@blocklet/meta 1.16.0 → 1.16.1
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/util.d.ts +9 -3
- package/lib/util.js +24 -1
- package/package.json +6 -7
package/lib/util.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ type TConfig = TEnvironment & {
|
|
|
5
5
|
key: string;
|
|
6
6
|
};
|
|
7
7
|
type Component = BlockletState | ComponentState;
|
|
8
|
+
type ComponentPro = Component & {
|
|
9
|
+
configObj?: Record<string, string>;
|
|
10
|
+
environmentObj?: Record<string, string>;
|
|
11
|
+
};
|
|
8
12
|
declare const getComponentId: (component?: {
|
|
9
13
|
meta?: {
|
|
10
14
|
did?: string;
|
|
@@ -40,7 +44,7 @@ declare const getComponentBundleId: (component: {
|
|
|
40
44
|
* @a/b/@c/d/@e/f => @a/b/@c/d
|
|
41
45
|
*/
|
|
42
46
|
declare const getParentComponentName: (name?: string) => string;
|
|
43
|
-
declare const forEachBlocklet: (blocklet:
|
|
47
|
+
declare const forEachBlocklet: (blocklet: ComponentPro, cb: Function, { parallel, concurrencyLimit, sync, params: inputParams, _parent, _root, _level, _tasks: inputTasks, _ancestors, _limit, }?: {
|
|
44
48
|
parallel?: boolean;
|
|
45
49
|
concurrencyLimit?: number;
|
|
46
50
|
sync?: boolean;
|
|
@@ -111,17 +115,18 @@ type ChainInfo = {
|
|
|
111
115
|
host: string;
|
|
112
116
|
};
|
|
113
117
|
declare const getChainInfo: (env: Record<string, string>) => ChainInfo;
|
|
118
|
+
declare const getBlockletChainInfo: (blocklet: ComponentPro) => ChainInfo;
|
|
114
119
|
declare const isExternalBlocklet: (blocklet?: BlockletState) => boolean;
|
|
115
120
|
declare const getRolesFromAuthConfig: (config: {
|
|
116
121
|
whoCanAccess: string;
|
|
117
122
|
}) => Array<string>;
|
|
118
123
|
declare const getBlockletAppIdList: (blocklet: Partial<BlockletState>) => string[];
|
|
119
|
-
export { isFreeBlocklet, isFreeComponent, isComponentBlocklet, forEachBlocklet, forEachBlockletSync, forEachChild, forEachChildSync, isDeletableBlocklet, getSharedConfigObj, getAppMissingConfigs, getComponentMissingConfigs, isEnvShareable, wipeSensitiveData, hasRunnableComponent, getAppName, getAppName as getDisplayName, getAppDescription, fixBlockletStatus, findWebInterface, findWebInterfacePort, findServiceFromMeta, getWhoCanAccess, replaceSlotToIp, getComponentId, getComponentName, getComponentBundleId, findComponent, findComponentById, getParentComponentName, getConnectAppUrl, getChainInfo, isExternalBlocklet, isPreferenceKey, getRolesFromAuthConfig, getBlockletAppIdList, };
|
|
124
|
+
export { isFreeBlocklet, isFreeComponent, isComponentBlocklet, forEachBlocklet, forEachBlockletSync, forEachChild, forEachChildSync, isDeletableBlocklet, getSharedConfigObj, getAppMissingConfigs, getComponentMissingConfigs, isEnvShareable, wipeSensitiveData, hasRunnableComponent, getAppName, getAppName as getDisplayName, getAppDescription, fixBlockletStatus, findWebInterface, findWebInterfacePort, findServiceFromMeta, getWhoCanAccess, replaceSlotToIp, getComponentId, getComponentName, getComponentBundleId, findComponent, findComponentById, getParentComponentName, getConnectAppUrl, getChainInfo, getBlockletChainInfo, isExternalBlocklet, isPreferenceKey, getRolesFromAuthConfig, getBlockletAppIdList, };
|
|
120
125
|
declare const _default: {
|
|
121
126
|
isFreeBlocklet: (meta: TBlockletMeta) => boolean;
|
|
122
127
|
isFreeComponent: (meta: TBlockletMeta) => boolean;
|
|
123
128
|
isComponentBlocklet: (meta?: TBlockletMeta) => boolean;
|
|
124
|
-
forEachBlocklet: (blocklet:
|
|
129
|
+
forEachBlocklet: (blocklet: ComponentPro, cb: Function, { parallel, concurrencyLimit, sync, params: inputParams, _parent, _root, _level, _tasks: inputTasks, _ancestors, _limit, }?: {
|
|
125
130
|
parallel?: boolean;
|
|
126
131
|
concurrencyLimit?: number;
|
|
127
132
|
sync?: boolean;
|
|
@@ -197,6 +202,7 @@ declare const _default: {
|
|
|
197
202
|
baseUrl: string;
|
|
198
203
|
}) => string;
|
|
199
204
|
getChainInfo: (env: Record<string, string>) => ChainInfo;
|
|
205
|
+
getBlockletChainInfo: (blocklet: ComponentPro) => ChainInfo;
|
|
200
206
|
isExternalBlocklet: (blocklet?: BlockletState) => boolean;
|
|
201
207
|
isPreferenceKey: (x: TConfig) => Boolean;
|
|
202
208
|
getRolesFromAuthConfig: (config: {
|
package/lib/util.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.getBlockletAppIdList = exports.getRolesFromAuthConfig = exports.isPreferenceKey = exports.isExternalBlocklet = exports.getChainInfo = exports.getConnectAppUrl = exports.getParentComponentName = exports.findComponentById = exports.findComponent = exports.getComponentBundleId = exports.getComponentName = exports.getComponentId = exports.replaceSlotToIp = exports.getWhoCanAccess = exports.findServiceFromMeta = exports.findWebInterfacePort = exports.findWebInterface = exports.fixBlockletStatus = exports.getAppDescription = exports.getDisplayName = exports.getAppName = exports.hasRunnableComponent = exports.wipeSensitiveData = exports.isEnvShareable = exports.getComponentMissingConfigs = exports.getAppMissingConfigs = exports.getSharedConfigObj = exports.isDeletableBlocklet = exports.forEachChildSync = exports.forEachChild = exports.forEachBlockletSync = exports.forEachBlocklet = exports.isComponentBlocklet = exports.isFreeComponent = exports.isFreeBlocklet = void 0;
|
|
6
|
+
exports.getBlockletAppIdList = exports.getRolesFromAuthConfig = exports.isPreferenceKey = exports.isExternalBlocklet = exports.getBlockletChainInfo = exports.getChainInfo = exports.getConnectAppUrl = exports.getParentComponentName = exports.findComponentById = exports.findComponent = exports.getComponentBundleId = exports.getComponentName = exports.getComponentId = exports.replaceSlotToIp = exports.getWhoCanAccess = exports.findServiceFromMeta = exports.findWebInterfacePort = exports.findWebInterface = exports.fixBlockletStatus = exports.getAppDescription = exports.getDisplayName = exports.getAppName = exports.hasRunnableComponent = exports.wipeSensitiveData = exports.isEnvShareable = exports.getComponentMissingConfigs = exports.getAppMissingConfigs = exports.getSharedConfigObj = exports.isDeletableBlocklet = exports.forEachChildSync = exports.forEachChild = exports.forEachBlockletSync = exports.forEachBlocklet = exports.isComponentBlocklet = exports.isFreeComponent = exports.isFreeBlocklet = void 0;
|
|
7
7
|
/* eslint-disable no-await-in-loop */
|
|
8
8
|
const get_1 = __importDefault(require("lodash/get"));
|
|
9
9
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
@@ -461,6 +461,28 @@ const getChainInfo = (env) => {
|
|
|
461
461
|
return result;
|
|
462
462
|
};
|
|
463
463
|
exports.getChainInfo = getChainInfo;
|
|
464
|
+
const getBlockletChainInfo = (blocklet) => {
|
|
465
|
+
const emptyInfo = getChainInfo({});
|
|
466
|
+
if (!blocklet) {
|
|
467
|
+
return emptyInfo;
|
|
468
|
+
}
|
|
469
|
+
const chainInfoInRoot = getChainInfo(blocklet.configObj);
|
|
470
|
+
if (chainInfoInRoot.host !== 'none') {
|
|
471
|
+
return chainInfoInRoot;
|
|
472
|
+
}
|
|
473
|
+
let chainInfoInChild;
|
|
474
|
+
forEachChildSync(blocklet, (b) => {
|
|
475
|
+
if (chainInfoInChild && chainInfoInChild.host !== 'none') {
|
|
476
|
+
return;
|
|
477
|
+
}
|
|
478
|
+
const chainInfo = getChainInfo(b.configObj);
|
|
479
|
+
if (chainInfo.host !== 'none') {
|
|
480
|
+
chainInfoInChild = chainInfo;
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
return chainInfoInChild || emptyInfo;
|
|
484
|
+
};
|
|
485
|
+
exports.getBlockletChainInfo = getBlockletChainInfo;
|
|
464
486
|
const isExternalBlocklet = (blocklet) => !!blocklet?.controller;
|
|
465
487
|
exports.isExternalBlocklet = isExternalBlocklet;
|
|
466
488
|
const getRolesFromAuthConfig = (config) => {
|
|
@@ -507,6 +529,7 @@ exports.default = {
|
|
|
507
529
|
getParentComponentName,
|
|
508
530
|
getConnectAppUrl,
|
|
509
531
|
getChainInfo,
|
|
532
|
+
getBlockletChainInfo,
|
|
510
533
|
isExternalBlocklet,
|
|
511
534
|
isPreferenceKey,
|
|
512
535
|
getRolesFromAuthConfig,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.
|
|
6
|
+
"version": "1.16.1",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -24,14 +24,14 @@
|
|
|
24
24
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@abtnode/client": "1.16.
|
|
28
|
-
"@abtnode/constant": "1.16.
|
|
29
|
-
"@abtnode/util": "1.16.
|
|
27
|
+
"@abtnode/client": "1.16.1",
|
|
28
|
+
"@abtnode/constant": "1.16.1",
|
|
29
|
+
"@abtnode/util": "1.16.1",
|
|
30
30
|
"@arcblock/did": "1.18.65",
|
|
31
31
|
"@arcblock/did-ext": "1.18.65",
|
|
32
32
|
"@arcblock/did-util": "1.18.65",
|
|
33
33
|
"@arcblock/jwt": "1.18.65",
|
|
34
|
-
"@blocklet/constant": "1.16.
|
|
34
|
+
"@blocklet/constant": "1.16.1",
|
|
35
35
|
"@ocap/asset": "1.18.65",
|
|
36
36
|
"@ocap/mcrypto": "1.18.65",
|
|
37
37
|
"@ocap/types": "1.18.65",
|
|
@@ -59,7 +59,6 @@
|
|
|
59
59
|
"validate-npm-package-name": "^3.0.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@abtnode/client": "1.8.68",
|
|
63
62
|
"@arcblock/eslint-config-ts": "^0.2.3",
|
|
64
63
|
"@types/express": "^4.17.14",
|
|
65
64
|
"@types/jest": "^29.2.2",
|
|
@@ -81,5 +80,5 @@
|
|
|
81
80
|
"ts-node": "^10.9.1",
|
|
82
81
|
"typescript": "^4.8.4"
|
|
83
82
|
},
|
|
84
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "5912cfbd3b7573850727b05a808b1f798686267f"
|
|
85
84
|
}
|