@blocklet/sdk 1.8.59 → 1.8.60

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.d.ts CHANGED
@@ -1,7 +1,4 @@
1
- type BlockletPreferences = {
2
- [key: string]: any;
3
- };
4
- declare const env: Readonly<{
1
+ declare const _default: Readonly<{
5
2
  appId: string;
6
3
  appName: string;
7
4
  appDescription: string;
@@ -11,6 +8,8 @@ declare const env: Readonly<{
11
8
  cacheDir: string;
12
9
  mode: string;
13
10
  appStorageEndpoint: string;
14
- preferences: BlockletPreferences;
11
+ preferences: {
12
+ [key: string]: any;
13
+ };
15
14
  }>;
16
- export = env;
15
+ export = _default;
package/lib/env.js CHANGED
@@ -1,25 +1,3 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- const constant_1 = require("@blocklet/constant");
6
- const try_json_parse_1 = __importDefault(require("try-json-parse"));
7
- const preferences = Object.keys(process.env)
8
- .filter((x) => x.startsWith(constant_1.BLOCKLET_PREFERENCE_PREFIX))
9
- .reduce((acc, x) => {
10
- acc[x.replace(constant_1.BLOCKLET_PREFERENCE_PREFIX, '')] = (0, try_json_parse_1.default)(process.env[x]);
11
- return acc;
12
- }, {});
13
- const env = Object.freeze({
14
- appId: process.env.BLOCKLET_APP_ID,
15
- appName: process.env.BLOCKLET_APP_NAME,
16
- appDescription: process.env.BLOCKLET_APP_DESCRIPTION,
17
- appUrl: process.env.BLOCKLET_APP_URL,
18
- isComponent: process.env.BLOCKLET_DID !== process.env.BLOCKLET_REAL_DID,
19
- dataDir: process.env.BLOCKLET_DATA_DIR,
20
- cacheDir: process.env.BLOCKLET_CACHE_DIR,
21
- mode: process.env.BLOCKLET_MODE,
22
- appStorageEndpoint: process.env.BLOCKLET_APP_SPACE_ENDPOINT,
23
- preferences,
24
- });
25
- module.exports = env;
2
+ const env_1 = require("./util/env");
3
+ module.exports = (0, env_1.parseEnv)();
@@ -0,0 +1,17 @@
1
+ /// <reference types="node" />
2
+ type BlockletPreferences = {
3
+ [key: string]: any;
4
+ };
5
+ export declare function parseEnv(env?: NodeJS.ProcessEnv): Readonly<{
6
+ appId: string;
7
+ appName: string;
8
+ appDescription: string;
9
+ appUrl: string;
10
+ isComponent: boolean;
11
+ dataDir: string;
12
+ cacheDir: string;
13
+ mode: string;
14
+ appStorageEndpoint: string;
15
+ preferences: BlockletPreferences;
16
+ }>;
17
+ export {};
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseEnv = void 0;
4
+ const constant_1 = require("@blocklet/constant");
5
+ function parseEnv(env = process.env) {
6
+ const preferences = Object.keys(env)
7
+ .filter((x) => x.startsWith(constant_1.BLOCKLET_PREFERENCE_PREFIX))
8
+ .reduce((acc, x) => {
9
+ const key = x.replace(constant_1.BLOCKLET_PREFERENCE_PREFIX, '');
10
+ try {
11
+ acc[key] = JSON.parse(env[x]);
12
+ }
13
+ catch (_a) {
14
+ acc[key] = env[x];
15
+ }
16
+ return acc;
17
+ }, {});
18
+ return Object.freeze({
19
+ appId: env.BLOCKLET_APP_ID,
20
+ appName: env.BLOCKLET_APP_NAME,
21
+ appDescription: env.BLOCKLET_APP_DESCRIPTION,
22
+ appUrl: env.BLOCKLET_APP_URL,
23
+ isComponent: env.BLOCKLET_DID !== env.BLOCKLET_REAL_DID,
24
+ dataDir: env.BLOCKLET_DATA_DIR,
25
+ cacheDir: env.BLOCKLET_CACHE_DIR,
26
+ mode: env.BLOCKLET_MODE,
27
+ appStorageEndpoint: env.BLOCKLET_APP_SPACE_ENDPOINT,
28
+ preferences,
29
+ });
30
+ }
31
+ exports.parseEnv = parseEnv;
package/lib/version.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- declare const version = "1.8.59";
1
+ declare const version = "1.8.60";
2
2
  export { version };
3
3
  declare const _default: {
4
4
  version: string;
package/lib/version.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = void 0;
4
- const version = '1.8.59';
4
+ const version = '1.8.60';
5
5
  exports.version = version;
6
6
  exports.default = { version };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.8.59",
6
+ "version": "1.8.60",
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,13 +26,13 @@
26
26
  "author": "linchen1987 <linchen.1987@foxmail.com> (http://github.com/linchen1987)",
27
27
  "license": "MIT",
28
28
  "dependencies": {
29
- "@abtnode/client": "1.8.59",
30
- "@abtnode/constant": "1.8.59",
29
+ "@abtnode/client": "1.8.60",
30
+ "@abtnode/constant": "1.8.60",
31
31
  "@arcblock/did-auth": "1.18.34",
32
32
  "@arcblock/jwt": "1.18.34",
33
33
  "@arcblock/ws": "1.18.34",
34
- "@blocklet/constant": "1.8.59",
35
- "@blocklet/meta": "1.8.59",
34
+ "@blocklet/constant": "1.8.60",
35
+ "@blocklet/meta": "1.8.60",
36
36
  "@did-connect/authenticator": "^2.1.33",
37
37
  "@did-connect/handler": "^2.1.33",
38
38
  "@nedb/core": "^2.1.2",
@@ -44,7 +44,6 @@
44
44
  "json-stable-stringify": "^1.0.1",
45
45
  "lodash": "^4.17.21",
46
46
  "lru-cache": "^6.0.0",
47
- "try-json-parse": "^1.0.0",
48
47
  "url-join": "^4.0.1"
49
48
  },
50
49
  "resolutions": {
@@ -69,5 +68,5 @@
69
68
  "ts-node": "^10.9.1",
70
69
  "typescript": "^4.8.4"
71
70
  },
72
- "gitHead": "2cc84bf7f971585a6cc29b566d33c0a74d1ee94a"
71
+ "gitHead": "0a56dc596f58d83f22d1ea0d0145d84e7151f5be"
73
72
  }