@fetchx/fetcher-factory 0.1.8 → 0.1.9
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/cjs/fetcher-setup.js +1 -1
- package/dist/esm/fetcher-setup.js +1 -1
- package/dist/esm/fetcher-setup.js.map +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/types/fetcher-setup.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +16 -16
|
@@ -12,7 +12,7 @@ var _fetcherInterceptorLogin = _interopRequireDefault(require("@fetchx/fetcher-i
|
|
|
12
12
|
/**
|
|
13
13
|
* 允许对 Fetcher 进行设置,有些拦截器需要考虑多环境,可能根据业务不同而不同,
|
|
14
14
|
* 有些则是在初始化时不方便设置(比如登录有可能造成循环依赖),通常此操作在
|
|
15
|
-
*
|
|
15
|
+
* 应用启动时进行,且默认只允许执行一次,因此执行完会默认封禁拦截器扩展。
|
|
16
16
|
*/
|
|
17
17
|
function fetcherSetup(fetcher, _ref) {
|
|
18
18
|
var adapter = _ref.adapter,
|
|
@@ -5,7 +5,7 @@ import interceptLogin from '@fetchx/fetcher-interceptor-login';
|
|
|
5
5
|
/**
|
|
6
6
|
* 允许对 Fetcher 进行设置,有些拦截器需要考虑多环境,可能根据业务不同而不同,
|
|
7
7
|
* 有些则是在初始化时不方便设置(比如登录有可能造成循环依赖),通常此操作在
|
|
8
|
-
*
|
|
8
|
+
* 应用启动时进行,且默认只允许执行一次,因此执行完会默认封禁拦截器扩展。
|
|
9
9
|
*/
|
|
10
10
|
export default function fetcherSetup(fetcher, _ref) {
|
|
11
11
|
var adapter = _ref.adapter,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetcher-setup.js","names":["interceptHeaders","interceptMerging","interceptSls","interceptLogin","fetcherSetup","fetcher","_ref","adapter","urlBase","getHeaders","interceptorMergingOptions","interceptorSlsOptions","interceptorLoginOptions","freeze","arguments","length","undefined","setAdapter","setUrlBase"],"sources":["../../src/fetcher-setup.ts"],"sourcesContent":["import {\n Fetcher\n} from '@fetchx/fetcher-core';\nimport interceptHeaders from '@fetchx/fetcher-interceptor-headers';\nimport interceptMerging from '@fetchx/fetcher-interceptor-merging';\nimport interceptSls from '@fetchx/fetcher-interceptor-sls';\nimport interceptLogin from '@fetchx/fetcher-interceptor-login';\n\nimport {\n IFetcherFactoryOptions\n} from './types';\n\n/**\n * 允许对 Fetcher 进行设置,有些拦截器需要考虑多环境,可能根据业务不同而不同,\n * 有些则是在初始化时不方便设置(比如登录有可能造成循环依赖),通常此操作在\n *
|
|
1
|
+
{"version":3,"file":"fetcher-setup.js","names":["interceptHeaders","interceptMerging","interceptSls","interceptLogin","fetcherSetup","fetcher","_ref","adapter","urlBase","getHeaders","interceptorMergingOptions","interceptorSlsOptions","interceptorLoginOptions","freeze","arguments","length","undefined","setAdapter","setUrlBase"],"sources":["../../src/fetcher-setup.ts"],"sourcesContent":["import {\n Fetcher\n} from '@fetchx/fetcher-core';\nimport interceptHeaders from '@fetchx/fetcher-interceptor-headers';\nimport interceptMerging from '@fetchx/fetcher-interceptor-merging';\nimport interceptSls from '@fetchx/fetcher-interceptor-sls';\nimport interceptLogin from '@fetchx/fetcher-interceptor-login';\n\nimport {\n IFetcherFactoryOptions\n} from './types';\n\n/**\n * 允许对 Fetcher 进行设置,有些拦截器需要考虑多环境,可能根据业务不同而不同,\n * 有些则是在初始化时不方便设置(比如登录有可能造成循环依赖),通常此操作在\n * 应用启动时进行,且默认只允许执行一次,因此执行完会默认封禁拦截器扩展。\n */\nexport default function fetcherSetup(fetcher: Fetcher, {\n adapter,\n urlBase,\n getHeaders,\n interceptorMergingOptions,\n interceptorSlsOptions,\n interceptorLoginOptions\n}: Omit<IFetcherFactoryOptions, 'interceptorBizOptions'>, freeze = true): void {\n if (adapter) {\n fetcher.setAdapter(adapter);\n }\n \n if (urlBase) {\n fetcher.setUrlBase(urlBase);\n }\n \n if (getHeaders) {\n interceptHeaders(fetcher, getHeaders);\n }\n \n if (interceptorMergingOptions) { // FIXME 跟 interceptor-login 冲突,启用需谨慎\n interceptMerging(fetcher);\n }\n\n if (interceptorSlsOptions) {\n interceptSls(fetcher, interceptorSlsOptions);\n }\n \n if (interceptorLoginOptions) {\n interceptLogin(fetcher, interceptorLoginOptions);\n }\n \n if (freeze) {\n fetcher.freeze(); // 不要多次 setup\n }\n}\n"],"mappings":"AAGA,OAAOA,gBAAgB,MAAM,qCAAqC;AAClE,OAAOC,gBAAgB,MAAM,qCAAqC;AAClE,OAAOC,YAAY,MAAM,iCAAiC;AAC1D,OAAOC,cAAc,MAAM,mCAAmC;AAM9D;AACA;AACA;AACA;AACA;AACA,eAAe,SAASC,YAAYA,CAACC,OAAgB,EAAAC,IAAA,EAO0B;EAAA,IAN7EC,OAAO,GAAAD,IAAA,CAAPC,OAAO;IACPC,OAAO,GAAAF,IAAA,CAAPE,OAAO;IACPC,UAAU,GAAAH,IAAA,CAAVG,UAAU;IACVC,yBAAyB,GAAAJ,IAAA,CAAzBI,yBAAyB;IACzBC,qBAAqB,GAAAL,IAAA,CAArBK,qBAAqB;IACrBC,uBAAuB,GAAAN,IAAA,CAAvBM,uBAAuB;EAAA,IACiCC,MAAM,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAE,SAAA,GAAAF,SAAA,MAAG,IAAI;EACrE,IAAIP,OAAO,EAAE;IACXF,OAAO,CAACY,UAAU,CAACV,OAAO,CAAC;EAC7B;EAEA,IAAIC,OAAO,EAAE;IACXH,OAAO,CAACa,UAAU,CAACV,OAAO,CAAC;EAC7B;EAEA,IAAIC,UAAU,EAAE;IACdT,gBAAgB,CAACK,OAAO,EAAEI,UAAU,CAAC;EACvC;EAEA,IAAIC,yBAAyB,EAAE;IAAE;IAC/BT,gBAAgB,CAACI,OAAO,CAAC;EAC3B;EAEA,IAAIM,qBAAqB,EAAE;IACzBT,YAAY,CAACG,OAAO,EAAEM,qBAAqB,CAAC;EAC9C;EAEA,IAAIC,uBAAuB,EAAE;IAC3BT,cAAc,CAACE,OAAO,EAAEO,uBAAuB,CAAC;EAClD;EAEA,IAAIC,MAAM,EAAE;IACVR,OAAO,CAACQ,MAAM,CAAC,CAAC,CAAC,CAAC;EACpB;AACF","ignoreList":[]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default } from './fetcher-factory';
|
|
2
2
|
export { default as fetcherSetup } from './fetcher-setup';
|
|
3
|
-
export * from '@fetchx/fetcher-core'; // eslint-disable-line import/export
|
|
3
|
+
export * from '@fetchx/fetcher-core'; // eslint-disable-line import-x/export
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["default","fetcherSetup"],"sources":["../../src/index.ts"],"sourcesContent":["export { default } from './fetcher-factory';\nexport { default as fetcherSetup } from './fetcher-setup';\n\nexport * from '@fetchx/fetcher-core'; // eslint-disable-line import/export\n\nexport type {\n FetcherInterceptorBizOptions\n} from '@fetchx/fetcher-interceptor-biz';\nexport type {\n FetcherInterceptorSlsOptions\n} from '@fetchx/fetcher-interceptor-sls';\nexport type {\n FetcherInterceptorLoginOptions\n} from '@fetchx/fetcher-interceptor-login';\n\nexport type {\n TFetcher as Fetcher, // eslint-disable-line import/export\n IFetcherConfigAugmented as FetcherConfig, // eslint-disable-line import/export\n IFetcherFactoryOptions as FetcherFactoryOptions\n} from './types';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,mBAAmB;AAC3C,SAASA,OAAO,IAAIC,YAAY,QAAQ,iBAAiB;AAEzD,cAAc,sBAAsB,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","fetcherSetup"],"sources":["../../src/index.ts"],"sourcesContent":["export { default } from './fetcher-factory';\nexport { default as fetcherSetup } from './fetcher-setup';\n\nexport * from '@fetchx/fetcher-core'; // eslint-disable-line import-x/export\n\nexport type {\n FetcherInterceptorBizOptions\n} from '@fetchx/fetcher-interceptor-biz';\nexport type {\n FetcherInterceptorSlsOptions\n} from '@fetchx/fetcher-interceptor-sls';\nexport type {\n FetcherInterceptorLoginOptions\n} from '@fetchx/fetcher-interceptor-login';\n\nexport type {\n TFetcher as Fetcher, // eslint-disable-line import-x/export\n IFetcherConfigAugmented as FetcherConfig, // eslint-disable-line import-x/export\n IFetcherFactoryOptions as FetcherFactoryOptions\n} from './types';\n"],"mappings":"AAAA,SAASA,OAAO,QAAQ,mBAAmB;AAC3C,SAASA,OAAO,IAAIC,YAAY,QAAQ,iBAAiB;AAEzD,cAAc,sBAAsB,CAAC,CAAC","ignoreList":[]}
|
|
@@ -3,6 +3,6 @@ import { IFetcherFactoryOptions } from './types';
|
|
|
3
3
|
/**
|
|
4
4
|
* 允许对 Fetcher 进行设置,有些拦截器需要考虑多环境,可能根据业务不同而不同,
|
|
5
5
|
* 有些则是在初始化时不方便设置(比如登录有可能造成循环依赖),通常此操作在
|
|
6
|
-
*
|
|
6
|
+
* 应用启动时进行,且默认只允许执行一次,因此执行完会默认封禁拦截器扩展。
|
|
7
7
|
*/
|
|
8
8
|
export default function fetcherSetup(fetcher: Fetcher, { adapter, urlBase, getHeaders, interceptorMergingOptions, interceptorSlsOptions, interceptorLoginOptions }: Omit<IFetcherFactoryOptions, 'interceptorBizOptions'>, freeze?: boolean): void;
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,6 +4,6 @@ export * from '@fetchx/fetcher-core';
|
|
|
4
4
|
export type { FetcherInterceptorBizOptions } from '@fetchx/fetcher-interceptor-biz';
|
|
5
5
|
export type { FetcherInterceptorSlsOptions } from '@fetchx/fetcher-interceptor-sls';
|
|
6
6
|
export type { FetcherInterceptorLoginOptions } from '@fetchx/fetcher-interceptor-login';
|
|
7
|
-
export type { TFetcher as Fetcher, // eslint-disable-line import/export
|
|
8
|
-
IFetcherConfigAugmented as FetcherConfig, // eslint-disable-line import/export
|
|
7
|
+
export type { TFetcher as Fetcher, // eslint-disable-line import-x/export
|
|
8
|
+
IFetcherConfigAugmented as FetcherConfig, // eslint-disable-line import-x/export
|
|
9
9
|
IFetcherFactoryOptions as FetcherFactoryOptions } from './types';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fetchx/fetcher-factory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "Fetcher factory to create custom fetcher with ease.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
"@babel/preset-env": "^7.29.7",
|
|
29
29
|
"@babel/preset-typescript": "^7.29.7",
|
|
30
30
|
"@chromatic-com/storybook": "^5.6.0",
|
|
31
|
-
"@kcuf/demo-rc": "^0.7.
|
|
31
|
+
"@kcuf/demo-rc": "^0.7.3",
|
|
32
32
|
"@kcuf/ts-config": "^0.2.0",
|
|
33
|
-
"@storybook/addon-docs": "^10.6.
|
|
34
|
-
"@storybook/addon-links": "^10.6.
|
|
35
|
-
"@storybook/react-vite": "^10.6.
|
|
33
|
+
"@storybook/addon-docs": "^10.6.7",
|
|
34
|
+
"@storybook/addon-links": "^10.6.7",
|
|
35
|
+
"@storybook/react-vite": "^10.6.7",
|
|
36
36
|
"@types/react": "^19.3.0",
|
|
37
37
|
"react": "^19.3.1",
|
|
38
38
|
"rimraf": "^6.1.4",
|
|
39
|
-
"storybook": "^10.6.
|
|
39
|
+
"storybook": "^10.6.7",
|
|
40
40
|
"styled-components": "^6.6.0",
|
|
41
41
|
"typescript": "^6.0.3"
|
|
42
42
|
},
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"@babel/runtime": ">=7.0.0"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@fetchx/fetcher-adapter-web": "^0.1.
|
|
48
|
-
"@fetchx/fetcher-core": "^0.1.
|
|
49
|
-
"@fetchx/fetcher-helper": "^0.1.
|
|
50
|
-
"@fetchx/fetcher-interceptor-biz": "^0.1.
|
|
51
|
-
"@fetchx/fetcher-interceptor-cache-local": "^0.1.
|
|
52
|
-
"@fetchx/fetcher-interceptor-headers": "^0.1.
|
|
53
|
-
"@fetchx/fetcher-interceptor-login": "^0.1.
|
|
54
|
-
"@fetchx/fetcher-interceptor-merging": "^0.1.
|
|
55
|
-
"@fetchx/fetcher-interceptor-sls": "^0.1.
|
|
47
|
+
"@fetchx/fetcher-adapter-web": "^0.1.9",
|
|
48
|
+
"@fetchx/fetcher-core": "^0.1.9",
|
|
49
|
+
"@fetchx/fetcher-helper": "^0.1.4",
|
|
50
|
+
"@fetchx/fetcher-interceptor-biz": "^0.1.9",
|
|
51
|
+
"@fetchx/fetcher-interceptor-cache-local": "^0.1.9",
|
|
52
|
+
"@fetchx/fetcher-interceptor-headers": "^0.1.9",
|
|
53
|
+
"@fetchx/fetcher-interceptor-login": "^0.1.9",
|
|
54
|
+
"@fetchx/fetcher-interceptor-merging": "^0.1.9",
|
|
55
|
+
"@fetchx/fetcher-interceptor-sls": "^0.1.9"
|
|
56
56
|
},
|
|
57
57
|
"scripts": {
|
|
58
58
|
"start": "storybook dev -p 6006",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
"watch": "pnpm build:esm -w",
|
|
66
66
|
"prepublishOnly": "pnpm build:clean && pnpm build"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "fc34b2f22a5347d1b075ba4aa9b65f605371bb7e"
|
|
69
69
|
}
|