abbot-http-client 0.0.33 → 0.0.35
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 +20 -14
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +18 -12
- 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
|
|
|
@@ -202,18 +202,18 @@ function axiosConf(cfg) {
|
|
|
202
202
|
var AbbotHttp = class {
|
|
203
203
|
config = defaultConfig;
|
|
204
204
|
constructor(config) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
target[key] = srcVal;
|
|
205
|
+
function deepMerge(target, source) {
|
|
206
|
+
for (const key in source) {
|
|
207
|
+
const srcVal = source[key];
|
|
208
|
+
if (srcVal && typeof srcVal === "object" && !Array.isArray(srcVal)) {
|
|
209
|
+
target[key] = deepMerge(target[key], srcVal);
|
|
210
|
+
} else if (srcVal !== void 0) {
|
|
211
|
+
target[key] = srcVal;
|
|
212
|
+
}
|
|
214
213
|
}
|
|
214
|
+
return target;
|
|
215
215
|
}
|
|
216
|
-
|
|
216
|
+
this.config = deepMerge(this.config, config);
|
|
217
217
|
}
|
|
218
218
|
createAxiosInstance(option) {
|
|
219
219
|
const axios2 = axiosConf(this.config);
|
|
@@ -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
|
@@ -55,7 +55,6 @@ interface AbbotResponse$1<T> {
|
|
|
55
55
|
declare class AbbotHttp {
|
|
56
56
|
protected config: AbbotConfig;
|
|
57
57
|
constructor(config: DeepPartial<AbbotConfig>);
|
|
58
|
-
protected deepMerge<T>(target: T, source: DeepPartial<T>): T;
|
|
59
58
|
protected createAxiosInstance(option?: Partial<MethodOption>): AxiosInstance;
|
|
60
59
|
protected prepareRequestConfig(option?: Partial<MethodOption>): {
|
|
61
60
|
cryp: Cryp;
|
|
@@ -82,6 +81,8 @@ declare class RestError<T extends AxiosError> extends Error {
|
|
|
82
81
|
constructor(rs: T);
|
|
83
82
|
}
|
|
84
83
|
|
|
84
|
+
declare function create(config: DeepPartial<AbbotConfig>): AbbotHttp;
|
|
85
|
+
|
|
85
86
|
type AbbotResponse<T> = AbbotResponse$1<T>;
|
|
86
87
|
|
|
87
|
-
export { type AbbotConfig,
|
|
88
|
+
export { type AbbotConfig, type AbbotResponse, AppError, RestError, catchError, create };
|
package/dist/index.d.ts
CHANGED
|
@@ -55,7 +55,6 @@ interface AbbotResponse$1<T> {
|
|
|
55
55
|
declare class AbbotHttp {
|
|
56
56
|
protected config: AbbotConfig;
|
|
57
57
|
constructor(config: DeepPartial<AbbotConfig>);
|
|
58
|
-
protected deepMerge<T>(target: T, source: DeepPartial<T>): T;
|
|
59
58
|
protected createAxiosInstance(option?: Partial<MethodOption>): AxiosInstance;
|
|
60
59
|
protected prepareRequestConfig(option?: Partial<MethodOption>): {
|
|
61
60
|
cryp: Cryp;
|
|
@@ -82,6 +81,8 @@ declare class RestError<T extends AxiosError> extends Error {
|
|
|
82
81
|
constructor(rs: T);
|
|
83
82
|
}
|
|
84
83
|
|
|
84
|
+
declare function create(config: DeepPartial<AbbotConfig>): AbbotHttp;
|
|
85
|
+
|
|
85
86
|
type AbbotResponse<T> = AbbotResponse$1<T>;
|
|
86
87
|
|
|
87
|
-
export { type AbbotConfig,
|
|
88
|
+
export { type AbbotConfig, type AbbotResponse, AppError, RestError, catchError, create };
|
package/dist/index.js
CHANGED
|
@@ -165,18 +165,18 @@ function axiosConf(cfg) {
|
|
|
165
165
|
var AbbotHttp = class {
|
|
166
166
|
config = defaultConfig;
|
|
167
167
|
constructor(config) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
target[key] = srcVal;
|
|
168
|
+
function deepMerge(target, source) {
|
|
169
|
+
for (const key in source) {
|
|
170
|
+
const srcVal = source[key];
|
|
171
|
+
if (srcVal && typeof srcVal === "object" && !Array.isArray(srcVal)) {
|
|
172
|
+
target[key] = deepMerge(target[key], srcVal);
|
|
173
|
+
} else if (srcVal !== void 0) {
|
|
174
|
+
target[key] = srcVal;
|
|
175
|
+
}
|
|
177
176
|
}
|
|
177
|
+
return target;
|
|
178
178
|
}
|
|
179
|
-
|
|
179
|
+
this.config = deepMerge(this.config, config);
|
|
180
180
|
}
|
|
181
181
|
createAxiosInstance(option) {
|
|
182
182
|
const axios2 = axiosConf(this.config);
|
|
@@ -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
|
};
|