@be-link/ecommerce-backend-bff-service-node-sdk 0.0.7 → 0.0.8

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/README.md CHANGED
@@ -26,7 +26,7 @@ import { EcommerceBackendBffSDK } from '@be-link/ecommerce-backend-bff-service-n
26
26
  const sdk = new EcommerceBackendBffSDK({
27
27
  getToken: async () => localStorage.getItem('token') || '',
28
28
  getUserId: async () => localStorage.getItem('userId') || '',
29
- getRuleId: async () => localStorage.getItem('ruleId') || '',
29
+ getRoleId: async () => localStorage.getItem('roleId') || '',
30
30
  environment: 'production'
31
31
  })
32
32
 
@@ -45,7 +45,7 @@ import { EcommerceBackendBffSDK } from '@be-link/ecommerce-backend-bff-service-n
45
45
  const sdk = new EcommerceBackendBffSDK({
46
46
  getToken: async () => wx.getStorageSync('token') || '',
47
47
  getUserId: async () => wx.getStorageSync('userId') || '',
48
- getRuleId: async () => wx.getStorageSync('ruleId') || '',
48
+ getRoleId: async () => wx.getStorageSync('roleId') || '',
49
49
  environment: 'test'
50
50
  })
51
51
 
@@ -38,10 +38,10 @@ class HttpClient {
38
38
  */
39
39
  async request(opts) {
40
40
  // 并发获取凭证,带错误处理
41
- const [token, userId, ruleId] = await Promise.all([
41
+ const [token, userId, roleId] = await Promise.all([
42
42
  Promise.resolve(this.options.getToken()).catch(() => ''),
43
43
  Promise.resolve(this.options.getUserId()).catch(() => ''),
44
- Promise.resolve(this.options.getRuleId()).catch(() => ''),
44
+ Promise.resolve(this.options.getRoleId()).catch(() => ''),
45
45
  ]);
46
46
  // 生成唯一的请求 ID(兼容所有环境)
47
47
  const requestId = `b-${(0, string_1.generateUUID)()}`;
@@ -51,7 +51,7 @@ class HttpClient {
51
51
  'X-Request-Id': requestId,
52
52
  'x-belink-authorization': token,
53
53
  'x-belink-pandora-userId': userId,
54
- 'x-belink-pandora-ruleId': ruleId,
54
+ 'x-belink-pandora-roleId': roleId,
55
55
  };
56
56
  // 合并自定义请求头(自定义请求头优先)
57
57
  const headers = {
package/cjs/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import type { SdkOptions } from './types';
11
11
  * const sdk = new EcommerceBackendBffSDK({
12
12
  * getToken: async () => localStorage.getItem('token') || '',
13
13
  * getUserId: async () => localStorage.getItem('userId') || '',
14
- * getRuleId: async () => localStorage.getItem('ruleId') || '',
14
+ * getRoleId: async () => localStorage.getItem('roleId') || '',
15
15
  * environment: 'production'
16
16
  * })
17
17
  *
@@ -19,7 +19,7 @@ import type { SdkOptions } from './types';
19
19
  * const sdk = new EcommerceBackendBffSDK({
20
20
  * getToken: async () => wx.getStorageSync('token') || '',
21
21
  * getUserId: async () => wx.getStorageSync('userId') || '',
22
- * getRuleId: async () => wx.getStorageSync('ruleId') || '',
22
+ * getRoleId: async () => wx.getStorageSync('roleId') || '',
23
23
  * environment: 'test'
24
24
  * })
25
25
  *
package/cjs/index.js CHANGED
@@ -17,7 +17,7 @@ const service_2 = __importDefault(require("./bff/modules/demo/service"));
17
17
  * const sdk = new EcommerceBackendBffSDK({
18
18
  * getToken: async () => localStorage.getItem('token') || '',
19
19
  * getUserId: async () => localStorage.getItem('userId') || '',
20
- * getRuleId: async () => localStorage.getItem('ruleId') || '',
20
+ * getRoleId: async () => localStorage.getItem('roleId') || '',
21
21
  * environment: 'production'
22
22
  * })
23
23
  *
@@ -25,7 +25,7 @@ const service_2 = __importDefault(require("./bff/modules/demo/service"));
25
25
  * const sdk = new EcommerceBackendBffSDK({
26
26
  * getToken: async () => wx.getStorageSync('token') || '',
27
27
  * getUserId: async () => wx.getStorageSync('userId') || '',
28
- * getRuleId: async () => wx.getStorageSync('ruleId') || '',
28
+ * getRoleId: async () => wx.getStorageSync('roleId') || '',
29
29
  * environment: 'test'
30
30
  * })
31
31
  *
@@ -13,10 +13,10 @@ export interface SdkOptions {
13
13
  */
14
14
  getUserId: () => string | Promise<string>;
15
15
  /**
16
- * 获取规则 ID 的回调函数
16
+ * 获取角色 ID 的回调函数
17
17
  * 可以是同步或异步的
18
18
  */
19
- getRuleId: () => string | Promise<string>;
19
+ getRoleId: () => string | Promise<string>;
20
20
  /**
21
21
  * 运行环境配置(必传)
22
22
  * - 'production': 生产环境
@@ -35,10 +35,10 @@ export class HttpClient {
35
35
  */
36
36
  async request(opts) {
37
37
  // 并发获取凭证,带错误处理
38
- const [token, userId, ruleId] = await Promise.all([
38
+ const [token, userId, roleId] = await Promise.all([
39
39
  Promise.resolve(this.options.getToken()).catch(() => ''),
40
40
  Promise.resolve(this.options.getUserId()).catch(() => ''),
41
- Promise.resolve(this.options.getRuleId()).catch(() => ''),
41
+ Promise.resolve(this.options.getRoleId()).catch(() => ''),
42
42
  ]);
43
43
  // 生成唯一的请求 ID(兼容所有环境)
44
44
  const requestId = `b-${generateUUID()}`;
@@ -48,7 +48,7 @@ export class HttpClient {
48
48
  'X-Request-Id': requestId,
49
49
  'x-belink-authorization': token,
50
50
  'x-belink-pandora-userId': userId,
51
- 'x-belink-pandora-ruleId': ruleId,
51
+ 'x-belink-pandora-roleId': roleId,
52
52
  };
53
53
  // 合并自定义请求头(自定义请求头优先)
54
54
  const headers = {
package/esm/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import type { SdkOptions } from './types';
11
11
  * const sdk = new EcommerceBackendBffSDK({
12
12
  * getToken: async () => localStorage.getItem('token') || '',
13
13
  * getUserId: async () => localStorage.getItem('userId') || '',
14
- * getRuleId: async () => localStorage.getItem('ruleId') || '',
14
+ * getRoleId: async () => localStorage.getItem('roleId') || '',
15
15
  * environment: 'production'
16
16
  * })
17
17
  *
@@ -19,7 +19,7 @@ import type { SdkOptions } from './types';
19
19
  * const sdk = new EcommerceBackendBffSDK({
20
20
  * getToken: async () => wx.getStorageSync('token') || '',
21
21
  * getUserId: async () => wx.getStorageSync('userId') || '',
22
- * getRuleId: async () => wx.getStorageSync('ruleId') || '',
22
+ * getRoleId: async () => wx.getStorageSync('roleId') || '',
23
23
  * environment: 'test'
24
24
  * })
25
25
  *
package/esm/index.mjs CHANGED
@@ -11,7 +11,7 @@ import DemoService from './bff/modules/demo/service.mjs';
11
11
  * const sdk = new EcommerceBackendBffSDK({
12
12
  * getToken: async () => localStorage.getItem('token') || '',
13
13
  * getUserId: async () => localStorage.getItem('userId') || '',
14
- * getRuleId: async () => localStorage.getItem('ruleId') || '',
14
+ * getRoleId: async () => localStorage.getItem('roleId') || '',
15
15
  * environment: 'production'
16
16
  * })
17
17
  *
@@ -19,7 +19,7 @@ import DemoService from './bff/modules/demo/service.mjs';
19
19
  * const sdk = new EcommerceBackendBffSDK({
20
20
  * getToken: async () => wx.getStorageSync('token') || '',
21
21
  * getUserId: async () => wx.getStorageSync('userId') || '',
22
- * getRuleId: async () => wx.getStorageSync('ruleId') || '',
22
+ * getRoleId: async () => wx.getStorageSync('roleId') || '',
23
23
  * environment: 'test'
24
24
  * })
25
25
  *
@@ -13,10 +13,10 @@ export interface SdkOptions {
13
13
  */
14
14
  getUserId: () => string | Promise<string>;
15
15
  /**
16
- * 获取规则 ID 的回调函数
16
+ * 获取角色 ID 的回调函数
17
17
  * 可以是同步或异步的
18
18
  */
19
- getRuleId: () => string | Promise<string>;
19
+ getRoleId: () => string | Promise<string>;
20
20
  /**
21
21
  * 运行环境配置(必传)
22
22
  * - 'production': 生产环境
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@be-link/ecommerce-backend-bff-service-node-sdk",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "EcommerceBackendBffService Node.js SDK",
5
5
  "type": "commonjs",
6
6
  "main": "./cjs/index.js",