@abtnode/core 1.16.19-beta-7d3ef675 → 1.16.19-beta-630ac853

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.
@@ -448,16 +448,6 @@ class DiskBlockletManager extends BaseBlockletManager {
448
448
  return migrateApplicationToStructV2({ did, appSk, context, manager: this, states });
449
449
  }
450
450
 
451
- // ============================================================================================
452
- // Public API for GQL or internal
453
- // ============================================================================================
454
-
455
- async getBlockletForLauncher({ did }) {
456
- const blocklet = await states.blocklet.getBlocklet(did);
457
- const isRunning = blocklet ? blocklet.status === BlockletStatus.running : false;
458
- return { did, isInstalled: !!blocklet, isRunning };
459
- }
460
-
461
451
  async start(
462
452
  { did, throwOnError, checkHealthImmediately = false, e2eMode = false, componentDids: inputComponentDids, atomic },
463
453
  context
@@ -2920,37 +2910,41 @@ class DiskBlockletManager extends BaseBlockletManager {
2920
2910
  }
2921
2911
  logger.info('done migration on upgrading', { did, componentDids });
2922
2912
 
2913
+ // handle component status
2914
+ const runningDids = [];
2915
+ const stoppedDids = [];
2923
2916
  if (action === INSTALL_ACTIONS.INSTALL_COMPONENT) {
2924
- await states.blocklet.setBlockletStatus(did, BlockletStatus.installed, { componentDids });
2917
+ for (const componentDid of componentDids) {
2918
+ const component = blocklet.children.find((x) => x.meta.did === componentDid);
2919
+ if (hasStartEngine(component.meta)) {
2920
+ // NOT start immediately for runnable component
2921
+ stoppedDids.push(componentDid);
2922
+ } else {
2923
+ // Start immediately for resource component
2924
+ runningDids.push(componentDid);
2925
+ }
2926
+ }
2925
2927
  } else {
2926
- const runningDids = [];
2927
- const stoppedDids = [];
2928
- const installedDids = [];
2929
2928
  for (const componentDid of componentDids) {
2930
2929
  const old = oldBlocklet.children.find((x) => x.meta.did === componentDid);
2931
2930
  if (old?.status === BlockletStatus.running) {
2932
2931
  runningDids.push(componentDid);
2933
- } else if (old?.status === BlockletStatus.installed) {
2934
- installedDids.push(componentDid);
2935
2932
  } else {
2936
2933
  stoppedDids.push(componentDid);
2937
2934
  }
2938
2935
  }
2939
- if (runningDids.length) {
2940
- try {
2941
- await this.start({ did, componentDids: runningDids }, context);
2942
- logger.info('started blocklet for upgrading', { did, version, runningDids });
2943
- } catch (error) {
2944
- logger.error('failed to start blocklet for upgrading', { did, version, runningDids, error });
2945
- }
2946
- }
2947
- if (stoppedDids.length) {
2948
- await states.blocklet.setBlockletStatus(did, BlockletStatus.stopped, { componentDids: stoppedDids });
2949
- }
2950
- if (installedDids.length) {
2951
- await states.blocklet.setBlockletStatus(did, BlockletStatus.installed, { componentDids: installedDids });
2936
+ }
2937
+ if (runningDids.length) {
2938
+ try {
2939
+ await this.start({ did, componentDids: runningDids }, context);
2940
+ logger.info('started blocklet for upgrading', { did, version, runningDids });
2941
+ } catch (error) {
2942
+ logger.error('failed to start blocklet for upgrading', { did, version, runningDids, error });
2952
2943
  }
2953
2944
  }
2945
+ if (stoppedDids.length) {
2946
+ await states.blocklet.setBlockletStatus(did, BlockletStatus.stopped, { componentDids: stoppedDids });
2947
+ }
2954
2948
 
2955
2949
  blocklet = await this.getBlocklet(did, context);
2956
2950
 
@@ -202,6 +202,7 @@ const createRelease = async ({
202
202
 
203
203
  const tmpExportDir = path.join(tmpDir, 'export');
204
204
  const tmpBundleDir = path.join(tmpExportDir, 'bundle');
205
+ const tmpReleaseDir = path.join(tmpExportDir, 'release');
205
206
 
206
207
  const moniker = (urlPathFriendly(slugify(release.blockletTitle)) || 'blocklet').toLowerCase();
207
208
  const releaseFileName = `${moniker}-${release.blockletVersion}.zip`;
@@ -252,10 +253,6 @@ const createRelease = async ({
252
253
  await fs.ensureDir(resourceDir);
253
254
  await fs.copy(resourceDir, path.join(tmpBundleDir, 'resource'));
254
255
 
255
- // copy resource to tmpResourceDir
256
- await fs.remove(tmpResourceDir);
257
- await fs.copy(resourceDir, tmpResourceDir);
258
-
259
256
  // create blocklet.yml
260
257
  const resourceList = await fs.readdir(resourceDir);
261
258
  const resourcesPaths = resourceList
@@ -284,7 +281,7 @@ const createRelease = async ({
284
281
 
285
282
  await new Promise((resolve, reject) => {
286
283
  archive
287
- .directory(tmpExportDir, false)
284
+ .directory(tmpReleaseDir, false)
288
285
  .on('error', (err) => reject(err))
289
286
  .pipe(writeStream);
290
287
 
package/lib/index.js CHANGED
@@ -263,7 +263,6 @@ function ABTNode(options) {
263
263
  devBlocklet: blockletManager.dev.bind(blockletManager),
264
264
  checkComponentsForUpdates: blockletManager.checkComponentsForUpdates.bind(blockletManager),
265
265
  upgradeComponents: blockletManager.upgradeComponents.bind(blockletManager),
266
- getBlockletForLauncher: blockletManager.getBlockletForLauncher.bind(blockletManager),
267
266
  getBlockletDomainAliases: blockletManager.getDomainAliases.bind(blockletManager),
268
267
  resetBlocklet: blockletManager.reset.bind(blockletManager),
269
268
  deleteBlockletProcess: blockletManager.deleteProcess.bind(blockletManager),
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.19-beta-7d3ef675",
6
+ "version": "1.16.19-beta-630ac853",
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.19-beta-7d3ef675",
23
- "@abtnode/auth": "1.16.19-beta-7d3ef675",
24
- "@abtnode/certificate-manager": "1.16.19-beta-7d3ef675",
25
- "@abtnode/constant": "1.16.19-beta-7d3ef675",
26
- "@abtnode/cron": "1.16.19-beta-7d3ef675",
27
- "@abtnode/logger": "1.16.19-beta-7d3ef675",
28
- "@abtnode/models": "1.16.19-beta-7d3ef675",
29
- "@abtnode/queue": "1.16.19-beta-7d3ef675",
30
- "@abtnode/rbac": "1.16.19-beta-7d3ef675",
31
- "@abtnode/router-provider": "1.16.19-beta-7d3ef675",
32
- "@abtnode/static-server": "1.16.19-beta-7d3ef675",
33
- "@abtnode/timemachine": "1.16.19-beta-7d3ef675",
34
- "@abtnode/util": "1.16.19-beta-7d3ef675",
22
+ "@abtnode/analytics": "1.16.19-beta-630ac853",
23
+ "@abtnode/auth": "1.16.19-beta-630ac853",
24
+ "@abtnode/certificate-manager": "1.16.19-beta-630ac853",
25
+ "@abtnode/constant": "1.16.19-beta-630ac853",
26
+ "@abtnode/cron": "1.16.19-beta-630ac853",
27
+ "@abtnode/logger": "1.16.19-beta-630ac853",
28
+ "@abtnode/models": "1.16.19-beta-630ac853",
29
+ "@abtnode/queue": "1.16.19-beta-630ac853",
30
+ "@abtnode/rbac": "1.16.19-beta-630ac853",
31
+ "@abtnode/router-provider": "1.16.19-beta-630ac853",
32
+ "@abtnode/static-server": "1.16.19-beta-630ac853",
33
+ "@abtnode/timemachine": "1.16.19-beta-630ac853",
34
+ "@abtnode/util": "1.16.19-beta-630ac853",
35
35
  "@arcblock/did": "1.18.95",
36
36
  "@arcblock/did-auth": "1.18.95",
37
37
  "@arcblock/did-ext": "^1.18.95",
@@ -42,11 +42,11 @@
42
42
  "@arcblock/pm2-events": "^0.0.5",
43
43
  "@arcblock/validator": "^1.18.95",
44
44
  "@arcblock/vc": "1.18.95",
45
- "@blocklet/constant": "1.16.19-beta-7d3ef675",
46
- "@blocklet/env": "1.16.19-beta-7d3ef675",
47
- "@blocklet/meta": "1.16.19-beta-7d3ef675",
48
- "@blocklet/resolver": "1.16.19-beta-7d3ef675",
49
- "@blocklet/sdk": "1.16.19-beta-7d3ef675",
45
+ "@blocklet/constant": "1.16.19-beta-630ac853",
46
+ "@blocklet/env": "1.16.19-beta-630ac853",
47
+ "@blocklet/meta": "1.16.19-beta-630ac853",
48
+ "@blocklet/resolver": "1.16.19-beta-630ac853",
49
+ "@blocklet/sdk": "1.16.19-beta-630ac853",
50
50
  "@did-space/client": "^0.3.33",
51
51
  "@fidm/x509": "^1.2.1",
52
52
  "@ocap/mcrypto": "1.18.95",
@@ -101,5 +101,5 @@
101
101
  "jest": "^27.5.1",
102
102
  "unzipper": "^0.10.11"
103
103
  },
104
- "gitHead": "af968e7bab22e67bd42d3dc93ff3ce827b9a91fe"
104
+ "gitHead": "a4feb519d9122ef75873dd8d657486afca2d4ac9"
105
105
  }