You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit dbb7b53
Browse filesBrowse the repository at this point in the historyBrowse files
- VitePress `base` is `/openfetch-docs/` — prefix relative doc paths below with that base when resolving URLs (e.g. `/skills` → `https://openfetch-js.github.io/openfetch-docs/skills`).
12
12
- Path map: English at `/` (default), locale hubs at `/ar/`, `/es/`, …, hub at `/languages/`.
13
-
- Monorepo package layout & request lifecycle: `openFetch/docs/PROJECT_FLOW.md` in the GitHub repo.
13
+
- Package layout & request lifecycle: [docs/PROJECT_FLOW.md](https://github.com/openfetch-js/OpenFetch/blob/main/docs/PROJECT_FLOW.md) in the library repo.
14
14
15
15
## Install & import
16
16
@@ -105,7 +105,7 @@ import { createFluentClient } from "@hamdymohamedak/openfetch/sugar";
105
105
106
106
## Agent skills (Cursor, Claude Code, compatible tools)
107
107
108
-
The repo includes **`openfetchskill/`** — a **`SKILL.md`** skill aligned with the [Agent Skills specification](https://agentskills.io/specification) (YAML frontmatter + Markdown). Ecosystem hub: [skills.sh](https://skills.sh). Human docs page: `/skills` on the site above.
108
+
Published plugin: **[openfetch-js/openFetchSkill](https://github.com/openfetch-js/openFetchSkill)** (`SKILL.md` + `references/`). The same folder exists as **`openfetchskill/`** in **[openfetch-js/OpenFetch](https://github.com/openfetch-js/OpenFetch)**. Spec: [Agent Skills](https://agentskills.io/specification). Hub: [skills.sh](https://skills.sh). Human overview: [openfetch-docs `/skills`](https://openfetch-js.github.io/openfetch-docs/skills).
Copy file name to clipboardExpand all lines: README.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,4 +96,4 @@ Translated locales live under **`ar/`**, **`es/`**, etc. (same filenames where t
96
96
97
97
### Package version
98
98
99
-
The docs site reads the displayed version from **`.vitepress/openfetch-version.ts`** (single source of truth for pages, hero “Ask ChatGPT / Claude” links, and generated `public/llms.txt`). Bump that file when you cut a release. For runtime behavior details and file-level architecture, see `openFetch/docs/PROJECT_FLOW.md`.
99
+
The docs site reads the displayed version from **`.vitepress/openfetch-version.ts`** (single source of truth for pages, hero “Ask ChatGPT / Claude” links, and generated `public/llms.txt`). Bump that file when you cut a release. For runtime behavior details and file-level architecture, see [**`docs/PROJECT_FLOW.md`**](https://github.com/openfetch-js/OpenFetch/blob/main/docs/PROJECT_FLOW.md) in the library repository.
Copy file name to clipboardExpand all lines: ar/configuration.md
+12-4Lines changed: 12 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# الإعدادات
2
2
3
-
يُدمج الإعداد من **افتراضيات العميل** و**خيارات كل استدعاء** عبر `mergeConfig` (انظر قواعد الدمج أدناه).
3
+
يُدمج الإعداد من **افتراضيات العميل** و**خيارات كل استدعاء** عبر `mergeConfig` (انظر قواعد الدمج أدناه). للصورة الكاملة للمسار والميزات الجديدة راجع [الميزات ومسار الطلب](./features-pipeline.md).
4
4
5
5
## `OpenFetchConfig` (الطلب)
6
6
@@ -24,14 +24,21 @@
24
24
25
25
### المهلات والإلغاء
26
26
27
-
-**`timeout`** — بالمللي ثانية؛ يستخدم `AbortController` داخلياً يُدمج مع **`signal`**عبر `mergeAbortSignals`.
27
+
-**`timeout`** — بالمللي ثانية؛ يُدمج مع **`signal`**. إن انتهت **المهلة الداخلية** أولاً → **`ERR_TIMEOUT`**؛ إلغاء المستخدم على **`signal`**→ **`ERR_CANCELED`**.
28
28
-**`signal`** — `AbortSignal` خارجي؛ يُدمج مع مهلة الإلغاء.
إن وُجد، يستنتج JSON من `Content-Type: application/json`، وإلا يُقرأ كنص.
34
34
-**`validateStatus`** — `(status: number) => boolean`. الافتراضي: 200–299. إن رجع `false`، يُرمى **`OpenFetchError`** برمز `ERR_BAD_RESPONSE` مع إرفاق الاستجابة.
35
+
-**`throwHttpErrors`** — يُستخدم **فقط عند عدم** تعيين **`validateStatus`**: مثل Ky (`false` لا يرمي على حالة HTTP؛ دالة ترجع `true` تعني «ارمِ لهذه الحالة»). إن وُجد **`validateStatus`** يُتجاهل **`throwHttpErrors`**.
36
+
-**`jsonSchema`** — [Standard Schema](https://github.com/standard-schema/standard-schema) اختياري على JSON المحلّل بعد نجاح الحالة؛ الفشل → **`SchemaValidationError`** (قبل **`transformResponse`**).
-**`Request` كمدخل** — `client.request(request, تجاوزات?)` يدمج عنوان الطلب والطريقة والرؤوس والجسم والإشارة مع الافتراضيات.
28
+
-**`throwHttpErrors`** — سلوك قريب من Ky عند عدم وجود **`validateStatus`**: `false` لا يرمي على حالة HTTP؛ دالة ترجع `true` تعني «ارمِ خطأ HTTP لهذه الحالة». إن وُجد **`validateStatus`** فهو **يغلب**`throwHttpErrors`.
29
+
30
+
### المعترضات والوسيط
31
+
32
+
-**معترضات الطلب** — تسلسل غير متزامن (LIFO).
33
+
-**معترضات الاستجابة** — تسلسل غير متزامن (FIFO).
34
+
-**الوسيط** — حول `next()` حتى يصل الطلب إلى **`dispatch`** (استدعاء `fetch` الفعلي).
35
+
36
+
### `dispatch` (النقل)
37
+
38
+
- بناء URL، **`assertSafeUrl`** اختياري، رؤوس، **`Accept`** مقترح عند **`responseType`**، مصادقة Basic، **`transformRequest`**، ثم **`fetch`**.
39
+
-**`timeout`** — مع تمييز **`ERR_TIMEOUT`** عن إلغاء المستخدم **`ERR_CANCELED`** عندما يكون الإلغاء من المهلة الداخلية فقط.
40
+
-**`rawResponse`** — تخطي التحليل و`transformResponse`؛ `data` هي `Response` الأصلية.
41
+
42
+
### بعد `fetch` (المسار العادي)
43
+
44
+
1.**تحليل الجسم**
45
+
2.**`validateStatus`** — فشل → `ERR_BAD_RESPONSE` (مع الجسم المحلّل إن وُجد)
46
+
3.**`jsonSchema`** — تحقق Standard Schema اختياري؛ فشل → **`SchemaValidationError`**
47
+
4.**`transformResponse`**
48
+
49
+
### إعادة المحاولة
50
+
51
+
- backoff، حالات HTTP، الشبكة، مفتاح **Idempotency** لـ POST عند التفعيل، ميزانية زمنية أحادية **`timeoutTotalMs`**.
52
+
-**`onAfterResponse`** — بعد نجاح المحاولة؛ رمي **`OpenFetchForceRetry`** يعيد المحاولة.
53
+
-**`onBeforeRetry`** — بعد فشل محاولة وقبل الانتظار (عند وجود محاولة لاحقة).
54
+
-**`hooks()`** — يدمج `onBeforeRetry` / `onAfterResponse` في `ctx.request.retry`.
**داخل الوسيط (مثال `createRetryMiddleware`):** كل محاولة تنفّذ `await next()` فيمرّ الوسيط الداخلي ثم **`dispatch`**. عند النجاح يُستدعى **`onAfterResponse`**؛ إذا أُلقِي **`OpenFetchForceRetry`** تُعاد المحاولة. عند الفشل يُستدعى **`onBeforeRetry`** (إن وُجد) ثم الانتظار ثم المحاولة التالية إن سمحت السياسة.
82
+
83
+
### داخل `dispatch` (بعد `fetch` — ليس `rawResponse`)
0 commit comments