@blocklet/meta 1.16.23-beta-7b5b0175 → 1.16.23-beta-abdda301
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/schema.js +1 -1
- package/lib/types/schema.d.ts +1 -1
- package/lib/util.d.ts +2 -0
- package/lib/util.js +22 -2
- package/package.json +4 -4
package/lib/schema.js
CHANGED
|
@@ -639,7 +639,7 @@ const blockletMetaProps = {
|
|
|
639
639
|
capabilities: Joi.object({
|
|
640
640
|
clusterMode: Joi.boolean(),
|
|
641
641
|
didSpace: Joi.string()
|
|
642
|
-
.valid(...Object.values(constant_2.
|
|
642
|
+
.valid(...Object.values(constant_2.BLOCKLET_APP_SPACE_REQUIREMENT))
|
|
643
643
|
.optional(),
|
|
644
644
|
navigation: Joi.boolean().default(true),
|
|
645
645
|
serverless: Joi.boolean().optional(),
|
package/lib/types/schema.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface TBlockletMeta {
|
|
|
13
13
|
capabilities?: {
|
|
14
14
|
clusterMode?: boolean;
|
|
15
15
|
component?: boolean;
|
|
16
|
-
didSpace?: 'required' | 'optional';
|
|
16
|
+
didSpace?: 'required' | 'requiredOnSetup' | 'optional' | 'requiredOnConnect';
|
|
17
17
|
navigation?: boolean;
|
|
18
18
|
serverless?: boolean;
|
|
19
19
|
sitemap?: boolean;
|
package/lib/util.d.ts
CHANGED
|
@@ -115,6 +115,7 @@ declare const getAppName: (blocklet: BlockletState, onlyUseMeta?: boolean) => st
|
|
|
115
115
|
* @returns blocklet display description
|
|
116
116
|
*/
|
|
117
117
|
declare const getAppDescription: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
|
118
|
+
export declare function getAppUrl(blocklet: BlockletState): string;
|
|
118
119
|
declare const fixBlockletStatus: (blocklet?: BlockletState) => void;
|
|
119
120
|
declare const findWebInterface: (blocklet?: BlockletState | TBlockletMeta) => any;
|
|
120
121
|
declare const findWebInterfacePort: (blocklet?: BlockletState) => any;
|
|
@@ -187,6 +188,7 @@ declare const _default: {
|
|
|
187
188
|
hasRunnableComponent: (blocklet: BlockletState) => boolean;
|
|
188
189
|
getAppName: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
|
189
190
|
getAppDescription: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
|
191
|
+
getAppUrl: typeof getAppUrl;
|
|
190
192
|
getDisplayName: (blocklet: BlockletState, onlyUseMeta?: boolean) => string;
|
|
191
193
|
fixBlockletStatus: (blocklet?: BlockletState) => void;
|
|
192
194
|
findWebInterface: (blocklet?: TBlockletMeta | BlockletState) => any;
|
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 = void 0;
|
|
6
|
+
exports.isPackBlocklet = 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 = 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"));
|
|
@@ -476,6 +476,25 @@ const getAppDescription = (blocklet, onlyUseMeta = false) => {
|
|
|
476
476
|
return description || meta.description || meta.name;
|
|
477
477
|
};
|
|
478
478
|
exports.getAppDescription = getAppDescription;
|
|
479
|
+
function getAppUrl(blocklet) {
|
|
480
|
+
const appUrls = blocklet?.site?.domainAliases
|
|
481
|
+
?.sort((a, b) => {
|
|
482
|
+
if (a.accessibility?.accessible && b.accessibility?.accessible) {
|
|
483
|
+
return +a.isProtected - +b.isProtected;
|
|
484
|
+
}
|
|
485
|
+
// eslint-disable-next-line no-unsafe-optional-chaining
|
|
486
|
+
return +b.accessibility?.accessible - +a.accessibility?.accessible;
|
|
487
|
+
})
|
|
488
|
+
?.map((domainAlias) => {
|
|
489
|
+
const protocol = domainAlias?.domainStatus?.isHttps ? 'https://' : 'http://';
|
|
490
|
+
const value = domainAlias?.value;
|
|
491
|
+
return `${protocol}${value}`;
|
|
492
|
+
})
|
|
493
|
+
.filter(Boolean);
|
|
494
|
+
const appUrl = appUrls?.[0];
|
|
495
|
+
return appUrl;
|
|
496
|
+
}
|
|
497
|
+
exports.getAppUrl = getAppUrl;
|
|
479
498
|
const fixBlockletStatus = (blocklet) => {
|
|
480
499
|
if (!blocklet) {
|
|
481
500
|
return;
|
|
@@ -721,6 +740,7 @@ exports.default = {
|
|
|
721
740
|
hasRunnableComponent,
|
|
722
741
|
getAppName,
|
|
723
742
|
getAppDescription,
|
|
743
|
+
getAppUrl,
|
|
724
744
|
getDisplayName: getAppName,
|
|
725
745
|
fixBlockletStatus,
|
|
726
746
|
findWebInterface,
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.16.23-beta-
|
|
6
|
+
"version": "1.16.23-beta-abdda301",
|
|
7
7
|
"description": "Library to parse/validate/fix blocklet meta",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -24,12 +24,12 @@
|
|
|
24
24
|
"author": "wangshijun <wangshijun2020@gmail.com> (http://github.com/wangshijun)",
|
|
25
25
|
"license": "Apache-2.0",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@abtnode/constant": "1.16.23-beta-
|
|
27
|
+
"@abtnode/constant": "1.16.23-beta-abdda301",
|
|
28
28
|
"@arcblock/did": "1.18.108",
|
|
29
29
|
"@arcblock/did-ext": "1.18.108",
|
|
30
30
|
"@arcblock/did-util": "1.18.108",
|
|
31
31
|
"@arcblock/jwt": "1.18.108",
|
|
32
|
-
"@blocklet/constant": "1.16.23-beta-
|
|
32
|
+
"@blocklet/constant": "1.16.23-beta-abdda301",
|
|
33
33
|
"@ocap/asset": "1.18.108",
|
|
34
34
|
"@ocap/mcrypto": "1.18.108",
|
|
35
35
|
"@ocap/types": "1.18.108",
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"ts-node": "^10.9.1",
|
|
79
79
|
"typescript": "^5.0.4"
|
|
80
80
|
},
|
|
81
|
-
"gitHead": "
|
|
81
|
+
"gitHead": "2b064df15b34007f6145170ee691ae9e91ff1528"
|
|
82
82
|
}
|