@clownlee/cores 1.0.20 → 1.0.22

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.
@@ -21,4 +21,10 @@ export default class SubAppAuthApis {
21
21
  * @returns AccessToken和RefreshToken
22
22
  */
23
23
  getSubAppToken(clientId: string, code: string, redirectUri?: string): Promise<any>;
24
+ /**
25
+ * 获取租户列表 API(供注册/新增用户等场景选择租户)
26
+ * @param type 租户类型:LOGIN(登录)或 REGISTER(注册)
27
+ * @returns 租户列表
28
+ */
29
+ getTenants(type?: 'LOGIN' | 'REGISTER'): Promise<any>;
24
30
  }
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { default as init } from '@clownlee/http';
2
2
 
3
3
  export declare const initHttp: typeof init;
4
- export type { RequestInitConfig, RefreshConfig, HttpRequestConfig, HttpResponse, HttpInstance, TokenResponse, } from '@clownlee/http';
4
+ export type { RequestInitConfig, RefreshConfig, HttpRequestConfig, HttpResponse, HttpStreamResponse, HttpInstance, TokenResponse, } from '@clownlee/http';
5
5
  export * from './apis';
6
6
  export * from './ui/permission-btn';
7
7
  export * from './ui/permission-table';
package/dist/index.js CHANGED
@@ -2708,7 +2708,7 @@ async function handleResponseInterceptor(response, store, refreshConfig) {
2708
2708
  throw refreshError;
2709
2709
  }
2710
2710
  } else if (code > 0 && code !== TENANT_SUPER_ADMIN_FIRST_LOGIN_CODE) {
2711
- throw new Error((responseData == null ? void 0 : responseData.message + 222) ?? "请求失败");
2711
+ throw new Error((responseData == null ? void 0 : responseData.message) ?? "请求失败");
2712
2712
  }
2713
2713
  return response;
2714
2714
  }
@@ -2789,11 +2789,8 @@ class RequestServiceClass {
2789
2789
  }
2790
2790
  return this.instance;
2791
2791
  }
2792
- /**
2793
- * 通用请求方法
2794
- */
2795
2792
  async request(config) {
2796
- var _a;
2793
+ var _a, _b;
2797
2794
  const instance = this.getInstance();
2798
2795
  const axiosConfig = {
2799
2796
  ...config,
@@ -2801,7 +2798,8 @@ class RequestServiceClass {
2801
2798
  cancelToken: config.cancelToken && "token" in config.cancelToken ? config.cancelToken.token : config.cancelToken
2802
2799
  };
2803
2800
  const response = await instance.request(axiosConfig);
2804
- if ((_a = response.headers["content-type"]) == null ? void 0 : _a.includes("application/octet-stream")) {
2801
+ const isBlobResponse = config.responseType === "blob" || ((_a = config.headers) == null ? void 0 : _a.responseType) === "blob" || ((_b = response.headers["content-type"]) == null ? void 0 : _b.includes("application/octet-stream"));
2802
+ if (isBlobResponse) {
2805
2803
  return response;
2806
2804
  }
2807
2805
  return response.data;
@@ -2992,6 +2990,16 @@ class SubAppAuthApis {
2992
2990
  redirectUri
2993
2991
  });
2994
2992
  }
2993
+ /**
2994
+ * 获取租户列表 API(供注册/新增用户等场景选择租户)
2995
+ * @param type 租户类型:LOGIN(登录)或 REGISTER(注册)
2996
+ * @returns 租户列表
2997
+ */
2998
+ async getTenants(type = "REGISTER") {
2999
+ return await this.http.post("/api/v1/iam/auth/register/tenants", {
3000
+ type
3001
+ });
3002
+ }
2995
3003
  }
2996
3004
  let Apis$4 = class Apis2 {
2997
3005
  constructor(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clownlee/cores",
3
- "version": "1.0.20",
3
+ "version": "1.0.22",
4
4
  "description": "公共核心库,提供统一的 HTTP 请求能力和自动 token 刷新功能",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,7 +30,7 @@
30
30
  "author": "",
31
31
  "license": "MIT",
32
32
  "dependencies": {
33
- "@clownlee/http": "^1.0.5",
33
+ "@clownlee/http": "^1.0.8",
34
34
  "pinia": "^2.1.7",
35
35
  "vue": "^3.5.25",
36
36
  "cropper": "^4.1.0",