@blocklet/meta 1.16.52-beta-20251002-030549-0f91dab2 → 1.16.52-beta-20251005-235515-42ad5caf
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/blocklet.js +5 -5
- package/lib/get-component-process-id.js +3 -2
- package/lib/parse-navigation-from-blocklet.js +8 -1
- package/lib/util.d.ts +6 -1
- package/lib/util.js +23 -3
- package/package.json +6 -6
package/lib/blocklet.js
CHANGED
|
@@ -42,17 +42,17 @@ const getComponentsInternalInfo = (app) => {
|
|
|
42
42
|
version: x.meta.version,
|
|
43
43
|
mountPoint: x.mountPoint || '',
|
|
44
44
|
status: x.status,
|
|
45
|
-
port: 0,
|
|
45
|
+
port: (0, util_1.findWebInterfacePort)(x) || 0,
|
|
46
46
|
containerPort: '',
|
|
47
47
|
resources: getComponentResourcesPath(x),
|
|
48
48
|
resourcesV2: getComponentResourcesPathV2(x),
|
|
49
49
|
group: x.meta.group,
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
component.port = x.environments.find((y) => y.key === webInterface.port).value;
|
|
54
|
-
component.containerPort = `${webInterface.containerPort || ''}`;
|
|
51
|
+
if (x.greenStatus === constant_1.BlockletStatus.running) {
|
|
52
|
+
component.status = constant_1.BlockletStatus.running;
|
|
55
53
|
}
|
|
54
|
+
const webInterface = (0, util_1.findWebInterface)(x) || (0, util_1.findDockerInterface)(x);
|
|
55
|
+
component.containerPort = `${webInterface?.containerPort || ''}`;
|
|
56
56
|
components.push(component);
|
|
57
57
|
});
|
|
58
58
|
return components;
|
|
@@ -5,9 +5,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
const crypto_1 = __importDefault(require("crypto"));
|
|
6
6
|
const md5 = (str) => crypto_1.default.createHash('md5').update(str).digest('hex');
|
|
7
7
|
const getComponentProcessId = (component, ancestors = []) => {
|
|
8
|
+
const realName = component.meta.name;
|
|
8
9
|
const name = !ancestors.length
|
|
9
|
-
?
|
|
10
|
-
: `${ancestors.map((x) => encodeURIComponent(x.meta.name)).join('/')}/${encodeURIComponent(
|
|
10
|
+
? realName
|
|
11
|
+
: `${ancestors.map((x) => encodeURIComponent(x.meta.name)).join('/')}/${encodeURIComponent(realName)}`;
|
|
11
12
|
if (name.length < 240) {
|
|
12
13
|
return name;
|
|
13
14
|
}
|
|
@@ -18,6 +18,7 @@ const unionWith_1 = __importDefault(require("lodash/unionWith"));
|
|
|
18
18
|
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
19
19
|
const pick_1 = __importDefault(require("lodash/pick"));
|
|
20
20
|
const isNil_1 = __importDefault(require("lodash/isNil"));
|
|
21
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
21
22
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
22
23
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
23
24
|
const ufo_1 = require("ufo");
|
|
@@ -543,6 +544,7 @@ function parseNavigation(blocklet = {}, options = {}) {
|
|
|
543
544
|
navigationMap.set((0, ufo_1.joinURL)(item.id, child.id), child);
|
|
544
545
|
});
|
|
545
546
|
});
|
|
547
|
+
const orgIsEnabled = (0, get_1.default)(blocklet, 'settings.org.enabled', false);
|
|
546
548
|
// 移除存在 db 中的默认导航
|
|
547
549
|
if (blocklet?.settings?.navigations) {
|
|
548
550
|
if (!Array.isArray(blocklet.settings.navigations)) {
|
|
@@ -560,8 +562,13 @@ function parseNavigation(blocklet = {}, options = {}) {
|
|
|
560
562
|
item.private = target.private;
|
|
561
563
|
}
|
|
562
564
|
}
|
|
565
|
+
// 检测如果 org 处于关闭状态,但是 userCenter/orgs 菜单存在,则删除 userCenter/orgs 菜单
|
|
566
|
+
if (!orgIsEnabled && item.section === 'userCenter' && item.id === '/userCenter/orgs') {
|
|
567
|
+
return null;
|
|
568
|
+
}
|
|
563
569
|
return item;
|
|
564
|
-
})
|
|
570
|
+
})
|
|
571
|
+
.filter(Boolean);
|
|
565
572
|
}
|
|
566
573
|
}
|
|
567
574
|
const customNavigationList = normalizeNavigationList(cleanOldNavigationHistory(blocklet?.settings?.navigations || [])).map(normalizeI18nFields);
|
package/lib/util.d.ts
CHANGED
|
@@ -151,10 +151,15 @@ declare const hasResourceType: (component: ComponentState, { type, did }?: {
|
|
|
151
151
|
declare const getMountPoints: (blocklet: any) => any[];
|
|
152
152
|
declare const checkPublicAccess: (securityConfig: any) => boolean;
|
|
153
153
|
declare const nanoid: (length?: number) => string;
|
|
154
|
-
|
|
154
|
+
declare function isBlockletRunning(blocklet: {
|
|
155
|
+
status: string;
|
|
156
|
+
greenStatus?: string;
|
|
157
|
+
}): boolean;
|
|
158
|
+
export { isFreeBlocklet, isFreeComponent, isBlockletRunning, forEachBlocklet, forEachBlockletSync, forEachChild, forEachChildSync, forEachComponentV2, forEachComponentV2Sync, isDeletableBlocklet, getSharedConfigObj, getAppMissingConfigs, getComponentMissingConfigs, isEnvShareableToClient, isEnvShareable, wipeSensitiveData, hasRunnableComponent, getAppName, getAppName as getDisplayName, getAppDescription, fixBlockletStatus, findWebInterface, findWebInterfacePort, findDockerInterface, findServiceFromMeta, checkPublicAccess, replaceSlotToIp, getComponentId, getComponentName, getComponentBundleId, findComponent, findComponentById, findComponentV2, findComponentByIdV2, filterComponentsV2, getParentComponentName, getConnectAppUrl, getChainInfo, getBlockletChainInfo, isExternalBlocklet, isPreferenceKey, getBlockletAppIdList, getBlockletServices, isInProgress, inProgressStatuses, isBeforeInstalled, isRunning, isAccessible, isGatewayBlocklet, isPackBlocklet, hasStartEngine, hasResourceType, getMountPoints, nanoid, };
|
|
155
159
|
declare const _default: {
|
|
156
160
|
isFreeBlocklet: (meta: TBlockletMeta) => boolean;
|
|
157
161
|
isFreeComponent: (meta: TBlockletMeta) => boolean;
|
|
162
|
+
isBlockletRunning: typeof isBlockletRunning;
|
|
158
163
|
forEachBlocklet: (blocklet: TComponentPro, cb: Function, { parallel, concurrencyLimit, sync, params: inputParams, _parent, _root, _level, _tasks: inputTasks, _ancestors, _limit, }?: {
|
|
159
164
|
parallel?: boolean;
|
|
160
165
|
concurrencyLimit?: number;
|
package/lib/util.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.hasStartEngine = exports.isPackBlocklet = exports.isGatewayBlocklet = exports.isAccessible = exports.isRunning = exports.isBeforeInstalled = exports.inProgressStatuses = exports.isInProgress = exports.getBlockletServices = exports.getBlockletAppIdList = 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.checkPublicAccess = exports.findServiceFromMeta = exports.findDockerInterface = 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 = void 0;
|
|
7
7
|
exports.nanoid = exports.getMountPoints = exports.hasResourceType = void 0;
|
|
8
8
|
exports.getAppUrl = getAppUrl;
|
|
9
|
+
exports.isBlockletRunning = isBlockletRunning;
|
|
9
10
|
/* eslint-disable no-await-in-loop */
|
|
10
11
|
const get_1 = __importDefault(require("lodash/get"));
|
|
11
12
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
@@ -535,6 +536,9 @@ const fixBlockletStatus = (blocklet) => {
|
|
|
535
536
|
}
|
|
536
537
|
forEachBlockletSync(blocklet, (b) => {
|
|
537
538
|
b.status = (0, constant_2.fromBlockletStatus)(b.status);
|
|
539
|
+
if (b.greenStatus !== undefined) {
|
|
540
|
+
b.greenStatus = (0, constant_2.fromBlockletStatus)(b.greenStatus);
|
|
541
|
+
}
|
|
538
542
|
if (b.source !== undefined) {
|
|
539
543
|
b.source = (0, constant_2.fromBlockletSource)(b.source);
|
|
540
544
|
}
|
|
@@ -581,9 +585,18 @@ const findWebInterfacePort = (blocklet) => {
|
|
|
581
585
|
if (!blocklet) {
|
|
582
586
|
return null;
|
|
583
587
|
}
|
|
584
|
-
const webInterface = findWebInterface(blocklet);
|
|
585
|
-
const { ports } = blocklet;
|
|
586
|
-
if (!webInterface
|
|
588
|
+
const webInterface = findWebInterface(blocklet) || findDockerInterface(blocklet);
|
|
589
|
+
const { ports, greenPorts } = blocklet;
|
|
590
|
+
if (!webInterface) {
|
|
591
|
+
return null;
|
|
592
|
+
}
|
|
593
|
+
if (blocklet.greenStatus === constant_2.BlockletStatus.running) {
|
|
594
|
+
if (!greenPorts) {
|
|
595
|
+
return null;
|
|
596
|
+
}
|
|
597
|
+
return greenPorts[webInterface.port];
|
|
598
|
+
}
|
|
599
|
+
if (!ports) {
|
|
587
600
|
return null;
|
|
588
601
|
}
|
|
589
602
|
return ports[webInterface.port];
|
|
@@ -777,9 +790,16 @@ const checkPublicAccess = (securityConfig) => {
|
|
|
777
790
|
exports.checkPublicAccess = checkPublicAccess;
|
|
778
791
|
const nanoid = (length = 16) => [...Array(length)].map(() => Math.random().toString(36)[2]).join('');
|
|
779
792
|
exports.nanoid = nanoid;
|
|
793
|
+
function isBlockletRunning(blocklet) {
|
|
794
|
+
if (!blocklet) {
|
|
795
|
+
return false;
|
|
796
|
+
}
|
|
797
|
+
return blocklet.status === 'running' || blocklet.greenStatus === 'running';
|
|
798
|
+
}
|
|
780
799
|
exports.default = {
|
|
781
800
|
isFreeBlocklet,
|
|
782
801
|
isFreeComponent,
|
|
802
|
+
isBlockletRunning,
|
|
783
803
|
forEachBlocklet,
|
|
784
804
|
forEachBlockletSync,
|
|
785
805
|
forEachChild,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.52-beta-
|
|
6
|
+
"version": "1.16.52-beta-20251005-235515-42ad5caf",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -25,14 +25,14 @@
|
|
|
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.52-beta-
|
|
29
|
-
"@abtnode/db-cache": "1.16.52-beta-
|
|
30
|
-
"@abtnode/docker-utils": "1.16.52-beta-
|
|
28
|
+
"@abtnode/constant": "1.16.52-beta-20251005-235515-42ad5caf",
|
|
29
|
+
"@abtnode/db-cache": "1.16.52-beta-20251005-235515-42ad5caf",
|
|
30
|
+
"@abtnode/docker-utils": "1.16.52-beta-20251005-235515-42ad5caf",
|
|
31
31
|
"@arcblock/did": "1.25.6",
|
|
32
32
|
"@arcblock/did-ext": "1.25.6",
|
|
33
33
|
"@arcblock/did-util": "1.25.6",
|
|
34
34
|
"@arcblock/jwt": "1.25.6",
|
|
35
|
-
"@blocklet/constant": "1.16.52-beta-
|
|
35
|
+
"@blocklet/constant": "1.16.52-beta-20251005-235515-42ad5caf",
|
|
36
36
|
"@ocap/asset": "1.25.6",
|
|
37
37
|
"@ocap/mcrypto": "1.25.6",
|
|
38
38
|
"@ocap/types": "1.25.6",
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"ts-node": "^10.9.1",
|
|
83
83
|
"typescript": "^5.6.3"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "7b295929a123edac2cb292c43f2edda0d3e3e6b8"
|
|
86
86
|
}
|