@giteeteam/apps-manifest 0.7.1 → 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
@@ -1,4 +1,8 @@
1
1
  import type { IManifest } from './types';
2
+ export declare const validateWorkspacePage: (json: IManifest) => {
3
+ pass: boolean;
4
+ errors: any[];
5
+ };
2
6
  export declare const validateAll: (json: IManifest) => {
3
7
  pass: boolean;
4
8
  errors: any[];
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,11 +120,18 @@ const validateFactory = (schema) => {
118
120
  };
119
121
  };
120
122
  const validateWorkspacePage = (json) => {
121
- const modules = json.modules['workspacePage'] || json.modules['proxima:workspacePage'];
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) {
129
+ if (module.type && !['group', 'board'].includes(module.type)) {
130
+ errors.push({
131
+ path: `/modules/workspacePage/${module.key}`,
132
+ message: `Group type must be 'group' or 'board'! `,
133
+ });
134
+ }
126
135
  if (module.type === 'group') {
127
136
  if (module.title && (module.title.length < 2 || module.title.length > 10)) {
128
137
  errors.push({
@@ -152,12 +161,13 @@ const validateWorkspacePage = (json) => {
152
161
  errors,
153
162
  };
154
163
  };
164
+ exports.validateWorkspacePage = validateWorkspacePage;
155
165
  const validateAll = (json) => {
156
166
  const validateFunctions = [
157
167
  validateFactory('http://proxima.com/schemas/all.json'),
158
168
  // 校验一下需要的引用是否存在
159
169
  validateResource,
160
- validateWorkspacePage,
170
+ exports.validateWorkspacePage,
161
171
  ];
162
172
  for (const validateFunction of validateFunctions) {
163
173
  const validateRes = validateFunction(json);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-manifest",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "Giteeteam Apps Manifest",
5
5
  "keywords": [
6
6
  "typescript",