@blocklet/sdk 1.16.15-beta-d464647a → 1.16.15-beta-324519fc

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
@@ -26,11 +26,6 @@ declare const logger: {
26
26
  };
27
27
  };
28
28
  declare const env: {
29
- componentDid: string;
30
- dataDir: string;
31
- cacheDir: string;
32
- mode: string;
33
- preferences: any;
34
29
  appId: string;
35
30
  appPid: string;
36
31
  appIds: string[];
@@ -38,12 +33,18 @@ declare const env: {
38
33
  appDescription: string;
39
34
  appUrl: string;
40
35
  isComponent: boolean;
36
+ dataDir: string;
37
+ cacheDir: string;
38
+ mode: string;
41
39
  appStorageEndpoint: string;
42
40
  serverVersion: string;
43
41
  languages: {
44
42
  code: string;
45
43
  name: string;
46
44
  }[];
45
+ preferences: Record<string, any>;
46
+ componentDid: string;
47
+ [key: string]: any;
47
48
  };
48
49
  type MountPoint = TComponentInternalInfo & {
49
50
  webEndpoint?: string;
@@ -91,11 +92,7 @@ declare const _default: {
91
92
  };
92
93
  };
93
94
  env: {
94
- componentDid: string;
95
- dataDir: string;
96
- cacheDir: string;
97
- mode: string;
98
- preferences: any;
95
+ [key: string]: any;
99
96
  appId: string;
100
97
  appPid: string;
101
98
  appIds: string[];
@@ -103,12 +100,17 @@ declare const _default: {
103
100
  appDescription: string;
104
101
  appUrl: string;
105
102
  isComponent: boolean;
103
+ dataDir: string;
104
+ cacheDir: string;
105
+ mode: string;
106
106
  appStorageEndpoint: string;
107
107
  serverVersion: string;
108
108
  languages: {
109
109
  code: string;
110
110
  name: string;
111
111
  }[];
112
+ preferences: Record<string, any>;
113
+ componentDid: string;
112
114
  };
113
115
  components: TComponents;
114
116
  events: EventEmitter;
@@ -3,11 +3,27 @@ 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
- const env_1 = require("@blocklet/env");
6
+ const constant_1 = require("@blocklet/constant");
7
7
  const semver_1 = __importDefault(require("semver"));
8
+ const path_1 = __importDefault(require("path"));
9
+ const fs_1 = __importDefault(require("fs"));
10
+ let serverVersionFromDisk = '';
11
+ const appDataDir = process.env.BLOCKLET_APP_DATA_DIR;
12
+ if (appDataDir) {
13
+ try {
14
+ const configFile = path_1.default.join(appDataDir, constant_1.APP_CONFIG_FILE_PATH);
15
+ if (fs_1.default.existsSync(configFile)) {
16
+ const config = JSON.parse(fs_1.default.readFileSync(configFile).toString());
17
+ serverVersionFromDisk = config.env.serverVersion;
18
+ }
19
+ }
20
+ catch (error) {
21
+ console.error(error);
22
+ }
23
+ }
8
24
  class ServerVersion {
9
25
  constructor() {
10
- this.version = env_1.serverVersion || process.env.ABT_NODE_VERSION || process.env.ABT_NODE || '0.0.0';
26
+ this.version = serverVersionFromDisk || process.env.ABT_NODE_VERSION || process.env.ABT_NODE || '0.0.0';
11
27
  }
12
28
  gte(version) {
13
29
  return semver_1.default.gte(this.version, version);
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.15-beta-d464647a",
6
+ "version": "1.16.15-beta-324519fc",
7
7
  "description": "graphql client to read/write data on abt node",
8
8
  "main": "lib/index.js",
9
9
  "typings": "lib/index.d.ts",
@@ -26,15 +26,15 @@
26
26
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
27
27
  "license": "Apache-2.0",
28
28
  "dependencies": {
29
- "@abtnode/client": "1.16.15-beta-d464647a",
30
- "@abtnode/constant": "1.16.15-beta-d464647a",
29
+ "@abtnode/client": "1.16.15-beta-324519fc",
30
+ "@abtnode/constant": "1.16.15-beta-324519fc",
31
31
  "@arcblock/did": "1.18.89",
32
32
  "@arcblock/did-auth": "1.18.89",
33
33
  "@arcblock/jwt": "1.18.89",
34
34
  "@arcblock/ws": "1.18.89",
35
- "@blocklet/constant": "1.16.15-beta-d464647a",
36
- "@blocklet/env": "1.16.15-beta-d464647a",
37
- "@blocklet/meta": "1.16.15-beta-d464647a",
35
+ "@blocklet/constant": "1.16.15-beta-324519fc",
36
+ "@blocklet/env": "1.16.15-beta-324519fc",
37
+ "@blocklet/meta": "1.16.15-beta-324519fc",
38
38
  "@did-connect/authenticator": "^2.2.0",
39
39
  "@did-connect/handler": "^2.2.0",
40
40
  "@nedb/core": "^2.1.5",
@@ -74,5 +74,5 @@
74
74
  "ts-node": "^10.9.1",
75
75
  "typescript": "^5.0.4"
76
76
  },
77
- "gitHead": "117b29484cbc36434ebdd635f100eb02a5cf7732"
77
+ "gitHead": "b1a9384dc9985e590bee01548ed4f38cba470a6b"
78
78
  }