vigor-fetch 5.0.0 → 5.1.0

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.d.ts CHANGED
@@ -114,6 +114,48 @@ type VigorMergeMode = "merge" | "replace" | "concat";
114
114
  type VigorMergeStrategy<T> = T extends VigorBuiltin ? VigorMergeMode | undefined : T extends readonly any[] ? VigorMergeMode : {
115
115
  [K in keyof T]?: VigorMergeStrategy<T[K]> | VigorMergeMode;
116
116
  };
117
+ /** Whether `A` and `B` are the same type. */
118
+ type VigorIsSame<A, B> = (<X>() => X extends A ? 1 : 2) extends (<X>() => X extends B ? 1 : 2) ? true : false;
119
+ /**
120
+ * What an intercept middleware changed: the keys of the context `A` it
121
+ * returned whose type differs from the context `P` it was given (or that
122
+ * `P` lacks). Returning `ctx` itself — or `{ ...ctx }` — changes nothing, so
123
+ * the pipeline keeps its own, current types instead of the snapshot `P` was
124
+ * computed from when the middleware was registered. An `any` return, or an
125
+ * `any` key, changes nothing either.
126
+ */
127
+ type VigorContextChanges<P, A> = 0 extends (1 & A) ? {} : VigorIsSame<A, P> extends true ? {} : A extends object ? {
128
+ [K in keyof A as K extends keyof P ? VigorIsSame<A[K], P[K]> extends true ? never : 0 extends (1 & A[K]) ? never : K : K]: A[K];
129
+ } : {};
130
+ /** `Ctx` with `Changes` written over it — `Ctx` itself when nothing changed. */
131
+ type VigorContextApply<Ctx, Changes> = [
132
+ keyof Changes
133
+ ] extends [never] ? Ctx : VigorContextReset<Ctx, Changes>;
134
+ /** `Ctx` with `Fresh`'s keys given `Fresh`'s types — what the runtime (re)sets at a stage's start. One mapped type, so it stays cheap. */
135
+ type VigorContextReset<Ctx, Fresh> = {
136
+ [K in keyof Ctx | keyof Fresh]: K extends keyof Fresh ? Fresh[K] : K extends keyof Ctx ? Ctx[K] : never;
137
+ };
138
+ /** One middleware applied to `Ctx` — see {@link VigorContextStage}. */
139
+ type VigorContextStep<Ctx, M, FluentKey extends PropertyKey> = M extends {
140
+ _mode: "intercept";
141
+ func: (ctx: infer P, ...args: any[]) => infer Ret;
142
+ } ? VigorContextApply<Ctx, VigorContextChanges<P, Awaited<Ret>>> : M extends {
143
+ _mode: "fluent";
144
+ func: (...args: any[]) => infer FR;
145
+ } ? [FluentKey] extends [never] ? Ctx : VigorContextApply<Ctx, {
146
+ [K in FluentKey]: Awaited<FR>;
147
+ }> : Ctx;
148
+ /**
149
+ * Folds one stage's middleware list over `Ctx`, the way the runtime runs
150
+ * it: an intercept middleware's returned context (awaited) overwrites the
151
+ * keys it changed (see {@link VigorContextChanges}), and a fluent one's
152
+ * return value (awaited) overwrites `FluentKey` — `never` for a stage whose
153
+ * fluent middlewares return nothing. A list that isn't a tuple, whose order
154
+ * is unknown, leaves `Ctx` as it is. An `any` list — a stage of a
155
+ * `Vigor*Schema<any>`, as in the schemas' own constraints — gives `any`, so
156
+ * any registered middleware satisfies them.
157
+ */
158
+ type VigorContextStage<Ctx, List, FluentKey extends PropertyKey = never> = 0 extends (1 & List) ? any : List extends readonly [infer Head, ...infer Tail] ? VigorContextStage<VigorContextStep<Ctx, Head, FluentKey>, Tail, FluentKey> : Ctx;
117
159
 
118
160
  /**
119
161
  * Base class for Vigor's immutable, chainable builder objects.
@@ -271,9 +313,7 @@ type VigorParsePolicyMiddlewaresFluent<T extends VigorParseSchema<T>> = {
271
313
  };
272
314
  onResult: {
273
315
  _mode: "fluent";
274
- func: (res: VigorParseOnResultContextSchema<T> extends {
275
- result: infer R;
276
- } ? R : never) => VigorParseContextSchema<any>["result"] | Promise<VigorParseContextSchema<any>["result"]>;
316
+ func: (res: VigorParseOnResultContextSchema<T>["result"]) => VigorParseContextSchema<any>["result"] | Promise<VigorParseContextSchema<any>["result"]>;
277
317
  };
278
318
  onError: {
279
319
  _mode: "fluent";
@@ -302,7 +342,7 @@ type VigorParsePolicyMiddlewaresIntercept<T extends VigorParseSchema<T>> = {
302
342
  };
303
343
  onError: {
304
344
  _mode: "intercept";
305
- func: (ctx: VigorParseContextSchema<T>, api: Pick<VigorParsePolicyMiddlewaresApi<T>, "setResult" | "throwError" | "proceedRestart" | "cancelRestart">) => VigorParseContextSchema<any> | Promise<VigorParseContextSchema<any>>;
345
+ func: (ctx: VigorParseOnErrorContextSchema<T>, api: Pick<VigorParsePolicyMiddlewaresApi<T>, "setResult" | "throwError" | "proceedRestart" | "cancelRestart">) => VigorParseContextSchema<any> | Promise<VigorParseContextSchema<any>>;
306
346
  };
307
347
  };
308
348
  /**
@@ -399,28 +439,10 @@ declare class VigorParsePolicyMiddlewares<T extends VigorParseSchema<T> = typeof
399
439
  };
400
440
  }>>;
401
441
  }
402
- type VigorParsePipeInitialContext<T extends VigorParseSchema<T>, R = T["policy"]["settings"]["raw"] extends true ? VigorExcludeDefault<T["policy"]["target"]> : VigorCastResult<T["cast"], unknown>> = VigorDeepMerge<Omit<VigorParseContextSchema<T, unknown>, "result">, {
403
- result: R;
404
- }>;
405
- type VigorParsePipeStepVoid<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
406
- _mode: "intercept";
407
- func: (...args: any[]) => infer Ret;
408
- } ? VigorParsePipeStepVoid<Ret, Tail> : VigorParsePipeStepVoid<Ctx, Tail> : Ctx;
409
- type VigorParsePipeStepResult<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
410
- _mode: "intercept";
411
- func: (...args: any[]) => infer Ret;
412
- } ? VigorParsePipeStepResult<Ret, Tail> : Head extends {
413
- _mode: "fluent";
414
- func: (...args: any[]) => infer FR;
415
- } ? VigorParsePipeStepResult<VigorDeepMerge<Ctx, {
416
- result: FR;
417
- }, {
418
- result: "replace";
419
- }>, Tail> : VigorParsePipeStepResult<Ctx, Tail> : Ctx;
420
- type VigorParsePolicyMiddlewaresPipe<T extends VigorParseSchema<T>> = VigorParsePipeStepVoid<VigorParsePipeStepResult<VigorParsePipeStepResult<VigorParsePipeStepVoid<VigorParsePipeInitialContext<T>, T["policy"]["middlewares"]["before"]>, T["policy"]["middlewares"]["after"]>, T["policy"]["middlewares"]["onResult"]>, T["policy"]["middlewares"]["onError"]>;
421
- type VigorParsePipeResult<T extends VigorParseSchema<T>> = VigorParsePolicyMiddlewaresPipe<T> extends {
422
- result: infer R;
423
- } ? R : never;
442
+ /** The result the success pipeline produces: the parsed one (or `.cast<T>()`'s), through `after` and `onResult`. */
443
+ type VigorParsePipeResult<T extends VigorParseSchema<T>> = VigorParseOnResultContextSchema<T>["result"];
444
+ /** `ctx.result` once the `onError` middlewares ran — what a recovered run (`setResult`) resolves to, as far as types go. */
445
+ type VigorParseErrorPipeResult<T extends VigorParseSchema<T>> = VigorParseOnErrorContextSchema<T>["result"];
424
446
 
425
447
  /**
426
448
  * One recorded timeline entry: which `action` happened, its `content`, `now`,
@@ -611,16 +633,24 @@ type VigorParseContextSchema<T extends VigorParseSchema<T>, R = VigorParsePipeRe
611
633
  timeline: VigorParseTimeline;
612
634
  policy: T["policy"];
613
635
  };
614
- /** Context shape seen by `before` middlewares — parsing hasn't run yet. */
615
- type VigorParseBeforeContextSchema<T extends VigorParseSchema<T>> = VigorParseContextSchema<T, VigorDefaultType>;
616
- /** Context shape seen by `after` middlewares — reflects the result after `before` has run. */
617
- type VigorParseAfterContextSchema<T extends VigorParseSchema<T>> = VigorParsePipeStepResult<VigorDeepMerge<VigorParsePipeStepVoid<VigorParsePipeInitialContext<T>, T["policy"]["middlewares"]["before"]>, {
618
- result: VigorParsePipeInitialContext<T>["result"];
619
- }, {
620
- result: "replace";
636
+ /** The result before any middleware: a `raw` parse's target, else `.cast<T>()`'s (`unknown` without one). */
637
+ type VigorParseNaturalResult<T extends VigorParseSchema<T>> = T["policy"]["settings"]["raw"] extends true ? VigorExcludeDefault<T["policy"]["target"]> : VigorCastResult<T["cast"], unknown>;
638
+ /**
639
+ * Context seen by `before` middlewares — parsing hasn't run yet.
640
+ *
641
+ * Each stage's context is defined on its own — the runtime's view at that
642
+ * point — with whatever the stage's earlier intercept middlewares changed by
643
+ * returning a different context (see `VigorContextStage`).
644
+ */
645
+ type VigorParseBeforeContextSchema<T extends VigorParseSchema<T>> = VigorContextStage<VigorParseContextSchema<T, VigorDefaultType>, T["policy"]["middlewares"]["before"]>;
646
+ /** Context seen by `after` middlewares — `result` is the parsed one; what `before` changed otherwise carries over. */
647
+ type VigorParseAfterContextSchema<T extends VigorParseSchema<T>> = VigorContextStage<VigorContextReset<VigorParseBeforeContextSchema<T>, {
648
+ result: VigorParseNaturalResult<T>;
621
649
  }>, T["policy"]["middlewares"]["after"]>;
622
- /** Context shape seen by `onResult` middlewares — additionally threads any `onResult` middlewares already registered earlier in the same chain, so `ctx.result` reflects what the previous `onResult` returned. */
623
- type VigorParseOnResultContextSchema<T extends VigorParseSchema<T>> = VigorParsePipeStepResult<VigorParseAfterContextSchema<T>, T["policy"]["middlewares"]["onResult"]>;
650
+ /** Context seen by `onResult` middlewares — `ctx.result` is what the earlier `onResult` ones left it as. */
651
+ type VigorParseOnResultContextSchema<T extends VigorParseSchema<T>> = VigorContextStage<VigorParseAfterContextSchema<T>, T["policy"]["middlewares"]["onResult"], "result">;
652
+ /** Context seen by `onError` middlewares — every strategy failed (or a middleware threw). */
653
+ type VigorParseOnErrorContextSchema<T extends VigorParseSchema<T>> = VigorContextStage<VigorParseContextSchema<T>, T["policy"]["middlewares"]["onError"]>;
624
654
  /** Context shape once the full middleware pipeline (including `onResult`) has run. */
625
655
  type VigorParseResultContextSchema<T extends VigorParseSchema<T>> = VigorParseContextSchema<T, VigorParsePipeResult<T>>;
626
656
  declare const VigorParseContextBase: {
@@ -855,7 +885,7 @@ type VigorParseSchema<T extends VigorParseSchema<T>> = {
855
885
  cast: unknown;
856
886
  };
857
887
  /** What `request()` resolves to: the pipeline's result, or what `settings.default` returns. */
858
- type VigorParseResult<T extends VigorParseSchema<T>> = VigorExcludeDefault<VigorParseContextSchema<T>["result"]> | VigorReturnType<T["policy"]["settings"]["default"]>;
888
+ type VigorParseResult<T extends VigorParseSchema<T>> = VigorExcludeDefault<VigorParseContextSchema<T>["result"]> | VigorExcludeDefault<VigorParseErrorPipeResult<T>> | VigorReturnType<T["policy"]["settings"]["default"]>;
859
889
  /** The builder `T` becomes after merging `P` in (with strategy tree `S`). */
860
890
  type VigorParseNext<T, P, S = undefined> = VigorApply<VigorParseTypeLambda, VigorDeepMerge<T, P, S>>;
861
891
  declare const VigorParseBase: {
@@ -1226,9 +1256,7 @@ type VigorRetryPolicyMiddlewaresFluent<T extends VigorRetrySchema<T>> = {
1226
1256
  };
1227
1257
  onResult: {
1228
1258
  _mode: "fluent";
1229
- func: (res: VigorRetryOnResultContextSchema<T> extends {
1230
- result: infer R;
1231
- } ? R : never) => VigorRetryContextSchema<any>["result"] | Promise<VigorRetryContextSchema<any>["result"]>;
1259
+ func: (res: VigorRetryOnResultContextSchema<T>["result"]) => VigorRetryContextSchema<any>["result"] | Promise<VigorRetryContextSchema<any>["result"]>;
1232
1260
  };
1233
1261
  retryIf: {
1234
1262
  _mode: "fluent";
@@ -1270,15 +1298,15 @@ type VigorRetryPolicyMiddlewaresIntercept<T extends VigorRetrySchema<T>> = {
1270
1298
  };
1271
1299
  retryIf: {
1272
1300
  _mode: "intercept";
1273
- func: (ctx: VigorRetryContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "proceedRetry" | "cancelRetry">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
1301
+ func: (ctx: VigorRetryRetryIfContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "proceedRetry" | "cancelRetry">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
1274
1302
  };
1275
1303
  onRetry: {
1276
1304
  _mode: "intercept";
1277
- func: (ctx: VigorRetryContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "throwError" | "setDelay">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
1305
+ func: (ctx: VigorRetryOnRetryContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "throwError" | "setDelay">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
1278
1306
  };
1279
1307
  onError: {
1280
1308
  _mode: "intercept";
1281
- func: (ctx: VigorRetryContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "setResult" | "throwError" | "proceedRestart" | "cancelRestart">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
1309
+ func: (ctx: VigorRetryOnErrorContextSchema<T>, api: Pick<VigorRetryPolicyMiddlewaresApi<T>, "setResult" | "throwError" | "proceedRestart" | "cancelRestart">) => VigorRetryContextSchema<any> | Promise<VigorRetryContextSchema<any>>;
1282
1310
  };
1283
1311
  };
1284
1312
  /**
@@ -1418,43 +1446,10 @@ declare class VigorRetryPolicyMiddlewares<T extends VigorRetrySchema<T> = typeof
1418
1446
  };
1419
1447
  }>>;
1420
1448
  }
1421
- type VigorRetryPipeInitialContext<T extends VigorRetrySchema<T>, R = VigorCastResult<T["cast"], VigorReturnType<T["policy"]["target"]>>> = VigorDeepMerge<Omit<VigorRetryContextSchema<T, unknown>, "result">, {
1422
- result: R;
1423
- }>;
1424
- type VigorRetryPipeStepVoid<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
1425
- _mode: "intercept";
1426
- func: (...args: any[]) => infer Ret;
1427
- } ? VigorRetryPipeStepVoid<Ret, Tail> : VigorRetryPipeStepVoid<Ctx, Tail> : Ctx;
1428
- type VigorRetryPipeStepResult<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
1429
- _mode: "intercept";
1430
- func: (...args: any[]) => infer Ret;
1431
- } ? VigorRetryPipeStepResult<Ret, Tail> : Head extends {
1432
- _mode: "fluent";
1433
- func: (...args: any[]) => infer FR;
1434
- } ? VigorRetryPipeStepResult<VigorDeepMerge<Ctx, {
1435
- result: FR;
1436
- }, {
1437
- result: "replace";
1438
- }>, Tail> : VigorRetryPipeStepResult<Ctx, Tail> : Ctx;
1439
- type VigorRetryPipeStepRetryIf<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
1440
- _mode: "intercept";
1441
- func: (...args: any[]) => infer Ret;
1442
- } ? VigorRetryPipeStepRetryIf<Ret, Tail> : Head extends {
1443
- _mode: "fluent";
1444
- func: (...args: any[]) => infer FR;
1445
- } ? VigorRetryPipeStepRetryIf<VigorDeepMerge<Ctx, {
1446
- flags: {
1447
- doRetry: FR;
1448
- };
1449
- }, {
1450
- flags: {
1451
- doRetry: "replace";
1452
- };
1453
- }>, Tail> : VigorRetryPipeStepRetryIf<Ctx, Tail> : Ctx;
1454
- 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"]>;
1455
- type VigorRetryPipeResult<T extends VigorRetrySchema<T>> = VigorRetryPolicyMiddlewaresPipe<T> extends {
1456
- result: infer R;
1457
- } ? R : never;
1449
+ /** The result the success pipeline produces: the target's (or `.cast<T>()`'s), through `after` and `onResult`. */
1450
+ type VigorRetryPipeResult<T extends VigorRetrySchema<T>> = VigorRetryOnResultContextSchema<T>["result"];
1451
+ /** `ctx.result` once the `onError` middlewares ran — what a recovered run (`setResult`) resolves to, as far as types go. */
1452
+ type VigorRetryErrorPipeResult<T extends VigorRetrySchema<T>> = VigorRetryOnErrorContextSchema<T>["result"];
1458
1453
 
1459
1454
  type VigorRetryTimelineStages = Omit<VigorRetryPolicyMiddlewaresSchema<any>, "__brand">;
1460
1455
  type VigorRetryTimelineApis = {
@@ -1555,16 +1550,29 @@ type VigorRetryContextSchema<T extends VigorRetrySchema<T>, R = VigorRetryPipeRe
1555
1550
  timeline: VigorRetryTimeline;
1556
1551
  policy: T["policy"];
1557
1552
  };
1558
- /** Context shape seen by `before` middlewares — the target hasn't run yet, so there's no result. */
1559
- type VigorRetryBeforeContextSchema<T extends VigorRetrySchema<T>> = VigorRetryContextSchema<T, VigorDefaultType>;
1560
- /** Context shape seen by `after` middlewares — reflects the result after `before` has run. */
1561
- type VigorRetryAfterContextSchema<T extends VigorRetrySchema<T>> = VigorRetryPipeStepResult<VigorDeepMerge<VigorRetryPipeStepVoid<VigorRetryPipeInitialContext<T>, T["policy"]["middlewares"]["before"]>, {
1562
- result: VigorRetryPipeInitialContext<T>["result"];
1563
- }, {
1564
- result: "replace";
1553
+ /** The result before any middleware: `.cast<T>()`'s, else the target's return type. */
1554
+ type VigorRetryNaturalResult<T extends VigorRetrySchema<T>> = VigorCastResult<T["cast"], VigorReturnType<T["policy"]["target"]>>;
1555
+ /**
1556
+ * Context seen by `before` middlewares — the target hasn't run yet, so
1557
+ * there's no result.
1558
+ *
1559
+ * Each stage's context is defined on its own — the runtime's view at that
1560
+ * point — with whatever the stage's earlier intercept middlewares changed by
1561
+ * returning a different context (see `VigorContextStage`).
1562
+ */
1563
+ type VigorRetryBeforeContextSchema<T extends VigorRetrySchema<T>> = VigorContextStage<VigorRetryContextSchema<T, VigorDefaultType>, T["policy"]["middlewares"]["before"]>;
1564
+ /** Context seen by `after` middlewares — `result` is the target's; what `before` changed otherwise carries over. */
1565
+ type VigorRetryAfterContextSchema<T extends VigorRetrySchema<T>> = VigorContextStage<VigorContextReset<VigorRetryBeforeContextSchema<T>, {
1566
+ result: VigorRetryNaturalResult<T>;
1565
1567
  }>, T["policy"]["middlewares"]["after"]>;
1566
- /** Context shape seen by `onResult` middlewares — additionally threads any `onResult` middlewares already registered earlier in the same chain, so `ctx.result` reflects what the previous `onResult` returned. */
1567
- type VigorRetryOnResultContextSchema<T extends VigorRetrySchema<T>> = VigorRetryPipeStepResult<VigorRetryAfterContextSchema<T>, T["policy"]["middlewares"]["onResult"]>;
1568
+ /** Context seen by `onResult` middlewares — `ctx.result` is what the earlier `onResult` ones left it as. */
1569
+ type VigorRetryOnResultContextSchema<T extends VigorRetrySchema<T>> = VigorContextStage<VigorRetryAfterContextSchema<T>, T["policy"]["middlewares"]["onResult"], "result">;
1570
+ /** Context seen by `retryIf` middlewares — an attempt failed. */
1571
+ type VigorRetryRetryIfContextSchema<T extends VigorRetrySchema<T>> = VigorContextStage<VigorRetryContextSchema<T>, T["policy"]["middlewares"]["retryIf"]>;
1572
+ /** Context seen by `onRetry` middlewares — `retryIf` decided to retry. */
1573
+ type VigorRetryOnRetryContextSchema<T extends VigorRetrySchema<T>> = VigorContextStage<VigorRetryRetryIfContextSchema<T>, T["policy"]["middlewares"]["onRetry"]>;
1574
+ /** Context seen by `onError` middlewares — the run failed. */
1575
+ type VigorRetryOnErrorContextSchema<T extends VigorRetrySchema<T>> = VigorContextStage<VigorRetryContextSchema<T>, T["policy"]["middlewares"]["onError"]>;
1568
1576
  /** Context shape once the full middleware pipeline (including `onResult`) has run. */
1569
1577
  type VigorRetryResultContextSchema<T extends VigorRetrySchema<T>> = VigorRetryContextSchema<T, VigorRetryPipeResult<T>>;
1570
1578
  declare const VigorRetryContextBase: {
@@ -1756,7 +1764,7 @@ type VigorRetrySchema<T extends VigorRetrySchema<T>> = {
1756
1764
  cast: unknown;
1757
1765
  };
1758
1766
  /** What `request()` resolves to: the pipeline's result, or what `settings.default` returns. */
1759
- type VigorRetryResult<T extends VigorRetrySchema<T>> = VigorExcludeDefault<VigorRetryContextSchema<T>["result"]> | VigorReturnType<T["policy"]["settings"]["default"]>;
1767
+ type VigorRetryResult<T extends VigorRetrySchema<T>> = VigorExcludeDefault<VigorRetryContextSchema<T>["result"]> | VigorExcludeDefault<VigorRetryErrorPipeResult<T>> | VigorReturnType<T["policy"]["settings"]["default"]>;
1760
1768
  /** The builder `T` becomes after merging `P` in (with strategy tree `S`). */
1761
1769
  type VigorRetryNext<T, P, S = undefined> = VigorApply<VigorRetryTypeLambda, VigorDeepMerge<T, P, S>>;
1762
1770
  declare const VigorRetryBase: {
@@ -2237,160 +2245,6 @@ interface VigorAllPolicyMiddlewaresTypeLambda extends VigorTypeLambda {
2237
2245
  readonly Target: VigorAllPolicyMiddlewares<VigorAllIn<this["In"]>>;
2238
2246
  }
2239
2247
 
2240
- declare const VigorAllErrorMessageFuncs: {
2241
- readonly EMPTY_TARGET: (_: {}) => string;
2242
- readonly TIMED_OUT: ({ limit, index }: {
2243
- limit: number;
2244
- index: number;
2245
- }) => string;
2246
- };
2247
- type VigorAllErrorCodes = keyof typeof VigorAllErrorMessageFuncs;
2248
- type VigorAllErrorDatas<C extends VigorAllErrorCodes> = Parameters<typeof VigorAllErrorMessageFuncs[C]> extends [infer A] ? A : undefined;
2249
- /**
2250
- * Every all error code as its own union member, so narrowing by `code`
2251
- * also narrows `data` to that code's payload.
2252
- */
2253
- type VigorAllErrors<T extends VigorAllSchema<any> = VigorAllSchema<any>> = {
2254
- [C in VigorAllErrorCodes]: VigorAllError<C, T>;
2255
- }[VigorAllErrorCodes];
2256
- /**
2257
- * `error` of a failed `requestVerbose()` — this module's errors, or anything else that was thrown (e.g. a task's error under `failFast`).
2258
- *
2259
- * Typed with the request's own schema `T`, so `context` (and anything else
2260
- * that depends on the config) is that request's, not a generic one.
2261
- */
2262
- type VigorAllRequestError<T extends VigorAllSchema<any> = any> = VigorResultError<VigorAllErrors<T>>;
2263
- /** Codes that may be raised without a run context. */
2264
- type VigorAllErrorCodesWithOptionalContext = never;
2265
- /** Codes that are never raised with a run context. */
2266
- type VigorAllErrorCodesWithoutContext = "TIMED_OUT";
2267
- /**
2268
- * The `context` of a `VigorAllError` with code `C`: the run context when
2269
- * the code always has one, `| undefined` when it may not, `undefined` when
2270
- * it never does. `TIMED_OUT` is raised for a single task (`data.index` says which), not with the batch context.
2271
- */
2272
- type VigorAllErrorContext<C extends VigorAllErrorCodes, T extends VigorAllSchema<any> = any> = VigorErrorContext<C, VigorAllContextSchema<T>, VigorAllErrorCodesWithOptionalContext, VigorAllErrorCodesWithoutContext>;
2273
- /** Error type thrown by the all module. */
2274
- declare class VigorAllError<C extends VigorAllErrorCodes, T extends VigorAllSchema<T>> extends VigorError<C, VigorAllErrorDatas<C>, VigorAllErrorContext<C, T>> {
2275
- /**
2276
- * @param code - One of the all module's error codes.
2277
- * @param options - Error metadata, including the `data` payload for `code`.
2278
- */
2279
- constructor(code: C, options: VigorErrorOptions<VigorAllErrorDatas<C>, VigorAllErrorContext<C, T>>);
2280
- }
2281
- /**
2282
- * What `isVigorAllError` narrows `E` to: the typed `VigorAllError` members
2283
- * already in `E` (so a `requestVerbose()` error keeps its request's
2284
- * `context` type), limited to codes `C`. For an `unknown` input (a `catch`
2285
- * binding, a `request()` rejection) there's no request to take types from,
2286
- * so it's the generic `VigorAllErrors<any>`.
2287
- */
2288
- type VigorAllErrorsIn<E, C extends VigorAllErrorCodes = VigorAllErrorCodes> = [
2289
- Extract<E, VigorAllError<any, any>>
2290
- ] extends [never] ? Extract<VigorAllErrors<any>, {
2291
- code: C;
2292
- }> : Extract<Extract<E, VigorAllError<any, any>>, {
2293
- code: C;
2294
- }>;
2295
- /**
2296
- * Narrows an error from a failed result envelope to the all module's typed
2297
- * error union. Prefer this over a bare `instanceof`: the envelope's `{}`
2298
- * member makes `instanceof` widen `data` back to every code's payload,
2299
- * while this guard keeps `code` and `data` in sync.
2300
- *
2301
- * Pass one or more `codes` to also check the code: the error is then
2302
- * narrowed to just those codes, so `data` is that code's payload right away.
2303
- *
2304
- * @example
2305
- * if (isVigorAllError(error, "TIMED_OUT")) {
2306
- * error.data // that code's payload
2307
- * }
2308
- */
2309
- declare function isVigorAllError<E>(error: E): error is E & VigorAllErrorsIn<E>;
2310
- declare function isVigorAllError<E, const C extends VigorAllErrorCodes>(error: E, ...codes: [C, ...C[]]): error is E & VigorAllErrorsIn<E, C>;
2311
-
2312
- /**
2313
- * A single task. It receives an `AbortSignal` that fires when the task's
2314
- * `timeout` elapses, the batch's `abortSignals` abort, or `failFast` stops
2315
- * the batch — tasks that ignore it keep running in the background, but
2316
- * their result is discarded.
2317
- */
2318
- type VigorAllTask = (signal: AbortSignal) => unknown | Promise<unknown>;
2319
- /** Extracts (and unwraps `Promise`/`Awaited`) the result type of a single task. */
2320
- type VigorAllTaskResult<F> = F extends (...args: any[]) => infer R ? Awaited<R> : never;
2321
- /**
2322
- * Maps a tuple of tasks to a tuple of their (awaited) result types, in the
2323
- * same order and length as `N`. If `N` isn't a literal tuple (e.g. the
2324
- * default, unconfigured `target`), this degrades to a plain array type.
2325
- */
2326
- type VigorAllTasksTuple<N extends readonly VigorAllTask[]> = {
2327
- [K in keyof N]: VigorAllTaskResult<N[K]>;
2328
- };
2329
- type VigorAllPolicySchema<T extends VigorAllSchema<T>> = {
2330
- __brand: VigorBrand<"All", "Policy<Schema">;
2331
- target: VigorAllTask[];
2332
- abortSignals: AbortSignal[];
2333
- settings: VigorAllPolicySettingsSchema<T>;
2334
- middlewares: VigorAllPolicyMiddlewaresSchema<T>;
2335
- };
2336
- declare const VigorAllPolicyBase: {
2337
- readonly __brand: VigorBrand<"All", "Policy<Schema">;
2338
- readonly target: [];
2339
- readonly abortSignals: [];
2340
- readonly settings: {
2341
- readonly __brand: VigorBrand<"All", "Policy<Settings<Schema">;
2342
- readonly debug: false;
2343
- readonly concurrency: 5;
2344
- readonly onlySuccess: false;
2345
- readonly timeout: symbol & {
2346
- __brand: VigorBrand<"Core", "Symbol_Empty">;
2347
- };
2348
- readonly failFast: false;
2349
- };
2350
- readonly middlewares: {
2351
- readonly __brand: VigorBrand<"All", "Policy<Middlewares<Schema">;
2352
- readonly before: [];
2353
- readonly after: [];
2354
- readonly onResult: [];
2355
- readonly beforeEach: [];
2356
- readonly afterEach: [];
2357
- readonly onErrorEach: [];
2358
- };
2359
- };
2360
- /**
2361
- * What a failed task's slot holds as `error`: whatever the task threw, or
2362
- * `VigorAllError("TIMED_OUT")` when it hit `settings.timeout`.
2363
- */
2364
- type VigorAllTaskError = VigorResultError<VigorAllError<"TIMED_OUT", any>>;
2365
- /**
2366
- * One task's outcome, shaped like `requestVerbose()`'s envelope: what it
2367
- * returned (or what `onErrorEach` recovered it with), or what it failed with.
2368
- */
2369
- type VigorAllSettled<V> = {
2370
- success: true;
2371
- data: V;
2372
- error: null;
2373
- } | {
2374
- success: false;
2375
- data: null;
2376
- error: VigorAllTaskError;
2377
- };
2378
- /**
2379
- * The naturally-inferred (pre-`.cast<T>()`) result type of `.request()`.
2380
- * When `onlySuccess` is left `false` (the default), every task gets its own
2381
- * tuple slot holding its outcome — `.target(() => 1 as const, () => "a")`
2382
- * infers `[VigorAllSettled<1>, VigorAllSettled<"a">]` — so a failed task
2383
- * can't pass for a result. `onlySuccess: true` keeps only the successful
2384
- * tasks' values, at runtime an arbitrary length, so it becomes an array of
2385
- * the tasks' result types (`(1 | "a")[]`). A non-literal `boolean` could be
2386
- * either, so it gives the union of both.
2387
- */
2388
- type VigorAllNaturalResult<T extends VigorAllSchema<T>> = T["policy"]["target"] extends readonly VigorAllTask[] ? VigorAllResultFor<T["policy"]["settings"]["onlySuccess"], VigorAllTasksTuple<T["policy"]["target"]>> : unknown[];
2389
- /** Distributes over `boolean`, so a non-literal `onlySuccess` yields both shapes. */
2390
- type VigorAllResultFor<OnlySuccess, Tuple extends readonly unknown[]> = OnlySuccess extends true ? Tuple[number][] : {
2391
- [K in keyof Tuple]: VigorAllSettled<Tuple[K]>;
2392
- };
2393
-
2394
2248
  /** Per-task hook (`beforeEach` / `afterEach`) — observes/mutates a single task's context, no return value. */
2395
2249
  type VigorAllEachMiddlewareFn = (ctx: VigorAllEachContextSchema<any>) => void | Promise<void>;
2396
2250
  /** Per-task failure hook (`onErrorEach`) — can override the task's outcome via `api.setResult`. */
@@ -2433,9 +2287,7 @@ type VigorAllPolicyMiddlewaresFluent<T extends VigorAllSchema<T>> = {
2433
2287
  };
2434
2288
  onResult: {
2435
2289
  _mode: "fluent";
2436
- func: (res: VigorAllOnResultContextSchema<T> extends {
2437
- result: infer R;
2438
- } ? R : never) => VigorAllContextSchema<any>["result"] | Promise<VigorAllContextSchema<any>["result"]>;
2290
+ func: (res: VigorAllOnResultContextSchema<T>["result"]) => VigorAllContextSchema<any>["result"] | Promise<VigorAllContextSchema<any>["result"]>;
2439
2291
  };
2440
2292
  };
2441
2293
  type VigorAllPolicyMiddlewaresApi<T extends VigorAllSchema<T>> = {
@@ -2558,28 +2410,162 @@ declare class VigorAllPolicyMiddlewares<T extends VigorAllSchema<T> = typeof Vig
2558
2410
  };
2559
2411
  }>>;
2560
2412
  }
2561
- type VigorAllPipeInitialContext<T extends VigorAllSchema<T>, R = VigorCastResult<T["cast"], VigorAllNaturalResult<T>>> = VigorDeepMerge<Omit<VigorAllContextSchema<T, unknown>, "result">, {
2562
- result: R;
2413
+ /** The result the batch-level pipeline produces: the tasks' outcomes (or `.cast<T>()`'s), through `after` and `onResult`. */
2414
+ type VigorAllPipeResult<T extends VigorAllSchema<T>> = VigorAllOnResultContextSchema<T>["result"];
2415
+
2416
+ declare const VigorAllErrorMessageFuncs: {
2417
+ readonly EMPTY_TARGET: (_: {}) => string;
2418
+ readonly TIMED_OUT: ({ limit, index }: {
2419
+ limit: number;
2420
+ index: number;
2421
+ }) => string;
2422
+ };
2423
+ type VigorAllErrorCodes = keyof typeof VigorAllErrorMessageFuncs;
2424
+ type VigorAllErrorDatas<C extends VigorAllErrorCodes> = Parameters<typeof VigorAllErrorMessageFuncs[C]> extends [infer A] ? A : undefined;
2425
+ /**
2426
+ * Every all error code as its own union member, so narrowing by `code`
2427
+ * also narrows `data` to that code's payload.
2428
+ */
2429
+ type VigorAllErrors<T extends VigorAllSchema<any> = VigorAllSchema<any>> = {
2430
+ [C in VigorAllErrorCodes]: VigorAllError<C, T>;
2431
+ }[VigorAllErrorCodes];
2432
+ /**
2433
+ * `error` of a failed `requestVerbose()` — this module's errors, or anything else that was thrown (e.g. a task's error under `failFast`).
2434
+ *
2435
+ * Typed with the request's own schema `T`, so `context` (and anything else
2436
+ * that depends on the config) is that request's, not a generic one.
2437
+ */
2438
+ type VigorAllRequestError<T extends VigorAllSchema<any> = any> = VigorResultError<VigorAllErrors<T>>;
2439
+ /** Codes that may be raised without a run context. */
2440
+ type VigorAllErrorCodesWithOptionalContext = never;
2441
+ /** Codes that are never raised with a run context. */
2442
+ type VigorAllErrorCodesWithoutContext = "TIMED_OUT";
2443
+ /**
2444
+ * The `context` of a `VigorAllError` with code `C`: the run context when
2445
+ * the code always has one, `| undefined` when it may not, `undefined` when
2446
+ * it never does. `TIMED_OUT` is raised for a single task (`data.index` says which), not with the batch context.
2447
+ */
2448
+ type VigorAllErrorContext<C extends VigorAllErrorCodes, T extends VigorAllSchema<any> = any> = VigorErrorContext<C, VigorAllContextSchema<T>, VigorAllErrorCodesWithOptionalContext, VigorAllErrorCodesWithoutContext>;
2449
+ /** Error type thrown by the all module. */
2450
+ declare class VigorAllError<C extends VigorAllErrorCodes, T extends VigorAllSchema<T>> extends VigorError<C, VigorAllErrorDatas<C>, VigorAllErrorContext<C, T>> {
2451
+ /**
2452
+ * @param code - One of the all module's error codes.
2453
+ * @param options - Error metadata, including the `data` payload for `code`.
2454
+ */
2455
+ constructor(code: C, options: VigorErrorOptions<VigorAllErrorDatas<C>, VigorAllErrorContext<C, T>>);
2456
+ }
2457
+ /**
2458
+ * What `isVigorAllError` narrows `E` to: the typed `VigorAllError` members
2459
+ * already in `E` (so a `requestVerbose()` error keeps its request's
2460
+ * `context` type), limited to codes `C`. For an `unknown` input (a `catch`
2461
+ * binding, a `request()` rejection) there's no request to take types from,
2462
+ * so it's the generic `VigorAllErrors<any>`.
2463
+ */
2464
+ type VigorAllErrorsIn<E, C extends VigorAllErrorCodes = VigorAllErrorCodes> = [
2465
+ Extract<E, VigorAllError<any, any>>
2466
+ ] extends [never] ? Extract<VigorAllErrors<any>, {
2467
+ code: C;
2468
+ }> : Extract<Extract<E, VigorAllError<any, any>>, {
2469
+ code: C;
2563
2470
  }>;
2564
- type VigorAllPipeStepVoid<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
2565
- _mode: "intercept";
2566
- func: (...args: any[]) => infer Ret;
2567
- } ? VigorAllPipeStepVoid<Ret, Tail> : VigorAllPipeStepVoid<Ctx, Tail> : Ctx;
2568
- type VigorAllPipeStepResult<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
2569
- _mode: "intercept";
2570
- func: (...args: any[]) => infer Ret;
2571
- } ? VigorAllPipeStepResult<Ret, Tail> : Head extends {
2572
- _mode: "fluent";
2573
- func: (...args: any[]) => infer FR;
2574
- } ? VigorAllPipeStepResult<VigorDeepMerge<Ctx, {
2575
- result: FR;
2576
- }, {
2577
- result: "replace";
2578
- }>, Tail> : VigorAllPipeStepResult<Ctx, Tail> : Ctx;
2579
- type VigorAllPolicyMiddlewaresPipe<T extends VigorAllSchema<T>> = VigorAllPipeStepResult<VigorAllPipeStepVoid<VigorAllPipeStepVoid<VigorAllPipeInitialContext<T>, T["policy"]["middlewares"]["before"]>, T["policy"]["middlewares"]["after"]>, T["policy"]["middlewares"]["onResult"]>;
2580
- type VigorAllPipeResult<T extends VigorAllSchema<T>> = VigorAllPolicyMiddlewaresPipe<T> extends {
2581
- result: infer R;
2582
- } ? R : never;
2471
+ /**
2472
+ * Narrows an error from a failed result envelope to the all module's typed
2473
+ * error union. Prefer this over a bare `instanceof`: the envelope's `{}`
2474
+ * member makes `instanceof` widen `data` back to every code's payload,
2475
+ * while this guard keeps `code` and `data` in sync.
2476
+ *
2477
+ * Pass one or more `codes` to also check the code: the error is then
2478
+ * narrowed to just those codes, so `data` is that code's payload right away.
2479
+ *
2480
+ * @example
2481
+ * if (isVigorAllError(error, "TIMED_OUT")) {
2482
+ * error.data // that code's payload
2483
+ * }
2484
+ */
2485
+ declare function isVigorAllError<E>(error: E): error is E & VigorAllErrorsIn<E>;
2486
+ declare function isVigorAllError<E, const C extends VigorAllErrorCodes>(error: E, ...codes: [C, ...C[]]): error is E & VigorAllErrorsIn<E, C>;
2487
+
2488
+ /**
2489
+ * A single task. It receives an `AbortSignal` that fires when the task's
2490
+ * `timeout` elapses, the batch's `abortSignals` abort, or `failFast` stops
2491
+ * the batch — tasks that ignore it keep running in the background, but
2492
+ * their result is discarded.
2493
+ */
2494
+ type VigorAllTask = (signal: AbortSignal) => unknown | Promise<unknown>;
2495
+ /** Extracts (and unwraps `Promise`/`Awaited`) the result type of a single task. */
2496
+ type VigorAllTaskResult<F> = F extends (...args: any[]) => infer R ? Awaited<R> : never;
2497
+ /**
2498
+ * Maps a tuple of tasks to a tuple of their (awaited) result types, in the
2499
+ * same order and length as `N`. If `N` isn't a literal tuple (e.g. the
2500
+ * default, unconfigured `target`), this degrades to a plain array type.
2501
+ */
2502
+ type VigorAllTasksTuple<N extends readonly VigorAllTask[]> = {
2503
+ [K in keyof N]: VigorAllTaskResult<N[K]>;
2504
+ };
2505
+ type VigorAllPolicySchema<T extends VigorAllSchema<T>> = {
2506
+ __brand: VigorBrand<"All", "Policy<Schema">;
2507
+ target: VigorAllTask[];
2508
+ abortSignals: AbortSignal[];
2509
+ settings: VigorAllPolicySettingsSchema<T>;
2510
+ middlewares: VigorAllPolicyMiddlewaresSchema<T>;
2511
+ };
2512
+ declare const VigorAllPolicyBase: {
2513
+ readonly __brand: VigorBrand<"All", "Policy<Schema">;
2514
+ readonly target: [];
2515
+ readonly abortSignals: [];
2516
+ readonly settings: {
2517
+ readonly __brand: VigorBrand<"All", "Policy<Settings<Schema">;
2518
+ readonly debug: false;
2519
+ readonly concurrency: 5;
2520
+ readonly onlySuccess: false;
2521
+ readonly timeout: symbol & {
2522
+ __brand: VigorBrand<"Core", "Symbol_Empty">;
2523
+ };
2524
+ readonly failFast: false;
2525
+ };
2526
+ readonly middlewares: {
2527
+ readonly __brand: VigorBrand<"All", "Policy<Middlewares<Schema">;
2528
+ readonly before: [];
2529
+ readonly after: [];
2530
+ readonly onResult: [];
2531
+ readonly beforeEach: [];
2532
+ readonly afterEach: [];
2533
+ readonly onErrorEach: [];
2534
+ };
2535
+ };
2536
+ /**
2537
+ * What a failed task's slot holds as `error`: whatever the task threw, or
2538
+ * `VigorAllError("TIMED_OUT")` when it hit `settings.timeout`.
2539
+ */
2540
+ type VigorAllTaskError = VigorResultError<VigorAllError<"TIMED_OUT", any>>;
2541
+ /**
2542
+ * One task's outcome, shaped like `requestVerbose()`'s envelope: what it
2543
+ * returned (or what `onErrorEach` recovered it with), or what it failed with.
2544
+ */
2545
+ type VigorAllSettled<V> = {
2546
+ success: true;
2547
+ data: V;
2548
+ error: null;
2549
+ } | {
2550
+ success: false;
2551
+ data: null;
2552
+ error: VigorAllTaskError;
2553
+ };
2554
+ /**
2555
+ * The naturally-inferred (pre-`.cast<T>()`) result type of `.request()`.
2556
+ * When `onlySuccess` is left `false` (the default), every task gets its own
2557
+ * tuple slot holding its outcome — `.target(() => 1 as const, () => "a")`
2558
+ * infers `[VigorAllSettled<1>, VigorAllSettled<"a">]` — so a failed task
2559
+ * can't pass for a result. `onlySuccess: true` keeps only the successful
2560
+ * tasks' values, at runtime an arbitrary length, so it becomes an array of
2561
+ * the tasks' result types (`(1 | "a")[]`). A non-literal `boolean` could be
2562
+ * either, so it gives the union of both.
2563
+ */
2564
+ type VigorAllNaturalResult<T extends VigorAllSchema<T>> = T["policy"]["target"] extends readonly VigorAllTask[] ? VigorAllResultFor<T["policy"]["settings"]["onlySuccess"], VigorAllTasksTuple<T["policy"]["target"]>> : unknown[];
2565
+ /** Distributes over `boolean`, so a non-literal `onlySuccess` yields both shapes. */
2566
+ type VigorAllResultFor<OnlySuccess, Tuple extends readonly unknown[]> = OnlySuccess extends true ? Tuple[number][] : {
2567
+ [K in keyof Tuple]: VigorAllSettled<Tuple[K]>;
2568
+ };
2583
2569
 
2584
2570
  type VigorAllTimelineStages = Omit<VigorAllPolicyMiddlewaresSchema<any>, "__brand">;
2585
2571
  type VigorAllTimelineApis = {
@@ -2639,16 +2625,22 @@ type VigorAllContextSchema<T extends VigorAllSchema<T>, R = VigorAllPipeResult<T
2639
2625
  /** Everything this `requestVerbose()` call has gone through so far. */
2640
2626
  timeline: VigorAllTimeline;
2641
2627
  };
2642
- /** Context shape seen by `before` middlewares — no task has run yet. */
2643
- type VigorAllBeforeContextSchema<T extends VigorAllSchema<T>> = VigorAllContextSchema<T, VigorDefaultType>;
2644
- /** Context shape seen by `after` middlewares — every task has settled, reflecting whatever `before` changed. */
2645
- type VigorAllAfterContextSchema<T extends VigorAllSchema<T>> = VigorDeepMerge<VigorAllPipeStepVoid<VigorAllPipeInitialContext<T>, T["policy"]["middlewares"]["before"]>, {
2646
- result: VigorAllPipeInitialContext<T>["result"];
2647
- }, {
2648
- result: "replace";
2649
- }>;
2650
- /** Context shape seen by `onResult` middlewares — additionally threads any `onResult` middlewares already registered earlier in the same chain, so `ctx.result` reflects what the previous `onResult` returned. */
2651
- type VigorAllOnResultContextSchema<T extends VigorAllSchema<T>> = VigorAllPipeStepResult<VigorAllPipeStepVoid<VigorAllAfterContextSchema<T>, T["policy"]["middlewares"]["after"]>, T["policy"]["middlewares"]["onResult"]>;
2628
+ /** The result before any batch-level middleware: `.cast<T>()`'s, else the tasks' outcomes. */
2629
+ type VigorAllCastNaturalResult<T extends VigorAllSchema<T>> = VigorCastResult<T["cast"], VigorAllNaturalResult<T>>;
2630
+ /**
2631
+ * Context seen by `before` middlewares — no task has run yet.
2632
+ *
2633
+ * Each stage's context is defined on its own — the runtime's view at that
2634
+ * point — with whatever the stage's earlier intercept middlewares changed by
2635
+ * returning a different context (see `VigorContextStage`).
2636
+ */
2637
+ type VigorAllBeforeContextSchema<T extends VigorAllSchema<T>> = VigorContextStage<VigorAllContextSchema<T, VigorDefaultType>, T["policy"]["middlewares"]["before"]>;
2638
+ /** Context seen by `after` middlewares — every task has settled; what `before` changed otherwise carries over. */
2639
+ type VigorAllAfterContextSchema<T extends VigorAllSchema<T>> = VigorContextStage<VigorContextReset<VigorAllBeforeContextSchema<T>, {
2640
+ result: VigorAllCastNaturalResult<T>;
2641
+ }>, T["policy"]["middlewares"]["after"]>;
2642
+ /** Context seen by `onResult` middlewares — `ctx.result` is what the earlier `onResult` ones left it as. */
2643
+ type VigorAllOnResultContextSchema<T extends VigorAllSchema<T>> = VigorContextStage<VigorAllAfterContextSchema<T>, T["policy"]["middlewares"]["onResult"], "result">;
2652
2644
  /** Context shape once the full batch-level pipeline (`before`/`after`/`onResult`) has run. */
2653
2645
  type VigorAllResultContextSchema<T extends VigorAllSchema<T>> = VigorAllContextSchema<T, VigorAllPipeResult<T>>;
2654
2646
  declare const VigorAllContextBase: {
@@ -3442,9 +3434,7 @@ type VigorFetchPolicyMiddlewaresFluent<T extends VigorFetchSchema<T>> = {
3442
3434
  };
3443
3435
  onResult: {
3444
3436
  _mode: "fluent";
3445
- func: (res: VigorFetchOnResultContextSchema<T> extends {
3446
- result: infer R;
3447
- } ? R : never) => VigorFetchContextSchema<any>["result"] | Promise<VigorFetchContextSchema<any>["result"]>;
3437
+ func: (res: VigorFetchOnResultContextSchema<T>["result"]) => VigorFetchContextSchema<any>["result"] | Promise<VigorFetchContextSchema<any>["result"]>;
3448
3438
  };
3449
3439
  onError: {
3450
3440
  _mode: "fluent";
@@ -3476,7 +3466,7 @@ type VigorFetchPolicyMiddlewaresIntercept<T extends VigorFetchSchema<T>> = {
3476
3466
  };
3477
3467
  onError: {
3478
3468
  _mode: "intercept";
3479
- func: (ctx: VigorFetchContextSchema<T>, api: Pick<VigorFetchPolicyMiddlewaresApi<T>, "setResult" | "throwError" | "proceedRestart" | "cancelRestart">) => VigorFetchContextSchema<any> | Promise<VigorFetchContextSchema<any>>;
3469
+ func: (ctx: VigorFetchOnErrorContextSchema<T>, api: Pick<VigorFetchPolicyMiddlewaresApi<T>, "setResult" | "throwError" | "proceedRestart" | "cancelRestart">) => VigorFetchContextSchema<any> | Promise<VigorFetchContextSchema<any>>;
3480
3470
  };
3481
3471
  };
3482
3472
  /**
@@ -3600,33 +3590,14 @@ type VigorFetchNaturalResult<T extends VigorFetchSchema<T>> = VigorFetchNaturalF
3600
3590
  * route matched (`VigorApiNoMatchType`) the parse engine's result is used.
3601
3591
  */
3602
3592
  type VigorFetchNaturalFor<T extends VigorFetchSchema<T>, D> = T["policy"]["parse"]["policy"]["settings"]["raw"] extends true ? VigorFetchParsedResult<T> : Exclude<D, VigorApiNoMatchType> | (VigorApiNoMatchType extends D ? VigorFetchParsedResult<T> : never);
3603
- type VigorFetchPipeInitialContext<T extends VigorFetchSchema<T>, R = VigorCastResult<T["cast"], VigorFetchNaturalResult<T>>> = VigorDeepMerge<Omit<VigorFetchContextSchema<T, unknown>, "result">, {
3604
- result: R;
3605
- }>;
3606
- type VigorFetchPipeStepVoid<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
3607
- _mode: "intercept";
3608
- func: (...args: any[]) => infer Ret;
3609
- } ? VigorFetchPipeStepVoid<Ret, Tail> : VigorFetchPipeStepVoid<Ctx, Tail> : Ctx;
3610
- type VigorFetchPipeStepResult<Ctx, Arr> = Arr extends [infer Head, ...infer Tail] ? Head extends {
3611
- _mode: "intercept";
3612
- func: (...args: any[]) => infer Ret;
3613
- } ? VigorFetchPipeStepResult<Ret, Tail> : Head extends {
3614
- _mode: "fluent";
3615
- func: (...args: any[]) => infer FR;
3616
- } ? VigorFetchPipeStepResult<VigorDeepMerge<Ctx, {
3617
- result: FR;
3618
- }, {
3619
- result: "replace";
3620
- }>, Tail> : VigorFetchPipeStepResult<Ctx, Tail> : Ctx;
3621
- type VigorFetchPolicyMiddlewaresPipe<T extends VigorFetchSchema<T>, Natural = VigorFetchNaturalResult<T>> = VigorFetchPipeStepVoid<VigorFetchPipeStepResult<VigorFetchPipeStepResult<VigorFetchPipeStepVoid<VigorFetchPipeInitialContext<T, VigorCastResult<T["cast"], Natural>>, T["policy"]["middlewares"]["before"]>, T["policy"]["middlewares"]["after"]>, T["policy"]["middlewares"]["onResult"]>, T["policy"]["middlewares"]["onError"]>;
3622
3593
  /**
3623
- * The result the middleware pipeline produces. `Natural` is the result it
3594
+ * The result the success pipeline produces. `Natural` is the result it
3624
3595
  * starts from (before `.cast<T>()`): by default the API map's whole success
3625
3596
  * union, or one status's data to follow that status through the pipeline.
3626
3597
  */
3627
- type VigorFetchPipeResult<T extends VigorFetchSchema<T>, Natural = VigorFetchNaturalResult<T>> = VigorFetchPolicyMiddlewaresPipe<T, Natural> extends {
3628
- result: infer R;
3629
- } ? R : never;
3598
+ type VigorFetchPipeResult<T extends VigorFetchSchema<T>, Natural = VigorFetchNaturalResult<T>> = VigorFetchOnResultContextSchema<T, Natural>["result"];
3599
+ /** `ctx.result` once the `onError` middlewares ran — what a recovered request (`setResult`) resolves to, as far as types go. */
3600
+ type VigorFetchErrorPipeResult<T extends VigorFetchSchema<T>> = VigorFetchOnErrorContextSchema<T>["result"];
3630
3601
 
3631
3602
  type VigorFetchTimelineStages = Omit<VigorFetchPolicyMiddlewaresSchema<any>, "__brand">;
3632
3603
  type VigorFetchTimelineApis = {
@@ -3736,16 +3707,27 @@ type VigorFetchContextSchema<T extends VigorFetchSchema<T>, R = VigorFetchPipeRe
3736
3707
  timeline: VigorFetchTimeline;
3737
3708
  policy: T["policy"];
3738
3709
  };
3739
- /** Context shape seen by `before` middlewares — the request hasn't been sent yet. */
3740
- type VigorFetchBeforeContextSchema<T extends VigorFetchSchema<T>> = VigorFetchContextSchema<T, VigorDefaultType>;
3741
- /** Context shape seen by `after` middlewares — reflects the result after `before` has run. */
3742
- type VigorFetchAfterContextSchema<T extends VigorFetchSchema<T>> = VigorFetchPipeStepResult<VigorDeepMerge<VigorFetchPipeStepVoid<VigorFetchPipeInitialContext<T>, T["policy"]["middlewares"]["before"]>, {
3743
- result: VigorFetchPipeInitialContext<T>["result"];
3744
- }, {
3745
- result: "replace";
3710
+ /**
3711
+ * Context seen by `before` middlewares — the request hasn't been sent yet.
3712
+ *
3713
+ * Each stage's context is defined on its own — the runtime's view at that
3714
+ * point — with whatever the stage's earlier intercept middlewares changed by
3715
+ * returning a different context (see `VigorContextStage`).
3716
+ */
3717
+ type VigorFetchBeforeContextSchema<T extends VigorFetchSchema<T>> = VigorContextStage<VigorFetchContextSchema<T, VigorDefaultType>, T["policy"]["middlewares"]["before"]>;
3718
+ /**
3719
+ * Context seen by `after` middlewares — `response` and the parsed `result`
3720
+ * are set; what `before` changed otherwise carries over. `Natural` is the
3721
+ * result before `.cast<T>()` (one API-map status's, when followed per status).
3722
+ */
3723
+ type VigorFetchAfterContextSchema<T extends VigorFetchSchema<T>, Natural = VigorFetchNaturalResult<T>> = VigorContextStage<VigorContextReset<VigorFetchBeforeContextSchema<T>, {
3724
+ result: VigorCastResult<T["cast"], Natural>;
3725
+ response: Response;
3746
3726
  }>, T["policy"]["middlewares"]["after"]>;
3747
- /** Context shape seen by `onResult` middlewares — additionally threads any `onResult` middlewares already registered earlier in the same chain, so `ctx.result` reflects what the previous `onResult` returned. */
3748
- type VigorFetchOnResultContextSchema<T extends VigorFetchSchema<T>> = VigorFetchPipeStepResult<VigorFetchAfterContextSchema<T>, T["policy"]["middlewares"]["onResult"]>;
3727
+ /** Context seen by `onResult` middlewares — `ctx.result` is what the earlier `onResult` ones left it as. */
3728
+ type VigorFetchOnResultContextSchema<T extends VigorFetchSchema<T>, Natural = VigorFetchNaturalResult<T>> = VigorContextStage<VigorFetchAfterContextSchema<T, Natural>, T["policy"]["middlewares"]["onResult"], "result">;
3729
+ /** Context seen by `onError` middlewares — the request failed. */
3730
+ type VigorFetchOnErrorContextSchema<T extends VigorFetchSchema<T>> = VigorContextStage<VigorFetchContextSchema<T>, T["policy"]["middlewares"]["onError"]>;
3749
3731
  /** Context shape once the full middleware pipeline (including `onResult`) has run. */
3750
3732
  type VigorFetchResultContextSchema<T extends VigorFetchSchema<T>> = VigorFetchContextSchema<T, VigorFetchPipeResult<T>>;
3751
3733
  declare const VigorFetchContextBase: {
@@ -4050,7 +4032,7 @@ type VigorFetchSchema<T extends VigorFetchSchema<T>> = {
4050
4032
  apiMap: unknown;
4051
4033
  };
4052
4034
  /** What `request()` resolves to: the pipeline's result, or what `settings.default` returns. */
4053
- type VigorFetchResult<T extends VigorFetchSchema<T>> = VigorExcludeDefault<VigorFetchContextSchema<T>["result"]> | VigorReturnType<T["policy"]["settings"]["default"]>;
4035
+ type VigorFetchResult<T extends VigorFetchSchema<T>> = VigorExcludeDefault<VigorFetchContextSchema<T>["result"]> | VigorExcludeDefault<VigorFetchErrorPipeResult<T>> | VigorReturnType<T["policy"]["settings"]["default"]>;
4054
4036
  /** The builder `T` becomes after merging `P` in (with strategy tree `S`). */
4055
4037
  type VigorFetchNext<T, P, S = undefined> = VigorApply<VigorFetchTypeLambda, VigorDeepMerge<T, P, S>>;
4056
4038
  /** `requestVerbose()`'s default type argument: "infer the result per status". Type-only. */
@@ -4090,7 +4072,7 @@ type VigorFetchVerboseParsed<T extends VigorFetchSchema<T>, R> = VigorFetchIsInf
4090
4072
  * `onError`'s `setResult` or `settings.default` — so there's no response:
4091
4073
  * `status`/`response` are `null`. Only possible when one of them is set.
4092
4074
  */
4093
- type VigorFetchVerboseRecovered<T extends VigorFetchSchema<T>, R> = (T["policy"]["middlewares"]["onError"] extends readonly [] ? never : VigorExcludeDefault<VigorFetchContextSchema<T>["result"]>) | (T["policy"]["settings"]["default"] extends VigorEmptyType ? never : VigorReturnType<T["policy"]["settings"]["default"]>) extends infer D ? [D] extends [never] ? never : {
4075
+ type VigorFetchVerboseRecovered<T extends VigorFetchSchema<T>, R> = (T["policy"]["middlewares"]["onError"] extends readonly [] ? never : VigorExcludeDefault<VigorFetchErrorPipeResult<T>>) | (T["policy"]["settings"]["default"] extends VigorEmptyType ? never : VigorReturnType<T["policy"]["settings"]["default"]>) extends infer D ? [D] extends [never] ? never : {
4094
4076
  success: true;
4095
4077
  data: VigorFetchIsInferred<R> extends true ? D : R;
4096
4078
  error: null;
@@ -5465,4 +5447,4 @@ type VigorPlugin<O extends {
5465
5447
  };
5466
5448
  declare const vigor: VigorInstance;
5467
5449
 
5468
- export { VigorAll, type VigorAllAfterContextSchema, VigorAllBase, type VigorAllBeforeContextSchema, VigorAllContextBase, type VigorAllContextSchema, VigorAllEachContextBase, type VigorAllEachContextSchema, type VigorAllEachMiddlewareFn, type VigorAllEachOnErrorFn, VigorAllError, type VigorAllErrorCodes, type VigorAllErrorCodesWithOptionalContext, type VigorAllErrorCodesWithoutContext, type VigorAllErrorContext, type VigorAllErrorDatas, VigorAllErrorMessageFuncs, type VigorAllErrors, type VigorAllErrorsIn, type VigorAllNaturalResult, type VigorAllOnResultContextSchema, type VigorAllPipeInitialContext, type VigorAllPipeResult, type VigorAllPipeStepResult, type VigorAllPipeStepVoid, VigorAllPolicyBase, VigorAllPolicyMiddlewares, type VigorAllPolicyMiddlewaresApi, VigorAllPolicyMiddlewaresBase, type VigorAllPolicyMiddlewaresFluent, type VigorAllPolicyMiddlewaresIntercept, type VigorAllPolicyMiddlewaresPipe, type VigorAllPolicyMiddlewaresSchema, type VigorAllPolicySchema, VigorAllPolicySettings, VigorAllPolicySettingsBase, type VigorAllPolicySettingsSchema, type VigorAllProcessHandler, type VigorAllRequestError, type VigorAllResult, type VigorAllResultContextSchema, type VigorAllSchema, type VigorAllSettled, type VigorAllTask, type VigorAllTaskError, type VigorAllTaskResult, type VigorAllTasksTuple, type VigorAllTimeline, type VigorAllTimelineEvents, type VigorAllTimelineSnapshot, type VigorApiFailure, type VigorApiKeys, type VigorApiMap, type VigorApiMapSlot, type VigorApiMatch, type VigorApiMatched, type VigorApiMethod, type VigorApiNoMatchType, type VigorApiParamValue, type VigorApiRequestIssue, type VigorApiRequestIssues, type VigorApiResponse, type VigorApiRoute, type VigorApiRouteKey, type VigorApiRouteOf, type VigorApiStatusClass, type VigorApiSuccess, type VigorBrand, type VigorBuiltin, VigorCastPlaceholder, type VigorCastPlaceholderType, type VigorCastResult, type VigorConcat, type VigorDeepMerge, type VigorDeepPartial, VigorDefault, type VigorDefaultType, VigorEmpty, type VigorEmptyType, VigorError, type VigorErrorContext, type VigorErrorOptions, type VigorExcludeDefault, type VigorExcludeEmpty, VigorFetch, type VigorFetchAfterContextSchema, VigorFetchBase, type VigorFetchBeforeContextSchema, type VigorFetchBodyFor, VigorFetchContextBase, type VigorFetchContextSchema, VigorFetchError, type VigorFetchErrorCodes, type VigorFetchErrorCodesWithOptionalContext, type VigorFetchErrorCodesWithoutContext, type VigorFetchErrorContext, type VigorFetchErrorDatas, VigorFetchErrorMessageFuncs, type VigorFetchErrors, type VigorFetchErrorsIn, type VigorFetchExtraOptions, type VigorFetchFailedData, type VigorFetchInferResult, type VigorFetchMethodFor, type VigorFetchNaturalFor, type VigorFetchNaturalResult, type VigorFetchOnResultContextSchema, type VigorFetchOptions, type VigorFetchParseSource, type VigorFetchParsedResult, type VigorFetchPipeInitialContext, type VigorFetchPipeResult, type VigorFetchPipeStepResult, type VigorFetchPipeStepVoid, VigorFetchPolicyBase, VigorFetchPolicyMiddlewares, type VigorFetchPolicyMiddlewaresApi, VigorFetchPolicyMiddlewaresBase, type VigorFetchPolicyMiddlewaresFluent, type VigorFetchPolicyMiddlewaresIntercept, type VigorFetchPolicyMiddlewaresPipe, type VigorFetchPolicyMiddlewaresSchema, type VigorFetchPolicySchema, VigorFetchPolicySettings, VigorFetchPolicySettingsBase, type VigorFetchPolicySettingsSchema, type VigorFetchProcessHandler, type VigorFetchRequestError, type VigorFetchRequestThis, type VigorFetchResult, type VigorFetchResultContextSchema, type VigorFetchRouteKeys, type VigorFetchSchema, type VigorFetchTimeline, type VigorFetchTimelineEvents, type VigorFetchTimelineSnapshot, type VigorFetchVerboseResult, type VigorHttpFailureStatus, type VigorHttpStatusOf, type VigorHttpSuccessStatus, type VigorInstance, VigorJitter, type VigorLastOf, type VigorMergeMode, type VigorMergeStrategy, type VigorNoExtraKeys, VigorParse, type VigorParseAfterContextSchema, VigorParseBase, type VigorParseBeforeContextSchema, type VigorParseBody, VigorParseContentTypeStrategy, VigorParseContextBase, type VigorParseContextSchema, VigorParseError, type VigorParseErrorCodes, type VigorParseErrorCodesWithOptionalContext, type VigorParseErrorCodesWithoutContext, type VigorParseErrorContext, type VigorParseErrorDatas, VigorParseErrorMessageFuncs, type VigorParseErrors, type VigorParseErrorsIn, type VigorParseOnResultContextSchema, type VigorParsePipeInitialContext, type VigorParsePipeResult, type VigorParsePipeStepResult, type VigorParsePipeStepVoid, VigorParsePolicyBase, VigorParsePolicyMiddlewares, type VigorParsePolicyMiddlewaresApi, VigorParsePolicyMiddlewaresBase, type VigorParsePolicyMiddlewaresFluent, type VigorParsePolicyMiddlewaresIntercept, type VigorParsePolicyMiddlewaresPipe, type VigorParsePolicyMiddlewaresSchema, type VigorParsePolicySchema, VigorParsePolicySettings, VigorParsePolicySettingsBase, type VigorParsePolicySettingsSchema, VigorParsePolicyStrategies, VigorParsePolicyStrategiesBase, type VigorParsePolicyStrategiesSchema, type VigorParseProcessHandler, type VigorParseRequestError, type VigorParseResult, type VigorParseResultContextSchema, type VigorParseSchema, VigorParseSniffStrategy, type VigorParseStrategyFunc, type VigorParseTimeline, type VigorParseTimelineEvents, type VigorParseTimelineSnapshot, type VigorPathList, type VigorPathSegments, type VigorPlugin, type VigorPrimitive, type VigorReplaceType, type VigorResolvedMethod, type VigorResultError, type VigorResultOf, VigorRetry, type VigorRetryAfterContextSchema, VigorRetryBase, type VigorRetryBeforeContextSchema, VigorRetryContextBase, type VigorRetryContextSchema, type VigorRetryDecisionReason, VigorRetryError, type VigorRetryErrorCodes, type VigorRetryErrorCodesWithOptionalContext, type VigorRetryErrorCodesWithoutContext, type VigorRetryErrorContext, type VigorRetryErrorDatas, VigorRetryErrorMessageFuncs, type VigorRetryErrors, type VigorRetryErrorsIn, type VigorRetryOnResultContextSchema, 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 VigorRetryProcessHandler, type VigorRetryRequestError, type VigorRetryResult, type VigorRetryResultContextSchema, type VigorRetrySchema, type VigorRetryTimeline, type VigorRetryTimelineEvents, type VigorRetryTimelineSnapshot, type VigorReturnType, type VigorRouteMethod, type VigorRouteParams, type VigorRoutePath, type VigorRoutePathList, type VigorRouteWithParams, type VigorRouteWithoutParams, type VigorSimplify, VigorStatus, type VigorStringable, type VigorTimeline, type VigorTimelineEndEvents, type VigorTimelineItem, type VigorTimelineMiddlewareEvents, type VigorTimelineOutcome, type VigorTimelineProcessEvents, type VigorTimelineSnapshot, adoptVigorFetchError, createBrand, createVigorTimelineRecorder, vigor as default, isVigorAllError, isVigorDefault, isVigorEmpty, isVigorFetchError, isVigorInternalMiddleware, isVigorParseError, isVigorRetryError, markVigorInternal, readVigorParseBody, vigor };
5450
+ export { VigorAll, type VigorAllAfterContextSchema, VigorAllBase, type VigorAllBeforeContextSchema, type VigorAllCastNaturalResult, VigorAllContextBase, type VigorAllContextSchema, VigorAllEachContextBase, type VigorAllEachContextSchema, type VigorAllEachMiddlewareFn, type VigorAllEachOnErrorFn, VigorAllError, type VigorAllErrorCodes, type VigorAllErrorCodesWithOptionalContext, type VigorAllErrorCodesWithoutContext, type VigorAllErrorContext, type VigorAllErrorDatas, VigorAllErrorMessageFuncs, type VigorAllErrors, type VigorAllErrorsIn, type VigorAllNaturalResult, type VigorAllOnResultContextSchema, type VigorAllPipeResult, VigorAllPolicyBase, VigorAllPolicyMiddlewares, type VigorAllPolicyMiddlewaresApi, VigorAllPolicyMiddlewaresBase, type VigorAllPolicyMiddlewaresFluent, type VigorAllPolicyMiddlewaresIntercept, type VigorAllPolicyMiddlewaresSchema, type VigorAllPolicySchema, VigorAllPolicySettings, VigorAllPolicySettingsBase, type VigorAllPolicySettingsSchema, type VigorAllProcessHandler, type VigorAllRequestError, type VigorAllResult, type VigorAllResultContextSchema, type VigorAllSchema, type VigorAllSettled, type VigorAllTask, type VigorAllTaskError, type VigorAllTaskResult, type VigorAllTasksTuple, type VigorAllTimeline, type VigorAllTimelineEvents, type VigorAllTimelineSnapshot, type VigorApiFailure, type VigorApiKeys, type VigorApiMap, type VigorApiMapSlot, type VigorApiMatch, type VigorApiMatched, type VigorApiMethod, type VigorApiNoMatchType, type VigorApiParamValue, type VigorApiRequestIssue, type VigorApiRequestIssues, type VigorApiResponse, type VigorApiRoute, type VigorApiRouteKey, type VigorApiRouteOf, type VigorApiStatusClass, type VigorApiSuccess, type VigorBrand, type VigorBuiltin, VigorCastPlaceholder, type VigorCastPlaceholderType, type VigorCastResult, type VigorConcat, type VigorContextApply, type VigorContextChanges, type VigorContextReset, type VigorContextStage, type VigorDeepMerge, type VigorDeepPartial, VigorDefault, type VigorDefaultType, VigorEmpty, type VigorEmptyType, VigorError, type VigorErrorContext, type VigorErrorOptions, type VigorExcludeDefault, type VigorExcludeEmpty, VigorFetch, type VigorFetchAfterContextSchema, VigorFetchBase, type VigorFetchBeforeContextSchema, type VigorFetchBodyFor, VigorFetchContextBase, type VigorFetchContextSchema, VigorFetchError, type VigorFetchErrorCodes, type VigorFetchErrorCodesWithOptionalContext, type VigorFetchErrorCodesWithoutContext, type VigorFetchErrorContext, type VigorFetchErrorDatas, VigorFetchErrorMessageFuncs, type VigorFetchErrorPipeResult, type VigorFetchErrors, type VigorFetchErrorsIn, type VigorFetchExtraOptions, type VigorFetchFailedData, type VigorFetchInferResult, type VigorFetchMethodFor, type VigorFetchNaturalFor, type VigorFetchNaturalResult, type VigorFetchOnErrorContextSchema, type VigorFetchOnResultContextSchema, type VigorFetchOptions, type VigorFetchParseSource, type VigorFetchParsedResult, type VigorFetchPipeResult, VigorFetchPolicyBase, VigorFetchPolicyMiddlewares, type VigorFetchPolicyMiddlewaresApi, VigorFetchPolicyMiddlewaresBase, type VigorFetchPolicyMiddlewaresFluent, type VigorFetchPolicyMiddlewaresIntercept, type VigorFetchPolicyMiddlewaresSchema, type VigorFetchPolicySchema, VigorFetchPolicySettings, VigorFetchPolicySettingsBase, type VigorFetchPolicySettingsSchema, type VigorFetchProcessHandler, type VigorFetchRequestError, type VigorFetchRequestThis, type VigorFetchResult, type VigorFetchResultContextSchema, type VigorFetchRouteKeys, type VigorFetchSchema, type VigorFetchTimeline, type VigorFetchTimelineEvents, type VigorFetchTimelineSnapshot, type VigorFetchVerboseResult, type VigorHttpFailureStatus, type VigorHttpStatusOf, type VigorHttpSuccessStatus, type VigorInstance, type VigorIsSame, VigorJitter, type VigorLastOf, type VigorMergeMode, type VigorMergeStrategy, type VigorNoExtraKeys, VigorParse, type VigorParseAfterContextSchema, VigorParseBase, type VigorParseBeforeContextSchema, type VigorParseBody, VigorParseContentTypeStrategy, VigorParseContextBase, type VigorParseContextSchema, VigorParseError, type VigorParseErrorCodes, type VigorParseErrorCodesWithOptionalContext, type VigorParseErrorCodesWithoutContext, type VigorParseErrorContext, type VigorParseErrorDatas, VigorParseErrorMessageFuncs, type VigorParseErrorPipeResult, type VigorParseErrors, type VigorParseErrorsIn, type VigorParseNaturalResult, type VigorParseOnErrorContextSchema, type VigorParseOnResultContextSchema, type VigorParsePipeResult, VigorParsePolicyBase, VigorParsePolicyMiddlewares, type VigorParsePolicyMiddlewaresApi, VigorParsePolicyMiddlewaresBase, type VigorParsePolicyMiddlewaresFluent, type VigorParsePolicyMiddlewaresIntercept, type VigorParsePolicyMiddlewaresSchema, type VigorParsePolicySchema, VigorParsePolicySettings, VigorParsePolicySettingsBase, type VigorParsePolicySettingsSchema, VigorParsePolicyStrategies, VigorParsePolicyStrategiesBase, type VigorParsePolicyStrategiesSchema, type VigorParseProcessHandler, type VigorParseRequestError, type VigorParseResult, type VigorParseResultContextSchema, type VigorParseSchema, VigorParseSniffStrategy, type VigorParseStrategyFunc, type VigorParseTimeline, type VigorParseTimelineEvents, type VigorParseTimelineSnapshot, type VigorPathList, type VigorPathSegments, type VigorPlugin, type VigorPrimitive, type VigorReplaceType, type VigorResolvedMethod, type VigorResultError, type VigorResultOf, VigorRetry, type VigorRetryAfterContextSchema, VigorRetryBase, type VigorRetryBeforeContextSchema, VigorRetryContextBase, type VigorRetryContextSchema, type VigorRetryDecisionReason, VigorRetryError, type VigorRetryErrorCodes, type VigorRetryErrorCodesWithOptionalContext, type VigorRetryErrorCodesWithoutContext, type VigorRetryErrorContext, type VigorRetryErrorDatas, VigorRetryErrorMessageFuncs, type VigorRetryErrorPipeResult, type VigorRetryErrors, type VigorRetryErrorsIn, type VigorRetryNaturalResult, type VigorRetryOnErrorContextSchema, type VigorRetryOnResultContextSchema, type VigorRetryOnRetryContextSchema, type VigorRetryPipeResult, 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 VigorRetryPolicyMiddlewaresSchema, type VigorRetryPolicySchema, VigorRetryPolicySettings, VigorRetryPolicySettingsBase, type VigorRetryPolicySettingsSchema, type VigorRetryProcessHandler, type VigorRetryRequestError, type VigorRetryResult, type VigorRetryResultContextSchema, type VigorRetryRetryIfContextSchema, type VigorRetrySchema, type VigorRetryTimeline, type VigorRetryTimelineEvents, type VigorRetryTimelineSnapshot, type VigorReturnType, type VigorRouteMethod, type VigorRouteParams, type VigorRoutePath, type VigorRoutePathList, type VigorRouteWithParams, type VigorRouteWithoutParams, type VigorSimplify, VigorStatus, type VigorStringable, type VigorTimeline, type VigorTimelineEndEvents, type VigorTimelineItem, type VigorTimelineMiddlewareEvents, type VigorTimelineOutcome, type VigorTimelineProcessEvents, type VigorTimelineSnapshot, adoptVigorFetchError, createBrand, createVigorTimelineRecorder, vigor as default, isVigorAllError, isVigorDefault, isVigorEmpty, isVigorFetchError, isVigorInternalMiddleware, isVigorParseError, isVigorRetryError, markVigorInternal, readVigorParseBody, vigor };