@blocklet/meta 1.16.27 → 1.16.28-beta-bfbab430
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/engine.d.ts +7 -3
- package/lib/engine.js +23 -6
- package/lib/index.d.ts +3 -3
- package/lib/index.js +5 -4
- package/lib/parse-navigation-from-blocklet.js +3 -3
- package/lib/schema.js +15 -2
- package/lib/types/schema.d.ts +11 -3
- package/lib/util.d.ts +4 -5
- package/lib/util.js +14 -14
- package/package.json +4 -4
- package/lib/has-start-engine.d.ts +0 -4
- package/lib/has-start-engine.js +0 -4
package/lib/engine.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TEngine, TBlockletMeta } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* get blocklet engine info by platform
|
|
4
4
|
* @param {object} meta blocklet meta
|
|
5
5
|
*/
|
|
6
|
-
declare const
|
|
7
|
-
export
|
|
6
|
+
export declare const getBlockletEngine: (meta: any) => TEngine;
|
|
7
|
+
export declare const isGatewayBlocklet: (meta: TBlockletMeta) => boolean;
|
|
8
|
+
export declare const isPackBlocklet: (meta: TBlockletMeta) => boolean;
|
|
9
|
+
export declare const isEngineBlocklet: (meta: TBlockletMeta) => boolean;
|
|
10
|
+
export declare const hasStartEngine: (meta: any) => boolean;
|
|
11
|
+
export declare const hasMountPoint: (meta: any) => boolean;
|
package/lib/engine.js
CHANGED
|
@@ -2,27 +2,44 @@
|
|
|
2
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.hasMountPoint = exports.hasStartEngine = exports.isEngineBlocklet = exports.isPackBlocklet = exports.isGatewayBlocklet = exports.getBlockletEngine = void 0;
|
|
5
7
|
const os_1 = __importDefault(require("os"));
|
|
8
|
+
const constant_1 = require("@blocklet/constant");
|
|
6
9
|
/**
|
|
7
10
|
* get blocklet engine info by platform
|
|
8
11
|
* @param {object} meta blocklet meta
|
|
9
12
|
*/
|
|
10
|
-
const
|
|
13
|
+
const getBlockletEngine = (meta) => {
|
|
11
14
|
if (meta === undefined) {
|
|
12
15
|
throw new Error('blocklet meta param is required');
|
|
13
16
|
}
|
|
14
17
|
const { engine } = meta;
|
|
18
|
+
// if no engine info, use node as default
|
|
15
19
|
if (!engine) {
|
|
16
|
-
return { interpreter: 'node',
|
|
20
|
+
return { interpreter: 'node', source: '' };
|
|
17
21
|
}
|
|
22
|
+
// if engine is not an array, return it directly
|
|
18
23
|
if (!Array.isArray(engine)) {
|
|
19
24
|
return engine;
|
|
20
25
|
}
|
|
26
|
+
// find engine by platform
|
|
21
27
|
const platform = os_1.default.platform();
|
|
22
|
-
const
|
|
23
|
-
if (!
|
|
28
|
+
const match = engine.find((r) => r.platform === platform);
|
|
29
|
+
if (!match) {
|
|
24
30
|
throw new Error(`can not find a proper engine interpreter on ${platform}`);
|
|
25
31
|
}
|
|
26
|
-
return
|
|
32
|
+
return match;
|
|
27
33
|
};
|
|
28
|
-
|
|
34
|
+
exports.getBlockletEngine = getBlockletEngine;
|
|
35
|
+
const isGatewayBlocklet = (meta) => meta?.group === constant_1.BlockletGroup.gateway;
|
|
36
|
+
exports.isGatewayBlocklet = isGatewayBlocklet;
|
|
37
|
+
const isPackBlocklet = (meta) => meta?.group === constant_1.BlockletGroup.pack;
|
|
38
|
+
exports.isPackBlocklet = isPackBlocklet;
|
|
39
|
+
const isEngineBlocklet = (meta) => meta?.group === constant_1.BlockletGroup.engine;
|
|
40
|
+
exports.isEngineBlocklet = isEngineBlocklet;
|
|
41
|
+
const hasStartEngine = (meta) => !!meta?.main || (0, exports.getBlockletEngine)((meta || {})).interpreter === 'blocklet';
|
|
42
|
+
exports.hasStartEngine = hasStartEngine;
|
|
43
|
+
const hasMountPoint = (meta) => ((0, exports.hasStartEngine)(meta) || (meta?.interfaces || []).find((x) => x.type === constant_1.BLOCKLET_INTERFACE_TYPE_WEB)) &&
|
|
44
|
+
(0, exports.isGatewayBlocklet)(meta) === false;
|
|
45
|
+
exports.hasMountPoint = hasMountPoint;
|
package/lib/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import parse from './parse';
|
|
|
4
4
|
import toBlockletDid from './did';
|
|
5
5
|
import getBlockletWallet from './wallet';
|
|
6
6
|
import getBlockletInfo from './info';
|
|
7
|
-
import getBlockletEngine from './engine';
|
|
7
|
+
import { getBlockletEngine, hasStartEngine } from './engine';
|
|
8
8
|
import { validateMeta, fixAndValidateService } from './validate';
|
|
9
9
|
import { formatPerson, parsePerson, fixPerson, fixInterfaces, fixService, fixName } from './fix';
|
|
10
10
|
import { list, select, update, read } from './file';
|
|
@@ -27,7 +27,7 @@ export { fixName };
|
|
|
27
27
|
export { toBlockletDid };
|
|
28
28
|
export { getBlockletWallet };
|
|
29
29
|
export { getBlockletInfo };
|
|
30
|
-
export { getBlockletEngine };
|
|
30
|
+
export { getBlockletEngine, hasStartEngine };
|
|
31
31
|
export { verifyMultiSig };
|
|
32
32
|
export { getConnectedAccounts, getConnectedDids, getPermanentDid, getWallet, getWalletDid };
|
|
33
33
|
declare const _default: {
|
|
@@ -82,7 +82,7 @@ declare const _default: {
|
|
|
82
82
|
wallet: import("@ocap/wallet").WalletObject<string>;
|
|
83
83
|
permanentWallet: import("@ocap/wallet").WalletObject<string>;
|
|
84
84
|
};
|
|
85
|
-
getBlockletEngine: (meta:
|
|
85
|
+
getBlockletEngine: (meta: any) => import("./types").TEngine;
|
|
86
86
|
verifyMultiSig: (blockletMeta: import("./types").TBlockletMeta) => boolean;
|
|
87
87
|
getConnectedAccounts: typeof getConnectedAccounts;
|
|
88
88
|
getConnectedDids: typeof getConnectedDids;
|
package/lib/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.getWalletDid = exports.getWallet = exports.getPermanentDid = exports.getConnectedDids = exports.getConnectedAccounts = exports.verifyMultiSig = exports.getBlockletEngine = exports.getBlockletInfo = exports.getBlockletWallet = exports.toBlockletDid = exports.fixName = exports.fixService = exports.fixInterfaces = exports.fixPerson = exports.parsePerson = exports.formatPerson = exports.fixAndValidateService = exports.validateMeta = exports.parse = exports.read = exports.update = exports.select = exports.list = exports.constants = void 0;
|
|
29
|
+
exports.getWalletDid = exports.getWallet = exports.getPermanentDid = exports.getConnectedDids = exports.getConnectedAccounts = exports.verifyMultiSig = exports.hasStartEngine = exports.getBlockletEngine = exports.getBlockletInfo = exports.getBlockletWallet = exports.toBlockletDid = exports.fixName = exports.fixService = exports.fixInterfaces = exports.fixPerson = exports.parsePerson = exports.formatPerson = exports.fixAndValidateService = exports.validateMeta = exports.parse = exports.read = exports.update = exports.select = exports.list = exports.constants = void 0;
|
|
30
30
|
const constants = __importStar(require("./constants"));
|
|
31
31
|
exports.constants = constants;
|
|
32
32
|
const parse_1 = __importDefault(require("./parse"));
|
|
@@ -37,8 +37,9 @@ const wallet_1 = __importDefault(require("./wallet"));
|
|
|
37
37
|
exports.getBlockletWallet = wallet_1.default;
|
|
38
38
|
const info_1 = __importDefault(require("./info"));
|
|
39
39
|
exports.getBlockletInfo = info_1.default;
|
|
40
|
-
const engine_1 =
|
|
41
|
-
exports
|
|
40
|
+
const engine_1 = require("./engine");
|
|
41
|
+
Object.defineProperty(exports, "getBlockletEngine", { enumerable: true, get: function () { return engine_1.getBlockletEngine; } });
|
|
42
|
+
Object.defineProperty(exports, "hasStartEngine", { enumerable: true, get: function () { return engine_1.hasStartEngine; } });
|
|
42
43
|
const validate_1 = require("./validate");
|
|
43
44
|
Object.defineProperty(exports, "validateMeta", { enumerable: true, get: function () { return validate_1.validateMeta; } });
|
|
44
45
|
Object.defineProperty(exports, "fixAndValidateService", { enumerable: true, get: function () { return validate_1.fixAndValidateService; } });
|
|
@@ -80,7 +81,7 @@ exports.default = {
|
|
|
80
81
|
toBlockletDid: did_1.default,
|
|
81
82
|
getBlockletWallet: wallet_1.default,
|
|
82
83
|
getBlockletInfo: info_1.default,
|
|
83
|
-
getBlockletEngine: engine_1.
|
|
84
|
+
getBlockletEngine: engine_1.getBlockletEngine,
|
|
84
85
|
verifyMultiSig: verify_multi_sig_1.default,
|
|
85
86
|
getConnectedAccounts: did_utils_1.getConnectedAccounts,
|
|
86
87
|
getConnectedDids: did_utils_1.getConnectedDids,
|
|
@@ -14,7 +14,7 @@ const url_join_1 = __importDefault(require("url-join"));
|
|
|
14
14
|
const path_1 = __importDefault(require("path"));
|
|
15
15
|
const is_absolute_url_1 = __importDefault(require("is-absolute-url"));
|
|
16
16
|
const lodash_1 = require("lodash");
|
|
17
|
-
const
|
|
17
|
+
const engine_1 = require("./engine");
|
|
18
18
|
const url_path_friendly_1 = require("./url-path-friendly");
|
|
19
19
|
Object.defineProperty(exports, "checkLink", { enumerable: true, get: function () { return url_path_friendly_1.checkLink; } });
|
|
20
20
|
const DEFAULT_SECTION = 'header';
|
|
@@ -198,7 +198,7 @@ function parseBlockletNavigationList(blocklet = {}) {
|
|
|
198
198
|
const targetList = [];
|
|
199
199
|
const { children = [], meta = {} } = current;
|
|
200
200
|
const navigation = (0, cloneDeep_1.default)(meta?.navigation || []);
|
|
201
|
-
if ((0,
|
|
201
|
+
if ((0, engine_1.hasStartEngine)(meta) && current.meta?.capabilities?.navigation !== false) {
|
|
202
202
|
targetList.push(...navigation);
|
|
203
203
|
}
|
|
204
204
|
const parentName = parent.name || '';
|
|
@@ -206,7 +206,7 @@ function parseBlockletNavigationList(blocklet = {}) {
|
|
|
206
206
|
const currentName = current === blocklet ? '' : meta.name || '';
|
|
207
207
|
const currentBase = current === blocklet ? '' : current.mountPoint || BASE_PATH;
|
|
208
208
|
for (const child of children) {
|
|
209
|
-
if (!(0,
|
|
209
|
+
if (!(0, engine_1.hasStartEngine)(child.meta)) {
|
|
210
210
|
// eslint-disable-next-line no-continue
|
|
211
211
|
continue;
|
|
212
212
|
}
|
package/lib/schema.js
CHANGED
|
@@ -275,12 +275,25 @@ const interfaceSchema = Joi.object({
|
|
|
275
275
|
unknownType: 'any',
|
|
276
276
|
});
|
|
277
277
|
exports.interfaceSchema = interfaceSchema;
|
|
278
|
+
const engineSourceSchema = Joi.alternatives().try(Joi.string().required(), Joi.object({
|
|
279
|
+
url: Joi.string()
|
|
280
|
+
.uri({ scheme: ['http', 'https', 'file'] })
|
|
281
|
+
.required(),
|
|
282
|
+
name: blockletNameSchema.required(),
|
|
283
|
+
version: Joi.alternatives().try(Joi.string().valid('latest'), Joi.semverRange().valid()),
|
|
284
|
+
}), Joi.object({
|
|
285
|
+
store: Joi.string()
|
|
286
|
+
.uri({ scheme: ['http', 'https'] })
|
|
287
|
+
.required(),
|
|
288
|
+
name: blockletNameSchema.required(),
|
|
289
|
+
version: Joi.alternatives().try(Joi.string().valid('latest'), Joi.semverRange().valid()).default('latest'),
|
|
290
|
+
}));
|
|
278
291
|
const engineSchema = Joi.object({
|
|
279
292
|
platform: Joi.string()
|
|
280
293
|
.valid(...constant_2.BLOCKLET_PLATFORMS)
|
|
281
294
|
.optional(),
|
|
282
|
-
interpreter: Joi.string().valid('binary', 'node').default('node'),
|
|
283
|
-
|
|
295
|
+
interpreter: Joi.string().valid('binary', 'node', 'blocklet').default('node'),
|
|
296
|
+
source: engineSourceSchema,
|
|
284
297
|
args: Joi.array().items(Joi.string()).optional().default([]),
|
|
285
298
|
}).meta({
|
|
286
299
|
className: 'TEngine',
|
package/lib/types/schema.d.ts
CHANGED
|
@@ -47,7 +47,7 @@ export interface TBlockletMeta {
|
|
|
47
47
|
environments?: TEnvironment[];
|
|
48
48
|
files?: string[];
|
|
49
49
|
gitHash?: string;
|
|
50
|
-
group?: 'dapp' | 'static' | 'gateway' | 'pack';
|
|
50
|
+
group?: 'dapp' | 'static' | 'gateway' | 'pack' | 'engine';
|
|
51
51
|
homepage?: string;
|
|
52
52
|
htmlAst?: any;
|
|
53
53
|
interfaces?: TInterface[];
|
|
@@ -155,9 +155,17 @@ export interface TEndpoint {
|
|
|
155
155
|
}
|
|
156
156
|
export interface TEngine {
|
|
157
157
|
args?: string[];
|
|
158
|
-
interpreter?: 'binary' | 'node';
|
|
158
|
+
interpreter?: 'binary' | 'node' | 'blocklet';
|
|
159
159
|
platform?: 'aix' | 'darwin' | 'freebsd' | 'linux' | 'openbsd' | 'sunos' | 'win32';
|
|
160
|
-
|
|
160
|
+
source?: string | {
|
|
161
|
+
name: TBlockletName;
|
|
162
|
+
url: string;
|
|
163
|
+
version?: 'latest' | string;
|
|
164
|
+
} | {
|
|
165
|
+
name: TBlockletName;
|
|
166
|
+
store: string;
|
|
167
|
+
version?: 'latest' | string;
|
|
168
|
+
};
|
|
161
169
|
}
|
|
162
170
|
export interface TEnvironment {
|
|
163
171
|
default?: string;
|
package/lib/util.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { BlockletState, ComponentState } from '@abtnode/client';
|
|
2
2
|
import type { Request } from 'express';
|
|
3
|
-
import hasStartEngine from './
|
|
3
|
+
import { hasStartEngine, isEngineBlocklet, isGatewayBlocklet, isPackBlocklet } from './engine';
|
|
4
4
|
import type { TBlockletMeta, TEnvironment } from './types';
|
|
5
5
|
type TConfig = TEnvironment & {
|
|
6
6
|
key: string;
|
|
@@ -98,8 +98,6 @@ declare const isFreeBlocklet: (meta: TBlockletMeta) => boolean;
|
|
|
98
98
|
declare const isFreeComponent: (meta: TBlockletMeta) => boolean;
|
|
99
99
|
declare const wipeSensitiveData: (blocklet?: BlockletState) => BlockletState;
|
|
100
100
|
declare const isDeletableBlocklet: (blocklet?: BlockletState) => boolean;
|
|
101
|
-
declare const isGatewayBlocklet: (meta: TBlockletMeta) => boolean;
|
|
102
|
-
declare const isPackBlocklet: (meta: TBlockletMeta) => boolean;
|
|
103
101
|
declare const hasRunnableComponent: (blocklet: BlockletState) => boolean;
|
|
104
102
|
/**
|
|
105
103
|
* 获取 blocklet 的 name
|
|
@@ -153,7 +151,7 @@ declare const hasResourceType: (component: ComponentState, { type, did }?: {
|
|
|
153
151
|
type: string;
|
|
154
152
|
did: string;
|
|
155
153
|
}) => boolean;
|
|
156
|
-
export { isFreeBlocklet, isFreeComponent, forEachBlocklet, forEachBlockletSync, forEachChild, forEachChildSync, forEachComponentV2, forEachComponentV2Sync, isDeletableBlocklet, getSharedConfigObj, getAppMissingConfigs, getComponentMissingConfigs, isEnvShareableToClient, isEnvShareable, wipeSensitiveData, hasRunnableComponent, getAppName, getAppName as getDisplayName, getAppDescription, fixBlockletStatus, findWebInterface, findWebInterfacePort, findServiceFromMeta, getWhoCanAccess, getComponentWhoCanAccess, replaceSlotToIp, getComponentId, getComponentName, getComponentBundleId, findComponent, findComponentById, findComponentV2, findComponentByIdV2, filterComponentsV2, getParentComponentName, getConnectAppUrl, getChainInfo, getBlockletChainInfo, isExternalBlocklet, isPreferenceKey, getRolesFromAuthConfig, getBlockletAppIdList, getBlockletServices, isInProgress, isBeforeInstalled, isRunning, isAccessible, isGatewayBlocklet, isPackBlocklet, hasStartEngine, hasResourceType, };
|
|
154
|
+
export { isFreeBlocklet, isFreeComponent, forEachBlocklet, forEachBlockletSync, forEachChild, forEachChildSync, forEachComponentV2, forEachComponentV2Sync, isDeletableBlocklet, getSharedConfigObj, getAppMissingConfigs, getComponentMissingConfigs, isEnvShareableToClient, isEnvShareable, wipeSensitiveData, hasRunnableComponent, getAppName, getAppName as getDisplayName, getAppDescription, fixBlockletStatus, findWebInterface, findWebInterfacePort, findServiceFromMeta, getWhoCanAccess, getComponentWhoCanAccess, replaceSlotToIp, getComponentId, getComponentName, getComponentBundleId, findComponent, findComponentById, findComponentV2, findComponentByIdV2, filterComponentsV2, getParentComponentName, getConnectAppUrl, getChainInfo, getBlockletChainInfo, isExternalBlocklet, isPreferenceKey, getRolesFromAuthConfig, getBlockletAppIdList, getBlockletServices, isInProgress, isBeforeInstalled, isRunning, isAccessible, isGatewayBlocklet, isEngineBlocklet, isPackBlocklet, hasStartEngine, hasResourceType, };
|
|
157
155
|
declare const _default: {
|
|
158
156
|
isFreeBlocklet: (meta: TBlockletMeta) => boolean;
|
|
159
157
|
isFreeComponent: (meta: TBlockletMeta) => boolean;
|
|
@@ -262,8 +260,9 @@ declare const _default: {
|
|
|
262
260
|
isRunning: (status: string | number) => boolean;
|
|
263
261
|
isAccessible: (status: string | number) => boolean;
|
|
264
262
|
isGatewayBlocklet: (meta: TBlockletMeta) => boolean;
|
|
263
|
+
isEngineBlocklet: (meta: TBlockletMeta) => boolean;
|
|
265
264
|
isPackBlocklet: (meta: TBlockletMeta) => boolean;
|
|
266
|
-
hasStartEngine: (meta:
|
|
265
|
+
hasStartEngine: (meta: any) => boolean;
|
|
267
266
|
hasResourceType: (component: ComponentState, { type, did }?: {
|
|
268
267
|
type: string;
|
|
269
268
|
did: string;
|
package/lib/util.js
CHANGED
|
@@ -3,8 +3,8 @@ 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.
|
|
7
|
-
exports.hasResourceType = exports.hasStartEngine = void 0;
|
|
6
|
+
exports.isEngineBlocklet = exports.isGatewayBlocklet = exports.isAccessible = exports.isRunning = exports.isBeforeInstalled = exports.isInProgress = exports.getBlockletServices = exports.getBlockletAppIdList = exports.getRolesFromAuthConfig = exports.isPreferenceKey = exports.isExternalBlocklet = exports.getBlockletChainInfo = exports.getChainInfo = exports.getConnectAppUrl = exports.getParentComponentName = exports.filterComponentsV2 = exports.findComponentByIdV2 = exports.findComponentV2 = exports.findComponentById = exports.findComponent = exports.getComponentBundleId = exports.getComponentName = exports.getComponentId = exports.replaceSlotToIp = exports.getComponentWhoCanAccess = exports.getWhoCanAccess = exports.findServiceFromMeta = exports.findWebInterfacePort = exports.findWebInterface = exports.fixBlockletStatus = exports.getAppDescription = exports.getDisplayName = exports.getAppName = exports.hasRunnableComponent = exports.wipeSensitiveData = exports.isEnvShareable = exports.isEnvShareableToClient = exports.getComponentMissingConfigs = exports.getAppMissingConfigs = exports.getSharedConfigObj = exports.isDeletableBlocklet = exports.forEachComponentV2Sync = exports.forEachComponentV2 = exports.forEachChildSync = exports.forEachChild = exports.forEachBlockletSync = exports.forEachBlocklet = exports.isFreeComponent = exports.isFreeBlocklet = exports.getAppUrl = void 0;
|
|
7
|
+
exports.hasResourceType = exports.hasStartEngine = exports.isPackBlocklet = void 0;
|
|
8
8
|
/* eslint-disable no-await-in-loop */
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
@@ -12,8 +12,11 @@ const url_join_1 = __importDefault(require("url-join"));
|
|
|
12
12
|
const p_limit_1 = __importDefault(require("p-limit"));
|
|
13
13
|
const constant_1 = __importDefault(require("@abtnode/constant"));
|
|
14
14
|
const constant_2 = require("@blocklet/constant");
|
|
15
|
-
const
|
|
16
|
-
exports
|
|
15
|
+
const engine_1 = require("./engine");
|
|
16
|
+
Object.defineProperty(exports, "hasStartEngine", { enumerable: true, get: function () { return engine_1.hasStartEngine; } });
|
|
17
|
+
Object.defineProperty(exports, "isEngineBlocklet", { enumerable: true, get: function () { return engine_1.isEngineBlocklet; } });
|
|
18
|
+
Object.defineProperty(exports, "isGatewayBlocklet", { enumerable: true, get: function () { return engine_1.isGatewayBlocklet; } });
|
|
19
|
+
Object.defineProperty(exports, "isPackBlocklet", { enumerable: true, get: function () { return engine_1.isPackBlocklet; } });
|
|
17
20
|
const { NODE_SERVICES, SLOT_FOR_IP_DNS_SITE, WHO_CAN_ACCESS, WHO_CAN_ACCESS_PREFIX_ROLES } = constant_1.default;
|
|
18
21
|
const getComponentId = (component, ancestors = []) => `${ancestors.map((x) => (x && x.meta ? x.meta.did : '')).join('/')}${ancestors.length ? '/' : ''}${component && component.meta ? component.meta.did : ''}`;
|
|
19
22
|
exports.getComponentId = getComponentId;
|
|
@@ -419,10 +422,6 @@ const isDeletableBlocklet = (blocklet) => {
|
|
|
419
422
|
return config.value === 'yes';
|
|
420
423
|
};
|
|
421
424
|
exports.isDeletableBlocklet = isDeletableBlocklet;
|
|
422
|
-
const isGatewayBlocklet = (meta) => meta?.group === constant_2.BlockletGroup.gateway;
|
|
423
|
-
exports.isGatewayBlocklet = isGatewayBlocklet;
|
|
424
|
-
const isPackBlocklet = (meta) => meta?.group === constant_2.BlockletGroup.pack;
|
|
425
|
-
exports.isPackBlocklet = isPackBlocklet;
|
|
426
425
|
const hasRunnableComponent = (blocklet) => {
|
|
427
426
|
let has = false;
|
|
428
427
|
forEachBlockletSync(blocklet, (x) => {
|
|
@@ -599,8 +598,8 @@ const getConnectAppUrl = ({ request, baseUrl }) => {
|
|
|
599
598
|
};
|
|
600
599
|
exports.getConnectAppUrl = getConnectAppUrl;
|
|
601
600
|
const replaceSlotToIp = (url, ip) => {
|
|
602
|
-
const
|
|
603
|
-
return (url || '').replace(SLOT_FOR_IP_DNS_SITE, (ip || '').replace(new RegExp(
|
|
601
|
+
const separator = (ip || '').includes(':') ? ':' : /\./; // ip v6 or v4
|
|
602
|
+
return (url || '').replace(SLOT_FOR_IP_DNS_SITE, (ip || '').replace(new RegExp(separator, 'g'), '-'));
|
|
604
603
|
};
|
|
605
604
|
exports.replaceSlotToIp = replaceSlotToIp;
|
|
606
605
|
const getChainInfo = (env) => {
|
|
@@ -716,7 +715,7 @@ const hasResourceType = (component, { type, did } = { type: '', did: '' }) => {
|
|
|
716
715
|
if (!component) {
|
|
717
716
|
return false;
|
|
718
717
|
}
|
|
719
|
-
return (!(0,
|
|
718
|
+
return (!(0, engine_1.hasStartEngine)(component.meta) &&
|
|
720
719
|
component.meta?.resource?.bundles?.length > 0 &&
|
|
721
720
|
(component.meta.resource.bundles || []).some((y) => y.type === type && y.did === did));
|
|
722
721
|
};
|
|
@@ -769,8 +768,9 @@ exports.default = {
|
|
|
769
768
|
isBeforeInstalled,
|
|
770
769
|
isRunning,
|
|
771
770
|
isAccessible,
|
|
772
|
-
isGatewayBlocklet,
|
|
773
|
-
|
|
774
|
-
|
|
771
|
+
isGatewayBlocklet: engine_1.isGatewayBlocklet,
|
|
772
|
+
isEngineBlocklet: engine_1.isEngineBlocklet,
|
|
773
|
+
isPackBlocklet: engine_1.isPackBlocklet,
|
|
774
|
+
hasStartEngine: engine_1.hasStartEngine,
|
|
775
775
|
hasResourceType,
|
|
776
776
|
};
|
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.28-beta-bfbab430",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -25,12 +25,12 @@
|
|
|
25
25
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
26
26
|
"license": "Apache-2.0",
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@abtnode/constant": "1.16.
|
|
28
|
+
"@abtnode/constant": "1.16.28-beta-bfbab430",
|
|
29
29
|
"@arcblock/did": "1.18.123",
|
|
30
30
|
"@arcblock/did-ext": "1.18.123",
|
|
31
31
|
"@arcblock/did-util": "1.18.123",
|
|
32
32
|
"@arcblock/jwt": "1.18.123",
|
|
33
|
-
"@blocklet/constant": "1.16.
|
|
33
|
+
"@blocklet/constant": "1.16.28-beta-bfbab430",
|
|
34
34
|
"@ocap/asset": "1.18.123",
|
|
35
35
|
"@ocap/mcrypto": "1.18.123",
|
|
36
36
|
"@ocap/types": "1.18.123",
|
|
@@ -79,5 +79,5 @@
|
|
|
79
79
|
"ts-node": "^10.9.1",
|
|
80
80
|
"typescript": "^5.0.4"
|
|
81
81
|
},
|
|
82
|
-
"gitHead": "
|
|
82
|
+
"gitHead": "f1fbf0752de46be00d1faa0d54eb7d28016e0bb9"
|
|
83
83
|
}
|
package/lib/has-start-engine.js
DELETED