zova-module-a-fetch 5.1.25 → 5.1.27
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/.metadata/index.d.ts +9 -9
- package/dist/.metadata/index.d.ts.map +1 -1
- package/dist/.metadata/this.d.ts +1 -1
- package/dist/bean/bean.fetch.d.ts +1 -1
- package/dist/bean/bean.interceptorBase.d.ts +2 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +19 -6
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +2 -2
- package/dist/lib/interceptor.d.ts +1 -1
- package/dist/service/composer.d.ts +3 -3
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interceptor.d.ts +1 -1
- package/package.json +2 -2
- package/src/.metadata/index.ts +9 -9
- package/src/.metadata/this.ts +1 -1
- package/src/bean/bean.fetch.ts +2 -2
- package/src/bean/bean.interceptorBase.ts +2 -2
- package/src/index.ts +3 -3
- package/src/lib/index.ts +2 -2
- package/src/lib/interceptor.ts +1 -1
- package/src/monkey.ts +1 -1
- package/src/service/composer.ts +2 -2
- package/src/types/index.ts +1 -1
- package/src/types/interceptor.ts +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** bean: begin */
|
|
2
|
-
export * from '../bean/bean.fetch.
|
|
3
|
-
export * from '../bean/bean.interceptorBase.
|
|
2
|
+
export * from '../bean/bean.fetch.ts';
|
|
3
|
+
export * from '../bean/bean.interceptorBase.ts';
|
|
4
4
|
import 'zova';
|
|
5
5
|
declare module 'zova' {
|
|
6
6
|
}
|
|
@@ -14,8 +14,8 @@ declare module 'zova-module-a-fetch' {
|
|
|
14
14
|
}
|
|
15
15
|
/** bean: end */
|
|
16
16
|
/** bean: begin */
|
|
17
|
-
import { BeanFetch } from '../bean/bean.fetch.
|
|
18
|
-
import { BeanInterceptorBase } from '../bean/bean.interceptorBase.
|
|
17
|
+
import type { BeanFetch } from '../bean/bean.fetch.ts';
|
|
18
|
+
import type { BeanInterceptorBase } from '../bean/bean.interceptorBase.ts';
|
|
19
19
|
import 'zova';
|
|
20
20
|
declare module 'zova' {
|
|
21
21
|
interface IBeanRecordGeneral {
|
|
@@ -25,7 +25,7 @@ declare module 'zova' {
|
|
|
25
25
|
}
|
|
26
26
|
/** bean: end */
|
|
27
27
|
/** service: begin */
|
|
28
|
-
export * from '../service/composer.
|
|
28
|
+
export * from '../service/composer.ts';
|
|
29
29
|
import 'zova-module-a-bean';
|
|
30
30
|
declare module 'zova-module-a-bean' {
|
|
31
31
|
interface IServiceRecord {
|
|
@@ -42,7 +42,7 @@ declare module 'zova-module-a-fetch' {
|
|
|
42
42
|
}
|
|
43
43
|
/** service: end */
|
|
44
44
|
/** service: begin */
|
|
45
|
-
import { ServiceComposer } from '../service/composer.
|
|
45
|
+
import type { ServiceComposer } from '../service/composer.ts';
|
|
46
46
|
import 'zova';
|
|
47
47
|
declare module 'zova' {
|
|
48
48
|
interface IBeanRecordGeneral {
|
|
@@ -51,11 +51,11 @@ declare module 'zova' {
|
|
|
51
51
|
}
|
|
52
52
|
/** service: end */
|
|
53
53
|
/** config: begin */
|
|
54
|
-
export * from '../config/config.
|
|
55
|
-
import { config } from '../config/config.
|
|
54
|
+
export * from '../config/config.ts';
|
|
55
|
+
import { config } from '../config/config.ts';
|
|
56
56
|
/** config: end */
|
|
57
57
|
/** monkey: begin */
|
|
58
|
-
export * from '../monkey.
|
|
58
|
+
export * from '../monkey.ts';
|
|
59
59
|
/** monkey: end */
|
|
60
60
|
/** scope: begin */
|
|
61
61
|
import { BeanScopeBase, type BeanScopeUtil, TypeModuleConfig } from 'zova';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/.metadata/index.ts"],"names":[],"mappings":"AACA,kBAAkB;AAClB,cAAc,uBAAuB,CAAC;AACtC,cAAc,iCAAiC,CAAC;AAEhD,OAAO,MAAM,CAAC;AACd,OAAO,QAAQ,MAAM,CAAC;CAGr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AI,UAAU,IAAI,kBAAkB,CAAC;KAEtC;CACR;AACD,mBAAmB;AACnB,qBAAqB;AACrB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,MAAM,CAAC;AACd,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAiB,kBAAkB;QACjC,0BAA0B,EAAE,eAAe,CAAC;KAC7C;CACF;AACD,mBAAmB;AACnB,oBAAoB;AACpB,cAAc,qBAAqB,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,kBAAkB;AAClB,oBAAoB;AACpB,cAAc,cAAc,CAAC;AAC7B,kBAAkB;AAClB,mBAAmB;AACnB,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,gBAAgB,EAAE,MAAM,MAAM,CAAC;AAG3E,qBACa,iBAAkB,SAAQ,aAAa;CAAG;AAEvD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,aAAa,CAAC;IACtB,MAAM,EAAE,gBAAgB,CAAC,OAAO,MAAM,CAAC,CAAC;CACvC;AAED,OAAO,MAAM,CAAC;AACd,OAAO,QAAQ,MAAM,CAAC;IACpB,UAAiB,gBAAgB;QAC/B,SAAS,EAAE,iBAAiB,CAAC;KAC9B;IAED,UAAiB,gBAAgB;QAC/B,SAAS,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;KACtC;CAKF;AAED,iBAAiB"}
|
package/dist/.metadata/this.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AxiosInstance } from 'axios';
|
|
2
2
|
import { BeanBase } from 'zova';
|
|
3
|
-
import type { IBeanFetchOptions } from '../types/interceptor.
|
|
3
|
+
import type { IBeanFetchOptions } from '../types/interceptor.ts';
|
|
4
4
|
declare const SymbolFetch: unique symbol;
|
|
5
5
|
export interface BeanFetch extends AxiosInstance {
|
|
6
6
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BeanBase } from 'zova';
|
|
2
|
-
import type { IDecoratorInterceptorOptions } from '../types/interceptor.
|
|
3
|
-
import type { BeanFetch } from './bean.fetch.
|
|
2
|
+
import type { IDecoratorInterceptorOptions } from '../types/interceptor.ts';
|
|
3
|
+
import type { BeanFetch } from './bean.fetch.ts';
|
|
4
4
|
export declare class BeanInterceptorBase<T extends IDecoratorInterceptorOptions = IDecoratorInterceptorOptions> extends BeanBase {
|
|
5
5
|
protected $beanFetch: BeanFetch;
|
|
6
6
|
protected $options: T;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './.metadata/index.
|
|
2
|
-
export * from './lib/index.
|
|
3
|
-
export * from './types/index.
|
|
1
|
+
export * from './.metadata/index.ts';
|
|
2
|
+
export * from './lib/index.ts';
|
|
3
|
+
export * from './types/index.ts';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,13 @@ import axios, { Axios } from "axios";
|
|
|
3
3
|
import { markRaw } from "vue";
|
|
4
4
|
import { Bean, Scope, Service } from "zova-module-a-bean";
|
|
5
5
|
//#region src/service/composer.ts
|
|
6
|
-
var _dec$3
|
|
6
|
+
var _dec$3;
|
|
7
|
+
var _dec2$3;
|
|
8
|
+
var _dec3$1;
|
|
9
|
+
var _dec4$1;
|
|
10
|
+
var _class$3;
|
|
11
|
+
var _class2;
|
|
12
|
+
var _descriptor;
|
|
7
13
|
function _initializerDefineProperty(e, i, r, l) {
|
|
8
14
|
r && Object.defineProperty(e, i, {
|
|
9
15
|
enumerable: r.enumerable,
|
|
@@ -101,7 +107,9 @@ var ServiceComposer = (_dec$3 = Service(), _dec2$3 = BeanInfo({ module: "a-fetch
|
|
|
101
107
|
}), _class2)) || _class$3) || _class$3);
|
|
102
108
|
//#endregion
|
|
103
109
|
//#region src/bean/bean.fetch.ts
|
|
104
|
-
var _dec$2
|
|
110
|
+
var _dec$2;
|
|
111
|
+
var _dec2$2;
|
|
112
|
+
var _class$2;
|
|
105
113
|
var SymbolFetch = Symbol("SymbolFetch");
|
|
106
114
|
var BeanFetch$1 = (_dec$2 = Bean(), _dec2$2 = BeanInfo({ module: "a-fetch" }), _dec$2(_class$2 = _dec2$2(_class$2 = class BeanFetch extends BeanBase {
|
|
107
115
|
constructor(...args) {
|
|
@@ -151,7 +159,12 @@ function patchAxios(_Axios) {
|
|
|
151
159
|
}
|
|
152
160
|
//#endregion
|
|
153
161
|
//#region src/bean/bean.interceptorBase.ts
|
|
154
|
-
var _dec$1
|
|
162
|
+
var _dec$1;
|
|
163
|
+
var _dec2$1;
|
|
164
|
+
var _dec3;
|
|
165
|
+
var _dec4;
|
|
166
|
+
var _dec5;
|
|
167
|
+
var _class$1;
|
|
155
168
|
var BeanInterceptorBase = (_dec$1 = Bean(), _dec2$1 = Virtual(), _dec3 = BeanInfo({ module: "a-fetch" }), _dec4 = Reflect.metadata("design:type", Function), _dec5 = Reflect.metadata("design:paramtypes", [typeof BeanFetch === "undefined" ? Object : BeanFetch, typeof T === "undefined" ? Object : T]), _dec$1(_class$1 = _dec2$1(_class$1 = _dec3(_class$1 = _dec4(_class$1 = _dec5(_class$1 = class BeanInterceptorBase extends BeanBase {
|
|
156
169
|
constructor(beanFetch, options) {
|
|
157
170
|
super();
|
|
@@ -185,9 +198,9 @@ var Monkey = class extends BeanSimple {
|
|
|
185
198
|
};
|
|
186
199
|
//#endregion
|
|
187
200
|
//#region src/.metadata/index.ts
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
var
|
|
201
|
+
var _dec;
|
|
202
|
+
var _dec2;
|
|
203
|
+
var _class;
|
|
191
204
|
var ScopeModuleAFetch = (_dec = Scope(), _dec2 = BeanInfo({ module: "a-fetch" }), _dec(_class = _dec2(_class = class ScopeModuleAFetch extends BeanScopeBase {}) || _class) || _class);
|
|
192
205
|
/** scope: end */
|
|
193
206
|
//#endregion
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../src/service/composer.ts","../src/bean/bean.fetch.ts","../src/bean/bean.interceptorBase.ts","../src/config/config.ts","../src/monkey.ts","../src/.metadata/index.ts","../src/lib/const.ts","../src/lib/interceptor.ts"],"sourcesContent":["var _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor;\nfunction _initializerDefineProperty(e, i, r, l) { r && Object.defineProperty(e, i, { enumerable: r.enumerable, configurable: r.configurable, writable: r.writable, value: r.initializer ? r.initializer.call(l) : void 0 }); }\nfunction _applyDecoratedDescriptor(i, e, r, n, l) { var a = {}; return Object.keys(n).forEach(function (i) { a[i] = n[i]; }), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, (\"value\" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function (r, n) { return n(i, e, r) || r; }, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a; }\nfunction _initializerWarningHelper(r, e) { throw Error(\"Decorating class property failed. Please ensure that transform-class-properties is enabled and runs after the decorators transform.\"); }\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport { BeanBase, cast, deepExtend, SymbolErrorInstanceInfo, Use } from 'zova';\nimport { Service } from 'zova-module-a-bean';\nexport let ServiceComposer = (_dec = Service(), _dec2 = __z_BeanInfo({\n module: \"a-fetch\"\n}), _dec3 = Use(\"a-bean.sys.onion\"), _dec4 = Reflect.metadata(\"design:type\", typeof SysOnion === \"undefined\" ? Object : SysOnion), _dec(_class = _dec2(_class = (_class2 = class ServiceComposer extends BeanBase {\n constructor(...args) {\n super(...args);\n this.$beanFetch = void 0;\n _initializerDefineProperty(this, \"$$sysOnion\", _descriptor, this);\n this._composerRequest = void 0;\n this._composerRequestError = void 0;\n this._composerResponse = void 0;\n this._composerResponseError = void 0;\n }\n async __init__(beanFetch, onionItems) {\n this.$beanFetch = beanFetch;\n await this._createComposer(onionItems);\n }\n executeRequest(config) {\n return this._composerRequest(config);\n }\n executeRequestError(error) {\n return this._composerRequestError(error);\n }\n executeResponse(response) {\n return this._composerResponse(response);\n }\n async executeResponseError(error) {\n error = await this._composerResponseError(error);\n if (error instanceof Error) {\n error[SymbolErrorInstanceInfo] = {\n instance: this.ctx.instance,\n info: 'executeResponseError'\n };\n }\n return error;\n }\n async _createComposer(onionItems) {\n // onionSlices\n let onionSlices;\n if (onionItems) {\n onionSlices = await this.$$sysOnion.interceptor.loadOnions(onionItems);\n } else {\n onionSlices = await this.$$sysOnion.interceptor.loadOnionsFromPackage();\n }\n // create interceptors\n for (const onionSlice of onionSlices) {\n onionSlice.beanInstance = await this.bean._newBean(onionSlice.beanFullName, true, this.$beanFetch, onionSlice.options);\n }\n // compose\n this._composerRequest = this.$$sysOnion.interceptor.compose(onionSlices, (onionSlice, config, next) => {\n // options\n const options = this._combineOnionOptions(onionSlice, config);\n // enable match ignore\n if (!this.$$sysOnion.checkOnionOptionsEnabled(options, config.url)) {\n return next(config);\n }\n // execute\n const beanInstance = cast(onionSlice.beanInstance);\n if (!beanInstance.onRequest) return next(config);\n return beanInstance.onRequest(config, options, next);\n });\n this._composerRequestError = this.$$sysOnion.interceptor.compose(onionSlices, (onionSlice, error, next) => {\n const config = error.config;\n // options\n const options = this._combineOnionOptions(onionSlice, config);\n // enable match ignore\n if (!this.$$sysOnion.checkOnionOptionsEnabled(options, config?.url)) {\n return next(error);\n }\n // execute\n const beanInstance = cast(onionSlice.beanInstance);\n if (!beanInstance.onRequestError) return next(error);\n return beanInstance.onRequestError(error, options, next);\n });\n this._composerResponse = this.$$sysOnion.interceptor.compose(onionSlices, (onionSlice, response, next) => {\n const config = response.config;\n // options\n const options = this._combineOnionOptions(onionSlice, config);\n // enable match ignore\n if (!this.$$sysOnion.checkOnionOptionsEnabled(options, config?.url)) {\n return next(response);\n }\n // execute\n const beanInstance = cast(onionSlice.beanInstance);\n if (!beanInstance.onResponse) return next(response);\n return beanInstance.onResponse(response, options, next);\n });\n this._composerResponseError = this.$$sysOnion.interceptor.compose(onionSlices, (onionSlice, error, next) => {\n const config = error.config;\n // options\n const options = this._combineOnionOptions(onionSlice, config);\n // enable match ignore\n if (!this.$$sysOnion.checkOnionOptionsEnabled(options, config?.url)) {\n return next(error);\n }\n // execute\n const beanInstance = cast(onionSlice.beanInstance);\n if (!beanInstance.onResponseError) return next(error);\n return beanInstance.onResponseError(error, options, next);\n });\n }\n _combineOnionOptions(item, config) {\n // options: dynamic\n let optionsDynamic;\n if (config?.interceptors) {\n optionsDynamic = config?.interceptors[item.name];\n }\n // final options\n const options = optionsDynamic ? deepExtend({}, item.options, optionsDynamic) : item.options;\n // ok\n return options;\n }\n}, _descriptor = _applyDecoratedDescriptor(_class2.prototype, \"$$sysOnion\", [_dec3, _dec4], {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n}), _class2)) || _class) || _class);","var _dec, _dec2, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport axios, { Axios } from 'axios';\nimport { markRaw } from 'vue';\nimport { BeanBase, deepExtend } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\nimport { ServiceComposer } from '../service/composer.js';\nconst SymbolFetch = Symbol('SymbolFetch');\nexport let BeanFetch = (_dec = Bean(), _dec2 = __z_BeanInfo({\n module: \"a-fetch\"\n}), _dec(_class = _dec2(_class = class BeanFetch extends BeanBase {\n constructor(...args) {\n super(...args);\n this._composer = void 0;\n this[SymbolFetch] = void 0;\n }\n async __init__(options) {\n patchAxios(Axios);\n // axiosConfig\n const axiosConfig = deepExtend({}, {\n baseURL: this.sys.util.getApiBaseURL()\n }, this.scope.config.axios.config, options?.axiosConfig);\n // composer\n this._composer = await this.bean._newBean(ServiceComposer, true, this, options?.onionItems);\n // axios\n this[SymbolFetch] = markRaw(axios.create(axiosConfig));\n this._addInterceptors(this[SymbolFetch]);\n }\n __get__(prop) {\n return this[SymbolFetch] && this[SymbolFetch][prop];\n }\n _addInterceptors(api) {\n // request\n api.interceptors.request.use(async config => {\n return await this._composer.executeRequest(config);\n }, async _error => {\n if (!(_error instanceof Error)) return Promise.reject(_error);\n const error = await this._composer.executeRequestError(_error);\n return Promise.reject(error);\n });\n // response\n api.interceptors.response.use(async response => {\n return await this._composer.executeResponse(response);\n }, async _error => {\n if (!(_error instanceof Error)) return Promise.reject(_error);\n const error = await this._composer.executeResponseError(_error);\n return Promise.reject(error);\n });\n }\n}) || _class) || _class);\nfunction patchAxios(_Axios) {\n if (_Axios.__requestPatched) return;\n _Axios.__requestPatched = true;\n const requestPrev = _Axios.prototype.request;\n _Axios.prototype.request = async function (...args) {\n try {\n return await requestPrev.call(this, ...args);\n } catch (err) {\n if (err instanceof Error) throw err;\n return err;\n }\n };\n}","var _dec, _dec2, _dec3, _dec4, _dec5, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport { BeanBase, Virtual } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\nexport let BeanInterceptorBase = (_dec = Bean(), _dec2 = Virtual(), _dec3 = __z_BeanInfo({\n module: \"a-fetch\"\n}), _dec4 = Reflect.metadata(\"design:type\", Function), _dec5 = Reflect.metadata(\"design:paramtypes\", [typeof BeanFetch === \"undefined\" ? Object : BeanFetch, typeof T === \"undefined\" ? Object : T]), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = _dec5(_class = class BeanInterceptorBase extends BeanBase {\n constructor(beanFetch, options) {\n super();\n this.$beanFetch = void 0;\n this.$options = void 0;\n this.$beanFetch = beanFetch;\n this.$options = options;\n }\n}) || _class) || _class) || _class) || _class) || _class);","export const config = _sys => {\n return {\n axios: {\n config: {}\n }\n };\n};","import { BeanSimple } from 'zova';\nimport { BeanFetch } from './bean/bean.fetch.js';\nexport class Monkey extends BeanSimple {\n async appInitialize() {\n // $fetch: should in appInitialize, because should init many interceptors\n this.app.meta.$fetch = await this.bean._getBean(BeanFetch, false);\n }\n async beanInit(bean, beanInstance) {\n const self = this;\n // $fetch\n bean.defineProperty(beanInstance, '$fetch', {\n enumerable: false,\n configurable: true,\n get() {\n return self.app.meta.$fetch;\n }\n });\n }\n}","var _dec, _dec2, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\n// eslint-disable\n/** bean: begin */\nexport * from '../bean/bean.fetch.js';\nexport * from '../bean/bean.interceptorBase.js';\nimport 'zova';\n/** bean: end */\n/** bean: begin */\nimport { BeanFetch } from '../bean/bean.fetch.js';\nimport 'zova';\n/** bean: end */\n/** service: begin */\nexport * from '../service/composer.js';\nimport 'zova-module-a-bean';\n/** service: end */\n/** service: begin */\nimport { ServiceComposer } from '../service/composer.js';\nimport 'zova';\n/** service: end */\n/** config: begin */\nexport * from '../config/config.js';\n/** config: end */\n/** monkey: begin */\nexport * from '../monkey.js';\n/** monkey: end */\n/** scope: begin */\nimport { BeanScopeBase } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\nexport let ScopeModuleAFetch = (_dec = Scope(), _dec2 = __z_BeanInfo({\n module: \"a-fetch\"\n}), _dec(_class = _dec2(_class = class ScopeModuleAFetch extends BeanScopeBase {}) || _class) || _class);\nimport 'zova';\n\n/** scope: end */","export const SymbolInterceptorBodyResponseFlag = Symbol('SymbolInterceptorBodyResponseFlag');","import { createBeanDecorator } from 'zova';\nexport function Interceptor(options) {\n return createBeanDecorator('interceptor', 'new', true, options);\n}"],"mappings":";;;;;AAAA,IAAI,QAAM,SAAO,SAAO,SAAO,UAAQ,SAAS;AAChD,SAAS,2BAA2B,GAAG,GAAG,GAAG,GAAG;CAAE,KAAK,OAAO,eAAe,GAAG,GAAG;EAAE,YAAY,EAAE;EAAY,cAAc,EAAE;EAAc,UAAU,EAAE;EAAU,OAAO,EAAE,cAAc,EAAE,YAAY,KAAK,CAAC,IAAI,KAAK;CAAE,CAAC;AAAG;AAC7N,SAAS,0BAA0B,GAAG,GAAG,GAAG,GAAG,GAAG;CAAE,IAAI,IAAI,CAAC;CAAG,OAAO,OAAO,KAAK,CAAC,CAAC,CA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;;;ACC3F,SAAgB,YAAY,SAAS;CACnC,OAAO,oBAAoB,eAAe,OAAO,MAAM,OAAO;AAChE"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_dec","_dec2","_dec3","_dec4","_class","__z_BeanInfo","_dec","_dec2","_class","BeanFetch","__z_BeanInfo","_dec","_dec2","_class","__z_BeanInfo","BeanFetch","__z_BeanInfo"],"sources":["../src/service/composer.ts","../src/bean/bean.fetch.ts","../src/bean/bean.interceptorBase.ts","../src/config/config.ts","../src/monkey.ts","../src/.metadata/index.ts","../src/lib/const.ts","../src/lib/interceptor.ts"],"sourcesContent":["var _dec, _dec2, _dec3, _dec4, _class, _class2, _descriptor;\nfunction _initializerDefineProperty(e, i, r, l) { r && Object.defineProperty(e, i, { enumerable: r.enumerable, configurable: r.configurable, writable: r.writable, value: r.initializer ? r.initializer.call(l) : void 0 }); }\nfunction _applyDecoratedDescriptor(i, e, r, n, l) { var a = {}; return Object.keys(n).forEach(function (i) { a[i] = n[i]; }), a.enumerable = !!a.enumerable, a.configurable = !!a.configurable, (\"value\" in a || a.initializer) && (a.writable = !0), a = r.slice().reverse().reduce(function (r, n) { return n(i, e, r) || r; }, a), l && void 0 !== a.initializer && (a.value = a.initializer ? a.initializer.call(l) : void 0, a.initializer = void 0), void 0 === a.initializer ? (Object.defineProperty(i, e, a), null) : a; }\nfunction _initializerWarningHelper(r, e) { throw Error(\"Decorating class property failed. Please ensure that transform-class-properties is enabled and runs after the decorators transform.\"); }\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport { BeanBase, cast, deepExtend, SymbolErrorInstanceInfo, Use } from 'zova';\nimport { Service } from 'zova-module-a-bean';\nexport let ServiceComposer = (_dec = Service(), _dec2 = __z_BeanInfo({\n module: \"a-fetch\"\n}), _dec3 = Use(\"a-bean.sys.onion\"), _dec4 = Reflect.metadata(\"design:type\", typeof SysOnion === \"undefined\" ? Object : SysOnion), _dec(_class = _dec2(_class = (_class2 = class ServiceComposer extends BeanBase {\n constructor(...args) {\n super(...args);\n this.$beanFetch = void 0;\n _initializerDefineProperty(this, \"$$sysOnion\", _descriptor, this);\n this._composerRequest = void 0;\n this._composerRequestError = void 0;\n this._composerResponse = void 0;\n this._composerResponseError = void 0;\n }\n async __init__(beanFetch, onionItems) {\n this.$beanFetch = beanFetch;\n await this._createComposer(onionItems);\n }\n executeRequest(config) {\n return this._composerRequest(config);\n }\n executeRequestError(error) {\n return this._composerRequestError(error);\n }\n executeResponse(response) {\n return this._composerResponse(response);\n }\n async executeResponseError(error) {\n error = await this._composerResponseError(error);\n if (error instanceof Error) {\n error[SymbolErrorInstanceInfo] = {\n instance: this.ctx.instance,\n info: 'executeResponseError'\n };\n }\n return error;\n }\n async _createComposer(onionItems) {\n // onionSlices\n let onionSlices;\n if (onionItems) {\n onionSlices = await this.$$sysOnion.interceptor.loadOnions(onionItems);\n } else {\n onionSlices = await this.$$sysOnion.interceptor.loadOnionsFromPackage();\n }\n // create interceptors\n for (const onionSlice of onionSlices) {\n onionSlice.beanInstance = await this.bean._newBean(onionSlice.beanFullName, true, this.$beanFetch, onionSlice.options);\n }\n // compose\n this._composerRequest = this.$$sysOnion.interceptor.compose(onionSlices, (onionSlice, config, next) => {\n // options\n const options = this._combineOnionOptions(onionSlice, config);\n // enable match ignore\n if (!this.$$sysOnion.checkOnionOptionsEnabled(options, config.url)) {\n return next(config);\n }\n // execute\n const beanInstance = cast(onionSlice.beanInstance);\n if (!beanInstance.onRequest) return next(config);\n return beanInstance.onRequest(config, options, next);\n });\n this._composerRequestError = this.$$sysOnion.interceptor.compose(onionSlices, (onionSlice, error, next) => {\n const config = error.config;\n // options\n const options = this._combineOnionOptions(onionSlice, config);\n // enable match ignore\n if (!this.$$sysOnion.checkOnionOptionsEnabled(options, config?.url)) {\n return next(error);\n }\n // execute\n const beanInstance = cast(onionSlice.beanInstance);\n if (!beanInstance.onRequestError) return next(error);\n return beanInstance.onRequestError(error, options, next);\n });\n this._composerResponse = this.$$sysOnion.interceptor.compose(onionSlices, (onionSlice, response, next) => {\n const config = response.config;\n // options\n const options = this._combineOnionOptions(onionSlice, config);\n // enable match ignore\n if (!this.$$sysOnion.checkOnionOptionsEnabled(options, config?.url)) {\n return next(response);\n }\n // execute\n const beanInstance = cast(onionSlice.beanInstance);\n if (!beanInstance.onResponse) return next(response);\n return beanInstance.onResponse(response, options, next);\n });\n this._composerResponseError = this.$$sysOnion.interceptor.compose(onionSlices, (onionSlice, error, next) => {\n const config = error.config;\n // options\n const options = this._combineOnionOptions(onionSlice, config);\n // enable match ignore\n if (!this.$$sysOnion.checkOnionOptionsEnabled(options, config?.url)) {\n return next(error);\n }\n // execute\n const beanInstance = cast(onionSlice.beanInstance);\n if (!beanInstance.onResponseError) return next(error);\n return beanInstance.onResponseError(error, options, next);\n });\n }\n _combineOnionOptions(item, config) {\n // options: dynamic\n let optionsDynamic;\n if (config?.interceptors) {\n optionsDynamic = config?.interceptors[item.name];\n }\n // final options\n const options = optionsDynamic ? deepExtend({}, item.options, optionsDynamic) : item.options;\n // ok\n return options;\n }\n}, _descriptor = _applyDecoratedDescriptor(_class2.prototype, \"$$sysOnion\", [_dec3, _dec4], {\n configurable: true,\n enumerable: true,\n writable: true,\n initializer: null\n}), _class2)) || _class) || _class);","var _dec, _dec2, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport axios, { Axios } from 'axios';\nimport { markRaw } from 'vue';\nimport { BeanBase, deepExtend } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\nimport { ServiceComposer } from '../service/composer.ts';\nconst SymbolFetch = Symbol('SymbolFetch');\nexport let BeanFetch = (_dec = Bean(), _dec2 = __z_BeanInfo({\n module: \"a-fetch\"\n}), _dec(_class = _dec2(_class = class BeanFetch extends BeanBase {\n constructor(...args) {\n super(...args);\n this._composer = void 0;\n this[SymbolFetch] = void 0;\n }\n async __init__(options) {\n patchAxios(Axios);\n // axiosConfig\n const axiosConfig = deepExtend({}, {\n baseURL: this.sys.util.getApiBaseURL()\n }, this.scope.config.axios.config, options?.axiosConfig);\n // composer\n this._composer = await this.bean._newBean(ServiceComposer, true, this, options?.onionItems);\n // axios\n this[SymbolFetch] = markRaw(axios.create(axiosConfig));\n this._addInterceptors(this[SymbolFetch]);\n }\n __get__(prop) {\n return this[SymbolFetch] && this[SymbolFetch][prop];\n }\n _addInterceptors(api) {\n // request\n api.interceptors.request.use(async config => {\n return await this._composer.executeRequest(config);\n }, async _error => {\n if (!(_error instanceof Error)) return Promise.reject(_error);\n const error = await this._composer.executeRequestError(_error);\n return Promise.reject(error);\n });\n // response\n api.interceptors.response.use(async response => {\n return await this._composer.executeResponse(response);\n }, async _error => {\n if (!(_error instanceof Error)) return Promise.reject(_error);\n const error = await this._composer.executeResponseError(_error);\n return Promise.reject(error);\n });\n }\n}) || _class) || _class);\nfunction patchAxios(_Axios) {\n if (_Axios.__requestPatched) return;\n _Axios.__requestPatched = true;\n const requestPrev = _Axios.prototype.request;\n _Axios.prototype.request = async function (...args) {\n try {\n return await requestPrev.call(this, ...args);\n } catch (err) {\n if (err instanceof Error) throw err;\n return err;\n }\n };\n}","var _dec, _dec2, _dec3, _dec4, _dec5, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\nimport { BeanBase, Virtual } from 'zova';\nimport { Bean } from 'zova-module-a-bean';\nexport let BeanInterceptorBase = (_dec = Bean(), _dec2 = Virtual(), _dec3 = __z_BeanInfo({\n module: \"a-fetch\"\n}), _dec4 = Reflect.metadata(\"design:type\", Function), _dec5 = Reflect.metadata(\"design:paramtypes\", [typeof BeanFetch === \"undefined\" ? Object : BeanFetch, typeof T === \"undefined\" ? Object : T]), _dec(_class = _dec2(_class = _dec3(_class = _dec4(_class = _dec5(_class = class BeanInterceptorBase extends BeanBase {\n constructor(beanFetch, options) {\n super();\n this.$beanFetch = void 0;\n this.$options = void 0;\n this.$beanFetch = beanFetch;\n this.$options = options;\n }\n}) || _class) || _class) || _class) || _class) || _class);","export const config = _sys => {\n return {\n axios: {\n config: {}\n }\n };\n};","import { BeanSimple } from 'zova';\nimport { BeanFetch } from './bean/bean.fetch.ts';\nexport class Monkey extends BeanSimple {\n async appInitialize() {\n // $fetch: should in appInitialize, because should init many interceptors\n this.app.meta.$fetch = await this.bean._getBean(BeanFetch, false);\n }\n async beanInit(bean, beanInstance) {\n const self = this;\n // $fetch\n bean.defineProperty(beanInstance, '$fetch', {\n enumerable: false,\n configurable: true,\n get() {\n return self.app.meta.$fetch;\n }\n });\n }\n}","var _dec, _dec2, _class;\nimport { \"BeanInfo\" as __z_BeanInfo } from \"zova\";\n// eslint-disable\n/** bean: begin */\nexport * from '../bean/bean.fetch.ts';\nexport * from '../bean/bean.interceptorBase.ts';\nimport 'zova';\n/** bean: end */\n/** bean: begin */\n\nimport 'zova';\n/** bean: end */\n/** service: begin */\nexport * from '../service/composer.ts';\nimport 'zova-module-a-bean';\n/** service: end */\n/** service: begin */\n\nimport 'zova';\n/** service: end */\n/** config: begin */\nexport * from '../config/config.ts';\n/** config: end */\n/** monkey: begin */\nexport * from '../monkey.ts';\n/** monkey: end */\n/** scope: begin */\nimport { BeanScopeBase } from 'zova';\nimport { Scope } from 'zova-module-a-bean';\nexport let ScopeModuleAFetch = (_dec = Scope(), _dec2 = __z_BeanInfo({\n module: \"a-fetch\"\n}), _dec(_class = _dec2(_class = class ScopeModuleAFetch extends BeanScopeBase {}) || _class) || _class);\nimport 'zova';\n\n/** scope: end */","export const SymbolInterceptorBodyResponseFlag = Symbol('SymbolInterceptorBodyResponseFlag');","import { createBeanDecorator } from 'zova';\nexport function Interceptor(options) {\n return createBeanDecorator('interceptor', 'new', true, options);\n}"],"mappings":";;;;;AAAA,IAAIA;AAAMC,IAAAA;AAAOC,IAAAA;AAAOC,IAAAA;AAAOC,IAAAA;AAAQ,IAAA;AAAS,IAAA;AAChD,SAAS,2BAA2B,GAAG,GAAG,GAAG,GAAG;CAAE,KAAK,OAAO,eAAe,GAAG,GAAG;EAAE,YAAY,EAAE;EAAY,cAAc,E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AM;IACJ,OAAO,KAAK,IAAI,KAAK;GACvB;EACF,CAAC;CACH;AACF;;;AClBA,IAAI;AAAM,IAAA;AAAO,IAAA;AA6BjB,IAAW,qBAAqB,OAAO,MAAM,GAAG,QAAQC,SAAa,EACnE,QAAQ,UACV,CAAC,GAAG,KAAK,SAAS,MAAM,SAAS,MAAM,0BAA0B,cAAc,CAAC,CAAC,KAAK,MAAM,KAAK;;;;AC/BjG,IAAa,oCAAoC,OAAO,mCAAmC;;;ACC3F,SAAgB,YAAY,SAAS;CACnC,OAAO,oBAAoB,eAAe,OAAO,MAAM,OAAO;AAChE"}
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './const.
|
|
2
|
-
export * from './interceptor.
|
|
1
|
+
export * from './const.ts';
|
|
2
|
+
export * from './interceptor.ts';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { IDecoratorInterceptorOptions } from '../types/interceptor.
|
|
1
|
+
import type { IDecoratorInterceptorOptions } from '../types/interceptor.ts';
|
|
2
2
|
export declare function Interceptor<T extends IDecoratorInterceptorOptions>(options?: T): ClassDecorator;
|
|
3
3
|
//# sourceMappingURL=interceptor.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
2
|
import { BeanBase } from 'zova';
|
|
3
3
|
import { IOnionItem, SysOnion } from 'zova-module-a-bean';
|
|
4
|
-
import type { BeanFetch } from '../bean/bean.fetch.
|
|
5
|
-
import type { IDecoratorInterceptorOptions, IInterceptorRecord } from '../types/interceptor.
|
|
4
|
+
import type { BeanFetch } from '../bean/bean.fetch.ts';
|
|
5
|
+
import type { IDecoratorInterceptorOptions, IInterceptorRecord } from '../types/interceptor.ts';
|
|
6
6
|
export declare class ServiceComposer extends BeanBase {
|
|
7
7
|
protected $beanFetch: BeanFetch;
|
|
8
8
|
$$sysOnion: SysOnion;
|
|
@@ -14,7 +14,7 @@ export declare class ServiceComposer extends BeanBase {
|
|
|
14
14
|
executeRequest(config: AxiosRequestConfig): any;
|
|
15
15
|
executeRequestError(error: AxiosError): any;
|
|
16
16
|
executeResponse(response: AxiosResponse): any;
|
|
17
|
-
executeResponseError(error: AxiosError): Promise<AxiosError<unknown, any>>;
|
|
17
|
+
executeResponseError(error: AxiosError): Promise<AxiosError<unknown, any, any>>;
|
|
18
18
|
private _createComposer;
|
|
19
19
|
private _combineOnionOptions;
|
|
20
20
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './interceptor.
|
|
1
|
+
export * from './interceptor.ts';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AxiosError, AxiosRequestConfig, AxiosResponse, CreateAxiosDefaults } from 'axios';
|
|
2
2
|
import type { OmitNever, PowerPartial } from 'zova';
|
|
3
3
|
import type { IOnionItem, IOnionOptionsDeps, IOnionOptionsEnable, IOnionOptionsMatch, ServiceOnion, TypeOnionOptionsMatchRule } from 'zova-module-a-bean';
|
|
4
|
-
import type { BeanFetch } from '../bean/bean.fetch.
|
|
4
|
+
import type { BeanFetch } from '../bean/bean.fetch.ts';
|
|
5
5
|
export type NextInterceptorRequest = (config?: AxiosRequestConfig) => Promise<AxiosRequestConfig>;
|
|
6
6
|
export type NextInterceptorResponse = (response?: AxiosResponse) => Promise<AxiosResponse>;
|
|
7
7
|
export type NextInterceptorError = (error?: AxiosError) => Promise<AxiosError>;
|
package/package.json
CHANGED
package/src/.metadata/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// eslint-disable
|
|
2
2
|
/** bean: begin */
|
|
3
|
-
export * from '../bean/bean.fetch.
|
|
4
|
-
export * from '../bean/bean.interceptorBase.
|
|
3
|
+
export * from '../bean/bean.fetch.ts';
|
|
4
|
+
export * from '../bean/bean.interceptorBase.ts';
|
|
5
5
|
|
|
6
6
|
import 'zova';
|
|
7
7
|
declare module 'zova' {
|
|
@@ -23,8 +23,8 @@ declare module 'zova-module-a-fetch' {
|
|
|
23
23
|
}
|
|
24
24
|
/** bean: end */
|
|
25
25
|
/** bean: begin */
|
|
26
|
-
import { BeanFetch } from '../bean/bean.fetch.
|
|
27
|
-
import { BeanInterceptorBase } from '../bean/bean.interceptorBase.
|
|
26
|
+
import type { BeanFetch } from '../bean/bean.fetch.ts';
|
|
27
|
+
import type { BeanInterceptorBase } from '../bean/bean.interceptorBase.ts';
|
|
28
28
|
import 'zova';
|
|
29
29
|
declare module 'zova' {
|
|
30
30
|
export interface IBeanRecordGeneral {
|
|
@@ -34,7 +34,7 @@ declare module 'zova' {
|
|
|
34
34
|
}
|
|
35
35
|
/** bean: end */
|
|
36
36
|
/** service: begin */
|
|
37
|
-
export * from '../service/composer.
|
|
37
|
+
export * from '../service/composer.ts';
|
|
38
38
|
|
|
39
39
|
import 'zova-module-a-bean';
|
|
40
40
|
declare module 'zova-module-a-bean' {
|
|
@@ -60,7 +60,7 @@ declare module 'zova-module-a-fetch' {
|
|
|
60
60
|
}
|
|
61
61
|
/** service: end */
|
|
62
62
|
/** service: begin */
|
|
63
|
-
import { ServiceComposer } from '../service/composer.
|
|
63
|
+
import type { ServiceComposer } from '../service/composer.ts';
|
|
64
64
|
import 'zova';
|
|
65
65
|
declare module 'zova' {
|
|
66
66
|
export interface IBeanRecordGeneral {
|
|
@@ -69,11 +69,11 @@ declare module 'zova' {
|
|
|
69
69
|
}
|
|
70
70
|
/** service: end */
|
|
71
71
|
/** config: begin */
|
|
72
|
-
export * from '../config/config.
|
|
73
|
-
import { config } from '../config/config.
|
|
72
|
+
export * from '../config/config.ts';
|
|
73
|
+
import { config } from '../config/config.ts';
|
|
74
74
|
/** config: end */
|
|
75
75
|
/** monkey: begin */
|
|
76
|
-
export * from '../monkey.
|
|
76
|
+
export * from '../monkey.ts';
|
|
77
77
|
/** monkey: end */
|
|
78
78
|
/** scope: begin */
|
|
79
79
|
import { BeanScopeBase, type BeanScopeUtil, TypeModuleConfig } from 'zova';
|
package/src/.metadata/this.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const __ThisModule__ = 'a-fetch';
|
|
2
|
-
export { ScopeModuleAFetch as ScopeModule } from './index.
|
|
2
|
+
export { ScopeModuleAFetch as ScopeModule } from './index.ts';
|
package/src/bean/bean.fetch.ts
CHANGED
|
@@ -5,9 +5,9 @@ import { markRaw } from 'vue';
|
|
|
5
5
|
import { BeanBase, deepExtend } from 'zova';
|
|
6
6
|
import { Bean } from 'zova-module-a-bean';
|
|
7
7
|
|
|
8
|
-
import type { IBeanFetchOptions } from '../types/interceptor.
|
|
8
|
+
import type { IBeanFetchOptions } from '../types/interceptor.ts';
|
|
9
9
|
|
|
10
|
-
import { ServiceComposer } from '../service/composer.
|
|
10
|
+
import { ServiceComposer } from '../service/composer.ts';
|
|
11
11
|
|
|
12
12
|
const SymbolFetch = Symbol('SymbolFetch');
|
|
13
13
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { BeanBase, Virtual } from 'zova';
|
|
2
2
|
import { Bean } from 'zova-module-a-bean';
|
|
3
3
|
|
|
4
|
-
import type { IDecoratorInterceptorOptions } from '../types/interceptor.
|
|
5
|
-
import type { BeanFetch } from './bean.fetch.
|
|
4
|
+
import type { IDecoratorInterceptorOptions } from '../types/interceptor.ts';
|
|
5
|
+
import type { BeanFetch } from './bean.fetch.ts';
|
|
6
6
|
|
|
7
7
|
@Bean()
|
|
8
8
|
@Virtual()
|
package/src/index.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './.metadata/index.
|
|
2
|
-
export * from './lib/index.
|
|
3
|
-
export * from './types/index.
|
|
1
|
+
export * from './.metadata/index.ts';
|
|
2
|
+
export * from './lib/index.ts';
|
|
3
|
+
export * from './types/index.ts';
|
package/src/lib/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './const.
|
|
2
|
-
export * from './interceptor.
|
|
1
|
+
export * from './const.ts';
|
|
2
|
+
export * from './interceptor.ts';
|
package/src/lib/interceptor.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createBeanDecorator } from 'zova';
|
|
2
2
|
|
|
3
|
-
import type { IDecoratorInterceptorOptions } from '../types/interceptor.
|
|
3
|
+
import type { IDecoratorInterceptorOptions } from '../types/interceptor.ts';
|
|
4
4
|
|
|
5
5
|
export function Interceptor<T extends IDecoratorInterceptorOptions>(options?: T): ClassDecorator {
|
|
6
6
|
return createBeanDecorator('interceptor', 'new', true, options);
|
package/src/monkey.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { BeanBase, BeanContainer, IMonkeyAppInitialize, IMonkeyBeanInit } f
|
|
|
2
2
|
|
|
3
3
|
import { BeanSimple } from 'zova';
|
|
4
4
|
|
|
5
|
-
import { BeanFetch } from './bean/bean.fetch.
|
|
5
|
+
import { BeanFetch } from './bean/bean.fetch.ts';
|
|
6
6
|
|
|
7
7
|
export class Monkey extends BeanSimple implements IMonkeyAppInitialize, IMonkeyBeanInit {
|
|
8
8
|
async appInitialize() {
|
package/src/service/composer.ts
CHANGED
|
@@ -4,7 +4,7 @@ import { BeanBase, cast, deepExtend, SymbolErrorInstanceInfo, Use } from 'zova';
|
|
|
4
4
|
import { IOnionItem, IOnionSlice, SysOnion, TypeComposer } from 'zova-module-a-bean';
|
|
5
5
|
import { Service } from 'zova-module-a-bean';
|
|
6
6
|
|
|
7
|
-
import type { BeanFetch } from '../bean/bean.fetch.
|
|
7
|
+
import type { BeanFetch } from '../bean/bean.fetch.ts';
|
|
8
8
|
import type {
|
|
9
9
|
IDecoratorInterceptorOptions,
|
|
10
10
|
IInterceptorRecord,
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
IInterceptorRequestError,
|
|
13
13
|
IInterceptorResponse,
|
|
14
14
|
IInterceptorResponseError,
|
|
15
|
-
} from '../types/interceptor.
|
|
15
|
+
} from '../types/interceptor.ts';
|
|
16
16
|
|
|
17
17
|
@Service()
|
|
18
18
|
export class ServiceComposer extends BeanBase {
|
package/src/types/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './interceptor.
|
|
1
|
+
export * from './interceptor.ts';
|
package/src/types/interceptor.ts
CHANGED
|
@@ -9,7 +9,7 @@ import type {
|
|
|
9
9
|
TypeOnionOptionsMatchRule,
|
|
10
10
|
} from 'zova-module-a-bean';
|
|
11
11
|
|
|
12
|
-
import type { BeanFetch } from '../bean/bean.fetch.
|
|
12
|
+
import type { BeanFetch } from '../bean/bean.fetch.ts';
|
|
13
13
|
|
|
14
14
|
export type NextInterceptorRequest = (config?: AxiosRequestConfig) => Promise<AxiosRequestConfig>;
|
|
15
15
|
export type NextInterceptorResponse = (response?: AxiosResponse) => Promise<AxiosResponse>;
|