@giteeteam/apps-manifest 0.7.0 → 0.7.2
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.
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"type": "object",
|
|
3
|
+
"$id": "http://proxima.com/schemas/modules/frontend/workspacePage.json",
|
|
4
|
+
"additionalProperties": true,
|
|
5
|
+
"properties": {
|
|
6
|
+
"key": {
|
|
7
|
+
"type": "string"
|
|
8
|
+
},
|
|
9
|
+
"resource": {
|
|
10
|
+
"type": "string"
|
|
11
|
+
},
|
|
12
|
+
"title": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"loadType": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"route": {
|
|
19
|
+
"type": "string"
|
|
20
|
+
},
|
|
21
|
+
"type": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"required": [
|
|
26
|
+
"key", "title"
|
|
27
|
+
]
|
|
28
|
+
}
|
|
@@ -16,6 +16,20 @@
|
|
|
16
16
|
}
|
|
17
17
|
]
|
|
18
18
|
},
|
|
19
|
+
"^(workspacePage)$": {
|
|
20
|
+
"type": "array",
|
|
21
|
+
"uniqueItems": true,
|
|
22
|
+
"uniqueItemProperties": [
|
|
23
|
+
"key"
|
|
24
|
+
],
|
|
25
|
+
"minItems": 1,
|
|
26
|
+
"additionalItems": true,
|
|
27
|
+
"items": [
|
|
28
|
+
{
|
|
29
|
+
"$ref": "frontend/workspacePage.json"
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
19
33
|
"^(webtrigger)$": {
|
|
20
34
|
"type": "array",
|
|
21
35
|
"uniqueItems": true,
|
package/lib/validate.d.ts
CHANGED
package/lib/validate.js
CHANGED
|
@@ -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.validateMessageQueues = exports.validateStorage = exports.validateDependVersion = exports.validateLocales = exports.validateTables = exports.validateResources = exports.validateModules = exports.validateApp = exports.validateAll = void 0;
|
|
6
|
+
exports.validateMessageQueues = exports.validateStorage = exports.validateDependVersion = exports.validateLocales = exports.validateTables = exports.validateResources = exports.validateModules = exports.validateApp = exports.validateAll = exports.validateWorkspacePage = void 0;
|
|
7
7
|
const ajv_1 = __importDefault(require("ajv"));
|
|
8
8
|
const ajv_keywords_1 = __importDefault(require("ajv-keywords"));
|
|
9
9
|
const lodash_1 = require("lodash");
|
|
@@ -11,6 +11,7 @@ const all_json_1 = __importDefault(require("./schema/all.json"));
|
|
|
11
11
|
const app_json_1 = __importDefault(require("./schema/app.json"));
|
|
12
12
|
const index_json_1 = __importDefault(require("./schema/modules/index.json"));
|
|
13
13
|
const base_json_1 = __importDefault(require("./schema/modules/frontend/base.json"));
|
|
14
|
+
const workspacePage_json_1 = __importDefault(require("./schema/modules/frontend/workspacePage.json"));
|
|
14
15
|
const base_json_2 = __importDefault(require("./schema/modules/trigger/base.json"));
|
|
15
16
|
const webtrigger_json_1 = __importDefault(require("./schema/modules/trigger/webtrigger.json"));
|
|
16
17
|
const base_json_3 = __importDefault(require("./schema/modules/function/base.json"));
|
|
@@ -88,6 +89,7 @@ const validateFactory = (schema) => {
|
|
|
88
89
|
app_json_1.default,
|
|
89
90
|
index_json_1.default,
|
|
90
91
|
base_json_1.default,
|
|
92
|
+
workspacePage_json_1.default,
|
|
91
93
|
base_json_2.default,
|
|
92
94
|
webtrigger_json_1.default,
|
|
93
95
|
base_json_3.default,
|
|
@@ -118,20 +120,40 @@ const validateFactory = (schema) => {
|
|
|
118
120
|
};
|
|
119
121
|
};
|
|
120
122
|
const validateWorkspacePage = (json) => {
|
|
121
|
-
|
|
123
|
+
var _a;
|
|
124
|
+
const modules = (_a = json === null || json === void 0 ? void 0 : json.modules) === null || _a === void 0 ? void 0 : _a['workspacePage'];
|
|
122
125
|
const errors = [];
|
|
123
126
|
if (modules === null || modules === void 0 ? void 0 : modules.length) {
|
|
124
127
|
const groupKey = modules.filter(item => item.type === 'group').map(item => item.key);
|
|
125
128
|
for (const module of modules) {
|
|
126
|
-
if (module.type
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
if (module.parent && !groupKey.includes(module.parent)) {
|
|
129
|
+
if (module.type && !['group', 'board'].includes(module.type)) {
|
|
130
130
|
errors.push({
|
|
131
131
|
path: `/modules/workspacePage/${module.key}`,
|
|
132
|
-
message: `
|
|
132
|
+
message: `Group type must be 'group' or 'board'! `,
|
|
133
133
|
});
|
|
134
134
|
}
|
|
135
|
+
if (module.type === 'group') {
|
|
136
|
+
if (module.title && (module.title.length < 2 || module.title.length > 10)) {
|
|
137
|
+
errors.push({
|
|
138
|
+
path: `/modules/workspacePage/${module.key}`,
|
|
139
|
+
message: `Group title length must be between 2 and 10! `,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
if (module.parent && !groupKey.includes(module.parent)) {
|
|
145
|
+
errors.push({
|
|
146
|
+
path: `/modules/workspacePage/${module.key}`,
|
|
147
|
+
message: `Parent '${module.parent}' not found! `,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
if (module.title && (module.title.length < 2 || module.title.length > 30)) {
|
|
151
|
+
errors.push({
|
|
152
|
+
path: `/modules/workspacePage/${module.key}`,
|
|
153
|
+
message: `Title length must be between 2 and 30! `,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
135
157
|
}
|
|
136
158
|
}
|
|
137
159
|
return {
|
|
@@ -139,12 +161,13 @@ const validateWorkspacePage = (json) => {
|
|
|
139
161
|
errors,
|
|
140
162
|
};
|
|
141
163
|
};
|
|
164
|
+
exports.validateWorkspacePage = validateWorkspacePage;
|
|
142
165
|
const validateAll = (json) => {
|
|
143
166
|
const validateFunctions = [
|
|
144
167
|
validateFactory('http://proxima.com/schemas/all.json'),
|
|
145
168
|
// 校验一下需要的引用是否存在
|
|
146
169
|
validateResource,
|
|
147
|
-
validateWorkspacePage,
|
|
170
|
+
exports.validateWorkspacePage,
|
|
148
171
|
];
|
|
149
172
|
for (const validateFunction of validateFunctions) {
|
|
150
173
|
const validateRes = validateFunction(json);
|