abbot-http-client 0.0.32 → 0.0.34
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 +11 -5
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +9 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -30,10 +30,10 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
AbbotHttp: () => AbbotHttp,
|
|
34
33
|
AppError: () => AppError,
|
|
35
34
|
RestError: () => RestError,
|
|
36
|
-
catchError: () => catchError
|
|
35
|
+
catchError: () => catchError,
|
|
36
|
+
create: () => create
|
|
37
37
|
});
|
|
38
38
|
module.exports = __toCommonJS(index_exports);
|
|
39
39
|
|
|
@@ -201,7 +201,7 @@ function axiosConf(cfg) {
|
|
|
201
201
|
// src/http.ts
|
|
202
202
|
var AbbotHttp = class {
|
|
203
203
|
config = defaultConfig;
|
|
204
|
-
|
|
204
|
+
constructor(config) {
|
|
205
205
|
this.config = this.deepMerge(this.config, config);
|
|
206
206
|
}
|
|
207
207
|
deepMerge(target, source) {
|
|
@@ -445,10 +445,16 @@ var AbbotHttp = class {
|
|
|
445
445
|
return this.config;
|
|
446
446
|
}
|
|
447
447
|
};
|
|
448
|
+
|
|
449
|
+
// src/config/core.ts
|
|
450
|
+
function create(config) {
|
|
451
|
+
const http = new AbbotHttp(config);
|
|
452
|
+
return http;
|
|
453
|
+
}
|
|
448
454
|
// Annotate the CommonJS export names for ESM import in node:
|
|
449
455
|
0 && (module.exports = {
|
|
450
|
-
AbbotHttp,
|
|
451
456
|
AppError,
|
|
452
457
|
RestError,
|
|
453
|
-
catchError
|
|
458
|
+
catchError,
|
|
459
|
+
create
|
|
454
460
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -54,7 +54,7 @@ interface AbbotResponse$1<T> {
|
|
|
54
54
|
}
|
|
55
55
|
declare class AbbotHttp {
|
|
56
56
|
protected config: AbbotConfig;
|
|
57
|
-
|
|
57
|
+
constructor(config: DeepPartial<AbbotConfig>);
|
|
58
58
|
protected deepMerge<T>(target: T, source: DeepPartial<T>): T;
|
|
59
59
|
protected createAxiosInstance(option?: Partial<MethodOption>): AxiosInstance;
|
|
60
60
|
protected prepareRequestConfig(option?: Partial<MethodOption>): {
|
|
@@ -82,6 +82,8 @@ declare class RestError<T extends AxiosError> extends Error {
|
|
|
82
82
|
constructor(rs: T);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
declare function create(config: DeepPartial<AbbotConfig>): AbbotHttp;
|
|
86
|
+
|
|
85
87
|
type AbbotResponse<T> = AbbotResponse$1<T>;
|
|
86
88
|
|
|
87
|
-
export { type AbbotConfig,
|
|
89
|
+
export { type AbbotConfig, type AbbotResponse, AppError, RestError, catchError, create };
|
package/dist/index.d.ts
CHANGED
|
@@ -54,7 +54,7 @@ interface AbbotResponse$1<T> {
|
|
|
54
54
|
}
|
|
55
55
|
declare class AbbotHttp {
|
|
56
56
|
protected config: AbbotConfig;
|
|
57
|
-
|
|
57
|
+
constructor(config: DeepPartial<AbbotConfig>);
|
|
58
58
|
protected deepMerge<T>(target: T, source: DeepPartial<T>): T;
|
|
59
59
|
protected createAxiosInstance(option?: Partial<MethodOption>): AxiosInstance;
|
|
60
60
|
protected prepareRequestConfig(option?: Partial<MethodOption>): {
|
|
@@ -82,6 +82,8 @@ declare class RestError<T extends AxiosError> extends Error {
|
|
|
82
82
|
constructor(rs: T);
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
declare function create(config: DeepPartial<AbbotConfig>): AbbotHttp;
|
|
86
|
+
|
|
85
87
|
type AbbotResponse<T> = AbbotResponse$1<T>;
|
|
86
88
|
|
|
87
|
-
export { type AbbotConfig,
|
|
89
|
+
export { type AbbotConfig, type AbbotResponse, AppError, RestError, catchError, create };
|
package/dist/index.js
CHANGED
|
@@ -164,7 +164,7 @@ function axiosConf(cfg) {
|
|
|
164
164
|
// src/http.ts
|
|
165
165
|
var AbbotHttp = class {
|
|
166
166
|
config = defaultConfig;
|
|
167
|
-
|
|
167
|
+
constructor(config) {
|
|
168
168
|
this.config = this.deepMerge(this.config, config);
|
|
169
169
|
}
|
|
170
170
|
deepMerge(target, source) {
|
|
@@ -408,9 +408,15 @@ var AbbotHttp = class {
|
|
|
408
408
|
return this.config;
|
|
409
409
|
}
|
|
410
410
|
};
|
|
411
|
+
|
|
412
|
+
// src/config/core.ts
|
|
413
|
+
function create(config) {
|
|
414
|
+
const http = new AbbotHttp(config);
|
|
415
|
+
return http;
|
|
416
|
+
}
|
|
411
417
|
export {
|
|
412
|
-
AbbotHttp,
|
|
413
418
|
AppError,
|
|
414
419
|
RestError,
|
|
415
|
-
catchError
|
|
420
|
+
catchError,
|
|
421
|
+
create
|
|
416
422
|
};
|