@abtnode/core 1.16.44-beta-20250512-155818-937e465d → 1.16.44-beta-20250516-225119-c0b5ec8d
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/api/team.js +19 -5
- package/lib/blocklet/downloader/resolve-download.js +9 -2
- package/lib/blocklet/manager/disk.js +10 -8
- package/lib/blocklet/migration-dist/migration.cjs +1 -1
- package/lib/blocklet/project/publish-to-endpoint.js +1 -47
- package/lib/blocklet/security/vault.js +1 -1
- package/lib/event/index.js +7 -6
- package/lib/monitor/blocklet-runtime-monitor.js +17 -0
- package/lib/states/access-key.js +1 -1
- package/lib/states/backup.js +1 -1
- package/lib/states/blocklet-extras.js +1 -1
- package/lib/states/blocklet.js +1 -1
- package/lib/states/node.js +1 -1
- package/lib/states/oauth-client.js +1 -1
- package/lib/states/project.js +1 -1
- package/lib/states/session.js +1 -1
- package/lib/states/user.js +1 -1
- package/lib/states/verify-code.js +1 -1
- package/lib/team/manager.js +22 -3
- package/lib/util/blocklet.js +2 -1
- package/lib/util/docker/check-docker-installed.js +18 -26
- package/lib/util/docker/check-need-run-docker.js +1 -2
- package/lib/util/docker/docker-container-prune.js +3 -2
- package/lib/util/docker/docker-network.js +3 -3
- package/lib/util/domain-status.js +23 -21
- package/lib/util/launcher.js +1 -0
- package/lib/validators/theme.js +159 -0
- package/package.json +36 -36
package/lib/api/team.js
CHANGED
|
@@ -29,7 +29,7 @@ const {
|
|
|
29
29
|
upsertToPassports,
|
|
30
30
|
createUserPassport,
|
|
31
31
|
} = require('@abtnode/auth/lib/passport');
|
|
32
|
-
const formatError = require('@
|
|
32
|
+
const { formatError } = require('@blocklet/error');
|
|
33
33
|
const { getPassportStatusEndpoint, getApplicationInfo } = require('@abtnode/auth/lib/auth');
|
|
34
34
|
const { callFederated, getFederatedMaster, findFederatedSite } = require('@abtnode/auth/lib/util/federated');
|
|
35
35
|
const { hasActiveOwnerPassport } = require('@abtnode/util/lib/passport');
|
|
@@ -47,7 +47,7 @@ const { validateTrustedPassportIssuers } = require('../validators/trusted-passpo
|
|
|
47
47
|
const { validateTrustedFactories } = require('../validators/trusted-factory');
|
|
48
48
|
const { validateCreateRole, validateUpdateRole } = require('../validators/role');
|
|
49
49
|
const { validateCreatePermission, validateUpdatePermission } = require('../validators/permission');
|
|
50
|
-
|
|
50
|
+
const { BlockletRuntimeMonitor } = require('../monitor/blocklet-runtime-monitor');
|
|
51
51
|
const { getBlocklet } = require('../util/blocklet');
|
|
52
52
|
const StoreUtil = require('../util/store');
|
|
53
53
|
const { profileSchema } = require('../validators/user');
|
|
@@ -156,6 +156,9 @@ const getUserSessionWhere = ({ status, blocklet }) => {
|
|
|
156
156
|
updatedAt: {
|
|
157
157
|
[Op.gt]: new Date(now - sessionTtl * 1000),
|
|
158
158
|
},
|
|
159
|
+
status: {
|
|
160
|
+
[Op.ne]: 'offline',
|
|
161
|
+
},
|
|
159
162
|
};
|
|
160
163
|
}
|
|
161
164
|
if (status === 'expired') {
|
|
@@ -163,6 +166,14 @@ const getUserSessionWhere = ({ status, blocklet }) => {
|
|
|
163
166
|
updatedAt: {
|
|
164
167
|
[Op.lt]: new Date(now - sessionTtl * 1000),
|
|
165
168
|
},
|
|
169
|
+
status: {
|
|
170
|
+
[Op.ne]: 'offline',
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (status === 'offline') {
|
|
175
|
+
return {
|
|
176
|
+
status: 'offline',
|
|
166
177
|
};
|
|
167
178
|
}
|
|
168
179
|
return {};
|
|
@@ -195,6 +206,8 @@ class TeamAPI extends EventEmitter {
|
|
|
195
206
|
1000 * 10, // 30s 节流
|
|
196
207
|
{ leading: true, trailing: true }
|
|
197
208
|
);
|
|
209
|
+
|
|
210
|
+
this.runtimeMonitor = new BlockletRuntimeMonitor({ states });
|
|
198
211
|
}
|
|
199
212
|
|
|
200
213
|
getThrottledEmit(teamDid) {
|
|
@@ -221,6 +234,7 @@ class TeamAPI extends EventEmitter {
|
|
|
221
234
|
limit: 1,
|
|
222
235
|
});
|
|
223
236
|
const backup = Array.isArray(backups) && backups.length > 0 ? backups[0] : null;
|
|
237
|
+
const appRuntimeInfo = await this.runtimeMonitor.getBlockletRuntimeInfo(teamDid);
|
|
224
238
|
|
|
225
239
|
return {
|
|
226
240
|
user: {
|
|
@@ -232,6 +246,7 @@ class TeamAPI extends EventEmitter {
|
|
|
232
246
|
activePassports,
|
|
233
247
|
},
|
|
234
248
|
backup,
|
|
249
|
+
appRuntimeInfo,
|
|
235
250
|
};
|
|
236
251
|
}
|
|
237
252
|
|
|
@@ -2264,7 +2279,7 @@ class TeamAPI extends EventEmitter {
|
|
|
2264
2279
|
if (nodeInfo.did === teamDid) {
|
|
2265
2280
|
return 0;
|
|
2266
2281
|
}
|
|
2267
|
-
const
|
|
2282
|
+
const userSessionState = await this.getUserSessionState(teamDid);
|
|
2268
2283
|
const where = { userDid };
|
|
2269
2284
|
if (visitorId) where.visitorId = visitorId;
|
|
2270
2285
|
if (appPid) where.appPid = appPid;
|
|
@@ -2272,8 +2287,7 @@ class TeamAPI extends EventEmitter {
|
|
|
2272
2287
|
const blocklet = await getBlocklet({ did: teamDid, states: this.states, dataDirs: this.dataDirs, useCache: true });
|
|
2273
2288
|
const whereStatus = getUserSessionWhere({ status, blocklet });
|
|
2274
2289
|
Object.assign(where, whereStatus);
|
|
2275
|
-
|
|
2276
|
-
const result = await state.model.destroy({ where });
|
|
2290
|
+
const result = await userSessionState.update(where, { $set: { status: 'offline' } });
|
|
2277
2291
|
const { permanentWallet } = getBlockletInfo(blocklet, nodeInfo.sk);
|
|
2278
2292
|
const masterSite = getFederatedMaster(blocklet);
|
|
2279
2293
|
if (masterSite && masterSite.isMaster !== false && masterSite.appPid !== teamDid) {
|
|
@@ -106,7 +106,8 @@ const resolveDiffDownload = async (
|
|
|
106
106
|
|
|
107
107
|
logger.info('Resolve diff download', { tarFile, cwd });
|
|
108
108
|
const downloadDir = path.join(path.dirname(tarFile), path.basename(tarFile, path.extname(tarFile)));
|
|
109
|
-
|
|
109
|
+
let diffDir = `${downloadDir}-diff`;
|
|
110
|
+
const baseDiffDir = diffDir;
|
|
110
111
|
try {
|
|
111
112
|
await expandTarball({ source: tarFile, dest: diffDir, strip: 0 });
|
|
112
113
|
fs.removeSync(tarFile);
|
|
@@ -115,6 +116,12 @@ const resolveDiffDownload = async (
|
|
|
115
116
|
logger.error('expand blocklet tar file error', { error });
|
|
116
117
|
throw error;
|
|
117
118
|
}
|
|
119
|
+
if (
|
|
120
|
+
!fs.existsSync(path.join(diffDir, 'blocklet.yml')) &&
|
|
121
|
+
fs.existsSync(path.join(diffDir, 'package', 'blocklet.yml'))
|
|
122
|
+
) {
|
|
123
|
+
diffDir = path.join(diffDir, 'package');
|
|
124
|
+
}
|
|
118
125
|
logger.info('Copy installDir to downloadDir', { installDir: distDir, downloadDir });
|
|
119
126
|
await fs.copy(getBundleDir(distDir, oldMeta), downloadDir);
|
|
120
127
|
try {
|
|
@@ -141,7 +148,7 @@ const resolveDiffDownload = async (
|
|
|
141
148
|
}
|
|
142
149
|
};
|
|
143
150
|
await walkDiff(diffDir);
|
|
144
|
-
fs.removeSync(
|
|
151
|
+
fs.removeSync(baseDiffDir);
|
|
145
152
|
const meta = getBlockletMeta(downloadDir);
|
|
146
153
|
if (dist?.integrity) {
|
|
147
154
|
meta.dist = dist;
|
|
@@ -235,6 +235,7 @@ const ensureBlockletRunning = require('./ensure-blocklet-running');
|
|
|
235
235
|
|
|
236
236
|
const { transformNotification } = require('../../util/notification');
|
|
237
237
|
const { generateUserUpdateData } = require('../../util/user');
|
|
238
|
+
const { blockletThemeSchema } = require('../../validators/theme');
|
|
238
239
|
const checkDNS = require('../../util/check-dns.js');
|
|
239
240
|
|
|
240
241
|
const { formatEnvironments, getBlockletMeta, validateOwner, isCLI } = util;
|
|
@@ -257,9 +258,6 @@ const USER_PROFILE_SYNC_FIELDS = [
|
|
|
257
258
|
'phoneVerified',
|
|
258
259
|
];
|
|
259
260
|
|
|
260
|
-
const startTime = Date.now();
|
|
261
|
-
const TWO_DAYS = 2 * 24 * 60 * 60 * 1000;
|
|
262
|
-
|
|
263
261
|
const getHookArgs = (blocklet) => ({
|
|
264
262
|
output: blocklet.mode === BLOCKLET_MODES.DEVELOPMENT ? '' : path.join(blocklet.env.logsDir, 'output.log'),
|
|
265
263
|
error: blocklet.mode === BLOCKLET_MODES.DEVELOPMENT ? '' : path.join(blocklet.env.logsDir, 'error.log'),
|
|
@@ -1908,7 +1906,12 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
1908
1906
|
}
|
|
1909
1907
|
|
|
1910
1908
|
async configTheme({ did, theme = {} }, context) {
|
|
1911
|
-
|
|
1909
|
+
const { error, value } = blockletThemeSchema.validate(theme);
|
|
1910
|
+
if (error) {
|
|
1911
|
+
throw new Error(error.message);
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
await states.blockletExtras.setSettings(did, { theme: value });
|
|
1912
1915
|
|
|
1913
1916
|
const newState = await this.getBlocklet(did);
|
|
1914
1917
|
this.emit(BlockletInternalEvents.appSettingChanged, { appDid: did });
|
|
@@ -2329,16 +2332,19 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
2329
2332
|
await Promise.all(
|
|
2330
2333
|
customAliases.map(async (alias) => {
|
|
2331
2334
|
const dns = await checkDNS(alias.value, cnameDomain?.value);
|
|
2335
|
+
logger.info('dns info', { dns });
|
|
2332
2336
|
if (!dns.isDnsResolved || !dns.isCnameMatch) {
|
|
2333
2337
|
return;
|
|
2334
2338
|
}
|
|
2335
2339
|
|
|
2336
2340
|
if (!alias.certificateId) {
|
|
2341
|
+
logger.info('cron check dns no certificate');
|
|
2337
2342
|
await issueCert(alias);
|
|
2338
2343
|
return;
|
|
2339
2344
|
}
|
|
2340
2345
|
|
|
2341
2346
|
const cert = await this.certManager.manager.getByDomain(alias.value);
|
|
2347
|
+
logger.info('cron check dns certificate', { cert });
|
|
2342
2348
|
if (cert?.status === 'error') {
|
|
2343
2349
|
await issueCert(alias);
|
|
2344
2350
|
}
|
|
@@ -2424,10 +2430,6 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
2424
2430
|
time: '*/10 * * * *',
|
|
2425
2431
|
options: { runOnInit: false },
|
|
2426
2432
|
fn: () => {
|
|
2427
|
-
if (Date.now() - startTime > TWO_DAYS) {
|
|
2428
|
-
return;
|
|
2429
|
-
}
|
|
2430
|
-
|
|
2431
2433
|
const fn = this.updateAllBlockletCertificate.bind(this);
|
|
2432
2434
|
fn();
|
|
2433
2435
|
},
|
|
@@ -38744,7 +38744,7 @@ module.exports = require("zlib");
|
|
|
38744
38744
|
/***/ ((module) => {
|
|
38745
38745
|
|
|
38746
38746
|
"use strict";
|
|
38747
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.43","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib","test":"node tools/jest.js","coverage":"npm run test -- --coverage"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.16.43","@abtnode/auth":"1.16.43","@abtnode/certificate-manager":"1.16.43","@abtnode/client":"1.16.43","@abtnode/constant":"1.16.43","@abtnode/cron":"1.16.43","@abtnode/docker-utils":"1.16.43","@abtnode/logger":"1.16.43","@abtnode/models":"1.16.43","@abtnode/queue":"1.16.43","@abtnode/rbac":"1.16.43","@abtnode/router-provider":"1.16.43","@abtnode/static-server":"1.16.43","@abtnode/timemachine":"1.16.43","@abtnode/util":"1.16.43","@arcblock/did":"1.20.
|
|
38747
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@abtnode/core","publishConfig":{"access":"public"},"version":"1.16.43","description":"","main":"lib/index.js","files":["lib"],"scripts":{"lint":"eslint tests lib --ignore-pattern \'tests/assets/*\'","lint:fix":"eslint --fix tests lib","test":"node tools/jest.js","coverage":"npm run test -- --coverage"},"keywords":[],"author":"wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)","license":"Apache-2.0","dependencies":{"@abtnode/analytics":"1.16.43","@abtnode/auth":"1.16.43","@abtnode/certificate-manager":"1.16.43","@abtnode/client":"1.16.43","@abtnode/constant":"1.16.43","@abtnode/cron":"1.16.43","@abtnode/docker-utils":"1.16.43","@abtnode/logger":"1.16.43","@abtnode/models":"1.16.43","@abtnode/queue":"1.16.43","@abtnode/rbac":"1.16.43","@abtnode/router-provider":"1.16.43","@abtnode/static-server":"1.16.43","@abtnode/timemachine":"1.16.43","@abtnode/util":"1.16.43","@arcblock/did":"1.20.11","@arcblock/did-auth":"1.20.11","@arcblock/did-ext":"1.20.11","@arcblock/did-motif":"^1.1.13","@arcblock/did-util":"1.20.11","@arcblock/event-hub":"1.20.11","@arcblock/jwt":"1.20.11","@arcblock/pm2-events":"^0.0.5","@arcblock/validator":"1.20.11","@arcblock/vc":"1.20.11","@blocklet/constant":"1.16.43","@blocklet/did-space-js":"^1.0.53","@blocklet/env":"1.16.43","@blocklet/error":"^0.2.4","@blocklet/meta":"1.16.43","@blocklet/resolver":"1.16.43","@blocklet/sdk":"1.16.43","@blocklet/store":"1.16.43","@blocklet/theme":"^2.13.37","@fidm/x509":"^1.2.1","@ocap/mcrypto":"1.20.11","@ocap/util":"1.20.11","@ocap/wallet":"1.20.11","@slack/webhook":"^5.0.4","archiver":"^7.0.1","axios":"^1.7.9","axon":"^2.0.3","chalk":"^4.1.2","cross-spawn":"^7.0.3","dayjs":"^1.11.13","deep-diff":"^1.0.2","detect-port":"^1.5.1","envfile":"^7.1.0","escape-string-regexp":"^4.0.0","fast-glob":"^3.3.2","filesize":"^10.1.1","flat":"^5.0.2","fs-extra":"^11.2.0","get-port":"^5.1.1","hasha":"^5.2.2","is-base64":"^1.1.0","is-cidr":"4","is-ip":"3","is-url":"^1.2.4","joi":"17.12.2","joi-extension-semver":"^5.0.0","js-yaml":"^4.1.0","kill-port":"^2.0.1","lodash":"^4.17.21","lru-cache":"^11.0.2","node-stream-zip":"^1.15.0","p-all":"^3.0.0","p-limit":"^3.1.0","p-map":"^4.0.0","p-retry":"^4.6.2","p-wait-for":"^3.2.0","rate-limiter-flexible":"^5.0.5","read-last-lines":"^1.8.0","semver":"^7.6.3","sequelize":"^6.35.0","shelljs":"^0.8.5","slugify":"^1.6.6","ssri":"^8.0.1","stream-throttle":"^0.1.3","stream-to-promise":"^3.0.0","systeminformation":"^5.23.3","tail":"^2.2.4","tar":"^6.1.11","transliteration":"^2.3.5","ua-parser-js":"^1.0.2","ufo":"^1.5.3","uuid":"^9.0.1","valid-url":"^1.0.9","which":"^2.0.2","xbytes":"^1.8.0"},"devDependencies":{"expand-tilde":"^2.0.2","express":"^4.18.2","jest":"^29.7.0","unzipper":"^0.10.11"},"gitHead":"e5764f753181ed6a7c615cd4fc6682aacf0cb7cd"}');
|
|
38748
38748
|
|
|
38749
38749
|
/***/ }),
|
|
38750
38750
|
|
|
@@ -11,7 +11,6 @@ const tar = require('tar');
|
|
|
11
11
|
|
|
12
12
|
const { default: axios } = require('axios');
|
|
13
13
|
const hashFiles = require('@abtnode/util/lib/hash-files');
|
|
14
|
-
const isPathPrefixEqual = require('@abtnode/util/lib/is-path-prefix-equal');
|
|
15
14
|
const validateBlockletEntry = require('@blocklet/meta/lib/entry');
|
|
16
15
|
const { hasMountPoint } = require('@blocklet/meta/lib/engine');
|
|
17
16
|
const urlPathFriendly = require('@blocklet/meta/lib/url-path-friendly').default;
|
|
@@ -162,48 +161,6 @@ const publishToEndpoint = async ({ did, projectId, endpointId, releaseId, manage
|
|
|
162
161
|
}
|
|
163
162
|
}
|
|
164
163
|
|
|
165
|
-
let blockletDiff;
|
|
166
|
-
try {
|
|
167
|
-
blockletDiff = await client.getBlockletDiff(
|
|
168
|
-
{
|
|
169
|
-
input: {
|
|
170
|
-
did: localMeta.did,
|
|
171
|
-
hashFiles: Object.entries(files).map(([file, hash]) => ({ file, hash })),
|
|
172
|
-
rootDid: rootDid || '',
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
headers: {
|
|
177
|
-
'x-access-blocklet': rootDid,
|
|
178
|
-
},
|
|
179
|
-
}
|
|
180
|
-
);
|
|
181
|
-
} catch (error) {
|
|
182
|
-
throw new Error(`Blocklet deploy failed when fetching diff: ${formatError(error)}`);
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
logger.info(`blockletDiff: ${JSON.stringify(blockletDiff)}`);
|
|
186
|
-
|
|
187
|
-
const {
|
|
188
|
-
addSet = [],
|
|
189
|
-
changeSet = [],
|
|
190
|
-
deleteSet = [],
|
|
191
|
-
hasBlocklet: hasDiff,
|
|
192
|
-
version: serverVersion,
|
|
193
|
-
} = blockletDiff.blockletDiff || {};
|
|
194
|
-
const diffList = hasDiff ? [...addSet, ...changeSet] : null;
|
|
195
|
-
|
|
196
|
-
// if no diff and mountPoint not changed, stop deploy
|
|
197
|
-
if (hasDiff && localMeta.version === serverVersion && !addSet.length && !changeSet.length && !deleteSet.length) {
|
|
198
|
-
let needNotDeploy = true;
|
|
199
|
-
const child = app.children.find((x) => x.meta.did === localMeta.did);
|
|
200
|
-
needNotDeploy = isPathPrefixEqual(mountPoint, child?.mountPoint);
|
|
201
|
-
|
|
202
|
-
if (needNotDeploy) {
|
|
203
|
-
logger.info(`${localMeta.title}@${localMeta.version} already exists in ${app.meta.title}`);
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
164
|
logger.info(`start deploy ${localMeta.name}@${localMeta.version} to ${connected.endpoint}`);
|
|
208
165
|
|
|
209
166
|
const tarFile = path.join(releaseDir, `${slugify(localMeta.name)}-${localMeta.version}.tgz`);
|
|
@@ -211,17 +168,14 @@ const publishToEndpoint = async ({ did, projectId, endpointId, releaseId, manage
|
|
|
211
168
|
{
|
|
212
169
|
file: tarFile,
|
|
213
170
|
cwd: bundleDir,
|
|
214
|
-
filter: (f) => !
|
|
171
|
+
filter: (f) => !files || fileFilter(f.replace(/^\.\//, ''), { files }),
|
|
215
172
|
},
|
|
216
173
|
['.']
|
|
217
174
|
);
|
|
218
175
|
|
|
219
176
|
const { form } = makeFormData({
|
|
220
177
|
tarFile,
|
|
221
|
-
hasDiff,
|
|
222
178
|
did: localMeta.did,
|
|
223
|
-
serverVersion,
|
|
224
|
-
deleteSet,
|
|
225
179
|
mountPoint,
|
|
226
180
|
rootDid,
|
|
227
181
|
dist: {
|
|
@@ -6,7 +6,7 @@ const { isValid, isFromPublicKey } = require('@arcblock/did');
|
|
|
6
6
|
const { getBlockletAppIdList } = require('@blocklet/meta/lib/util');
|
|
7
7
|
const { verifyVault } = require('@blocklet/meta/lib/security');
|
|
8
8
|
const { getWalletDid } = require('@blocklet/meta/lib/did-utils');
|
|
9
|
-
const formatError = require('@
|
|
9
|
+
const { formatError } = require('@blocklet/error');
|
|
10
10
|
|
|
11
11
|
const logger = require('@abtnode/logger')('@abtnode/core');
|
|
12
12
|
|
package/lib/event/index.js
CHANGED
|
@@ -22,6 +22,7 @@ const {
|
|
|
22
22
|
} = require('@abtnode/constant');
|
|
23
23
|
const { joinURL } = require('ufo');
|
|
24
24
|
const { encode } = require('@abtnode/util/lib/base32');
|
|
25
|
+
const dayjs = require('dayjs');
|
|
25
26
|
|
|
26
27
|
const { NodeMonitSender } = require('../monitor/node-monit-sender');
|
|
27
28
|
const { isCLI } = require('../util');
|
|
@@ -652,11 +653,11 @@ module.exports = ({
|
|
|
652
653
|
};
|
|
653
654
|
|
|
654
655
|
const translation = translations[locale] || translations.en;
|
|
655
|
-
const localeMap = {
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
};
|
|
659
|
-
const targetLocale = localeMap[locale] || localeMap.en;
|
|
656
|
+
// const localeMap = {
|
|
657
|
+
// en: 'en-US',
|
|
658
|
+
// zh: 'zh-CN',
|
|
659
|
+
// };
|
|
660
|
+
// const targetLocale = localeMap[locale] || localeMap.en;
|
|
660
661
|
const notification = {
|
|
661
662
|
title: translation.title,
|
|
662
663
|
body: translation.body,
|
|
@@ -679,7 +680,7 @@ module.exports = ({
|
|
|
679
680
|
},
|
|
680
681
|
{
|
|
681
682
|
type: 'text',
|
|
682
|
-
data: { type: 'plain', text: userSession.updatedAt.
|
|
683
|
+
data: { type: 'plain', text: dayjs(userSession.updatedAt).utc().format('YYYY-MM-DD HH:mm:ss [UTC]') },
|
|
683
684
|
},
|
|
684
685
|
],
|
|
685
686
|
},
|
|
@@ -220,6 +220,23 @@ class BlockletRuntimeMonitor extends EventEmitter {
|
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
222
|
|
|
223
|
+
async getBlockletRuntimeInfo(blockletDid) {
|
|
224
|
+
if (this.getRuntimeInfo(blockletDid)) {
|
|
225
|
+
return this.getRuntimeInfo(blockletDid);
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const blocklets = await this.states.blocklet.getBlocklets();
|
|
229
|
+
const blocklet = blocklets.find((x) => x.meta.did === blockletDid);
|
|
230
|
+
|
|
231
|
+
if (blocklet) {
|
|
232
|
+
await this._monit(blocklet, { addToHistory: true }).catch((err) => {
|
|
233
|
+
this.logger.error('failed to get blocklet runtime info', { error: err });
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
return this.getRuntimeInfo(blockletDid);
|
|
238
|
+
}
|
|
239
|
+
|
|
223
240
|
delete(blockletDid) {
|
|
224
241
|
delete this.data[blockletDid];
|
|
225
242
|
}
|
package/lib/states/access-key.js
CHANGED
|
@@ -3,7 +3,7 @@ const { Op } = require('sequelize');
|
|
|
3
3
|
const { isValid } = require('@arcblock/did');
|
|
4
4
|
const { fromRandom, fromPublicKey } = require('@ocap/wallet');
|
|
5
5
|
const { toBase58, fromBase58 } = require('@ocap/util');
|
|
6
|
-
const CustomError = require('@
|
|
6
|
+
const { CustomError } = require('@blocklet/error');
|
|
7
7
|
|
|
8
8
|
const logger = require('@abtnode/logger')('@abtnode/core:states:access-key');
|
|
9
9
|
const BaseState = require('./base');
|
package/lib/states/backup.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { Joi } = require('@arcblock/validator');
|
|
2
2
|
const { BACKUPS } = require('@abtnode/constant');
|
|
3
|
-
const CustomError = require('@
|
|
3
|
+
const { CustomError } = require('@blocklet/error');
|
|
4
4
|
|
|
5
5
|
const { Op } = require('sequelize');
|
|
6
6
|
const dayjs = require('@abtnode/util/lib/dayjs');
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
const logger = require('@abtnode/logger')('@abtnode/core:states:blocklet-extras');
|
|
5
5
|
const camelCase = require('lodash/camelCase');
|
|
6
6
|
const get = require('lodash/get');
|
|
7
|
-
const CustomError = require('@
|
|
7
|
+
const { CustomError } = require('@blocklet/error');
|
|
8
8
|
|
|
9
9
|
const BaseState = require('./base');
|
|
10
10
|
|
package/lib/states/blocklet.js
CHANGED
|
@@ -9,7 +9,7 @@ const cloneDeep = require('@abtnode/util/lib/deep-clone');
|
|
|
9
9
|
const detectPort = require('detect-port');
|
|
10
10
|
const Lock = require('@abtnode/util/lib/lock');
|
|
11
11
|
const security = require('@abtnode/util/lib/security');
|
|
12
|
-
const CustomError = require('@
|
|
12
|
+
const { CustomError } = require('@blocklet/error');
|
|
13
13
|
const { fixPerson, fixInterfaces } = require('@blocklet/meta/lib/fix');
|
|
14
14
|
const {
|
|
15
15
|
getDisplayName,
|
package/lib/states/node.js
CHANGED
|
@@ -3,7 +3,7 @@ const semver = require('semver');
|
|
|
3
3
|
const omit = require('lodash/omit');
|
|
4
4
|
const isEmpty = require('lodash/isEmpty');
|
|
5
5
|
const security = require('@abtnode/util/lib/security');
|
|
6
|
-
const CustomError = require('@
|
|
6
|
+
const { CustomError } = require('@blocklet/error');
|
|
7
7
|
const { generateRandomString } = require('@abtnode/models/lib/util');
|
|
8
8
|
const { isFromPublicKey } = require('@arcblock/did');
|
|
9
9
|
const SingleFlightLRUCache = require('@abtnode/util/lib/single-flight-lru-cache');
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const crypto = require('crypto');
|
|
2
2
|
const uuid = require('uuid');
|
|
3
3
|
const { OAUTH_CLIENT_SECRET_TTL } = require('@abtnode/constant');
|
|
4
|
-
const CustomError = require('@
|
|
4
|
+
const { CustomError } = require('@blocklet/error');
|
|
5
5
|
const BaseState = require('./base');
|
|
6
6
|
const { oauthClientSchema } = require('../validators/oauth');
|
|
7
7
|
|
package/lib/states/project.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const pickBy = require('lodash/pickBy');
|
|
2
2
|
const pick = require('lodash/pick');
|
|
3
|
-
const CustomError = require('@
|
|
3
|
+
const { CustomError } = require('@blocklet/error');
|
|
4
4
|
const BaseState = require('./base');
|
|
5
5
|
|
|
6
6
|
const isUndefinedOrNull = (x) => x === undefined || x === null;
|
package/lib/states/session.js
CHANGED
package/lib/states/user.js
CHANGED
|
@@ -9,7 +9,7 @@ const { BaseState } = require('@abtnode/models');
|
|
|
9
9
|
const { Sequelize, Op } = require('sequelize');
|
|
10
10
|
const { updateConnectedAccount } = require('@abtnode/util/lib/user');
|
|
11
11
|
const { LOGIN_PROVIDER } = require('@blocklet/constant');
|
|
12
|
-
const CustomError = require('@
|
|
12
|
+
const { CustomError } = require('@blocklet/error');
|
|
13
13
|
|
|
14
14
|
const logger = require('@abtnode/logger')('@abtnode/core:states:user');
|
|
15
15
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const logger = require('@abtnode/logger')('@abtnode/core:states:verify-code');
|
|
2
2
|
|
|
3
|
-
const CustomError = require('@
|
|
3
|
+
const { CustomError } = require('@blocklet/error');
|
|
4
4
|
const { Hasher } = require('@ocap/mcrypto');
|
|
5
5
|
const { Joi } = require('@arcblock/validator');
|
|
6
6
|
const { VERIFY_CODE_LENGTH, VERIFY_CODE_TTL, VERIFY_SEND_TTL } = require('@abtnode/constant');
|
package/lib/team/manager.js
CHANGED
|
@@ -26,7 +26,7 @@ const {
|
|
|
26
26
|
const { isActivityIncluded } = require('@abtnode/util/lib/notification-preview/util');
|
|
27
27
|
const { joinURL, withHttps } = require('ufo');
|
|
28
28
|
const { isCustomDomain } = require('@abtnode/util/lib/url-evaluation');
|
|
29
|
-
|
|
29
|
+
const dayjs = require('dayjs');
|
|
30
30
|
const { getDidDomainForBlocklet } = require('@abtnode/util/lib/get-domain-for-blocklet');
|
|
31
31
|
const getBlockletInfo = require('@blocklet/meta/lib/info');
|
|
32
32
|
const { getDomainsByDid } = require('../router/helper');
|
|
@@ -196,6 +196,13 @@ class TeamManager extends EventEmitter {
|
|
|
196
196
|
return this.getState(teamDid, 'verifyCode');
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
+
/**
|
|
200
|
+
* 判断 passport 是否已经过期
|
|
201
|
+
*/
|
|
202
|
+
isPassportExpired(passport) {
|
|
203
|
+
return passport.status !== 'valid' || (passport.expirationDate && dayjs(passport.expirationDate).isBefore(dayjs()));
|
|
204
|
+
}
|
|
205
|
+
|
|
199
206
|
async getNotificationReceivers(payload) {
|
|
200
207
|
const { teamDid, userDids = [], roles = [], selection = {}, includeConnectedAccounts = false } = payload;
|
|
201
208
|
// 会根据 teamDid 返回对应 state
|
|
@@ -217,9 +224,20 @@ class TeamManager extends EventEmitter {
|
|
|
217
224
|
approved: true,
|
|
218
225
|
selection,
|
|
219
226
|
includeConnectedAccounts,
|
|
227
|
+
includePassports: true,
|
|
220
228
|
},
|
|
221
229
|
});
|
|
222
|
-
|
|
230
|
+
|
|
231
|
+
const validUsers = queryUsers.filter((user) => {
|
|
232
|
+
const { passports } = user;
|
|
233
|
+
if (passports.length && passports.some((x) => !this.isPassportExpired(x))) {
|
|
234
|
+
return true;
|
|
235
|
+
}
|
|
236
|
+
logger.warn(`user's passports are all expired: ${user.did}`);
|
|
237
|
+
return false;
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
users = users.concat(validUsers);
|
|
223
241
|
}
|
|
224
242
|
|
|
225
243
|
return users;
|
|
@@ -487,7 +505,8 @@ class TeamManager extends EventEmitter {
|
|
|
487
505
|
const receivers = await this._getReceiverList(teamDid, receiver, isExist);
|
|
488
506
|
|
|
489
507
|
if (!receivers?.length && process.env.NODE_ENV !== 'test') {
|
|
490
|
-
|
|
508
|
+
logger.warn('No valid receivers', { teamDid, receiver });
|
|
509
|
+
throw new Error('No valid receivers');
|
|
491
510
|
}
|
|
492
511
|
|
|
493
512
|
const notificationActor = notification?.activity?.actor || payload.activity?.actor;
|
package/lib/util/blocklet.js
CHANGED
|
@@ -60,6 +60,7 @@ const { toSvg: createDidLogo } =
|
|
|
60
60
|
process.env.NODE_ENV !== 'test' ? require('@arcblock/did-motif') : require('@arcblock/did-motif/dist/did-motif.cjs');
|
|
61
61
|
const { createBlockiesSvg } = require('@blocklet/meta/lib/blockies');
|
|
62
62
|
const formatName = require('@abtnode/util/lib/format-name');
|
|
63
|
+
const { hasMountPoint } = require('@blocklet/meta/lib/engine');
|
|
63
64
|
|
|
64
65
|
const SCRIPT_ENGINES_WHITE_LIST = ['npm', 'npx', 'pnpm', 'yarn'];
|
|
65
66
|
|
|
@@ -1943,7 +1944,7 @@ const resolveMountPointConflict = (comp, blocklet) => {
|
|
|
1943
1944
|
try {
|
|
1944
1945
|
if (!comp?.mountPoint) return comp;
|
|
1945
1946
|
|
|
1946
|
-
const children = blocklet?.children || [];
|
|
1947
|
+
const children = (blocklet?.children || []).filter((x) => x?.meta && hasMountPoint(x.meta));
|
|
1947
1948
|
|
|
1948
1949
|
const existingComponent = children.find((x) => x.mountPoint === comp.mountPoint && x.meta?.did !== comp.meta?.did);
|
|
1949
1950
|
if (!existingComponent) return comp;
|
|
@@ -1,35 +1,27 @@
|
|
|
1
1
|
const logger = require('@abtnode/logger')('@abtnode/core:util:blocklet');
|
|
2
2
|
const promiseSpawn = require('@abtnode/util/lib/promise-spawn');
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
installed: false,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
async function checkDockerInstalled() {
|
|
10
|
-
if (process.env.ABT_NODE_NOT_ALLOW_DOCKER) {
|
|
11
|
-
return false;
|
|
12
|
-
}
|
|
4
|
+
let lastTime = 0;
|
|
5
|
+
let lastResultPromise = null;
|
|
13
6
|
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
function checkDockerInstalled() {
|
|
8
|
+
const now = Date.now();
|
|
9
|
+
if (now - lastTime < 5000 && lastResultPromise) {
|
|
10
|
+
return lastResultPromise;
|
|
16
11
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return checkDockerInstalledCache.installed;
|
|
12
|
+
lastTime = now;
|
|
13
|
+
lastResultPromise = (async () => {
|
|
14
|
+
if (process.env.ABT_NODE_NOT_ALLOW_DOCKER) return false;
|
|
15
|
+
try {
|
|
16
|
+
await promiseSpawn('docker ps', { mute: true });
|
|
17
|
+
logger.info('Docker is installed');
|
|
18
|
+
return true;
|
|
19
|
+
} catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
})();
|
|
23
|
+
return lastResultPromise;
|
|
30
24
|
}
|
|
31
|
-
|
|
32
25
|
module.exports = {
|
|
33
26
|
checkDockerInstalled,
|
|
34
|
-
checkDockerInstalledCache,
|
|
35
27
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const { NODE_MODES } = require('@abtnode/constant');
|
|
2
2
|
const { BLOCKLET_MODES } = require('@blocklet/constant');
|
|
3
|
-
const { checkDockerInstalled
|
|
3
|
+
const { checkDockerInstalled } = require('./check-docker-installed');
|
|
4
4
|
|
|
5
5
|
async function checkNeedRunDocker(meta = {}, env = {}, nodeInfo = {}) {
|
|
6
6
|
if (!process.env.ABT_NODE_DATA_DIR) {
|
|
@@ -27,7 +27,6 @@ async function checkNeedRunDocker(meta = {}, env = {}, nodeInfo = {}) {
|
|
|
27
27
|
|
|
28
28
|
// Ensure Docker is installed
|
|
29
29
|
if (!nodeInfo.isDockerInstalled) {
|
|
30
|
-
checkDockerInstalledCache.checked = false;
|
|
31
30
|
if (!(await checkDockerInstalled())) {
|
|
32
31
|
throw new Error('Docker is not installed');
|
|
33
32
|
}
|
|
@@ -2,7 +2,7 @@ const pm2 = require('@abtnode/util/lib/async-pm2');
|
|
|
2
2
|
const logger = require('@abtnode/logger')('@abtnode/core:util:blocklet');
|
|
3
3
|
const promiseSpawn = require('@abtnode/util/lib/promise-spawn');
|
|
4
4
|
|
|
5
|
-
const { checkDockerInstalled
|
|
5
|
+
const { checkDockerInstalled } = require('./check-docker-installed');
|
|
6
6
|
const parseDockerName = require('./parse-docker-name');
|
|
7
7
|
const promiseDebounce = require('../promise-debounce');
|
|
8
8
|
|
|
@@ -14,7 +14,8 @@ async function pruneDockerNetwork() {
|
|
|
14
14
|
}
|
|
15
15
|
pruneLock = true;
|
|
16
16
|
try {
|
|
17
|
-
|
|
17
|
+
const isDockerInstalled = await checkDockerInstalled();
|
|
18
|
+
if (isDockerInstalled) {
|
|
18
19
|
await promiseSpawn('docker network prune -f');
|
|
19
20
|
}
|
|
20
21
|
} catch (e) {
|
|
@@ -3,7 +3,7 @@ const logger = require('@abtnode/logger')('@abtnode/docker-network');
|
|
|
3
3
|
const promiseSpawn = require('@abtnode/util/lib/promise-spawn');
|
|
4
4
|
const LockFile = require('@abtnode/util/lib/lock-with-file');
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const { checkDockerInstalled } = require('./check-docker-installed');
|
|
7
7
|
|
|
8
8
|
const lockFile = new LockFile(
|
|
9
9
|
process.env.ABT_NODE_DATA_DIR ? path.join(process.env.ABT_NODE_DATA_DIR, 'tmp', 'docker-network-locks') : '',
|
|
@@ -29,7 +29,8 @@ setInterval(
|
|
|
29
29
|
if (!lockFile.tryLock(networkPruneLockName)) {
|
|
30
30
|
return;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
const isDockerInstalled = await checkDockerInstalled();
|
|
33
|
+
if (isDockerInstalled) {
|
|
33
34
|
await promiseSpawn('docker network prune -f');
|
|
34
35
|
}
|
|
35
36
|
logger.info('docker prune network done');
|
|
@@ -47,7 +48,6 @@ async function _createDockerNetwork(dockerNetworkName, nodeInfo) {
|
|
|
47
48
|
return;
|
|
48
49
|
}
|
|
49
50
|
if (!nodeInfo.isDockerInstalled) {
|
|
50
|
-
checkDockerInstalledCache.checked = false;
|
|
51
51
|
if (!(await checkDockerInstalled())) {
|
|
52
52
|
return;
|
|
53
53
|
}
|
|
@@ -91,16 +91,26 @@ class DomainStatus extends EventEmitter {
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
checkDomainDNS(domain, cnameDomain) {
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
try {
|
|
95
|
+
if (isCustomDomain(domain)) {
|
|
96
|
+
return checkDNS(domain, cnameDomain);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return Promise.resolve({
|
|
100
|
+
isDnsResolved: true,
|
|
101
|
+
hasCname: true,
|
|
102
|
+
cnameRecords: [cnameDomain],
|
|
103
|
+
isCnameMatch: true,
|
|
104
|
+
});
|
|
105
|
+
} catch (error) {
|
|
106
|
+
logger.error('check domain dns error', error?.message);
|
|
107
|
+
return Promise.resolve({
|
|
108
|
+
isDnsResolved: false,
|
|
109
|
+
hasCname: false,
|
|
110
|
+
cnameRecords: [],
|
|
111
|
+
isCnameMatch: false,
|
|
112
|
+
});
|
|
96
113
|
}
|
|
97
|
-
|
|
98
|
-
return Promise.resolve({
|
|
99
|
-
isDnsResolved: true,
|
|
100
|
-
hasCname: true,
|
|
101
|
-
cnameRecords: [cnameDomain],
|
|
102
|
-
isCnameMatch: true,
|
|
103
|
-
});
|
|
104
114
|
}
|
|
105
115
|
|
|
106
116
|
async checkDomainsStatus({ domains, did } = {}) {
|
|
@@ -109,24 +119,16 @@ class DomainStatus extends EventEmitter {
|
|
|
109
119
|
domains = await this.states.site.getBlockletDomains(did);
|
|
110
120
|
}
|
|
111
121
|
|
|
122
|
+
const cnameDomain = domains.find((x) => isDidDomain(x));
|
|
123
|
+
|
|
112
124
|
(domains || []).forEach((domain) => {
|
|
113
|
-
Promise.all([
|
|
114
|
-
this.getHttpsCert(domain),
|
|
115
|
-
checkDomainDnsWrapper(domain),
|
|
116
|
-
this.checkDomainDNS(
|
|
117
|
-
domain,
|
|
118
|
-
domains.find((x) => isDidDomain(x))
|
|
119
|
-
),
|
|
120
|
-
])
|
|
125
|
+
Promise.all([this.getHttpsCert(domain), checkDomainDnsWrapper(domain), this.checkDomainDNS(domain, cnameDomain)])
|
|
121
126
|
.then(([matchedCert, dns, dnsResolve]) => {
|
|
122
127
|
const eventData = {
|
|
123
128
|
domain,
|
|
124
129
|
matchedCert,
|
|
125
130
|
isHttps: !!matchedCert,
|
|
126
|
-
dns: {
|
|
127
|
-
...dns,
|
|
128
|
-
...dnsResolve,
|
|
129
|
-
},
|
|
131
|
+
dns: { ...dns, ...dnsResolve },
|
|
130
132
|
};
|
|
131
133
|
|
|
132
134
|
if (did) {
|
package/lib/util/launcher.js
CHANGED
|
@@ -491,6 +491,7 @@ const isDataRetentionExceeded = (terminatedAt) =>
|
|
|
491
491
|
!!terminatedAt && dayjs().diff(dayjs(terminatedAt), 'days') > SERVERLESS_BLOCKLET_DATA_RETENTION_DAYS;
|
|
492
492
|
|
|
493
493
|
const launchBlockletByLauncher = async (node, extraParams, context) => {
|
|
494
|
+
logger.debug('launchBlockletByLauncher', { extraParams, context });
|
|
494
495
|
const checker = createServerlessInstallGuard(node, true);
|
|
495
496
|
|
|
496
497
|
extraParams.locale = context.locale || 'en';
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
const Joi = require('joi');
|
|
2
|
+
|
|
3
|
+
const colorString = Joi.string(); // Accepts rgba, hex, etc.
|
|
4
|
+
|
|
5
|
+
const paletteColorSchema = Joi.object({
|
|
6
|
+
main: colorString,
|
|
7
|
+
contrastText: colorString.optional(),
|
|
8
|
+
light: colorString.optional(),
|
|
9
|
+
dark: colorString.optional(),
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const greySchema = Joi.object({
|
|
13
|
+
50: colorString.optional(),
|
|
14
|
+
100: colorString.optional(),
|
|
15
|
+
200: colorString.optional(),
|
|
16
|
+
300: colorString.optional(),
|
|
17
|
+
400: colorString.optional(),
|
|
18
|
+
500: colorString.optional(),
|
|
19
|
+
600: colorString.optional(),
|
|
20
|
+
700: colorString.optional(),
|
|
21
|
+
800: colorString.optional(),
|
|
22
|
+
900: colorString.optional(),
|
|
23
|
+
A100: colorString.optional(),
|
|
24
|
+
A200: colorString.optional(),
|
|
25
|
+
A400: colorString.optional(),
|
|
26
|
+
A700: colorString.optional(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const textSchema = Joi.object({
|
|
30
|
+
primary: colorString.optional(),
|
|
31
|
+
secondary: colorString.optional(),
|
|
32
|
+
disabled: colorString.optional(),
|
|
33
|
+
hint: colorString.optional(),
|
|
34
|
+
contrast: colorString.optional(),
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const backgroundSchema = Joi.object({
|
|
38
|
+
default: colorString.optional(),
|
|
39
|
+
paper: colorString.optional(),
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
const commonSchema = Joi.object({
|
|
43
|
+
black: colorString.optional(),
|
|
44
|
+
white: colorString.optional(),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const actionSchema = Joi.object({
|
|
48
|
+
active: colorString.optional(),
|
|
49
|
+
hover: colorString.optional(),
|
|
50
|
+
hoverOpacity: Joi.number().optional(),
|
|
51
|
+
selected: colorString.optional(),
|
|
52
|
+
selectedOpacity: Joi.number().optional(),
|
|
53
|
+
disabled: colorString.optional(),
|
|
54
|
+
disabledBackground: colorString.optional(),
|
|
55
|
+
disabledOpacity: Joi.number().optional(),
|
|
56
|
+
focus: colorString.optional(),
|
|
57
|
+
focusOpacity: Joi.number().optional(),
|
|
58
|
+
activatedOpacity: Joi.number().optional(),
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
const paletteSchema = Joi.object({
|
|
62
|
+
mode: Joi.string().valid('light', 'dark').required(),
|
|
63
|
+
primary: paletteColorSchema.required(),
|
|
64
|
+
secondary: paletteColorSchema.required(),
|
|
65
|
+
error: paletteColorSchema.required(),
|
|
66
|
+
warning: paletteColorSchema.required(),
|
|
67
|
+
info: paletteColorSchema.required(),
|
|
68
|
+
success: paletteColorSchema.required(),
|
|
69
|
+
grey: greySchema.required(),
|
|
70
|
+
text: textSchema.required(),
|
|
71
|
+
divider: colorString.optional(),
|
|
72
|
+
background: backgroundSchema.optional(),
|
|
73
|
+
common: commonSchema.optional(),
|
|
74
|
+
action: actionSchema.optional(),
|
|
75
|
+
storeSecondary: paletteColorSchema.optional(),
|
|
76
|
+
did: Joi.object({
|
|
77
|
+
primary: colorString.optional(),
|
|
78
|
+
secondary: colorString.optional(),
|
|
79
|
+
}).optional(),
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
const shapeSchema = Joi.object({
|
|
83
|
+
borderRadius: Joi.number().optional(),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const typographyVariantSchema = Joi.object({
|
|
87
|
+
fontSize: Joi.alternatives(Joi.string(), Joi.number()).optional(),
|
|
88
|
+
lineHeight: Joi.alternatives(Joi.string(), Joi.number()).optional(),
|
|
89
|
+
fontWeight: Joi.number().optional(),
|
|
90
|
+
textTransform: Joi.string().optional(),
|
|
91
|
+
fontFamily: Joi.string().optional(),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const allowedTypographyVariants = [
|
|
95
|
+
'h1',
|
|
96
|
+
'h2',
|
|
97
|
+
'h3',
|
|
98
|
+
'h4',
|
|
99
|
+
'h5',
|
|
100
|
+
'h6',
|
|
101
|
+
'subtitle1',
|
|
102
|
+
'subtitle2',
|
|
103
|
+
'body1',
|
|
104
|
+
'body2',
|
|
105
|
+
'caption',
|
|
106
|
+
'overline',
|
|
107
|
+
'button',
|
|
108
|
+
'allVariants',
|
|
109
|
+
];
|
|
110
|
+
const typographySchema = Joi.object({
|
|
111
|
+
fontSize: Joi.number().optional(),
|
|
112
|
+
fontFamily: Joi.string().optional(),
|
|
113
|
+
color: Joi.object({
|
|
114
|
+
main: colorString.optional(),
|
|
115
|
+
gray: colorString.optional(),
|
|
116
|
+
}).optional(),
|
|
117
|
+
...Object.fromEntries(allowedTypographyVariants.map((v) => [v, typographyVariantSchema.optional()])),
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
const breakpointsSchema = Joi.object({
|
|
121
|
+
values: Joi.object({
|
|
122
|
+
xs: Joi.number().optional(),
|
|
123
|
+
sm: Joi.number().optional(),
|
|
124
|
+
md: Joi.number().optional(),
|
|
125
|
+
lg: Joi.number().optional(),
|
|
126
|
+
xl: Joi.number().optional(),
|
|
127
|
+
}).optional(),
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const shadowsSchema = Joi.array().items(Joi.string()).min(1).max(25);
|
|
131
|
+
|
|
132
|
+
const styleOverrideSchema = Joi.object().pattern(Joi.string(), Joi.any());
|
|
133
|
+
|
|
134
|
+
const componentsSchema = Joi.object().pattern(
|
|
135
|
+
Joi.string(),
|
|
136
|
+
Joi.object({
|
|
137
|
+
styleOverrides: styleOverrideSchema.optional(),
|
|
138
|
+
})
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const muiThemeSchema = Joi.object({
|
|
142
|
+
palette: paletteSchema.optional(),
|
|
143
|
+
shape: shapeSchema.optional(),
|
|
144
|
+
typography: typographySchema.optional(),
|
|
145
|
+
breakpoints: breakpointsSchema.optional(),
|
|
146
|
+
shadows: shadowsSchema.optional(),
|
|
147
|
+
components: componentsSchema.optional(),
|
|
148
|
+
}).options({ allowUnknown: true, stripUnknown: true });
|
|
149
|
+
|
|
150
|
+
const blockletThemeSchema = Joi.object({
|
|
151
|
+
light: muiThemeSchema.required(),
|
|
152
|
+
dark: muiThemeSchema.required(),
|
|
153
|
+
prefer: Joi.string().valid('light', 'dark', 'system').default('light'),
|
|
154
|
+
}).options({ allowUnknown: true, stripUnknown: true });
|
|
155
|
+
|
|
156
|
+
module.exports = {
|
|
157
|
+
muiThemeSchema,
|
|
158
|
+
blockletThemeSchema,
|
|
159
|
+
};
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.44-beta-
|
|
6
|
+
"version": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,44 +19,44 @@
|
|
|
19
19
|
"author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
|
|
20
20
|
"license": "Apache-2.0",
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@abtnode/analytics": "1.16.44-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.44-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.44-beta-
|
|
25
|
-
"@abtnode/client": "1.16.44-beta-
|
|
26
|
-
"@abtnode/constant": "1.16.44-beta-
|
|
27
|
-
"@abtnode/cron": "1.16.44-beta-
|
|
28
|
-
"@abtnode/docker-utils": "1.16.44-beta-
|
|
29
|
-
"@abtnode/logger": "1.16.44-beta-
|
|
30
|
-
"@abtnode/models": "1.16.44-beta-
|
|
31
|
-
"@abtnode/queue": "1.16.44-beta-
|
|
32
|
-
"@abtnode/rbac": "1.16.44-beta-
|
|
33
|
-
"@abtnode/router-provider": "1.16.44-beta-
|
|
34
|
-
"@abtnode/static-server": "1.16.44-beta-
|
|
35
|
-
"@abtnode/timemachine": "1.16.44-beta-
|
|
36
|
-
"@abtnode/util": "1.16.44-beta-
|
|
37
|
-
"@arcblock/did": "1.20.
|
|
38
|
-
"@arcblock/did-auth": "1.20.
|
|
39
|
-
"@arcblock/did-ext": "1.20.
|
|
22
|
+
"@abtnode/analytics": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
23
|
+
"@abtnode/auth": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
25
|
+
"@abtnode/client": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
26
|
+
"@abtnode/constant": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
27
|
+
"@abtnode/cron": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
28
|
+
"@abtnode/docker-utils": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
29
|
+
"@abtnode/logger": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
30
|
+
"@abtnode/models": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
31
|
+
"@abtnode/queue": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
32
|
+
"@abtnode/rbac": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
33
|
+
"@abtnode/router-provider": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
34
|
+
"@abtnode/static-server": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
35
|
+
"@abtnode/timemachine": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
36
|
+
"@abtnode/util": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
37
|
+
"@arcblock/did": "1.20.11",
|
|
38
|
+
"@arcblock/did-auth": "1.20.11",
|
|
39
|
+
"@arcblock/did-ext": "1.20.11",
|
|
40
40
|
"@arcblock/did-motif": "^1.1.13",
|
|
41
|
-
"@arcblock/did-util": "1.20.
|
|
42
|
-
"@arcblock/event-hub": "1.20.
|
|
43
|
-
"@arcblock/jwt": "1.20.
|
|
41
|
+
"@arcblock/did-util": "1.20.11",
|
|
42
|
+
"@arcblock/event-hub": "1.20.11",
|
|
43
|
+
"@arcblock/jwt": "1.20.11",
|
|
44
44
|
"@arcblock/pm2-events": "^0.0.5",
|
|
45
|
-
"@arcblock/validator": "1.20.
|
|
46
|
-
"@arcblock/vc": "1.20.
|
|
47
|
-
"@blocklet/constant": "1.16.44-beta-
|
|
48
|
-
"@blocklet/did-space-js": "^1.0.
|
|
49
|
-
"@blocklet/env": "1.16.44-beta-
|
|
45
|
+
"@arcblock/validator": "1.20.11",
|
|
46
|
+
"@arcblock/vc": "1.20.11",
|
|
47
|
+
"@blocklet/constant": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
48
|
+
"@blocklet/did-space-js": "^1.0.53",
|
|
49
|
+
"@blocklet/env": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
50
50
|
"@blocklet/error": "^0.2.4",
|
|
51
|
-
"@blocklet/meta": "1.16.44-beta-
|
|
52
|
-
"@blocklet/resolver": "1.16.44-beta-
|
|
53
|
-
"@blocklet/sdk": "1.16.44-beta-
|
|
54
|
-
"@blocklet/store": "1.16.44-beta-
|
|
55
|
-
"@blocklet/theme": "^2.13.
|
|
51
|
+
"@blocklet/meta": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
52
|
+
"@blocklet/resolver": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
53
|
+
"@blocklet/sdk": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
54
|
+
"@blocklet/store": "1.16.44-beta-20250516-225119-c0b5ec8d",
|
|
55
|
+
"@blocklet/theme": "^2.13.37",
|
|
56
56
|
"@fidm/x509": "^1.2.1",
|
|
57
|
-
"@ocap/mcrypto": "1.20.
|
|
58
|
-
"@ocap/util": "1.20.
|
|
59
|
-
"@ocap/wallet": "1.20.
|
|
57
|
+
"@ocap/mcrypto": "1.20.11",
|
|
58
|
+
"@ocap/util": "1.20.11",
|
|
59
|
+
"@ocap/wallet": "1.20.11",
|
|
60
60
|
"@slack/webhook": "^5.0.4",
|
|
61
61
|
"archiver": "^7.0.1",
|
|
62
62
|
"axios": "^1.7.9",
|
|
@@ -116,5 +116,5 @@
|
|
|
116
116
|
"jest": "^29.7.0",
|
|
117
117
|
"unzipper": "^0.10.11"
|
|
118
118
|
},
|
|
119
|
-
"gitHead": "
|
|
119
|
+
"gitHead": "eb15dee761c0ea273981c848992e5f29b94a69dc"
|
|
120
120
|
}
|