vigor-fetch 3.1.6 → 3.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -435,7 +435,7 @@ type VigorFetchOptions<T = Record<string, any>> = {
|
|
|
435
435
|
type VigorStringable = string | number | boolean | null | undefined | Date;
|
|
436
436
|
type VigorFetchConfig = {
|
|
437
437
|
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "HEAD" | "OPTIONS" | "CONNECT" | "TRACE";
|
|
438
|
-
origin:
|
|
438
|
+
origin: string;
|
|
439
439
|
path: Array<string>;
|
|
440
440
|
query: Array<Record<string, VigorStringable | Array<VigorStringable>>>;
|
|
441
441
|
hash: string;
|
|
@@ -544,7 +544,7 @@ declare class VigorFetch extends VigorStatus<VigorFetchConfig, VigorFetch> {
|
|
|
544
544
|
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>;
|
|
545
545
|
protected _stringifyList(unkList: Array<VigorStringable>): Array<string>;
|
|
546
546
|
method(str: VigorFetchConfig["method"]): VigorFetch;
|
|
547
|
-
origin(
|
|
547
|
+
origin(str: VigorFetchConfig["origin"]): VigorFetch;
|
|
548
548
|
path(...strs: VigorIncludeSpread<VigorStringable>): VigorFetch;
|
|
549
549
|
query(...strs: VigorIncludeSpread<VigorFetchConfig["query"][number]>): VigorFetch;
|
|
550
550
|
hash(str: VigorFetchConfig["hash"]): VigorFetch;
|
|
@@ -780,7 +780,7 @@ declare const VigorEntry: {
|
|
|
780
780
|
};
|
|
781
781
|
declare const vigor: {
|
|
782
782
|
use: <C, R>(func: (entry: typeof VigorEntry, config: C) => R | Promise<R>, config: C) => Promise<R>;
|
|
783
|
-
fetch: (
|
|
783
|
+
fetch: (str: Parameters<VigorFetch["origin"]>[0]) => VigorFetch;
|
|
784
784
|
retry: (target: Parameters<VigorRetry["target"]>[0]) => VigorRetry;
|
|
785
785
|
parse: (response: Parameters<VigorParse["target"]>[0]) => VigorParse;
|
|
786
786
|
all: (...funcs: Parameters<VigorAll["target"]>[0][]) => VigorAll;
|
package/dist/index.js
CHANGED
|
@@ -917,7 +917,7 @@ class VigorFetchInterceptors extends VigorStatus {
|
|
|
917
917
|
class VigorFetch extends VigorStatus {
|
|
918
918
|
constructor(config) {
|
|
919
919
|
const base = {
|
|
920
|
-
origin:
|
|
920
|
+
origin: VigorDefault,
|
|
921
921
|
path: [],
|
|
922
922
|
query: [],
|
|
923
923
|
hash: "",
|
|
@@ -972,7 +972,7 @@ class VigorFetch extends VigorStatus {
|
|
|
972
972
|
});
|
|
973
973
|
}
|
|
974
974
|
method(str) { return this._next({ method: str }); }
|
|
975
|
-
origin(
|
|
975
|
+
origin(str) { return this._next({ origin: str }); }
|
|
976
976
|
path(...strs) { return this._next({ path: this._stringifyList(strs.flat()) }); }
|
|
977
977
|
query(...strs) { return this._next({ query: strs.flat() }); }
|
|
978
978
|
hash(str) { return this._next({ hash: str }); }
|
|
@@ -980,7 +980,7 @@ class VigorFetch extends VigorStatus {
|
|
|
980
980
|
headers(obj) { return this._next({ options: { headers: obj } }); }
|
|
981
981
|
body(obj) { return this._next({ options: { headers: this._config.options.headers, body: obj } }); }
|
|
982
982
|
_buildUrl(origin, path, query, hash) {
|
|
983
|
-
const originObj = new URL(origin
|
|
983
|
+
const originObj = new URL(origin);
|
|
984
984
|
const baseStr = originObj.origin;
|
|
985
985
|
const pathObj = [originObj.pathname.replace(/^\/+|\/+$/g, '')];
|
|
986
986
|
for (const str of path) {
|
|
@@ -1708,8 +1708,8 @@ const vigor = {
|
|
|
1708
1708
|
use: async (func, config) => {
|
|
1709
1709
|
return await func(VigorEntry, config);
|
|
1710
1710
|
},
|
|
1711
|
-
fetch: (
|
|
1712
|
-
return new VigorFetch().origin(
|
|
1711
|
+
fetch: (str) => {
|
|
1712
|
+
return new VigorFetch().origin(str);
|
|
1713
1713
|
},
|
|
1714
1714
|
retry: (target) => {
|
|
1715
1715
|
return new VigorRetry().target(target);
|
package/dist/index.mjs
CHANGED
|
@@ -913,7 +913,7 @@ class VigorFetchInterceptors extends VigorStatus {
|
|
|
913
913
|
class VigorFetch extends VigorStatus {
|
|
914
914
|
constructor(config) {
|
|
915
915
|
const base = {
|
|
916
|
-
origin:
|
|
916
|
+
origin: VigorDefault,
|
|
917
917
|
path: [],
|
|
918
918
|
query: [],
|
|
919
919
|
hash: "",
|
|
@@ -968,7 +968,7 @@ class VigorFetch extends VigorStatus {
|
|
|
968
968
|
});
|
|
969
969
|
}
|
|
970
970
|
method(str) { return this._next({ method: str }); }
|
|
971
|
-
origin(
|
|
971
|
+
origin(str) { return this._next({ origin: str }); }
|
|
972
972
|
path(...strs) { return this._next({ path: this._stringifyList(strs.flat()) }); }
|
|
973
973
|
query(...strs) { return this._next({ query: strs.flat() }); }
|
|
974
974
|
hash(str) { return this._next({ hash: str }); }
|
|
@@ -976,7 +976,7 @@ class VigorFetch extends VigorStatus {
|
|
|
976
976
|
headers(obj) { return this._next({ options: { headers: obj } }); }
|
|
977
977
|
body(obj) { return this._next({ options: { headers: this._config.options.headers, body: obj } }); }
|
|
978
978
|
_buildUrl(origin, path, query, hash) {
|
|
979
|
-
const originObj = new URL(origin
|
|
979
|
+
const originObj = new URL(origin);
|
|
980
980
|
const baseStr = originObj.origin;
|
|
981
981
|
const pathObj = [originObj.pathname.replace(/^\/+|\/+$/g, '')];
|
|
982
982
|
for (const str of path) {
|
|
@@ -1704,8 +1704,8 @@ const vigor = {
|
|
|
1704
1704
|
use: async (func, config) => {
|
|
1705
1705
|
return await func(VigorEntry, config);
|
|
1706
1706
|
},
|
|
1707
|
-
fetch: (
|
|
1708
|
-
return new VigorFetch().origin(
|
|
1707
|
+
fetch: (str) => {
|
|
1708
|
+
return new VigorFetch().origin(str);
|
|
1709
1709
|
},
|
|
1710
1710
|
retry: (target) => {
|
|
1711
1711
|
return new VigorRetry().target(target);
|