@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 CHANGED
@@ -1119,8 +1119,24 @@ function wrapRequestWithProjectPrefix(biz, projectId) {
1119
1119
  return wrapped;
1120
1120
  }
1121
1121
  function createClient(opts) {
1122
- const biz = opts?.requestInstance || request;
1123
- const ai = opts?.aiRequestInstance || aiRequest;
1122
+ function makeRequestFromBase(base) {
1123
+ if (!base) return void 0;
1124
+ return new request_default({
1125
+ baseURL: base,
1126
+ timeout: 6e4,
1127
+ interceptors: {
1128
+ requestInterceptor: (config) => {
1129
+ config.headers = config.headers || {};
1130
+ return config;
1131
+ },
1132
+ requestInterceptorCatch: (err) => Promise.reject(err),
1133
+ responseInterceptor: (res) => res,
1134
+ responseInterceptorCatch: (err) => Promise.reject(err)
1135
+ }
1136
+ });
1137
+ }
1138
+ const biz = opts?.requestInstance || makeRequestFromBase(opts?.baseUrl) || request;
1139
+ const ai = opts?.aiRequestInstance || makeRequestFromBase(opts?.aiBaseUrl) || aiRequest;
1124
1140
  const bizWrapped = wrapRequestWithProjectPrefix(biz, opts?.projectId);
1125
1141
  let token = null;
1126
1142
  try {