@abtnode/core 1.16.21-beta-bd0e2503 → 1.16.21-beta-445a8baa
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 +3 -4
- package/lib/blocklet/manager/config-synchronizer.js +1 -0
- package/lib/blocklet/manager/disk.js +50 -28
- package/lib/blocklet/project/index.js +30 -7
- package/lib/event/index.js +2 -1
- package/lib/router/helper.js +20 -2
- package/lib/router/manager.js +9 -9
- package/lib/states/notification.js +8 -1
- package/lib/team/manager.js +8 -1
- package/lib/util/blocklet.js +34 -8
- package/lib/webhook/index.js +10 -1
- package/package.json +20 -20
package/lib/api/team.js
CHANGED
|
@@ -1332,10 +1332,9 @@ class TeamAPI extends EventEmitter {
|
|
|
1332
1332
|
);
|
|
1333
1333
|
}
|
|
1334
1334
|
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
}
|
|
1335
|
+
createNotification = (payload) => {
|
|
1336
|
+
return this.teamManager.createNotification(payload);
|
|
1337
|
+
};
|
|
1339
1338
|
|
|
1340
1339
|
async getNotification({ teamDid, ...rest }) {
|
|
1341
1340
|
const notificationState = await this.getNotificationState(teamDid);
|
|
@@ -141,6 +141,7 @@ const {
|
|
|
141
141
|
getAppConfigsFromComponent,
|
|
142
142
|
removeAppConfigsFromComponent,
|
|
143
143
|
getConfigsFromInput,
|
|
144
|
+
getPackConfig,
|
|
144
145
|
} = require('../../util/blocklet');
|
|
145
146
|
const { getDidDomainForBlocklet } = require('../../util/get-domain-for-blocklet');
|
|
146
147
|
const states = require('../../states');
|
|
@@ -1184,7 +1185,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
1184
1185
|
}
|
|
1185
1186
|
|
|
1186
1187
|
// eslint-disable-next-line no-unused-vars
|
|
1187
|
-
async config({ did, configs: newConfigs, skipHook, skipDidDocument }, context) {
|
|
1188
|
+
async config({ did, configs: newConfigs, skipHook, skipDidDocument, skipEmitEvents }, context) {
|
|
1188
1189
|
// todo: skipDidDocument will be deleted
|
|
1189
1190
|
if (!Array.isArray(newConfigs)) {
|
|
1190
1191
|
throw new Error('configs list is not an array');
|
|
@@ -1323,25 +1324,27 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
1323
1324
|
await this._updateDidDocument(newState);
|
|
1324
1325
|
}
|
|
1325
1326
|
|
|
1326
|
-
if (!
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1327
|
+
if (!skipEmitEvents) {
|
|
1328
|
+
if (!childDid && !newConfigs.some((x) => x.key === BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SK)) {
|
|
1329
|
+
this.emit(BlockletInternalEvents.appConfigChanged, {
|
|
1330
|
+
appDid: rootDid,
|
|
1331
|
+
configs: newConfigs.map((x) => ({ key: x.key, value: x.value })),
|
|
1332
|
+
});
|
|
1333
|
+
this.configSynchronizer.throttledSyncAppConfig(blocklet.meta.did);
|
|
1334
|
+
}
|
|
1333
1335
|
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1336
|
+
this.emit(BlockletEvents.updated, { ...newState, context });
|
|
1337
|
+
const serverSk = (await states.node.read()).sk;
|
|
1338
|
+
if (childDid) {
|
|
1339
|
+
const configs = JSON.stringify(newConfigs.map((x) => ({ key: x.key, value: x.value })));
|
|
1340
|
+
this.emit(BlockletInternalEvents.componentConfigChanged, {
|
|
1341
|
+
appDid: rootDid,
|
|
1342
|
+
componentDid: childDid,
|
|
1343
|
+
configs: encrypt(configs, getComponentApiKey({ serverSk, app: ancestors[0], component: blocklet }), childDid),
|
|
1344
|
+
});
|
|
1343
1345
|
|
|
1344
|
-
|
|
1346
|
+
this.configSynchronizer.syncComponentConfig(childDid, rootDid, { serverSk });
|
|
1347
|
+
}
|
|
1345
1348
|
}
|
|
1346
1349
|
|
|
1347
1350
|
return newState;
|
|
@@ -1628,6 +1631,7 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
1628
1631
|
|
|
1629
1632
|
const blocklet = await states.blocklet.getBlocklet(did);
|
|
1630
1633
|
await states.blockletExtras.setSettings(blocklet.meta.did, { initialized: true, owner });
|
|
1634
|
+
this.configSynchronizer.throttledSyncAppConfig(blocklet.meta.did);
|
|
1631
1635
|
logger.info('Blocklet initialized', { did, owner });
|
|
1632
1636
|
|
|
1633
1637
|
this.emit(BlockletEvents.updated, { meta: { did: blocklet.meta.did }, context });
|
|
@@ -2857,6 +2861,22 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
2857
2861
|
await this._updateDependents(did);
|
|
2858
2862
|
blocklet = await this.getBlocklet(did);
|
|
2859
2863
|
|
|
2864
|
+
// Inject pack configs
|
|
2865
|
+
const packConfig = await getPackConfig(blocklet);
|
|
2866
|
+
if (packConfig) {
|
|
2867
|
+
await this.configNavigations({ did, navigations: packConfig.navigations });
|
|
2868
|
+
|
|
2869
|
+
for (const { did: componentDid, configs } of packConfig.components || []) {
|
|
2870
|
+
await this.config({
|
|
2871
|
+
did: [blocklet.meta.did, componentDid],
|
|
2872
|
+
configs,
|
|
2873
|
+
skipHook: true,
|
|
2874
|
+
skipDidDocument: true,
|
|
2875
|
+
skipEmitEvents: true,
|
|
2876
|
+
});
|
|
2877
|
+
}
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2860
2880
|
this.emit(BlockletEvents.installed, { blocklet, context });
|
|
2861
2881
|
|
|
2862
2882
|
// Update dynamic component meta in blocklet settings
|
|
@@ -3387,13 +3407,6 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
3387
3407
|
}
|
|
3388
3408
|
|
|
3389
3409
|
try {
|
|
3390
|
-
const extra = await states.blockletExtras.getMeta(did);
|
|
3391
|
-
const isExternal = !!extra?.controller;
|
|
3392
|
-
|
|
3393
|
-
if (isExternal) {
|
|
3394
|
-
return;
|
|
3395
|
-
}
|
|
3396
|
-
|
|
3397
3410
|
let blockletUrl;
|
|
3398
3411
|
try {
|
|
3399
3412
|
const blocklet = await this.getBlocklet(did);
|
|
@@ -3408,9 +3421,18 @@ class DiskBlockletManager extends BaseBlockletManager {
|
|
|
3408
3421
|
logger.error('[_createNotification] get blocklet url failed', { error });
|
|
3409
3422
|
}
|
|
3410
3423
|
|
|
3411
|
-
|
|
3412
|
-
const
|
|
3413
|
-
|
|
3424
|
+
// if blocklet is external, no need to create notification in server
|
|
3425
|
+
const extra = await states.blockletExtras.getMeta(did);
|
|
3426
|
+
const isExternal = !!extra?.controller;
|
|
3427
|
+
if (!isExternal) {
|
|
3428
|
+
await states.notification.create({ ...notification, blockletUrl });
|
|
3429
|
+
}
|
|
3430
|
+
|
|
3431
|
+
await this.teamManager.createNotification({
|
|
3432
|
+
teamDid: did,
|
|
3433
|
+
...notification,
|
|
3434
|
+
blockletUrl,
|
|
3435
|
+
});
|
|
3414
3436
|
} catch (error) {
|
|
3415
3437
|
logger.error('create notification failed', { error });
|
|
3416
3438
|
}
|
|
@@ -2,12 +2,14 @@ const path = require('path');
|
|
|
2
2
|
const fs = require('fs-extra');
|
|
3
3
|
const createArchive = require('archiver');
|
|
4
4
|
const { slugify } = require('transliteration');
|
|
5
|
-
const {
|
|
5
|
+
const { isValid: isValidDid } = require('@arcblock/did');
|
|
6
|
+
const { BLOCKLET_META_FILE, PROJECT, BLOCKLET_RESOURCE_DIR } = require('@blocklet/constant');
|
|
6
7
|
const { update: updateMetaFile } = require('@blocklet/meta/lib/file');
|
|
7
8
|
const { createRelease: createBlockletRelease } = require('@abtnode/util/lib/create-blocklet-release');
|
|
8
9
|
const { titleSchema } = require('@blocklet/meta/lib/schema');
|
|
9
10
|
const { validateNewDid } = require('@blocklet/meta/lib/name');
|
|
10
11
|
const urlPathFriendly = require('@blocklet/meta/lib/url-path-friendly').default;
|
|
12
|
+
const fg = require('fast-glob');
|
|
11
13
|
|
|
12
14
|
const logger = require('@abtnode/logger')('create-resource-blocklet');
|
|
13
15
|
|
|
@@ -119,6 +121,28 @@ const checkResourceExists = async (projectDir, action, releaseId) => {
|
|
|
119
121
|
}
|
|
120
122
|
};
|
|
121
123
|
|
|
124
|
+
const getResourceList = async (resourceDir) => {
|
|
125
|
+
const list = await fg(['*/*'], { cwd: resourceDir, onlyDirectories: true });
|
|
126
|
+
|
|
127
|
+
return list
|
|
128
|
+
.filter((x) => x !== COMPONENT_CONFIG_MAP_DIR)
|
|
129
|
+
.map((x) => {
|
|
130
|
+
const [did, type] = x.split('/');
|
|
131
|
+
if (!type) {
|
|
132
|
+
throw new Error(`invalid resource: ${x}. type is required`);
|
|
133
|
+
}
|
|
134
|
+
if (!isValidDid(did)) {
|
|
135
|
+
throw new Error(`invalid resource: ${x}. did is invalid`);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
return {
|
|
139
|
+
did,
|
|
140
|
+
type,
|
|
141
|
+
public: true,
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
};
|
|
145
|
+
|
|
122
146
|
const createRelease = async ({
|
|
123
147
|
did,
|
|
124
148
|
projectId,
|
|
@@ -274,15 +298,12 @@ const createRelease = async ({
|
|
|
274
298
|
|
|
275
299
|
// create resource
|
|
276
300
|
await fs.ensureDir(resourceDir);
|
|
277
|
-
const tmpBundleResourceDir = path.join(tmpBundleDir,
|
|
301
|
+
const tmpBundleResourceDir = path.join(tmpBundleDir, BLOCKLET_RESOURCE_DIR);
|
|
278
302
|
await fs.copy(resourceDir, tmpBundleResourceDir);
|
|
279
303
|
await fs.remove(path.join(tmpBundleResourceDir, COMPONENT_CONFIG_MAP_DIR));
|
|
280
304
|
|
|
281
305
|
// create blocklet.yml
|
|
282
|
-
const resourceList = await
|
|
283
|
-
const resourcesPaths = resourceList
|
|
284
|
-
.filter((x) => x !== COMPONENT_CONFIG_MAP_DIR)
|
|
285
|
-
.map((x) => path.join('/resource', x));
|
|
306
|
+
const resourceList = await getResourceList(resourceDir);
|
|
286
307
|
const meta = {
|
|
287
308
|
did: blockletDid,
|
|
288
309
|
name: blockletDid,
|
|
@@ -290,7 +311,9 @@ const createRelease = async ({
|
|
|
290
311
|
description: blockletDescription,
|
|
291
312
|
version: blockletVersion,
|
|
292
313
|
logo: logoFileName,
|
|
293
|
-
|
|
314
|
+
resource: {
|
|
315
|
+
bundles: resourceList.length ? resourceList : undefined,
|
|
316
|
+
},
|
|
294
317
|
components: [],
|
|
295
318
|
files: project.blockletScreenshots?.length ? ['screenshots'] : [],
|
|
296
319
|
screenshots: project.blockletScreenshots || [],
|
package/lib/event/index.js
CHANGED
|
@@ -341,7 +341,7 @@ module.exports = ({
|
|
|
341
341
|
sticky: true,
|
|
342
342
|
};
|
|
343
343
|
await node.createNotification(param);
|
|
344
|
-
await node.
|
|
344
|
+
await node.createBlockletNotification({ ...param, teamDid: args.did });
|
|
345
345
|
}
|
|
346
346
|
} catch (error) {
|
|
347
347
|
logger.error('Failed to createAuditLog for backupToSpaces failed', { error });
|
|
@@ -500,6 +500,7 @@ module.exports = ({
|
|
|
500
500
|
listen(teamAPI, EVENTS.USER_PERMISSION_UPDATED, onEvent);
|
|
501
501
|
listen(teamAPI, BlockletEvents.updated, onEvent);
|
|
502
502
|
listen(teamManager, BlockletEvents.storeChange, onEvent);
|
|
503
|
+
listen(teamManager, EVENTS.NOTIFICATION_BLOCKLET_CREATE, onEvent);
|
|
503
504
|
|
|
504
505
|
listen(certManager, EVENTS.CERT_ISSUED, onEvent);
|
|
505
506
|
listen(certManager, EVENTS.CERT_ERROR, onEvent);
|
package/lib/router/helper.js
CHANGED
|
@@ -77,7 +77,11 @@ const { getFromCache: getAccessibleExternalNodeIp } = require('../util/get-acces
|
|
|
77
77
|
const Router = require('./index');
|
|
78
78
|
const states = require('../states');
|
|
79
79
|
const { getBlockletDomainGroupName, getDidFromDomainGroupName } = require('../util/router');
|
|
80
|
-
const {
|
|
80
|
+
const {
|
|
81
|
+
getBlockletDidDomainList,
|
|
82
|
+
updateDidDocument: updateBlockletDocument,
|
|
83
|
+
getPackConfig,
|
|
84
|
+
} = require('../util/blocklet');
|
|
81
85
|
const { toCamelCase } = require('../util/index');
|
|
82
86
|
const { get: getIp } = require('../util/ip');
|
|
83
87
|
|
|
@@ -391,6 +395,7 @@ const ensureWellknownRule = async (sites = []) => {
|
|
|
391
395
|
componentId: rule.to.componentId,
|
|
392
396
|
cacheGroup: isServiceFeDevelopment ? '' : 'blockletProxy',
|
|
393
397
|
target: avatarPathPrefix,
|
|
398
|
+
port: process.env.ABT_NODE_SERVICE_PORT,
|
|
394
399
|
},
|
|
395
400
|
isProtected: true,
|
|
396
401
|
dynamic: true,
|
|
@@ -1008,13 +1013,26 @@ module.exports = function getRouterHelpers({ dataDirs, routingSnapshot, routerMa
|
|
|
1008
1013
|
// let didDomain in front of ipEchoDnsDomain
|
|
1009
1014
|
domainAliases.push({ value: getIpDnsDomainForBlocklet(blocklet), isProtected: true });
|
|
1010
1015
|
|
|
1016
|
+
const rules = [rule];
|
|
1017
|
+
|
|
1018
|
+
// inject rules in pack after app installed
|
|
1019
|
+
const config = await getPackConfig(blocklet);
|
|
1020
|
+
const rulesInPack = (config?.site?.rules || []).map((x) => {
|
|
1021
|
+
const y = { ...x };
|
|
1022
|
+
if (y.to.did) {
|
|
1023
|
+
y.to.did = blocklet.meta.did;
|
|
1024
|
+
}
|
|
1025
|
+
return y;
|
|
1026
|
+
});
|
|
1027
|
+
rules.push(...rulesInPack);
|
|
1028
|
+
|
|
1011
1029
|
await routerManager.addRoutingSite(
|
|
1012
1030
|
{
|
|
1013
1031
|
site: {
|
|
1014
1032
|
domain: domainGroup,
|
|
1015
1033
|
domainAliases,
|
|
1016
1034
|
isProtected: true,
|
|
1017
|
-
rules
|
|
1035
|
+
rules,
|
|
1018
1036
|
},
|
|
1019
1037
|
skipCheckDynamicBlacklist: true,
|
|
1020
1038
|
skipValidation: true,
|
package/lib/router/manager.js
CHANGED
|
@@ -32,7 +32,12 @@ const {
|
|
|
32
32
|
BLOCKLET_INTERFACE_TYPE_WEB,
|
|
33
33
|
BlockletGroup,
|
|
34
34
|
} = require('@blocklet/constant');
|
|
35
|
-
const {
|
|
35
|
+
const {
|
|
36
|
+
forEachComponentV2Sync,
|
|
37
|
+
hasStartEngine,
|
|
38
|
+
isGatewayBlocklet,
|
|
39
|
+
getComponentId,
|
|
40
|
+
} = require('@blocklet/meta/lib/util');
|
|
36
41
|
const { fromPublicKey } = require('@ocap/wallet');
|
|
37
42
|
|
|
38
43
|
const {
|
|
@@ -708,7 +713,7 @@ class RouterManager extends EventEmitter {
|
|
|
708
713
|
rules.push(rawRule);
|
|
709
714
|
}
|
|
710
715
|
|
|
711
|
-
|
|
716
|
+
forEachComponentV2Sync(blocklet, (component) => {
|
|
712
717
|
const { meta } = component;
|
|
713
718
|
if (isGatewayBlocklet(meta) || !hasStartEngine(meta)) {
|
|
714
719
|
return;
|
|
@@ -728,12 +733,7 @@ class RouterManager extends EventEmitter {
|
|
|
728
733
|
return;
|
|
729
734
|
}
|
|
730
735
|
|
|
731
|
-
const pathPrefix = path.join(
|
|
732
|
-
blockletPrefix,
|
|
733
|
-
// level 1 component should be independent with root component
|
|
734
|
-
...ancestors.slice(1).map((x) => x.mountPoint || ''),
|
|
735
|
-
mountPoint
|
|
736
|
-
);
|
|
736
|
+
const pathPrefix = path.join(blockletPrefix, mountPoint);
|
|
737
737
|
|
|
738
738
|
const occupied = normalizePathPrefix(pathPrefix) === normalizePathPrefix(rawRule.from.pathPrefix);
|
|
739
739
|
|
|
@@ -754,7 +754,7 @@ class RouterManager extends EventEmitter {
|
|
|
754
754
|
port: findInterfacePortByName(component, childWebInterface.name),
|
|
755
755
|
did: rawRule.to.did, // root component did
|
|
756
756
|
interfaceName: rawRule.to.interfaceName, // root component interface
|
|
757
|
-
componentId:
|
|
757
|
+
componentId: getComponentId(component, [blocklet]),
|
|
758
758
|
},
|
|
759
759
|
isProtected: occupied ? rawRule.isProtected : true,
|
|
760
760
|
};
|
|
@@ -40,7 +40,14 @@ class NotificationState extends BaseState {
|
|
|
40
40
|
severity: payload.severity || 'info',
|
|
41
41
|
read: false,
|
|
42
42
|
});
|
|
43
|
-
|
|
43
|
+
|
|
44
|
+
if (!payload.teamDid) {
|
|
45
|
+
this.emit(EVENTS.NOTIFICATION_CREATE, {
|
|
46
|
+
...payload,
|
|
47
|
+
...doc,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
44
51
|
return doc;
|
|
45
52
|
}
|
|
46
53
|
|
package/lib/team/manager.js
CHANGED
|
@@ -10,7 +10,7 @@ const pick = require('lodash/pick');
|
|
|
10
10
|
|
|
11
11
|
const { createRBAC, MemoryStorage, SequelizeStorage } = require('@abtnode/rbac');
|
|
12
12
|
const logger = require('@abtnode/logger')('@abtnode/core:team:manager');
|
|
13
|
-
const { ROLES, RBAC_CONFIG } = require('@abtnode/constant');
|
|
13
|
+
const { ROLES, RBAC_CONFIG, EVENTS } = require('@abtnode/constant');
|
|
14
14
|
const { BlockletEvents } = require('@blocklet/constant');
|
|
15
15
|
const Lock = require('@abtnode/util/lib/lock');
|
|
16
16
|
const {
|
|
@@ -136,6 +136,13 @@ class TeamManager extends EventEmitter {
|
|
|
136
136
|
return this.getState(teamDid, 'notification');
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
async createNotification({ teamDid, ...payload }) {
|
|
140
|
+
const notification = await this.getState(teamDid, 'notification');
|
|
141
|
+
const doc = await notification.create({ ...payload, teamDid });
|
|
142
|
+
const metaDid = await this.states.blocklet.getBlockletMetaDid(teamDid);
|
|
143
|
+
this.emit(EVENTS.NOTIFICATION_BLOCKLET_CREATE, { meta: { did: metaDid }, ...payload, ...doc, teamDid });
|
|
144
|
+
}
|
|
145
|
+
|
|
139
146
|
async getProjectState(teamDid) {
|
|
140
147
|
return {
|
|
141
148
|
projectState: await this.getState(teamDid, 'project'),
|
package/lib/util/blocklet.js
CHANGED
|
@@ -70,6 +70,7 @@ const {
|
|
|
70
70
|
fromBlockletStatus,
|
|
71
71
|
BLOCKLET_PREFERENCE_FILE,
|
|
72
72
|
BLOCKLET_PREFERENCE_PREFIX,
|
|
73
|
+
BLOCKLET_RESOURCE_DIR,
|
|
73
74
|
} = require('@blocklet/constant');
|
|
74
75
|
const validateBlockletEntry = require('@blocklet/meta/lib/entry');
|
|
75
76
|
const getBlockletEngine = require('@blocklet/meta/lib/engine');
|
|
@@ -377,6 +378,8 @@ const getComponentSystemEnvironments = (blocklet) => {
|
|
|
377
378
|
const getRuntimeEnvironments = (blocklet, nodeEnvironments, ancestors) => {
|
|
378
379
|
const root = (ancestors || [])[0] || blocklet;
|
|
379
380
|
|
|
381
|
+
const initialized = root?.settings?.initialized;
|
|
382
|
+
|
|
380
383
|
// pm2 will force inject env variables of daemon process to blocklet process
|
|
381
384
|
// we can only rewrite these private env variables to empty
|
|
382
385
|
const safeNodeEnvironments = PRIVATE_NODE_ENVS.reduce((o, x) => {
|
|
@@ -436,6 +439,10 @@ const getRuntimeEnvironments = (blocklet, nodeEnvironments, ancestors) => {
|
|
|
436
439
|
...safeNodeEnvironments,
|
|
437
440
|
};
|
|
438
441
|
|
|
442
|
+
if (initialized) {
|
|
443
|
+
env.initialized = initialized;
|
|
444
|
+
}
|
|
445
|
+
|
|
439
446
|
// ensure all envs are literals and do not contain line breaks
|
|
440
447
|
Object.keys(env).forEach((key) => {
|
|
441
448
|
env[key] = formatEnv(env[key]);
|
|
@@ -1536,16 +1543,10 @@ const checkDuplicateAppSk = async ({ sk, did, states }) => {
|
|
|
1536
1543
|
}
|
|
1537
1544
|
};
|
|
1538
1545
|
|
|
1539
|
-
const checkDuplicateMountPoint = (
|
|
1546
|
+
const checkDuplicateMountPoint = (app, mountPoint) => {
|
|
1540
1547
|
const err = new Error(`cannot add duplicate mount point, ${mountPoint || '/'} already exist`);
|
|
1541
|
-
if (
|
|
1542
|
-
blocklet.meta?.group !== BlockletGroup.gateway &&
|
|
1543
|
-
normalizePathPrefix(blocklet.mountPoint) === normalizePathPrefix(mountPoint)
|
|
1544
|
-
) {
|
|
1545
|
-
throw err;
|
|
1546
|
-
}
|
|
1547
1548
|
|
|
1548
|
-
for (const component of
|
|
1549
|
+
for (const component of app.children || []) {
|
|
1549
1550
|
if (
|
|
1550
1551
|
hasStartEngine(component.meta) &&
|
|
1551
1552
|
normalizePathPrefix(component.mountPoint) === normalizePathPrefix(mountPoint)
|
|
@@ -1935,6 +1936,30 @@ const removeAppConfigsFromComponent = async (componentConfigs, app, blockletExtr
|
|
|
1935
1936
|
}
|
|
1936
1937
|
};
|
|
1937
1938
|
|
|
1939
|
+
const getPackConfig = (app) => {
|
|
1940
|
+
const packComponent = (app?.children || []).find((x) => x.meta.group === BlockletGroup.pack);
|
|
1941
|
+
if (!packComponent) {
|
|
1942
|
+
return null;
|
|
1943
|
+
}
|
|
1944
|
+
|
|
1945
|
+
const resource = (packComponent.meta.resource?.bundles || []).find(
|
|
1946
|
+
(x) => x.did === packComponent.meta.did && x.type === 'config'
|
|
1947
|
+
);
|
|
1948
|
+
|
|
1949
|
+
if (!resource) {
|
|
1950
|
+
return null;
|
|
1951
|
+
}
|
|
1952
|
+
|
|
1953
|
+
const { appDir } = packComponent.env;
|
|
1954
|
+
const configFile = path.join(appDir, BLOCKLET_RESOURCE_DIR, resource.did, resource.type, 'config.json');
|
|
1955
|
+
|
|
1956
|
+
if (!fs.existsSync(configFile)) {
|
|
1957
|
+
return null;
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
return fs.readJSON(configFile);
|
|
1961
|
+
};
|
|
1962
|
+
|
|
1938
1963
|
module.exports = {
|
|
1939
1964
|
updateBlockletFallbackLogo,
|
|
1940
1965
|
forEachBlocklet,
|
|
@@ -2002,4 +2027,5 @@ module.exports = {
|
|
|
2002
2027
|
getAppConfigsFromComponent,
|
|
2003
2028
|
removeAppConfigsFromComponent,
|
|
2004
2029
|
getConfigsFromInput,
|
|
2030
|
+
getPackConfig,
|
|
2005
2031
|
};
|
package/lib/webhook/index.js
CHANGED
|
@@ -100,7 +100,11 @@ module.exports = ({ events, dataDirs, instance }) => {
|
|
|
100
100
|
const options = { ...message, nodeInfo, node: instance };
|
|
101
101
|
if (item.type === 'slack') {
|
|
102
102
|
// eslint-disable-next-line
|
|
103
|
-
options.urlInfo = await getSlackUrlInfo({
|
|
103
|
+
options.urlInfo = await getSlackUrlInfo({
|
|
104
|
+
blockletUrl: message.blockletUrl,
|
|
105
|
+
path: message.action,
|
|
106
|
+
serverUrls: baseUrls,
|
|
107
|
+
});
|
|
104
108
|
}
|
|
105
109
|
try {
|
|
106
110
|
// eslint-disable-next-line
|
|
@@ -133,6 +137,11 @@ module.exports = ({ events, dataDirs, instance }) => {
|
|
|
133
137
|
queue.push({ title, description, status: severity, action, entityType, blockletUrl });
|
|
134
138
|
});
|
|
135
139
|
|
|
140
|
+
events.on(EVENTS.NOTIFICATION_BLOCKLET_CREATE, (data) => {
|
|
141
|
+
const { title, description, severity, action, entityType, blockletUrl } = data;
|
|
142
|
+
queue.push({ title, description, status: severity, action, entityType, blockletUrl });
|
|
143
|
+
});
|
|
144
|
+
|
|
136
145
|
events.on(EVENTS.NODE_STARTED, async (message) => {
|
|
137
146
|
await sendMessage(message);
|
|
138
147
|
});
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.21-beta-
|
|
6
|
+
"version": "1.16.21-beta-445a8baa",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -19,19 +19,19 @@
|
|
|
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.21-beta-
|
|
23
|
-
"@abtnode/auth": "1.16.21-beta-
|
|
24
|
-
"@abtnode/certificate-manager": "1.16.21-beta-
|
|
25
|
-
"@abtnode/constant": "1.16.21-beta-
|
|
26
|
-
"@abtnode/cron": "1.16.21-beta-
|
|
27
|
-
"@abtnode/logger": "1.16.21-beta-
|
|
28
|
-
"@abtnode/models": "1.16.21-beta-
|
|
29
|
-
"@abtnode/queue": "1.16.21-beta-
|
|
30
|
-
"@abtnode/rbac": "1.16.21-beta-
|
|
31
|
-
"@abtnode/router-provider": "1.16.21-beta-
|
|
32
|
-
"@abtnode/static-server": "1.16.21-beta-
|
|
33
|
-
"@abtnode/timemachine": "1.16.21-beta-
|
|
34
|
-
"@abtnode/util": "1.16.21-beta-
|
|
22
|
+
"@abtnode/analytics": "1.16.21-beta-445a8baa",
|
|
23
|
+
"@abtnode/auth": "1.16.21-beta-445a8baa",
|
|
24
|
+
"@abtnode/certificate-manager": "1.16.21-beta-445a8baa",
|
|
25
|
+
"@abtnode/constant": "1.16.21-beta-445a8baa",
|
|
26
|
+
"@abtnode/cron": "1.16.21-beta-445a8baa",
|
|
27
|
+
"@abtnode/logger": "1.16.21-beta-445a8baa",
|
|
28
|
+
"@abtnode/models": "1.16.21-beta-445a8baa",
|
|
29
|
+
"@abtnode/queue": "1.16.21-beta-445a8baa",
|
|
30
|
+
"@abtnode/rbac": "1.16.21-beta-445a8baa",
|
|
31
|
+
"@abtnode/router-provider": "1.16.21-beta-445a8baa",
|
|
32
|
+
"@abtnode/static-server": "1.16.21-beta-445a8baa",
|
|
33
|
+
"@abtnode/timemachine": "1.16.21-beta-445a8baa",
|
|
34
|
+
"@abtnode/util": "1.16.21-beta-445a8baa",
|
|
35
35
|
"@arcblock/did": "1.18.107",
|
|
36
36
|
"@arcblock/did-auth": "1.18.107",
|
|
37
37
|
"@arcblock/did-ext": "^1.18.107",
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"@arcblock/pm2-events": "^0.0.5",
|
|
43
43
|
"@arcblock/validator": "^1.18.107",
|
|
44
44
|
"@arcblock/vc": "1.18.107",
|
|
45
|
-
"@blocklet/constant": "1.16.21-beta-
|
|
46
|
-
"@blocklet/env": "1.16.21-beta-
|
|
47
|
-
"@blocklet/meta": "1.16.21-beta-
|
|
48
|
-
"@blocklet/resolver": "1.16.21-beta-
|
|
49
|
-
"@blocklet/sdk": "1.16.21-beta-
|
|
45
|
+
"@blocklet/constant": "1.16.21-beta-445a8baa",
|
|
46
|
+
"@blocklet/env": "1.16.21-beta-445a8baa",
|
|
47
|
+
"@blocklet/meta": "1.16.21-beta-445a8baa",
|
|
48
|
+
"@blocklet/resolver": "1.16.21-beta-445a8baa",
|
|
49
|
+
"@blocklet/sdk": "1.16.21-beta-445a8baa",
|
|
50
50
|
"@did-space/client": "^0.3.45",
|
|
51
51
|
"@fidm/x509": "^1.2.1",
|
|
52
52
|
"@ocap/mcrypto": "1.18.107",
|
|
@@ -102,5 +102,5 @@
|
|
|
102
102
|
"jest": "^27.5.1",
|
|
103
103
|
"unzipper": "^0.10.11"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "7a7ff8be7f424775c3bde0eead773d8e6177fa1a"
|
|
106
106
|
}
|