@giteeteam/apps-manifest 0.7.6 → 0.7.7
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/validate.d.ts +4 -0
- package/lib/validate.js +26 -1
- package/package.json +2 -1
package/lib/validate.d.ts
CHANGED
|
@@ -3,6 +3,10 @@ export declare const validateWorkspacePage: (json: IManifest) => {
|
|
|
3
3
|
pass: boolean;
|
|
4
4
|
errors: any[];
|
|
5
5
|
};
|
|
6
|
+
export declare const validateScheduledTrigger: (json: IManifest) => {
|
|
7
|
+
pass: boolean;
|
|
8
|
+
errors: any[];
|
|
9
|
+
};
|
|
6
10
|
export declare const validateAll: (json: IManifest) => {
|
|
7
11
|
pass: boolean;
|
|
8
12
|
errors: any[];
|
package/lib/validate.js
CHANGED
|
@@ -3,11 +3,12 @@ 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 = exports.validateWorkspacePage = void 0;
|
|
6
|
+
exports.validateMessageQueues = exports.validateStorage = exports.validateDependVersion = exports.validateLocales = exports.validateTables = exports.validateResources = exports.validateModules = exports.validateApp = exports.validateAll = exports.validateScheduledTrigger = 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 ajv_errors_1 = __importDefault(require("ajv-errors"));
|
|
10
10
|
const lodash_1 = require("lodash");
|
|
11
|
+
const cron_1 = require("cron");
|
|
11
12
|
const all_json_1 = __importDefault(require("./schema/all.json"));
|
|
12
13
|
const app_json_1 = __importDefault(require("./schema/app.json"));
|
|
13
14
|
const index_json_1 = __importDefault(require("./schema/modules/index.json"));
|
|
@@ -169,12 +170,36 @@ const validateWorkspacePage = (json) => {
|
|
|
169
170
|
};
|
|
170
171
|
};
|
|
171
172
|
exports.validateWorkspacePage = validateWorkspacePage;
|
|
173
|
+
const validateScheduledTrigger = (json) => {
|
|
174
|
+
var _a;
|
|
175
|
+
const modules = (_a = json === null || json === void 0 ? void 0 : json.modules) === null || _a === void 0 ? void 0 : _a['scheduledTrigger'];
|
|
176
|
+
const errors = [];
|
|
177
|
+
if (modules === null || modules === void 0 ? void 0 : modules.length) {
|
|
178
|
+
for (const module of modules) {
|
|
179
|
+
try {
|
|
180
|
+
new cron_1.CronTime(module.cronTime);
|
|
181
|
+
}
|
|
182
|
+
catch (err) {
|
|
183
|
+
errors.push({
|
|
184
|
+
path: `/modules/scheduledTrigger/${module.key}`,
|
|
185
|
+
message: `cronTime is invalid! `,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
pass: errors.length === 0,
|
|
192
|
+
errors,
|
|
193
|
+
};
|
|
194
|
+
};
|
|
195
|
+
exports.validateScheduledTrigger = validateScheduledTrigger;
|
|
172
196
|
const validateAll = (json) => {
|
|
173
197
|
const validateFunctions = [
|
|
174
198
|
validateFactory(all_json_1.default),
|
|
175
199
|
// 校验一下需要的引用是否存在
|
|
176
200
|
validateResource,
|
|
177
201
|
exports.validateWorkspacePage,
|
|
202
|
+
exports.validateScheduledTrigger,
|
|
178
203
|
];
|
|
179
204
|
for (const validateFunction of validateFunctions) {
|
|
180
205
|
const validateRes = validateFunction(json);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@giteeteam/apps-manifest",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.7",
|
|
4
4
|
"description": "Giteeteam Apps Manifest",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"ajv": "^8.6.3",
|
|
29
29
|
"ajv-errors": "^3.0.0",
|
|
30
30
|
"ajv-keywords": "^5.0.0",
|
|
31
|
+
"cron": "^3.1.6",
|
|
31
32
|
"lodash": "^4.17.21",
|
|
32
33
|
"yaml": "^2.1.1"
|
|
33
34
|
},
|