@blocklet/constant 1.16.8 → 1.16.9
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/LICENSE +13 -0
- package/index.js +166 -234
- package/package.json +18 -7
package/LICENSE
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
Copyright 2018-2020 ArcBlock
|
|
2
|
+
|
|
3
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License.
|
|
5
|
+
You may obtain a copy of the License at
|
|
6
|
+
|
|
7
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
|
|
9
|
+
Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
See the License for the specific language governing permissions and
|
|
13
|
+
limitations under the License.
|
package/index.js
CHANGED
|
@@ -1,277 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable prettier/prettier */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.CHAIN_PROP_MAP_REVERSE = exports.CHAIN_PROP_MAP = exports.RESTORE_PROGRESS_STATUS = exports.CHAIN_INFO_CONFIG = exports.BLOCKLET_APP_SPACE_ENDPOINTS = exports.BLOCKLET_CONFIGURABLE_KEY = exports.BLOCKLET_LATEST_REQUIREMENT_ABTNODE = exports.BLOCKLET_LATEST_REQUIREMENT_SERVER = exports.BLOCKLET_LATEST_SPEC_VERSION = exports.BLOCKLET_UPLOADS_DIR = exports.BLOCKLET_DEFAULT_VERSION = exports.BLOCKLET_PREFERENCE_PREFIX = exports.BLOCKLET_PREFERENCE_FILE = exports.BLOCKLET_META_FILE_ALT = exports.BLOCKLET_META_FILE = exports.BLOCKLET_ENTRY_FILE = exports.BLOCKLET_BUNDLE_FILE = exports.BLOCKLET_BUNDLE_FOLDER = exports.BLOCKLET_RELEASE_FILE = exports.BLOCKLET_RELEASE_FOLDER = exports.BLOCKLET_DEFAULT_PATH_REWRITE = exports.BLOCKLET_DEFAULT_PORT_NAME = exports.BLOCKLET_DYNAMIC_PATH_PREFIX = exports.BLOCKLET_INTERFACE_PROTOCOLS = exports.BLOCKLET_INTERFACE_PROTOCOL_UDP = exports.BLOCKLET_INTERFACE_PROTOCOL_TCP = exports.BLOCKLET_INTERFACE_PROTOCOL_HTTP = exports.BLOCKLET_STANDARD_INTERFACES = exports.BLOCKLET_UI_INTERFACES = exports.BLOCKLET_INTERFACE_WELLKNOWN = exports.BLOCKLET_INTERFACE_PUBLIC = exports.BLOCKLET_INTERFACE_TYPES = exports.BLOCKLET_INTERFACE_TYPE_WELLKNOWN = exports.BLOCKLET_INTERFACE_TYPE_SERVICE = exports.BLOCKLET_INTERFACE_TYPE_WEB = exports.BLOCKLET_FACTORY_SHARES = exports.BLOCKLET_MODES = exports.BLOCKLET_ARCHITECTURES = exports.BLOCKLET_PLATFORMS = exports.BlockletEvents = exports.BLOCKLET_GROUPS = exports.BlockletGroup = exports.toBlockletSource = exports.fromBlockletSource = exports.BlockletSource = exports.toBlockletStatus = exports.fromBlockletStatus = exports.BlockletStatus = void 0;
|
|
1
5
|
const fromEntry = (entries) => (v) => {
|
|
2
|
-
|
|
3
|
-
|
|
6
|
+
const match = Object.entries(entries).find((x) => x[1] === Number(v));
|
|
7
|
+
return match ? match[0] : 'unknown';
|
|
4
8
|
};
|
|
5
|
-
|
|
9
|
+
// deprecated: toEntry is same as fromEntry
|
|
6
10
|
const toEntry = (entries) => (v) => Object.keys(entries).find((x) => entries[x] === Number(v));
|
|
7
|
-
|
|
8
11
|
// Blocklet Status
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
deleted: 14,
|
|
12
|
+
exports.BlockletStatus = Object.freeze({
|
|
13
|
+
added: 0,
|
|
14
|
+
downloading: 1,
|
|
15
|
+
downloaded: 2,
|
|
16
|
+
installing: 3,
|
|
17
|
+
installed: 4,
|
|
18
|
+
starting: 5,
|
|
19
|
+
running: 6,
|
|
20
|
+
stopping: 7,
|
|
21
|
+
stopped: 8,
|
|
22
|
+
error: 9,
|
|
23
|
+
upgrading: 10,
|
|
24
|
+
restarting: 11,
|
|
25
|
+
corrupted: 12,
|
|
26
|
+
waiting: 13,
|
|
27
|
+
deleted: 14,
|
|
26
28
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
const toBlockletStatus = toEntry(BlockletStatus);
|
|
30
|
-
|
|
29
|
+
exports.fromBlockletStatus = fromEntry(exports.BlockletStatus);
|
|
30
|
+
exports.toBlockletStatus = toEntry(exports.BlockletStatus); // deprecated
|
|
31
31
|
// Blocklet Source
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
// Installed from a url (similar to Blocklet Store)
|
|
44
|
-
url: 3,
|
|
45
|
-
|
|
46
|
-
// Installed by custom creation
|
|
47
|
-
custom: 4,
|
|
32
|
+
exports.BlockletSource = Object.freeze({
|
|
33
|
+
// Installed from Blocklet Store
|
|
34
|
+
registry: 0,
|
|
35
|
+
// Installed from local development source folder
|
|
36
|
+
local: 1,
|
|
37
|
+
// Installed from uploading bundle directly
|
|
38
|
+
upload: 2,
|
|
39
|
+
// Installed from a url (similar to Blocklet Store)
|
|
40
|
+
url: 3,
|
|
41
|
+
// Installed by custom creation
|
|
42
|
+
custom: 4,
|
|
48
43
|
});
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const toBlockletSource = toEntry(BlockletSource);
|
|
52
|
-
|
|
44
|
+
exports.fromBlockletSource = fromEntry(exports.BlockletSource);
|
|
45
|
+
exports.toBlockletSource = toEntry(exports.BlockletSource); // deprecated
|
|
53
46
|
// Blocklet Group(Type)
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
// This type is used to combine other component blocklets
|
|
66
|
-
// No instance will be spawned at runtime
|
|
67
|
-
gateway: 'gateway',
|
|
47
|
+
exports.BlockletGroup = Object.freeze({
|
|
48
|
+
// Only static website
|
|
49
|
+
// The website is served by by Blocklet Server at runtime
|
|
50
|
+
static: 'static',
|
|
51
|
+
// The runtime instance is provided by its own backend server
|
|
52
|
+
dapp: 'dapp',
|
|
53
|
+
starter: false,
|
|
54
|
+
// This type is used to combine other component blocklets
|
|
55
|
+
// No instance will be spawned at runtime
|
|
56
|
+
gateway: 'gateway',
|
|
68
57
|
});
|
|
69
|
-
|
|
70
|
-
const BLOCKLET_GROUPS = ['dapp', 'static', 'gateway'];
|
|
71
|
-
|
|
58
|
+
exports.BLOCKLET_GROUPS = ['dapp', 'static', 'gateway'];
|
|
72
59
|
// Blocklet Events
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
certError: 'blocklet.certError',
|
|
109
|
-
certIssued: 'blocklet.certIssued',
|
|
110
|
-
|
|
111
|
-
// did-space
|
|
112
|
-
spaceConnected: 'blocklet.spaceConnected',
|
|
113
|
-
|
|
114
|
-
// install by nft
|
|
115
|
-
nftConsumed: 'blocklet.nftConsumed',
|
|
60
|
+
exports.BlockletEvents = Object.freeze({
|
|
61
|
+
// status updated
|
|
62
|
+
added: 'blocklet.added',
|
|
63
|
+
downloadFailed: 'blocklet.downloadFailed',
|
|
64
|
+
installed: 'blocklet.installed',
|
|
65
|
+
installFailed: 'blocklet.installFailed',
|
|
66
|
+
upgraded: 'blocklet.upgraded',
|
|
67
|
+
upgradeFailed: 'blocklet.upgradedFailed',
|
|
68
|
+
downgraded: 'blocklet.downgraded',
|
|
69
|
+
downgradeFailed: 'blocklet.downgradedFailed',
|
|
70
|
+
removed: 'blocklet.removed',
|
|
71
|
+
started: 'blocklet.started',
|
|
72
|
+
startFailed: 'blocklet.startFailed',
|
|
73
|
+
stopped: 'blocklet.stopped',
|
|
74
|
+
reloaded: 'blocklet.reloaded',
|
|
75
|
+
statusChange: 'blocklet.statusChange',
|
|
76
|
+
dataCleaned: 'blocklet.dataCleaned',
|
|
77
|
+
// 备份还原进度
|
|
78
|
+
backupProgress: 'blocklet.backupProgress',
|
|
79
|
+
restoreProgress: 'blocklet.restoreProgress',
|
|
80
|
+
downloadBundleProgress: 'blocklet.downloadBundleProgress',
|
|
81
|
+
// state updated
|
|
82
|
+
updated: 'blocklet.updated',
|
|
83
|
+
domainStatus: 'blocklet.domainStatus',
|
|
84
|
+
storeChange: 'blocklet.storeChange',
|
|
85
|
+
appDidChanged: 'blocklet.appDidChanged',
|
|
86
|
+
// purchase
|
|
87
|
+
purchaseChange: 'blocklet.purchaseChange',
|
|
88
|
+
// cert
|
|
89
|
+
certError: 'blocklet.certError',
|
|
90
|
+
certIssued: 'blocklet.certIssued',
|
|
91
|
+
// did-space
|
|
92
|
+
spaceConnected: 'blocklet.spaceConnected',
|
|
93
|
+
// install by nft
|
|
94
|
+
nftConsumed: 'blocklet.nftConsumed',
|
|
116
95
|
});
|
|
117
|
-
|
|
96
|
+
exports.BLOCKLET_PLATFORMS = ['aix', 'darwin', 'freebsd', 'linux', 'openbsd', 'sunos', 'win32'];
|
|
97
|
+
exports.BLOCKLET_ARCHITECTURES = [
|
|
98
|
+
'arm',
|
|
99
|
+
'arm64',
|
|
100
|
+
'ia32',
|
|
101
|
+
'mips',
|
|
102
|
+
'mipsel',
|
|
103
|
+
'ppc',
|
|
104
|
+
'ppc64',
|
|
105
|
+
's390',
|
|
106
|
+
's390x',
|
|
107
|
+
'x32',
|
|
108
|
+
'x64',
|
|
109
|
+
];
|
|
110
|
+
exports.BLOCKLET_MODES = Object.freeze({
|
|
111
|
+
PRODUCTION: 'production',
|
|
112
|
+
DEVELOPMENT: 'development',
|
|
113
|
+
});
|
|
114
|
+
exports.BLOCKLET_FACTORY_SHARES = { developer: 0.7, store: 0.3 };
|
|
118
115
|
// Blocklet Interface
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const BLOCKLET_INTERFACE_TYPE_SERVICE = 'service';
|
|
122
|
-
|
|
116
|
+
exports.BLOCKLET_INTERFACE_TYPE_WEB = 'web';
|
|
117
|
+
exports.BLOCKLET_INTERFACE_TYPE_SERVICE = 'service';
|
|
123
118
|
// Wellknown interface declares an sub-interface under web interface
|
|
124
119
|
// The path of the wellknown interface must starts with /.well-known, e.g. /.well-known/acme-challenge)
|
|
125
120
|
// The wellknown interface can be mounted to every endpoint of the abtnode and all blocklets on the abtnode
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
exports.BLOCKLET_INTERFACE_TYPE_WELLKNOWN = 'wellknown';
|
|
122
|
+
exports.BLOCKLET_INTERFACE_TYPES = [
|
|
123
|
+
exports.BLOCKLET_INTERFACE_TYPE_WEB,
|
|
124
|
+
exports.BLOCKLET_INTERFACE_TYPE_SERVICE,
|
|
125
|
+
exports.BLOCKLET_INTERFACE_TYPE_WELLKNOWN,
|
|
131
126
|
];
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
BLOCKLET_INTERFACE_PROTOCOL_UDP,
|
|
144
|
-
BLOCKLET_INTERFACE_PROTOCOL_HTTP,
|
|
127
|
+
exports.BLOCKLET_INTERFACE_PUBLIC = 'publicUrl';
|
|
128
|
+
exports.BLOCKLET_INTERFACE_WELLKNOWN = 'wellknownUrl'; // Deprecated
|
|
129
|
+
exports.BLOCKLET_UI_INTERFACES = [exports.BLOCKLET_INTERFACE_PUBLIC];
|
|
130
|
+
exports.BLOCKLET_STANDARD_INTERFACES = [exports.BLOCKLET_INTERFACE_PUBLIC, exports.BLOCKLET_INTERFACE_WELLKNOWN];
|
|
131
|
+
exports.BLOCKLET_INTERFACE_PROTOCOL_HTTP = 'http';
|
|
132
|
+
exports.BLOCKLET_INTERFACE_PROTOCOL_TCP = 'tcp';
|
|
133
|
+
exports.BLOCKLET_INTERFACE_PROTOCOL_UDP = 'udp';
|
|
134
|
+
exports.BLOCKLET_INTERFACE_PROTOCOLS = [
|
|
135
|
+
exports.BLOCKLET_INTERFACE_PROTOCOL_TCP,
|
|
136
|
+
exports.BLOCKLET_INTERFACE_PROTOCOL_UDP,
|
|
137
|
+
exports.BLOCKLET_INTERFACE_PROTOCOL_HTTP,
|
|
145
138
|
];
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
acc[CHAIN_PROP_MAP[key]] = key;
|
|
166
|
-
return acc;
|
|
167
|
-
}, {});
|
|
168
|
-
|
|
169
|
-
module.exports = Object.freeze({
|
|
170
|
-
BlockletStatus,
|
|
171
|
-
fromBlockletStatus,
|
|
172
|
-
toBlockletStatus,
|
|
173
|
-
|
|
174
|
-
BlockletSource,
|
|
175
|
-
fromBlockletSource,
|
|
176
|
-
toBlockletSource,
|
|
177
|
-
|
|
178
|
-
BlockletGroup,
|
|
179
|
-
BLOCKLET_GROUPS,
|
|
180
|
-
|
|
181
|
-
BlockletEvents,
|
|
182
|
-
|
|
183
|
-
BLOCKLET_PLATFORMS: ['aix', 'darwin', 'freebsd', 'linux', 'openbsd', 'sunos', 'win32'],
|
|
184
|
-
BLOCKLET_ARCHITECTURES: ['arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', 'x64'],
|
|
185
|
-
|
|
186
|
-
BLOCKLET_MODES: Object.freeze({
|
|
187
|
-
PRODUCTION: 'production',
|
|
188
|
-
DEVELOPMENT: 'development',
|
|
189
|
-
}),
|
|
190
|
-
|
|
191
|
-
BLOCKLET_FACTORY_SHARES: { developer: 0.7, store: 0.3 },
|
|
192
|
-
|
|
193
|
-
// interface
|
|
194
|
-
BLOCKLET_INTERFACE_PUBLIC,
|
|
195
|
-
BLOCKLET_INTERFACE_WELLKNOWN, // Deprecated
|
|
196
|
-
BLOCKLET_UI_INTERFACES,
|
|
197
|
-
BLOCKLET_STANDARD_INTERFACES,
|
|
198
|
-
|
|
199
|
-
BLOCKLET_INTERFACE_TYPE_WEB,
|
|
200
|
-
BLOCKLET_INTERFACE_TYPE_SERVICE,
|
|
201
|
-
BLOCKLET_INTERFACE_TYPE_WELLKNOWN,
|
|
202
|
-
BLOCKLET_INTERFACE_TYPES,
|
|
203
|
-
|
|
204
|
-
BLOCKLET_INTERFACE_PROTOCOL_HTTP,
|
|
205
|
-
BLOCKLET_INTERFACE_PROTOCOL_TCP,
|
|
206
|
-
BLOCKLET_INTERFACE_PROTOCOL_UDP,
|
|
207
|
-
BLOCKLET_INTERFACE_PROTOCOLS,
|
|
208
|
-
|
|
209
|
-
BLOCKLET_DYNAMIC_PATH_PREFIX: '*',
|
|
210
|
-
BLOCKLET_DEFAULT_PORT_NAME: 'BLOCKLET_PORT',
|
|
211
|
-
BLOCKLET_DEFAULT_PATH_REWRITE: '/',
|
|
212
|
-
|
|
213
|
-
// bundle
|
|
214
|
-
BLOCKLET_RELEASE_FOLDER: '.blocklet/release',
|
|
215
|
-
BLOCKLET_RELEASE_FILE: 'blocklet.json',
|
|
216
|
-
BLOCKLET_BUNDLE_FOLDER: '.blocklet/bundle',
|
|
217
|
-
BLOCKLET_BUNDLE_FILE: 'blocklet.zip',
|
|
218
|
-
BLOCKLET_ENTRY_FILE: 'blocklet.js',
|
|
219
|
-
BLOCKLET_META_FILE: 'blocklet.yml',
|
|
220
|
-
BLOCKLET_META_FILE_ALT: 'blocklet.yaml',
|
|
221
|
-
BLOCKLET_PREFERENCE_FILE: 'blocklet.prefs.json',
|
|
222
|
-
BLOCKLET_PREFERENCE_PREFIX: 'prefs.',
|
|
223
|
-
|
|
224
|
-
BLOCKLET_DEFAULT_VERSION: '1.0.0',
|
|
225
|
-
|
|
226
|
-
BLOCKLET_UPLOADS_DIR: '__uploads',
|
|
227
|
-
|
|
228
|
-
BLOCKLET_LATEST_SPEC_VERSION: '1.2.8',
|
|
229
|
-
BLOCKLET_LATEST_REQUIREMENT_SERVER: '>=1.7.0',
|
|
230
|
-
BLOCKLET_LATEST_REQUIREMENT_ABTNODE: '>=1.5.15', // Deprecated
|
|
231
|
-
|
|
232
|
-
BLOCKLET_CONFIGURABLE_KEY: {
|
|
139
|
+
exports.BLOCKLET_DYNAMIC_PATH_PREFIX = '*';
|
|
140
|
+
exports.BLOCKLET_DEFAULT_PORT_NAME = 'BLOCKLET_PORT';
|
|
141
|
+
exports.BLOCKLET_DEFAULT_PATH_REWRITE = '/';
|
|
142
|
+
// bundle
|
|
143
|
+
exports.BLOCKLET_RELEASE_FOLDER = '.blocklet/release';
|
|
144
|
+
exports.BLOCKLET_RELEASE_FILE = 'blocklet.json';
|
|
145
|
+
exports.BLOCKLET_BUNDLE_FOLDER = '.blocklet/bundle';
|
|
146
|
+
exports.BLOCKLET_BUNDLE_FILE = 'blocklet.zip';
|
|
147
|
+
exports.BLOCKLET_ENTRY_FILE = 'blocklet.js';
|
|
148
|
+
exports.BLOCKLET_META_FILE = 'blocklet.yml';
|
|
149
|
+
exports.BLOCKLET_META_FILE_ALT = 'blocklet.yaml';
|
|
150
|
+
exports.BLOCKLET_PREFERENCE_FILE = 'blocklet.prefs.json';
|
|
151
|
+
exports.BLOCKLET_PREFERENCE_PREFIX = 'prefs.';
|
|
152
|
+
exports.BLOCKLET_DEFAULT_VERSION = '1.0.0';
|
|
153
|
+
exports.BLOCKLET_UPLOADS_DIR = '__uploads';
|
|
154
|
+
exports.BLOCKLET_LATEST_SPEC_VERSION = '1.2.8';
|
|
155
|
+
exports.BLOCKLET_LATEST_REQUIREMENT_SERVER = '>=1.7.0';
|
|
156
|
+
exports.BLOCKLET_LATEST_REQUIREMENT_ABTNODE = '>=1.5.15'; // Deprecated
|
|
157
|
+
exports.BLOCKLET_CONFIGURABLE_KEY = {
|
|
233
158
|
// APP Config Key that start with BLOCKLET_ cannot set to child component
|
|
234
159
|
BLOCKLET_CLUSTER_SIZE: 'BLOCKLET_CLUSTER_SIZE',
|
|
235
160
|
BLOCKLET_APP_NAME: 'BLOCKLET_APP_NAME',
|
|
236
161
|
BLOCKLET_APP_DESCRIPTION: 'BLOCKLET_APP_DESCRIPTION',
|
|
237
162
|
BLOCKLET_APP_SK: 'BLOCKLET_APP_SK',
|
|
238
|
-
BLOCKLET_APP_LOGO: 'BLOCKLET_APP_LOGO',
|
|
163
|
+
BLOCKLET_APP_LOGO: 'BLOCKLET_APP_LOGO',
|
|
239
164
|
BLOCKLET_APP_LOGO_SQUARE: 'BLOCKLET_APP_LOGO_SQUARE',
|
|
240
165
|
BLOCKLET_APP_LOGO_RECT: 'BLOCKLET_APP_LOGO_RECT',
|
|
241
166
|
BLOCKLET_APP_LOGO_FAVICON: 'BLOCKLET_APP_LOGO_FAVICON',
|
|
242
167
|
BLOCKLET_APP_URL: 'BLOCKLET_APP_URL',
|
|
243
168
|
BLOCKLET_PASSPORT_COLOR: 'BLOCKLET_PASSPORT_COLOR',
|
|
244
|
-
BLOCKLET_WALLET_TYPE: 'BLOCKLET_WALLET_TYPE',
|
|
169
|
+
BLOCKLET_WALLET_TYPE: 'BLOCKLET_WALLET_TYPE',
|
|
245
170
|
BLOCKLET_DELETABLE: 'BLOCKLET_DELETABLE',
|
|
246
|
-
|
|
247
171
|
// 应用使用 DID Spaces 存储 文件/nft 的时候使用的环境变量
|
|
248
172
|
BLOCKLET_APP_SPACE_ENDPOINT: 'BLOCKLET_APP_SPACE_ENDPOINT',
|
|
249
173
|
BLOCKLET_APP_SPACES_URL: 'BLOCKLET_APP_SPACES_URL',
|
|
250
|
-
|
|
251
174
|
// 应用使用 DID Spaces 备份的时候使用的环境变量
|
|
252
175
|
BLOCKLET_APP_BACKUP_ENDPOINT: 'BLOCKLET_APP_BACKUP_ENDPOINT',
|
|
253
|
-
|
|
254
176
|
BLOCKLET_APP_CHAIN_HOST: 'BLOCKLET_APP_CHAIN_HOST',
|
|
255
177
|
BLOCKLET_APP_CHAIN_TYPE: 'BLOCKLET_APP_CHAIN_TYPE',
|
|
256
178
|
BLOCKLET_APP_CHAIN_ID: 'BLOCKLET_APP_CHAIN_ID',
|
|
257
|
-
|
|
258
179
|
// Component Key
|
|
259
180
|
COMPONENT_ACCESS_WHO: 'COMPONENT_ACCESS_WHO',
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
BLOCKLET_APP_SPACE_ENDPOINTS: {
|
|
181
|
+
};
|
|
182
|
+
exports.BLOCKLET_APP_SPACE_ENDPOINTS = {
|
|
263
183
|
REQUIRED: 'required',
|
|
264
184
|
OPTIONAL: 'optional',
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
CHAIN_INFO_CONFIG: {
|
|
185
|
+
};
|
|
186
|
+
exports.CHAIN_INFO_CONFIG = {
|
|
268
187
|
CHAIN_TYPE: ['type', 'arcblock'],
|
|
269
188
|
CHAIN_ID: ['id', 'none'],
|
|
270
189
|
CHAIN_HOST: ['host', 'none'],
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
190
|
+
};
|
|
191
|
+
exports.RESTORE_PROGRESS_STATUS = {
|
|
192
|
+
waiting: 0,
|
|
193
|
+
start: 10,
|
|
194
|
+
importData: 20,
|
|
195
|
+
downloading: 30,
|
|
196
|
+
importDataSuccess: 40,
|
|
197
|
+
installing: 50,
|
|
198
|
+
completed: 60,
|
|
199
|
+
error: 70,
|
|
200
|
+
};
|
|
201
|
+
exports.CHAIN_PROP_MAP = {
|
|
202
|
+
BLOCKLET_APP_CHAIN_HOST: 'CHAIN_HOST',
|
|
203
|
+
BLOCKLET_APP_CHAIN_ID: 'CHAIN_ID',
|
|
204
|
+
BLOCKLET_APP_CHAIN_TYPE: 'CHAIN_TYPE',
|
|
205
|
+
};
|
|
206
|
+
exports.CHAIN_PROP_MAP_REVERSE = Object.keys(exports.CHAIN_PROP_MAP).reduce((acc, key) => {
|
|
207
|
+
acc[exports.CHAIN_PROP_MAP[key]] = key;
|
|
208
|
+
return acc;
|
|
209
|
+
}, {});
|
package/package.json
CHANGED
|
@@ -3,22 +3,33 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.
|
|
6
|
+
"version": "1.16.9",
|
|
7
7
|
"description": "Blocklet constants",
|
|
8
8
|
"main": "index.js",
|
|
9
9
|
"files": [
|
|
10
10
|
"index.js"
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
|
-
"lint": "eslint tests index.
|
|
14
|
-
"lint:fix": "
|
|
13
|
+
"lint": "eslint tests index.ts",
|
|
14
|
+
"lint:fix": "npm run lint -- --fix",
|
|
15
15
|
"test": "NODE_ENV=test node tools/jest.js",
|
|
16
|
-
"coverage": "npm run test -- --coverage"
|
|
16
|
+
"coverage": "npm run test -- --coverage",
|
|
17
|
+
"clean": "rm -f index.d.ts index.js",
|
|
18
|
+
"build": "npm run clean && tsc"
|
|
17
19
|
},
|
|
18
20
|
"author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
|
|
19
|
-
"license": "
|
|
21
|
+
"license": "Apache-2.0",
|
|
20
22
|
"devDependencies": {
|
|
21
|
-
"
|
|
23
|
+
"@arcblock/eslint-config-ts": "^0.2.3",
|
|
24
|
+
"@types/jest": "^29.2.0",
|
|
25
|
+
"@types/node": "^18.11.0",
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^5.40.1",
|
|
27
|
+
"@typescript-eslint/parser": "^5.40.1",
|
|
28
|
+
"eslint": "^8.25.0",
|
|
29
|
+
"jest": "^27.5.1",
|
|
30
|
+
"prettier": "^2.7.1",
|
|
31
|
+
"ts-jest": "^27.1.5",
|
|
32
|
+
"typescript": "^5.0.4"
|
|
22
33
|
},
|
|
23
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "700ce63e24f6f9b7ad8ecd4ca0aecc8305ee9693"
|
|
24
35
|
}
|