@abtnode/core 1.16.24-beta-30f58f8d → 1.16.24-beta-3d2e25fd

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.
@@ -113,7 +113,6 @@ const installComponentFromUrl = async ({
113
113
  if (onlyRequired) {
114
114
  newChildren = filterRequiredComponents(newChild, newChildren);
115
115
  }
116
-
117
116
  blocklet.children.push(...newChildren);
118
117
 
119
118
  checkVersionCompatibility(blocklet.children);
@@ -8,7 +8,40 @@ const { filterDuplicateComponents, parseComponents } = require('./blocklet');
8
8
  async function getDynamicComponents({ url }) {
9
9
  const rawMeta = await axios.get(url).then((res) => res.data);
10
10
  const { dynamicComponents } = await parseComponents({ meta: rawMeta });
11
- return filterDuplicateComponents(dynamicComponents);
11
+
12
+ const components = filterDuplicateComponents(dynamicComponents);
13
+
14
+ const requiredComponents = {};
15
+ rawMeta.components?.forEach((component) => {
16
+ if (component.required) {
17
+ requiredComponents[component.source?.name || component.name] = true;
18
+ }
19
+ });
20
+
21
+ const subRequiredComponents = {};
22
+ components.forEach((component) => {
23
+ component.required = !!requiredComponents[component.meta?.name || component.meta?.did];
24
+ if (component.required && component.meta?.components) {
25
+ component.meta.components.forEach((subComponent) => {
26
+ if (subComponent.required) {
27
+ if (subComponent.source?.name) {
28
+ subRequiredComponents[subComponent.source?.name] = true;
29
+ }
30
+ subRequiredComponents[subComponent.name] = true;
31
+ }
32
+ });
33
+ }
34
+ });
35
+ components.forEach((component) => {
36
+ if (subRequiredComponents[component.meta?.name || component.meta?.did]) {
37
+ component.required = true;
38
+ }
39
+ });
40
+
41
+ // eslint-disable-next-line no-nested-ternary
42
+ components.sort((a, b) => (a.required === b.required ? 0 : a.required ? -1 : 1));
43
+
44
+ return components;
12
45
  }
13
46
 
14
47
  module.exports = getDynamicComponents;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.16.24-beta-30f58f8d",
6
+ "version": "1.16.24-beta-3d2e25fd",
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.24-beta-30f58f8d",
23
- "@abtnode/auth": "1.16.24-beta-30f58f8d",
24
- "@abtnode/certificate-manager": "1.16.24-beta-30f58f8d",
25
- "@abtnode/constant": "1.16.24-beta-30f58f8d",
26
- "@abtnode/cron": "1.16.24-beta-30f58f8d",
27
- "@abtnode/logger": "1.16.24-beta-30f58f8d",
28
- "@abtnode/models": "1.16.24-beta-30f58f8d",
29
- "@abtnode/queue": "1.16.24-beta-30f58f8d",
30
- "@abtnode/rbac": "1.16.24-beta-30f58f8d",
31
- "@abtnode/router-provider": "1.16.24-beta-30f58f8d",
32
- "@abtnode/static-server": "1.16.24-beta-30f58f8d",
33
- "@abtnode/timemachine": "1.16.24-beta-30f58f8d",
34
- "@abtnode/util": "1.16.24-beta-30f58f8d",
22
+ "@abtnode/analytics": "1.16.24-beta-3d2e25fd",
23
+ "@abtnode/auth": "1.16.24-beta-3d2e25fd",
24
+ "@abtnode/certificate-manager": "1.16.24-beta-3d2e25fd",
25
+ "@abtnode/constant": "1.16.24-beta-3d2e25fd",
26
+ "@abtnode/cron": "1.16.24-beta-3d2e25fd",
27
+ "@abtnode/logger": "1.16.24-beta-3d2e25fd",
28
+ "@abtnode/models": "1.16.24-beta-3d2e25fd",
29
+ "@abtnode/queue": "1.16.24-beta-3d2e25fd",
30
+ "@abtnode/rbac": "1.16.24-beta-3d2e25fd",
31
+ "@abtnode/router-provider": "1.16.24-beta-3d2e25fd",
32
+ "@abtnode/static-server": "1.16.24-beta-3d2e25fd",
33
+ "@abtnode/timemachine": "1.16.24-beta-3d2e25fd",
34
+ "@abtnode/util": "1.16.24-beta-3d2e25fd",
35
35
  "@arcblock/did": "1.18.110",
36
36
  "@arcblock/did-auth": "1.18.110",
37
37
  "@arcblock/did-ext": "^1.18.110",
@@ -42,11 +42,11 @@
42
42
  "@arcblock/pm2-events": "^0.0.5",
43
43
  "@arcblock/validator": "^1.18.110",
44
44
  "@arcblock/vc": "1.18.110",
45
- "@blocklet/constant": "1.16.24-beta-30f58f8d",
46
- "@blocklet/env": "1.16.24-beta-30f58f8d",
47
- "@blocklet/meta": "1.16.24-beta-30f58f8d",
48
- "@blocklet/resolver": "1.16.24-beta-30f58f8d",
49
- "@blocklet/sdk": "1.16.24-beta-30f58f8d",
45
+ "@blocklet/constant": "1.16.24-beta-3d2e25fd",
46
+ "@blocklet/env": "1.16.24-beta-3d2e25fd",
47
+ "@blocklet/meta": "1.16.24-beta-3d2e25fd",
48
+ "@blocklet/resolver": "1.16.24-beta-3d2e25fd",
49
+ "@blocklet/sdk": "1.16.24-beta-3d2e25fd",
50
50
  "@did-space/client": "^0.3.64",
51
51
  "@fidm/x509": "^1.2.1",
52
52
  "@ocap/mcrypto": "1.18.110",
@@ -102,5 +102,5 @@
102
102
  "jest": "^29.7.0",
103
103
  "unzipper": "^0.10.11"
104
104
  },
105
- "gitHead": "95f8e79898d7901f0665f3883e3c014c36f16668"
105
+ "gitHead": "6dce348d0d02a6c0ef5735a0b73bfd8b2e1503fd"
106
106
  }