@abtnode/core 1.6.17 → 1.6.18

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.
@@ -1,68 +1,23 @@
1
- const childProcess = require('child_process');
2
1
  const get = require('lodash/get');
3
2
  const camelCase = require('lodash/camelCase');
3
+ const runScript = require('@abtnode/util/lib/run-script');
4
4
 
5
5
  // eslint-disable-next-line global-require
6
6
  const logger = require('@abtnode/logger')(`${require('../../package.json').name}:blocklet:hooks`);
7
7
 
8
8
  const { getSafeEnv } = require('../util');
9
9
 
10
- const runAsync = ({ appDir, env, hook, progress = false }) => {
11
- const safeEnv = getSafeEnv(env);
12
- const child = childProcess.exec(hook, {
13
- cwd: appDir,
14
- env: safeEnv,
15
- stdio: 'inherit',
16
- });
17
-
18
- if (progress) {
19
- child.stdout.pipe(process.stdout);
20
- child.stderr.pipe(process.stderr);
21
- }
22
-
23
- return new Promise((resolve, reject) => {
24
- const errorMessages = [];
25
- let hasUnhandledRejection = false;
26
-
27
- child.stderr.on('data', (err) => {
28
- // Check if has unhandledRejection in childProcess
29
- // https://stackoverflow.com/questions/32784649/gracefully-handle-errors-in-child-processes-in-nodejs
30
- if (err.includes('UnhandledPromiseRejectionWarning')) {
31
- hasUnhandledRejection = true;
32
- }
33
- errorMessages.push(err);
34
- });
35
-
36
- child.on('exit', (code) => {
37
- if (errorMessages.length > 0) {
38
- if (code !== 0 || hasUnhandledRejection) {
39
- return reject(new Error(errorMessages.join('\r\n')));
40
- }
41
-
42
- if (!progress) {
43
- errorMessages.forEach((message) => process.stderr.write(message));
44
- }
45
- }
46
-
47
- return resolve();
48
- });
49
- });
50
- };
51
-
52
- /**
53
- * @param {*} args.did root blocklet did
54
- */
55
- const runUserHook = async (name, args) => {
56
- const { appDir, hooks, env, exitOnError = true, progress = false, notification, did } = args;
57
- const hook = get(hooks, `[${name}]`) || get(hooks, `[${camelCase(name)}]`);
10
+ const runUserHook = async (appId, hookName, args) => {
11
+ const { appDir, hooks, env, exitOnError = true, silent = false, notification, did } = args;
12
+ const hook = get(hooks, `[${hookName}]`) || get(hooks, `[${camelCase(hookName)}]`);
58
13
 
59
14
  try {
60
15
  if (!hook) {
61
16
  return;
62
17
  }
63
18
 
64
- logger.info(`run hook:${name}:`, { hook });
65
- await runAsync({ appDir, env, hook, progress });
19
+ logger.info(`run hook:${hookName}:`, { hook });
20
+ await runScript(hook, [appId, hookName].join(':'), { cwd: appDir, env: getSafeEnv(env), silent });
66
21
  } catch (error) {
67
22
  logger.error(`run ${hook} error:`, { error });
68
23
 
@@ -77,33 +32,31 @@ const runUserHook = async (name, args) => {
77
32
  }
78
33
 
79
34
  if (exitOnError) {
80
- throw new Error(`Run [${name}] failed: ${error.message}`);
35
+ throw new Error(`Run [${hookName}] failed: ${error.message}`);
81
36
  }
82
37
  }
83
38
  };
84
39
 
85
- const preDeploy = (...args) => runUserHook('pre-deploy', ...args);
86
- const preInstall = (...args) => runUserHook('pre-install', ...args);
87
- const postInstall = (...args) => runUserHook('post-install', ...args);
88
-
89
- const preStart = async (blocklet, option) => {
40
+ const preDeploy = (appId, ...args) => runUserHook(appId, 'pre-deploy', ...args);
41
+ const preInstall = (appId, ...args) => runUserHook(appId, 'pre-install', ...args);
42
+ const postInstall = (appId, ...args) => runUserHook(appId, 'post-install', ...args);
43
+ const preConfig = (appId, ...args) => runUserHook(appId, 'pre-config', ...args);
44
+ const preStart = async (blocklet, options) => {
90
45
  // check required environments
91
46
  let environments = get(blocklet, 'meta.environments', []);
92
47
  if (!Array.isArray(environments)) {
93
48
  environments = [environments];
94
49
  }
95
50
 
96
- const tmp = environments.filter((e) => e.required && option.env[e.name] === undefined).map((e) => e.name);
51
+ const tmp = environments.filter((e) => e.required && options.env[e.name] === undefined).map((e) => e.name);
97
52
  if (tmp.length > 0) {
98
53
  throw new Error(`Required environments is not set: ${tmp.join(',')}`);
99
54
  }
100
55
 
101
- return runUserHook('pre-start', option);
56
+ return runUserHook(blocklet.env.appId, 'pre-start', options);
102
57
  };
103
58
 
104
- const preUninstall = (...args) => runUserHook('pre-uninstall', ...args);
105
- const preStop = (...args) => runUserHook('pre-stop', ...args);
106
-
107
- const preConfig = (...args) => runUserHook('pre-config', ...args);
59
+ const preUninstall = (appId, ...args) => runUserHook(appId, 'pre-uninstall', ...args);
60
+ const preStop = (appId, ...args) => runUserHook(appId, 'pre-stop', ...args);
108
61
 
109
62
  module.exports = { preDeploy, preInstall, postInstall, preStart, preUninstall, preStop, preConfig };
@@ -20,7 +20,6 @@ const logger = require('@abtnode/logger')('@abtnode/core:blocklet:manager');
20
20
  const downloadFile = require('@abtnode/util/lib/download-file');
21
21
  const Lock = require('@abtnode/util/lib/lock');
22
22
  const { getVcFromPresentation } = require('@abtnode/util/lib/vc');
23
- const { updateBlocklet: updateDidDocument } = require('@abtnode/util/lib/did-document');
24
23
  const { BLOCKLET_PURCHASE_NFT_TYPE } = require('@abtnode/constant');
25
24
 
26
25
  const getBlockletEngine = require('@blocklet/meta/lib/engine');
@@ -31,7 +30,6 @@ const {
31
30
  hasRunnableComponent,
32
31
  } = require('@blocklet/meta/lib/util');
33
32
  const validateBlockletEntry = require('@blocklet/meta/lib/entry');
34
- const { getBlockletInfo } = require('@blocklet/meta/lib');
35
33
  const toBlockletDid = require('@blocklet/meta/lib/did');
36
34
  const { validateMeta } = require('@blocklet/meta/lib/validate');
37
35
  const { update: updateMetaFile } = require('@blocklet/meta/lib/file');
@@ -293,7 +291,6 @@ class BlockletManager extends BaseBlockletManager {
293
291
  hooks: Object.assign(b.meta.hooks || {}, b.meta.scripts || {}),
294
292
  env: getRuntimeEnvironments(b, nodeEnvironments, blocklet),
295
293
  did, // root blocklet did,
296
- progress: blocklet.mode === BLOCKLET_MODES.DEVELOPMENT,
297
294
  }),
298
295
  nodeEnvironments,
299
296
  nodeInfo: await states.node.read(),
@@ -344,7 +341,7 @@ class BlockletManager extends BaseBlockletManager {
344
341
  }
345
342
  }
346
343
 
347
- async stop({ did, updateStatus = true }, context) {
344
+ async stop({ did, updateStatus = true, silent = false }, context) {
348
345
  logger.info('stop blocklet', { did });
349
346
 
350
347
  const blocklet = await this.ensureBlocklet(did);
@@ -360,7 +357,7 @@ class BlockletManager extends BaseBlockletManager {
360
357
 
361
358
  await stopBlockletProcess(blocklet, {
362
359
  preStop: (b) =>
363
- hooks.preStop({
360
+ hooks.preStop(b.env.appId, {
364
361
  appDir: b.env.appDir,
365
362
  hooks: Object.assign(b.meta.hooks || {}, b.meta.scripts || {}),
366
363
  env: getRuntimeEnvironments(b, nodeEnvironments, blocklet),
@@ -368,7 +365,7 @@ class BlockletManager extends BaseBlockletManager {
368
365
  notification: states.notification,
369
366
  context,
370
367
  exitOnError: false,
371
- progress: blocklet.mode === BLOCKLET_MODES.DEVELOPMENT,
368
+ silent,
372
369
  }),
373
370
  });
374
371
 
@@ -436,7 +433,7 @@ class BlockletManager extends BaseBlockletManager {
436
433
 
437
434
  await deleteBlockletProcess(blocklet, {
438
435
  preDelete: (b) =>
439
- hooks.preUninstall({
436
+ hooks.preUninstall(b.env.appId, {
440
437
  appDir: b.env.appDir,
441
438
  hooks: Object.assign(b.meta.hooks || {}, b.meta.scripts || {}),
442
439
  env: getRuntimeEnvironments(b, nodeEnvironments, blocklet),
@@ -512,12 +509,14 @@ class BlockletManager extends BaseBlockletManager {
512
509
  return result;
513
510
  }
514
511
 
515
- async detail({ did, attachRuntimeInfo = true }, context) {
512
+ async detail({ did, attachConfig = true, attachRuntimeInfo = true }, context) {
516
513
  if (!did) {
517
514
  throw new Error('did should not be empty');
518
515
  }
519
516
 
520
- const nodeInfo = await states.node.read();
517
+ if (!attachConfig) {
518
+ return states.blocklet.getBlocklet(did);
519
+ }
521
520
 
522
521
  if (!attachRuntimeInfo) {
523
522
  try {
@@ -528,6 +527,8 @@ class BlockletManager extends BaseBlockletManager {
528
527
  }
529
528
  }
530
529
 
530
+ const nodeInfo = await states.node.read();
531
+
531
532
  return this.attachRuntimeInfo({ did, nodeInfo, diskInfo: true, context });
532
533
  }
533
534
 
@@ -624,14 +625,13 @@ class BlockletManager extends BaseBlockletManager {
624
625
  }
625
626
 
626
627
  // FIXME: we should also call preConfig for child blocklets
627
- await hooks.preConfig({
628
+ await hooks.preConfig(blocklet.env.appId, {
628
629
  appDir: blocklet.env.appDir,
629
630
  hooks: Object.assign(blocklet.meta.hooks || {}, blocklet.meta.scripts || {}),
630
631
  exitOnError: true,
631
632
  env: { ...getRuntimeEnvironments(blocklet, nodeEnvironments), ...blocklet.configObj },
632
633
  did,
633
634
  context,
634
- progress: blocklet.mode === BLOCKLET_MODES.DEVELOPMENT,
635
635
  });
636
636
 
637
637
  // update db
@@ -887,6 +887,11 @@ class BlockletManager extends BaseBlockletManager {
887
887
  // ============================================================================================
888
888
  // Internal API that are used by public APIs and called from CLI
889
889
  // ============================================================================================
890
+
891
+ /**
892
+ * After the dev function finished, the caller should send a BlockletEvents.deployed event to the daemon
893
+ * @returns {Object} blocklet
894
+ */
890
895
  async dev(folder) {
891
896
  logger.info('dev blocklet', { folder });
892
897
 
@@ -919,11 +924,13 @@ class BlockletManager extends BaseBlockletManager {
919
924
  await this.deleteProcess({ did });
920
925
  logger.info('delete blocklet precess for dev', { did, version });
921
926
  } catch (err) {
922
- logger.error('failed to delete blocklet process for dev', { error: err });
927
+ if (process.env.NODE_ENV !== 'development') {
928
+ logger.error('failed to delete blocklet process for dev', { error: err });
929
+ }
923
930
  }
924
931
 
925
932
  const children = await this._getChildren(meta);
926
- const blocklet = await states.blocklet.addBlocklet({
933
+ const added = await states.blocklet.addBlocklet({
927
934
  did,
928
935
  meta,
929
936
  source: BlockletSource.local,
@@ -934,15 +941,16 @@ class BlockletManager extends BaseBlockletManager {
934
941
  logger.info('add blocklet for dev', { did, version, meta });
935
942
 
936
943
  const oldBlocklet = { children: children.filter((x) => x.dynamic) }; // let downloader skip re-downloading dynamic blocklet
937
- await this._downloadBlocklet(blocklet, oldBlocklet);
944
+ await this._downloadBlocklet(added, oldBlocklet);
938
945
  await states.blocklet.setBlockletStatus(did, BlockletStatus.installed);
939
946
 
940
947
  // Add environments
941
948
  await this._setConfigs(did);
942
949
  await this.updateBlockletEnvironment(did);
943
950
 
944
- this.emit(BlockletEvents.deployed, { blocklet, context: {} });
945
- return this.ensureBlocklet(did);
951
+ const blocklet = await this.ensureBlocklet(did);
952
+
953
+ return blocklet;
946
954
  }
947
955
 
948
956
  async ensureBlocklet(did) {
@@ -1705,19 +1713,6 @@ class BlockletManager extends BaseBlockletManager {
1705
1713
  );
1706
1714
  }
1707
1715
 
1708
- async getStatus(did) {
1709
- if (!did) {
1710
- throw new Error('did is required');
1711
- }
1712
-
1713
- const blocklet = await states.blocklet.getBlocklet(did);
1714
- if (!blocklet) {
1715
- return null;
1716
- }
1717
-
1718
- return { name: blocklet.meta.name, did: blocklet.meta.did, status: blocklet.status };
1719
- }
1720
-
1721
1716
  async prune() {
1722
1717
  const blocklets = await states.blocklet.getBlocklets();
1723
1718
  const settings = await states.blockletExtras.listSettings();
@@ -2126,7 +2121,7 @@ class BlockletManager extends BaseBlockletManager {
2126
2121
  // pre install
2127
2122
  const nodeEnvironments = await states.node.getEnvironments();
2128
2123
  const preInstall = (b) =>
2129
- hooks.preInstall({
2124
+ hooks.preInstall(b.env.appId, {
2130
2125
  hooks: Object.assign(b.meta.hooks || {}, b.meta.scripts || {}),
2131
2126
  env: { ...nodeEnvironments },
2132
2127
  appDir: b.env.appDir,
@@ -2142,7 +2137,7 @@ class BlockletManager extends BaseBlockletManager {
2142
2137
 
2143
2138
  // post install
2144
2139
  const postInstall = (b) =>
2145
- hooks.postInstall({
2140
+ hooks.postInstall(b.env.appId, {
2146
2141
  hooks: Object.assign(b.meta.hooks || {}, b.meta.scripts || {}),
2147
2142
  env: getRuntimeEnvironments(b, nodeEnvironments, blocklet),
2148
2143
  appDir: b.env.appDir,
@@ -2155,17 +2150,6 @@ class BlockletManager extends BaseBlockletManager {
2155
2150
  await states.blocklet.setBlockletStatus(did, BlockletStatus.installed);
2156
2151
  blocklet = await this.ensureBlocklet(did);
2157
2152
  logger.info('blocklet installed', { source, did: meta.did });
2158
- if (process.env.NODE_ENV !== 'test') {
2159
- const nodeInfo = await states.node.read();
2160
- const blockletInfo = getBlockletInfo(blocklet, nodeInfo.sk);
2161
- const updateDidDnsResult = await updateDidDocument({
2162
- wallet: blockletInfo.wallet,
2163
- domain: nodeInfo.didDomain,
2164
- nodeDid: nodeInfo.did,
2165
- didRegistryUrl: nodeInfo.didRegistry,
2166
- });
2167
- logger.info('updated did document', { updateDidDnsResult, blockletId: blocklet.meta.did });
2168
- }
2169
2153
 
2170
2154
  this.emit(BlockletEvents.installed, { blocklet, context });
2171
2155
 
@@ -2226,7 +2210,7 @@ class BlockletManager extends BaseBlockletManager {
2226
2210
  // pre install
2227
2211
  const nodeEnvironments = await states.node.getEnvironments();
2228
2212
  const preInstall = (b) =>
2229
- hooks.preInstall({
2213
+ hooks.preInstall(b.env.appId, {
2230
2214
  hooks: Object.assign(b.meta.hooks || {}, b.meta.scripts || {}),
2231
2215
  env: { ...nodeEnvironments },
2232
2216
  appDir: b.env.appDir,
@@ -2242,7 +2226,7 @@ class BlockletManager extends BaseBlockletManager {
2242
2226
 
2243
2227
  // post install
2244
2228
  const postInstall = (b) =>
2245
- hooks.postInstall({
2229
+ hooks.postInstall(b.env.appId, {
2246
2230
  hooks: Object.assign(b.meta.hooks || {}, b.meta.scripts || {}),
2247
2231
  env: getRuntimeEnvironments(b, nodeEnvironments, blocklet),
2248
2232
  appDir: b.env.appDir,
@@ -2258,10 +2242,10 @@ class BlockletManager extends BaseBlockletManager {
2258
2242
  if (b.meta.did === did) {
2259
2243
  return runMigrationScripts({
2260
2244
  blocklet: b,
2245
+ appDir: b.env.appDir,
2246
+ env: getRuntimeEnvironments(b, nodeEnvironments, blocklet),
2261
2247
  oldVersion,
2262
2248
  newVersion: version,
2263
- env: getRuntimeEnvironments(b, nodeEnvironments, blocklet),
2264
- appDir: b.env.appDir,
2265
2249
  did: b.meta.did,
2266
2250
  notification: states.notification,
2267
2251
  context,
@@ -1,67 +1,25 @@
1
1
  /* eslint-disable no-await-in-loop */
2
- const childProcess = require('child_process');
3
2
  const fs = require('fs-extra');
4
3
  const path = require('path');
5
4
  const semver = require('semver');
5
+ const runScript = require('@abtnode/util/lib/run-script');
6
6
 
7
7
  const { getMigrationScripts: getScripts } = require('../migrations');
8
8
  const { getSafeEnv } = require('../util');
9
9
  const { name } = require('../../package.json');
10
10
  const logger = require('@abtnode/logger')(`${name}:blocklet:migration`); // eslint-disable-line
11
11
 
12
- const _runScript = ({ appDir, env, migrationScript, progress = false }) => {
13
- const safeEnv = getSafeEnv(env);
14
-
15
- const child = childProcess.exec(`node ${migrationScript}`, {
16
- cwd: appDir,
17
- env: safeEnv,
18
- stdio: 'inherit',
19
- });
20
- let hasUnhandledRejection = false;
21
-
22
- if (progress) {
23
- child.stdout.pipe(process.stdout);
24
- child.stderr.pipe(process.stderr);
25
- }
26
-
27
- return new Promise((resolve, reject) => {
28
- const errorMessages = [];
29
-
30
- child.stderr.on('data', (err) => {
31
- // Check if has unhandledRejection in childProcess
32
- // https://stackoverflow.com/questions/32784649/gracefully-handle-errors-in-child-processes-in-nodejs
33
- if (err.includes('UnhandledPromiseRejectionWarning')) {
34
- hasUnhandledRejection = true;
35
- }
36
- errorMessages.push(err);
37
- });
38
-
39
- child.on('exit', (code) => {
40
- if (errorMessages.length > 0) {
41
- if (code !== 0 || hasUnhandledRejection) {
42
- return reject(new Error(errorMessages.join('\r\n')));
43
- }
44
-
45
- if (!progress) {
46
- errorMessages.forEach((message) => process.stderr.write(message));
47
- }
48
- }
49
-
50
- return resolve();
51
- });
52
- });
53
- };
54
-
55
12
  async function runScripts({
13
+ blocklet,
14
+ appDir,
15
+ env,
16
+ oldVersion,
56
17
  dbDir,
57
18
  backupDir,
58
19
  scriptsDir,
59
20
  printInfo,
60
21
  printSuccess,
61
22
  printError,
62
- appDir,
63
- env,
64
- oldVersion,
65
23
  }) {
66
24
  let scripts = [];
67
25
  try {
@@ -90,7 +48,11 @@ async function runScripts({
90
48
  const { script: scriptPath } = pendingScripts[i];
91
49
  try {
92
50
  printInfo(`Migration script started: ${scriptPath}`);
93
- await _runScript({ appDir, env, migrationScript: path.join(scriptsDir, scriptPath) });
51
+ await runScript(`node ${path.join(scriptsDir, scriptPath)}`, [blocklet.env.appId, 'migration'].join(':'), {
52
+ cwd: appDir,
53
+ env: getSafeEnv(env),
54
+ silent: false,
55
+ });
94
56
  printInfo(`Migration script executed: ${scriptPath}`);
95
57
  } catch (migrationErr) {
96
58
  printError(`Failed to execute migration script: ${scriptPath}, error: ${migrationErr.message}`);
@@ -123,6 +85,7 @@ async function doRestore({ dbDir, backupDir, printInfo, printSuccess }) {
123
85
  }
124
86
 
125
87
  module.exports = async ({
88
+ blocklet,
126
89
  appDir,
127
90
  env,
128
91
  oldVersion,
@@ -142,15 +105,16 @@ module.exports = async ({
142
105
  fs.ensureDirSync(backupDir);
143
106
 
144
107
  await runScripts({
108
+ blocklet,
109
+ appDir,
110
+ env,
111
+ oldVersion,
112
+ newVersion,
145
113
  dbDir,
146
114
  backupDir,
147
115
  scriptsDir,
148
116
  printError,
149
117
  printInfo,
150
118
  printSuccess,
151
- appDir,
152
- env,
153
- oldVersion,
154
- newVersion,
155
119
  });
156
120
  };
package/lib/index.js CHANGED
@@ -208,7 +208,6 @@ function ABTNode(options) {
208
208
  upgradeBlocklet: blockletManager.upgrade.bind(blockletManager),
209
209
  configBlocklet: blockletManager.config.bind(blockletManager),
210
210
  devBlocklet: blockletManager.dev.bind(blockletManager),
211
- getBlockletStatus: blockletManager.getStatus.bind(blockletManager),
212
211
  checkChildBlockletsForUpdates: blockletManager.checkChildrenForUpdates.bind(blockletManager),
213
212
  updateChildBlocklets: blockletManager.updateChildren.bind(blockletManager),
214
213
  getLatestBlockletVersion: blockletManager.getLatestBlockletVersion.bind(blockletManager),
@@ -660,7 +660,9 @@ module.exports = function getRouterHelpers({ dataDirs, routingSnapshot, routerMa
660
660
 
661
661
  const dashboardDomain = get(info, 'routing.dashboardDomain', '');
662
662
  const didDomain = `${info.did.toLowerCase()}.${info.didDomain}`;
663
- const dashboardAliasDomains = [dashboardDomain, didDomain]
663
+ let dashboardAliasDomains = [dashboardDomain, didDomain];
664
+
665
+ dashboardAliasDomains = dashboardAliasDomains
664
666
  .filter((item) => item && !isExistsInAlias(item))
665
667
  .map((item) => ({ value: item, isProtected: true }));
666
668
 
@@ -747,17 +749,15 @@ module.exports = function getRouterHelpers({ dataDirs, routingSnapshot, routerMa
747
749
  const existSite = await states.site.findOne({ domain: domainGroup });
748
750
  if (!existSite) {
749
751
  const ipEchoDnsDomain = getIpDnsDomainForBlocklet(blocklet, webInterface, nodeInfo.did);
750
- const appIdEnv = blocklet.environments.find((e) => e.key === 'BLOCKLET_APP_ID');
751
752
  const domainAliases = [{ value: ipEchoDnsDomain, isProtected: true }];
752
753
 
753
754
  const didDomain = getDidDomainForBlocklet({
754
- appId: appIdEnv.value,
755
+ name: blocklet.meta.name,
756
+ daemonDid: nodeInfo.did,
755
757
  didDomain: nodeInfo.didDomain,
756
758
  });
757
759
 
758
- if (blocklet.mode !== 'development') {
759
- domainAliases.push({ value: didDomain, isProtected: true });
760
- }
760
+ domainAliases.push({ value: didDomain, isProtected: true });
761
761
 
762
762
  await routerManager.addRoutingSite(
763
763
  {
@@ -252,7 +252,7 @@ const getRootSystemEnvironments = (blocklet, nodeInfo) => {
252
252
  const appDescription = description || result.description;
253
253
 
254
254
  // FIXME: we should use https here when possible, eg, when did-gateway is available
255
- const appUrl = `http://${getDidDomainForBlocklet({ appId, didDomain: nodeInfo.didDomain })}`;
255
+ const appUrl = `http://${getDidDomainForBlocklet({ name, daemonDid: nodeInfo.did, didDomain: nodeInfo.didDomain })}`;
256
256
 
257
257
  return {
258
258
  BLOCKLET_DID: did,
@@ -16,8 +16,8 @@ const getIpDnsDomainForBlocklet = (blocklet, blockletInterface) => {
16
16
  }${iName}-${SLOT_FOR_IP_DNS_SITE}.${DEFAULT_IP_DNS_DOMAIN_SUFFIX}`;
17
17
  };
18
18
 
19
- const getDidDomainForBlocklet = ({ appId, didDomain }) => {
20
- return `${appId.toLowerCase()}.${didDomain}`;
19
+ const getDidDomainForBlocklet = ({ name, daemonDid, didDomain }) => {
20
+ return `${formatName(name)}-${daemonDid.toLowerCase()}.${didDomain}`;
21
21
  };
22
22
 
23
23
  module.exports = { getIpDnsDomainForBlocklet, getDidDomainForBlocklet };
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.6.17",
6
+ "version": "1.6.18",
7
7
  "description": "",
8
8
  "main": "lib/index.js",
9
9
  "files": [
@@ -19,22 +19,22 @@
19
19
  "author": "wangshijun <wangshijun2010@gmail.com> (http://github.com/wangshijun)",
20
20
  "license": "MIT",
21
21
  "dependencies": {
22
- "@abtnode/certificate-manager": "1.6.17",
23
- "@abtnode/constant": "1.6.17",
24
- "@abtnode/cron": "1.6.17",
25
- "@abtnode/db": "1.6.17",
26
- "@abtnode/logger": "1.6.17",
27
- "@abtnode/queue": "1.6.17",
28
- "@abtnode/rbac": "1.6.17",
29
- "@abtnode/router-provider": "1.6.17",
30
- "@abtnode/static-server": "1.6.17",
31
- "@abtnode/timemachine": "1.6.17",
32
- "@abtnode/util": "1.6.17",
22
+ "@abtnode/certificate-manager": "1.6.18",
23
+ "@abtnode/constant": "1.6.18",
24
+ "@abtnode/cron": "1.6.18",
25
+ "@abtnode/db": "1.6.18",
26
+ "@abtnode/logger": "1.6.18",
27
+ "@abtnode/queue": "1.6.18",
28
+ "@abtnode/rbac": "1.6.18",
29
+ "@abtnode/router-provider": "1.6.18",
30
+ "@abtnode/static-server": "1.6.18",
31
+ "@abtnode/timemachine": "1.6.18",
32
+ "@abtnode/util": "1.6.18",
33
33
  "@arcblock/did": "^1.14.8",
34
34
  "@arcblock/event-hub": "1.14.8",
35
35
  "@arcblock/pm2-events": "^0.0.5",
36
36
  "@arcblock/vc": "^1.14.8",
37
- "@blocklet/meta": "1.6.17",
37
+ "@blocklet/meta": "1.6.18",
38
38
  "@fidm/x509": "^1.2.1",
39
39
  "@nedb/core": "^1.2.2",
40
40
  "@nedb/multi": "^1.2.2",
@@ -75,5 +75,5 @@
75
75
  "express": "^4.17.1",
76
76
  "jest": "^27.4.5"
77
77
  },
78
- "gitHead": "d567a622a779eba43c95eaeb4633cb2b276bb7b9"
78
+ "gitHead": "2f02f166869d8ebedc0466068f6ed90ab3e07b87"
79
79
  }