@blocklet/sdk 1.16.54-beta-20251023-041534-36eec6b9 → 1.16.54-beta-20251027-105624-dfa978f8

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/lib/config.d.ts CHANGED
@@ -11,15 +11,18 @@ declare const Events: {
11
11
  };
12
12
  declare let logger: {
13
13
  info: {
14
+ (...data: any[]): void;
14
15
  (...data: any[]): void;
15
16
  (message?: any, ...optionalParams: any[]): void;
16
17
  };
17
18
  debug: (...args: any[]) => void;
18
19
  warn: {
20
+ (...data: any[]): void;
19
21
  (...data: any[]): void;
20
22
  (message?: any, ...optionalParams: any[]): void;
21
23
  };
22
24
  error: {
25
+ (...data: any[]): void;
23
26
  (...data: any[]): void;
24
27
  (message?: any, ...optionalParams: any[]): void;
25
28
  };
@@ -94,15 +97,18 @@ TComponent, events, Events, getBlockletJs, _handleComponentUpdateOld, _handleApp
94
97
  declare const _default: {
95
98
  logger: {
96
99
  info: {
100
+ (...data: any[]): void;
97
101
  (...data: any[]): void;
98
102
  (message?: any, ...optionalParams: any[]): void;
99
103
  };
100
104
  debug: (...args: any[]) => void;
101
105
  warn: {
106
+ (...data: any[]): void;
102
107
  (...data: any[]): void;
103
108
  (message?: any, ...optionalParams: any[]): void;
104
109
  };
105
110
  error: {
111
+ (...data: any[]): void;
106
112
  (...data: any[]): void;
107
113
  (message?: any, ...optionalParams: any[]): void;
108
114
  };
@@ -77,9 +77,10 @@ class BlockletClient extends server_js_1.default {
77
77
  }
78
78
  async _getAuthHeaders() {
79
79
  const headers = await super._getAuthHeaders();
80
- // BLOCKLET_DID is always same as BLOCKLET_APP_PID in structV2 application
81
- headers['x-access-blocklet'] = process.env.BLOCKLET_DID;
82
- headers['x-access-component'] = process.env.BLOCKLET_COMPONENT_DID;
80
+ // Use BLOCKLET_APP_PID to match the DID used for deriving BLOCKLET_APP_ASK
81
+ // BLOCKLET_APP_ASK is derived from root.appPid, so we must use BLOCKLET_APP_PID here
82
+ headers['x-access-blocklet'] = process.env.BLOCKLET_APP_PID;
83
+ headers['x-component-did'] = process.env.BLOCKLET_COMPONENT_DID;
83
84
  return headers;
84
85
  }
85
86
  }
@@ -0,0 +1 @@
1
+ export default function testSetup(): void;
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = setupJest;
7
- // Setup blocklet environments for jest
6
+ exports.default = testSetup;
7
+ // Setup blocklet environments
8
8
  const os_1 = __importDefault(require("os"));
9
9
  const fs_1 = __importDefault(require("fs"));
10
10
  const path_1 = __importDefault(require("path"));
@@ -12,7 +12,7 @@ const parse_1 = require("@blocklet/meta/lib/parse");
12
12
  const mcrypto_1 = require("@ocap/mcrypto");
13
13
  const wallet_1 = require("@ocap/wallet");
14
14
  const did_ext_1 = require("@arcblock/did-ext");
15
- function setupJest() {
15
+ function testSetup() {
16
16
  try {
17
17
  const dir = process.cwd();
18
18
  const wallet = (0, wallet_1.fromRandom)({ role: mcrypto_1.types.RoleType.ROLE_APPLICATION });
@@ -56,6 +56,6 @@ function setupJest() {
56
56
  ]);
57
57
  }
58
58
  catch (err) {
59
- console.error('Failed to setup blocklet environment for jest', err);
59
+ console.error('Failed to setup blocklet environment for test', err);
60
60
  }
61
61
  }
@@ -0,0 +1 @@
1
+ export default function testTeardown(): void;
@@ -3,13 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = setupJest;
7
- // Setup blocklet environments for jest
6
+ exports.default = testTeardown;
7
+ // Setup blocklet environments for test
8
8
  const os_1 = __importDefault(require("os"));
9
9
  const fs_extra_1 = __importDefault(require("fs-extra"));
10
10
  const path_1 = __importDefault(require("path"));
11
11
  const parse_1 = require("@blocklet/meta/lib/parse");
12
- function setupJest() {
12
+ function testTeardown() {
13
13
  try {
14
14
  const dir = process.cwd();
15
15
  const meta = (0, parse_1.parse)(dir, { ensureComponentStore: false });
@@ -19,6 +19,6 @@ function setupJest() {
19
19
  }
20
20
  }
21
21
  catch (err) {
22
- console.error('Failed to tear blocklet environment for jest', err);
22
+ console.error('Failed to tear blocklet environment for test', err);
23
23
  }
24
24
  }
@@ -15,7 +15,7 @@ const semver_1 = __importDefault(require("semver"));
15
15
  const qs_1 = __importDefault(require("qs"));
16
16
  const wallet_1 = require("../wallet");
17
17
  const { getPkWallet } = wallet_1.getWallet;
18
- const verify = async (data, sig, { type, appSk, appPk, } = {}) => {
18
+ const verify = async (data, sig, { type, appSk = process.env.BLOCKLET_APP_ASK || process.env.BLOCKLET_APP_SK, appPk, } = {}) => {
19
19
  try {
20
20
  if (!sig) {
21
21
  throw new Error('empty sig');
@@ -35,8 +35,9 @@ const verify = async (data, sig, { type, appSk, appPk, } = {}) => {
35
35
  }
36
36
  };
37
37
  exports.verify = verify;
38
+ const sign = async (data, { type, appSk = process.env.BLOCKLET_APP_ASK || process.env.BLOCKLET_APP_SK } = {}
38
39
  // eslint-disable-next-line require-await
39
- const sign = async (data, { type, appSk } = {}) => {
40
+ ) => {
40
41
  const wallet = (0, wallet_1.getWallet)(type, appSk);
41
42
  return wallet.sign((0, json_stable_stringify_1.default)(data || {}));
42
43
  };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.54-beta-20251023-041534-36eec6b9",
6
+ "version": "1.16.54-beta-20251027-105624-dfa978f8",
7
7
  "description": "graphql client to read/write data on abt node",
8
8
  "homepage": "https://www.arcblock.io/docs/blocklet-sdk-nodejs",
9
9
  "main": "lib/index.js",
@@ -16,8 +16,8 @@
16
16
  "verify": "npm run lint:fix && npm run test && npm run build",
17
17
  "lint": "eslint src tests service",
18
18
  "lint:fix": "npm run lint -- --fix",
19
- "test": "bun test",
20
- "coverage": "bun test --coverage",
19
+ "test": "bun test --bail --timeout 30000",
20
+ "coverage": "bun test --bail --timeout 30000 --coverage",
21
21
  "clean": "rm -fr lib",
22
22
  "prebuild": "npm run clean && npm run types",
23
23
  "types": "rm -rf ./src/types && node tools/version.js && ts-node tools/types.js && rm -f ./src/types/index.ts && prettier --write ./src/types/notification.ts",
@@ -28,19 +28,19 @@
28
28
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
29
29
  "license": "Apache-2.0",
30
30
  "dependencies": {
31
- "@abtnode/constant": "1.16.54-beta-20251023-041534-36eec6b9",
32
- "@abtnode/db-cache": "1.16.54-beta-20251023-041534-36eec6b9",
33
- "@abtnode/util": "1.16.54-beta-20251023-041534-36eec6b9",
31
+ "@abtnode/constant": "1.16.54-beta-20251027-105624-dfa978f8",
32
+ "@abtnode/db-cache": "1.16.54-beta-20251027-105624-dfa978f8",
33
+ "@abtnode/util": "1.16.54-beta-20251027-105624-dfa978f8",
34
34
  "@arcblock/did": "^1.26.3",
35
35
  "@arcblock/did-connect-js": "^1.26.3",
36
36
  "@arcblock/did-ext": "^1.26.3",
37
37
  "@arcblock/jwt": "^1.26.3",
38
38
  "@arcblock/ws": "^1.26.3",
39
- "@blocklet/constant": "1.16.54-beta-20251023-041534-36eec6b9",
40
- "@blocklet/env": "1.16.54-beta-20251023-041534-36eec6b9",
39
+ "@blocklet/constant": "1.16.54-beta-20251027-105624-dfa978f8",
40
+ "@blocklet/env": "1.16.54-beta-20251027-105624-dfa978f8",
41
41
  "@blocklet/error": "^0.2.5",
42
- "@blocklet/meta": "1.16.54-beta-20251023-041534-36eec6b9",
43
- "@blocklet/server-js": "1.16.54-beta-20251023-041534-36eec6b9",
42
+ "@blocklet/meta": "1.16.54-beta-20251027-105624-dfa978f8",
43
+ "@blocklet/server-js": "1.16.54-beta-20251027-105624-dfa978f8",
44
44
  "@blocklet/theme": "^3.1.51",
45
45
  "@did-connect/authenticator": "^2.2.8",
46
46
  "@did-connect/handler": "^2.2.8",
@@ -70,7 +70,6 @@
70
70
  "devDependencies": {
71
71
  "@arcblock/eslint-config-ts": "^0.3.3",
72
72
  "@types/express": "^5.0.0",
73
- "@types/jest": "^29.5.13",
74
73
  "@types/json-stable-stringify": "^1.0.36",
75
74
  "@types/lodash": "^4.17.20",
76
75
  "@types/node": "^22.7.5",
@@ -79,13 +78,11 @@
79
78
  "axios-mock-adapter": "^2.1.0",
80
79
  "detect-port": "^1.5.1",
81
80
  "eslint": "^8.57.0",
82
- "jest": "^29.7.0",
83
81
  "joi-to-typescript": "^4.14.0",
84
82
  "json-stable-stringify": "^1.0.1",
85
83
  "prettier": "^3.3.2",
86
- "ts-jest": "^29.2.5",
87
84
  "ts-node": "^10.9.1",
88
85
  "typescript": "^5.6.3"
89
86
  },
90
- "gitHead": "a642bc21c7c0f4aaccae2758d6b1d836d078bc1b"
87
+ "gitHead": "03b0bb26807c6c427ca700f48566ecc913f1353e"
91
88
  }
@@ -1 +0,0 @@
1
- export default function setupJest(): void;
@@ -1 +0,0 @@
1
- export default function setupJest(): void;