vigor-fetch 4.0.5 → 4.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +72 -11
- package/dist/index.d.cts +1405 -2551
- package/dist/index.d.ts +1405 -2551
- package/dist/index.js +72 -11
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,19 @@ type VigorApply<F extends VigorTypeLambda, In> = F extends {
|
|
|
8
8
|
readonly In: In;
|
|
9
9
|
})["Target"] : never;
|
|
10
10
|
|
|
11
|
+
type VigorBrand<Branch extends string, Name extends string> = string & {
|
|
12
|
+
__brand: `@vigor-fetch:::${Branch} <- ${Name}`;
|
|
13
|
+
};
|
|
14
|
+
declare const VigorDefault: symbol & {
|
|
15
|
+
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
16
|
+
};
|
|
17
|
+
type VigorDefaultType = typeof VigorDefault;
|
|
18
|
+
declare const VigorEmpty: symbol & {
|
|
19
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
20
|
+
};
|
|
21
|
+
type VigorEmptyType = typeof VigorEmpty;
|
|
22
|
+
type VigorExcludeEmpty<T> = Exclude<T, VigorEmptyType>;
|
|
23
|
+
|
|
11
24
|
type VigorPrimitive = string | number | bigint | boolean | symbol | null | undefined;
|
|
12
25
|
type VigorBuiltin = VigorPrimitive | Date | RegExp | Function | Map<any, any> | Set<any> | WeakMap<any, any> | WeakSet<any>;
|
|
13
26
|
type VigorDeepPartial<T> = unknown extends T ? T : T extends VigorBuiltin ? T : T extends readonly (infer U)[] ? readonly VigorDeepPartial<U>[] : {
|
|
@@ -25,37 +38,23 @@ type VigorReplaceType<T, K extends keyof T, V> = VigorSimplify<{
|
|
|
25
38
|
type VigorConcat<T extends readonly any[], U extends readonly any[]> = [...T, ...U];
|
|
26
39
|
type VigorLastOf<T extends readonly any[]> = T extends [...infer _, infer L] ? L : never;
|
|
27
40
|
type VigorReturnType<T> = T extends (...args: Array<any>) => any ? Awaited<ReturnType<T>> : never;
|
|
41
|
+
/**
|
|
42
|
+
* Resolves the effective result type for a builder that supports `.cast<T>()`.
|
|
43
|
+
*
|
|
44
|
+
* If `Cast` is anything other than the `VigorEmpty` sentinel (i.e. `.cast<T>()`
|
|
45
|
+
* was called at least once), it always wins — regardless of how many times
|
|
46
|
+
* `target()`/`strategies()`/etc. were called before or after it. Otherwise the
|
|
47
|
+
* naturally-inferred `Natural` type (e.g. derived from the target function's
|
|
48
|
+
* return type through the middleware pipeline) is used.
|
|
49
|
+
*/
|
|
50
|
+
type VigorCastResult<Cast, Natural> = [
|
|
51
|
+
VigorExcludeEmpty<Cast>
|
|
52
|
+
] extends [never] ? Natural : Cast;
|
|
28
53
|
type VigorMergeMode = "merge" | "replace" | "concat";
|
|
29
54
|
type VigorMergeStrategy<T> = T extends VigorBuiltin ? VigorMergeMode | undefined : T extends readonly any[] ? VigorMergeMode : {
|
|
30
55
|
[K in keyof T]?: VigorMergeStrategy<T[K]> | VigorMergeMode;
|
|
31
56
|
};
|
|
32
57
|
|
|
33
|
-
type VigorBrand<Branch extends string, Name extends string> = string & {
|
|
34
|
-
__brand: `@vigor-fetch:::${Branch} <- ${Name}`;
|
|
35
|
-
};
|
|
36
|
-
declare const VigorDefault: symbol & {
|
|
37
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
38
|
-
};
|
|
39
|
-
type VigorDefaultType = typeof VigorDefault;
|
|
40
|
-
declare const VigorEmpty: symbol & {
|
|
41
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
42
|
-
};
|
|
43
|
-
type VigorEmptyType = typeof VigorEmpty;
|
|
44
|
-
type VigorExcludeEmpty<T> = Exclude<T, VigorEmptyType>;
|
|
45
|
-
|
|
46
|
-
type VigorParseContextSchema<T extends VigorParseSchema<T>> = {
|
|
47
|
-
__brand: VigorBrand<"Parse", "Context<Schema">;
|
|
48
|
-
result: unknown | VigorDefaultType;
|
|
49
|
-
error: unknown;
|
|
50
|
-
response: VigorParsePolicySchema<T>["target"];
|
|
51
|
-
flags: {
|
|
52
|
-
overrided: boolean;
|
|
53
|
-
restarted: boolean;
|
|
54
|
-
};
|
|
55
|
-
record: Record<string, any>;
|
|
56
|
-
policy: T["policy"];
|
|
57
|
-
};
|
|
58
|
-
|
|
59
58
|
/**
|
|
60
59
|
* Base class for Vigor's immutable, chainable builder objects.
|
|
61
60
|
*
|
|
@@ -101,347 +100,191 @@ declare abstract class VigorStatus<Base, Config extends Base, TL extends VigorTy
|
|
|
101
100
|
get config(): Config;
|
|
102
101
|
}
|
|
103
102
|
|
|
104
|
-
type
|
|
105
|
-
__brand: VigorBrand<"
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
maxRestarts: number;
|
|
103
|
+
type VigorAllPolicySettingsSchema<T extends VigorAllSchema<T>> = {
|
|
104
|
+
__brand: VigorBrand<"All", "Policy<Settings<Schema">;
|
|
105
|
+
concurrency: number;
|
|
106
|
+
onlySuccess: boolean;
|
|
109
107
|
};
|
|
110
|
-
declare const
|
|
111
|
-
readonly __brand: VigorBrand<"
|
|
112
|
-
readonly
|
|
113
|
-
readonly
|
|
114
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
115
|
-
};
|
|
116
|
-
readonly maxRestarts: 3;
|
|
108
|
+
declare const VigorAllPolicySettingsBase: {
|
|
109
|
+
readonly __brand: VigorBrand<"All", "Policy<Settings<Schema">;
|
|
110
|
+
readonly concurrency: 5;
|
|
111
|
+
readonly onlySuccess: false;
|
|
117
112
|
};
|
|
118
|
-
/** Immutable builder for
|
|
119
|
-
declare class
|
|
113
|
+
/** Immutable builder for an all-policy's general settings. */
|
|
114
|
+
declare class VigorAllPolicySettings<T extends VigorAllSchema<T> = typeof VigorAllBase> extends VigorStatus<VigorAllSchema<any>, T, VigorAllPolicySettingsTypeLambda> {
|
|
120
115
|
constructor(config?: T);
|
|
121
|
-
protected _create<C>(config: C): VigorApply<
|
|
122
|
-
/**
|
|
123
|
-
|
|
124
|
-
readonly policy: {
|
|
125
|
-
readonly settings: {
|
|
126
|
-
readonly raw: N;
|
|
127
|
-
};
|
|
128
|
-
};
|
|
129
|
-
}>>>;
|
|
130
|
-
/** Sets the fallback value/factory used when parsing ultimately fails. */
|
|
131
|
-
default<const N extends VigorExcludeEmpty<VigorParseSchema<any>["policy"]["settings"]["default"]>>(func: N): VigorParsePolicySettings<VigorParseIn<VigorDeepMerge<T, {
|
|
116
|
+
protected _create<C>(config: C): VigorApply<VigorAllPolicySettingsTypeLambda, C>;
|
|
117
|
+
/** Sets the maximum number of tasks run concurrently. */
|
|
118
|
+
concurrency<const N extends VigorAllSchema<any>["policy"]["settings"]["concurrency"]>(num: N): VigorAllPolicySettings<VigorAllIn<VigorDeepMerge<T, {
|
|
132
119
|
readonly policy: {
|
|
133
120
|
readonly settings: {
|
|
134
|
-
readonly
|
|
121
|
+
readonly concurrency: N;
|
|
135
122
|
};
|
|
136
123
|
};
|
|
137
124
|
}>>>;
|
|
138
|
-
/**
|
|
139
|
-
|
|
125
|
+
/** When enabled, filters the final result down to only the tasks that succeeded. */
|
|
126
|
+
onlySuccess<const N extends VigorAllSchema<any>["policy"]["settings"]["onlySuccess"]>(bool: N): VigorAllPolicySettings<VigorAllIn<VigorDeepMerge<T, {
|
|
140
127
|
readonly policy: {
|
|
141
128
|
readonly settings: {
|
|
142
|
-
readonly
|
|
129
|
+
readonly onlySuccess: N;
|
|
143
130
|
};
|
|
144
131
|
};
|
|
145
132
|
}>>>;
|
|
146
133
|
}
|
|
147
134
|
|
|
148
|
-
type
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
};
|
|
155
|
-
declare const VigorParsePolicyMiddlewaresBase: {
|
|
156
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
157
|
-
readonly before: [];
|
|
158
|
-
readonly after: [];
|
|
159
|
-
readonly onResult: [];
|
|
160
|
-
readonly onError: [];
|
|
135
|
+
type VigorAllTask = () => unknown | Promise<unknown>;
|
|
136
|
+
type VigorAllPolicySchema<T extends VigorAllSchema<T>> = {
|
|
137
|
+
__brand: VigorBrand<"All", "Policy<Schema">;
|
|
138
|
+
target: VigorAllTask[];
|
|
139
|
+
settings: VigorAllPolicySettingsSchema<T>;
|
|
140
|
+
middlewares: VigorAllPolicyMiddlewaresSchema<T>;
|
|
161
141
|
};
|
|
162
|
-
|
|
163
|
-
__brand: VigorBrand<"
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
_mode: "fluent";
|
|
170
|
-
func: (ctx: T["context"]) => void;
|
|
171
|
-
};
|
|
172
|
-
onResult: {
|
|
173
|
-
_mode: "fluent";
|
|
174
|
-
func: (res: T["context"]["result"]) => VigorParseSchema<any>["context"]["result"];
|
|
142
|
+
declare const VigorAllPolicyBase: {
|
|
143
|
+
readonly __brand: VigorBrand<"All", "Policy<Schema">;
|
|
144
|
+
readonly target: VigorAllTask[];
|
|
145
|
+
readonly settings: {
|
|
146
|
+
readonly __brand: VigorBrand<"All", "Policy<Settings<Schema">;
|
|
147
|
+
readonly concurrency: 5;
|
|
148
|
+
readonly onlySuccess: false;
|
|
175
149
|
};
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
150
|
+
readonly middlewares: {
|
|
151
|
+
readonly __brand: VigorBrand<"All", "Policy<Middlewares<Schema">;
|
|
152
|
+
readonly before: VigorAllEachMiddlewareFn[];
|
|
153
|
+
readonly after: VigorAllEachMiddlewareFn[];
|
|
154
|
+
readonly onError: VigorAllEachOnErrorFn[];
|
|
179
155
|
};
|
|
180
156
|
};
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
157
|
+
|
|
158
|
+
type VigorAllContextSchema<T extends VigorAllSchema<T>> = {
|
|
159
|
+
__brand: VigorBrand<"All", "Context<Schema">;
|
|
160
|
+
result: unknown[] | VigorDefaultType;
|
|
161
|
+
policy: T["policy"];
|
|
162
|
+
record: Record<string, any>;
|
|
186
163
|
};
|
|
187
|
-
type
|
|
188
|
-
__brand: VigorBrand<"
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
after: {
|
|
194
|
-
_mode: "intercept";
|
|
195
|
-
func: (ctx: T["context"], api: Pick<VigorParsePolicyMiddlewaresApi<T>, "setResult" | "throwError">) => VigorParseSchema<any>["context"] | Promise<VigorParseSchema<any>["context"]>;
|
|
196
|
-
};
|
|
197
|
-
onResult: {
|
|
198
|
-
_mode: "intercept";
|
|
199
|
-
func: (ctx: T["context"], api: Pick<VigorParsePolicyMiddlewaresApi<T>, "setResult" | "throwError">) => VigorParseSchema<any>["context"] | Promise<VigorParseSchema<any>["context"]>;
|
|
200
|
-
};
|
|
201
|
-
onError: {
|
|
202
|
-
_mode: "intercept";
|
|
203
|
-
func: (ctx: T["context"], api: Pick<VigorParsePolicyMiddlewaresApi<T>, "setResult" | "throwError" | "proceedRestart" | "cancelRestart">) => VigorParseSchema<any>["context"] | Promise<VigorParseSchema<any>["context"]>;
|
|
164
|
+
type VigorAllEachContextSchema<T extends VigorAllSchema<T>> = {
|
|
165
|
+
__brand: VigorBrand<"All", "EachContext<Schema">;
|
|
166
|
+
result: unknown | VigorDefaultType;
|
|
167
|
+
error: unknown;
|
|
168
|
+
flags: {
|
|
169
|
+
overrided: boolean;
|
|
204
170
|
};
|
|
171
|
+
record: Record<string, any>;
|
|
205
172
|
};
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
173
|
+
|
|
174
|
+
type VigorAllEachMiddlewareFn = (ctx: VigorAllEachContextSchema<any>) => void | Promise<void>;
|
|
175
|
+
type VigorAllEachOnErrorFn = (ctx: VigorAllEachContextSchema<any>, api: {
|
|
176
|
+
setResult: (r: unknown) => void;
|
|
177
|
+
}) => void | Promise<void>;
|
|
178
|
+
type VigorAllPolicyMiddlewaresSchema<T extends VigorAllSchema<T>> = {
|
|
179
|
+
__brand: VigorBrand<"All", "Policy<Middlewares<Schema">;
|
|
180
|
+
before: VigorAllEachMiddlewareFn[];
|
|
181
|
+
after: VigorAllEachMiddlewareFn[];
|
|
182
|
+
onError: VigorAllEachOnErrorFn[];
|
|
183
|
+
};
|
|
184
|
+
declare const VigorAllPolicyMiddlewaresBase: {
|
|
185
|
+
readonly __brand: VigorBrand<"All", "Policy<Middlewares<Schema">;
|
|
186
|
+
readonly before: VigorAllEachMiddlewareFn[];
|
|
187
|
+
readonly after: VigorAllEachMiddlewareFn[];
|
|
188
|
+
readonly onError: VigorAllEachOnErrorFn[];
|
|
189
|
+
};
|
|
190
|
+
/** Immutable builder for an all-policy's per-task middleware pipeline (`before`, `after`, `onError`). */
|
|
191
|
+
declare class VigorAllPolicyMiddlewares<T extends VigorAllSchema<T> = typeof VigorAllBase> extends VigorStatus<VigorAllSchema<any>, T, VigorAllPolicyMiddlewaresTypeLambda> {
|
|
213
192
|
constructor(config?: T);
|
|
214
|
-
protected _create<C>(config: C): VigorApply<
|
|
215
|
-
/** Registers a middleware that runs before
|
|
216
|
-
before<const N extends
|
|
217
|
-
policy: {
|
|
218
|
-
middlewares: {
|
|
219
|
-
before: [
|
|
220
|
-
_mode: "fluent";
|
|
221
|
-
func: N;
|
|
222
|
-
}];
|
|
193
|
+
protected _create<C>(config: C): VigorApply<VigorAllPolicyMiddlewaresTypeLambda, C>;
|
|
194
|
+
/** Registers a middleware that runs before each task is invoked. */
|
|
195
|
+
before<const N extends VigorAllEachMiddlewareFn>(func: N): VigorAllPolicyMiddlewares<VigorAllIn<VigorDeepMerge<T, {
|
|
196
|
+
readonly policy: {
|
|
197
|
+
readonly middlewares: {
|
|
198
|
+
readonly before: readonly [N];
|
|
223
199
|
};
|
|
224
200
|
};
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
func: N;
|
|
232
|
-
}];
|
|
201
|
+
}>>>;
|
|
202
|
+
/** Registers a middleware that runs after each task settles successfully. */
|
|
203
|
+
after<const N extends VigorAllEachMiddlewareFn>(func: N): VigorAllPolicyMiddlewares<VigorAllIn<VigorDeepMerge<T, {
|
|
204
|
+
readonly policy: {
|
|
205
|
+
readonly middlewares: {
|
|
206
|
+
readonly after: readonly [N];
|
|
233
207
|
};
|
|
234
208
|
};
|
|
235
|
-
}
|
|
236
|
-
/** Registers a middleware that runs
|
|
237
|
-
|
|
238
|
-
policy: {
|
|
239
|
-
middlewares: {
|
|
240
|
-
|
|
241
|
-
_mode: "fluent";
|
|
242
|
-
func: N;
|
|
243
|
-
}];
|
|
209
|
+
}>>>;
|
|
210
|
+
/** Registers a middleware that runs when an individual task fails. */
|
|
211
|
+
onError<const N extends VigorAllEachOnErrorFn>(func: N): VigorAllPolicyMiddlewares<VigorAllIn<VigorDeepMerge<T, {
|
|
212
|
+
readonly policy: {
|
|
213
|
+
readonly middlewares: {
|
|
214
|
+
readonly onError: readonly [N];
|
|
244
215
|
};
|
|
245
216
|
};
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
}];
|
|
265
|
-
};
|
|
266
|
-
};
|
|
267
|
-
}>>;
|
|
268
|
-
onResult<const N extends VigorParsePolicyMiddlewaresIntercept<any>["onResult"]["func"]>(type: "intercept", func: N): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
269
|
-
policy: {
|
|
270
|
-
middlewares: {
|
|
271
|
-
onResult: [{
|
|
272
|
-
_mode: "intercept";
|
|
273
|
-
func: N;
|
|
274
|
-
}];
|
|
275
|
-
};
|
|
276
|
-
};
|
|
277
|
-
}>>;
|
|
278
|
-
/** Registers a middleware that runs when parsing ultimately fails. */
|
|
279
|
-
onError<const N extends VigorParsePolicyMiddlewaresFluent<any>["onError"]["func"]>(type: "fluent", func: N): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
280
|
-
policy: {
|
|
281
|
-
middlewares: {
|
|
282
|
-
onError: [{
|
|
283
|
-
_mode: "fluent";
|
|
284
|
-
func: N;
|
|
285
|
-
}];
|
|
286
|
-
};
|
|
287
|
-
};
|
|
288
|
-
}>>;
|
|
289
|
-
onError<const N extends VigorParsePolicyMiddlewaresIntercept<any>["onError"]["func"]>(type: "intercept", func: N): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
290
|
-
policy: {
|
|
291
|
-
middlewares: {
|
|
292
|
-
onError: [{
|
|
293
|
-
_mode: "intercept";
|
|
294
|
-
func: N;
|
|
295
|
-
}];
|
|
296
|
-
};
|
|
297
|
-
};
|
|
298
|
-
}>>;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
type VigorParsePolicySchema<T extends VigorParseSchema<T>> = {
|
|
302
|
-
__brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
303
|
-
target: Request | Response | VigorDefaultType;
|
|
304
|
-
settings: VigorParsePolicySettingsSchema<T>;
|
|
305
|
-
middlewares: VigorParsePolicyMiddlewaresSchema<T>;
|
|
306
|
-
strategies: VigorParsePolicyStrategiesSchema<T>;
|
|
307
|
-
};
|
|
308
|
-
declare const VigorParsePolicyBase: {
|
|
309
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
310
|
-
readonly target: symbol & {
|
|
311
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
312
|
-
};
|
|
313
|
-
readonly settings: {
|
|
314
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
315
|
-
readonly raw: false;
|
|
316
|
-
readonly default: symbol & {
|
|
317
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
318
|
-
};
|
|
319
|
-
readonly maxRestarts: 3;
|
|
320
|
-
};
|
|
321
|
-
readonly middlewares: {
|
|
322
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
323
|
-
readonly before: [];
|
|
324
|
-
readonly after: [];
|
|
325
|
-
readonly onResult: [];
|
|
326
|
-
readonly onError: [];
|
|
327
|
-
};
|
|
328
|
-
readonly strategies: {
|
|
329
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
330
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
331
|
-
};
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
type VigorParseSchema<T extends VigorParseSchema<T>> = {
|
|
335
|
-
__brand: VigorBrand<"Parse", "Schema">;
|
|
336
|
-
policy: VigorParsePolicySchema<T>;
|
|
337
|
-
context: VigorParseContextSchema<T>;
|
|
338
|
-
};
|
|
339
|
-
declare const VigorParseBase: {
|
|
340
|
-
readonly __brand: VigorBrand<"Parse", "Schema">;
|
|
341
|
-
readonly policy: {
|
|
342
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
343
|
-
readonly target: symbol & {
|
|
344
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
345
|
-
};
|
|
346
|
-
readonly settings: {
|
|
347
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
348
|
-
readonly raw: false;
|
|
349
|
-
readonly default: symbol & {
|
|
350
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
351
|
-
};
|
|
352
|
-
readonly maxRestarts: 3;
|
|
217
|
+
}>>>;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
type VigorAllSchema<T extends VigorAllSchema<T>> = {
|
|
221
|
+
__brand: VigorBrand<"All", "Schema">;
|
|
222
|
+
policy: VigorAllPolicySchema<T>;
|
|
223
|
+
/** Type-level override for the resolved result type, set via `.cast<T>()`. */
|
|
224
|
+
cast: unknown;
|
|
225
|
+
};
|
|
226
|
+
declare const VigorAllBase: {
|
|
227
|
+
readonly __brand: VigorBrand<"All", "Schema">;
|
|
228
|
+
readonly policy: {
|
|
229
|
+
readonly __brand: VigorBrand<"All", "Policy<Schema">;
|
|
230
|
+
readonly target: VigorAllTask[];
|
|
231
|
+
readonly settings: {
|
|
232
|
+
readonly __brand: VigorBrand<"All", "Policy<Settings<Schema">;
|
|
233
|
+
readonly concurrency: 5;
|
|
234
|
+
readonly onlySuccess: false;
|
|
353
235
|
};
|
|
354
236
|
readonly middlewares: {
|
|
355
|
-
readonly __brand: VigorBrand<"
|
|
356
|
-
readonly before: [];
|
|
357
|
-
readonly after: [];
|
|
358
|
-
readonly
|
|
359
|
-
readonly onError: [];
|
|
360
|
-
};
|
|
361
|
-
readonly strategies: {
|
|
362
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
363
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
237
|
+
readonly __brand: VigorBrand<"All", "Policy<Middlewares<Schema">;
|
|
238
|
+
readonly before: VigorAllEachMiddlewareFn[];
|
|
239
|
+
readonly after: VigorAllEachMiddlewareFn[];
|
|
240
|
+
readonly onError: VigorAllEachOnErrorFn[];
|
|
364
241
|
};
|
|
365
242
|
};
|
|
366
|
-
readonly
|
|
367
|
-
|
|
368
|
-
readonly result: symbol & {
|
|
369
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
370
|
-
};
|
|
371
|
-
readonly error: symbol & {
|
|
372
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
373
|
-
};
|
|
374
|
-
readonly response: symbol & {
|
|
375
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
376
|
-
};
|
|
377
|
-
readonly flags: {
|
|
378
|
-
readonly overrided: false;
|
|
379
|
-
readonly restarted: false;
|
|
380
|
-
};
|
|
381
|
-
readonly record: {};
|
|
382
|
-
readonly policy: {
|
|
383
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
384
|
-
readonly target: symbol & {
|
|
385
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
386
|
-
};
|
|
387
|
-
readonly settings: {
|
|
388
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
389
|
-
readonly raw: false;
|
|
390
|
-
readonly default: symbol & {
|
|
391
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
392
|
-
};
|
|
393
|
-
readonly maxRestarts: 3;
|
|
394
|
-
};
|
|
395
|
-
readonly middlewares: {
|
|
396
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
397
|
-
readonly before: [];
|
|
398
|
-
readonly after: [];
|
|
399
|
-
readonly onResult: [];
|
|
400
|
-
readonly onError: [];
|
|
401
|
-
};
|
|
402
|
-
readonly strategies: {
|
|
403
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
404
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
405
|
-
};
|
|
406
|
-
};
|
|
243
|
+
readonly cast: symbol & {
|
|
244
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
407
245
|
};
|
|
408
246
|
};
|
|
409
247
|
/**
|
|
410
|
-
* Immutable builder that
|
|
411
|
-
*
|
|
412
|
-
*
|
|
248
|
+
* Immutable builder that runs a list of independent tasks with bounded
|
|
249
|
+
* concurrency, per-task middleware, and either an all-results or
|
|
250
|
+
* only-successes result mode.
|
|
413
251
|
*/
|
|
414
|
-
declare class
|
|
252
|
+
declare class VigorAll<T extends VigorAllSchema<T> = typeof VigorAllBase> extends VigorStatus<VigorAllSchema<T>, T, VigorAllTypeLambda> {
|
|
415
253
|
constructor(config?: T);
|
|
416
|
-
protected _create<C>(config: C): VigorApply<
|
|
417
|
-
/** Sets the
|
|
418
|
-
target<const N extends
|
|
254
|
+
protected _create<C>(config: C): VigorApply<VigorAllTypeLambda, C>;
|
|
255
|
+
/** Sets the list of tasks to run. */
|
|
256
|
+
target<const N extends VigorAllTask[]>(...funcs: N): VigorAll<VigorAllIn<VigorDeepMerge<T, {
|
|
419
257
|
readonly policy: {
|
|
420
258
|
readonly target: N;
|
|
421
259
|
};
|
|
422
260
|
}>>>;
|
|
423
|
-
/** Configures the
|
|
424
|
-
settings<const N extends VigorDeepPartial<
|
|
261
|
+
/** Configures the all-policy's general settings (concurrency, onlySuccess). */
|
|
262
|
+
settings<const N extends VigorDeepPartial<VigorAllPolicySettingsSchema<T>>, R extends VigorAllSchema<any>>(input: N | ((s: VigorAllPolicySettings<T>) => VigorAllPolicySettings<R>) | VigorAllPolicySettings<R>): VigorAll<VigorAllIn<VigorDeepMerge<T, {
|
|
425
263
|
readonly policy: {
|
|
426
|
-
readonly settings:
|
|
264
|
+
readonly settings: VigorAllPolicySettingsSchema<any>;
|
|
427
265
|
};
|
|
428
266
|
}>>>;
|
|
429
|
-
/** Configures the
|
|
430
|
-
middlewares<const N extends VigorDeepPartial<
|
|
267
|
+
/** Configures the all-policy's per-task middleware pipeline. */
|
|
268
|
+
middlewares<const N extends VigorDeepPartial<VigorAllPolicyMiddlewaresSchema<T>>, R extends VigorAllSchema<any>>(input: N | ((s: VigorAllPolicyMiddlewares<T>) => VigorAllPolicyMiddlewares<R>) | VigorAllPolicyMiddlewares<R>): VigorAll<VigorAllIn<VigorDeepMerge<T, {
|
|
431
269
|
readonly policy: {
|
|
432
|
-
readonly middlewares:
|
|
270
|
+
readonly middlewares: VigorAllPolicyMiddlewaresSchema<any>;
|
|
433
271
|
};
|
|
434
272
|
}>>>;
|
|
435
|
-
/**
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
273
|
+
/** Runs a single task through the before/after/onError middleware pipeline. */
|
|
274
|
+
private _runTask;
|
|
275
|
+
/**
|
|
276
|
+
* Overrides the resolved result type with `T`, taking priority over the
|
|
277
|
+
* naturally-inferred `unknown[]`. Can be called before or after
|
|
278
|
+
* `target()` (or any other configuration method); whichever `.cast<T>()`
|
|
279
|
+
* call happens last wins.
|
|
280
|
+
*/
|
|
281
|
+
cast<const C>(): VigorAll<VigorAllIn<VigorDeepMerge<T, {
|
|
282
|
+
cast: C;
|
|
440
283
|
}>>>;
|
|
441
|
-
/** Runs
|
|
442
|
-
request<R = T["
|
|
443
|
-
/** Runs
|
|
444
|
-
requestVerbose<R = T["
|
|
284
|
+
/** Runs all tasks and returns the results array directly, throwing on final failure. */
|
|
285
|
+
request<R = VigorCastResult<T["cast"], unknown[]>>(): Promise<R>;
|
|
286
|
+
/** Runs all tasks and returns a result/error envelope instead of throwing. */
|
|
287
|
+
requestVerbose<R = VigorCastResult<T["cast"], unknown[]>>(): Promise<{
|
|
445
288
|
success: false;
|
|
446
289
|
data: null;
|
|
447
290
|
error: unknown;
|
|
@@ -450,218 +293,178 @@ declare class VigorParse<T extends VigorParseSchema<T> = typeof VigorParseBase>
|
|
|
450
293
|
data: R;
|
|
451
294
|
error: null;
|
|
452
295
|
}>;
|
|
453
|
-
/** Internal execution loop implementing the
|
|
296
|
+
/** Internal execution loop implementing the bounded-concurrency worker pool. */
|
|
454
297
|
private requestRuntime;
|
|
455
298
|
}
|
|
456
299
|
|
|
457
|
-
type
|
|
458
|
-
interface
|
|
459
|
-
readonly Target:
|
|
460
|
-
}
|
|
461
|
-
interface VigorParsePolicySettingsTypeLambda extends VigorTypeLambda {
|
|
462
|
-
readonly Target: VigorParsePolicySettings<VigorParseIn<this["In"]>>;
|
|
300
|
+
type VigorAllIn<T> = T extends VigorAllSchema<any> ? T : never;
|
|
301
|
+
interface VigorAllTypeLambda extends VigorTypeLambda {
|
|
302
|
+
readonly Target: VigorAll<VigorAllIn<this["In"]>>;
|
|
463
303
|
}
|
|
464
|
-
interface
|
|
465
|
-
readonly Target:
|
|
304
|
+
interface VigorAllPolicySettingsTypeLambda extends VigorTypeLambda {
|
|
305
|
+
readonly Target: VigorAllPolicySettings<VigorAllIn<this["In"]>>;
|
|
466
306
|
}
|
|
467
|
-
interface
|
|
468
|
-
readonly Target:
|
|
307
|
+
interface VigorAllPolicyMiddlewaresTypeLambda extends VigorTypeLambda {
|
|
308
|
+
readonly Target: VigorAllPolicyMiddlewares<VigorAllIn<this["In"]>>;
|
|
469
309
|
}
|
|
470
310
|
|
|
471
|
-
type
|
|
472
|
-
type
|
|
473
|
-
|
|
474
|
-
|
|
311
|
+
type VigorFetchExtraOptions = Omit<RequestInit, "method" | "headers" | "body" | "signal">;
|
|
312
|
+
type VigorFetchOptions = VigorFetchExtraOptions & {
|
|
313
|
+
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "CONNECT" | "TRACE";
|
|
314
|
+
headers: Record<string, string>;
|
|
315
|
+
body?: BodyInit | null;
|
|
316
|
+
signal?: AbortSignal;
|
|
475
317
|
};
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
318
|
+
/**
|
|
319
|
+
* Base shape shared by every fetch context variant. `R` is the type of
|
|
320
|
+
* `result` at the point the context is observed — computed per pipeline
|
|
321
|
+
* stage instead of being fixed on the schema.
|
|
322
|
+
*/
|
|
323
|
+
type VigorFetchContextSchema<T extends VigorFetchSchema<T>, R = VigorCastResult<T["cast"], unknown> | VigorDefaultType> = {
|
|
324
|
+
__brand: VigorBrand<"Fetch", "Context<Schema">;
|
|
325
|
+
href: string;
|
|
326
|
+
response: Response | VigorDefaultType;
|
|
327
|
+
result: R;
|
|
328
|
+
error: unknown;
|
|
329
|
+
options: VigorFetchOptions | VigorDefaultType;
|
|
330
|
+
flags: {
|
|
331
|
+
overrided: boolean;
|
|
332
|
+
restarted: boolean;
|
|
333
|
+
};
|
|
334
|
+
record: Record<string, any>;
|
|
335
|
+
policy: T["policy"];
|
|
479
336
|
};
|
|
480
|
-
/**
|
|
481
|
-
|
|
482
|
-
/**
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
337
|
+
/** Context shape seen by `before` middlewares — the request hasn't been sent yet. */
|
|
338
|
+
type VigorFetchBeforeContextSchema<T extends VigorFetchSchema<T>> = VigorFetchContextSchema<T, VigorDefaultType>;
|
|
339
|
+
/** Context shape seen by `after` / `onResult` middlewares — a response has been received/parsed. */
|
|
340
|
+
type VigorFetchAfterContextSchema<T extends VigorFetchSchema<T>> = VigorFetchContextSchema<T, VigorCastResult<T["cast"], unknown> | VigorDefaultType>;
|
|
341
|
+
|
|
342
|
+
type VigorFetchPolicySettingsSchema<T extends VigorFetchSchema<T>> = {
|
|
343
|
+
__brand: VigorBrand<"Fetch", "Policy<Settings<Schema">;
|
|
344
|
+
retryHeaders: string[];
|
|
345
|
+
unretryStatus: number[];
|
|
346
|
+
maxRestarts: number;
|
|
347
|
+
default: ((ctx: VigorFetchContextSchema<T>) => any | Promise<any>) | VigorEmptyType;
|
|
348
|
+
};
|
|
349
|
+
declare const VigorFetchPolicySettingsBase: {
|
|
350
|
+
readonly __brand: VigorBrand<"Fetch", "Policy<Settings<Schema">;
|
|
351
|
+
readonly retryHeaders: ["retry-after", "ratelimit-reset", "x-ratelimit-reset", "x-retry-after", "x-amz-retry-after", "chrome-proxy-next-link"];
|
|
352
|
+
readonly unretryStatus: [400, 401, 403, 404, 405, 413, 422];
|
|
353
|
+
readonly maxRestarts: 3;
|
|
354
|
+
readonly default: symbol & {
|
|
355
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
356
|
+
};
|
|
357
|
+
};
|
|
358
|
+
/** Immutable builder for a fetch policy's general settings. */
|
|
359
|
+
declare class VigorFetchPolicySettings<T extends VigorFetchSchema<T> = typeof VigorFetchBase> extends VigorStatus<VigorFetchSchema<any>, T, VigorFetchPolicySettingsTypeLambda> {
|
|
486
360
|
constructor(config?: T);
|
|
487
|
-
protected _create<C>(config: C): VigorApply<
|
|
488
|
-
/**
|
|
489
|
-
|
|
490
|
-
*
|
|
491
|
-
* @param replace - When `true`, replaces the existing chain instead of
|
|
492
|
-
* appending to it (the default is to concat, since strategies are
|
|
493
|
-
* tried in sequence as a fallback chain).
|
|
494
|
-
*/
|
|
495
|
-
private _set;
|
|
496
|
-
/** Adds the content-type based parsing strategy. */
|
|
497
|
-
contentType(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
361
|
+
protected _create<C>(config: C): VigorApply<VigorFetchPolicySettingsTypeLambda, C>;
|
|
362
|
+
/** Sets response headers consulted to compute a server-suggested retry delay. */
|
|
363
|
+
retryHeaders<const N extends VigorFetchSchema<any>["policy"]["settings"]["retryHeaders"]>(...strs: N): VigorFetchPolicySettings<VigorFetchIn<VigorDeepMerge<T, {
|
|
498
364
|
readonly policy: {
|
|
499
|
-
readonly
|
|
500
|
-
readonly
|
|
501
|
-
};
|
|
502
|
-
};
|
|
503
|
-
}>>>;
|
|
504
|
-
/** Adds the sniffing (try-each-method) parsing strategy. */
|
|
505
|
-
sniff(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
506
|
-
readonly policy: {
|
|
507
|
-
readonly strategies: {
|
|
508
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
509
|
-
};
|
|
510
|
-
};
|
|
511
|
-
}>>>;
|
|
512
|
-
/** Adds a strategy that always parses the response as JSON. */
|
|
513
|
-
json(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
514
|
-
readonly policy: {
|
|
515
|
-
readonly strategies: {
|
|
516
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
517
|
-
};
|
|
518
|
-
};
|
|
519
|
-
}>>>;
|
|
520
|
-
/** Adds a strategy that always parses the response as text. */
|
|
521
|
-
text(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
522
|
-
readonly policy: {
|
|
523
|
-
readonly strategies: {
|
|
524
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
525
|
-
};
|
|
526
|
-
};
|
|
527
|
-
}>>>;
|
|
528
|
-
/** Adds a strategy that always parses the response as an `ArrayBuffer`. */
|
|
529
|
-
arrayBuffer(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
530
|
-
readonly policy: {
|
|
531
|
-
readonly strategies: {
|
|
532
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
533
|
-
};
|
|
534
|
-
};
|
|
535
|
-
}>>>;
|
|
536
|
-
/** Adds a strategy that always parses the response as a `Blob`. */
|
|
537
|
-
blob(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
538
|
-
readonly policy: {
|
|
539
|
-
readonly strategies: {
|
|
540
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
365
|
+
readonly settings: {
|
|
366
|
+
readonly retryHeaders: N;
|
|
541
367
|
};
|
|
542
368
|
};
|
|
543
369
|
}>>>;
|
|
544
|
-
/**
|
|
545
|
-
|
|
370
|
+
/** Sets HTTP status codes that should never be retried. */
|
|
371
|
+
unretryStatus<const N extends VigorFetchSchema<any>["policy"]["settings"]["unretryStatus"]>(...nums: N): VigorFetchPolicySettings<VigorFetchIn<VigorDeepMerge<T, {
|
|
546
372
|
readonly policy: {
|
|
547
|
-
readonly
|
|
548
|
-
readonly
|
|
373
|
+
readonly settings: {
|
|
374
|
+
readonly unretryStatus: N;
|
|
549
375
|
};
|
|
550
376
|
};
|
|
551
377
|
}>>>;
|
|
552
|
-
/**
|
|
553
|
-
|
|
378
|
+
/** Sets the maximum number of full restarts allowed. */
|
|
379
|
+
maxRestarts<const N extends VigorFetchSchema<any>["policy"]["settings"]["maxRestarts"]>(num: N): VigorFetchPolicySettings<VigorFetchIn<VigorDeepMerge<T, {
|
|
554
380
|
readonly policy: {
|
|
555
|
-
readonly
|
|
556
|
-
readonly
|
|
381
|
+
readonly settings: {
|
|
382
|
+
readonly maxRestarts: N;
|
|
557
383
|
};
|
|
558
384
|
};
|
|
559
385
|
}>>>;
|
|
560
|
-
/**
|
|
561
|
-
|
|
386
|
+
/** Sets the fallback value/factory used when the request ultimately fails. */
|
|
387
|
+
default<const N extends VigorExcludeEmpty<VigorFetchSchema<any>["policy"]["settings"]["default"]>>(func: N): VigorFetchPolicySettings<VigorFetchIn<VigorDeepMerge<T, {
|
|
562
388
|
readonly policy: {
|
|
563
|
-
readonly
|
|
564
|
-
readonly
|
|
389
|
+
readonly settings: {
|
|
390
|
+
readonly default: N;
|
|
565
391
|
};
|
|
566
392
|
};
|
|
567
393
|
}>>>;
|
|
568
394
|
}
|
|
569
395
|
|
|
570
|
-
type
|
|
571
|
-
__brand: VigorBrand<"
|
|
572
|
-
before: (
|
|
573
|
-
after: (
|
|
574
|
-
onResult: (
|
|
575
|
-
|
|
576
|
-
onRetry: (VigorRetryPolicyMiddlewaresFluent<T>["onRetry"] | VigorRetryPolicyMiddlewaresIntercept<T>["onRetry"])[];
|
|
577
|
-
onError: (VigorRetryPolicyMiddlewaresFluent<T>["onError"] | VigorRetryPolicyMiddlewaresIntercept<T>["onError"])[];
|
|
396
|
+
type VigorFetchPolicyMiddlewaresSchema<T extends VigorFetchSchema<T>> = {
|
|
397
|
+
__brand: VigorBrand<"Fetch", "Policy<Middlewares<Schema">;
|
|
398
|
+
before: (VigorFetchPolicyMiddlewaresFluent<T>["before"] | VigorFetchPolicyMiddlewaresIntercept<T>["before"])[];
|
|
399
|
+
after: (VigorFetchPolicyMiddlewaresFluent<T>["after"] | VigorFetchPolicyMiddlewaresIntercept<T>["after"])[];
|
|
400
|
+
onResult: (VigorFetchPolicyMiddlewaresFluent<T>["onResult"] | VigorFetchPolicyMiddlewaresIntercept<T>["onResult"])[];
|
|
401
|
+
onError: (VigorFetchPolicyMiddlewaresFluent<T>["onError"] | VigorFetchPolicyMiddlewaresIntercept<T>["onError"])[];
|
|
578
402
|
};
|
|
579
|
-
declare const
|
|
580
|
-
readonly __brand: VigorBrand<"
|
|
403
|
+
declare const VigorFetchPolicyMiddlewaresBase: {
|
|
404
|
+
readonly __brand: VigorBrand<"Fetch", "Policy<Middlewares<Schema">;
|
|
581
405
|
readonly before: [];
|
|
582
406
|
readonly after: [];
|
|
583
407
|
readonly onResult: [];
|
|
584
|
-
readonly retryIf: [];
|
|
585
|
-
readonly onRetry: [];
|
|
586
408
|
readonly onError: [];
|
|
587
409
|
};
|
|
588
|
-
type
|
|
589
|
-
__brand: VigorBrand<"
|
|
410
|
+
type VigorFetchPolicyMiddlewaresFluent<T extends VigorFetchSchema<T>> = {
|
|
411
|
+
__brand: VigorBrand<"Fetch", "Policy<Middlewares<Fluent<Schema">;
|
|
590
412
|
before: {
|
|
591
413
|
_mode: "fluent";
|
|
592
|
-
func: (ctx: T
|
|
414
|
+
func: (ctx: VigorFetchBeforeContextSchema<T>) => void;
|
|
593
415
|
};
|
|
594
416
|
after: {
|
|
595
417
|
_mode: "fluent";
|
|
596
|
-
func: (ctx: T
|
|
418
|
+
func: (ctx: VigorFetchAfterContextSchema<T>) => void;
|
|
597
419
|
};
|
|
598
420
|
onResult: {
|
|
599
421
|
_mode: "fluent";
|
|
600
|
-
func: (res: T["
|
|
601
|
-
};
|
|
602
|
-
retryIf: {
|
|
603
|
-
_mode: "fluent";
|
|
604
|
-
func: (err: T["context"]["error"]) => VigorRetrySchema<any>["context"]["flags"]["doRetry"];
|
|
605
|
-
};
|
|
606
|
-
onRetry: {
|
|
607
|
-
_mode: "fluent";
|
|
608
|
-
func: (err: T["context"]["error"]) => void;
|
|
422
|
+
func: (res: VigorFetchAfterContextSchema<T>["result"]) => VigorFetchContextSchema<any>["result"];
|
|
609
423
|
};
|
|
610
424
|
onError: {
|
|
611
425
|
_mode: "fluent";
|
|
612
|
-
func: (err: T["
|
|
426
|
+
func: (err: VigorFetchContextSchema<T>["error"]) => void;
|
|
613
427
|
};
|
|
614
428
|
};
|
|
615
|
-
type
|
|
616
|
-
setResult: (res:
|
|
617
|
-
throwError: (err:
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
cancelRetry: () => void;
|
|
622
|
-
setDelay: (num: VigorRetrySchema<any>["context"]["system"]["delay"]) => void;
|
|
429
|
+
type VigorFetchPolicyMiddlewaresApi<T extends VigorFetchSchema<T>> = {
|
|
430
|
+
setResult: (res: VigorFetchContextSchema<any>["result"]) => void;
|
|
431
|
+
throwError: (err: VigorFetchContextSchema<any>["error"]) => void;
|
|
432
|
+
setOptions: (opts: VigorFetchOptions) => void;
|
|
433
|
+
setHeaders: (headers: VigorFetchOptions["headers"]) => void;
|
|
434
|
+
setBody: (body: VigorFetchOptions["body"]) => void;
|
|
623
435
|
proceedRestart: () => void;
|
|
624
436
|
cancelRestart: () => void;
|
|
625
437
|
};
|
|
626
|
-
type
|
|
627
|
-
__brand: VigorBrand<"
|
|
438
|
+
type VigorFetchPolicyMiddlewaresIntercept<T extends VigorFetchSchema<T>> = {
|
|
439
|
+
__brand: VigorBrand<"Fetch", "Policy<Middlewares<Intercept<Schema">;
|
|
628
440
|
before: {
|
|
629
441
|
_mode: "intercept";
|
|
630
|
-
func: (ctx: T
|
|
442
|
+
func: (ctx: VigorFetchBeforeContextSchema<T>, api: Pick<VigorFetchPolicyMiddlewaresApi<T>, "throwError" | "setOptions" | "setHeaders" | "setBody">) => VigorFetchContextSchema<any> | Promise<VigorFetchContextSchema<any>>;
|
|
631
443
|
};
|
|
632
444
|
after: {
|
|
633
445
|
_mode: "intercept";
|
|
634
|
-
func: (ctx: T
|
|
446
|
+
func: (ctx: VigorFetchAfterContextSchema<T>, api: Pick<VigorFetchPolicyMiddlewaresApi<T>, "setResult" | "throwError">) => VigorFetchContextSchema<any> | Promise<VigorFetchContextSchema<any>>;
|
|
635
447
|
};
|
|
636
448
|
onResult: {
|
|
637
449
|
_mode: "intercept";
|
|
638
|
-
func: (ctx: T
|
|
639
|
-
};
|
|
640
|
-
retryIf: {
|
|
641
|
-
_mode: "intercept";
|
|
642
|
-
func: (ctx: T["context"], api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "proceedRetry" | "cancelRetry">) => VigorRetrySchema<any>["context"] | Promise<VigorRetrySchema<any>["context"]>;
|
|
643
|
-
};
|
|
644
|
-
onRetry: {
|
|
645
|
-
_mode: "intercept";
|
|
646
|
-
func: (ctx: T["context"], api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "throwError" | "setDelay">) => VigorRetrySchema<any>["context"] | Promise<VigorRetrySchema<any>["context"]>;
|
|
450
|
+
func: (ctx: VigorFetchAfterContextSchema<T>, api: Pick<VigorFetchPolicyMiddlewaresApi<T>, "setResult" | "throwError">) => VigorFetchContextSchema<any> | Promise<VigorFetchContextSchema<any>>;
|
|
647
451
|
};
|
|
648
452
|
onError: {
|
|
649
453
|
_mode: "intercept";
|
|
650
|
-
func: (ctx: T
|
|
454
|
+
func: (ctx: VigorFetchContextSchema<T>, api: Pick<VigorFetchPolicyMiddlewaresApi<T>, "setResult" | "throwError" | "proceedRestart" | "cancelRestart">) => VigorFetchContextSchema<any> | Promise<VigorFetchContextSchema<any>>;
|
|
651
455
|
};
|
|
652
456
|
};
|
|
653
457
|
/**
|
|
654
|
-
* Immutable builder for a
|
|
655
|
-
* `after`, `onResult`, `
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
* control flow).
|
|
458
|
+
* Immutable builder for a fetch policy's middleware pipeline (`before`,
|
|
459
|
+
* `after`, `onResult`, `onError`). Each stage accepts either "fluent"
|
|
460
|
+
* middleware (returns a plain value merged into the context) or
|
|
461
|
+
* "intercept" middleware (receives an explicit API to mutate control flow).
|
|
659
462
|
*/
|
|
660
|
-
declare class
|
|
463
|
+
declare class VigorFetchPolicyMiddlewares<T extends VigorFetchSchema<T> = typeof VigorFetchBase> extends VigorStatus<VigorFetchSchema<any>, T, VigorFetchPolicyMiddlewaresTypeLambda> {
|
|
661
464
|
constructor(config?: T);
|
|
662
|
-
protected _create<C>(config: C): VigorApply<
|
|
663
|
-
/** Registers a middleware that runs before the
|
|
664
|
-
before<const N extends
|
|
465
|
+
protected _create<C>(config: C): VigorApply<VigorFetchPolicyMiddlewaresTypeLambda, C>;
|
|
466
|
+
/** Registers a middleware that runs before the request is sent. */
|
|
467
|
+
before<const N extends VigorFetchPolicyMiddlewaresFluent<T>["before"]["func"]>(type: "fluent", func: N): VigorApply<VigorFetchPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
665
468
|
policy: {
|
|
666
469
|
middlewares: {
|
|
667
470
|
before: [{
|
|
@@ -671,7 +474,7 @@ declare class VigorRetryPolicyMiddlewares<T extends VigorRetrySchema<T> = typeof
|
|
|
671
474
|
};
|
|
672
475
|
};
|
|
673
476
|
}>>;
|
|
674
|
-
before<const N extends
|
|
477
|
+
before<const N extends VigorFetchPolicyMiddlewaresIntercept<T>["before"]["func"]>(type: "intercept", func: N): VigorApply<VigorFetchPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
675
478
|
policy: {
|
|
676
479
|
middlewares: {
|
|
677
480
|
before: [{
|
|
@@ -681,8 +484,8 @@ declare class VigorRetryPolicyMiddlewares<T extends VigorRetrySchema<T> = typeof
|
|
|
681
484
|
};
|
|
682
485
|
};
|
|
683
486
|
}>>;
|
|
684
|
-
/** Registers a middleware that runs after the
|
|
685
|
-
after<const N extends
|
|
487
|
+
/** Registers a middleware that runs after the response is received. */
|
|
488
|
+
after<const N extends VigorFetchPolicyMiddlewaresFluent<T>["after"]["func"]>(type: "fluent", func: N): VigorApply<VigorFetchPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
686
489
|
policy: {
|
|
687
490
|
middlewares: {
|
|
688
491
|
after: [{
|
|
@@ -692,7 +495,7 @@ declare class VigorRetryPolicyMiddlewares<T extends VigorRetrySchema<T> = typeof
|
|
|
692
495
|
};
|
|
693
496
|
};
|
|
694
497
|
}>>;
|
|
695
|
-
after<const N extends
|
|
498
|
+
after<const N extends VigorFetchPolicyMiddlewaresIntercept<T>["after"]["func"]>(type: "intercept", func: N): VigorApply<VigorFetchPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
696
499
|
policy: {
|
|
697
500
|
middlewares: {
|
|
698
501
|
after: [{
|
|
@@ -702,8 +505,8 @@ declare class VigorRetryPolicyMiddlewares<T extends VigorRetrySchema<T> = typeof
|
|
|
702
505
|
};
|
|
703
506
|
};
|
|
704
507
|
}>>;
|
|
705
|
-
/** Registers a middleware
|
|
706
|
-
onResult<const N extends
|
|
508
|
+
/** Registers a middleware that transforms or validates the parsed result. */
|
|
509
|
+
onResult<const N extends VigorFetchPolicyMiddlewaresFluent<T>["onResult"]["func"]>(type: "fluent", func: N): VigorApply<VigorFetchPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
707
510
|
policy: {
|
|
708
511
|
middlewares: {
|
|
709
512
|
onResult: [{
|
|
@@ -713,7 +516,7 @@ declare class VigorRetryPolicyMiddlewares<T extends VigorRetrySchema<T> = typeof
|
|
|
713
516
|
};
|
|
714
517
|
};
|
|
715
518
|
}>>;
|
|
716
|
-
onResult<const N extends
|
|
519
|
+
onResult<const N extends VigorFetchPolicyMiddlewaresIntercept<T>["onResult"]["func"]>(type: "intercept", func: N): VigorApply<VigorFetchPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
717
520
|
policy: {
|
|
718
521
|
middlewares: {
|
|
719
522
|
onResult: [{
|
|
@@ -723,50 +526,8 @@ declare class VigorRetryPolicyMiddlewares<T extends VigorRetrySchema<T> = typeof
|
|
|
723
526
|
};
|
|
724
527
|
};
|
|
725
528
|
}>>;
|
|
726
|
-
/** Registers a middleware that
|
|
727
|
-
|
|
728
|
-
policy: {
|
|
729
|
-
middlewares: {
|
|
730
|
-
retryIf: [{
|
|
731
|
-
_mode: "fluent";
|
|
732
|
-
func: N;
|
|
733
|
-
}];
|
|
734
|
-
};
|
|
735
|
-
};
|
|
736
|
-
}>>;
|
|
737
|
-
retryIf<const N extends VigorRetryPolicyMiddlewaresIntercept<any>["retryIf"]["func"]>(type: "intercept", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
738
|
-
policy: {
|
|
739
|
-
middlewares: {
|
|
740
|
-
retryIf: [{
|
|
741
|
-
_mode: "intercept";
|
|
742
|
-
func: N;
|
|
743
|
-
}];
|
|
744
|
-
};
|
|
745
|
-
};
|
|
746
|
-
}>>;
|
|
747
|
-
/** Registers a middleware invoked right before a retry attempt is scheduled. */
|
|
748
|
-
onRetry<const N extends VigorRetryPolicyMiddlewaresFluent<any>["onRetry"]["func"]>(type: "fluent", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
749
|
-
policy: {
|
|
750
|
-
middlewares: {
|
|
751
|
-
onRetry: [{
|
|
752
|
-
_mode: "fluent";
|
|
753
|
-
func: N;
|
|
754
|
-
}];
|
|
755
|
-
};
|
|
756
|
-
};
|
|
757
|
-
}>>;
|
|
758
|
-
onRetry<const N extends VigorRetryPolicyMiddlewaresIntercept<any>["onRetry"]["func"]>(type: "intercept", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
759
|
-
policy: {
|
|
760
|
-
middlewares: {
|
|
761
|
-
onRetry: [{
|
|
762
|
-
_mode: "intercept";
|
|
763
|
-
func: N;
|
|
764
|
-
}];
|
|
765
|
-
};
|
|
766
|
-
};
|
|
767
|
-
}>>;
|
|
768
|
-
/** Registers a middleware invoked when retries/restarts are exhausted. */
|
|
769
|
-
onError<const N extends VigorRetryPolicyMiddlewaresFluent<any>["onError"]["func"]>(type: "fluent", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
529
|
+
/** Registers a middleware that runs when the request ultimately fails. */
|
|
530
|
+
onError<const N extends VigorFetchPolicyMiddlewaresFluent<T>["onError"]["func"]>(type: "fluent", func: N): VigorApply<VigorFetchPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
770
531
|
policy: {
|
|
771
532
|
middlewares: {
|
|
772
533
|
onError: [{
|
|
@@ -776,7 +537,7 @@ declare class VigorRetryPolicyMiddlewares<T extends VigorRetrySchema<T> = typeof
|
|
|
776
537
|
};
|
|
777
538
|
};
|
|
778
539
|
}>>;
|
|
779
|
-
onError<const N extends
|
|
540
|
+
onError<const N extends VigorFetchPolicyMiddlewaresIntercept<T>["onError"]["func"]>(type: "intercept", func: N): VigorApply<VigorFetchPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
780
541
|
policy: {
|
|
781
542
|
middlewares: {
|
|
782
543
|
onError: [{
|
|
@@ -787,347 +548,25 @@ declare class VigorRetryPolicyMiddlewares<T extends VigorRetrySchema<T> = typeof
|
|
|
787
548
|
};
|
|
788
549
|
}>>;
|
|
789
550
|
}
|
|
790
|
-
type VigorRetryPipeInitialContext<T extends VigorRetrySchema<T>, R = VigorReturnType<T["policy"]["target"]>> = VigorDeepMerge<Omit<T["context"], "result">, {
|
|
791
|
-
result: R;
|
|
792
|
-
}>;
|
|
793
|
-
type VigorRetryPipeStepVoid<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
|
|
794
|
-
_mode: "intercept";
|
|
795
|
-
func: (...args: any[]) => infer Ret;
|
|
796
|
-
} ? VigorRetryPipeStepVoid<Ret, Tail> : VigorRetryPipeStepVoid<Ctx, Tail> : Ctx;
|
|
797
|
-
type VigorRetryPipeStepResult<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
|
|
798
|
-
_mode: "intercept";
|
|
799
|
-
func: (...args: any[]) => infer Ret;
|
|
800
|
-
} ? VigorRetryPipeStepResult<Ret, Tail> : Head extends {
|
|
801
|
-
_mode: "fluent";
|
|
802
|
-
func: (...args: any[]) => infer FR;
|
|
803
|
-
} ? VigorRetryPipeStepResult<VigorDeepMerge<Ctx, {
|
|
804
|
-
result: FR;
|
|
805
|
-
}>, Tail> : VigorRetryPipeStepResult<Ctx, Tail> : Ctx;
|
|
806
|
-
type VigorRetryPipeStepRetryIf<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
|
|
807
|
-
_mode: "intercept";
|
|
808
|
-
func: (...args: any[]) => infer Ret;
|
|
809
|
-
} ? VigorRetryPipeStepRetryIf<Ret, Tail> : Head extends {
|
|
810
|
-
_mode: "fluent";
|
|
811
|
-
func: (...args: any[]) => infer FR;
|
|
812
|
-
} ? VigorRetryPipeStepRetryIf<VigorDeepMerge<Ctx, {
|
|
813
|
-
flags: {
|
|
814
|
-
doRetry: FR;
|
|
815
|
-
};
|
|
816
|
-
}>, Tail> : VigorRetryPipeStepRetryIf<Ctx, Tail> : Ctx;
|
|
817
|
-
type VigorRetryPolicyMiddlewaresPipe<T extends VigorRetrySchema<T>> = VigorRetryPipeStepVoid<VigorRetryPipeStepVoid<VigorRetryPipeStepRetryIf<VigorRetryPipeStepResult<VigorRetryPipeStepVoid<VigorRetryPipeStepVoid<VigorRetryPipeInitialContext<T>, T["policy"]["middlewares"]["before"]>, T["policy"]["middlewares"]["after"]>, T["policy"]["middlewares"]["onResult"]>, T["policy"]["middlewares"]["retryIf"]>, T["policy"]["middlewares"]["onRetry"]>, T["policy"]["middlewares"]["onError"]>;
|
|
818
|
-
type VigorRetryPipeResult<T extends VigorRetrySchema<T>> = VigorRetryPolicyMiddlewaresPipe<T> extends {
|
|
819
|
-
result: infer R;
|
|
820
|
-
} ? R : never;
|
|
821
|
-
|
|
822
|
-
type VigorRetryContextSchema<T extends VigorRetrySchema<T>> = {
|
|
823
|
-
__brand: VigorBrand<"Retry", "Context<Schema">;
|
|
824
|
-
result: VigorRetryPipeResult<T> | VigorDefaultType;
|
|
825
|
-
error: unknown;
|
|
826
|
-
system: {
|
|
827
|
-
delay: number | VigorDefaultType;
|
|
828
|
-
attempt: number;
|
|
829
|
-
};
|
|
830
|
-
flags: {
|
|
831
|
-
doRetry: boolean;
|
|
832
|
-
doRestart: boolean;
|
|
833
|
-
brokeRetry: boolean;
|
|
834
|
-
overridden: boolean;
|
|
835
|
-
};
|
|
836
|
-
record: Record<string, any>;
|
|
837
|
-
policy: T["policy"];
|
|
838
|
-
};
|
|
839
551
|
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
552
|
+
/** Returns a random offset in the range `[-jitter, +jitter]` to randomize a computed delay. */
|
|
553
|
+
declare function VigorJitter(jitter: number): number;
|
|
554
|
+
type VigorRetryPolicyAlgorithmsConstantSchema<T extends VigorRetryPolicyAlgorithmsConstantSchema<T>> = {
|
|
555
|
+
__brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
556
|
+
_tag: "constant";
|
|
557
|
+
jitter: number;
|
|
558
|
+
interval: number;
|
|
559
|
+
_calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<T>) => number;
|
|
846
560
|
};
|
|
847
|
-
declare const
|
|
848
|
-
readonly __brand: VigorBrand<"Retry", "Policy<
|
|
849
|
-
readonly
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
readonly
|
|
853
|
-
readonly maxRestarts: 3;
|
|
854
|
-
readonly timeout: 20000;
|
|
561
|
+
declare const VigorRetryPolicyAlgorithmsConstantBase: {
|
|
562
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
563
|
+
readonly _tag: "constant";
|
|
564
|
+
readonly jitter: 1000;
|
|
565
|
+
readonly interval: 2000;
|
|
566
|
+
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
855
567
|
};
|
|
856
|
-
/** Immutable builder for
|
|
857
|
-
declare class
|
|
858
|
-
constructor(config?: T);
|
|
859
|
-
protected _create<C>(config: C): VigorApply<VigorRetryPolicySettingsTypeLambda, C>;
|
|
860
|
-
/** Sets the fallback value/factory used when the target ultimately fails. */
|
|
861
|
-
default<const N extends VigorExcludeEmpty<VigorRetrySchema<any>["policy"]["settings"]["default"]>>(func: N): VigorRetryPolicySettings<VigorRetryIn<VigorDeepMerge<T, {
|
|
862
|
-
readonly policy: {
|
|
863
|
-
readonly settings: {
|
|
864
|
-
readonly default: N;
|
|
865
|
-
};
|
|
866
|
-
};
|
|
867
|
-
}>>>;
|
|
868
|
-
/** Sets the maximum number of retry attempts before giving up. */
|
|
869
|
-
maxAttempts<const N extends VigorRetrySchema<any>["policy"]["settings"]["maxAttempts"]>(num: N): VigorRetryPolicySettings<VigorRetryIn<VigorDeepMerge<T, {
|
|
870
|
-
readonly policy: {
|
|
871
|
-
readonly settings: {
|
|
872
|
-
readonly maxAttempts: N;
|
|
873
|
-
};
|
|
874
|
-
};
|
|
875
|
-
}>>>;
|
|
876
|
-
/** Sets the maximum number of full restarts allowed. */
|
|
877
|
-
maxRestarts<const N extends VigorRetrySchema<any>["policy"]["settings"]["maxRestarts"]>(num: N): VigorRetryPolicySettings<VigorRetryIn<VigorDeepMerge<T, {
|
|
878
|
-
readonly policy: {
|
|
879
|
-
readonly settings: {
|
|
880
|
-
readonly maxRestarts: N;
|
|
881
|
-
};
|
|
882
|
-
};
|
|
883
|
-
}>>>;
|
|
884
|
-
/** Sets the timeout, in milliseconds, for a single attempt. */
|
|
885
|
-
timeout<const N extends VigorRetrySchema<any>["policy"]["settings"]["timeout"]>(num: N): VigorRetryPolicySettings<VigorRetryIn<VigorDeepMerge<T, {
|
|
886
|
-
readonly policy: {
|
|
887
|
-
readonly settings: {
|
|
888
|
-
readonly timeout: N;
|
|
889
|
-
};
|
|
890
|
-
};
|
|
891
|
-
}>>>;
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
type VigorRetryPolicySchema<T extends VigorRetrySchema<T>> = {
|
|
895
|
-
__brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
896
|
-
target: ((signal: AbortSignal) => any | Promise<any>) | VigorEmptyType;
|
|
897
|
-
abortSignals: AbortSignal[];
|
|
898
|
-
settings: VigorRetryPolicySettingsSchema<T>;
|
|
899
|
-
middlewares: VigorRetryPolicyMiddlewaresSchema<T>;
|
|
900
|
-
algorithms: VigorRetryPolicyAlgorithmsSchema<T>;
|
|
901
|
-
};
|
|
902
|
-
declare const VigorRetryPolicyBase: {
|
|
903
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
904
|
-
readonly target: symbol & {
|
|
905
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
906
|
-
};
|
|
907
|
-
readonly abortSignals: [];
|
|
908
|
-
readonly settings: {
|
|
909
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
910
|
-
readonly default: symbol & {
|
|
911
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
912
|
-
};
|
|
913
|
-
readonly maxAttempts: 5;
|
|
914
|
-
readonly maxRestarts: 3;
|
|
915
|
-
readonly timeout: 20000;
|
|
916
|
-
};
|
|
917
|
-
readonly middlewares: {
|
|
918
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
919
|
-
readonly before: [];
|
|
920
|
-
readonly after: [];
|
|
921
|
-
readonly onResult: [];
|
|
922
|
-
readonly retryIf: [];
|
|
923
|
-
readonly onRetry: [];
|
|
924
|
-
readonly onError: [];
|
|
925
|
-
};
|
|
926
|
-
readonly algorithms: {
|
|
927
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
928
|
-
readonly _tag: "constant";
|
|
929
|
-
readonly jitter: 1000;
|
|
930
|
-
readonly interval: 2000;
|
|
931
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
932
|
-
};
|
|
933
|
-
};
|
|
934
|
-
|
|
935
|
-
type VigorRetrySchema<T extends VigorRetrySchema<T>> = {
|
|
936
|
-
__brand: VigorBrand<"Retry", "Schema">;
|
|
937
|
-
policy: VigorRetryPolicySchema<T>;
|
|
938
|
-
context: VigorRetryContextSchema<T>;
|
|
939
|
-
};
|
|
940
|
-
declare const VigorRetryBase: {
|
|
941
|
-
readonly __brand: VigorBrand<"Retry", "Schema">;
|
|
942
|
-
readonly policy: {
|
|
943
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
944
|
-
readonly target: symbol & {
|
|
945
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
946
|
-
};
|
|
947
|
-
readonly abortSignals: [];
|
|
948
|
-
readonly settings: {
|
|
949
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
950
|
-
readonly default: symbol & {
|
|
951
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
952
|
-
};
|
|
953
|
-
readonly maxAttempts: 5;
|
|
954
|
-
readonly maxRestarts: 3;
|
|
955
|
-
readonly timeout: 20000;
|
|
956
|
-
};
|
|
957
|
-
readonly middlewares: {
|
|
958
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
959
|
-
readonly before: [];
|
|
960
|
-
readonly after: [];
|
|
961
|
-
readonly onResult: [];
|
|
962
|
-
readonly retryIf: [];
|
|
963
|
-
readonly onRetry: [];
|
|
964
|
-
readonly onError: [];
|
|
965
|
-
};
|
|
966
|
-
readonly algorithms: {
|
|
967
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
968
|
-
readonly _tag: "constant";
|
|
969
|
-
readonly jitter: 1000;
|
|
970
|
-
readonly interval: 2000;
|
|
971
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
972
|
-
};
|
|
973
|
-
};
|
|
974
|
-
readonly context: {
|
|
975
|
-
readonly __brand: VigorBrand<"Retry", "Context<Schema">;
|
|
976
|
-
readonly result: symbol & {
|
|
977
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
978
|
-
};
|
|
979
|
-
readonly error: symbol & {
|
|
980
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
981
|
-
};
|
|
982
|
-
readonly system: {
|
|
983
|
-
readonly delay: symbol & {
|
|
984
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
985
|
-
};
|
|
986
|
-
readonly attempt: 0;
|
|
987
|
-
};
|
|
988
|
-
readonly flags: {
|
|
989
|
-
readonly doRetry: true;
|
|
990
|
-
readonly doRestart: false;
|
|
991
|
-
readonly brokeRetry: false;
|
|
992
|
-
readonly overridden: false;
|
|
993
|
-
};
|
|
994
|
-
readonly record: {};
|
|
995
|
-
readonly policy: {
|
|
996
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
997
|
-
readonly target: symbol & {
|
|
998
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
999
|
-
};
|
|
1000
|
-
readonly abortSignals: [];
|
|
1001
|
-
readonly settings: {
|
|
1002
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
1003
|
-
readonly default: symbol & {
|
|
1004
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1005
|
-
};
|
|
1006
|
-
readonly maxAttempts: 5;
|
|
1007
|
-
readonly maxRestarts: 3;
|
|
1008
|
-
readonly timeout: 20000;
|
|
1009
|
-
};
|
|
1010
|
-
readonly middlewares: {
|
|
1011
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
1012
|
-
readonly before: [];
|
|
1013
|
-
readonly after: [];
|
|
1014
|
-
readonly onResult: [];
|
|
1015
|
-
readonly retryIf: [];
|
|
1016
|
-
readonly onRetry: [];
|
|
1017
|
-
readonly onError: [];
|
|
1018
|
-
};
|
|
1019
|
-
readonly algorithms: {
|
|
1020
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
1021
|
-
readonly _tag: "constant";
|
|
1022
|
-
readonly jitter: 1000;
|
|
1023
|
-
readonly interval: 2000;
|
|
1024
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
1025
|
-
};
|
|
1026
|
-
};
|
|
1027
|
-
};
|
|
1028
|
-
};
|
|
1029
|
-
/**
|
|
1030
|
-
* Immutable builder that executes a target function with retry, restart,
|
|
1031
|
-
* timeout, and abort support, driven by a configurable delay algorithm and
|
|
1032
|
-
* middleware pipeline.
|
|
1033
|
-
*/
|
|
1034
|
-
declare class VigorRetry<T extends VigorRetrySchema<T> = typeof VigorRetryBase> extends VigorStatus<VigorRetrySchema<T>, T, VigorRetryTypeLambda> {
|
|
1035
|
-
constructor(config?: T);
|
|
1036
|
-
protected _create<C>(config: C): VigorApply<VigorRetryTypeLambda, C>;
|
|
1037
|
-
/** Sets the target function to invoke, with retry/timeout applied. */
|
|
1038
|
-
target<const N extends VigorExcludeEmpty<VigorRetrySchema<T>["policy"]["target"]>>(func: N): VigorRetry<VigorRetryIn<VigorDeepMerge<T, {
|
|
1039
|
-
readonly policy: {
|
|
1040
|
-
readonly target: N;
|
|
1041
|
-
};
|
|
1042
|
-
}>>>;
|
|
1043
|
-
/** Sets external abort signals that, when aborted, stop retrying. */
|
|
1044
|
-
abortSignals<const N extends VigorRetrySchema<T>["policy"]["abortSignals"]>(...sig: N): VigorRetry<VigorRetryIn<VigorDeepMerge<T, {
|
|
1045
|
-
readonly policy: {
|
|
1046
|
-
readonly abortSignals: N;
|
|
1047
|
-
};
|
|
1048
|
-
}>>>;
|
|
1049
|
-
/** Configures the retry policy's general settings (max attempts, timeout, etc). */
|
|
1050
|
-
settings<const N extends VigorDeepPartial<VigorRetryPolicySettingsSchema<T>>, R extends VigorRetrySchema<any>>(input: N | ((s: VigorRetryPolicySettings<T>) => VigorRetryPolicySettings<R>) | VigorRetryPolicySettings<R>): VigorRetry<VigorRetryIn<VigorDeepMerge<T, {
|
|
1051
|
-
readonly policy: {
|
|
1052
|
-
readonly settings: VigorRetryPolicySettingsSchema<any>;
|
|
1053
|
-
};
|
|
1054
|
-
}>>>;
|
|
1055
|
-
/** Configures the retry policy's middleware pipeline. */
|
|
1056
|
-
middlewares<const N extends VigorDeepPartial<VigorRetryPolicyMiddlewaresSchema<T>>, R extends VigorRetrySchema<any>>(input: N | ((s: VigorRetryPolicyMiddlewares<T>) => VigorRetryPolicyMiddlewares<R>) | VigorRetryPolicyMiddlewares<R>): VigorRetry<VigorRetryIn<VigorDeepMerge<T, {
|
|
1057
|
-
readonly policy: {
|
|
1058
|
-
readonly middlewares: VigorRetryPolicyMiddlewaresSchema<any>;
|
|
1059
|
-
};
|
|
1060
|
-
}>>>;
|
|
1061
|
-
/** Configures the retry policy's delay algorithm. */
|
|
1062
|
-
algorithms<const N extends VigorDeepPartial<VigorRetryPolicyAlgorithmsSchema<T>>, R extends VigorRetrySchema<any>>(input: N | ((a: VigorRetryPolicyAlgorithms<T>) => VigorRetryPolicyAlgorithms<R> | VigorRetryPolicyAlgorithmsConstant<any>)): VigorRetry<VigorRetryIn<VigorDeepMerge<T, {
|
|
1063
|
-
readonly policy: {
|
|
1064
|
-
readonly algorithms: any;
|
|
1065
|
-
};
|
|
1066
|
-
}>>>;
|
|
1067
|
-
/** Runs the target and returns its result directly, throwing on final failure. */
|
|
1068
|
-
request<R = T["context"]["result"]>(): Promise<R>;
|
|
1069
|
-
/** Runs the target and returns a result/error envelope instead of throwing. */
|
|
1070
|
-
requestVerbose<R = T["context"]["result"]>(): Promise<{
|
|
1071
|
-
success: false;
|
|
1072
|
-
data: null;
|
|
1073
|
-
error: unknown;
|
|
1074
|
-
} | {
|
|
1075
|
-
success: true;
|
|
1076
|
-
data: R;
|
|
1077
|
-
error: null;
|
|
1078
|
-
}>;
|
|
1079
|
-
/** Internal execution loop implementing the attempt/retry/restart lifecycle. */
|
|
1080
|
-
private requestRuntime;
|
|
1081
|
-
}
|
|
1082
|
-
|
|
1083
|
-
type VigorRetryIn<T> = T extends VigorRetrySchema<any> ? T : never;
|
|
1084
|
-
type VigorRetryAlgorithmsConstantIn<T> = T extends VigorRetryPolicyAlgorithmsConstantSchema<any> ? T : never;
|
|
1085
|
-
type VigorRetryAlgorithmsLinearIn<T> = T extends VigorRetryPolicyAlgorithmsLinearSchema<any> ? T : never;
|
|
1086
|
-
type VigorRetryAlgorithmsBackoffIn<T> = T extends VigorRetryPolicyAlgorithmsBackoffSchema<any> ? T : never;
|
|
1087
|
-
type VigorRetryAlgorithmsCustomIn<T> = T extends VigorRetryPolicyAlgorithmsCustomSchema<any> ? T : never;
|
|
1088
|
-
interface VigorRetryTypeLambda extends VigorTypeLambda {
|
|
1089
|
-
readonly Target: VigorRetry<VigorRetryIn<this["In"]>>;
|
|
1090
|
-
}
|
|
1091
|
-
interface VigorRetryPolicySettingsTypeLambda extends VigorTypeLambda {
|
|
1092
|
-
readonly Target: VigorRetryPolicySettings<VigorRetryIn<this["In"]>>;
|
|
1093
|
-
}
|
|
1094
|
-
interface VigorRetryPolicyMiddlewaresTypeLambda extends VigorTypeLambda {
|
|
1095
|
-
readonly Target: VigorRetryPolicyMiddlewares<VigorRetryIn<this["In"]>>;
|
|
1096
|
-
}
|
|
1097
|
-
interface VigorRetryPolicyAlgorithmsTypeLambda extends VigorTypeLambda {
|
|
1098
|
-
readonly Target: VigorRetryPolicyAlgorithms<VigorRetryIn<this["In"]>>;
|
|
1099
|
-
}
|
|
1100
|
-
interface VigorRetryPolicyAlgorithmsConstantTypeLambda extends VigorTypeLambda {
|
|
1101
|
-
readonly Target: VigorRetryPolicyAlgorithmsConstant<VigorRetryAlgorithmsConstantIn<this["In"]>>;
|
|
1102
|
-
}
|
|
1103
|
-
interface VigorRetryPolicyAlgorithmsLinearTypeLambda extends VigorTypeLambda {
|
|
1104
|
-
readonly Target: VigorRetryPolicyAlgorithmsLinear<VigorRetryAlgorithmsLinearIn<this["In"]>>;
|
|
1105
|
-
}
|
|
1106
|
-
interface VigorRetryPolicyAlgorithmsBackoffTypeLambda extends VigorTypeLambda {
|
|
1107
|
-
readonly Target: VigorRetryPolicyAlgorithmsBackoff<VigorRetryAlgorithmsBackoffIn<this["In"]>>;
|
|
1108
|
-
}
|
|
1109
|
-
interface VigorRetryPolicyAlgorithmsCustomTypeLambda extends VigorTypeLambda {
|
|
1110
|
-
readonly Target: VigorRetryPolicyAlgorithmsCustom<VigorRetryAlgorithmsCustomIn<this["In"]>>;
|
|
1111
|
-
}
|
|
1112
|
-
|
|
1113
|
-
/** Returns a random offset in the range `[-jitter, +jitter]` to randomize a computed delay. */
|
|
1114
|
-
declare function VigorJitter(jitter: number): number;
|
|
1115
|
-
type VigorRetryPolicyAlgorithmsConstantSchema<T extends VigorRetryPolicyAlgorithmsConstantSchema<T>> = {
|
|
1116
|
-
__brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
1117
|
-
_tag: "constant";
|
|
1118
|
-
jitter: number;
|
|
1119
|
-
interval: number;
|
|
1120
|
-
_calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<T>) => number;
|
|
1121
|
-
};
|
|
1122
|
-
declare const VigorRetryPolicyAlgorithmsConstantBase: {
|
|
1123
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
1124
|
-
readonly _tag: "constant";
|
|
1125
|
-
readonly jitter: 1000;
|
|
1126
|
-
readonly interval: 2000;
|
|
1127
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
1128
|
-
};
|
|
1129
|
-
/** Immutable builder for the constant-interval retry delay algorithm. */
|
|
1130
|
-
declare class VigorRetryPolicyAlgorithmsConstant<T extends VigorRetryPolicyAlgorithmsConstantSchema<T> = typeof VigorRetryPolicyAlgorithmsConstantBase> extends VigorStatus<VigorRetryPolicyAlgorithmsConstantSchema<any>, T, VigorRetryPolicyAlgorithmsConstantTypeLambda> {
|
|
568
|
+
/** Immutable builder for the constant-interval retry delay algorithm. */
|
|
569
|
+
declare class VigorRetryPolicyAlgorithmsConstant<T extends VigorRetryPolicyAlgorithmsConstantSchema<T> = typeof VigorRetryPolicyAlgorithmsConstantBase> extends VigorStatus<VigorRetryPolicyAlgorithmsConstantSchema<any>, T, VigorRetryPolicyAlgorithmsConstantTypeLambda> {
|
|
1131
570
|
constructor(config?: T);
|
|
1132
571
|
protected _create<C>(config: C): VigorApply<VigorRetryPolicyAlgorithmsConstantTypeLambda, C>;
|
|
1133
572
|
/** Sets the amount of random jitter added to the computed delay. */
|
|
@@ -1358,154 +797,507 @@ declare class VigorRetryPolicyAlgorithms<T extends VigorRetrySchema<T> = typeof
|
|
|
1358
797
|
}>>>;
|
|
1359
798
|
}
|
|
1360
799
|
|
|
1361
|
-
type
|
|
1362
|
-
__brand: VigorBrand<"
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
readonly onlySuccess: false;
|
|
800
|
+
type VigorRetryPolicyMiddlewaresSchema<T extends VigorRetrySchema<T>> = {
|
|
801
|
+
__brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
802
|
+
before: (VigorRetryPolicyMiddlewaresFluent<T>["before"] | VigorRetryPolicyMiddlewaresIntercept<T>["before"])[];
|
|
803
|
+
after: (VigorRetryPolicyMiddlewaresFluent<T>["after"] | VigorRetryPolicyMiddlewaresIntercept<T>["after"])[];
|
|
804
|
+
onResult: (VigorRetryPolicyMiddlewaresFluent<T>["onResult"] | VigorRetryPolicyMiddlewaresIntercept<T>["onResult"])[];
|
|
805
|
+
retryIf: (VigorRetryPolicyMiddlewaresFluent<T>["retryIf"] | VigorRetryPolicyMiddlewaresIntercept<T>["retryIf"])[];
|
|
806
|
+
onRetry: (VigorRetryPolicyMiddlewaresFluent<T>["onRetry"] | VigorRetryPolicyMiddlewaresIntercept<T>["onRetry"])[];
|
|
807
|
+
onError: (VigorRetryPolicyMiddlewaresFluent<T>["onError"] | VigorRetryPolicyMiddlewaresIntercept<T>["onError"])[];
|
|
1370
808
|
};
|
|
1371
|
-
|
|
1372
|
-
|
|
809
|
+
declare const VigorRetryPolicyMiddlewaresBase: {
|
|
810
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
811
|
+
readonly before: [];
|
|
812
|
+
readonly after: [];
|
|
813
|
+
readonly onResult: [];
|
|
814
|
+
readonly retryIf: [];
|
|
815
|
+
readonly onRetry: [];
|
|
816
|
+
readonly onError: [];
|
|
817
|
+
};
|
|
818
|
+
type VigorRetryPolicyMiddlewaresFluent<T extends VigorRetrySchema<T>> = {
|
|
819
|
+
__brand: VigorBrand<"Retry", "Policy<Middlewares<Fluent<Schema">;
|
|
820
|
+
before: {
|
|
821
|
+
_mode: "fluent";
|
|
822
|
+
func: (ctx: VigorRetryBeforeContextSchema<T>) => void;
|
|
823
|
+
};
|
|
824
|
+
after: {
|
|
825
|
+
_mode: "fluent";
|
|
826
|
+
func: (ctx: VigorRetryAfterContextSchema<T>) => void;
|
|
827
|
+
};
|
|
828
|
+
onResult: {
|
|
829
|
+
_mode: "fluent";
|
|
830
|
+
func: (res: VigorRetryAfterContextSchema<T>["result"]) => VigorRetryContextSchema<any>["result"];
|
|
831
|
+
};
|
|
832
|
+
retryIf: {
|
|
833
|
+
_mode: "fluent";
|
|
834
|
+
func: (err: VigorRetryContextSchema<T>["error"]) => VigorRetryContextSchema<any>["flags"]["doRetry"];
|
|
835
|
+
};
|
|
836
|
+
onRetry: {
|
|
837
|
+
_mode: "fluent";
|
|
838
|
+
func: (err: VigorRetryContextSchema<T>["error"]) => void;
|
|
839
|
+
};
|
|
840
|
+
onError: {
|
|
841
|
+
_mode: "fluent";
|
|
842
|
+
func: (err: VigorRetryContextSchema<T>["error"]) => void;
|
|
843
|
+
};
|
|
844
|
+
};
|
|
845
|
+
type VigorRetryPolicyMiddlewaresApi<T extends VigorRetrySchema<T>> = {
|
|
846
|
+
setResult: (res: VigorRetryContextSchema<any>["result"]) => void;
|
|
847
|
+
throwError: (err: VigorRetryContextSchema<any>["error"]) => void;
|
|
848
|
+
abort: (err: VigorRetryContextSchema<any>["error"]) => void;
|
|
849
|
+
breakRetry: (err: VigorRetryContextSchema<any>["error"]) => void;
|
|
850
|
+
proceedRetry: () => void;
|
|
851
|
+
cancelRetry: () => void;
|
|
852
|
+
setDelay: (num: VigorRetryContextSchema<any>["system"]["delay"]) => void;
|
|
853
|
+
proceedRestart: () => void;
|
|
854
|
+
cancelRestart: () => void;
|
|
855
|
+
};
|
|
856
|
+
type VigorRetryPolicyMiddlewaresIntercept<T extends VigorRetrySchema<T>> = {
|
|
857
|
+
__brand: VigorBrand<"Retry", "Policy<Middlewares<Intercept<Schema">;
|
|
858
|
+
before: {
|
|
859
|
+
_mode: "intercept";
|
|
860
|
+
func: (ctx: VigorRetryBeforeContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "abort" | "throwError" | "breakRetry">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
|
|
861
|
+
};
|
|
862
|
+
after: {
|
|
863
|
+
_mode: "intercept";
|
|
864
|
+
func: (ctx: VigorRetryAfterContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "throwError">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
|
|
865
|
+
};
|
|
866
|
+
onResult: {
|
|
867
|
+
_mode: "intercept";
|
|
868
|
+
func: (ctx: VigorRetryAfterContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "setResult" | "throwError">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
|
|
869
|
+
};
|
|
870
|
+
retryIf: {
|
|
871
|
+
_mode: "intercept";
|
|
872
|
+
func: (ctx: VigorRetryContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "proceedRetry" | "cancelRetry">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
|
|
873
|
+
};
|
|
874
|
+
onRetry: {
|
|
875
|
+
_mode: "intercept";
|
|
876
|
+
func: (ctx: VigorRetryContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "throwError" | "setDelay">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
|
|
877
|
+
};
|
|
878
|
+
onError: {
|
|
879
|
+
_mode: "intercept";
|
|
880
|
+
func: (ctx: VigorRetryContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "setResult" | "throwError" | "proceedRestart" | "cancelRestart">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
|
|
881
|
+
};
|
|
882
|
+
};
|
|
883
|
+
/**
|
|
884
|
+
* Immutable builder for a retry policy's middleware pipeline (`before`,
|
|
885
|
+
* `after`, `onResult`, `retryIf`, `onRetry`, `onError`). Each stage accepts
|
|
886
|
+
* either "fluent" middleware (returns a plain value merged into the
|
|
887
|
+
* context) or "intercept" middleware (receives an explicit API to mutate
|
|
888
|
+
* control flow).
|
|
889
|
+
*/
|
|
890
|
+
declare class VigorRetryPolicyMiddlewares<T extends VigorRetrySchema<T> = typeof VigorRetryBase> extends VigorStatus<VigorRetrySchema<any>, T, VigorRetryPolicyMiddlewaresTypeLambda> {
|
|
1373
891
|
constructor(config?: T);
|
|
1374
|
-
protected _create<C>(config: C): VigorApply<
|
|
1375
|
-
/**
|
|
1376
|
-
|
|
892
|
+
protected _create<C>(config: C): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, C>;
|
|
893
|
+
/** Registers a middleware that runs before the retried target is invoked. */
|
|
894
|
+
before<const N extends VigorRetryPolicyMiddlewaresFluent<T>["before"]["func"]>(type: "fluent", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
895
|
+
policy: {
|
|
896
|
+
middlewares: {
|
|
897
|
+
before: [{
|
|
898
|
+
_mode: "fluent";
|
|
899
|
+
func: N;
|
|
900
|
+
}];
|
|
901
|
+
};
|
|
902
|
+
};
|
|
903
|
+
}>>;
|
|
904
|
+
before<const N extends VigorRetryPolicyMiddlewaresIntercept<T>["before"]["func"]>(type: "intercept", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
905
|
+
policy: {
|
|
906
|
+
middlewares: {
|
|
907
|
+
before: [{
|
|
908
|
+
_mode: "intercept";
|
|
909
|
+
func: N;
|
|
910
|
+
}];
|
|
911
|
+
};
|
|
912
|
+
};
|
|
913
|
+
}>>;
|
|
914
|
+
/** Registers a middleware that runs after the retried target settles. */
|
|
915
|
+
after<const N extends VigorRetryPolicyMiddlewaresFluent<T>["after"]["func"]>(type: "fluent", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
916
|
+
policy: {
|
|
917
|
+
middlewares: {
|
|
918
|
+
after: [{
|
|
919
|
+
_mode: "fluent";
|
|
920
|
+
func: N;
|
|
921
|
+
}];
|
|
922
|
+
};
|
|
923
|
+
};
|
|
924
|
+
}>>;
|
|
925
|
+
after<const N extends VigorRetryPolicyMiddlewaresIntercept<T>["after"]["func"]>(type: "intercept", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
926
|
+
policy: {
|
|
927
|
+
middlewares: {
|
|
928
|
+
after: [{
|
|
929
|
+
_mode: "intercept";
|
|
930
|
+
func: N;
|
|
931
|
+
}];
|
|
932
|
+
};
|
|
933
|
+
};
|
|
934
|
+
}>>;
|
|
935
|
+
/** Registers a middleware to transform or validate the retry's result. */
|
|
936
|
+
onResult<const N extends VigorRetryPolicyMiddlewaresFluent<T>["onResult"]["func"]>(type: "fluent", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
937
|
+
policy: {
|
|
938
|
+
middlewares: {
|
|
939
|
+
onResult: [{
|
|
940
|
+
_mode: "fluent";
|
|
941
|
+
func: N;
|
|
942
|
+
}];
|
|
943
|
+
};
|
|
944
|
+
};
|
|
945
|
+
}>>;
|
|
946
|
+
onResult<const N extends VigorRetryPolicyMiddlewaresIntercept<T>["onResult"]["func"]>(type: "intercept", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
947
|
+
policy: {
|
|
948
|
+
middlewares: {
|
|
949
|
+
onResult: [{
|
|
950
|
+
_mode: "intercept";
|
|
951
|
+
func: N;
|
|
952
|
+
}];
|
|
953
|
+
};
|
|
954
|
+
};
|
|
955
|
+
}>>;
|
|
956
|
+
/** Registers a middleware that decides whether a failed attempt should be retried. */
|
|
957
|
+
retryIf<const N extends VigorRetryPolicyMiddlewaresFluent<T>["retryIf"]["func"]>(type: "fluent", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
958
|
+
policy: {
|
|
959
|
+
middlewares: {
|
|
960
|
+
retryIf: [{
|
|
961
|
+
_mode: "fluent";
|
|
962
|
+
func: N;
|
|
963
|
+
}];
|
|
964
|
+
};
|
|
965
|
+
};
|
|
966
|
+
}>>;
|
|
967
|
+
retryIf<const N extends VigorRetryPolicyMiddlewaresIntercept<T>["retryIf"]["func"]>(type: "intercept", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
968
|
+
policy: {
|
|
969
|
+
middlewares: {
|
|
970
|
+
retryIf: [{
|
|
971
|
+
_mode: "intercept";
|
|
972
|
+
func: N;
|
|
973
|
+
}];
|
|
974
|
+
};
|
|
975
|
+
};
|
|
976
|
+
}>>;
|
|
977
|
+
/** Registers a middleware invoked right before a retry attempt is scheduled. */
|
|
978
|
+
onRetry<const N extends VigorRetryPolicyMiddlewaresFluent<T>["onRetry"]["func"]>(type: "fluent", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
979
|
+
policy: {
|
|
980
|
+
middlewares: {
|
|
981
|
+
onRetry: [{
|
|
982
|
+
_mode: "fluent";
|
|
983
|
+
func: N;
|
|
984
|
+
}];
|
|
985
|
+
};
|
|
986
|
+
};
|
|
987
|
+
}>>;
|
|
988
|
+
onRetry<const N extends VigorRetryPolicyMiddlewaresIntercept<T>["onRetry"]["func"]>(type: "intercept", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
989
|
+
policy: {
|
|
990
|
+
middlewares: {
|
|
991
|
+
onRetry: [{
|
|
992
|
+
_mode: "intercept";
|
|
993
|
+
func: N;
|
|
994
|
+
}];
|
|
995
|
+
};
|
|
996
|
+
};
|
|
997
|
+
}>>;
|
|
998
|
+
/** Registers a middleware invoked when retries/restarts are exhausted. */
|
|
999
|
+
onError<const N extends VigorRetryPolicyMiddlewaresFluent<T>["onError"]["func"]>(type: "fluent", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
1000
|
+
policy: {
|
|
1001
|
+
middlewares: {
|
|
1002
|
+
onError: [{
|
|
1003
|
+
_mode: "fluent";
|
|
1004
|
+
func: N;
|
|
1005
|
+
}];
|
|
1006
|
+
};
|
|
1007
|
+
};
|
|
1008
|
+
}>>;
|
|
1009
|
+
onError<const N extends VigorRetryPolicyMiddlewaresIntercept<T>["onError"]["func"]>(type: "intercept", func: N): VigorApply<VigorRetryPolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
1010
|
+
policy: {
|
|
1011
|
+
middlewares: {
|
|
1012
|
+
onError: [{
|
|
1013
|
+
_mode: "intercept";
|
|
1014
|
+
func: N;
|
|
1015
|
+
}];
|
|
1016
|
+
};
|
|
1017
|
+
};
|
|
1018
|
+
}>>;
|
|
1019
|
+
}
|
|
1020
|
+
type VigorRetryPipeInitialContext<T extends VigorRetrySchema<T>, R = VigorCastResult<T["cast"], VigorReturnType<T["policy"]["target"]>>> = VigorDeepMerge<Omit<VigorRetryContextSchema<T, unknown>, "result">, {
|
|
1021
|
+
result: R;
|
|
1022
|
+
}>;
|
|
1023
|
+
type VigorRetryPipeStepVoid<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
|
|
1024
|
+
_mode: "intercept";
|
|
1025
|
+
func: (...args: any[]) => infer Ret;
|
|
1026
|
+
} ? VigorRetryPipeStepVoid<Ret, Tail> : VigorRetryPipeStepVoid<Ctx, Tail> : Ctx;
|
|
1027
|
+
type VigorRetryPipeStepResult<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
|
|
1028
|
+
_mode: "intercept";
|
|
1029
|
+
func: (...args: any[]) => infer Ret;
|
|
1030
|
+
} ? VigorRetryPipeStepResult<Ret, Tail> : Head extends {
|
|
1031
|
+
_mode: "fluent";
|
|
1032
|
+
func: (...args: any[]) => infer FR;
|
|
1033
|
+
} ? VigorRetryPipeStepResult<VigorDeepMerge<Ctx, {
|
|
1034
|
+
result: FR;
|
|
1035
|
+
}>, Tail> : VigorRetryPipeStepResult<Ctx, Tail> : Ctx;
|
|
1036
|
+
type VigorRetryPipeStepRetryIf<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
|
|
1037
|
+
_mode: "intercept";
|
|
1038
|
+
func: (...args: any[]) => infer Ret;
|
|
1039
|
+
} ? VigorRetryPipeStepRetryIf<Ret, Tail> : Head extends {
|
|
1040
|
+
_mode: "fluent";
|
|
1041
|
+
func: (...args: any[]) => infer FR;
|
|
1042
|
+
} ? VigorRetryPipeStepRetryIf<VigorDeepMerge<Ctx, {
|
|
1043
|
+
flags: {
|
|
1044
|
+
doRetry: FR;
|
|
1045
|
+
};
|
|
1046
|
+
}>, Tail> : VigorRetryPipeStepRetryIf<Ctx, Tail> : Ctx;
|
|
1047
|
+
type VigorRetryPolicyMiddlewaresPipe<T extends VigorRetrySchema<T>> = VigorRetryPipeStepVoid<VigorRetryPipeStepVoid<VigorRetryPipeStepRetryIf<VigorRetryPipeStepResult<VigorRetryPipeStepVoid<VigorRetryPipeStepVoid<VigorRetryPipeInitialContext<T>, T["policy"]["middlewares"]["before"]>, T["policy"]["middlewares"]["after"]>, T["policy"]["middlewares"]["onResult"]>, T["policy"]["middlewares"]["retryIf"]>, T["policy"]["middlewares"]["onRetry"]>, T["policy"]["middlewares"]["onError"]>;
|
|
1048
|
+
type VigorRetryPipeResult<T extends VigorRetrySchema<T>> = VigorRetryPolicyMiddlewaresPipe<T> extends {
|
|
1049
|
+
result: infer R;
|
|
1050
|
+
} ? R : never;
|
|
1051
|
+
|
|
1052
|
+
/**
|
|
1053
|
+
* Base shape shared by every retry context variant. `R` is the type of
|
|
1054
|
+
* `result` at the point the context is observed — it differs by pipeline
|
|
1055
|
+
* stage (before / after / onResult / ...), so callers plug in whichever
|
|
1056
|
+
* `R` matches where they are in the pipeline instead of this being fixed
|
|
1057
|
+
* on the schema.
|
|
1058
|
+
*/
|
|
1059
|
+
type VigorRetryContextSchema<T extends VigorRetrySchema<T>, R = VigorRetryPipeResult<T> | VigorDefaultType> = {
|
|
1060
|
+
__brand: VigorBrand<"Retry", "Context<Schema">;
|
|
1061
|
+
result: R;
|
|
1062
|
+
error: unknown;
|
|
1063
|
+
system: {
|
|
1064
|
+
delay: number | VigorDefaultType;
|
|
1065
|
+
attempt: number;
|
|
1066
|
+
};
|
|
1067
|
+
flags: {
|
|
1068
|
+
doRetry: boolean;
|
|
1069
|
+
doRestart: boolean;
|
|
1070
|
+
brokeRetry: boolean;
|
|
1071
|
+
overridden: boolean;
|
|
1072
|
+
};
|
|
1073
|
+
record: Record<string, any>;
|
|
1074
|
+
policy: T["policy"];
|
|
1075
|
+
};
|
|
1076
|
+
/** Context shape seen by `before` middlewares — the target hasn't run yet, so there's no result. */
|
|
1077
|
+
type VigorRetryBeforeContextSchema<T extends VigorRetrySchema<T>> = VigorRetryContextSchema<T, VigorDefaultType>;
|
|
1078
|
+
/** Context shape seen by `after` / `onResult` middlewares — the target has settled. */
|
|
1079
|
+
type VigorRetryAfterContextSchema<T extends VigorRetrySchema<T>> = VigorRetryContextSchema<T, VigorRetryPipeInitialContext<T>["result"]>;
|
|
1080
|
+
|
|
1081
|
+
type VigorRetryPolicySettingsSchema<T extends VigorRetrySchema<T>> = {
|
|
1082
|
+
__brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
1083
|
+
default: ((ctx: VigorRetryContextSchema<T>) => any | Promise<any>) | VigorEmptyType;
|
|
1084
|
+
maxAttempts: number;
|
|
1085
|
+
maxRestarts: number;
|
|
1086
|
+
timeout: number;
|
|
1087
|
+
};
|
|
1088
|
+
declare const VigorRetryPolicySettingsBase: {
|
|
1089
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
1090
|
+
readonly default: symbol & {
|
|
1091
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1092
|
+
};
|
|
1093
|
+
readonly maxAttempts: 5;
|
|
1094
|
+
readonly maxRestarts: 3;
|
|
1095
|
+
readonly timeout: 20000;
|
|
1096
|
+
};
|
|
1097
|
+
/** Immutable builder for a retry policy's general settings. */
|
|
1098
|
+
declare class VigorRetryPolicySettings<T extends VigorRetrySchema<T> = typeof VigorRetryBase> extends VigorStatus<VigorRetrySchema<any>, T, VigorRetryPolicySettingsTypeLambda> {
|
|
1099
|
+
constructor(config?: T);
|
|
1100
|
+
protected _create<C>(config: C): VigorApply<VigorRetryPolicySettingsTypeLambda, C>;
|
|
1101
|
+
/** Sets the fallback value/factory used when the target ultimately fails. */
|
|
1102
|
+
default<const N extends VigorExcludeEmpty<VigorRetrySchema<any>["policy"]["settings"]["default"]>>(func: N): VigorRetryPolicySettings<VigorRetryIn<VigorDeepMerge<T, {
|
|
1377
1103
|
readonly policy: {
|
|
1378
1104
|
readonly settings: {
|
|
1379
|
-
readonly
|
|
1105
|
+
readonly default: N;
|
|
1380
1106
|
};
|
|
1381
1107
|
};
|
|
1382
1108
|
}>>>;
|
|
1383
|
-
/**
|
|
1384
|
-
|
|
1109
|
+
/** Sets the maximum number of retry attempts before giving up. */
|
|
1110
|
+
maxAttempts<const N extends VigorRetrySchema<any>["policy"]["settings"]["maxAttempts"]>(num: N): VigorRetryPolicySettings<VigorRetryIn<VigorDeepMerge<T, {
|
|
1385
1111
|
readonly policy: {
|
|
1386
1112
|
readonly settings: {
|
|
1387
|
-
readonly
|
|
1113
|
+
readonly maxAttempts: N;
|
|
1114
|
+
};
|
|
1115
|
+
};
|
|
1116
|
+
}>>>;
|
|
1117
|
+
/** Sets the maximum number of full restarts allowed. */
|
|
1118
|
+
maxRestarts<const N extends VigorRetrySchema<any>["policy"]["settings"]["maxRestarts"]>(num: N): VigorRetryPolicySettings<VigorRetryIn<VigorDeepMerge<T, {
|
|
1119
|
+
readonly policy: {
|
|
1120
|
+
readonly settings: {
|
|
1121
|
+
readonly maxRestarts: N;
|
|
1122
|
+
};
|
|
1123
|
+
};
|
|
1124
|
+
}>>>;
|
|
1125
|
+
/** Sets the timeout, in milliseconds, for a single attempt. */
|
|
1126
|
+
timeout<const N extends VigorRetrySchema<any>["policy"]["settings"]["timeout"]>(num: N): VigorRetryPolicySettings<VigorRetryIn<VigorDeepMerge<T, {
|
|
1127
|
+
readonly policy: {
|
|
1128
|
+
readonly settings: {
|
|
1129
|
+
readonly timeout: N;
|
|
1388
1130
|
};
|
|
1389
1131
|
};
|
|
1390
1132
|
}>>>;
|
|
1391
1133
|
}
|
|
1392
1134
|
|
|
1393
|
-
type
|
|
1394
|
-
type
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1135
|
+
type VigorRetryIn<T> = T extends VigorRetrySchema<any> ? T : never;
|
|
1136
|
+
type VigorRetryAlgorithmsConstantIn<T> = T extends VigorRetryPolicyAlgorithmsConstantSchema<any> ? T : never;
|
|
1137
|
+
type VigorRetryAlgorithmsLinearIn<T> = T extends VigorRetryPolicyAlgorithmsLinearSchema<any> ? T : never;
|
|
1138
|
+
type VigorRetryAlgorithmsBackoffIn<T> = T extends VigorRetryPolicyAlgorithmsBackoffSchema<any> ? T : never;
|
|
1139
|
+
type VigorRetryAlgorithmsCustomIn<T> = T extends VigorRetryPolicyAlgorithmsCustomSchema<any> ? T : never;
|
|
1140
|
+
interface VigorRetryTypeLambda extends VigorTypeLambda {
|
|
1141
|
+
readonly Target: VigorRetry<VigorRetryIn<this["In"]>>;
|
|
1142
|
+
}
|
|
1143
|
+
interface VigorRetryPolicySettingsTypeLambda extends VigorTypeLambda {
|
|
1144
|
+
readonly Target: VigorRetryPolicySettings<VigorRetryIn<this["In"]>>;
|
|
1145
|
+
}
|
|
1146
|
+
interface VigorRetryPolicyMiddlewaresTypeLambda extends VigorTypeLambda {
|
|
1147
|
+
readonly Target: VigorRetryPolicyMiddlewares<VigorRetryIn<this["In"]>>;
|
|
1148
|
+
}
|
|
1149
|
+
interface VigorRetryPolicyAlgorithmsTypeLambda extends VigorTypeLambda {
|
|
1150
|
+
readonly Target: VigorRetryPolicyAlgorithms<VigorRetryIn<this["In"]>>;
|
|
1151
|
+
}
|
|
1152
|
+
interface VigorRetryPolicyAlgorithmsConstantTypeLambda extends VigorTypeLambda {
|
|
1153
|
+
readonly Target: VigorRetryPolicyAlgorithmsConstant<VigorRetryAlgorithmsConstantIn<this["In"]>>;
|
|
1154
|
+
}
|
|
1155
|
+
interface VigorRetryPolicyAlgorithmsLinearTypeLambda extends VigorTypeLambda {
|
|
1156
|
+
readonly Target: VigorRetryPolicyAlgorithmsLinear<VigorRetryAlgorithmsLinearIn<this["In"]>>;
|
|
1157
|
+
}
|
|
1158
|
+
interface VigorRetryPolicyAlgorithmsBackoffTypeLambda extends VigorTypeLambda {
|
|
1159
|
+
readonly Target: VigorRetryPolicyAlgorithmsBackoff<VigorRetryAlgorithmsBackoffIn<this["In"]>>;
|
|
1160
|
+
}
|
|
1161
|
+
interface VigorRetryPolicyAlgorithmsCustomTypeLambda extends VigorTypeLambda {
|
|
1162
|
+
readonly Target: VigorRetryPolicyAlgorithmsCustom<VigorRetryAlgorithmsCustomIn<this["In"]>>;
|
|
1163
|
+
}
|
|
1164
|
+
|
|
1165
|
+
type VigorRetryPolicySchema<T extends VigorRetrySchema<T>> = {
|
|
1166
|
+
__brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
1167
|
+
target: ((signal: AbortSignal) => any | Promise<any>) | VigorEmptyType;
|
|
1168
|
+
abortSignals: AbortSignal[];
|
|
1169
|
+
settings: VigorRetryPolicySettingsSchema<T>;
|
|
1170
|
+
middlewares: VigorRetryPolicyMiddlewaresSchema<T>;
|
|
1171
|
+
algorithms: VigorRetryPolicyAlgorithmsSchema<T>;
|
|
1399
1172
|
};
|
|
1400
|
-
declare const
|
|
1401
|
-
readonly __brand: VigorBrand<"
|
|
1402
|
-
readonly target:
|
|
1173
|
+
declare const VigorRetryPolicyBase: {
|
|
1174
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
1175
|
+
readonly target: symbol & {
|
|
1176
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1177
|
+
};
|
|
1178
|
+
readonly abortSignals: [];
|
|
1403
1179
|
readonly settings: {
|
|
1404
|
-
readonly __brand: VigorBrand<"
|
|
1405
|
-
readonly
|
|
1406
|
-
|
|
1180
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
1181
|
+
readonly default: symbol & {
|
|
1182
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1183
|
+
};
|
|
1184
|
+
readonly maxAttempts: 5;
|
|
1185
|
+
readonly maxRestarts: 3;
|
|
1186
|
+
readonly timeout: 20000;
|
|
1407
1187
|
};
|
|
1408
1188
|
readonly middlewares: {
|
|
1409
|
-
readonly __brand: VigorBrand<"
|
|
1410
|
-
readonly before:
|
|
1411
|
-
readonly after:
|
|
1412
|
-
readonly
|
|
1189
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
1190
|
+
readonly before: [];
|
|
1191
|
+
readonly after: [];
|
|
1192
|
+
readonly onResult: [];
|
|
1193
|
+
readonly retryIf: [];
|
|
1194
|
+
readonly onRetry: [];
|
|
1195
|
+
readonly onError: [];
|
|
1413
1196
|
};
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
record: Record<string, any>;
|
|
1421
|
-
};
|
|
1422
|
-
type VigorAllEachContextSchema<T extends VigorAllSchema<T>> = {
|
|
1423
|
-
__brand: VigorBrand<"All", "EachContext<Schema">;
|
|
1424
|
-
result: unknown | VigorDefaultType;
|
|
1425
|
-
error: unknown;
|
|
1426
|
-
flags: {
|
|
1427
|
-
overrided: boolean;
|
|
1197
|
+
readonly algorithms: {
|
|
1198
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
1199
|
+
readonly _tag: "constant";
|
|
1200
|
+
readonly jitter: 1000;
|
|
1201
|
+
readonly interval: 2000;
|
|
1202
|
+
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
1428
1203
|
};
|
|
1429
|
-
record: Record<string, any>;
|
|
1430
1204
|
};
|
|
1431
1205
|
|
|
1432
|
-
type
|
|
1433
|
-
__brand: VigorBrand<"
|
|
1434
|
-
policy:
|
|
1435
|
-
|
|
1206
|
+
type VigorRetrySchema<T extends VigorRetrySchema<T>> = {
|
|
1207
|
+
__brand: VigorBrand<"Retry", "Schema">;
|
|
1208
|
+
policy: VigorRetryPolicySchema<T>;
|
|
1209
|
+
/** Type-level override for the resolved result type, set via `.cast<T>()`. */
|
|
1210
|
+
cast: unknown;
|
|
1436
1211
|
};
|
|
1437
|
-
declare const
|
|
1438
|
-
readonly __brand: VigorBrand<"
|
|
1212
|
+
declare const VigorRetryBase: {
|
|
1213
|
+
readonly __brand: VigorBrand<"Retry", "Schema">;
|
|
1439
1214
|
readonly policy: {
|
|
1440
|
-
readonly __brand: VigorBrand<"
|
|
1441
|
-
readonly target:
|
|
1442
|
-
|
|
1443
|
-
readonly __brand: VigorBrand<"All", "Policy<Settings<Schema">;
|
|
1444
|
-
readonly concurrency: 5;
|
|
1445
|
-
readonly onlySuccess: false;
|
|
1215
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
1216
|
+
readonly target: symbol & {
|
|
1217
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1446
1218
|
};
|
|
1447
|
-
readonly
|
|
1448
|
-
|
|
1449
|
-
readonly
|
|
1450
|
-
readonly
|
|
1451
|
-
|
|
1219
|
+
readonly abortSignals: [];
|
|
1220
|
+
readonly settings: {
|
|
1221
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
1222
|
+
readonly default: symbol & {
|
|
1223
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1224
|
+
};
|
|
1225
|
+
readonly maxAttempts: 5;
|
|
1226
|
+
readonly maxRestarts: 3;
|
|
1227
|
+
readonly timeout: 20000;
|
|
1452
1228
|
};
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1229
|
+
readonly middlewares: {
|
|
1230
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
1231
|
+
readonly before: [];
|
|
1232
|
+
readonly after: [];
|
|
1233
|
+
readonly onResult: [];
|
|
1234
|
+
readonly retryIf: [];
|
|
1235
|
+
readonly onRetry: [];
|
|
1236
|
+
readonly onError: [];
|
|
1458
1237
|
};
|
|
1459
|
-
readonly
|
|
1460
|
-
readonly __brand: VigorBrand<"
|
|
1461
|
-
readonly
|
|
1462
|
-
readonly
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
readonly onlySuccess: false;
|
|
1466
|
-
};
|
|
1467
|
-
readonly middlewares: {
|
|
1468
|
-
readonly __brand: VigorBrand<"All", "Policy<Middlewares<Schema">;
|
|
1469
|
-
readonly before: VigorAllEachMiddlewareFn[];
|
|
1470
|
-
readonly after: VigorAllEachMiddlewareFn[];
|
|
1471
|
-
readonly onError: VigorAllEachOnErrorFn[];
|
|
1472
|
-
};
|
|
1238
|
+
readonly algorithms: {
|
|
1239
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
1240
|
+
readonly _tag: "constant";
|
|
1241
|
+
readonly jitter: 1000;
|
|
1242
|
+
readonly interval: 2000;
|
|
1243
|
+
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
1473
1244
|
};
|
|
1474
|
-
|
|
1245
|
+
};
|
|
1246
|
+
readonly cast: symbol & {
|
|
1247
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1475
1248
|
};
|
|
1476
1249
|
};
|
|
1477
1250
|
/**
|
|
1478
|
-
* Immutable builder that
|
|
1479
|
-
*
|
|
1480
|
-
*
|
|
1251
|
+
* Immutable builder that executes a target function with retry, restart,
|
|
1252
|
+
* timeout, and abort support, driven by a configurable delay algorithm and
|
|
1253
|
+
* middleware pipeline.
|
|
1481
1254
|
*/
|
|
1482
|
-
declare class
|
|
1255
|
+
declare class VigorRetry<T extends VigorRetrySchema<T> = typeof VigorRetryBase> extends VigorStatus<VigorRetrySchema<T>, T, VigorRetryTypeLambda> {
|
|
1483
1256
|
constructor(config?: T);
|
|
1484
|
-
protected _create<C>(config: C): VigorApply<
|
|
1485
|
-
/** Sets the
|
|
1486
|
-
target<const N extends
|
|
1257
|
+
protected _create<C>(config: C): VigorApply<VigorRetryTypeLambda, C>;
|
|
1258
|
+
/** Sets the target function to invoke, with retry/timeout applied. */
|
|
1259
|
+
target<const N extends VigorExcludeEmpty<VigorRetrySchema<T>["policy"]["target"]>>(func: N): VigorRetry<VigorRetryIn<VigorDeepMerge<T, {
|
|
1487
1260
|
readonly policy: {
|
|
1488
1261
|
readonly target: N;
|
|
1489
1262
|
};
|
|
1490
1263
|
}>>>;
|
|
1491
|
-
/**
|
|
1492
|
-
|
|
1264
|
+
/** Sets external abort signals that, when aborted, stop retrying. */
|
|
1265
|
+
abortSignals<const N extends VigorRetrySchema<T>["policy"]["abortSignals"]>(...sig: N): VigorRetry<VigorRetryIn<VigorDeepMerge<T, {
|
|
1493
1266
|
readonly policy: {
|
|
1494
|
-
readonly
|
|
1267
|
+
readonly abortSignals: N;
|
|
1495
1268
|
};
|
|
1496
1269
|
}>>>;
|
|
1497
|
-
/** Configures the
|
|
1498
|
-
|
|
1270
|
+
/** Configures the retry policy's general settings (max attempts, timeout, etc). */
|
|
1271
|
+
settings<const N extends VigorDeepPartial<VigorRetryPolicySettingsSchema<T>>, R extends VigorRetrySchema<any>>(input: N | ((s: VigorRetryPolicySettings<T>) => VigorRetryPolicySettings<R>) | VigorRetryPolicySettings<R>): VigorRetry<VigorRetryIn<VigorDeepMerge<T, {
|
|
1499
1272
|
readonly policy: {
|
|
1500
|
-
readonly
|
|
1273
|
+
readonly settings: VigorRetryPolicySettingsSchema<any>;
|
|
1501
1274
|
};
|
|
1502
1275
|
}>>>;
|
|
1503
|
-
/**
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1276
|
+
/** Configures the retry policy's middleware pipeline. */
|
|
1277
|
+
middlewares<const N extends VigorDeepPartial<VigorRetryPolicyMiddlewaresSchema<T>>, R extends VigorRetrySchema<any>>(input: N | ((s: VigorRetryPolicyMiddlewares<T>) => VigorRetryPolicyMiddlewares<R>) | VigorRetryPolicyMiddlewares<R>): VigorRetry<VigorRetryIn<VigorDeepMerge<T, {
|
|
1278
|
+
readonly policy: {
|
|
1279
|
+
readonly middlewares: VigorRetryPolicyMiddlewaresSchema<any>;
|
|
1280
|
+
};
|
|
1281
|
+
}>>>;
|
|
1282
|
+
/** Configures the retry policy's delay algorithm. */
|
|
1283
|
+
algorithms<const N extends VigorDeepPartial<VigorRetryPolicyAlgorithmsSchema<T>>, R extends VigorRetrySchema<any>>(input: N | ((a: VigorRetryPolicyAlgorithms<T>) => VigorRetryPolicyAlgorithms<R> | VigorRetryPolicyAlgorithmsConstant<any>)): VigorRetry<VigorRetryIn<VigorDeepMerge<T, {
|
|
1284
|
+
readonly policy: {
|
|
1285
|
+
readonly algorithms: any;
|
|
1286
|
+
};
|
|
1287
|
+
}>>>;
|
|
1288
|
+
/**
|
|
1289
|
+
* Overrides the resolved result type with `T`, taking priority over the
|
|
1290
|
+
* type naturally inferred from `target()`. Can be called before or after
|
|
1291
|
+
* `target()` (or any other configuration method); whichever `.cast<T>()`
|
|
1292
|
+
* call happens last wins.
|
|
1293
|
+
*/
|
|
1294
|
+
cast<const C>(): VigorRetry<VigorRetryIn<VigorDeepMerge<T, {
|
|
1295
|
+
cast: C;
|
|
1296
|
+
}>>>;
|
|
1297
|
+
/** Runs the target and returns its result directly, throwing on final failure. */
|
|
1298
|
+
request<R = VigorCastResult<T["cast"], VigorRetryContextSchema<T>["result"]>>(): Promise<R>;
|
|
1299
|
+
/** Runs the target and returns a result/error envelope instead of throwing. */
|
|
1300
|
+
requestVerbose<R = VigorCastResult<T["cast"], VigorRetryContextSchema<T>["result"]>>(): Promise<{
|
|
1509
1301
|
success: false;
|
|
1510
1302
|
data: null;
|
|
1511
1303
|
error: unknown;
|
|
@@ -1514,215 +1306,244 @@ declare class VigorAll<T extends VigorAllSchema<T> = typeof VigorAllBase> extend
|
|
|
1514
1306
|
data: R;
|
|
1515
1307
|
error: null;
|
|
1516
1308
|
}>;
|
|
1517
|
-
/** Internal execution loop implementing the
|
|
1309
|
+
/** Internal execution loop implementing the attempt/retry/restart lifecycle. */
|
|
1518
1310
|
private requestRuntime;
|
|
1519
1311
|
}
|
|
1520
1312
|
|
|
1521
|
-
type
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
|
|
1525
|
-
interface VigorAllPolicySettingsTypeLambda extends VigorTypeLambda {
|
|
1526
|
-
readonly Target: VigorAllPolicySettings<VigorAllIn<this["In"]>>;
|
|
1527
|
-
}
|
|
1528
|
-
interface VigorAllPolicyMiddlewaresTypeLambda extends VigorTypeLambda {
|
|
1529
|
-
readonly Target: VigorAllPolicyMiddlewares<VigorAllIn<this["In"]>>;
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
type VigorAllEachMiddlewareFn = (ctx: VigorAllEachContextSchema<any>) => void | Promise<void>;
|
|
1533
|
-
type VigorAllEachOnErrorFn = (ctx: VigorAllEachContextSchema<any>, api: {
|
|
1534
|
-
setResult: (r: unknown) => void;
|
|
1535
|
-
}) => void | Promise<void>;
|
|
1536
|
-
type VigorAllPolicyMiddlewaresSchema<T extends VigorAllSchema<T>> = {
|
|
1537
|
-
__brand: VigorBrand<"All", "Policy<Middlewares<Schema">;
|
|
1538
|
-
before: VigorAllEachMiddlewareFn[];
|
|
1539
|
-
after: VigorAllEachMiddlewareFn[];
|
|
1540
|
-
onError: VigorAllEachOnErrorFn[];
|
|
1313
|
+
type VigorParseStrategyFunc = (response: Response) => Promise<any>;
|
|
1314
|
+
type VigorParsePolicyStrategiesSchema<T extends VigorParseSchema<T>> = {
|
|
1315
|
+
__brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
1316
|
+
funcs: Array<VigorParseStrategyFunc>;
|
|
1541
1317
|
};
|
|
1542
|
-
declare const
|
|
1543
|
-
readonly __brand: VigorBrand<"
|
|
1544
|
-
readonly
|
|
1545
|
-
readonly after: VigorAllEachMiddlewareFn[];
|
|
1546
|
-
readonly onError: VigorAllEachOnErrorFn[];
|
|
1318
|
+
declare const VigorParsePolicyStrategiesBase: {
|
|
1319
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
1320
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1547
1321
|
};
|
|
1548
|
-
/**
|
|
1549
|
-
declare
|
|
1322
|
+
/** Parses a response by matching its `Content-Type` header against a known parser table. */
|
|
1323
|
+
declare const VigorParseContentTypeStrategy: VigorParseStrategyFunc;
|
|
1324
|
+
/** Parses a response by trying a sequence of body-reading methods until one succeeds. */
|
|
1325
|
+
declare const VigorParseSniffStrategy: VigorParseStrategyFunc;
|
|
1326
|
+
/** Immutable builder for a parse policy's fallback chain of parsing strategies. */
|
|
1327
|
+
declare class VigorParsePolicyStrategies<T extends VigorParseSchema<T> = typeof VigorParseBase> extends VigorStatus<VigorParseSchema<any>, T, VigorParsePolicyStrategiesTypeLambda> {
|
|
1550
1328
|
constructor(config?: T);
|
|
1551
|
-
protected _create<C>(config: C): VigorApply<
|
|
1552
|
-
/**
|
|
1553
|
-
|
|
1329
|
+
protected _create<C>(config: C): VigorApply<VigorParsePolicyStrategiesTypeLambda, C>;
|
|
1330
|
+
/**
|
|
1331
|
+
* Adds strategy functions to the fallback chain.
|
|
1332
|
+
*
|
|
1333
|
+
* @param replace - When `true`, replaces the existing chain instead of
|
|
1334
|
+
* appending to it (the default is to concat, since strategies are
|
|
1335
|
+
* tried in sequence as a fallback chain).
|
|
1336
|
+
*/
|
|
1337
|
+
private _set;
|
|
1338
|
+
/** Adds the content-type based parsing strategy. */
|
|
1339
|
+
contentType(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
1554
1340
|
readonly policy: {
|
|
1555
|
-
readonly
|
|
1556
|
-
readonly
|
|
1341
|
+
readonly strategies: {
|
|
1342
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1557
1343
|
};
|
|
1558
1344
|
};
|
|
1559
1345
|
}>>>;
|
|
1560
|
-
/**
|
|
1561
|
-
|
|
1346
|
+
/** Adds the sniffing (try-each-method) parsing strategy. */
|
|
1347
|
+
sniff(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
1562
1348
|
readonly policy: {
|
|
1563
|
-
readonly
|
|
1564
|
-
readonly
|
|
1349
|
+
readonly strategies: {
|
|
1350
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1565
1351
|
};
|
|
1566
1352
|
};
|
|
1567
1353
|
}>>>;
|
|
1568
|
-
/**
|
|
1569
|
-
|
|
1354
|
+
/** Adds a strategy that always parses the response as JSON. */
|
|
1355
|
+
json(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
1570
1356
|
readonly policy: {
|
|
1571
|
-
readonly
|
|
1572
|
-
readonly
|
|
1357
|
+
readonly strategies: {
|
|
1358
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1359
|
+
};
|
|
1360
|
+
};
|
|
1361
|
+
}>>>;
|
|
1362
|
+
/** Adds a strategy that always parses the response as text. */
|
|
1363
|
+
text(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
1364
|
+
readonly policy: {
|
|
1365
|
+
readonly strategies: {
|
|
1366
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1367
|
+
};
|
|
1368
|
+
};
|
|
1369
|
+
}>>>;
|
|
1370
|
+
/** Adds a strategy that always parses the response as an `ArrayBuffer`. */
|
|
1371
|
+
arrayBuffer(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
1372
|
+
readonly policy: {
|
|
1373
|
+
readonly strategies: {
|
|
1374
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1375
|
+
};
|
|
1376
|
+
};
|
|
1377
|
+
}>>>;
|
|
1378
|
+
/** Adds a strategy that always parses the response as a `Blob`. */
|
|
1379
|
+
blob(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
1380
|
+
readonly policy: {
|
|
1381
|
+
readonly strategies: {
|
|
1382
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1383
|
+
};
|
|
1384
|
+
};
|
|
1385
|
+
}>>>;
|
|
1386
|
+
/** Adds a strategy that always parses the response as a `Uint8Array`. */
|
|
1387
|
+
bytes(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
1388
|
+
readonly policy: {
|
|
1389
|
+
readonly strategies: {
|
|
1390
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1391
|
+
};
|
|
1392
|
+
};
|
|
1393
|
+
}>>>;
|
|
1394
|
+
/** Adds a strategy that always parses the response as `FormData`. */
|
|
1395
|
+
formData(replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
1396
|
+
readonly policy: {
|
|
1397
|
+
readonly strategies: {
|
|
1398
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1399
|
+
};
|
|
1400
|
+
};
|
|
1401
|
+
}>>>;
|
|
1402
|
+
/** Adds a user-supplied custom parsing strategy. */
|
|
1403
|
+
custom<const N extends VigorParseStrategyFunc>(func: N, replace?: boolean): VigorParsePolicyStrategies<VigorParseIn<VigorDeepMerge<T, {
|
|
1404
|
+
readonly policy: {
|
|
1405
|
+
readonly strategies: {
|
|
1406
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1573
1407
|
};
|
|
1574
1408
|
};
|
|
1575
1409
|
}>>>;
|
|
1576
1410
|
}
|
|
1577
1411
|
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1412
|
+
/**
|
|
1413
|
+
* Base shape shared by every parse context variant. `R` is the type of
|
|
1414
|
+
* `result` at the point the context is observed — computed per pipeline
|
|
1415
|
+
* stage instead of being fixed on the schema.
|
|
1416
|
+
*/
|
|
1417
|
+
type VigorParseContextSchema<T extends VigorParseSchema<T>, R = VigorCastResult<T["cast"], unknown> | VigorDefaultType> = {
|
|
1418
|
+
__brand: VigorBrand<"Parse", "Context<Schema">;
|
|
1419
|
+
result: R;
|
|
1420
|
+
error: unknown;
|
|
1421
|
+
response: VigorParsePolicySchema<T>["target"];
|
|
1422
|
+
flags: {
|
|
1423
|
+
overrided: boolean;
|
|
1424
|
+
restarted: boolean;
|
|
1425
|
+
};
|
|
1426
|
+
record: Record<string, any>;
|
|
1427
|
+
policy: T["policy"];
|
|
1428
|
+
};
|
|
1429
|
+
/** Context shape seen by `before` middlewares — parsing hasn't run yet. */
|
|
1430
|
+
type VigorParseBeforeContextSchema<T extends VigorParseSchema<T>> = VigorParseContextSchema<T, VigorDefaultType>;
|
|
1431
|
+
/** Context shape seen by `after` / `onResult` middlewares — a result has been produced. */
|
|
1432
|
+
type VigorParseAfterContextSchema<T extends VigorParseSchema<T>> = VigorParseContextSchema<T, VigorCastResult<T["cast"], unknown> | VigorDefaultType>;
|
|
1433
|
+
|
|
1434
|
+
type VigorParsePolicySettingsSchema<T extends VigorParseSchema<T>> = {
|
|
1435
|
+
__brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
1436
|
+
raw: boolean;
|
|
1437
|
+
default: ((ctx: VigorParseContextSchema<T>) => any | Promise<any>) | VigorEmptyType;
|
|
1582
1438
|
maxRestarts: number;
|
|
1583
|
-
default: ((ctx: T["context"]) => any | Promise<any>) | VigorEmptyType;
|
|
1584
1439
|
};
|
|
1585
|
-
declare const
|
|
1586
|
-
readonly __brand: VigorBrand<"
|
|
1587
|
-
readonly
|
|
1588
|
-
readonly unretryStatus: [400, 401, 403, 404, 405, 413, 422];
|
|
1589
|
-
readonly maxRestarts: 3;
|
|
1440
|
+
declare const VigorParsePolicySettingsBase: {
|
|
1441
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
1442
|
+
readonly raw: false;
|
|
1590
1443
|
readonly default: symbol & {
|
|
1591
1444
|
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1592
1445
|
};
|
|
1446
|
+
readonly maxRestarts: 3;
|
|
1593
1447
|
};
|
|
1594
|
-
/** Immutable builder for a
|
|
1595
|
-
declare class
|
|
1448
|
+
/** Immutable builder for a parse policy's general settings. */
|
|
1449
|
+
declare class VigorParsePolicySettings<T extends VigorParseSchema<T> = typeof VigorParseBase> extends VigorStatus<VigorParseSchema<any>, T, VigorParsePolicySettingsTypeLambda> {
|
|
1596
1450
|
constructor(config?: T);
|
|
1597
|
-
protected _create<C>(config: C): VigorApply<
|
|
1598
|
-
/**
|
|
1599
|
-
|
|
1600
|
-
readonly policy: {
|
|
1601
|
-
readonly settings: {
|
|
1602
|
-
readonly retryHeaders: N;
|
|
1603
|
-
};
|
|
1604
|
-
};
|
|
1605
|
-
}>>>;
|
|
1606
|
-
/** Sets HTTP status codes that should never be retried. */
|
|
1607
|
-
unretryStatus<const N extends VigorFetchSchema<any>["policy"]["settings"]["unretryStatus"]>(...nums: N): VigorFetchPolicySettings<VigorFetchIn<VigorDeepMerge<T, {
|
|
1451
|
+
protected _create<C>(config: C): VigorApply<VigorParsePolicySettingsTypeLambda, C>;
|
|
1452
|
+
/** When enabled, skips content-type based parsing and returns the raw response. */
|
|
1453
|
+
raw<const N extends VigorParseSchema<any>["policy"]["settings"]["raw"]>(bool: N): VigorParsePolicySettings<VigorParseIn<VigorDeepMerge<T, {
|
|
1608
1454
|
readonly policy: {
|
|
1609
1455
|
readonly settings: {
|
|
1610
|
-
readonly
|
|
1456
|
+
readonly raw: N;
|
|
1611
1457
|
};
|
|
1612
1458
|
};
|
|
1613
1459
|
}>>>;
|
|
1614
|
-
/** Sets the
|
|
1615
|
-
|
|
1460
|
+
/** Sets the fallback value/factory used when parsing ultimately fails. */
|
|
1461
|
+
default<const N extends VigorExcludeEmpty<VigorParseSchema<any>["policy"]["settings"]["default"]>>(func: N): VigorParsePolicySettings<VigorParseIn<VigorDeepMerge<T, {
|
|
1616
1462
|
readonly policy: {
|
|
1617
1463
|
readonly settings: {
|
|
1618
|
-
readonly
|
|
1464
|
+
readonly default: N;
|
|
1619
1465
|
};
|
|
1620
1466
|
};
|
|
1621
|
-
}>>>;
|
|
1622
|
-
/** Sets the
|
|
1623
|
-
|
|
1467
|
+
}>>>;
|
|
1468
|
+
/** Sets the maximum number of full restarts allowed. */
|
|
1469
|
+
maxRestarts<const N extends VigorParseSchema<any>["policy"]["settings"]["maxRestarts"]>(num: N): VigorParsePolicySettings<VigorParseIn<VigorDeepMerge<T, {
|
|
1624
1470
|
readonly policy: {
|
|
1625
1471
|
readonly settings: {
|
|
1626
|
-
readonly
|
|
1472
|
+
readonly maxRestarts: N;
|
|
1627
1473
|
};
|
|
1628
1474
|
};
|
|
1629
1475
|
}>>>;
|
|
1630
1476
|
}
|
|
1631
1477
|
|
|
1632
|
-
type
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1636
|
-
|
|
1637
|
-
|
|
1638
|
-
};
|
|
1639
|
-
type VigorFetchContextSchema<T extends VigorFetchSchema<T>> = {
|
|
1640
|
-
__brand: VigorBrand<"Fetch", "Context<Schema">;
|
|
1641
|
-
href: string;
|
|
1642
|
-
response: Response | VigorDefaultType;
|
|
1643
|
-
result: unknown | VigorDefaultType;
|
|
1644
|
-
error: unknown;
|
|
1645
|
-
options: VigorFetchOptions | VigorDefaultType;
|
|
1646
|
-
flags: {
|
|
1647
|
-
overrided: boolean;
|
|
1648
|
-
restarted: boolean;
|
|
1649
|
-
};
|
|
1650
|
-
record: Record<string, any>;
|
|
1651
|
-
policy: T["policy"];
|
|
1652
|
-
};
|
|
1653
|
-
|
|
1654
|
-
type VigorFetchPolicyMiddlewaresSchema<T extends VigorFetchSchema<T>> = {
|
|
1655
|
-
__brand: VigorBrand<"Fetch", "Policy<Middlewares<Schema">;
|
|
1656
|
-
before: (VigorFetchPolicyMiddlewaresFluent<T>["before"] | VigorFetchPolicyMiddlewaresIntercept<T>["before"])[];
|
|
1657
|
-
after: (VigorFetchPolicyMiddlewaresFluent<T>["after"] | VigorFetchPolicyMiddlewaresIntercept<T>["after"])[];
|
|
1658
|
-
onResult: (VigorFetchPolicyMiddlewaresFluent<T>["onResult"] | VigorFetchPolicyMiddlewaresIntercept<T>["onResult"])[];
|
|
1659
|
-
onError: (VigorFetchPolicyMiddlewaresFluent<T>["onError"] | VigorFetchPolicyMiddlewaresIntercept<T>["onError"])[];
|
|
1478
|
+
type VigorParsePolicyMiddlewaresSchema<T extends VigorParseSchema<T>> = {
|
|
1479
|
+
__brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
1480
|
+
before: (VigorParsePolicyMiddlewaresFluent<T>["before"] | VigorParsePolicyMiddlewaresIntercept<T>["before"])[];
|
|
1481
|
+
after: (VigorParsePolicyMiddlewaresFluent<T>["after"] | VigorParsePolicyMiddlewaresIntercept<T>["after"])[];
|
|
1482
|
+
onResult: (VigorParsePolicyMiddlewaresFluent<T>["onResult"] | VigorParsePolicyMiddlewaresIntercept<T>["onResult"])[];
|
|
1483
|
+
onError: (VigorParsePolicyMiddlewaresFluent<T>["onError"] | VigorParsePolicyMiddlewaresIntercept<T>["onError"])[];
|
|
1660
1484
|
};
|
|
1661
|
-
declare const
|
|
1662
|
-
readonly __brand: VigorBrand<"
|
|
1485
|
+
declare const VigorParsePolicyMiddlewaresBase: {
|
|
1486
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
1663
1487
|
readonly before: [];
|
|
1664
1488
|
readonly after: [];
|
|
1665
1489
|
readonly onResult: [];
|
|
1666
1490
|
readonly onError: [];
|
|
1667
1491
|
};
|
|
1668
|
-
type
|
|
1669
|
-
__brand: VigorBrand<"
|
|
1492
|
+
type VigorParsePolicyMiddlewaresFluent<T extends VigorParseSchema<T>> = {
|
|
1493
|
+
__brand: VigorBrand<"Parse", "Policy<Middlewares<Fluent<Schema">;
|
|
1670
1494
|
before: {
|
|
1671
1495
|
_mode: "fluent";
|
|
1672
|
-
func: (ctx: T
|
|
1496
|
+
func: (ctx: VigorParseBeforeContextSchema<T>) => void;
|
|
1673
1497
|
};
|
|
1674
1498
|
after: {
|
|
1675
1499
|
_mode: "fluent";
|
|
1676
|
-
func: (ctx: T
|
|
1500
|
+
func: (ctx: VigorParseAfterContextSchema<T>) => void;
|
|
1677
1501
|
};
|
|
1678
1502
|
onResult: {
|
|
1679
1503
|
_mode: "fluent";
|
|
1680
|
-
func: (res: T["
|
|
1504
|
+
func: (res: VigorParseAfterContextSchema<T>["result"]) => VigorParseContextSchema<any>["result"];
|
|
1681
1505
|
};
|
|
1682
1506
|
onError: {
|
|
1683
1507
|
_mode: "fluent";
|
|
1684
|
-
func: (err: T["
|
|
1508
|
+
func: (err: VigorParseContextSchema<T>["error"]) => void;
|
|
1685
1509
|
};
|
|
1686
1510
|
};
|
|
1687
|
-
type
|
|
1688
|
-
setResult: (res:
|
|
1689
|
-
throwError: (err:
|
|
1690
|
-
setOptions: (opts: VigorFetchOptions) => void;
|
|
1691
|
-
setHeaders: (headers: VigorFetchOptions["headers"]) => void;
|
|
1692
|
-
setBody: (body: VigorFetchOptions["body"]) => void;
|
|
1511
|
+
type VigorParsePolicyMiddlewaresApi<T extends VigorParseSchema<T>> = {
|
|
1512
|
+
setResult: (res: VigorParseContextSchema<any>["result"]) => void;
|
|
1513
|
+
throwError: (err: VigorParseContextSchema<any>["error"]) => void;
|
|
1693
1514
|
proceedRestart: () => void;
|
|
1694
1515
|
cancelRestart: () => void;
|
|
1695
1516
|
};
|
|
1696
|
-
type
|
|
1697
|
-
__brand: VigorBrand<"
|
|
1517
|
+
type VigorParsePolicyMiddlewaresIntercept<T extends VigorParseSchema<T>> = {
|
|
1518
|
+
__brand: VigorBrand<"Parse", "Policy<Middlewares<Intercept<Schema">;
|
|
1698
1519
|
before: {
|
|
1699
1520
|
_mode: "intercept";
|
|
1700
|
-
func: (ctx: T
|
|
1521
|
+
func: (ctx: VigorParseBeforeContextSchema<T>, api: Pick<VigorParsePolicyMiddlewaresApi<T>, "throwError">) => VigorParseContextSchema<any> | Promise<VigorParseContextSchema<any>>;
|
|
1701
1522
|
};
|
|
1702
1523
|
after: {
|
|
1703
1524
|
_mode: "intercept";
|
|
1704
|
-
func: (ctx: T
|
|
1525
|
+
func: (ctx: VigorParseAfterContextSchema<T>, api: Pick<VigorParsePolicyMiddlewaresApi<T>, "setResult" | "throwError">) => VigorParseContextSchema<any> | Promise<VigorParseContextSchema<any>>;
|
|
1705
1526
|
};
|
|
1706
1527
|
onResult: {
|
|
1707
1528
|
_mode: "intercept";
|
|
1708
|
-
func: (ctx: T
|
|
1529
|
+
func: (ctx: VigorParseAfterContextSchema<T>, api: Pick<VigorParsePolicyMiddlewaresApi<T>, "setResult" | "throwError">) => VigorParseContextSchema<any> | Promise<VigorParseContextSchema<any>>;
|
|
1709
1530
|
};
|
|
1710
1531
|
onError: {
|
|
1711
1532
|
_mode: "intercept";
|
|
1712
|
-
func: (ctx: T
|
|
1533
|
+
func: (ctx: VigorParseContextSchema<T>, api: Pick<VigorParsePolicyMiddlewaresApi<T>, "setResult" | "throwError" | "proceedRestart" | "cancelRestart">) => VigorParseContextSchema<any> | Promise<VigorParseContextSchema<any>>;
|
|
1713
1534
|
};
|
|
1714
1535
|
};
|
|
1715
1536
|
/**
|
|
1716
|
-
* Immutable builder for a
|
|
1537
|
+
* Immutable builder for a parse policy's middleware pipeline (`before`,
|
|
1717
1538
|
* `after`, `onResult`, `onError`). Each stage accepts either "fluent"
|
|
1718
1539
|
* middleware (returns a plain value merged into the context) or
|
|
1719
1540
|
* "intercept" middleware (receives an explicit API to mutate control flow).
|
|
1720
1541
|
*/
|
|
1721
|
-
declare class
|
|
1542
|
+
declare class VigorParsePolicyMiddlewares<T extends VigorParseSchema<T> = typeof VigorParseBase> extends VigorStatus<VigorParseSchema<any>, T, VigorParsePolicyMiddlewaresTypeLambda> {
|
|
1722
1543
|
constructor(config?: T);
|
|
1723
|
-
protected _create<C>(config: C): VigorApply<
|
|
1724
|
-
/** Registers a middleware that runs before the
|
|
1725
|
-
before<const N extends
|
|
1544
|
+
protected _create<C>(config: C): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, C>;
|
|
1545
|
+
/** Registers a middleware that runs before the response is parsed. */
|
|
1546
|
+
before<const N extends VigorParsePolicyMiddlewaresFluent<T>["before"]["func"]>(type: "fluent", func: N): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
1726
1547
|
policy: {
|
|
1727
1548
|
middlewares: {
|
|
1728
1549
|
before: [{
|
|
@@ -1732,7 +1553,7 @@ declare class VigorFetchPolicyMiddlewares<T extends VigorFetchSchema<T> = typeof
|
|
|
1732
1553
|
};
|
|
1733
1554
|
};
|
|
1734
1555
|
}>>;
|
|
1735
|
-
before<const N extends
|
|
1556
|
+
before<const N extends VigorParsePolicyMiddlewaresIntercept<T>["before"]["func"]>(type: "intercept", func: N): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
1736
1557
|
policy: {
|
|
1737
1558
|
middlewares: {
|
|
1738
1559
|
before: [{
|
|
@@ -1742,8 +1563,8 @@ declare class VigorFetchPolicyMiddlewares<T extends VigorFetchSchema<T> = typeof
|
|
|
1742
1563
|
};
|
|
1743
1564
|
};
|
|
1744
1565
|
}>>;
|
|
1745
|
-
/** Registers a middleware that runs after the response
|
|
1746
|
-
after<const N extends
|
|
1566
|
+
/** Registers a middleware that runs after the response has been parsed. */
|
|
1567
|
+
after<const N extends VigorParsePolicyMiddlewaresFluent<T>["after"]["func"]>(type: "fluent", func: N): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
1747
1568
|
policy: {
|
|
1748
1569
|
middlewares: {
|
|
1749
1570
|
after: [{
|
|
@@ -1753,7 +1574,7 @@ declare class VigorFetchPolicyMiddlewares<T extends VigorFetchSchema<T> = typeof
|
|
|
1753
1574
|
};
|
|
1754
1575
|
};
|
|
1755
1576
|
}>>;
|
|
1756
|
-
after<const N extends
|
|
1577
|
+
after<const N extends VigorParsePolicyMiddlewaresIntercept<T>["after"]["func"]>(type: "intercept", func: N): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
1757
1578
|
policy: {
|
|
1758
1579
|
middlewares: {
|
|
1759
1580
|
after: [{
|
|
@@ -1764,7 +1585,7 @@ declare class VigorFetchPolicyMiddlewares<T extends VigorFetchSchema<T> = typeof
|
|
|
1764
1585
|
};
|
|
1765
1586
|
}>>;
|
|
1766
1587
|
/** Registers a middleware that transforms or validates the parsed result. */
|
|
1767
|
-
onResult<const N extends
|
|
1588
|
+
onResult<const N extends VigorParsePolicyMiddlewaresFluent<T>["onResult"]["func"]>(type: "fluent", func: N): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
1768
1589
|
policy: {
|
|
1769
1590
|
middlewares: {
|
|
1770
1591
|
onResult: [{
|
|
@@ -1774,7 +1595,7 @@ declare class VigorFetchPolicyMiddlewares<T extends VigorFetchSchema<T> = typeof
|
|
|
1774
1595
|
};
|
|
1775
1596
|
};
|
|
1776
1597
|
}>>;
|
|
1777
|
-
onResult<const N extends
|
|
1598
|
+
onResult<const N extends VigorParsePolicyMiddlewaresIntercept<T>["onResult"]["func"]>(type: "intercept", func: N): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
1778
1599
|
policy: {
|
|
1779
1600
|
middlewares: {
|
|
1780
1601
|
onResult: [{
|
|
@@ -1784,8 +1605,8 @@ declare class VigorFetchPolicyMiddlewares<T extends VigorFetchSchema<T> = typeof
|
|
|
1784
1605
|
};
|
|
1785
1606
|
};
|
|
1786
1607
|
}>>;
|
|
1787
|
-
/** Registers a middleware that runs when
|
|
1788
|
-
onError<const N extends
|
|
1608
|
+
/** Registers a middleware that runs when parsing ultimately fails. */
|
|
1609
|
+
onError<const N extends VigorParsePolicyMiddlewaresFluent<T>["onError"]["func"]>(type: "fluent", func: N): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
1789
1610
|
policy: {
|
|
1790
1611
|
middlewares: {
|
|
1791
1612
|
onError: [{
|
|
@@ -1795,7 +1616,7 @@ declare class VigorFetchPolicyMiddlewares<T extends VigorFetchSchema<T> = typeof
|
|
|
1795
1616
|
};
|
|
1796
1617
|
};
|
|
1797
1618
|
}>>;
|
|
1798
|
-
onError<const N extends
|
|
1619
|
+
onError<const N extends VigorParsePolicyMiddlewaresIntercept<T>["onError"]["func"]>(type: "intercept", func: N): VigorApply<VigorParsePolicyMiddlewaresTypeLambda, VigorDeepMerge<T, {
|
|
1799
1620
|
policy: {
|
|
1800
1621
|
middlewares: {
|
|
1801
1622
|
onError: [{
|
|
@@ -1807,15 +1628,145 @@ declare class VigorFetchPolicyMiddlewares<T extends VigorFetchSchema<T> = typeof
|
|
|
1807
1628
|
}>>;
|
|
1808
1629
|
}
|
|
1809
1630
|
|
|
1810
|
-
type
|
|
1811
|
-
interface
|
|
1812
|
-
readonly Target:
|
|
1631
|
+
type VigorParseIn<T> = T extends VigorParseSchema<any> ? T : never;
|
|
1632
|
+
interface VigorParseTypeLambda extends VigorTypeLambda {
|
|
1633
|
+
readonly Target: VigorParse<VigorParseIn<this["In"]>>;
|
|
1813
1634
|
}
|
|
1814
|
-
interface
|
|
1815
|
-
readonly Target:
|
|
1635
|
+
interface VigorParsePolicySettingsTypeLambda extends VigorTypeLambda {
|
|
1636
|
+
readonly Target: VigorParsePolicySettings<VigorParseIn<this["In"]>>;
|
|
1816
1637
|
}
|
|
1817
|
-
interface
|
|
1818
|
-
readonly Target:
|
|
1638
|
+
interface VigorParsePolicyMiddlewaresTypeLambda extends VigorTypeLambda {
|
|
1639
|
+
readonly Target: VigorParsePolicyMiddlewares<VigorParseIn<this["In"]>>;
|
|
1640
|
+
}
|
|
1641
|
+
interface VigorParsePolicyStrategiesTypeLambda extends VigorTypeLambda {
|
|
1642
|
+
readonly Target: VigorParsePolicyStrategies<VigorParseIn<this["In"]>>;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
type VigorParsePolicySchema<T extends VigorParseSchema<T>> = {
|
|
1646
|
+
__brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
1647
|
+
target: Request | Response | VigorDefaultType;
|
|
1648
|
+
settings: VigorParsePolicySettingsSchema<T>;
|
|
1649
|
+
middlewares: VigorParsePolicyMiddlewaresSchema<T>;
|
|
1650
|
+
strategies: VigorParsePolicyStrategiesSchema<T>;
|
|
1651
|
+
};
|
|
1652
|
+
declare const VigorParsePolicyBase: {
|
|
1653
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
1654
|
+
readonly target: symbol & {
|
|
1655
|
+
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
1656
|
+
};
|
|
1657
|
+
readonly settings: {
|
|
1658
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
1659
|
+
readonly raw: false;
|
|
1660
|
+
readonly default: symbol & {
|
|
1661
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1662
|
+
};
|
|
1663
|
+
readonly maxRestarts: 3;
|
|
1664
|
+
};
|
|
1665
|
+
readonly middlewares: {
|
|
1666
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
1667
|
+
readonly before: [];
|
|
1668
|
+
readonly after: [];
|
|
1669
|
+
readonly onResult: [];
|
|
1670
|
+
readonly onError: [];
|
|
1671
|
+
};
|
|
1672
|
+
readonly strategies: {
|
|
1673
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
1674
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1675
|
+
};
|
|
1676
|
+
};
|
|
1677
|
+
|
|
1678
|
+
type VigorParseSchema<T extends VigorParseSchema<T>> = {
|
|
1679
|
+
__brand: VigorBrand<"Parse", "Schema">;
|
|
1680
|
+
policy: VigorParsePolicySchema<T>;
|
|
1681
|
+
/** Type-level override for the resolved result type, set via `.cast<T>()`. */
|
|
1682
|
+
cast: unknown;
|
|
1683
|
+
};
|
|
1684
|
+
declare const VigorParseBase: {
|
|
1685
|
+
readonly __brand: VigorBrand<"Parse", "Schema">;
|
|
1686
|
+
readonly policy: {
|
|
1687
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
1688
|
+
readonly target: symbol & {
|
|
1689
|
+
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
1690
|
+
};
|
|
1691
|
+
readonly settings: {
|
|
1692
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
1693
|
+
readonly raw: false;
|
|
1694
|
+
readonly default: symbol & {
|
|
1695
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1696
|
+
};
|
|
1697
|
+
readonly maxRestarts: 3;
|
|
1698
|
+
};
|
|
1699
|
+
readonly middlewares: {
|
|
1700
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
1701
|
+
readonly before: [];
|
|
1702
|
+
readonly after: [];
|
|
1703
|
+
readonly onResult: [];
|
|
1704
|
+
readonly onError: [];
|
|
1705
|
+
};
|
|
1706
|
+
readonly strategies: {
|
|
1707
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
1708
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
1709
|
+
};
|
|
1710
|
+
};
|
|
1711
|
+
readonly cast: symbol & {
|
|
1712
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1713
|
+
};
|
|
1714
|
+
};
|
|
1715
|
+
/**
|
|
1716
|
+
* Immutable builder that parses an HTTP response into a result value,
|
|
1717
|
+
* trying each configured strategy in sequence with an optional middleware
|
|
1718
|
+
* pipeline and restart-on-failure support.
|
|
1719
|
+
*/
|
|
1720
|
+
declare class VigorParse<T extends VigorParseSchema<T> = typeof VigorParseBase> extends VigorStatus<VigorParseSchema<T>, T, VigorParseTypeLambda> {
|
|
1721
|
+
constructor(config?: T);
|
|
1722
|
+
protected _create<C>(config: C): VigorApply<VigorParseTypeLambda, C>;
|
|
1723
|
+
/** Sets the `Response` object to parse. */
|
|
1724
|
+
target<const N extends VigorParseSchema<T>["policy"]["target"]>(response: N): VigorParse<VigorParseIn<VigorDeepMerge<T, {
|
|
1725
|
+
readonly policy: {
|
|
1726
|
+
readonly target: N;
|
|
1727
|
+
};
|
|
1728
|
+
}>>>;
|
|
1729
|
+
/** Configures the parse policy's general settings. */
|
|
1730
|
+
settings<const N extends VigorDeepPartial<VigorParsePolicySettingsSchema<T>>, R extends VigorParseSchema<any>>(input: N | ((s: VigorParsePolicySettings<T>) => VigorParsePolicySettings<R>) | VigorParsePolicySettings<R>): VigorParse<VigorParseIn<VigorDeepMerge<T, {
|
|
1731
|
+
readonly policy: {
|
|
1732
|
+
readonly settings: VigorParsePolicySettingsSchema<any>;
|
|
1733
|
+
};
|
|
1734
|
+
}>>>;
|
|
1735
|
+
/** Configures the parse policy's middleware pipeline. */
|
|
1736
|
+
middlewares<const N extends VigorDeepPartial<VigorParsePolicyMiddlewaresSchema<T>>, R extends VigorParseSchema<any>>(input: N | ((s: VigorParsePolicyMiddlewares<T>) => VigorParsePolicyMiddlewares<R>) | VigorParsePolicyMiddlewares<R>): VigorParse<VigorParseIn<VigorDeepMerge<T, {
|
|
1737
|
+
readonly policy: {
|
|
1738
|
+
readonly middlewares: VigorParsePolicyMiddlewaresSchema<any>;
|
|
1739
|
+
};
|
|
1740
|
+
}>>>;
|
|
1741
|
+
/** Configures the parse policy's fallback chain of parsing strategies. */
|
|
1742
|
+
strategies<const N extends VigorDeepPartial<VigorParsePolicyStrategiesSchema<T>>, R extends VigorParseSchema<any>>(input: N | ((s: VigorParsePolicyStrategies<T>) => VigorParsePolicyStrategies<R>) | VigorParsePolicyStrategies<R>): VigorParse<VigorParseIn<VigorDeepMerge<T, {
|
|
1743
|
+
readonly policy: {
|
|
1744
|
+
readonly strategies: VigorParsePolicyStrategiesSchema<any>;
|
|
1745
|
+
};
|
|
1746
|
+
}>>>;
|
|
1747
|
+
/**
|
|
1748
|
+
* Overrides the resolved result type with `T`, taking priority over the
|
|
1749
|
+
* default `unknown` result. Can be called before or after `strategies()`
|
|
1750
|
+
* (or any other configuration method); whichever `.cast<T>()` call
|
|
1751
|
+
* happens last wins.
|
|
1752
|
+
*/
|
|
1753
|
+
cast<const C>(): VigorParse<VigorParseIn<VigorDeepMerge<T, {
|
|
1754
|
+
cast: C;
|
|
1755
|
+
}>>>;
|
|
1756
|
+
/** Runs parsing and returns the result directly, throwing on final failure. */
|
|
1757
|
+
request<R = VigorCastResult<T["cast"], VigorParseContextSchema<T>["result"]>>(): Promise<R>;
|
|
1758
|
+
/** Runs parsing and returns a result/error envelope instead of throwing. */
|
|
1759
|
+
requestVerbose<R = VigorCastResult<T["cast"], VigorParseContextSchema<T>["result"]>>(): Promise<{
|
|
1760
|
+
success: false;
|
|
1761
|
+
data: null;
|
|
1762
|
+
error: unknown;
|
|
1763
|
+
} | {
|
|
1764
|
+
success: true;
|
|
1765
|
+
data: R;
|
|
1766
|
+
error: null;
|
|
1767
|
+
}>;
|
|
1768
|
+
/** Internal execution loop implementing the strategy fallback and restart handling. */
|
|
1769
|
+
private requestRuntime;
|
|
1819
1770
|
}
|
|
1820
1771
|
|
|
1821
1772
|
type VigorStringable = string | number | boolean | null | undefined | Date;
|
|
@@ -1883,76 +1834,25 @@ declare const VigorFetchPolicyBase: {
|
|
|
1883
1834
|
readonly maxRestarts: 3;
|
|
1884
1835
|
readonly timeout: 20000;
|
|
1885
1836
|
};
|
|
1886
|
-
readonly middlewares: {
|
|
1887
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
1888
|
-
readonly before: [];
|
|
1889
|
-
readonly after: [];
|
|
1890
|
-
readonly onResult: [];
|
|
1891
|
-
readonly retryIf: [];
|
|
1892
|
-
readonly onRetry: [];
|
|
1893
|
-
readonly onError: [];
|
|
1894
|
-
};
|
|
1895
|
-
readonly algorithms: {
|
|
1896
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
1897
|
-
readonly _tag: "constant";
|
|
1898
|
-
readonly jitter: 1000;
|
|
1899
|
-
readonly interval: 2000;
|
|
1900
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
1901
|
-
};
|
|
1902
|
-
};
|
|
1903
|
-
readonly context: {
|
|
1904
|
-
readonly __brand: VigorBrand<"Retry", "Context<Schema">;
|
|
1905
|
-
readonly result: symbol & {
|
|
1906
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
1907
|
-
};
|
|
1908
|
-
readonly error: symbol & {
|
|
1909
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
1910
|
-
};
|
|
1911
|
-
readonly system: {
|
|
1912
|
-
readonly delay: symbol & {
|
|
1913
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
1914
|
-
};
|
|
1915
|
-
readonly attempt: 0;
|
|
1916
|
-
};
|
|
1917
|
-
readonly flags: {
|
|
1918
|
-
readonly doRetry: true;
|
|
1919
|
-
readonly doRestart: false;
|
|
1920
|
-
readonly brokeRetry: false;
|
|
1921
|
-
readonly overridden: false;
|
|
1922
|
-
};
|
|
1923
|
-
readonly record: {};
|
|
1924
|
-
readonly policy: {
|
|
1925
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
1926
|
-
readonly target: symbol & {
|
|
1927
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1928
|
-
};
|
|
1929
|
-
readonly abortSignals: [];
|
|
1930
|
-
readonly settings: {
|
|
1931
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
1932
|
-
readonly default: symbol & {
|
|
1933
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1934
|
-
};
|
|
1935
|
-
readonly maxAttempts: 5;
|
|
1936
|
-
readonly maxRestarts: 3;
|
|
1937
|
-
readonly timeout: 20000;
|
|
1938
|
-
};
|
|
1939
|
-
readonly middlewares: {
|
|
1940
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
1941
|
-
readonly before: [];
|
|
1942
|
-
readonly after: [];
|
|
1943
|
-
readonly onResult: [];
|
|
1944
|
-
readonly retryIf: [];
|
|
1945
|
-
readonly onRetry: [];
|
|
1946
|
-
readonly onError: [];
|
|
1947
|
-
};
|
|
1948
|
-
readonly algorithms: {
|
|
1949
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
1950
|
-
readonly _tag: "constant";
|
|
1951
|
-
readonly jitter: 1000;
|
|
1952
|
-
readonly interval: 2000;
|
|
1953
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
1954
|
-
};
|
|
1837
|
+
readonly middlewares: {
|
|
1838
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
1839
|
+
readonly before: [];
|
|
1840
|
+
readonly after: [];
|
|
1841
|
+
readonly onResult: [];
|
|
1842
|
+
readonly retryIf: [];
|
|
1843
|
+
readonly onRetry: [];
|
|
1844
|
+
readonly onError: [];
|
|
1955
1845
|
};
|
|
1846
|
+
readonly algorithms: {
|
|
1847
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
1848
|
+
readonly _tag: "constant";
|
|
1849
|
+
readonly jitter: 1000;
|
|
1850
|
+
readonly interval: 2000;
|
|
1851
|
+
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
1852
|
+
};
|
|
1853
|
+
};
|
|
1854
|
+
readonly cast: symbol & {
|
|
1855
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1956
1856
|
};
|
|
1957
1857
|
};
|
|
1958
1858
|
readonly parse: {
|
|
@@ -1982,47 +1882,8 @@ declare const VigorFetchPolicyBase: {
|
|
|
1982
1882
|
readonly funcs: VigorParseStrategyFunc[];
|
|
1983
1883
|
};
|
|
1984
1884
|
};
|
|
1985
|
-
readonly
|
|
1986
|
-
|
|
1987
|
-
readonly result: symbol & {
|
|
1988
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
1989
|
-
};
|
|
1990
|
-
readonly error: symbol & {
|
|
1991
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
1992
|
-
};
|
|
1993
|
-
readonly response: symbol & {
|
|
1994
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
1995
|
-
};
|
|
1996
|
-
readonly flags: {
|
|
1997
|
-
readonly overrided: false;
|
|
1998
|
-
readonly restarted: false;
|
|
1999
|
-
};
|
|
2000
|
-
readonly record: {};
|
|
2001
|
-
readonly policy: {
|
|
2002
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
2003
|
-
readonly target: symbol & {
|
|
2004
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2005
|
-
};
|
|
2006
|
-
readonly settings: {
|
|
2007
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
2008
|
-
readonly raw: false;
|
|
2009
|
-
readonly default: symbol & {
|
|
2010
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2011
|
-
};
|
|
2012
|
-
readonly maxRestarts: 3;
|
|
2013
|
-
};
|
|
2014
|
-
readonly middlewares: {
|
|
2015
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
2016
|
-
readonly before: [];
|
|
2017
|
-
readonly after: [];
|
|
2018
|
-
readonly onResult: [];
|
|
2019
|
-
readonly onError: [];
|
|
2020
|
-
};
|
|
2021
|
-
readonly strategies: {
|
|
2022
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
2023
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
2024
|
-
};
|
|
2025
|
-
};
|
|
1885
|
+
readonly cast: symbol & {
|
|
1886
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2026
1887
|
};
|
|
2027
1888
|
};
|
|
2028
1889
|
};
|
|
@@ -2030,7 +1891,8 @@ declare const VigorFetchPolicyBase: {
|
|
|
2030
1891
|
type VigorFetchSchema<T extends VigorFetchSchema<T>> = {
|
|
2031
1892
|
__brand: VigorBrand<"Fetch", "Schema">;
|
|
2032
1893
|
policy: VigorFetchPolicySchema<T>;
|
|
2033
|
-
|
|
1894
|
+
/** Type-level override for the resolved result type, set via `.cast<T>()`. */
|
|
1895
|
+
cast: unknown;
|
|
2034
1896
|
};
|
|
2035
1897
|
declare const VigorFetchBase: {
|
|
2036
1898
|
readonly __brand: VigorBrand<"Fetch", "Schema">;
|
|
@@ -2073,372 +1935,72 @@ declare const VigorFetchBase: {
|
|
|
2073
1935
|
readonly target: symbol & {
|
|
2074
1936
|
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2075
1937
|
};
|
|
2076
|
-
readonly abortSignals: [];
|
|
2077
|
-
readonly settings: {
|
|
2078
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
2079
|
-
readonly default: symbol & {
|
|
2080
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2081
|
-
};
|
|
2082
|
-
readonly maxAttempts: 5;
|
|
2083
|
-
readonly maxRestarts: 3;
|
|
2084
|
-
readonly timeout: 20000;
|
|
2085
|
-
};
|
|
2086
|
-
readonly middlewares: {
|
|
2087
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
2088
|
-
readonly before: [];
|
|
2089
|
-
readonly after: [];
|
|
2090
|
-
readonly onResult: [];
|
|
2091
|
-
readonly retryIf: [];
|
|
2092
|
-
readonly onRetry: [];
|
|
2093
|
-
readonly onError: [];
|
|
2094
|
-
};
|
|
2095
|
-
readonly algorithms: {
|
|
2096
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
2097
|
-
readonly _tag: "constant";
|
|
2098
|
-
readonly jitter: 1000;
|
|
2099
|
-
readonly interval: 2000;
|
|
2100
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
2101
|
-
};
|
|
2102
|
-
};
|
|
2103
|
-
readonly context: {
|
|
2104
|
-
readonly __brand: VigorBrand<"Retry", "Context<Schema">;
|
|
2105
|
-
readonly result: symbol & {
|
|
2106
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2107
|
-
};
|
|
2108
|
-
readonly error: symbol & {
|
|
2109
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2110
|
-
};
|
|
2111
|
-
readonly system: {
|
|
2112
|
-
readonly delay: symbol & {
|
|
2113
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2114
|
-
};
|
|
2115
|
-
readonly attempt: 0;
|
|
2116
|
-
};
|
|
2117
|
-
readonly flags: {
|
|
2118
|
-
readonly doRetry: true;
|
|
2119
|
-
readonly doRestart: false;
|
|
2120
|
-
readonly brokeRetry: false;
|
|
2121
|
-
readonly overridden: false;
|
|
2122
|
-
};
|
|
2123
|
-
readonly record: {};
|
|
2124
|
-
readonly policy: {
|
|
2125
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
2126
|
-
readonly target: symbol & {
|
|
2127
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2128
|
-
};
|
|
2129
|
-
readonly abortSignals: [];
|
|
2130
|
-
readonly settings: {
|
|
2131
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
2132
|
-
readonly default: symbol & {
|
|
2133
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2134
|
-
};
|
|
2135
|
-
readonly maxAttempts: 5;
|
|
2136
|
-
readonly maxRestarts: 3;
|
|
2137
|
-
readonly timeout: 20000;
|
|
2138
|
-
};
|
|
2139
|
-
readonly middlewares: {
|
|
2140
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
2141
|
-
readonly before: [];
|
|
2142
|
-
readonly after: [];
|
|
2143
|
-
readonly onResult: [];
|
|
2144
|
-
readonly retryIf: [];
|
|
2145
|
-
readonly onRetry: [];
|
|
2146
|
-
readonly onError: [];
|
|
2147
|
-
};
|
|
2148
|
-
readonly algorithms: {
|
|
2149
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
2150
|
-
readonly _tag: "constant";
|
|
2151
|
-
readonly jitter: 1000;
|
|
2152
|
-
readonly interval: 2000;
|
|
2153
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
2154
|
-
};
|
|
2155
|
-
};
|
|
2156
|
-
};
|
|
2157
|
-
};
|
|
2158
|
-
readonly parse: {
|
|
2159
|
-
readonly __brand: VigorBrand<"Parse", "Schema">;
|
|
2160
|
-
readonly policy: {
|
|
2161
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
2162
|
-
readonly target: symbol & {
|
|
2163
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2164
|
-
};
|
|
2165
|
-
readonly settings: {
|
|
2166
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
2167
|
-
readonly raw: false;
|
|
2168
|
-
readonly default: symbol & {
|
|
2169
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2170
|
-
};
|
|
2171
|
-
readonly maxRestarts: 3;
|
|
2172
|
-
};
|
|
2173
|
-
readonly middlewares: {
|
|
2174
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
2175
|
-
readonly before: [];
|
|
2176
|
-
readonly after: [];
|
|
2177
|
-
readonly onResult: [];
|
|
2178
|
-
readonly onError: [];
|
|
2179
|
-
};
|
|
2180
|
-
readonly strategies: {
|
|
2181
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
2182
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
2183
|
-
};
|
|
2184
|
-
};
|
|
2185
|
-
readonly context: {
|
|
2186
|
-
readonly __brand: VigorBrand<"Parse", "Context<Schema">;
|
|
2187
|
-
readonly result: symbol & {
|
|
2188
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2189
|
-
};
|
|
2190
|
-
readonly error: symbol & {
|
|
2191
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2192
|
-
};
|
|
2193
|
-
readonly response: symbol & {
|
|
2194
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2195
|
-
};
|
|
2196
|
-
readonly flags: {
|
|
2197
|
-
readonly overrided: false;
|
|
2198
|
-
readonly restarted: false;
|
|
2199
|
-
};
|
|
2200
|
-
readonly record: {};
|
|
2201
|
-
readonly policy: {
|
|
2202
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
2203
|
-
readonly target: symbol & {
|
|
2204
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2205
|
-
};
|
|
2206
|
-
readonly settings: {
|
|
2207
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
2208
|
-
readonly raw: false;
|
|
2209
|
-
readonly default: symbol & {
|
|
2210
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2211
|
-
};
|
|
2212
|
-
readonly maxRestarts: 3;
|
|
2213
|
-
};
|
|
2214
|
-
readonly middlewares: {
|
|
2215
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
2216
|
-
readonly before: [];
|
|
2217
|
-
readonly after: [];
|
|
2218
|
-
readonly onResult: [];
|
|
2219
|
-
readonly onError: [];
|
|
2220
|
-
};
|
|
2221
|
-
readonly strategies: {
|
|
2222
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
2223
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
2224
|
-
};
|
|
2225
|
-
};
|
|
2226
|
-
};
|
|
2227
|
-
};
|
|
2228
|
-
};
|
|
2229
|
-
readonly context: {
|
|
2230
|
-
readonly __brand: VigorBrand<"Fetch", "Context<Schema">;
|
|
2231
|
-
readonly href: "";
|
|
2232
|
-
readonly response: symbol & {
|
|
2233
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2234
|
-
};
|
|
2235
|
-
readonly result: symbol & {
|
|
2236
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2237
|
-
};
|
|
2238
|
-
readonly error: symbol & {
|
|
2239
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2240
|
-
};
|
|
2241
|
-
readonly options: symbol & {
|
|
2242
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2243
|
-
};
|
|
2244
|
-
readonly flags: {
|
|
2245
|
-
readonly overrided: false;
|
|
2246
|
-
readonly restarted: false;
|
|
2247
|
-
};
|
|
2248
|
-
readonly record: {};
|
|
2249
|
-
readonly policy: {
|
|
2250
|
-
readonly __brand: VigorBrand<"Fetch", "Policy<Schema">;
|
|
2251
|
-
readonly method: symbol & {
|
|
2252
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2253
|
-
};
|
|
2254
|
-
readonly origin: symbol & {
|
|
2255
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2256
|
-
};
|
|
2257
|
-
readonly path: [];
|
|
2258
|
-
readonly query: [];
|
|
2259
|
-
readonly hash: "";
|
|
2260
|
-
readonly headers: {};
|
|
2261
|
-
readonly body: symbol & {
|
|
2262
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2263
|
-
};
|
|
2264
|
-
readonly extra: {};
|
|
2265
|
-
readonly settings: {
|
|
2266
|
-
readonly __brand: VigorBrand<"Fetch", "Policy<Settings<Schema">;
|
|
2267
|
-
readonly retryHeaders: ["retry-after", "ratelimit-reset", "x-ratelimit-reset", "x-retry-after", "x-amz-retry-after", "chrome-proxy-next-link"];
|
|
2268
|
-
readonly unretryStatus: [400, 401, 403, 404, 405, 413, 422];
|
|
2269
|
-
readonly maxRestarts: 3;
|
|
2270
|
-
readonly default: symbol & {
|
|
2271
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2272
|
-
};
|
|
2273
|
-
};
|
|
2274
|
-
readonly middlewares: {
|
|
2275
|
-
readonly __brand: VigorBrand<"Fetch", "Policy<Middlewares<Schema">;
|
|
2276
|
-
readonly before: [];
|
|
2277
|
-
readonly after: [];
|
|
2278
|
-
readonly onResult: [];
|
|
2279
|
-
readonly onError: [];
|
|
2280
|
-
};
|
|
2281
|
-
readonly retry: {
|
|
2282
|
-
readonly __brand: VigorBrand<"Retry", "Schema">;
|
|
2283
|
-
readonly policy: {
|
|
2284
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
2285
|
-
readonly target: symbol & {
|
|
2286
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2287
|
-
};
|
|
2288
|
-
readonly abortSignals: [];
|
|
2289
|
-
readonly settings: {
|
|
2290
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
2291
|
-
readonly default: symbol & {
|
|
2292
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2293
|
-
};
|
|
2294
|
-
readonly maxAttempts: 5;
|
|
2295
|
-
readonly maxRestarts: 3;
|
|
2296
|
-
readonly timeout: 20000;
|
|
2297
|
-
};
|
|
2298
|
-
readonly middlewares: {
|
|
2299
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
2300
|
-
readonly before: [];
|
|
2301
|
-
readonly after: [];
|
|
2302
|
-
readonly onResult: [];
|
|
2303
|
-
readonly retryIf: [];
|
|
2304
|
-
readonly onRetry: [];
|
|
2305
|
-
readonly onError: [];
|
|
2306
|
-
};
|
|
2307
|
-
readonly algorithms: {
|
|
2308
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
2309
|
-
readonly _tag: "constant";
|
|
2310
|
-
readonly jitter: 1000;
|
|
2311
|
-
readonly interval: 2000;
|
|
2312
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
2313
|
-
};
|
|
2314
|
-
};
|
|
2315
|
-
readonly context: {
|
|
2316
|
-
readonly __brand: VigorBrand<"Retry", "Context<Schema">;
|
|
2317
|
-
readonly result: symbol & {
|
|
2318
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2319
|
-
};
|
|
2320
|
-
readonly error: symbol & {
|
|
2321
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2322
|
-
};
|
|
2323
|
-
readonly system: {
|
|
2324
|
-
readonly delay: symbol & {
|
|
2325
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2326
|
-
};
|
|
2327
|
-
readonly attempt: 0;
|
|
2328
|
-
};
|
|
2329
|
-
readonly flags: {
|
|
2330
|
-
readonly doRetry: true;
|
|
2331
|
-
readonly doRestart: false;
|
|
2332
|
-
readonly brokeRetry: false;
|
|
2333
|
-
readonly overridden: false;
|
|
2334
|
-
};
|
|
2335
|
-
readonly record: {};
|
|
2336
|
-
readonly policy: {
|
|
2337
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
2338
|
-
readonly target: symbol & {
|
|
2339
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2340
|
-
};
|
|
2341
|
-
readonly abortSignals: [];
|
|
2342
|
-
readonly settings: {
|
|
2343
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
2344
|
-
readonly default: symbol & {
|
|
2345
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2346
|
-
};
|
|
2347
|
-
readonly maxAttempts: 5;
|
|
2348
|
-
readonly maxRestarts: 3;
|
|
2349
|
-
readonly timeout: 20000;
|
|
2350
|
-
};
|
|
2351
|
-
readonly middlewares: {
|
|
2352
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
2353
|
-
readonly before: [];
|
|
2354
|
-
readonly after: [];
|
|
2355
|
-
readonly onResult: [];
|
|
2356
|
-
readonly retryIf: [];
|
|
2357
|
-
readonly onRetry: [];
|
|
2358
|
-
readonly onError: [];
|
|
2359
|
-
};
|
|
2360
|
-
readonly algorithms: {
|
|
2361
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
2362
|
-
readonly _tag: "constant";
|
|
2363
|
-
readonly jitter: 1000;
|
|
2364
|
-
readonly interval: 2000;
|
|
2365
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
2366
|
-
};
|
|
1938
|
+
readonly abortSignals: [];
|
|
1939
|
+
readonly settings: {
|
|
1940
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
1941
|
+
readonly default: symbol & {
|
|
1942
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2367
1943
|
};
|
|
1944
|
+
readonly maxAttempts: 5;
|
|
1945
|
+
readonly maxRestarts: 3;
|
|
1946
|
+
readonly timeout: 20000;
|
|
1947
|
+
};
|
|
1948
|
+
readonly middlewares: {
|
|
1949
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
1950
|
+
readonly before: [];
|
|
1951
|
+
readonly after: [];
|
|
1952
|
+
readonly onResult: [];
|
|
1953
|
+
readonly retryIf: [];
|
|
1954
|
+
readonly onRetry: [];
|
|
1955
|
+
readonly onError: [];
|
|
1956
|
+
};
|
|
1957
|
+
readonly algorithms: {
|
|
1958
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
1959
|
+
readonly _tag: "constant";
|
|
1960
|
+
readonly jitter: 1000;
|
|
1961
|
+
readonly interval: 2000;
|
|
1962
|
+
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
2368
1963
|
};
|
|
2369
1964
|
};
|
|
2370
|
-
readonly
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
readonly default: symbol & {
|
|
2381
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2382
|
-
};
|
|
2383
|
-
readonly maxRestarts: 3;
|
|
2384
|
-
};
|
|
2385
|
-
readonly middlewares: {
|
|
2386
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
2387
|
-
readonly before: [];
|
|
2388
|
-
readonly after: [];
|
|
2389
|
-
readonly onResult: [];
|
|
2390
|
-
readonly onError: [];
|
|
2391
|
-
};
|
|
2392
|
-
readonly strategies: {
|
|
2393
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
2394
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
2395
|
-
};
|
|
1965
|
+
readonly cast: symbol & {
|
|
1966
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1967
|
+
};
|
|
1968
|
+
};
|
|
1969
|
+
readonly parse: {
|
|
1970
|
+
readonly __brand: VigorBrand<"Parse", "Schema">;
|
|
1971
|
+
readonly policy: {
|
|
1972
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
1973
|
+
readonly target: symbol & {
|
|
1974
|
+
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2396
1975
|
};
|
|
2397
|
-
readonly
|
|
2398
|
-
readonly __brand: VigorBrand<"Parse", "
|
|
2399
|
-
readonly
|
|
2400
|
-
|
|
2401
|
-
|
|
2402
|
-
readonly error: symbol & {
|
|
2403
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2404
|
-
};
|
|
2405
|
-
readonly response: symbol & {
|
|
2406
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2407
|
-
};
|
|
2408
|
-
readonly flags: {
|
|
2409
|
-
readonly overrided: false;
|
|
2410
|
-
readonly restarted: false;
|
|
2411
|
-
};
|
|
2412
|
-
readonly record: {};
|
|
2413
|
-
readonly policy: {
|
|
2414
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
2415
|
-
readonly target: symbol & {
|
|
2416
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2417
|
-
};
|
|
2418
|
-
readonly settings: {
|
|
2419
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
2420
|
-
readonly raw: false;
|
|
2421
|
-
readonly default: symbol & {
|
|
2422
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2423
|
-
};
|
|
2424
|
-
readonly maxRestarts: 3;
|
|
2425
|
-
};
|
|
2426
|
-
readonly middlewares: {
|
|
2427
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
2428
|
-
readonly before: [];
|
|
2429
|
-
readonly after: [];
|
|
2430
|
-
readonly onResult: [];
|
|
2431
|
-
readonly onError: [];
|
|
2432
|
-
};
|
|
2433
|
-
readonly strategies: {
|
|
2434
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
2435
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
2436
|
-
};
|
|
1976
|
+
readonly settings: {
|
|
1977
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
1978
|
+
readonly raw: false;
|
|
1979
|
+
readonly default: symbol & {
|
|
1980
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2437
1981
|
};
|
|
1982
|
+
readonly maxRestarts: 3;
|
|
1983
|
+
};
|
|
1984
|
+
readonly middlewares: {
|
|
1985
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
1986
|
+
readonly before: [];
|
|
1987
|
+
readonly after: [];
|
|
1988
|
+
readonly onResult: [];
|
|
1989
|
+
readonly onError: [];
|
|
1990
|
+
};
|
|
1991
|
+
readonly strategies: {
|
|
1992
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
1993
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
2438
1994
|
};
|
|
2439
1995
|
};
|
|
1996
|
+
readonly cast: symbol & {
|
|
1997
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
1998
|
+
};
|
|
2440
1999
|
};
|
|
2441
2000
|
};
|
|
2001
|
+
readonly cast: symbol & {
|
|
2002
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2003
|
+
};
|
|
2442
2004
|
};
|
|
2443
2005
|
/**
|
|
2444
2006
|
* Immutable builder that performs an HTTP request, composing an internal
|
|
@@ -2565,10 +2127,19 @@ declare class VigorFetch<T extends VigorFetchSchema<T> = typeof VigorFetchBase>
|
|
|
2565
2127
|
headers: Record<string, string>;
|
|
2566
2128
|
body: BodyInit | null | undefined;
|
|
2567
2129
|
};
|
|
2130
|
+
/**
|
|
2131
|
+
* Overrides the resolved result type with `T`, taking priority over the
|
|
2132
|
+
* default `unknown` result. Can be called before or after `parse()` (or
|
|
2133
|
+
* any other configuration method); whichever `.cast<T>()` call happens
|
|
2134
|
+
* last wins.
|
|
2135
|
+
*/
|
|
2136
|
+
cast<const C>(): VigorFetch<VigorFetchIn<VigorDeepMerge<T, {
|
|
2137
|
+
cast: C;
|
|
2138
|
+
}>>>;
|
|
2568
2139
|
/** Runs the request and returns its parsed result directly, throwing on final failure. */
|
|
2569
|
-
request<R = T["
|
|
2140
|
+
request<R = VigorCastResult<T["cast"], VigorFetchContextSchema<T>["result"]>>(): Promise<R>;
|
|
2570
2141
|
/** Runs the request and returns a result/error envelope instead of throwing. */
|
|
2571
|
-
requestVerbose<R = T["
|
|
2142
|
+
requestVerbose<R = VigorCastResult<T["cast"], VigorFetchContextSchema<T>["result"]>>(): Promise<{
|
|
2572
2143
|
success: false;
|
|
2573
2144
|
data: null;
|
|
2574
2145
|
error: unknown;
|
|
@@ -2581,53 +2152,244 @@ declare class VigorFetch<T extends VigorFetchSchema<T> = typeof VigorFetchBase>
|
|
|
2581
2152
|
private requestRuntime;
|
|
2582
2153
|
}
|
|
2583
2154
|
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
|
|
2596
|
-
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2155
|
+
type VigorFetchIn<T> = T extends VigorFetchSchema<any> ? T : never;
|
|
2156
|
+
interface VigorFetchTypeLambda extends VigorTypeLambda {
|
|
2157
|
+
readonly Target: VigorFetch<VigorFetchIn<this["In"]>>;
|
|
2158
|
+
}
|
|
2159
|
+
interface VigorFetchPolicySettingsTypeLambda extends VigorTypeLambda {
|
|
2160
|
+
readonly Target: VigorFetchPolicySettings<VigorFetchIn<this["In"]>>;
|
|
2161
|
+
}
|
|
2162
|
+
interface VigorFetchPolicyMiddlewaresTypeLambda extends VigorTypeLambda {
|
|
2163
|
+
readonly Target: VigorFetchPolicyMiddlewares<VigorFetchIn<this["In"]>>;
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
/**
|
|
2167
|
+
* Small named helpers that actually *call* the target/origin method with the
|
|
2168
|
+
* generic argument `F`. These exist purely so `ReturnType<typeof xWithY<F>>`
|
|
2169
|
+
* can forward `F` into the real merged config type — referencing the method
|
|
2170
|
+
* type directly (e.g. `VigorRetry["target"]`) would leave `F` unapplied and
|
|
2171
|
+
* collapse back to the method's own parameter type.
|
|
2172
|
+
*/
|
|
2173
|
+
declare function retryWithTarget<const F extends Parameters<VigorRetry["target"]>[0]>(task: F): VigorRetry<VigorRetryIn<{
|
|
2174
|
+
policy: {
|
|
2175
|
+
target: F;
|
|
2176
|
+
__brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
2177
|
+
abortSignals: [];
|
|
2178
|
+
settings: {
|
|
2179
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
2180
|
+
readonly default: symbol & {
|
|
2181
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2600
2182
|
};
|
|
2601
|
-
readonly
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2183
|
+
readonly maxAttempts: 5;
|
|
2184
|
+
readonly maxRestarts: 3;
|
|
2185
|
+
readonly timeout: 20000;
|
|
2186
|
+
};
|
|
2187
|
+
middlewares: {
|
|
2188
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
2189
|
+
readonly before: [];
|
|
2190
|
+
readonly after: [];
|
|
2191
|
+
readonly onResult: [];
|
|
2192
|
+
readonly retryIf: [];
|
|
2193
|
+
readonly onRetry: [];
|
|
2194
|
+
readonly onError: [];
|
|
2195
|
+
};
|
|
2196
|
+
algorithms: {
|
|
2197
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
2198
|
+
readonly _tag: "constant";
|
|
2199
|
+
readonly jitter: 1000;
|
|
2200
|
+
readonly interval: 2000;
|
|
2201
|
+
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
2202
|
+
};
|
|
2203
|
+
};
|
|
2204
|
+
__brand: VigorBrand<"Retry", "Schema">;
|
|
2205
|
+
cast: symbol & {
|
|
2206
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2207
|
+
};
|
|
2208
|
+
}>>;
|
|
2209
|
+
declare function parseWithTarget<const F extends Parameters<VigorParse["target"]>[0]>(response: F): VigorParse<VigorParseIn<{
|
|
2210
|
+
policy: {
|
|
2211
|
+
target: F;
|
|
2212
|
+
__brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
2213
|
+
settings: {
|
|
2214
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
2215
|
+
readonly raw: false;
|
|
2216
|
+
readonly default: symbol & {
|
|
2217
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2606
2218
|
};
|
|
2219
|
+
readonly maxRestarts: 3;
|
|
2607
2220
|
};
|
|
2608
|
-
|
|
2609
|
-
readonly __brand: VigorBrand<"
|
|
2610
|
-
readonly
|
|
2611
|
-
|
|
2221
|
+
middlewares: {
|
|
2222
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
2223
|
+
readonly before: [];
|
|
2224
|
+
readonly after: [];
|
|
2225
|
+
readonly onResult: [];
|
|
2226
|
+
readonly onError: [];
|
|
2227
|
+
};
|
|
2228
|
+
strategies: {
|
|
2229
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
2230
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
2231
|
+
};
|
|
2232
|
+
};
|
|
2233
|
+
__brand: VigorBrand<"Parse", "Schema">;
|
|
2234
|
+
cast: symbol & {
|
|
2235
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2236
|
+
};
|
|
2237
|
+
}>>;
|
|
2238
|
+
declare function fetchWithOrigin<const F extends Parameters<VigorFetch["origin"]>[0]>(origin: F): VigorFetch<VigorFetchIn<{
|
|
2239
|
+
policy: {
|
|
2240
|
+
__brand: VigorBrand<"Fetch", "Policy<Schema">;
|
|
2241
|
+
settings: {
|
|
2242
|
+
readonly __brand: VigorBrand<"Fetch", "Policy<Settings<Schema">;
|
|
2243
|
+
readonly retryHeaders: ["retry-after", "ratelimit-reset", "x-ratelimit-reset", "x-retry-after", "x-amz-retry-after", "chrome-proxy-next-link"];
|
|
2244
|
+
readonly unretryStatus: [400, 401, 403, 404, 405, 413, 422];
|
|
2245
|
+
readonly maxRestarts: 3;
|
|
2246
|
+
readonly default: symbol & {
|
|
2247
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2248
|
+
};
|
|
2249
|
+
};
|
|
2250
|
+
middlewares: {
|
|
2251
|
+
readonly __brand: VigorBrand<"Fetch", "Policy<Middlewares<Schema">;
|
|
2252
|
+
readonly before: [];
|
|
2253
|
+
readonly after: [];
|
|
2254
|
+
readonly onResult: [];
|
|
2255
|
+
readonly onError: [];
|
|
2256
|
+
};
|
|
2257
|
+
headers: {};
|
|
2258
|
+
method: symbol & {
|
|
2259
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2260
|
+
};
|
|
2261
|
+
body: symbol & {
|
|
2262
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2263
|
+
};
|
|
2264
|
+
origin: F;
|
|
2265
|
+
path: [];
|
|
2266
|
+
query: [];
|
|
2267
|
+
hash: "";
|
|
2268
|
+
extra: {};
|
|
2269
|
+
retry: {
|
|
2270
|
+
readonly __brand: VigorBrand<"Retry", "Schema">;
|
|
2271
|
+
readonly policy: {
|
|
2272
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
2273
|
+
readonly target: symbol & {
|
|
2274
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2275
|
+
};
|
|
2276
|
+
readonly abortSignals: [];
|
|
2277
|
+
readonly settings: {
|
|
2278
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
2279
|
+
readonly default: symbol & {
|
|
2280
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2281
|
+
};
|
|
2282
|
+
readonly maxAttempts: 5;
|
|
2283
|
+
readonly maxRestarts: 3;
|
|
2284
|
+
readonly timeout: 20000;
|
|
2285
|
+
};
|
|
2286
|
+
readonly middlewares: {
|
|
2287
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
2288
|
+
readonly before: [];
|
|
2289
|
+
readonly after: [];
|
|
2290
|
+
readonly onResult: [];
|
|
2291
|
+
readonly retryIf: [];
|
|
2292
|
+
readonly onRetry: [];
|
|
2293
|
+
readonly onError: [];
|
|
2294
|
+
};
|
|
2295
|
+
readonly algorithms: {
|
|
2296
|
+
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
2297
|
+
readonly _tag: "constant";
|
|
2298
|
+
readonly jitter: 1000;
|
|
2299
|
+
readonly interval: 2000;
|
|
2300
|
+
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
2301
|
+
};
|
|
2302
|
+
};
|
|
2303
|
+
readonly cast: symbol & {
|
|
2304
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2612
2305
|
};
|
|
2306
|
+
};
|
|
2307
|
+
parse: {
|
|
2308
|
+
readonly __brand: VigorBrand<"Parse", "Schema">;
|
|
2613
2309
|
readonly policy: {
|
|
2614
|
-
readonly __brand: VigorBrand<"
|
|
2615
|
-
readonly target:
|
|
2310
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
2311
|
+
readonly target: symbol & {
|
|
2312
|
+
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2313
|
+
};
|
|
2616
2314
|
readonly settings: {
|
|
2617
|
-
readonly __brand: VigorBrand<"
|
|
2618
|
-
readonly
|
|
2619
|
-
readonly
|
|
2315
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
2316
|
+
readonly raw: false;
|
|
2317
|
+
readonly default: symbol & {
|
|
2318
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2319
|
+
};
|
|
2320
|
+
readonly maxRestarts: 3;
|
|
2620
2321
|
};
|
|
2621
2322
|
readonly middlewares: {
|
|
2622
|
-
readonly __brand: VigorBrand<"
|
|
2623
|
-
readonly before:
|
|
2624
|
-
readonly after:
|
|
2625
|
-
readonly
|
|
2323
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
2324
|
+
readonly before: [];
|
|
2325
|
+
readonly after: [];
|
|
2326
|
+
readonly onResult: [];
|
|
2327
|
+
readonly onError: [];
|
|
2328
|
+
};
|
|
2329
|
+
readonly strategies: {
|
|
2330
|
+
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
2331
|
+
readonly funcs: VigorParseStrategyFunc[];
|
|
2626
2332
|
};
|
|
2627
2333
|
};
|
|
2628
|
-
readonly
|
|
2334
|
+
readonly cast: symbol & {
|
|
2335
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2336
|
+
};
|
|
2629
2337
|
};
|
|
2630
|
-
}
|
|
2338
|
+
};
|
|
2339
|
+
__brand: VigorBrand<"Fetch", "Schema">;
|
|
2340
|
+
cast: symbol & {
|
|
2341
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2342
|
+
};
|
|
2343
|
+
}>>;
|
|
2344
|
+
declare function allWithTargets<const F extends VigorAllTask[]>(tasks: F): VigorAll<VigorAllIn<{
|
|
2345
|
+
policy: {
|
|
2346
|
+
target: F extends VigorBuiltin ? F : F extends readonly any[] ? [...VigorAllTask[], ...F] : F;
|
|
2347
|
+
__brand: VigorBrand<"All", "Policy<Schema">;
|
|
2348
|
+
settings: {
|
|
2349
|
+
readonly __brand: VigorBrand<"All", "Policy<Settings<Schema">;
|
|
2350
|
+
readonly concurrency: 5;
|
|
2351
|
+
readonly onlySuccess: false;
|
|
2352
|
+
};
|
|
2353
|
+
middlewares: {
|
|
2354
|
+
readonly __brand: VigorBrand<"All", "Policy<Middlewares<Schema">;
|
|
2355
|
+
readonly before: VigorAllEachMiddlewareFn[];
|
|
2356
|
+
readonly after: VigorAllEachMiddlewareFn[];
|
|
2357
|
+
readonly onError: VigorAllEachOnErrorFn[];
|
|
2358
|
+
};
|
|
2359
|
+
};
|
|
2360
|
+
__brand: VigorBrand<"All", "Schema">;
|
|
2361
|
+
cast: symbol & {
|
|
2362
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2363
|
+
};
|
|
2364
|
+
}>>;
|
|
2365
|
+
/**
|
|
2366
|
+
* Overload types for each entry helper. Object literals can't declare
|
|
2367
|
+
* overloaded method shorthand directly (`foo(): A; foo(x: B): C { ... }` is a
|
|
2368
|
+
* syntax error inside `{ ... }`), so each helper is typed here and the
|
|
2369
|
+
* implementation is cast to it below.
|
|
2370
|
+
*/
|
|
2371
|
+
type RetryFn = {
|
|
2372
|
+
(): VigorRetry;
|
|
2373
|
+
<const F extends Parameters<VigorRetry["target"]>[0]>(task: F): ReturnType<typeof retryWithTarget<F>>;
|
|
2374
|
+
};
|
|
2375
|
+
type ParseFn = {
|
|
2376
|
+
(): VigorParse;
|
|
2377
|
+
<const F extends Parameters<VigorParse["target"]>[0]>(response: F): ReturnType<typeof parseWithTarget<F>>;
|
|
2378
|
+
};
|
|
2379
|
+
type FetchFn = {
|
|
2380
|
+
(): VigorFetch;
|
|
2381
|
+
<const F extends Parameters<VigorFetch["origin"]>[0]>(origin: F): ReturnType<typeof fetchWithOrigin<F>>;
|
|
2382
|
+
};
|
|
2383
|
+
type AllFn = {
|
|
2384
|
+
(): VigorAll;
|
|
2385
|
+
<const F extends VigorAllTask[]>(...tasks: F): ReturnType<typeof allWithTargets<F>>;
|
|
2386
|
+
};
|
|
2387
|
+
/** Everything `vigor` exposes except `use` — kept separate so `VigorInstance` (below) can self-reference without a circular-inference error. */
|
|
2388
|
+
declare const vigorBase: {
|
|
2389
|
+
retry: RetryFn;
|
|
2390
|
+
parse: ParseFn;
|
|
2391
|
+
fetch: FetchFn;
|
|
2392
|
+
all: AllFn;
|
|
2631
2393
|
builders: {
|
|
2632
2394
|
fetch: {
|
|
2633
2395
|
settings: () => VigorFetchPolicySettings<{
|
|
@@ -2698,59 +2460,8 @@ declare const vigorBase: {
|
|
|
2698
2460
|
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
2699
2461
|
};
|
|
2700
2462
|
};
|
|
2701
|
-
readonly
|
|
2702
|
-
|
|
2703
|
-
readonly result: symbol & {
|
|
2704
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2705
|
-
};
|
|
2706
|
-
readonly error: symbol & {
|
|
2707
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2708
|
-
};
|
|
2709
|
-
readonly system: {
|
|
2710
|
-
readonly delay: symbol & {
|
|
2711
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2712
|
-
};
|
|
2713
|
-
readonly attempt: 0;
|
|
2714
|
-
};
|
|
2715
|
-
readonly flags: {
|
|
2716
|
-
readonly doRetry: true;
|
|
2717
|
-
readonly doRestart: false;
|
|
2718
|
-
readonly brokeRetry: false;
|
|
2719
|
-
readonly overridden: false;
|
|
2720
|
-
};
|
|
2721
|
-
readonly record: {};
|
|
2722
|
-
readonly policy: {
|
|
2723
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
2724
|
-
readonly target: symbol & {
|
|
2725
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2726
|
-
};
|
|
2727
|
-
readonly abortSignals: [];
|
|
2728
|
-
readonly settings: {
|
|
2729
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
2730
|
-
readonly default: symbol & {
|
|
2731
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2732
|
-
};
|
|
2733
|
-
readonly maxAttempts: 5;
|
|
2734
|
-
readonly maxRestarts: 3;
|
|
2735
|
-
readonly timeout: 20000;
|
|
2736
|
-
};
|
|
2737
|
-
readonly middlewares: {
|
|
2738
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
2739
|
-
readonly before: [];
|
|
2740
|
-
readonly after: [];
|
|
2741
|
-
readonly onResult: [];
|
|
2742
|
-
readonly retryIf: [];
|
|
2743
|
-
readonly onRetry: [];
|
|
2744
|
-
readonly onError: [];
|
|
2745
|
-
};
|
|
2746
|
-
readonly algorithms: {
|
|
2747
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
2748
|
-
readonly _tag: "constant";
|
|
2749
|
-
readonly jitter: 1000;
|
|
2750
|
-
readonly interval: 2000;
|
|
2751
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
2752
|
-
};
|
|
2753
|
-
};
|
|
2463
|
+
readonly cast: symbol & {
|
|
2464
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2754
2465
|
};
|
|
2755
2466
|
};
|
|
2756
2467
|
readonly parse: {
|
|
@@ -2780,263 +2491,14 @@ declare const vigorBase: {
|
|
|
2780
2491
|
readonly funcs: VigorParseStrategyFunc[];
|
|
2781
2492
|
};
|
|
2782
2493
|
};
|
|
2783
|
-
readonly
|
|
2784
|
-
readonly __brand: VigorBrand<"Parse", "Context<Schema">;
|
|
2785
|
-
readonly result: symbol & {
|
|
2786
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2787
|
-
};
|
|
2788
|
-
readonly error: symbol & {
|
|
2789
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2790
|
-
};
|
|
2791
|
-
readonly response: symbol & {
|
|
2792
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2793
|
-
};
|
|
2794
|
-
readonly flags: {
|
|
2795
|
-
readonly overrided: false;
|
|
2796
|
-
readonly restarted: false;
|
|
2797
|
-
};
|
|
2798
|
-
readonly record: {};
|
|
2799
|
-
readonly policy: {
|
|
2800
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
2801
|
-
readonly target: symbol & {
|
|
2802
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2803
|
-
};
|
|
2804
|
-
readonly settings: {
|
|
2805
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
2806
|
-
readonly raw: false;
|
|
2807
|
-
readonly default: symbol & {
|
|
2808
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2809
|
-
};
|
|
2810
|
-
readonly maxRestarts: 3;
|
|
2811
|
-
};
|
|
2812
|
-
readonly middlewares: {
|
|
2813
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
2814
|
-
readonly before: [];
|
|
2815
|
-
readonly after: [];
|
|
2816
|
-
readonly onResult: [];
|
|
2817
|
-
readonly onError: [];
|
|
2818
|
-
};
|
|
2819
|
-
readonly strategies: {
|
|
2820
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
2821
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
2822
|
-
};
|
|
2823
|
-
};
|
|
2824
|
-
};
|
|
2825
|
-
};
|
|
2826
|
-
};
|
|
2827
|
-
readonly context: {
|
|
2828
|
-
readonly __brand: VigorBrand<"Fetch", "Context<Schema">;
|
|
2829
|
-
readonly href: "";
|
|
2830
|
-
readonly response: symbol & {
|
|
2831
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2832
|
-
};
|
|
2833
|
-
readonly result: symbol & {
|
|
2834
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2835
|
-
};
|
|
2836
|
-
readonly error: symbol & {
|
|
2837
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2838
|
-
};
|
|
2839
|
-
readonly options: symbol & {
|
|
2840
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2841
|
-
};
|
|
2842
|
-
readonly flags: {
|
|
2843
|
-
readonly overrided: false;
|
|
2844
|
-
readonly restarted: false;
|
|
2845
|
-
};
|
|
2846
|
-
readonly record: {};
|
|
2847
|
-
readonly policy: {
|
|
2848
|
-
readonly __brand: VigorBrand<"Fetch", "Policy<Schema">;
|
|
2849
|
-
readonly method: symbol & {
|
|
2850
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2851
|
-
};
|
|
2852
|
-
readonly origin: symbol & {
|
|
2853
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2854
|
-
};
|
|
2855
|
-
readonly path: [];
|
|
2856
|
-
readonly query: [];
|
|
2857
|
-
readonly hash: "";
|
|
2858
|
-
readonly headers: {};
|
|
2859
|
-
readonly body: symbol & {
|
|
2494
|
+
readonly cast: symbol & {
|
|
2860
2495
|
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2861
2496
|
};
|
|
2862
|
-
readonly extra: {};
|
|
2863
|
-
readonly settings: {
|
|
2864
|
-
readonly __brand: VigorBrand<"Fetch", "Policy<Settings<Schema">;
|
|
2865
|
-
readonly retryHeaders: ["retry-after", "ratelimit-reset", "x-ratelimit-reset", "x-retry-after", "x-amz-retry-after", "chrome-proxy-next-link"];
|
|
2866
|
-
readonly unretryStatus: [400, 401, 403, 404, 405, 413, 422];
|
|
2867
|
-
readonly maxRestarts: 3;
|
|
2868
|
-
readonly default: symbol & {
|
|
2869
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2870
|
-
};
|
|
2871
|
-
};
|
|
2872
|
-
readonly middlewares: {
|
|
2873
|
-
readonly __brand: VigorBrand<"Fetch", "Policy<Middlewares<Schema">;
|
|
2874
|
-
readonly before: [];
|
|
2875
|
-
readonly after: [];
|
|
2876
|
-
readonly onResult: [];
|
|
2877
|
-
readonly onError: [];
|
|
2878
|
-
};
|
|
2879
|
-
readonly retry: {
|
|
2880
|
-
readonly __brand: VigorBrand<"Retry", "Schema">;
|
|
2881
|
-
readonly policy: {
|
|
2882
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
2883
|
-
readonly target: symbol & {
|
|
2884
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2885
|
-
};
|
|
2886
|
-
readonly abortSignals: [];
|
|
2887
|
-
readonly settings: {
|
|
2888
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
2889
|
-
readonly default: symbol & {
|
|
2890
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2891
|
-
};
|
|
2892
|
-
readonly maxAttempts: 5;
|
|
2893
|
-
readonly maxRestarts: 3;
|
|
2894
|
-
readonly timeout: 20000;
|
|
2895
|
-
};
|
|
2896
|
-
readonly middlewares: {
|
|
2897
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
2898
|
-
readonly before: [];
|
|
2899
|
-
readonly after: [];
|
|
2900
|
-
readonly onResult: [];
|
|
2901
|
-
readonly retryIf: [];
|
|
2902
|
-
readonly onRetry: [];
|
|
2903
|
-
readonly onError: [];
|
|
2904
|
-
};
|
|
2905
|
-
readonly algorithms: {
|
|
2906
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
2907
|
-
readonly _tag: "constant";
|
|
2908
|
-
readonly jitter: 1000;
|
|
2909
|
-
readonly interval: 2000;
|
|
2910
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
2911
|
-
};
|
|
2912
|
-
};
|
|
2913
|
-
readonly context: {
|
|
2914
|
-
readonly __brand: VigorBrand<"Retry", "Context<Schema">;
|
|
2915
|
-
readonly result: symbol & {
|
|
2916
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2917
|
-
};
|
|
2918
|
-
readonly error: symbol & {
|
|
2919
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2920
|
-
};
|
|
2921
|
-
readonly system: {
|
|
2922
|
-
readonly delay: symbol & {
|
|
2923
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2924
|
-
};
|
|
2925
|
-
readonly attempt: 0;
|
|
2926
|
-
};
|
|
2927
|
-
readonly flags: {
|
|
2928
|
-
readonly doRetry: true;
|
|
2929
|
-
readonly doRestart: false;
|
|
2930
|
-
readonly brokeRetry: false;
|
|
2931
|
-
readonly overridden: false;
|
|
2932
|
-
};
|
|
2933
|
-
readonly record: {};
|
|
2934
|
-
readonly policy: {
|
|
2935
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
2936
|
-
readonly target: symbol & {
|
|
2937
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2938
|
-
};
|
|
2939
|
-
readonly abortSignals: [];
|
|
2940
|
-
readonly settings: {
|
|
2941
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
2942
|
-
readonly default: symbol & {
|
|
2943
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2944
|
-
};
|
|
2945
|
-
readonly maxAttempts: 5;
|
|
2946
|
-
readonly maxRestarts: 3;
|
|
2947
|
-
readonly timeout: 20000;
|
|
2948
|
-
};
|
|
2949
|
-
readonly middlewares: {
|
|
2950
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
2951
|
-
readonly before: [];
|
|
2952
|
-
readonly after: [];
|
|
2953
|
-
readonly onResult: [];
|
|
2954
|
-
readonly retryIf: [];
|
|
2955
|
-
readonly onRetry: [];
|
|
2956
|
-
readonly onError: [];
|
|
2957
|
-
};
|
|
2958
|
-
readonly algorithms: {
|
|
2959
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
2960
|
-
readonly _tag: "constant";
|
|
2961
|
-
readonly jitter: 1000;
|
|
2962
|
-
readonly interval: 2000;
|
|
2963
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
2964
|
-
};
|
|
2965
|
-
};
|
|
2966
|
-
};
|
|
2967
|
-
};
|
|
2968
|
-
readonly parse: {
|
|
2969
|
-
readonly __brand: VigorBrand<"Parse", "Schema">;
|
|
2970
|
-
readonly policy: {
|
|
2971
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
2972
|
-
readonly target: symbol & {
|
|
2973
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2974
|
-
};
|
|
2975
|
-
readonly settings: {
|
|
2976
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
2977
|
-
readonly raw: false;
|
|
2978
|
-
readonly default: symbol & {
|
|
2979
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2980
|
-
};
|
|
2981
|
-
readonly maxRestarts: 3;
|
|
2982
|
-
};
|
|
2983
|
-
readonly middlewares: {
|
|
2984
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
2985
|
-
readonly before: [];
|
|
2986
|
-
readonly after: [];
|
|
2987
|
-
readonly onResult: [];
|
|
2988
|
-
readonly onError: [];
|
|
2989
|
-
};
|
|
2990
|
-
readonly strategies: {
|
|
2991
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
2992
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
2993
|
-
};
|
|
2994
|
-
};
|
|
2995
|
-
readonly context: {
|
|
2996
|
-
readonly __brand: VigorBrand<"Parse", "Context<Schema">;
|
|
2997
|
-
readonly result: symbol & {
|
|
2998
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2999
|
-
};
|
|
3000
|
-
readonly error: symbol & {
|
|
3001
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3002
|
-
};
|
|
3003
|
-
readonly response: symbol & {
|
|
3004
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3005
|
-
};
|
|
3006
|
-
readonly flags: {
|
|
3007
|
-
readonly overrided: false;
|
|
3008
|
-
readonly restarted: false;
|
|
3009
|
-
};
|
|
3010
|
-
readonly record: {};
|
|
3011
|
-
readonly policy: {
|
|
3012
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
3013
|
-
readonly target: symbol & {
|
|
3014
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3015
|
-
};
|
|
3016
|
-
readonly settings: {
|
|
3017
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
3018
|
-
readonly raw: false;
|
|
3019
|
-
readonly default: symbol & {
|
|
3020
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3021
|
-
};
|
|
3022
|
-
readonly maxRestarts: 3;
|
|
3023
|
-
};
|
|
3024
|
-
readonly middlewares: {
|
|
3025
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
3026
|
-
readonly before: [];
|
|
3027
|
-
readonly after: [];
|
|
3028
|
-
readonly onResult: [];
|
|
3029
|
-
readonly onError: [];
|
|
3030
|
-
};
|
|
3031
|
-
readonly strategies: {
|
|
3032
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
3033
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
3034
|
-
};
|
|
3035
|
-
};
|
|
3036
|
-
};
|
|
3037
|
-
};
|
|
3038
2497
|
};
|
|
3039
2498
|
};
|
|
2499
|
+
readonly cast: symbol & {
|
|
2500
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2501
|
+
};
|
|
3040
2502
|
}>;
|
|
3041
2503
|
middlewares: () => VigorFetchPolicyMiddlewares<{
|
|
3042
2504
|
readonly __brand: VigorBrand<"Fetch", "Schema">;
|
|
@@ -3106,59 +2568,8 @@ declare const vigorBase: {
|
|
|
3106
2568
|
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
3107
2569
|
};
|
|
3108
2570
|
};
|
|
3109
|
-
readonly
|
|
3110
|
-
|
|
3111
|
-
readonly result: symbol & {
|
|
3112
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3113
|
-
};
|
|
3114
|
-
readonly error: symbol & {
|
|
3115
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3116
|
-
};
|
|
3117
|
-
readonly system: {
|
|
3118
|
-
readonly delay: symbol & {
|
|
3119
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3120
|
-
};
|
|
3121
|
-
readonly attempt: 0;
|
|
3122
|
-
};
|
|
3123
|
-
readonly flags: {
|
|
3124
|
-
readonly doRetry: true;
|
|
3125
|
-
readonly doRestart: false;
|
|
3126
|
-
readonly brokeRetry: false;
|
|
3127
|
-
readonly overridden: false;
|
|
3128
|
-
};
|
|
3129
|
-
readonly record: {};
|
|
3130
|
-
readonly policy: {
|
|
3131
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
3132
|
-
readonly target: symbol & {
|
|
3133
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3134
|
-
};
|
|
3135
|
-
readonly abortSignals: [];
|
|
3136
|
-
readonly settings: {
|
|
3137
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
3138
|
-
readonly default: symbol & {
|
|
3139
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3140
|
-
};
|
|
3141
|
-
readonly maxAttempts: 5;
|
|
3142
|
-
readonly maxRestarts: 3;
|
|
3143
|
-
readonly timeout: 20000;
|
|
3144
|
-
};
|
|
3145
|
-
readonly middlewares: {
|
|
3146
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
3147
|
-
readonly before: [];
|
|
3148
|
-
readonly after: [];
|
|
3149
|
-
readonly onResult: [];
|
|
3150
|
-
readonly retryIf: [];
|
|
3151
|
-
readonly onRetry: [];
|
|
3152
|
-
readonly onError: [];
|
|
3153
|
-
};
|
|
3154
|
-
readonly algorithms: {
|
|
3155
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
3156
|
-
readonly _tag: "constant";
|
|
3157
|
-
readonly jitter: 1000;
|
|
3158
|
-
readonly interval: 2000;
|
|
3159
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
3160
|
-
};
|
|
3161
|
-
};
|
|
2571
|
+
readonly cast: symbol & {
|
|
2572
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3162
2573
|
};
|
|
3163
2574
|
};
|
|
3164
2575
|
readonly parse: {
|
|
@@ -3188,263 +2599,14 @@ declare const vigorBase: {
|
|
|
3188
2599
|
readonly funcs: VigorParseStrategyFunc[];
|
|
3189
2600
|
};
|
|
3190
2601
|
};
|
|
3191
|
-
readonly
|
|
3192
|
-
readonly __brand: VigorBrand<"Parse", "Context<Schema">;
|
|
3193
|
-
readonly result: symbol & {
|
|
3194
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3195
|
-
};
|
|
3196
|
-
readonly error: symbol & {
|
|
3197
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3198
|
-
};
|
|
3199
|
-
readonly response: symbol & {
|
|
3200
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3201
|
-
};
|
|
3202
|
-
readonly flags: {
|
|
3203
|
-
readonly overrided: false;
|
|
3204
|
-
readonly restarted: false;
|
|
3205
|
-
};
|
|
3206
|
-
readonly record: {};
|
|
3207
|
-
readonly policy: {
|
|
3208
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
3209
|
-
readonly target: symbol & {
|
|
3210
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3211
|
-
};
|
|
3212
|
-
readonly settings: {
|
|
3213
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
3214
|
-
readonly raw: false;
|
|
3215
|
-
readonly default: symbol & {
|
|
3216
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3217
|
-
};
|
|
3218
|
-
readonly maxRestarts: 3;
|
|
3219
|
-
};
|
|
3220
|
-
readonly middlewares: {
|
|
3221
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
3222
|
-
readonly before: [];
|
|
3223
|
-
readonly after: [];
|
|
3224
|
-
readonly onResult: [];
|
|
3225
|
-
readonly onError: [];
|
|
3226
|
-
};
|
|
3227
|
-
readonly strategies: {
|
|
3228
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
3229
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
3230
|
-
};
|
|
3231
|
-
};
|
|
3232
|
-
};
|
|
3233
|
-
};
|
|
3234
|
-
};
|
|
3235
|
-
readonly context: {
|
|
3236
|
-
readonly __brand: VigorBrand<"Fetch", "Context<Schema">;
|
|
3237
|
-
readonly href: "";
|
|
3238
|
-
readonly response: symbol & {
|
|
3239
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3240
|
-
};
|
|
3241
|
-
readonly result: symbol & {
|
|
3242
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3243
|
-
};
|
|
3244
|
-
readonly error: symbol & {
|
|
3245
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3246
|
-
};
|
|
3247
|
-
readonly options: symbol & {
|
|
3248
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3249
|
-
};
|
|
3250
|
-
readonly flags: {
|
|
3251
|
-
readonly overrided: false;
|
|
3252
|
-
readonly restarted: false;
|
|
3253
|
-
};
|
|
3254
|
-
readonly record: {};
|
|
3255
|
-
readonly policy: {
|
|
3256
|
-
readonly __brand: VigorBrand<"Fetch", "Policy<Schema">;
|
|
3257
|
-
readonly method: symbol & {
|
|
3258
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3259
|
-
};
|
|
3260
|
-
readonly origin: symbol & {
|
|
3261
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3262
|
-
};
|
|
3263
|
-
readonly path: [];
|
|
3264
|
-
readonly query: [];
|
|
3265
|
-
readonly hash: "";
|
|
3266
|
-
readonly headers: {};
|
|
3267
|
-
readonly body: symbol & {
|
|
2602
|
+
readonly cast: symbol & {
|
|
3268
2603
|
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3269
2604
|
};
|
|
3270
|
-
readonly extra: {};
|
|
3271
|
-
readonly settings: {
|
|
3272
|
-
readonly __brand: VigorBrand<"Fetch", "Policy<Settings<Schema">;
|
|
3273
|
-
readonly retryHeaders: ["retry-after", "ratelimit-reset", "x-ratelimit-reset", "x-retry-after", "x-amz-retry-after", "chrome-proxy-next-link"];
|
|
3274
|
-
readonly unretryStatus: [400, 401, 403, 404, 405, 413, 422];
|
|
3275
|
-
readonly maxRestarts: 3;
|
|
3276
|
-
readonly default: symbol & {
|
|
3277
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3278
|
-
};
|
|
3279
|
-
};
|
|
3280
|
-
readonly middlewares: {
|
|
3281
|
-
readonly __brand: VigorBrand<"Fetch", "Policy<Middlewares<Schema">;
|
|
3282
|
-
readonly before: [];
|
|
3283
|
-
readonly after: [];
|
|
3284
|
-
readonly onResult: [];
|
|
3285
|
-
readonly onError: [];
|
|
3286
|
-
};
|
|
3287
|
-
readonly retry: {
|
|
3288
|
-
readonly __brand: VigorBrand<"Retry", "Schema">;
|
|
3289
|
-
readonly policy: {
|
|
3290
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
3291
|
-
readonly target: symbol & {
|
|
3292
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3293
|
-
};
|
|
3294
|
-
readonly abortSignals: [];
|
|
3295
|
-
readonly settings: {
|
|
3296
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
3297
|
-
readonly default: symbol & {
|
|
3298
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3299
|
-
};
|
|
3300
|
-
readonly maxAttempts: 5;
|
|
3301
|
-
readonly maxRestarts: 3;
|
|
3302
|
-
readonly timeout: 20000;
|
|
3303
|
-
};
|
|
3304
|
-
readonly middlewares: {
|
|
3305
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
3306
|
-
readonly before: [];
|
|
3307
|
-
readonly after: [];
|
|
3308
|
-
readonly onResult: [];
|
|
3309
|
-
readonly retryIf: [];
|
|
3310
|
-
readonly onRetry: [];
|
|
3311
|
-
readonly onError: [];
|
|
3312
|
-
};
|
|
3313
|
-
readonly algorithms: {
|
|
3314
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
3315
|
-
readonly _tag: "constant";
|
|
3316
|
-
readonly jitter: 1000;
|
|
3317
|
-
readonly interval: 2000;
|
|
3318
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
3319
|
-
};
|
|
3320
|
-
};
|
|
3321
|
-
readonly context: {
|
|
3322
|
-
readonly __brand: VigorBrand<"Retry", "Context<Schema">;
|
|
3323
|
-
readonly result: symbol & {
|
|
3324
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3325
|
-
};
|
|
3326
|
-
readonly error: symbol & {
|
|
3327
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3328
|
-
};
|
|
3329
|
-
readonly system: {
|
|
3330
|
-
readonly delay: symbol & {
|
|
3331
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3332
|
-
};
|
|
3333
|
-
readonly attempt: 0;
|
|
3334
|
-
};
|
|
3335
|
-
readonly flags: {
|
|
3336
|
-
readonly doRetry: true;
|
|
3337
|
-
readonly doRestart: false;
|
|
3338
|
-
readonly brokeRetry: false;
|
|
3339
|
-
readonly overridden: false;
|
|
3340
|
-
};
|
|
3341
|
-
readonly record: {};
|
|
3342
|
-
readonly policy: {
|
|
3343
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
3344
|
-
readonly target: symbol & {
|
|
3345
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3346
|
-
};
|
|
3347
|
-
readonly abortSignals: [];
|
|
3348
|
-
readonly settings: {
|
|
3349
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
3350
|
-
readonly default: symbol & {
|
|
3351
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3352
|
-
};
|
|
3353
|
-
readonly maxAttempts: 5;
|
|
3354
|
-
readonly maxRestarts: 3;
|
|
3355
|
-
readonly timeout: 20000;
|
|
3356
|
-
};
|
|
3357
|
-
readonly middlewares: {
|
|
3358
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
3359
|
-
readonly before: [];
|
|
3360
|
-
readonly after: [];
|
|
3361
|
-
readonly onResult: [];
|
|
3362
|
-
readonly retryIf: [];
|
|
3363
|
-
readonly onRetry: [];
|
|
3364
|
-
readonly onError: [];
|
|
3365
|
-
};
|
|
3366
|
-
readonly algorithms: {
|
|
3367
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
3368
|
-
readonly _tag: "constant";
|
|
3369
|
-
readonly jitter: 1000;
|
|
3370
|
-
readonly interval: 2000;
|
|
3371
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
3372
|
-
};
|
|
3373
|
-
};
|
|
3374
|
-
};
|
|
3375
|
-
};
|
|
3376
|
-
readonly parse: {
|
|
3377
|
-
readonly __brand: VigorBrand<"Parse", "Schema">;
|
|
3378
|
-
readonly policy: {
|
|
3379
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
3380
|
-
readonly target: symbol & {
|
|
3381
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3382
|
-
};
|
|
3383
|
-
readonly settings: {
|
|
3384
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
3385
|
-
readonly raw: false;
|
|
3386
|
-
readonly default: symbol & {
|
|
3387
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3388
|
-
};
|
|
3389
|
-
readonly maxRestarts: 3;
|
|
3390
|
-
};
|
|
3391
|
-
readonly middlewares: {
|
|
3392
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
3393
|
-
readonly before: [];
|
|
3394
|
-
readonly after: [];
|
|
3395
|
-
readonly onResult: [];
|
|
3396
|
-
readonly onError: [];
|
|
3397
|
-
};
|
|
3398
|
-
readonly strategies: {
|
|
3399
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
3400
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
3401
|
-
};
|
|
3402
|
-
};
|
|
3403
|
-
readonly context: {
|
|
3404
|
-
readonly __brand: VigorBrand<"Parse", "Context<Schema">;
|
|
3405
|
-
readonly result: symbol & {
|
|
3406
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3407
|
-
};
|
|
3408
|
-
readonly error: symbol & {
|
|
3409
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3410
|
-
};
|
|
3411
|
-
readonly response: symbol & {
|
|
3412
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3413
|
-
};
|
|
3414
|
-
readonly flags: {
|
|
3415
|
-
readonly overrided: false;
|
|
3416
|
-
readonly restarted: false;
|
|
3417
|
-
};
|
|
3418
|
-
readonly record: {};
|
|
3419
|
-
readonly policy: {
|
|
3420
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
3421
|
-
readonly target: symbol & {
|
|
3422
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3423
|
-
};
|
|
3424
|
-
readonly settings: {
|
|
3425
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
3426
|
-
readonly raw: false;
|
|
3427
|
-
readonly default: symbol & {
|
|
3428
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3429
|
-
};
|
|
3430
|
-
readonly maxRestarts: 3;
|
|
3431
|
-
};
|
|
3432
|
-
readonly middlewares: {
|
|
3433
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
3434
|
-
readonly before: [];
|
|
3435
|
-
readonly after: [];
|
|
3436
|
-
readonly onResult: [];
|
|
3437
|
-
readonly onError: [];
|
|
3438
|
-
};
|
|
3439
|
-
readonly strategies: {
|
|
3440
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
3441
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
3442
|
-
};
|
|
3443
|
-
};
|
|
3444
|
-
};
|
|
3445
|
-
};
|
|
3446
2605
|
};
|
|
3447
2606
|
};
|
|
2607
|
+
readonly cast: symbol & {
|
|
2608
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
2609
|
+
};
|
|
3448
2610
|
}>;
|
|
3449
2611
|
};
|
|
3450
2612
|
retry: {
|
|
@@ -3482,59 +2644,8 @@ declare const vigorBase: {
|
|
|
3482
2644
|
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
3483
2645
|
};
|
|
3484
2646
|
};
|
|
3485
|
-
readonly
|
|
3486
|
-
|
|
3487
|
-
readonly result: symbol & {
|
|
3488
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3489
|
-
};
|
|
3490
|
-
readonly error: symbol & {
|
|
3491
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3492
|
-
};
|
|
3493
|
-
readonly system: {
|
|
3494
|
-
readonly delay: symbol & {
|
|
3495
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3496
|
-
};
|
|
3497
|
-
readonly attempt: 0;
|
|
3498
|
-
};
|
|
3499
|
-
readonly flags: {
|
|
3500
|
-
readonly doRetry: true;
|
|
3501
|
-
readonly doRestart: false;
|
|
3502
|
-
readonly brokeRetry: false;
|
|
3503
|
-
readonly overridden: false;
|
|
3504
|
-
};
|
|
3505
|
-
readonly record: {};
|
|
3506
|
-
readonly policy: {
|
|
3507
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
3508
|
-
readonly target: symbol & {
|
|
3509
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3510
|
-
};
|
|
3511
|
-
readonly abortSignals: [];
|
|
3512
|
-
readonly settings: {
|
|
3513
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
3514
|
-
readonly default: symbol & {
|
|
3515
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3516
|
-
};
|
|
3517
|
-
readonly maxAttempts: 5;
|
|
3518
|
-
readonly maxRestarts: 3;
|
|
3519
|
-
readonly timeout: 20000;
|
|
3520
|
-
};
|
|
3521
|
-
readonly middlewares: {
|
|
3522
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
3523
|
-
readonly before: [];
|
|
3524
|
-
readonly after: [];
|
|
3525
|
-
readonly onResult: [];
|
|
3526
|
-
readonly retryIf: [];
|
|
3527
|
-
readonly onRetry: [];
|
|
3528
|
-
readonly onError: [];
|
|
3529
|
-
};
|
|
3530
|
-
readonly algorithms: {
|
|
3531
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
3532
|
-
readonly _tag: "constant";
|
|
3533
|
-
readonly jitter: 1000;
|
|
3534
|
-
readonly interval: 2000;
|
|
3535
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
3536
|
-
};
|
|
3537
|
-
};
|
|
2647
|
+
readonly cast: symbol & {
|
|
2648
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3538
2649
|
};
|
|
3539
2650
|
}>;
|
|
3540
2651
|
middlewares: () => VigorRetryPolicyMiddlewares<{
|
|
@@ -3571,59 +2682,8 @@ declare const vigorBase: {
|
|
|
3571
2682
|
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
3572
2683
|
};
|
|
3573
2684
|
};
|
|
3574
|
-
readonly
|
|
3575
|
-
|
|
3576
|
-
readonly result: symbol & {
|
|
3577
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3578
|
-
};
|
|
3579
|
-
readonly error: symbol & {
|
|
3580
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3581
|
-
};
|
|
3582
|
-
readonly system: {
|
|
3583
|
-
readonly delay: symbol & {
|
|
3584
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3585
|
-
};
|
|
3586
|
-
readonly attempt: 0;
|
|
3587
|
-
};
|
|
3588
|
-
readonly flags: {
|
|
3589
|
-
readonly doRetry: true;
|
|
3590
|
-
readonly doRestart: false;
|
|
3591
|
-
readonly brokeRetry: false;
|
|
3592
|
-
readonly overridden: false;
|
|
3593
|
-
};
|
|
3594
|
-
readonly record: {};
|
|
3595
|
-
readonly policy: {
|
|
3596
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
3597
|
-
readonly target: symbol & {
|
|
3598
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3599
|
-
};
|
|
3600
|
-
readonly abortSignals: [];
|
|
3601
|
-
readonly settings: {
|
|
3602
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
3603
|
-
readonly default: symbol & {
|
|
3604
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3605
|
-
};
|
|
3606
|
-
readonly maxAttempts: 5;
|
|
3607
|
-
readonly maxRestarts: 3;
|
|
3608
|
-
readonly timeout: 20000;
|
|
3609
|
-
};
|
|
3610
|
-
readonly middlewares: {
|
|
3611
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
3612
|
-
readonly before: [];
|
|
3613
|
-
readonly after: [];
|
|
3614
|
-
readonly onResult: [];
|
|
3615
|
-
readonly retryIf: [];
|
|
3616
|
-
readonly onRetry: [];
|
|
3617
|
-
readonly onError: [];
|
|
3618
|
-
};
|
|
3619
|
-
readonly algorithms: {
|
|
3620
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
3621
|
-
readonly _tag: "constant";
|
|
3622
|
-
readonly jitter: 1000;
|
|
3623
|
-
readonly interval: 2000;
|
|
3624
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
3625
|
-
};
|
|
3626
|
-
};
|
|
2685
|
+
readonly cast: symbol & {
|
|
2686
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3627
2687
|
};
|
|
3628
2688
|
}>;
|
|
3629
2689
|
algorithms: () => VigorRetryPolicyAlgorithms<{
|
|
@@ -3660,59 +2720,8 @@ declare const vigorBase: {
|
|
|
3660
2720
|
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
3661
2721
|
};
|
|
3662
2722
|
};
|
|
3663
|
-
readonly
|
|
3664
|
-
|
|
3665
|
-
readonly result: symbol & {
|
|
3666
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3667
|
-
};
|
|
3668
|
-
readonly error: symbol & {
|
|
3669
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3670
|
-
};
|
|
3671
|
-
readonly system: {
|
|
3672
|
-
readonly delay: symbol & {
|
|
3673
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3674
|
-
};
|
|
3675
|
-
readonly attempt: 0;
|
|
3676
|
-
};
|
|
3677
|
-
readonly flags: {
|
|
3678
|
-
readonly doRetry: true;
|
|
3679
|
-
readonly doRestart: false;
|
|
3680
|
-
readonly brokeRetry: false;
|
|
3681
|
-
readonly overridden: false;
|
|
3682
|
-
};
|
|
3683
|
-
readonly record: {};
|
|
3684
|
-
readonly policy: {
|
|
3685
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
3686
|
-
readonly target: symbol & {
|
|
3687
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3688
|
-
};
|
|
3689
|
-
readonly abortSignals: [];
|
|
3690
|
-
readonly settings: {
|
|
3691
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Settings<Schema">;
|
|
3692
|
-
readonly default: symbol & {
|
|
3693
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3694
|
-
};
|
|
3695
|
-
readonly maxAttempts: 5;
|
|
3696
|
-
readonly maxRestarts: 3;
|
|
3697
|
-
readonly timeout: 20000;
|
|
3698
|
-
};
|
|
3699
|
-
readonly middlewares: {
|
|
3700
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Middlewares<Schema">;
|
|
3701
|
-
readonly before: [];
|
|
3702
|
-
readonly after: [];
|
|
3703
|
-
readonly onResult: [];
|
|
3704
|
-
readonly retryIf: [];
|
|
3705
|
-
readonly onRetry: [];
|
|
3706
|
-
readonly onError: [];
|
|
3707
|
-
};
|
|
3708
|
-
readonly algorithms: {
|
|
3709
|
-
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
3710
|
-
readonly _tag: "constant";
|
|
3711
|
-
readonly jitter: 1000;
|
|
3712
|
-
readonly interval: 2000;
|
|
3713
|
-
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
3714
|
-
};
|
|
3715
|
-
};
|
|
2723
|
+
readonly cast: symbol & {
|
|
2724
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3716
2725
|
};
|
|
3717
2726
|
}>;
|
|
3718
2727
|
algorithm: {
|
|
@@ -3785,47 +2794,8 @@ declare const vigorBase: {
|
|
|
3785
2794
|
readonly funcs: VigorParseStrategyFunc[];
|
|
3786
2795
|
};
|
|
3787
2796
|
};
|
|
3788
|
-
readonly
|
|
3789
|
-
|
|
3790
|
-
readonly result: symbol & {
|
|
3791
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3792
|
-
};
|
|
3793
|
-
readonly error: symbol & {
|
|
3794
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3795
|
-
};
|
|
3796
|
-
readonly response: symbol & {
|
|
3797
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3798
|
-
};
|
|
3799
|
-
readonly flags: {
|
|
3800
|
-
readonly overrided: false;
|
|
3801
|
-
readonly restarted: false;
|
|
3802
|
-
};
|
|
3803
|
-
readonly record: {};
|
|
3804
|
-
readonly policy: {
|
|
3805
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
3806
|
-
readonly target: symbol & {
|
|
3807
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3808
|
-
};
|
|
3809
|
-
readonly settings: {
|
|
3810
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
3811
|
-
readonly raw: false;
|
|
3812
|
-
readonly default: symbol & {
|
|
3813
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3814
|
-
};
|
|
3815
|
-
readonly maxRestarts: 3;
|
|
3816
|
-
};
|
|
3817
|
-
readonly middlewares: {
|
|
3818
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
3819
|
-
readonly before: [];
|
|
3820
|
-
readonly after: [];
|
|
3821
|
-
readonly onResult: [];
|
|
3822
|
-
readonly onError: [];
|
|
3823
|
-
};
|
|
3824
|
-
readonly strategies: {
|
|
3825
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
3826
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
3827
|
-
};
|
|
3828
|
-
};
|
|
2797
|
+
readonly cast: symbol & {
|
|
2798
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3829
2799
|
};
|
|
3830
2800
|
}>;
|
|
3831
2801
|
middlewares: () => VigorParsePolicyMiddlewares<{
|
|
@@ -3855,47 +2825,8 @@ declare const vigorBase: {
|
|
|
3855
2825
|
readonly funcs: VigorParseStrategyFunc[];
|
|
3856
2826
|
};
|
|
3857
2827
|
};
|
|
3858
|
-
readonly
|
|
3859
|
-
|
|
3860
|
-
readonly result: symbol & {
|
|
3861
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3862
|
-
};
|
|
3863
|
-
readonly error: symbol & {
|
|
3864
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3865
|
-
};
|
|
3866
|
-
readonly response: symbol & {
|
|
3867
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3868
|
-
};
|
|
3869
|
-
readonly flags: {
|
|
3870
|
-
readonly overrided: false;
|
|
3871
|
-
readonly restarted: false;
|
|
3872
|
-
};
|
|
3873
|
-
readonly record: {};
|
|
3874
|
-
readonly policy: {
|
|
3875
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
3876
|
-
readonly target: symbol & {
|
|
3877
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3878
|
-
};
|
|
3879
|
-
readonly settings: {
|
|
3880
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
3881
|
-
readonly raw: false;
|
|
3882
|
-
readonly default: symbol & {
|
|
3883
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3884
|
-
};
|
|
3885
|
-
readonly maxRestarts: 3;
|
|
3886
|
-
};
|
|
3887
|
-
readonly middlewares: {
|
|
3888
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
3889
|
-
readonly before: [];
|
|
3890
|
-
readonly after: [];
|
|
3891
|
-
readonly onResult: [];
|
|
3892
|
-
readonly onError: [];
|
|
3893
|
-
};
|
|
3894
|
-
readonly strategies: {
|
|
3895
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
3896
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
3897
|
-
};
|
|
3898
|
-
};
|
|
2828
|
+
readonly cast: symbol & {
|
|
2829
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3899
2830
|
};
|
|
3900
2831
|
}>;
|
|
3901
2832
|
strategies: () => VigorParsePolicyStrategies<{
|
|
@@ -3925,47 +2856,8 @@ declare const vigorBase: {
|
|
|
3925
2856
|
readonly funcs: VigorParseStrategyFunc[];
|
|
3926
2857
|
};
|
|
3927
2858
|
};
|
|
3928
|
-
readonly
|
|
3929
|
-
|
|
3930
|
-
readonly result: symbol & {
|
|
3931
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3932
|
-
};
|
|
3933
|
-
readonly error: symbol & {
|
|
3934
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3935
|
-
};
|
|
3936
|
-
readonly response: symbol & {
|
|
3937
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3938
|
-
};
|
|
3939
|
-
readonly flags: {
|
|
3940
|
-
readonly overrided: false;
|
|
3941
|
-
readonly restarted: false;
|
|
3942
|
-
};
|
|
3943
|
-
readonly record: {};
|
|
3944
|
-
readonly policy: {
|
|
3945
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
3946
|
-
readonly target: symbol & {
|
|
3947
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3948
|
-
};
|
|
3949
|
-
readonly settings: {
|
|
3950
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Settings<Schema">;
|
|
3951
|
-
readonly raw: false;
|
|
3952
|
-
readonly default: symbol & {
|
|
3953
|
-
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3954
|
-
};
|
|
3955
|
-
readonly maxRestarts: 3;
|
|
3956
|
-
};
|
|
3957
|
-
readonly middlewares: {
|
|
3958
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Middlewares<Schema">;
|
|
3959
|
-
readonly before: [];
|
|
3960
|
-
readonly after: [];
|
|
3961
|
-
readonly onResult: [];
|
|
3962
|
-
readonly onError: [];
|
|
3963
|
-
};
|
|
3964
|
-
readonly strategies: {
|
|
3965
|
-
readonly __brand: VigorBrand<"Parse", "Policy<Strategies<Schema">;
|
|
3966
|
-
readonly funcs: VigorParseStrategyFunc[];
|
|
3967
|
-
};
|
|
3968
|
-
};
|
|
2859
|
+
readonly cast: symbol & {
|
|
2860
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
3969
2861
|
};
|
|
3970
2862
|
}>;
|
|
3971
2863
|
};
|
|
@@ -3987,27 +2879,8 @@ declare const vigorBase: {
|
|
|
3987
2879
|
readonly onError: VigorAllEachOnErrorFn[];
|
|
3988
2880
|
};
|
|
3989
2881
|
};
|
|
3990
|
-
readonly
|
|
3991
|
-
|
|
3992
|
-
readonly result: symbol & {
|
|
3993
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
3994
|
-
};
|
|
3995
|
-
readonly policy: {
|
|
3996
|
-
readonly __brand: VigorBrand<"All", "Policy<Schema">;
|
|
3997
|
-
readonly target: VigorAllTask[];
|
|
3998
|
-
readonly settings: {
|
|
3999
|
-
readonly __brand: VigorBrand<"All", "Policy<Settings<Schema">;
|
|
4000
|
-
readonly concurrency: 5;
|
|
4001
|
-
readonly onlySuccess: false;
|
|
4002
|
-
};
|
|
4003
|
-
readonly middlewares: {
|
|
4004
|
-
readonly __brand: VigorBrand<"All", "Policy<Middlewares<Schema">;
|
|
4005
|
-
readonly before: VigorAllEachMiddlewareFn[];
|
|
4006
|
-
readonly after: VigorAllEachMiddlewareFn[];
|
|
4007
|
-
readonly onError: VigorAllEachOnErrorFn[];
|
|
4008
|
-
};
|
|
4009
|
-
};
|
|
4010
|
-
readonly record: {};
|
|
2882
|
+
readonly cast: symbol & {
|
|
2883
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
4011
2884
|
};
|
|
4012
2885
|
}>;
|
|
4013
2886
|
middlewares: () => VigorAllPolicyMiddlewares<{
|
|
@@ -4027,27 +2900,8 @@ declare const vigorBase: {
|
|
|
4027
2900
|
readonly onError: VigorAllEachOnErrorFn[];
|
|
4028
2901
|
};
|
|
4029
2902
|
};
|
|
4030
|
-
readonly
|
|
4031
|
-
|
|
4032
|
-
readonly result: symbol & {
|
|
4033
|
-
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
4034
|
-
};
|
|
4035
|
-
readonly policy: {
|
|
4036
|
-
readonly __brand: VigorBrand<"All", "Policy<Schema">;
|
|
4037
|
-
readonly target: VigorAllTask[];
|
|
4038
|
-
readonly settings: {
|
|
4039
|
-
readonly __brand: VigorBrand<"All", "Policy<Settings<Schema">;
|
|
4040
|
-
readonly concurrency: 5;
|
|
4041
|
-
readonly onlySuccess: false;
|
|
4042
|
-
};
|
|
4043
|
-
readonly middlewares: {
|
|
4044
|
-
readonly __brand: VigorBrand<"All", "Policy<Middlewares<Schema">;
|
|
4045
|
-
readonly before: VigorAllEachMiddlewareFn[];
|
|
4046
|
-
readonly after: VigorAllEachMiddlewareFn[];
|
|
4047
|
-
readonly onError: VigorAllEachOnErrorFn[];
|
|
4048
|
-
};
|
|
4049
|
-
};
|
|
4050
|
-
readonly record: {};
|
|
2903
|
+
readonly cast: symbol & {
|
|
2904
|
+
__brand: VigorBrand<"Core", "Symbol_Empty">;
|
|
4051
2905
|
};
|
|
4052
2906
|
}>;
|
|
4053
2907
|
};
|
|
@@ -4119,12 +2973,12 @@ declare const VigorRetryErrorMessageFuncs: {
|
|
|
4119
2973
|
type VigorRetryErrorCodes = keyof typeof VigorRetryErrorMessageFuncs;
|
|
4120
2974
|
type VigorRetryErrorDatas<C extends VigorRetryErrorCodes> = Parameters<typeof VigorRetryErrorMessageFuncs[C]> extends [infer A] ? A : undefined;
|
|
4121
2975
|
/** Error type thrown by the retry module. */
|
|
4122
|
-
declare class VigorRetryError<C extends VigorRetryErrorCodes, T extends VigorRetrySchema<T>> extends VigorError<C, VigorRetryErrorDatas<C>, T
|
|
2976
|
+
declare class VigorRetryError<C extends VigorRetryErrorCodes, T extends VigorRetrySchema<T>> extends VigorError<C, VigorRetryErrorDatas<C>, VigorRetryContextSchema<T>> {
|
|
4123
2977
|
/**
|
|
4124
2978
|
* @param code - One of the retry module's error codes.
|
|
4125
2979
|
* @param options - Error metadata, including the `data` payload for `code`.
|
|
4126
2980
|
*/
|
|
4127
|
-
constructor(code: C, options: VigorErrorOptions<VigorRetryErrorDatas<C>, T
|
|
2981
|
+
constructor(code: C, options: VigorErrorOptions<VigorRetryErrorDatas<C>, VigorRetryContextSchema<T>>);
|
|
4128
2982
|
}
|
|
4129
2983
|
|
|
4130
2984
|
declare const VigorParseErrorMessageFuncs: {
|
|
@@ -4149,12 +3003,12 @@ declare const VigorParseErrorMessageFuncs: {
|
|
|
4149
3003
|
type VigorParseErrorCodes = keyof typeof VigorParseErrorMessageFuncs;
|
|
4150
3004
|
type VigorParseErrorDatas<C extends VigorParseErrorCodes> = Parameters<typeof VigorParseErrorMessageFuncs[C]> extends [infer A] ? A : undefined;
|
|
4151
3005
|
/** Error type thrown by the parse module. */
|
|
4152
|
-
declare class VigorParseError<C extends VigorParseErrorCodes, T extends VigorParseSchema<T>> extends VigorError<C, VigorParseErrorDatas<C>, T
|
|
3006
|
+
declare class VigorParseError<C extends VigorParseErrorCodes, T extends VigorParseSchema<T>> extends VigorError<C, VigorParseErrorDatas<C>, VigorParseContextSchema<T>> {
|
|
4153
3007
|
/**
|
|
4154
3008
|
* @param code - One of the parse module's error codes.
|
|
4155
3009
|
* @param options - Error metadata, including the `data` payload for `code`.
|
|
4156
3010
|
*/
|
|
4157
|
-
constructor(code: C, options: VigorErrorOptions<VigorParseErrorDatas<C>, T
|
|
3011
|
+
constructor(code: C, options: VigorErrorOptions<VigorParseErrorDatas<C>, VigorParseContextSchema<T>>);
|
|
4158
3012
|
}
|
|
4159
3013
|
|
|
4160
3014
|
declare const VigorFetchErrorMessageFuncs: {
|
|
@@ -4183,12 +3037,12 @@ declare const VigorFetchErrorMessageFuncs: {
|
|
|
4183
3037
|
type VigorFetchErrorCodes = keyof typeof VigorFetchErrorMessageFuncs;
|
|
4184
3038
|
type VigorFetchErrorDatas<C extends VigorFetchErrorCodes> = Parameters<typeof VigorFetchErrorMessageFuncs[C]> extends [infer A] ? A : undefined;
|
|
4185
3039
|
/** Error type thrown by the fetch module. */
|
|
4186
|
-
declare class VigorFetchError<C extends VigorFetchErrorCodes, T extends VigorFetchSchema<T>> extends VigorError<C, VigorFetchErrorDatas<C>, T
|
|
3040
|
+
declare class VigorFetchError<C extends VigorFetchErrorCodes, T extends VigorFetchSchema<T>> extends VigorError<C, VigorFetchErrorDatas<C>, VigorFetchContextSchema<T>> {
|
|
4187
3041
|
/**
|
|
4188
3042
|
* @param code - One of the fetch module's error codes.
|
|
4189
3043
|
* @param options - Error metadata, including the `data` payload for `code`.
|
|
4190
3044
|
*/
|
|
4191
|
-
constructor(code: C, options: VigorErrorOptions<VigorFetchErrorDatas<C>, T
|
|
3045
|
+
constructor(code: C, options: VigorErrorOptions<VigorFetchErrorDatas<C>, VigorFetchContextSchema<T>>);
|
|
4192
3046
|
}
|
|
4193
3047
|
|
|
4194
3048
|
declare const VigorAllErrorMessageFuncs: {
|
|
@@ -4197,12 +3051,12 @@ declare const VigorAllErrorMessageFuncs: {
|
|
|
4197
3051
|
type VigorAllErrorCodes = keyof typeof VigorAllErrorMessageFuncs;
|
|
4198
3052
|
type VigorAllErrorDatas<C extends VigorAllErrorCodes> = Parameters<typeof VigorAllErrorMessageFuncs[C]> extends [infer A] ? A : undefined;
|
|
4199
3053
|
/** Error type thrown by the all module. */
|
|
4200
|
-
declare class VigorAllError<C extends VigorAllErrorCodes, T extends VigorAllSchema<T>> extends VigorError<C, VigorAllErrorDatas<C>, T
|
|
3054
|
+
declare class VigorAllError<C extends VigorAllErrorCodes, T extends VigorAllSchema<T>> extends VigorError<C, VigorAllErrorDatas<C>, VigorAllContextSchema<T>> {
|
|
4201
3055
|
/**
|
|
4202
3056
|
* @param code - One of the all module's error codes.
|
|
4203
3057
|
* @param options - Error metadata, including the `data` payload for `code`.
|
|
4204
3058
|
*/
|
|
4205
|
-
constructor(code: C, options: VigorErrorOptions<VigorAllErrorDatas<C>, T
|
|
3059
|
+
constructor(code: C, options: VigorErrorOptions<VigorAllErrorDatas<C>, VigorAllContextSchema<T>>);
|
|
4206
3060
|
}
|
|
4207
3061
|
|
|
4208
|
-
export { VigorAll, VigorAllBase, type VigorAllEachMiddlewareFn, type VigorAllEachOnErrorFn, VigorAllError, type VigorAllErrorCodes, type VigorAllErrorDatas, VigorAllErrorMessageFuncs, VigorAllPolicyBase, VigorAllPolicyMiddlewares, VigorAllPolicyMiddlewaresBase, type VigorAllPolicyMiddlewaresSchema, type VigorAllPolicySchema, VigorAllPolicySettings, VigorAllPolicySettingsBase, type VigorAllPolicySettingsSchema, type VigorAllSchema, type VigorAllTask, type VigorBuiltin, type VigorConcat, type VigorDeepMerge, type VigorDeepPartial, VigorError, type VigorErrorOptions, VigorFetch, VigorFetchBase, VigorFetchError, type VigorFetchErrorCodes, type VigorFetchErrorDatas, VigorFetchErrorMessageFuncs, VigorFetchPolicyBase, VigorFetchPolicyMiddlewares, type VigorFetchPolicyMiddlewaresApi, VigorFetchPolicyMiddlewaresBase, type VigorFetchPolicyMiddlewaresFluent, type VigorFetchPolicyMiddlewaresIntercept, type VigorFetchPolicyMiddlewaresSchema, type VigorFetchPolicySchema, VigorFetchPolicySettings, VigorFetchPolicySettingsBase, type VigorFetchPolicySettingsSchema, type VigorFetchSchema, type VigorInstance, VigorJitter, type VigorLastOf, type VigorMergeMode, type VigorMergeStrategy, VigorParse, VigorParseBase, VigorParseContentTypeStrategy, VigorParseError, type VigorParseErrorCodes, type VigorParseErrorDatas, VigorParseErrorMessageFuncs, VigorParsePolicyBase, VigorParsePolicyMiddlewares, type VigorParsePolicyMiddlewaresApi, VigorParsePolicyMiddlewaresBase, type VigorParsePolicyMiddlewaresFluent, type VigorParsePolicyMiddlewaresIntercept, type VigorParsePolicyMiddlewaresSchema, type VigorParsePolicySchema, VigorParsePolicySettings, VigorParsePolicySettingsBase, type VigorParsePolicySettingsSchema, VigorParsePolicyStrategies, VigorParsePolicyStrategiesBase, type VigorParsePolicyStrategiesSchema, type VigorParseSchema, VigorParseSniffStrategy, type VigorParseStrategyFunc, type VigorPlugin, type VigorPrimitive, type VigorReplaceType, VigorRetry, VigorRetryBase, VigorRetryError, type VigorRetryErrorCodes, type VigorRetryErrorDatas, VigorRetryErrorMessageFuncs, type VigorRetryPipeInitialContext, type VigorRetryPipeResult, type VigorRetryPipeStepResult, type VigorRetryPipeStepRetryIf, type VigorRetryPipeStepVoid, VigorRetryPolicyAlgorithms, VigorRetryPolicyAlgorithmsBackoff, VigorRetryPolicyAlgorithmsBackoffBase, type VigorRetryPolicyAlgorithmsBackoffSchema, VigorRetryPolicyAlgorithmsBase, VigorRetryPolicyAlgorithmsConstant, VigorRetryPolicyAlgorithmsConstantBase, type VigorRetryPolicyAlgorithmsConstantSchema, VigorRetryPolicyAlgorithmsCustom, VigorRetryPolicyAlgorithmsCustomBase, type VigorRetryPolicyAlgorithmsCustomSchema, VigorRetryPolicyAlgorithmsLinear, VigorRetryPolicyAlgorithmsLinearBase, type VigorRetryPolicyAlgorithmsLinearSchema, type VigorRetryPolicyAlgorithmsSchema, VigorRetryPolicyBase, VigorRetryPolicyMiddlewares, type VigorRetryPolicyMiddlewaresApi, VigorRetryPolicyMiddlewaresBase, type VigorRetryPolicyMiddlewaresFluent, type VigorRetryPolicyMiddlewaresIntercept, type VigorRetryPolicyMiddlewaresPipe, type VigorRetryPolicyMiddlewaresSchema, type VigorRetryPolicySchema, VigorRetryPolicySettings, VigorRetryPolicySettingsBase, type VigorRetryPolicySettingsSchema, type VigorRetrySchema, type VigorReturnType, type VigorSimplify, VigorStatus, type VigorStringable, vigor as default, vigor };
|
|
3062
|
+
export { VigorAll, VigorAllBase, type VigorAllEachMiddlewareFn, type VigorAllEachOnErrorFn, VigorAllError, type VigorAllErrorCodes, type VigorAllErrorDatas, VigorAllErrorMessageFuncs, VigorAllPolicyBase, VigorAllPolicyMiddlewares, VigorAllPolicyMiddlewaresBase, type VigorAllPolicyMiddlewaresSchema, type VigorAllPolicySchema, VigorAllPolicySettings, VigorAllPolicySettingsBase, type VigorAllPolicySettingsSchema, type VigorAllSchema, type VigorAllTask, type VigorBuiltin, type VigorCastResult, type VigorConcat, type VigorDeepMerge, type VigorDeepPartial, VigorError, type VigorErrorOptions, VigorFetch, VigorFetchBase, VigorFetchError, type VigorFetchErrorCodes, type VigorFetchErrorDatas, VigorFetchErrorMessageFuncs, VigorFetchPolicyBase, VigorFetchPolicyMiddlewares, type VigorFetchPolicyMiddlewaresApi, VigorFetchPolicyMiddlewaresBase, type VigorFetchPolicyMiddlewaresFluent, type VigorFetchPolicyMiddlewaresIntercept, type VigorFetchPolicyMiddlewaresSchema, type VigorFetchPolicySchema, VigorFetchPolicySettings, VigorFetchPolicySettingsBase, type VigorFetchPolicySettingsSchema, type VigorFetchSchema, type VigorInstance, VigorJitter, type VigorLastOf, type VigorMergeMode, type VigorMergeStrategy, VigorParse, VigorParseBase, VigorParseContentTypeStrategy, VigorParseError, type VigorParseErrorCodes, type VigorParseErrorDatas, VigorParseErrorMessageFuncs, VigorParsePolicyBase, VigorParsePolicyMiddlewares, type VigorParsePolicyMiddlewaresApi, VigorParsePolicyMiddlewaresBase, type VigorParsePolicyMiddlewaresFluent, type VigorParsePolicyMiddlewaresIntercept, type VigorParsePolicyMiddlewaresSchema, type VigorParsePolicySchema, VigorParsePolicySettings, VigorParsePolicySettingsBase, type VigorParsePolicySettingsSchema, VigorParsePolicyStrategies, VigorParsePolicyStrategiesBase, type VigorParsePolicyStrategiesSchema, type VigorParseSchema, VigorParseSniffStrategy, type VigorParseStrategyFunc, type VigorPlugin, type VigorPrimitive, type VigorReplaceType, VigorRetry, VigorRetryBase, VigorRetryError, type VigorRetryErrorCodes, type VigorRetryErrorDatas, VigorRetryErrorMessageFuncs, type VigorRetryPipeInitialContext, type VigorRetryPipeResult, type VigorRetryPipeStepResult, type VigorRetryPipeStepRetryIf, type VigorRetryPipeStepVoid, VigorRetryPolicyAlgorithms, VigorRetryPolicyAlgorithmsBackoff, VigorRetryPolicyAlgorithmsBackoffBase, type VigorRetryPolicyAlgorithmsBackoffSchema, VigorRetryPolicyAlgorithmsBase, VigorRetryPolicyAlgorithmsConstant, VigorRetryPolicyAlgorithmsConstantBase, type VigorRetryPolicyAlgorithmsConstantSchema, VigorRetryPolicyAlgorithmsCustom, VigorRetryPolicyAlgorithmsCustomBase, type VigorRetryPolicyAlgorithmsCustomSchema, VigorRetryPolicyAlgorithmsLinear, VigorRetryPolicyAlgorithmsLinearBase, type VigorRetryPolicyAlgorithmsLinearSchema, type VigorRetryPolicyAlgorithmsSchema, VigorRetryPolicyBase, VigorRetryPolicyMiddlewares, type VigorRetryPolicyMiddlewaresApi, VigorRetryPolicyMiddlewaresBase, type VigorRetryPolicyMiddlewaresFluent, type VigorRetryPolicyMiddlewaresIntercept, type VigorRetryPolicyMiddlewaresPipe, type VigorRetryPolicyMiddlewaresSchema, type VigorRetryPolicySchema, VigorRetryPolicySettings, VigorRetryPolicySettingsBase, type VigorRetryPolicySettingsSchema, type VigorRetrySchema, type VigorReturnType, type VigorSimplify, VigorStatus, type VigorStringable, vigor as default, vigor };
|