vigor-fetch 4.0.4 → 4.0.6
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 +1963 -0
- package/dist/index.d.cts +5332 -0
- package/dist/index.d.ts +46 -35
- package/dist/index.js +1790 -1900
- package/package.json +11 -16
- package/dist/index.mjs +0 -1935
package/dist/index.d.ts
CHANGED
|
@@ -1552,8 +1552,8 @@ declare class VigorRetryPolicyAlgorithms<T extends VigorRetrySchema<T> = typeof
|
|
|
1552
1552
|
initial: 0;
|
|
1553
1553
|
minDelay: 500;
|
|
1554
1554
|
maxDelay: 10000;
|
|
1555
|
-
multiplier: 1.7;
|
|
1556
1555
|
unit: 1000;
|
|
1556
|
+
multiplier: 1.7;
|
|
1557
1557
|
};
|
|
1558
1558
|
};
|
|
1559
1559
|
}>>>;
|
|
@@ -2581,15 +2581,9 @@ declare class VigorFetch<T extends VigorFetchSchema<T> = typeof VigorFetchBase>
|
|
|
2581
2581
|
private requestRuntime;
|
|
2582
2582
|
}
|
|
2583
2583
|
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
options: O;
|
|
2588
|
-
func: (v: typeof vigor, options: O) => void;
|
|
2589
|
-
};
|
|
2590
|
-
declare const vigor: {
|
|
2591
|
-
readonly use: <P extends VigorPlugin<any>>(plugin: P, options?: P["options"]) => void;
|
|
2592
|
-
readonly retry: (task?: Parameters<VigorRetry["target"]>[0]) => VigorRetry<{
|
|
2584
|
+
/** Everything `vigor` exposes except `use` — kept separate so `VigorInstance` (below) can self-reference without a circular-inference error. */
|
|
2585
|
+
declare const vigorBase: {
|
|
2586
|
+
retry: (task?: ((signal: AbortSignal) => any | Promise<any>) | undefined) => VigorRetry<{
|
|
2593
2587
|
readonly __brand: VigorBrand<"Retry", "Schema">;
|
|
2594
2588
|
readonly policy: {
|
|
2595
2589
|
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
@@ -2764,7 +2758,9 @@ declare const vigor: {
|
|
|
2764
2758
|
};
|
|
2765
2759
|
__brand: VigorBrand<"Retry", "Schema">;
|
|
2766
2760
|
}>;
|
|
2767
|
-
|
|
2761
|
+
parse: (response?: (symbol & {
|
|
2762
|
+
__brand: VigorBrand<"Core", "Symbol_Default">;
|
|
2763
|
+
}) | Request | Response | undefined) => VigorParse<{
|
|
2768
2764
|
readonly __brand: VigorBrand<"Parse", "Schema">;
|
|
2769
2765
|
readonly policy: {
|
|
2770
2766
|
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
@@ -2903,7 +2899,7 @@ declare const vigor: {
|
|
|
2903
2899
|
};
|
|
2904
2900
|
__brand: VigorBrand<"Parse", "Schema">;
|
|
2905
2901
|
}>;
|
|
2906
|
-
|
|
2902
|
+
fetch: (origin?: string | undefined) => VigorFetch<{
|
|
2907
2903
|
readonly __brand: VigorBrand<"Fetch", "Schema">;
|
|
2908
2904
|
readonly policy: {
|
|
2909
2905
|
readonly __brand: VigorBrand<"Fetch", "Policy<Schema">;
|
|
@@ -3716,7 +3712,7 @@ declare const vigor: {
|
|
|
3716
3712
|
};
|
|
3717
3713
|
__brand: VigorBrand<"Fetch", "Schema">;
|
|
3718
3714
|
}>;
|
|
3719
|
-
|
|
3715
|
+
all: (...tasks: Parameters<VigorAll["target"]>) => VigorAll<{
|
|
3720
3716
|
readonly __brand: VigorBrand<"All", "Schema">;
|
|
3721
3717
|
readonly policy: {
|
|
3722
3718
|
readonly __brand: VigorBrand<"All", "Policy<Schema">;
|
|
@@ -3756,9 +3752,9 @@ declare const vigor: {
|
|
|
3756
3752
|
readonly record: {};
|
|
3757
3753
|
};
|
|
3758
3754
|
}>;
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3755
|
+
builders: {
|
|
3756
|
+
fetch: {
|
|
3757
|
+
settings: () => VigorFetchPolicySettings<{
|
|
3762
3758
|
readonly __brand: VigorBrand<"Fetch", "Schema">;
|
|
3763
3759
|
readonly policy: {
|
|
3764
3760
|
readonly __brand: VigorBrand<"Fetch", "Policy<Schema">;
|
|
@@ -4166,7 +4162,7 @@ declare const vigor: {
|
|
|
4166
4162
|
};
|
|
4167
4163
|
};
|
|
4168
4164
|
}>;
|
|
4169
|
-
|
|
4165
|
+
middlewares: () => VigorFetchPolicyMiddlewares<{
|
|
4170
4166
|
readonly __brand: VigorBrand<"Fetch", "Schema">;
|
|
4171
4167
|
readonly policy: {
|
|
4172
4168
|
readonly __brand: VigorBrand<"Fetch", "Policy<Schema">;
|
|
@@ -4575,8 +4571,8 @@ declare const vigor: {
|
|
|
4575
4571
|
};
|
|
4576
4572
|
}>;
|
|
4577
4573
|
};
|
|
4578
|
-
|
|
4579
|
-
|
|
4574
|
+
retry: {
|
|
4575
|
+
settings: () => VigorRetryPolicySettings<{
|
|
4580
4576
|
readonly __brand: VigorBrand<"Retry", "Schema">;
|
|
4581
4577
|
readonly policy: {
|
|
4582
4578
|
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
@@ -4665,7 +4661,7 @@ declare const vigor: {
|
|
|
4665
4661
|
};
|
|
4666
4662
|
};
|
|
4667
4663
|
}>;
|
|
4668
|
-
|
|
4664
|
+
middlewares: () => VigorRetryPolicyMiddlewares<{
|
|
4669
4665
|
readonly __brand: VigorBrand<"Retry", "Schema">;
|
|
4670
4666
|
readonly policy: {
|
|
4671
4667
|
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
@@ -4754,7 +4750,7 @@ declare const vigor: {
|
|
|
4754
4750
|
};
|
|
4755
4751
|
};
|
|
4756
4752
|
}>;
|
|
4757
|
-
|
|
4753
|
+
algorithms: () => VigorRetryPolicyAlgorithms<{
|
|
4758
4754
|
readonly __brand: VigorBrand<"Retry", "Schema">;
|
|
4759
4755
|
readonly policy: {
|
|
4760
4756
|
readonly __brand: VigorBrand<"Retry", "Policy<Schema">;
|
|
@@ -4843,15 +4839,15 @@ declare const vigor: {
|
|
|
4843
4839
|
};
|
|
4844
4840
|
};
|
|
4845
4841
|
}>;
|
|
4846
|
-
|
|
4847
|
-
|
|
4842
|
+
algorithm: {
|
|
4843
|
+
constant: () => VigorRetryPolicyAlgorithmsConstant<{
|
|
4848
4844
|
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Constant<Schema">;
|
|
4849
4845
|
readonly _tag: "constant";
|
|
4850
4846
|
readonly jitter: 1000;
|
|
4851
4847
|
readonly interval: 2000;
|
|
4852
4848
|
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsConstantSchema<any>) => number;
|
|
4853
4849
|
}>;
|
|
4854
|
-
|
|
4850
|
+
linear: () => VigorRetryPolicyAlgorithmsLinear<{
|
|
4855
4851
|
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Linear<Schema">;
|
|
4856
4852
|
readonly _tag: "linear";
|
|
4857
4853
|
readonly jitter: 1000;
|
|
@@ -4861,7 +4857,7 @@ declare const vigor: {
|
|
|
4861
4857
|
readonly maxDelay: 10000;
|
|
4862
4858
|
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsLinearSchema<any>) => number;
|
|
4863
4859
|
}>;
|
|
4864
|
-
|
|
4860
|
+
backoff: () => VigorRetryPolicyAlgorithmsBackoff<{
|
|
4865
4861
|
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Backoff<Schema">;
|
|
4866
4862
|
readonly _tag: "backoff";
|
|
4867
4863
|
readonly jitter: 800;
|
|
@@ -4872,7 +4868,7 @@ declare const vigor: {
|
|
|
4872
4868
|
readonly maxDelay: 10000;
|
|
4873
4869
|
readonly _calculateDelay: (att: number, config: VigorRetryPolicyAlgorithmsBackoffSchema<any>) => number;
|
|
4874
4870
|
}>;
|
|
4875
|
-
|
|
4871
|
+
custom: () => VigorRetryPolicyAlgorithmsCustom<{
|
|
4876
4872
|
readonly __brand: VigorBrand<"Retry", "Policy<Algorithms<Custom<Schema">;
|
|
4877
4873
|
readonly _tag: "custom";
|
|
4878
4874
|
readonly jitter: 800;
|
|
@@ -4885,8 +4881,8 @@ declare const vigor: {
|
|
|
4885
4881
|
}>;
|
|
4886
4882
|
};
|
|
4887
4883
|
};
|
|
4888
|
-
|
|
4889
|
-
|
|
4884
|
+
parse: {
|
|
4885
|
+
settings: () => VigorParsePolicySettings<{
|
|
4890
4886
|
readonly __brand: VigorBrand<"Parse", "Schema">;
|
|
4891
4887
|
readonly policy: {
|
|
4892
4888
|
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
@@ -4956,7 +4952,7 @@ declare const vigor: {
|
|
|
4956
4952
|
};
|
|
4957
4953
|
};
|
|
4958
4954
|
}>;
|
|
4959
|
-
|
|
4955
|
+
middlewares: () => VigorParsePolicyMiddlewares<{
|
|
4960
4956
|
readonly __brand: VigorBrand<"Parse", "Schema">;
|
|
4961
4957
|
readonly policy: {
|
|
4962
4958
|
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
@@ -5026,7 +5022,7 @@ declare const vigor: {
|
|
|
5026
5022
|
};
|
|
5027
5023
|
};
|
|
5028
5024
|
}>;
|
|
5029
|
-
|
|
5025
|
+
strategies: () => VigorParsePolicyStrategies<{
|
|
5030
5026
|
readonly __brand: VigorBrand<"Parse", "Schema">;
|
|
5031
5027
|
readonly policy: {
|
|
5032
5028
|
readonly __brand: VigorBrand<"Parse", "Policy<Schema">;
|
|
@@ -5097,8 +5093,8 @@ declare const vigor: {
|
|
|
5097
5093
|
};
|
|
5098
5094
|
}>;
|
|
5099
5095
|
};
|
|
5100
|
-
|
|
5101
|
-
|
|
5096
|
+
all: {
|
|
5097
|
+
settings: () => VigorAllPolicySettings<{
|
|
5102
5098
|
readonly __brand: VigorBrand<"All", "Schema">;
|
|
5103
5099
|
readonly policy: {
|
|
5104
5100
|
readonly __brand: VigorBrand<"All", "Policy<Schema">;
|
|
@@ -5138,7 +5134,7 @@ declare const vigor: {
|
|
|
5138
5134
|
readonly record: {};
|
|
5139
5135
|
};
|
|
5140
5136
|
}>;
|
|
5141
|
-
|
|
5137
|
+
middlewares: () => VigorAllPolicyMiddlewares<{
|
|
5142
5138
|
readonly __brand: VigorBrand<"All", "Schema">;
|
|
5143
5139
|
readonly policy: {
|
|
5144
5140
|
readonly __brand: VigorBrand<"All", "Policy<Schema">;
|
|
@@ -5181,6 +5177,22 @@ declare const vigor: {
|
|
|
5181
5177
|
};
|
|
5182
5178
|
};
|
|
5183
5179
|
};
|
|
5180
|
+
type VigorInstance = typeof vigorBase & {
|
|
5181
|
+
use: <P extends VigorPlugin<any, any>>(plugin: P, options?: P["options"]) => VigorInstance & ReturnType<P["func"]>;
|
|
5182
|
+
};
|
|
5183
|
+
/**
|
|
5184
|
+
* A plugin never mutates the `VigorInstance` it receives — it reads from it
|
|
5185
|
+
* (e.g. to wrap an existing method) and returns `Ext`, the properties to
|
|
5186
|
+
* merge into a *new* instance. `use()` owns cloning/merging, so plugins stay
|
|
5187
|
+
* pure and `vigor` itself is never touched.
|
|
5188
|
+
*/
|
|
5189
|
+
type VigorPlugin<O extends {
|
|
5190
|
+
[str: string]: any;
|
|
5191
|
+
} = {}, Ext extends Record<string, any> = Record<string, any>> = {
|
|
5192
|
+
options: O;
|
|
5193
|
+
func: (v: VigorInstance, options: O) => Ext;
|
|
5194
|
+
};
|
|
5195
|
+
declare const vigor: VigorInstance;
|
|
5184
5196
|
|
|
5185
5197
|
type VigorErrorOptions<D, T> = {
|
|
5186
5198
|
cause?: unknown;
|
|
@@ -5317,5 +5329,4 @@ declare class VigorAllError<C extends VigorAllErrorCodes, T extends VigorAllSche
|
|
|
5317
5329
|
constructor(code: C, options: VigorErrorOptions<VigorAllErrorDatas<C>, T["context"]>);
|
|
5318
5330
|
}
|
|
5319
5331
|
|
|
5320
|
-
export { VigorAll, VigorAllBase, VigorAllError, VigorAllErrorMessageFuncs, VigorAllPolicyBase, VigorAllPolicyMiddlewares, VigorAllPolicyMiddlewaresBase, VigorAllPolicySettings, VigorAllPolicySettingsBase, VigorError, VigorFetch, VigorFetchBase, VigorFetchError, VigorFetchErrorMessageFuncs, VigorFetchPolicyBase, VigorFetchPolicyMiddlewares, VigorFetchPolicyMiddlewaresBase, VigorFetchPolicySettings, VigorFetchPolicySettingsBase, VigorJitter, VigorParse, VigorParseBase, VigorParseContentTypeStrategy, VigorParseError, VigorParseErrorMessageFuncs, VigorParsePolicyBase, VigorParsePolicyMiddlewares, VigorParsePolicyMiddlewaresBase, VigorParsePolicySettings, VigorParsePolicySettingsBase, VigorParsePolicyStrategies, VigorParsePolicyStrategiesBase, VigorParseSniffStrategy, VigorRetry, VigorRetryBase, VigorRetryError, VigorRetryErrorMessageFuncs, VigorRetryPolicyAlgorithms, VigorRetryPolicyAlgorithmsBackoff, VigorRetryPolicyAlgorithmsBackoffBase, VigorRetryPolicyAlgorithmsBase, VigorRetryPolicyAlgorithmsConstant, VigorRetryPolicyAlgorithmsConstantBase, VigorRetryPolicyAlgorithmsCustom, VigorRetryPolicyAlgorithmsCustomBase, VigorRetryPolicyAlgorithmsLinear, VigorRetryPolicyAlgorithmsLinearBase, VigorRetryPolicyBase, VigorRetryPolicyMiddlewares, VigorRetryPolicyMiddlewaresBase, VigorRetryPolicySettings, VigorRetryPolicySettingsBase, VigorStatus, vigor as default, vigor };
|
|
5321
|
-
export type { VigorAllEachMiddlewareFn, VigorAllEachOnErrorFn, VigorAllErrorCodes, VigorAllErrorDatas, VigorAllPolicyMiddlewaresSchema, VigorAllPolicySchema, VigorAllPolicySettingsSchema, VigorAllSchema, VigorAllTask, VigorBuiltin, VigorConcat, VigorDeepMerge, VigorDeepPartial, VigorErrorOptions, VigorFetchErrorCodes, VigorFetchErrorDatas, VigorFetchPolicyMiddlewaresApi, VigorFetchPolicyMiddlewaresFluent, VigorFetchPolicyMiddlewaresIntercept, VigorFetchPolicyMiddlewaresSchema, VigorFetchPolicySchema, VigorFetchPolicySettingsSchema, VigorFetchSchema, VigorLastOf, VigorMergeMode, VigorMergeStrategy, VigorParseErrorCodes, VigorParseErrorDatas, VigorParsePolicyMiddlewaresApi, VigorParsePolicyMiddlewaresFluent, VigorParsePolicyMiddlewaresIntercept, VigorParsePolicyMiddlewaresSchema, VigorParsePolicySchema, VigorParsePolicySettingsSchema, VigorParsePolicyStrategiesSchema, VigorParseSchema, VigorParseStrategyFunc, VigorPlugin, VigorPrimitive, VigorReplaceType, VigorRetryErrorCodes, VigorRetryErrorDatas, VigorRetryPipeInitialContext, VigorRetryPipeResult, VigorRetryPipeStepResult, VigorRetryPipeStepRetryIf, VigorRetryPipeStepVoid, VigorRetryPolicyAlgorithmsBackoffSchema, VigorRetryPolicyAlgorithmsConstantSchema, VigorRetryPolicyAlgorithmsCustomSchema, VigorRetryPolicyAlgorithmsLinearSchema, VigorRetryPolicyAlgorithmsSchema, VigorRetryPolicyMiddlewaresApi, VigorRetryPolicyMiddlewaresFluent, VigorRetryPolicyMiddlewaresIntercept, VigorRetryPolicyMiddlewaresPipe, VigorRetryPolicyMiddlewaresSchema, VigorRetryPolicySchema, VigorRetryPolicySettingsSchema, VigorRetrySchema, VigorReturnType, VigorSimplify, VigorStringable };
|
|
5332
|
+
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 };
|