@giteeteam/apps-manifest 0.7.6 → 0.7.8

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.
@@ -50,7 +50,29 @@
50
50
  "indexes": {
51
51
  "type": "array",
52
52
  "items": {
53
- "type": "string"
53
+ "anyOf": [
54
+ {
55
+ "type": "string"
56
+ },
57
+ {
58
+ "type": "object",
59
+ "additionalProperties": true,
60
+ "properties": {
61
+ "name": {
62
+ "type": "string"
63
+ },
64
+ "fields": {
65
+ "type": "array",
66
+ "items": {
67
+ "type": "string"
68
+ }
69
+ },
70
+ "unique": {
71
+ "type": "boolean"
72
+ }
73
+ }
74
+ }
75
+ ]
54
76
  }
55
77
  }
56
78
  },
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.6",
3
+ "version": "0.7.8",
4
4
  "description": "Giteeteam Apps Manifest",
5
5
  "keywords": [
6
6
  "typescript",
@@ -17,7 +17,8 @@
17
17
  "dev": "tsc -w",
18
18
  "build": "rm -rf lib && tsc",
19
19
  "prepack": "pnpm build",
20
- "prepublish": "pnpm build"
20
+ "prepublish": "pnpm build",
21
+ "prepublishOnly": "pnpm build"
21
22
  },
22
23
  "publishConfig": {
23
24
  "conventionalCommits": true,
@@ -28,6 +29,7 @@
28
29
  "ajv": "^8.6.3",
29
30
  "ajv-errors": "^3.0.0",
30
31
  "ajv-keywords": "^5.0.0",
32
+ "cron": "^3.1.6",
31
33
  "lodash": "^4.17.21",
32
34
  "yaml": "^2.1.1"
33
35
  },