@howone/sdk 0.1.10 → 0.1.11
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.js +18 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1064,8 +1064,24 @@ function wrapRequestWithProjectPrefix(biz, projectId) {
|
|
|
1064
1064
|
return wrapped;
|
|
1065
1065
|
}
|
|
1066
1066
|
function createClient(opts) {
|
|
1067
|
-
|
|
1068
|
-
|
|
1067
|
+
function makeRequestFromBase(base) {
|
|
1068
|
+
if (!base) return void 0;
|
|
1069
|
+
return new request_default({
|
|
1070
|
+
baseURL: base,
|
|
1071
|
+
timeout: 6e4,
|
|
1072
|
+
interceptors: {
|
|
1073
|
+
requestInterceptor: (config) => {
|
|
1074
|
+
config.headers = config.headers || {};
|
|
1075
|
+
return config;
|
|
1076
|
+
},
|
|
1077
|
+
requestInterceptorCatch: (err) => Promise.reject(err),
|
|
1078
|
+
responseInterceptor: (res) => res,
|
|
1079
|
+
responseInterceptorCatch: (err) => Promise.reject(err)
|
|
1080
|
+
}
|
|
1081
|
+
});
|
|
1082
|
+
}
|
|
1083
|
+
const biz = opts?.requestInstance || makeRequestFromBase(opts?.baseUrl) || request;
|
|
1084
|
+
const ai = opts?.aiRequestInstance || makeRequestFromBase(opts?.aiBaseUrl) || aiRequest;
|
|
1069
1085
|
const bizWrapped = wrapRequestWithProjectPrefix(biz, opts?.projectId);
|
|
1070
1086
|
let token = null;
|
|
1071
1087
|
try {
|