@nocobase/sdk 1.4.0-alpha → 1.4.0-alpha.1

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.
@@ -120,12 +120,13 @@ interface ExtendedOptions {
120
120
  }
121
121
  export type APIClientOptions = AxiosInstance | (AxiosRequestConfig & ExtendedOptions);
122
122
  export declare class APIClient {
123
+ options?: APIClientOptions;
123
124
  axios: AxiosInstance;
124
125
  auth: Auth;
125
126
  storage: Storage;
126
127
  storagePrefix: string;
127
128
  getHeaders(): {};
128
- constructor(instance?: APIClientOptions);
129
+ constructor(options?: APIClientOptions);
129
130
  private initStorage;
130
131
  interceptors(): void;
131
132
  request<T = any, R = AxiosResponse<T>, D = any>(config: AxiosRequestConfig<D> | ResourceActionOptions): Promise<R>;
package/lib/APIClient.js CHANGED
@@ -252,6 +252,7 @@ const _MemoryStorage = class _MemoryStorage extends Storage {
252
252
  __name(_MemoryStorage, "MemoryStorage");
253
253
  let MemoryStorage = _MemoryStorage;
254
254
  const _APIClient = class _APIClient {
255
+ options;
255
256
  axios;
256
257
  auth;
257
258
  storage;
@@ -272,11 +273,12 @@ const _APIClient = class _APIClient {
272
273
  }
273
274
  return headers;
274
275
  }
275
- constructor(instance) {
276
- if (typeof instance === "function") {
277
- this.axios = instance;
276
+ constructor(options) {
277
+ this.options = options;
278
+ if (typeof options === "function") {
279
+ this.axios = options;
278
280
  } else {
279
- const { authClass, storageType, storageClass, storagePrefix = "NOCOBASE_", ...others } = instance || {};
281
+ const { authClass, storageType, storageClass, storagePrefix = "NOCOBASE_", ...others } = options || {};
280
282
  this.storagePrefix = storagePrefix;
281
283
  this.axios = import_axios.default.create(others);
282
284
  this.initStorage(storageClass, storageType);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/sdk",
3
- "version": "1.4.0-alpha",
3
+ "version": "1.4.0-alpha.1",
4
4
  "license": "AGPL-3.0",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -11,5 +11,5 @@
11
11
  "devDependencies": {
12
12
  "axios-mock-adapter": "^1.20.0"
13
13
  },
14
- "gitHead": "f097a2bddec152522b5645bd5d451f4c866d2060"
14
+ "gitHead": "b42379db55cd8774d3543c8d6cdc566434d3f170"
15
15
  }