@blocklet/meta 1.8.68-beta-500af7e5 → 1.8.69-beta-e0666d0d
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/index.d.ts +3 -3
- package/lib/info.d.ts +3 -3
- package/lib/info.js +3 -0
- package/lib/util.d.ts +15 -36
- package/lib/util.js +37 -7
- package/package.json +7 -7
package/lib/index.d.ts
CHANGED
|
@@ -82,10 +82,10 @@ declare const _default: {
|
|
|
82
82
|
name: string;
|
|
83
83
|
version: string;
|
|
84
84
|
description: string;
|
|
85
|
-
passportColor
|
|
85
|
+
passportColor: string;
|
|
86
86
|
appUrl: string;
|
|
87
|
-
wallet
|
|
88
|
-
permanentWallet
|
|
87
|
+
wallet: import("@ocap/wallet").WalletObject<string>;
|
|
88
|
+
permanentWallet: import("@ocap/wallet").WalletObject<string>;
|
|
89
89
|
};
|
|
90
90
|
getBlockletEngine: (meta: import("./types").TBlockletMeta) => import("./types").TEngine;
|
|
91
91
|
verifyMultiSig: (blockletMeta: import("./types").TBlockletMeta) => boolean;
|
package/lib/info.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ declare const getBlockletInfo: (state: BlockletState, nodeSk?: string, { returnW
|
|
|
7
7
|
name: string;
|
|
8
8
|
version: string;
|
|
9
9
|
description: string;
|
|
10
|
-
passportColor
|
|
10
|
+
passportColor: string;
|
|
11
11
|
appUrl: string;
|
|
12
|
-
wallet
|
|
13
|
-
permanentWallet
|
|
12
|
+
wallet: WalletObject;
|
|
13
|
+
permanentWallet: WalletObject;
|
|
14
14
|
};
|
|
15
15
|
export = getBlockletInfo;
|
package/lib/info.js
CHANGED
|
@@ -25,7 +25,10 @@ const getBlockletInfo = (state, nodeSk, { returnWallet = true } = {}) => {
|
|
|
25
25
|
version,
|
|
26
26
|
name,
|
|
27
27
|
description,
|
|
28
|
+
passportColor,
|
|
28
29
|
appUrl,
|
|
30
|
+
wallet: null,
|
|
31
|
+
permanentWallet: null,
|
|
29
32
|
};
|
|
30
33
|
}
|
|
31
34
|
const customSk = envs.find((x) => x.key === 'BLOCKLET_APP_SK');
|
package/lib/util.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BlockletState, ComponentState } from '@abtnode/client';
|
|
2
|
-
import { Request } from 'express';
|
|
3
|
-
import { TBlockletMeta, TEnvironment } from './types';
|
|
1
|
+
import type { BlockletState, ComponentState } from '@abtnode/client';
|
|
2
|
+
import type { Request } from 'express';
|
|
3
|
+
import type { TBlockletMeta, TEnvironment } from './types';
|
|
4
4
|
type TConfig = TEnvironment & {
|
|
5
5
|
key: string;
|
|
6
6
|
};
|
|
@@ -86,7 +86,14 @@ declare const hasRunnableComponent: (blocklet: BlockletState) => boolean;
|
|
|
86
86
|
* @param {Boolean} onlyUseMeta 优先使用应用元数据的name
|
|
87
87
|
* @returns blocklet display name
|
|
88
88
|
*/
|
|
89
|
-
declare const
|
|
89
|
+
declare const getAppName: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
|
90
|
+
/**
|
|
91
|
+
* 获取 blocklet 的 description
|
|
92
|
+
* @param {Object} blocklet 应用数据
|
|
93
|
+
* @param {Boolean} onlyUseMeta 优先使用应用元数据的name
|
|
94
|
+
* @returns blocklet display description
|
|
95
|
+
*/
|
|
96
|
+
declare const getAppDescription: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
|
90
97
|
declare const fixBlockletStatus: (blocklet?: BlockletState) => void;
|
|
91
98
|
declare const findWebInterface: (blocklet?: BlockletState | TBlockletMeta) => any;
|
|
92
99
|
declare const findWebInterfacePort: (blocklet?: BlockletState) => any;
|
|
@@ -102,38 +109,8 @@ declare const isExternalBlocklet: (blocklet?: BlockletState) => boolean;
|
|
|
102
109
|
declare const getRolesFromAuthConfig: (config: {
|
|
103
110
|
whoCanAccess: string;
|
|
104
111
|
}) => Array<string>;
|
|
105
|
-
|
|
106
|
-
export { isFreeComponent };
|
|
107
|
-
export { isComponentBlocklet };
|
|
108
|
-
export { forEachBlocklet };
|
|
109
|
-
export { forEachBlockletSync };
|
|
110
|
-
export { forEachChild };
|
|
111
|
-
export { forEachChildSync };
|
|
112
|
-
export { isDeletableBlocklet };
|
|
113
|
-
export { getSharedConfigObj };
|
|
114
|
-
export { getAppMissingConfigs };
|
|
115
|
-
export { getComponentMissingConfigs };
|
|
116
|
-
export { isEnvShareable };
|
|
117
|
-
export { wipeSensitiveData };
|
|
118
|
-
export { hasRunnableComponent };
|
|
119
|
-
export { getDisplayName };
|
|
120
|
-
export { fixBlockletStatus };
|
|
121
|
-
export { findWebInterface };
|
|
122
|
-
export { findWebInterfacePort };
|
|
123
|
-
export { findServiceFromMeta };
|
|
124
|
-
export { getWhoCanAccess };
|
|
125
|
-
export { replaceSlotToIp };
|
|
126
|
-
export { getComponentId };
|
|
127
|
-
export { getComponentName };
|
|
128
|
-
export { getComponentBundleId };
|
|
129
|
-
export { findComponent };
|
|
130
|
-
export { findComponentById };
|
|
131
|
-
export { getParentComponentName };
|
|
132
|
-
export { getConnectAppUrl };
|
|
133
|
-
export { getChainInfo };
|
|
134
|
-
export { isExternalBlocklet };
|
|
135
|
-
export { isPreferenceKey };
|
|
136
|
-
export { getRolesFromAuthConfig };
|
|
112
|
+
declare const getBlockletAppIdList: (blocklet: Partial<BlockletState>) => string[];
|
|
113
|
+
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, };
|
|
137
114
|
declare const _default: {
|
|
138
115
|
isFreeBlocklet: (meta: TBlockletMeta) => boolean;
|
|
139
116
|
isFreeComponent: (meta: TBlockletMeta) => boolean;
|
|
@@ -160,6 +137,8 @@ declare const _default: {
|
|
|
160
137
|
isEnvShareable: (env?: TConfig) => boolean;
|
|
161
138
|
wipeSensitiveData: (blocklet?: BlockletState) => BlockletState;
|
|
162
139
|
hasRunnableComponent: (blocklet: BlockletState) => boolean;
|
|
140
|
+
getAppName: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
|
141
|
+
getAppDescription: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
|
163
142
|
getDisplayName: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
|
164
143
|
fixBlockletStatus: (blocklet?: BlockletState) => void;
|
|
165
144
|
findWebInterface: (blocklet?: TBlockletMeta | BlockletState) => any;
|
package/lib/util.js
CHANGED
|
@@ -3,9 +3,10 @@ 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.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.getDisplayName = 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.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
|
+
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
9
10
|
const url_join_1 = __importDefault(require("url-join"));
|
|
10
11
|
const p_limit_1 = __importDefault(require("p-limit"));
|
|
11
12
|
const constant_1 = __importDefault(require("@abtnode/constant"));
|
|
@@ -317,21 +318,43 @@ exports.hasRunnableComponent = hasRunnableComponent;
|
|
|
317
318
|
* @param {Boolean} onlyUseMeta 优先使用应用元数据的name
|
|
318
319
|
* @returns blocklet display name
|
|
319
320
|
*/
|
|
320
|
-
const
|
|
321
|
+
const getAppName = (blocklet, onlyUseMeta = false) => {
|
|
321
322
|
if (!blocklet) {
|
|
322
323
|
return '';
|
|
323
324
|
}
|
|
324
325
|
const { meta } = blocklet;
|
|
325
|
-
let
|
|
326
|
+
let name;
|
|
326
327
|
if (!onlyUseMeta && blocklet.environments) {
|
|
327
328
|
const target = blocklet.environments.find((e) => e.key === 'BLOCKLET_APP_NAME');
|
|
328
329
|
if (target && target.value) {
|
|
329
|
-
|
|
330
|
+
name = target.value;
|
|
330
331
|
}
|
|
331
332
|
}
|
|
332
|
-
return
|
|
333
|
+
return name || meta.title || meta.name;
|
|
333
334
|
};
|
|
334
|
-
exports.
|
|
335
|
+
exports.getAppName = getAppName;
|
|
336
|
+
exports.getDisplayName = getAppName;
|
|
337
|
+
/**
|
|
338
|
+
* 获取 blocklet 的 description
|
|
339
|
+
* @param {Object} blocklet 应用数据
|
|
340
|
+
* @param {Boolean} onlyUseMeta 优先使用应用元数据的name
|
|
341
|
+
* @returns blocklet display description
|
|
342
|
+
*/
|
|
343
|
+
const getAppDescription = (blocklet, onlyUseMeta = false) => {
|
|
344
|
+
if (!blocklet) {
|
|
345
|
+
return '';
|
|
346
|
+
}
|
|
347
|
+
const { meta } = blocklet;
|
|
348
|
+
let description;
|
|
349
|
+
if (!onlyUseMeta && blocklet.environments) {
|
|
350
|
+
const target = blocklet.environments.find((e) => e.key === 'BLOCKLET_APP_DESCRIPTION');
|
|
351
|
+
if (target && target.value) {
|
|
352
|
+
description = target.value;
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return description || meta.description || meta.name;
|
|
356
|
+
};
|
|
357
|
+
exports.getAppDescription = getAppDescription;
|
|
335
358
|
const fixBlockletStatus = (blocklet) => {
|
|
336
359
|
if (!blocklet) {
|
|
337
360
|
return;
|
|
@@ -439,6 +462,11 @@ const getRolesFromAuthConfig = (config) => {
|
|
|
439
462
|
return config.whoCanAccess.substring(WHO_CAN_ACCESS_PREFIX_ROLES.length).split(',');
|
|
440
463
|
};
|
|
441
464
|
exports.getRolesFromAuthConfig = getRolesFromAuthConfig;
|
|
465
|
+
const getBlockletAppIdList = (blocklet) => {
|
|
466
|
+
const migratedFrom = Array.isArray(blocklet.migratedFrom) ? blocklet.migratedFrom.map((x) => x.appDid) : [];
|
|
467
|
+
return (0, uniq_1.default)([blocklet.appDid, blocklet.appPid, ...migratedFrom].filter(Boolean));
|
|
468
|
+
};
|
|
469
|
+
exports.getBlockletAppIdList = getBlockletAppIdList;
|
|
442
470
|
exports.default = {
|
|
443
471
|
isFreeBlocklet,
|
|
444
472
|
isFreeComponent,
|
|
@@ -454,7 +482,9 @@ exports.default = {
|
|
|
454
482
|
isEnvShareable,
|
|
455
483
|
wipeSensitiveData,
|
|
456
484
|
hasRunnableComponent,
|
|
457
|
-
|
|
485
|
+
getAppName,
|
|
486
|
+
getAppDescription,
|
|
487
|
+
getDisplayName: getAppName,
|
|
458
488
|
fixBlockletStatus,
|
|
459
489
|
findWebInterface,
|
|
460
490
|
findWebInterfacePort,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.
|
|
6
|
+
"version": "1.8.69-beta-e0666d0d",
|
|
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.8.
|
|
28
|
-
"@abtnode/constant": "1.8.
|
|
29
|
-
"@abtnode/util": "1.8.
|
|
27
|
+
"@abtnode/client": "1.8.69-beta-e0666d0d",
|
|
28
|
+
"@abtnode/constant": "1.8.69-beta-e0666d0d",
|
|
29
|
+
"@abtnode/util": "1.8.69-beta-e0666d0d",
|
|
30
30
|
"@arcblock/did": "1.18.57",
|
|
31
31
|
"@arcblock/did-ext": "1.18.57",
|
|
32
32
|
"@arcblock/did-util": "1.18.57",
|
|
33
33
|
"@arcblock/jwt": "1.18.57",
|
|
34
|
-
"@blocklet/constant": "1.8.
|
|
34
|
+
"@blocklet/constant": "1.8.69-beta-e0666d0d",
|
|
35
35
|
"@ocap/asset": "1.18.57",
|
|
36
36
|
"@ocap/mcrypto": "1.18.57",
|
|
37
37
|
"@ocap/types": "1.18.57",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"validate-npm-package-name": "^3.0.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@abtnode/client": "^1.8.
|
|
62
|
+
"@abtnode/client": "^1.8.68",
|
|
63
63
|
"@arcblock/eslint-config-ts": "^0.2.3",
|
|
64
64
|
"@types/express": "^4.17.14",
|
|
65
65
|
"@types/jest": "^29.2.2",
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"ts-node": "^10.9.1",
|
|
82
82
|
"typescript": "^4.8.4"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "acf0373591eaa3aff76483edc4e648afc543f1f7"
|
|
85
85
|
}
|