@blocklet/sdk 1.7.14 → 1.7.15

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/env.js CHANGED
@@ -1,4 +1,4 @@
1
- module.exports = {
1
+ module.exports = Object.freeze({
2
2
  appId: process.env.BLOCKLET_APP_ID,
3
3
  appName: process.env.BLOCKLET_APP_NAME,
4
4
  appDescription: process.env.BLOCKLET_APP_DESCRIPTION,
@@ -6,4 +6,4 @@ module.exports = {
6
6
  isComponent: process.env.BLOCKLET_DID !== process.env.BLOCKLET_REAL_DID,
7
7
  dataDir: process.env.BLOCKLET_DATA_DIR,
8
8
  cacheDir: process.env.BLOCKLET_CACHE_DIR,
9
- };
9
+ });
@@ -4,6 +4,7 @@ const { types } = require('@ocap/mcrypto');
4
4
  const { WalletType } = require('@ocap/wallet');
5
5
  const { NODE_SERVICES } = require('@abtnode/constant');
6
6
 
7
+ const VERSION = require('../../package.json').version; // version of notification sdk
7
8
  const checkBlockletEnv = require('../util/check-blocklet-env');
8
9
 
9
10
  // Auth 相关的功能 API 都在这里
@@ -20,10 +21,10 @@ const type =
20
21
  : 'eth';
21
22
 
22
23
  class AuthService extends Client {
23
- constructor(httpEndpoint, axios) {
24
+ constructor(httpEndpoint) {
24
25
  checkBlockletEnv();
25
26
 
26
- super(httpEndpoint || `http://127.0.0.1:${process.env.ABT_NODE_PORT}/api/gql`.trim(), axios);
27
+ super(httpEndpoint || `http://127.0.0.1:${process.env.ABT_NODE_PORT}/api/gql`.trim(), `BlockletSDK/${VERSION}`);
27
28
 
28
29
  this.setAuthAccessKey({
29
30
  accessKeyId: process.env.BLOCKLET_APP_ID,
@@ -40,15 +40,21 @@ module.exports = async (
40
40
  const token = JWT.sign(appId, appSk);
41
41
 
42
42
  try {
43
- const { data: res } = await axios.post(`http://127.0.0.1:${port}${SERVICE_PREFIX}/api/sendToUser`, {
44
- apiVersion: VERSION,
45
- data: {
46
- sender: { did, token, appDid: appId },
47
- receiver,
48
- notification,
49
- options: opt,
43
+ const { data: res } = await axios.post(
44
+ `http://127.0.0.1:${port}${SERVICE_PREFIX}/api/sendToUser`,
45
+ {
46
+ apiVersion: VERSION,
47
+ data: {
48
+ sender: { did, token, appDid: appId },
49
+ receiver,
50
+ notification,
51
+ options: opt,
52
+ },
50
53
  },
51
- });
54
+ {
55
+ headers: { 'User-Agent': `BlockletSDK/${VERSION}` },
56
+ }
57
+ );
52
58
 
53
59
  return res;
54
60
  } catch (error) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.7.14",
6
+ "version": "1.7.15",
7
7
  "description": "graphql client to read/write data on abt node",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,16 +19,16 @@
19
19
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@abtnode/client": "1.7.14",
23
- "@abtnode/constant": "1.7.14",
24
- "@abtnode/logger": "1.7.14",
25
- "@arcblock/did-auth": "^1.16.6",
26
- "@arcblock/jwt": "^1.16.6",
27
- "@arcblock/ws": "^1.16.6",
28
- "@blocklet/meta": "1.7.14",
22
+ "@abtnode/client": "1.7.15",
23
+ "@abtnode/constant": "1.7.15",
24
+ "@abtnode/logger": "1.7.15",
25
+ "@arcblock/did-auth": "^1.16.8",
26
+ "@arcblock/jwt": "^1.16.8",
27
+ "@arcblock/ws": "^1.16.8",
28
+ "@blocklet/meta": "1.7.15",
29
29
  "@nedb/core": "^1.2.2",
30
- "@ocap/mcrypto": "^1.16.6",
31
- "@ocap/wallet": "^1.16.6",
30
+ "@ocap/mcrypto": "^1.16.8",
31
+ "@ocap/wallet": "^1.16.8",
32
32
  "axios": "^0.26.1",
33
33
  "fs-extra": "^10.0.1",
34
34
  "joi": "^17.6.0",
@@ -40,5 +40,5 @@
40
40
  "detect-port": "^1.3.0",
41
41
  "jest": "^27.4.5"
42
42
  },
43
- "gitHead": "1f3855e6dc8b6d6c91526264e2f63215df6b962c"
43
+ "gitHead": "d95421b38c281ed41fa7490a707f149aa737f3d3"
44
44
  }