@nft-studio/js 0.1.22 → 0.1.23
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/cjs/index.d.ts +0 -18
- package/lib/cjs/libs/env.d.ts +9 -3
- package/lib/cjs/libs/env.js +25 -44
- package/lib/es/index.d.ts +0 -18
- package/lib/es/libs/env.d.ts +9 -3
- package/lib/es/libs/env.js +28 -44
- package/package.json +1 -1
package/lib/cjs/index.d.ts
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import env from './libs/env';
|
|
2
|
-
import * as utils from './libs/utils';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
env: {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
chainHost: string;
|
|
7
|
-
makerUrl: string | null;
|
|
8
|
-
blenderUrl: string | null;
|
|
9
|
-
storeUrl: string | null;
|
|
10
|
-
didSpaceEndpoint: string | null;
|
|
11
|
-
makerComponentInfo: any;
|
|
12
|
-
blenderComponentInfo: any;
|
|
13
|
-
storeComponentInfo: any;
|
|
14
|
-
};
|
|
15
|
-
utils: typeof utils;
|
|
16
|
-
};
|
|
17
|
-
export default _default;
|
|
18
|
-
export { env, utils };
|
package/lib/cjs/libs/env.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
interface EnvMap {
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
chainHost: string;
|
|
4
4
|
makerUrl: string | null;
|
|
5
5
|
blenderUrl: string | null;
|
|
6
6
|
storeUrl: string | null;
|
|
7
|
+
paymentKitUrl: string | null;
|
|
7
8
|
didSpaceEndpoint: string | null;
|
|
8
9
|
makerComponentInfo: any;
|
|
9
10
|
blenderComponentInfo: any;
|
|
10
11
|
storeComponentInfo: any;
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
paymentKitComponentInfo: any;
|
|
13
|
+
isMultiTenant: boolean;
|
|
14
|
+
canvasNodeDownloadPrefix: string;
|
|
15
|
+
defaultMultiplier: number;
|
|
16
|
+
}
|
|
17
|
+
declare const env: EnvMap;
|
|
18
|
+
export default env;
|
package/lib/cjs/libs/env.js
CHANGED
|
@@ -6,53 +6,34 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
|
|
7
7
|
var _config = _interopRequireDefault(require("@blocklet/sdk/lib/config"));
|
|
8
8
|
var _component = _interopRequireDefault(require("@blocklet/sdk/lib/component"));
|
|
9
|
-
var _logger = _interopRequireDefault(require("./logger"));
|
|
10
9
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
11
|
-
let envMap = {};
|
|
12
10
|
const getComponentInfo = did => {
|
|
13
11
|
return _config.default.components.find(item => item.did === did) || {};
|
|
14
12
|
};
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return _component.default.getComponentWebEndpoint("z8ia1ieY5KhEC4LMRETzS5nUwD7PvAND8qkfX");
|
|
30
|
-
},
|
|
31
|
-
get storeUrl() {
|
|
32
|
-
return _component.default.getComponentWebEndpoint("z8iZqkCjLP6TZpR12tT3jESWxB8SGzNsx8nZa");
|
|
33
|
-
},
|
|
34
|
-
get paymentKitUrl() {
|
|
35
|
-
return _component.default.getComponentWebEndpoint("z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk");
|
|
36
|
-
},
|
|
37
|
-
get makerComponentInfo() {
|
|
38
|
-
return getComponentInfo("z8ia2birZzhjbXqKnxPUUivmqErdsf3724tr6");
|
|
39
|
-
},
|
|
40
|
-
get blenderComponentInfo() {
|
|
41
|
-
return getComponentInfo("z8ia1ieY5KhEC4LMRETzS5nUwD7PvAND8qkfX");
|
|
42
|
-
},
|
|
43
|
-
get storeComponentInfo() {
|
|
44
|
-
return getComponentInfo("z8iZqkCjLP6TZpR12tT3jESWxB8SGzNsx8nZa");
|
|
45
|
-
},
|
|
46
|
-
get paymentKitComponentInfo() {
|
|
47
|
-
return getComponentInfo("z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk");
|
|
48
|
-
},
|
|
49
|
-
get didSpaceEndpoint() {
|
|
50
|
-
return _config.default.env.APP_SPACE_ENDPOINT || _config.default.env.BLOCKLET_APP_SPACE_ENDPOINT || process.env.APP_SPACE_ENDPOINT || process.env.BLOCKLET_APP_SPACE_ENDPOINT;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
13
|
+
const envGetters = {
|
|
14
|
+
isMultiTenant: () => _config.default.env.tenantMode === "multiple",
|
|
15
|
+
chainHost: () => _config.default.env.CHAIN_HOST || process.env.CHAIN_HOST || "",
|
|
16
|
+
makerUrl: () => _component.default.getComponentWebEndpoint("z8ia2birZzhjbXqKnxPUUivmqErdsf3724tr6"),
|
|
17
|
+
blenderUrl: () => _component.default.getComponentWebEndpoint("z8ia1ieY5KhEC4LMRETzS5nUwD7PvAND8qkfX"),
|
|
18
|
+
storeUrl: () => _component.default.getComponentWebEndpoint("z8iZqkCjLP6TZpR12tT3jESWxB8SGzNsx8nZa"),
|
|
19
|
+
paymentKitUrl: () => _component.default.getComponentWebEndpoint("z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk"),
|
|
20
|
+
makerComponentInfo: () => getComponentInfo("z8ia2birZzhjbXqKnxPUUivmqErdsf3724tr6"),
|
|
21
|
+
blenderComponentInfo: () => getComponentInfo("z8ia1ieY5KhEC4LMRETzS5nUwD7PvAND8qkfX"),
|
|
22
|
+
storeComponentInfo: () => getComponentInfo("z8iZqkCjLP6TZpR12tT3jESWxB8SGzNsx8nZa"),
|
|
23
|
+
paymentKitComponentInfo: () => getComponentInfo("z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk"),
|
|
24
|
+
didSpaceEndpoint: () => _config.default.env.APP_SPACE_ENDPOINT || _config.default.env.BLOCKLET_APP_SPACE_ENDPOINT || process.env.APP_SPACE_ENDPOINT || process.env.BLOCKLET_APP_SPACE_ENDPOINT,
|
|
25
|
+
canvasNodeDownloadPrefix: () => _config.default.env.CANVAS_NODE_DOWNLOAD_PREFIX || process.env.CANVAS_NODE_DOWNLOAD_PREFIX || "",
|
|
26
|
+
defaultMultiplier: () => _config.default.env.DEFAULT_MULTIPLIER || process.env.DEFAULT_MULTIPLIER || 1
|
|
53
27
|
};
|
|
54
|
-
|
|
55
|
-
_config.default.
|
|
56
|
-
|
|
28
|
+
const env = new Proxy({
|
|
29
|
+
..._config.default.env,
|
|
30
|
+
...Object.fromEntries(Object.entries(envGetters).map(([key, getter]) => [key, getter()]))
|
|
31
|
+
}, {
|
|
32
|
+
get(target, prop) {
|
|
33
|
+
if (prop in envGetters) {
|
|
34
|
+
return envGetters[prop]();
|
|
35
|
+
}
|
|
36
|
+
return _config.default.env[prop];
|
|
37
|
+
}
|
|
57
38
|
});
|
|
58
|
-
module.exports =
|
|
39
|
+
module.exports = env;
|
package/lib/es/index.d.ts
CHANGED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import env from './libs/env';
|
|
2
|
-
import * as utils from './libs/utils';
|
|
3
|
-
declare const _default: {
|
|
4
|
-
env: {
|
|
5
|
-
[key: string]: any;
|
|
6
|
-
chainHost: string;
|
|
7
|
-
makerUrl: string | null;
|
|
8
|
-
blenderUrl: string | null;
|
|
9
|
-
storeUrl: string | null;
|
|
10
|
-
didSpaceEndpoint: string | null;
|
|
11
|
-
makerComponentInfo: any;
|
|
12
|
-
blenderComponentInfo: any;
|
|
13
|
-
storeComponentInfo: any;
|
|
14
|
-
};
|
|
15
|
-
utils: typeof utils;
|
|
16
|
-
};
|
|
17
|
-
export default _default;
|
|
18
|
-
export { env, utils };
|
package/lib/es/libs/env.d.ts
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
interface EnvMap {
|
|
2
2
|
[key: string]: any;
|
|
3
3
|
chainHost: string;
|
|
4
4
|
makerUrl: string | null;
|
|
5
5
|
blenderUrl: string | null;
|
|
6
6
|
storeUrl: string | null;
|
|
7
|
+
paymentKitUrl: string | null;
|
|
7
8
|
didSpaceEndpoint: string | null;
|
|
8
9
|
makerComponentInfo: any;
|
|
9
10
|
blenderComponentInfo: any;
|
|
10
11
|
storeComponentInfo: any;
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
paymentKitComponentInfo: any;
|
|
13
|
+
isMultiTenant: boolean;
|
|
14
|
+
canvasNodeDownloadPrefix: string;
|
|
15
|
+
defaultMultiplier: number;
|
|
16
|
+
}
|
|
17
|
+
declare const env: EnvMap;
|
|
18
|
+
export default env;
|
package/lib/es/libs/env.js
CHANGED
|
@@ -1,51 +1,35 @@
|
|
|
1
1
|
import config from "@blocklet/sdk/lib/config";
|
|
2
2
|
import component from "@blocklet/sdk/lib/component";
|
|
3
|
-
import logger from "./logger.js";
|
|
4
|
-
let envMap = {};
|
|
5
3
|
const getComponentInfo = (did) => {
|
|
6
4
|
return config.components.find((item) => item.did === did) || {};
|
|
7
5
|
};
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
const envGetters = {
|
|
7
|
+
isMultiTenant: () => config.env.tenantMode === "multiple",
|
|
8
|
+
chainHost: () => config.env.CHAIN_HOST || process.env.CHAIN_HOST || "",
|
|
9
|
+
makerUrl: () => component.getComponentWebEndpoint("z8ia2birZzhjbXqKnxPUUivmqErdsf3724tr6"),
|
|
10
|
+
blenderUrl: () => component.getComponentWebEndpoint("z8ia1ieY5KhEC4LMRETzS5nUwD7PvAND8qkfX"),
|
|
11
|
+
storeUrl: () => component.getComponentWebEndpoint("z8iZqkCjLP6TZpR12tT3jESWxB8SGzNsx8nZa"),
|
|
12
|
+
paymentKitUrl: () => component.getComponentWebEndpoint("z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk"),
|
|
13
|
+
makerComponentInfo: () => getComponentInfo("z8ia2birZzhjbXqKnxPUUivmqErdsf3724tr6"),
|
|
14
|
+
blenderComponentInfo: () => getComponentInfo("z8ia1ieY5KhEC4LMRETzS5nUwD7PvAND8qkfX"),
|
|
15
|
+
storeComponentInfo: () => getComponentInfo("z8iZqkCjLP6TZpR12tT3jESWxB8SGzNsx8nZa"),
|
|
16
|
+
paymentKitComponentInfo: () => getComponentInfo("z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk"),
|
|
17
|
+
didSpaceEndpoint: () => config.env.APP_SPACE_ENDPOINT || config.env.BLOCKLET_APP_SPACE_ENDPOINT || process.env.APP_SPACE_ENDPOINT || process.env.BLOCKLET_APP_SPACE_ENDPOINT,
|
|
18
|
+
canvasNodeDownloadPrefix: () => config.env.CANVAS_NODE_DOWNLOAD_PREFIX || process.env.CANVAS_NODE_DOWNLOAD_PREFIX || "",
|
|
19
|
+
defaultMultiplier: () => config.env.DEFAULT_MULTIPLIER || process.env.DEFAULT_MULTIPLIER || 1
|
|
20
|
+
};
|
|
21
|
+
const env = new Proxy(
|
|
22
|
+
{
|
|
11
23
|
...config.env,
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
get
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return
|
|
20
|
-
},
|
|
21
|
-
get blenderUrl() {
|
|
22
|
-
return component.getComponentWebEndpoint("z8ia1ieY5KhEC4LMRETzS5nUwD7PvAND8qkfX");
|
|
23
|
-
},
|
|
24
|
-
get storeUrl() {
|
|
25
|
-
return component.getComponentWebEndpoint("z8iZqkCjLP6TZpR12tT3jESWxB8SGzNsx8nZa");
|
|
26
|
-
},
|
|
27
|
-
get paymentKitUrl() {
|
|
28
|
-
return component.getComponentWebEndpoint("z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk");
|
|
29
|
-
},
|
|
30
|
-
get makerComponentInfo() {
|
|
31
|
-
return getComponentInfo("z8ia2birZzhjbXqKnxPUUivmqErdsf3724tr6");
|
|
32
|
-
},
|
|
33
|
-
get blenderComponentInfo() {
|
|
34
|
-
return getComponentInfo("z8ia1ieY5KhEC4LMRETzS5nUwD7PvAND8qkfX");
|
|
35
|
-
},
|
|
36
|
-
get storeComponentInfo() {
|
|
37
|
-
return getComponentInfo("z8iZqkCjLP6TZpR12tT3jESWxB8SGzNsx8nZa");
|
|
38
|
-
},
|
|
39
|
-
get paymentKitComponentInfo() {
|
|
40
|
-
return getComponentInfo("z2qaCNvKMv5GjouKdcDWexv6WqtHbpNPQDnAk");
|
|
41
|
-
},
|
|
42
|
-
get didSpaceEndpoint() {
|
|
43
|
-
return config.env.APP_SPACE_ENDPOINT || config.env.BLOCKLET_APP_SPACE_ENDPOINT || process.env.APP_SPACE_ENDPOINT || process.env.BLOCKLET_APP_SPACE_ENDPOINT;
|
|
24
|
+
...Object.fromEntries(Object.entries(envGetters).map(([key, getter]) => [key, getter()]))
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
get(target, prop) {
|
|
28
|
+
if (prop in envGetters) {
|
|
29
|
+
return envGetters[prop]();
|
|
30
|
+
}
|
|
31
|
+
return config.env[prop];
|
|
44
32
|
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
config.events.on(config.Events.envUpdate, () => {
|
|
49
|
-
updateEnv();
|
|
50
|
-
});
|
|
51
|
-
export default envMap;
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
export default env;
|