@blocklet/meta 1.16.28 → 1.16.29-beta-e04c6f40
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.
|
@@ -85,9 +85,11 @@ interface Blocklet {
|
|
|
85
85
|
interface ParseNavigationOption {
|
|
86
86
|
beforeProcess?: (data: any) => any;
|
|
87
87
|
}
|
|
88
|
+
declare const sortRootNavigation: (navigation: NavigationItem[]) => NavigationItem[];
|
|
89
|
+
declare const cleanOldNavigationHistory: (navigation: NavigationItem[]) => NavigationItem[];
|
|
88
90
|
declare function parseNavigation(blocklet?: Blocklet, options?: ParseNavigationOption): {
|
|
89
91
|
navigationList: any[];
|
|
90
92
|
components: any[];
|
|
91
93
|
builtinList: any[];
|
|
92
94
|
};
|
|
93
|
-
export { parseNavigation, deepWalk, isMatchSection, nestNavigationList, filterNavigation, cleanOrphanNavigation, joinLink, checkLink, flattenNavigation, splitNavigationBySection, };
|
|
95
|
+
export { parseNavigation, deepWalk, isMatchSection, nestNavigationList, filterNavigation, cleanOrphanNavigation, joinLink, checkLink, flattenNavigation, splitNavigationBySection, cleanOldNavigationHistory, sortRootNavigation, };
|
|
@@ -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.splitNavigationBySection = exports.flattenNavigation = exports.checkLink = exports.joinLink = exports.cleanOrphanNavigation = exports.filterNavigation = exports.nestNavigationList = exports.isMatchSection = exports.deepWalk = exports.parseNavigation = void 0;
|
|
6
|
+
exports.sortRootNavigation = exports.cleanOldNavigationHistory = exports.splitNavigationBySection = exports.flattenNavigation = exports.checkLink = exports.joinLink = exports.cleanOrphanNavigation = exports.filterNavigation = exports.nestNavigationList = exports.isMatchSection = exports.deepWalk = exports.parseNavigation = void 0;
|
|
7
7
|
const unionWith_1 = __importDefault(require("lodash/unionWith"));
|
|
8
8
|
const isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
9
9
|
const pick_1 = __importDefault(require("lodash/pick"));
|
|
@@ -488,10 +488,25 @@ function cleanOrphanNavigation(list) {
|
|
|
488
488
|
});
|
|
489
489
|
}
|
|
490
490
|
exports.cleanOrphanNavigation = cleanOrphanNavigation;
|
|
491
|
+
const sortRootNavigation = (navigation) => {
|
|
492
|
+
const [root, other] = (0, lodash_1.partition)(navigation, (x) => x.id === '/team');
|
|
493
|
+
return [...root, ...other];
|
|
494
|
+
};
|
|
495
|
+
exports.sortRootNavigation = sortRootNavigation;
|
|
496
|
+
// FIXME: Pillar, 这个函数是一个过渡方案, 用来清理 navigation 中的历史数据, 之后可以删除
|
|
497
|
+
const cleanOldNavigationHistory = (navigation) => {
|
|
498
|
+
const [, other] = (0, lodash_1.partition)(navigation, (x) => {
|
|
499
|
+
const title = typeof x.title === 'string' ? x.title : x.title?.en;
|
|
500
|
+
// 这里找不到多余的可以用来判断的数据, 只好用 title 来判断
|
|
501
|
+
return (x.id === '/team' && title === 'Access') || (x.id === '/dashboard' && title === 'Blocklet');
|
|
502
|
+
});
|
|
503
|
+
return other;
|
|
504
|
+
};
|
|
505
|
+
exports.cleanOldNavigationHistory = cleanOldNavigationHistory;
|
|
491
506
|
function parseNavigation(blocklet = {}, options = {}) {
|
|
492
507
|
const { beforeProcess = (v) => v } = options;
|
|
493
508
|
const { navigationList: builtinNavigation, components } = parseBlockletNavigationList(blocklet);
|
|
494
|
-
const customNavigationList = blocklet?.settings?.navigations || [];
|
|
509
|
+
const customNavigationList = cleanOldNavigationHistory(blocklet?.settings?.navigations || []);
|
|
495
510
|
const compactedNavigation = compactNavigation(beforeProcess(builtinNavigation));
|
|
496
511
|
const patchedNavigation = patchBuiltinNavigation(compactedNavigation);
|
|
497
512
|
const splitNavigation = splitNavigationBySection(patchedNavigation);
|
package/lib/schema.js
CHANGED
|
@@ -302,7 +302,7 @@ const engineSchema = Joi.object({
|
|
|
302
302
|
exports.engineSchema = engineSchema;
|
|
303
303
|
const personSchema = Joi.object({
|
|
304
304
|
name: Joi.string().min(1).required(),
|
|
305
|
-
email: Joi.string().email().optional(),
|
|
305
|
+
email: Joi.string().email({ tlds: false }).optional(),
|
|
306
306
|
url: Joi.string().uri().optional(),
|
|
307
307
|
}).meta({
|
|
308
308
|
className: 'TPerson',
|
|
@@ -482,7 +482,9 @@ const blockletMetaProps = {
|
|
|
482
482
|
documentation: Joi.string().uri().optional().allow('').default(''),
|
|
483
483
|
homepage: Joi.string().uri().optional().allow('').default(''),
|
|
484
484
|
license: Joi.string().optional().allow('').default(''),
|
|
485
|
-
support: Joi.alternatives()
|
|
485
|
+
support: Joi.alternatives()
|
|
486
|
+
.try(Joi.string().uri(), Joi.string().email({ tlds: false }))
|
|
487
|
+
.optional(),
|
|
486
488
|
// which asset factory to mint blocklet purchase nft
|
|
487
489
|
// This is usually created and maintained by `blocklet publish` command
|
|
488
490
|
nftFactory: Joi.DID().optional().allow('').default(''),
|
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.29-beta-e04c6f40",
|
|
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.29-beta-e04c6f40",
|
|
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.29-beta-e04c6f40",
|
|
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": "f3e8f2ce931215b95ada33e87aee997d8ae52a69"
|
|
83
83
|
}
|