@blocklet/meta 1.8.26 → 1.8.27
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/constants.js +2 -190
- package/lib/schema.js +4 -0
- package/lib/util.js +4 -0
- package/package.json +13 -12
package/lib/constants.js
CHANGED
|
@@ -1,191 +1,3 @@
|
|
|
1
|
-
const
|
|
2
|
-
const match = Object.entries(entries).find((x) => x[1] === Number(v));
|
|
3
|
-
return match ? match[0] : 'unknown';
|
|
4
|
-
};
|
|
1
|
+
const constant = require('@blocklet/constant');
|
|
5
2
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
// Blocklet Status
|
|
9
|
-
|
|
10
|
-
const BlockletStatus = Object.freeze({
|
|
11
|
-
added: 0,
|
|
12
|
-
downloading: 1,
|
|
13
|
-
downloaded: 2, // Deprecated
|
|
14
|
-
installing: 3,
|
|
15
|
-
installed: 4,
|
|
16
|
-
starting: 5,
|
|
17
|
-
running: 6,
|
|
18
|
-
stopping: 7,
|
|
19
|
-
stopped: 8,
|
|
20
|
-
error: 9,
|
|
21
|
-
upgrading: 10,
|
|
22
|
-
restarting: 11, // Deprecated
|
|
23
|
-
corrupted: 12,
|
|
24
|
-
waiting: 13,
|
|
25
|
-
deleted: 14,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const fromBlockletStatus = fromEntry(BlockletStatus);
|
|
29
|
-
const toBlockletStatus = toEntry(BlockletStatus);
|
|
30
|
-
|
|
31
|
-
// Blocklet Source
|
|
32
|
-
|
|
33
|
-
const BlockletSource = Object.freeze({
|
|
34
|
-
// Installed from Blocklet Store
|
|
35
|
-
registry: 0,
|
|
36
|
-
|
|
37
|
-
// Installed from local development source folder
|
|
38
|
-
local: 1,
|
|
39
|
-
|
|
40
|
-
// Installed from uploading bundle directly
|
|
41
|
-
upload: 2,
|
|
42
|
-
|
|
43
|
-
// Installed from a url (similar to Blocklet Store)
|
|
44
|
-
url: 3,
|
|
45
|
-
|
|
46
|
-
// Installed by custom creation
|
|
47
|
-
custom: 4,
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
const fromBlockletSource = fromEntry(BlockletSource);
|
|
51
|
-
const toBlockletSource = toEntry(BlockletSource);
|
|
52
|
-
|
|
53
|
-
// Blocklet Group(Type)
|
|
54
|
-
|
|
55
|
-
const BlockletGroup = Object.freeze({
|
|
56
|
-
// Only static website
|
|
57
|
-
// The website is served by by Blocklet Server at runtime
|
|
58
|
-
static: 'static',
|
|
59
|
-
|
|
60
|
-
// The runtime instance is provided by its own backend server
|
|
61
|
-
dapp: 'dapp',
|
|
62
|
-
|
|
63
|
-
starter: false, // deprecated
|
|
64
|
-
|
|
65
|
-
// This type is used to combine other component blocklets
|
|
66
|
-
// No instance will be spawned at runtime
|
|
67
|
-
gateway: 'gateway',
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
const BLOCKLET_GROUPS = ['dapp', 'static', 'gateway'];
|
|
71
|
-
|
|
72
|
-
// Blocklet Events
|
|
73
|
-
|
|
74
|
-
const BlockletEvents = Object.freeze({
|
|
75
|
-
added: 'blocklet.added',
|
|
76
|
-
downloadFailed: 'blocklet.downloadFailed',
|
|
77
|
-
installed: 'blocklet.installed',
|
|
78
|
-
installFailed: 'blocklet.installFailed',
|
|
79
|
-
upgraded: 'blocklet.upgraded',
|
|
80
|
-
upgradeFailed: 'blocklet.upgradedFailed',
|
|
81
|
-
downgraded: 'blocklet.downgraded',
|
|
82
|
-
downgradeFailed: 'blocklet.downgradedFailed',
|
|
83
|
-
updated: 'blocklet.updated',
|
|
84
|
-
statusChange: 'blocklet.statusChange',
|
|
85
|
-
removed: 'blocklet.removed',
|
|
86
|
-
started: 'blocklet.started',
|
|
87
|
-
startFailed: 'blocklet.startFailed',
|
|
88
|
-
stopped: 'blocklet.stopped',
|
|
89
|
-
reloaded: 'blocklet.reloaded', // Deprecated
|
|
90
|
-
purchaseChange: 'blocklet.purchaseChange',
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
// Blocklet Interface
|
|
94
|
-
|
|
95
|
-
const BLOCKLET_INTERFACE_TYPE_WEB = 'web';
|
|
96
|
-
const BLOCKLET_INTERFACE_TYPE_SERVICE = 'service';
|
|
97
|
-
|
|
98
|
-
// Wellknown interface declares an sub-interface under web interface
|
|
99
|
-
// The path of the wellknown interface must starts with /.well-known, e.g. /.well-known/acme-challenge)
|
|
100
|
-
// The wellknown interface can be mounted to every endpoint of the abtnode and all blocklets on the abtnode
|
|
101
|
-
const BLOCKLET_INTERFACE_TYPE_WELLKNOWN = 'wellknown';
|
|
102
|
-
const BLOCKLET_INTERFACE_TYPES = [
|
|
103
|
-
BLOCKLET_INTERFACE_TYPE_WEB,
|
|
104
|
-
BLOCKLET_INTERFACE_TYPE_SERVICE,
|
|
105
|
-
BLOCKLET_INTERFACE_TYPE_WELLKNOWN,
|
|
106
|
-
];
|
|
107
|
-
|
|
108
|
-
const BLOCKLET_INTERFACE_PUBLIC = 'publicUrl';
|
|
109
|
-
const BLOCKLET_INTERFACE_WELLKNOWN = 'wellknownUrl'; // Deprecated
|
|
110
|
-
const BLOCKLET_UI_INTERFACES = [BLOCKLET_INTERFACE_PUBLIC];
|
|
111
|
-
const BLOCKLET_STANDARD_INTERFACES = [BLOCKLET_INTERFACE_PUBLIC, BLOCKLET_INTERFACE_WELLKNOWN];
|
|
112
|
-
|
|
113
|
-
const BLOCKLET_INTERFACE_PROTOCOL_HTTP = 'http';
|
|
114
|
-
const BLOCKLET_INTERFACE_PROTOCOL_TCP = 'tcp';
|
|
115
|
-
const BLOCKLET_INTERFACE_PROTOCOL_UDP = 'udp';
|
|
116
|
-
const BLOCKLET_INTERFACE_PROTOCOLS = [
|
|
117
|
-
BLOCKLET_INTERFACE_PROTOCOL_TCP,
|
|
118
|
-
BLOCKLET_INTERFACE_PROTOCOL_UDP,
|
|
119
|
-
BLOCKLET_INTERFACE_PROTOCOL_HTTP,
|
|
120
|
-
];
|
|
121
|
-
|
|
122
|
-
module.exports = Object.freeze({
|
|
123
|
-
BlockletStatus,
|
|
124
|
-
fromBlockletStatus,
|
|
125
|
-
toBlockletStatus,
|
|
126
|
-
|
|
127
|
-
BlockletSource,
|
|
128
|
-
fromBlockletSource,
|
|
129
|
-
toBlockletSource,
|
|
130
|
-
|
|
131
|
-
BlockletGroup,
|
|
132
|
-
BLOCKLET_GROUPS,
|
|
133
|
-
|
|
134
|
-
BlockletEvents,
|
|
135
|
-
|
|
136
|
-
BLOCKLET_PLATFORMS: ['aix', 'darwin', 'freebsd', 'linux', 'openbsd', 'sunos', 'win32'],
|
|
137
|
-
BLOCKLET_ARCHITECTURES: ['arm', 'arm64', 'ia32', 'mips', 'mipsel', 'ppc', 'ppc64', 's390', 's390x', 'x32', 'x64'],
|
|
138
|
-
|
|
139
|
-
BLOCKLET_MODES: Object.freeze({
|
|
140
|
-
PRODUCTION: 'production',
|
|
141
|
-
DEVELOPMENT: 'development',
|
|
142
|
-
}),
|
|
143
|
-
|
|
144
|
-
BLOCKLET_FACTORY_SHARES: { developer: 0.7, store: 0.3 },
|
|
145
|
-
|
|
146
|
-
// interface
|
|
147
|
-
BLOCKLET_INTERFACE_PUBLIC,
|
|
148
|
-
BLOCKLET_INTERFACE_WELLKNOWN, // Deprecated
|
|
149
|
-
BLOCKLET_UI_INTERFACES,
|
|
150
|
-
BLOCKLET_STANDARD_INTERFACES,
|
|
151
|
-
|
|
152
|
-
BLOCKLET_INTERFACE_TYPE_WEB,
|
|
153
|
-
BLOCKLET_INTERFACE_TYPE_SERVICE,
|
|
154
|
-
BLOCKLET_INTERFACE_TYPE_WELLKNOWN,
|
|
155
|
-
BLOCKLET_INTERFACE_TYPES,
|
|
156
|
-
|
|
157
|
-
BLOCKLET_INTERFACE_PROTOCOL_HTTP,
|
|
158
|
-
BLOCKLET_INTERFACE_PROTOCOL_TCP,
|
|
159
|
-
BLOCKLET_INTERFACE_PROTOCOL_UDP,
|
|
160
|
-
BLOCKLET_INTERFACE_PROTOCOLS,
|
|
161
|
-
|
|
162
|
-
BLOCKLET_DYNAMIC_PATH_PREFIX: '*',
|
|
163
|
-
BLOCKLET_DEFAULT_PORT_NAME: 'BLOCKLET_PORT',
|
|
164
|
-
BLOCKLET_DEFAULT_PATH_REWRITE: '/',
|
|
165
|
-
|
|
166
|
-
// bundle
|
|
167
|
-
BLOCKLET_RELEASE_FOLDER: '.blocklet/release',
|
|
168
|
-
BLOCKLET_RELEASE_FILE: 'blocklet.json',
|
|
169
|
-
BLOCKLET_BUNDLE_FOLDER: '.blocklet/bundle',
|
|
170
|
-
BLOCKLET_BUNDLE_FILE: 'blocklet.zip',
|
|
171
|
-
BLOCKLET_ENTRY_FILE: 'blocklet.js',
|
|
172
|
-
BLOCKLET_META_FILE: 'blocklet.yml',
|
|
173
|
-
BLOCKLET_META_FILE_ALT: 'blocklet.yaml',
|
|
174
|
-
|
|
175
|
-
BLOCKLET_DEFAULT_VERSION: '1.0.0',
|
|
176
|
-
|
|
177
|
-
BLOCKLET_LATEST_SPEC_VERSION: '1.2.7',
|
|
178
|
-
BLOCKLET_LATEST_REQUIREMENT_SERVER: '>=1.7.0',
|
|
179
|
-
BLOCKLET_LATEST_REQUIREMENT_ABTNODE: '>=1.5.15', // Deprecated
|
|
180
|
-
|
|
181
|
-
BLOCKLET_CONFIGURABLE_KEY: {
|
|
182
|
-
BLOCKLET_CLUSTER_SIZE: 'BLOCKLET_CLUSTER_SIZE',
|
|
183
|
-
BLOCKLET_APP_NAME: 'BLOCKLET_APP_NAME',
|
|
184
|
-
BLOCKLET_APP_DESCRIPTION: 'BLOCKLET_APP_DESCRIPTION',
|
|
185
|
-
BLOCKLET_APP_SK: 'BLOCKLET_APP_SK',
|
|
186
|
-
BLOCKLET_APP_URL: 'BLOCKLET_APP_URL',
|
|
187
|
-
BLOCKLET_PASSPORT_COLOR: 'BLOCKLET_PASSPORT_COLOR',
|
|
188
|
-
BLOCKLET_WALLET_TYPE: 'BLOCKLET_WALLET_TYPE',
|
|
189
|
-
BLOCKLET_DELETABLE: 'BLOCKLET_DELETABLE',
|
|
190
|
-
},
|
|
191
|
-
});
|
|
3
|
+
module.exports = constant;
|
package/lib/schema.js
CHANGED
|
@@ -42,6 +42,9 @@ const titleSchema = Joi.string()
|
|
|
42
42
|
return value;
|
|
43
43
|
});
|
|
44
44
|
const descriptionSchema = Joi.string().trim().min(3).max(160);
|
|
45
|
+
const logoSchema = Joi.string()
|
|
46
|
+
.uri({ scheme: ['http', 'https'], allowRelative: true })
|
|
47
|
+
.allow('');
|
|
45
48
|
const mountPointSchema = Joi.string().trim().min(1);
|
|
46
49
|
|
|
47
50
|
const blockletNameSchema = Joi.string()
|
|
@@ -515,6 +518,7 @@ module.exports = {
|
|
|
515
518
|
distSchema,
|
|
516
519
|
titleSchema,
|
|
517
520
|
descriptionSchema,
|
|
521
|
+
logoSchema,
|
|
518
522
|
navigationSchema,
|
|
519
523
|
themeSchema,
|
|
520
524
|
mountPointSchema,
|
package/lib/util.js
CHANGED
|
@@ -334,6 +334,10 @@ const hasRunnableComponent = (blocklet) => {
|
|
|
334
334
|
* @returns blocklet display name
|
|
335
335
|
*/
|
|
336
336
|
const getDisplayName = (blocklet, onlyUseMeta = false) => {
|
|
337
|
+
if (!blocklet) {
|
|
338
|
+
return '';
|
|
339
|
+
}
|
|
340
|
+
|
|
337
341
|
const { meta } = blocklet;
|
|
338
342
|
let displayName;
|
|
339
343
|
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.
|
|
6
|
+
"version": "1.8.27",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,16 +18,17 @@
|
|
|
18
18
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@abtnode/constant": "1.8.
|
|
22
|
-
"@abtnode/util": "1.8.
|
|
23
|
-
"@arcblock/did": "1.17.
|
|
24
|
-
"@arcblock/did-ext": "1.17.
|
|
25
|
-
"@arcblock/did-util": "1.17.
|
|
26
|
-
"@arcblock/jwt": "1.17.
|
|
27
|
-
"@
|
|
28
|
-
"@ocap/
|
|
29
|
-
"@ocap/
|
|
30
|
-
"@ocap/
|
|
21
|
+
"@abtnode/constant": "1.8.27",
|
|
22
|
+
"@abtnode/util": "1.8.27",
|
|
23
|
+
"@arcblock/did": "1.17.20",
|
|
24
|
+
"@arcblock/did-ext": "1.17.20",
|
|
25
|
+
"@arcblock/did-util": "1.17.20",
|
|
26
|
+
"@arcblock/jwt": "1.17.20",
|
|
27
|
+
"@blocklet/constant": "1.8.27",
|
|
28
|
+
"@ocap/asset": "1.17.20",
|
|
29
|
+
"@ocap/mcrypto": "1.17.20",
|
|
30
|
+
"@ocap/util": "1.17.20",
|
|
31
|
+
"@ocap/wallet": "1.17.20",
|
|
31
32
|
"ajv": "^8.11.0",
|
|
32
33
|
"axios": "^0.27.2",
|
|
33
34
|
"cjk-length": "^1.0.0",
|
|
@@ -53,5 +54,5 @@
|
|
|
53
54
|
"express": "^4.18.1",
|
|
54
55
|
"jest": "^27.5.1"
|
|
55
56
|
},
|
|
56
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "84b2cb3ee703479f17e88c91650ecf3015cbf6af"
|
|
57
58
|
}
|