vigor-fetch 3.1.3 → 3.1.4
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 +43 -18
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -260,9 +260,14 @@ type VigorRetryTimeline<I extends keyof VigorRetryInterceptorsFunctions, H exten
|
|
|
260
260
|
};
|
|
261
261
|
declare class VigorRetry extends VigorStatus<VigorRetryConfig, VigorRetry> {
|
|
262
262
|
constructor(config?: Partial<VigorRetryConfig>);
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
protected readonly RetryAlgorithms: {
|
|
264
|
+
constant: (config?: Partial<VigorRetryAlgorithmsConstantConfig>) => VigorRetryAlgorithmsConstant;
|
|
265
|
+
linear: (config?: Partial<VigorRetryAlgorithmsLinearConfig>) => VigorRetryAlgorithmsLinear;
|
|
266
|
+
backoff: (config?: Partial<VigorRetryAlgorithmsBackoffConfig>) => VigorRetryAlgorithmsBackoff;
|
|
267
|
+
custom: (config?: Partial<VigorRetryAlgorithmsCustomConfig>) => VigorRetryAlgorithmsCustom;
|
|
268
|
+
};
|
|
269
|
+
protected _createTimelineHandler(timeline: VigorRetryContext["timeline"]): <I extends keyof VigorRetryInterceptorsFunctions, H extends keyof VigorRetryProcessHandler, K extends keyof VigorRetryTimeline<I, H>>(action: K, content: VigorRetryTimeline<I, H>[K]) => void;
|
|
270
|
+
protected _createInterceptorHandler(ctx: VigorRetryContext, addTimeline: ReturnType<typeof this._createTimelineHandler>): <I extends keyof VigorRetryInterceptorsFunctions>(interceptorType: I, api: (interceptorType: I, func: VigorRetryInterceptorsFunctions[I]) => Pick<VigorRetryInterceptorsApi<any>, VigorRetryAllowedApis<I>>) => Promise<void>;
|
|
266
271
|
target(func: VigorRetryConfig["target"]): VigorRetry;
|
|
267
272
|
settings(func: ((s: VigorRetrySettings) => VigorRetrySettings) | VigorRetrySettings | VigorRetrySettings["_config"]): VigorRetry;
|
|
268
273
|
interceptors(func: ((i: VigorRetryInterceptors) => VigorRetryInterceptors) | VigorRetryInterceptors | VigorRetryInterceptors["_config"]): VigorRetry;
|
|
@@ -286,9 +291,19 @@ type VigorParseStrategiesConfig = {
|
|
|
286
291
|
};
|
|
287
292
|
declare class VigorParseStrategies extends VigorStatus<VigorParseStrategiesConfig, VigorParseStrategies> {
|
|
288
293
|
constructor(config?: Partial<VigorParseStrategiesConfig>);
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
294
|
+
protected readonly ParseAutoHeaders: {
|
|
295
|
+
header: string;
|
|
296
|
+
regExp: RegExp;
|
|
297
|
+
method: (res: Response) => Promise<any>;
|
|
298
|
+
}[];
|
|
299
|
+
protected readonly ParseAutoMethods: {
|
|
300
|
+
title: string;
|
|
301
|
+
method: (res: Response) => Promise<any>;
|
|
302
|
+
}[];
|
|
303
|
+
protected readonly ParseAutoAlgorithms: {
|
|
304
|
+
contentType: (response: Response) => Promise<any>;
|
|
305
|
+
sniff: (response: Response) => Promise<any>;
|
|
306
|
+
};
|
|
292
307
|
contentType(): VigorParseStrategies;
|
|
293
308
|
sniff(): VigorParseStrategies;
|
|
294
309
|
json(): VigorParseStrategies;
|
|
@@ -377,8 +392,8 @@ type VigorParseTimeline<I extends keyof VigorParseInterceptorsFunctions, H exten
|
|
|
377
392
|
};
|
|
378
393
|
declare class VigorParse extends VigorStatus<VigorParseConfig, VigorParse> {
|
|
379
394
|
constructor(config?: Partial<VigorParseConfig>);
|
|
380
|
-
|
|
381
|
-
|
|
395
|
+
protected _createTimelineHandler(timeline: VigorParseContext["timeline"]): <I extends keyof VigorParseInterceptorsFunctions, H extends keyof VigorParseProcessHandler, K extends keyof VigorParseTimeline<I, H>>(action: K, content: VigorParseTimeline<I, H>[K]) => void;
|
|
396
|
+
protected _createInterceptorHandler(ctx: VigorParseContext, addTimeline: ReturnType<typeof this._createTimelineHandler>): <I extends keyof VigorParseInterceptorsFunctions>(interceptorType: I, api: (interceptorType: I, func: VigorParseInterceptorsFunctions[I]) => Pick<VigorParseInterceptorsApi<any>, VigorParseAllowedApis<I>>) => Promise<void>;
|
|
382
397
|
target(response: VigorParseConfig["target"]): VigorParse;
|
|
383
398
|
settings(func: ((i: VigorParseSettings) => VigorParseSettings) | VigorParseSettings | VigorParseSettings["_config"]): VigorParse;
|
|
384
399
|
strategies(func: ((i: VigorParseStrategies) => VigorParseStrategies) | VigorParseStrategies | VigorParseStrategies["_config"]): VigorParse;
|
|
@@ -521,9 +536,9 @@ type VigorFetchTimeline<I extends keyof VigorFetchInterceptorsFunctions, H exten
|
|
|
521
536
|
};
|
|
522
537
|
declare class VigorFetch extends VigorStatus<VigorFetchConfig, VigorFetch> {
|
|
523
538
|
constructor(config?: Partial<VigorFetchConfig>);
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
539
|
+
protected _createTimelineHandler(timeline: VigorFetchContext["timeline"]): <I extends keyof VigorFetchInterceptorsFunctions, H extends keyof VigorFetchProcessHandler, K extends keyof VigorFetchTimeline<I, H>>(action: K, content: VigorFetchTimeline<I, H>[K]) => void;
|
|
540
|
+
protected _createInterceptorHandler(ctx: VigorFetchContext, addTimeline: ReturnType<typeof this._createTimelineHandler>): <I extends keyof VigorFetchInterceptorsFunctions>(interceptorType: I, api: (interceptorType: I, func: VigorFetchInterceptorsFunctions[I]) => Pick<VigorFetchInterceptorsApi<any>, VigorFetchAllowedApis<I>>) => Promise<void>;
|
|
541
|
+
protected _stringifyList(unkList: Array<VigorStringable>): Array<string>;
|
|
527
542
|
method(str: VigorFetchConfig["method"]): VigorFetch;
|
|
528
543
|
origin(...strs: VigorIncludeSpread<VigorStringable>): VigorFetch;
|
|
529
544
|
path(...strs: VigorIncludeSpread<VigorStringable>): VigorFetch;
|
|
@@ -532,8 +547,12 @@ declare class VigorFetch extends VigorStatus<VigorFetchConfig, VigorFetch> {
|
|
|
532
547
|
options(obj: VigorFetchConfig["options"]): VigorFetch;
|
|
533
548
|
headers(obj: VigorFetchConfig["options"]["headers"]): VigorFetch;
|
|
534
549
|
body(obj: VigorFetchConfig["options"]["body"]): VigorFetch;
|
|
535
|
-
|
|
536
|
-
|
|
550
|
+
protected _buildUrl(origin: VigorFetchConfig["origin"], path: VigorFetchConfig["path"], query: VigorFetchConfig["query"], hash: VigorFetchConfig["hash"]): string;
|
|
551
|
+
protected _normalizeOptions(body: unknown): {
|
|
552
|
+
isJson: boolean;
|
|
553
|
+
headers: Record<string, unknown>;
|
|
554
|
+
body: BodyInit | null | undefined;
|
|
555
|
+
};
|
|
537
556
|
settings(func: ((s: VigorFetchSettings) => VigorFetchSettings) | VigorFetchSettings | VigorFetchSettings["_config"]): VigorFetch;
|
|
538
557
|
interceptors(func: ((s: VigorFetchInterceptors) => VigorFetchInterceptors) | VigorFetchInterceptors | VigorFetchInterceptors["_config"]): VigorFetch;
|
|
539
558
|
retryConfig(func: ((s: VigorRetry) => VigorRetry) | VigorRetry | VigorRetry["_config"]): VigorFetch;
|
|
@@ -706,14 +725,20 @@ type VigorAllEachTimeline<I extends keyof VigorAllEachInterceptorsFunctions, H e
|
|
|
706
725
|
};
|
|
707
726
|
declare class VigorAll extends VigorStatus<VigorAllConfig, VigorAll> {
|
|
708
727
|
constructor(config?: Partial<VigorAllConfig>);
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
728
|
+
protected _createTimelineHandler(timeline: VigorAllContext["timeline"]): <I extends keyof VigorAllInterceptorsFunctions, H extends keyof VigorAllProcessHandler, K extends keyof VigorAllTimeline<I, H>>(action: K, content: VigorAllTimeline<I, H>[K]) => void;
|
|
729
|
+
protected _createInterceptorHandler(ctx: VigorAllContext, addTimeline: ReturnType<typeof this._createTimelineHandler>): <I extends keyof VigorAllInterceptorsFunctions>(interceptorType: I, api: (interceptorType: I, func: VigorAllInterceptorsFunctions[I]) => Pick<VigorAllInterceptorsApi<any>, VigorAllAllowedApis<I>>) => Promise<void>;
|
|
730
|
+
protected _createEachTimelineHandler(timeline: VigorAllEachContext["timeline"]): <I extends keyof VigorAllEachInterceptorsFunctions, H extends keyof VigorAllEachProcessHandler, K extends keyof VigorAllEachTimeline<I, H>>(action: K, content: VigorAllEachTimeline<I, H>[K]) => void;
|
|
731
|
+
protected _createEachInterceptorHandler(ctx: VigorAllEachContext, addEachTimeline: ReturnType<typeof this._createEachTimelineHandler>): <I extends keyof VigorAllEachInterceptorsFunctions>(interceptorType: I, api: (interceptorType: I, func: VigorAllEachInterceptorsFunctions[I]) => Pick<VigorAllEachInterceptorsApi<any>, VigorAllEachAllowedApis<I>>) => Promise<void>;
|
|
713
732
|
target(...funcs: VigorIncludeSpread<VigorAllConfig["target"][number]>): VigorAll;
|
|
714
733
|
settings(func: ((s: VigorAllSettings) => VigorAllSettings) | VigorAllSettings | VigorAllSettings["_config"]): VigorAll;
|
|
715
734
|
interceptors(func: ((s: VigorAllInterceptors) => VigorAllInterceptors) | VigorAllInterceptors | VigorAllInterceptors["_config"]): VigorAll;
|
|
716
|
-
|
|
735
|
+
protected runTask(task: VigorAllEachContext["target"], { stats, root }: {
|
|
736
|
+
stats: VigorAllEachContext["stats"];
|
|
737
|
+
root: VigorAllEachContext["root"];
|
|
738
|
+
}, semaphore: {
|
|
739
|
+
acquire: VigorAllEachContext["semaphore"]["acquire"];
|
|
740
|
+
release: VigorAllEachContext["semaphore"]["release"];
|
|
741
|
+
}): Promise<unknown>;
|
|
717
742
|
request<R extends VigorAllContext["result"]>(config?: VigorAllConfig, timeline?: VigorAllContext["timeline"]): Promise<R>;
|
|
718
743
|
}
|
|
719
744
|
declare const VigorEntry: {
|