@giteeteam/apps-manifest 0.7.2 → 0.7.4

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/manifest.d.ts CHANGED
@@ -55,7 +55,7 @@ export declare class Manifest {
55
55
  pass: boolean;
56
56
  errors: any[];
57
57
  } | {
58
- pass: boolean | Promise<unknown> | undefined;
58
+ pass: boolean;
59
59
  errors: {
60
60
  path: string;
61
61
  message: string | undefined;
@@ -0,0 +1,16 @@
1
+ {
2
+ "type": "object",
3
+ "$id": "http://proxima.com/schemas/modules/custom-item-type/base.json",
4
+ "additionalProperties": true,
5
+ "properties": {
6
+ "key": {
7
+ "type": "string"
8
+ },
9
+ "name": {
10
+ "type": "string"
11
+ }
12
+ },
13
+ "required": [
14
+ "key", "name"
15
+ ]
16
+ }
@@ -14,7 +14,10 @@
14
14
  {
15
15
  "$ref": "frontend/base.json"
16
16
  }
17
- ]
17
+ ],
18
+ "errorMessage": {
19
+ "uniqueItemProperties": "key must be unique"
20
+ }
18
21
  },
19
22
  "^(workspacePage)$": {
20
23
  "type": "array",
@@ -28,7 +31,10 @@
28
31
  {
29
32
  "$ref": "frontend/workspacePage.json"
30
33
  }
31
- ]
34
+ ],
35
+ "errorMessage": {
36
+ "uniqueItemProperties": "key must be unique"
37
+ }
32
38
  },
33
39
  "^(webtrigger)$": {
34
40
  "type": "array",
@@ -42,7 +48,10 @@
42
48
  {
43
49
  "$ref": "trigger/webtrigger.json"
44
50
  }
45
- ]
51
+ ],
52
+ "errorMessage": {
53
+ "uniqueItemProperties": "key must be unique"
54
+ }
46
55
  },
47
56
  "^(trigger)$": {
48
57
  "type": "array",
@@ -56,7 +65,10 @@
56
65
  {
57
66
  "$ref": "trigger/base.json"
58
67
  }
59
- ]
68
+ ],
69
+ "errorMessage": {
70
+ "uniqueItemProperties": "key must be unique"
71
+ }
60
72
  },
61
73
  "^(function)$": {
62
74
  "type": "array",
@@ -72,11 +84,12 @@
72
84
  }
73
85
  ]
74
86
  },
75
- "^(customFieldType)$": {
87
+ "^(customFieldType|proxima:FieldType)$": {
76
88
  "type": "array",
77
89
  "uniqueItems": true,
78
90
  "uniqueItemProperties": [
79
- "key"
91
+ "key",
92
+ "name"
80
93
  ],
81
94
  "minItems": 1,
82
95
  "additionalItems": true,
@@ -84,13 +97,17 @@
84
97
  {
85
98
  "$ref": "custom-field/type.json"
86
99
  }
87
- ]
100
+ ],
101
+ "errorMessage": {
102
+ "uniqueItemProperties": "key and name must be unique"
103
+ }
88
104
  },
89
- "^(customField)$": {
105
+ "^(customField|proxima:CustomField)$": {
90
106
  "type": "array",
91
107
  "uniqueItems": true,
92
108
  "uniqueItemProperties": [
93
- "key"
109
+ "key",
110
+ "name"
94
111
  ],
95
112
  "minItems": 1,
96
113
  "additionalItems": true,
@@ -98,7 +115,28 @@
98
115
  {
99
116
  "$ref": "custom-field/field.json"
100
117
  }
101
- ]
118
+ ],
119
+ "errorMessage": {
120
+ "uniqueItemProperties": "key and name must be unique"
121
+ }
122
+ },
123
+ "^(customItemType|proxima:ItemType)$": {
124
+ "type": "array",
125
+ "uniqueItems": true,
126
+ "uniqueItemProperties": [
127
+ "key",
128
+ "name"
129
+ ],
130
+ "minItems": 1,
131
+ "additionalItems": true,
132
+ "items": [
133
+ {
134
+ "$ref": "custom-item-type/base.json"
135
+ }
136
+ ],
137
+ "errorMessage": {
138
+ "uniqueItemProperties": "key and name must be unique"
139
+ }
102
140
  }
103
141
  },
104
142
  "additionalProperties": true,
package/lib/validate.d.ts CHANGED
@@ -7,63 +7,63 @@ export declare const validateAll: (json: IManifest) => {
7
7
  pass: boolean;
8
8
  errors: any[];
9
9
  } | {
10
- pass: boolean | Promise<unknown> | undefined;
10
+ pass: boolean;
11
11
  errors: {
12
12
  path: string;
13
13
  message: string | undefined;
14
14
  }[] | null;
15
15
  };
16
16
  export declare const validateApp: (json: IManifest) => {
17
- pass: boolean | Promise<unknown> | undefined;
17
+ pass: boolean;
18
18
  errors: {
19
19
  path: string;
20
20
  message: string | undefined;
21
21
  }[] | null;
22
22
  };
23
23
  export declare const validateModules: (json: IManifest) => {
24
- pass: boolean | Promise<unknown> | undefined;
24
+ pass: boolean;
25
25
  errors: {
26
26
  path: string;
27
27
  message: string | undefined;
28
28
  }[] | null;
29
29
  };
30
30
  export declare const validateResources: (json: IManifest) => {
31
- pass: boolean | Promise<unknown> | undefined;
31
+ pass: boolean;
32
32
  errors: {
33
33
  path: string;
34
34
  message: string | undefined;
35
35
  }[] | null;
36
36
  };
37
37
  export declare const validateTables: (json: IManifest) => {
38
- pass: boolean | Promise<unknown> | undefined;
38
+ pass: boolean;
39
39
  errors: {
40
40
  path: string;
41
41
  message: string | undefined;
42
42
  }[] | null;
43
43
  };
44
44
  export declare const validateLocales: (json: IManifest) => {
45
- pass: boolean | Promise<unknown> | undefined;
45
+ pass: boolean;
46
46
  errors: {
47
47
  path: string;
48
48
  message: string | undefined;
49
49
  }[] | null;
50
50
  };
51
51
  export declare const validateDependVersion: (json: IManifest) => {
52
- pass: boolean | Promise<unknown> | undefined;
52
+ pass: boolean;
53
53
  errors: {
54
54
  path: string;
55
55
  message: string | undefined;
56
56
  }[] | null;
57
57
  };
58
58
  export declare const validateStorage: (json: IManifest) => {
59
- pass: boolean | Promise<unknown> | undefined;
59
+ pass: boolean;
60
60
  errors: {
61
61
  path: string;
62
62
  message: string | undefined;
63
63
  }[] | null;
64
64
  };
65
65
  export declare const validateMessageQueues: (json: IManifest) => {
66
- pass: boolean | Promise<unknown> | undefined;
66
+ pass: boolean;
67
67
  errors: {
68
68
  path: string;
69
69
  message: string | undefined;
package/lib/validate.js CHANGED
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
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
+ const ajv_errors_1 = __importDefault(require("ajv-errors"));
9
10
  const lodash_1 = require("lodash");
10
11
  const all_json_1 = __importDefault(require("./schema/all.json"));
11
12
  const app_json_1 = __importDefault(require("./schema/app.json"));
@@ -17,6 +18,7 @@ const webtrigger_json_1 = __importDefault(require("./schema/modules/trigger/webt
17
18
  const base_json_3 = __importDefault(require("./schema/modules/function/base.json"));
18
19
  const field_json_1 = __importDefault(require("./schema/modules/custom-field/field.json"));
19
20
  const type_json_1 = __importDefault(require("./schema/modules/custom-field/type.json"));
21
+ const base_json_4 = __importDefault(require("./schema/modules/custom-item-type/base.json"));
20
22
  const resources_json_1 = __importDefault(require("./schema/resources.json"));
21
23
  const tables_json_1 = __importDefault(require("./schema/tables.json"));
22
24
  const locales_json_1 = __importDefault(require("./schema/locales.json"));
@@ -84,6 +86,7 @@ const validateFactory = (schema) => {
84
86
  // https://github.com/ajv-validator/ajv/issues/1417
85
87
  strictTuples: false,
86
88
  allowMatchingProperties: false,
89
+ allErrors: true,
87
90
  schemas: [
88
91
  all_json_1.default,
89
92
  app_json_1.default,
@@ -95,6 +98,7 @@ const validateFactory = (schema) => {
95
98
  base_json_3.default,
96
99
  field_json_1.default,
97
100
  type_json_1.default,
101
+ base_json_4.default,
98
102
  resources_json_1.default,
99
103
  tables_json_1.default,
100
104
  locales_json_1.default,
@@ -104,8 +108,9 @@ const validateFactory = (schema) => {
104
108
  ],
105
109
  });
106
110
  (0, ajv_keywords_1.default)(ajv);
111
+ (0, ajv_errors_1.default)(ajv);
107
112
  return (json) => {
108
- const validate = ajv.getSchema(schema);
113
+ const validate = ajv.compile(schema);
109
114
  const pass = validate === null || validate === void 0 ? void 0 : validate(json);
110
115
  const errors = validate === null || validate === void 0 ? void 0 : validate.errors;
111
116
  return {
@@ -129,7 +134,7 @@ const validateWorkspacePage = (json) => {
129
134
  if (module.type && !['group', 'board'].includes(module.type)) {
130
135
  errors.push({
131
136
  path: `/modules/workspacePage/${module.key}`,
132
- message: `Group type must be 'group' or 'board'! `,
137
+ message: `Type must be 'group' or 'board'! `,
133
138
  });
134
139
  }
135
140
  if (module.type === 'group') {
@@ -164,7 +169,7 @@ const validateWorkspacePage = (json) => {
164
169
  exports.validateWorkspacePage = validateWorkspacePage;
165
170
  const validateAll = (json) => {
166
171
  const validateFunctions = [
167
- validateFactory('http://proxima.com/schemas/all.json'),
172
+ validateFactory(all_json_1.default),
168
173
  // 校验一下需要的引用是否存在
169
174
  validateResource,
170
175
  exports.validateWorkspacePage,
@@ -181,11 +186,11 @@ const validateAll = (json) => {
181
186
  };
182
187
  };
183
188
  exports.validateAll = validateAll;
184
- exports.validateApp = validateFactory('http://proxima.com/schemas/app.json');
185
- exports.validateModules = validateFactory('http://proxima.com/schemas/modules/index.json');
186
- exports.validateResources = validateFactory('http://proxima.com/schemas/resources.json');
187
- exports.validateTables = validateFactory('http://proxima.com/schemas/tables.json');
188
- exports.validateLocales = validateFactory('http://proxima.com/schemas/locales.json');
189
- exports.validateDependVersion = validateFactory('http://proxima.com/schemas/dependVersion.json');
190
- exports.validateStorage = validateFactory('http://proxima.com/schemas/storage.json');
191
- exports.validateMessageQueues = validateFactory('http://proxima.com/schemas/messageQueues.json');
189
+ exports.validateApp = validateFactory(app_json_1.default);
190
+ exports.validateModules = validateFactory(index_json_1.default);
191
+ exports.validateResources = validateFactory(resources_json_1.default);
192
+ exports.validateTables = validateFactory(tables_json_1.default);
193
+ exports.validateLocales = validateFactory(locales_json_1.default);
194
+ exports.validateDependVersion = validateFactory(dependVersion_json_1.default);
195
+ exports.validateStorage = validateFactory(storage_json_1.default);
196
+ exports.validateMessageQueues = validateFactory(messageQueues_json_1.default);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-manifest",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "description": "Giteeteam Apps Manifest",
5
5
  "keywords": [
6
6
  "typescript",
@@ -12,14 +12,6 @@
12
12
  "files": [
13
13
  "lib"
14
14
  ],
15
- "bugs": {
16
- "url": "https://github.com/moriahq/proxima/issues"
17
- },
18
- "homepage": "https://github.com/moriahq/proxima/tree/develop/giteeteam/packages/giteeteam/packages/apps-manifest",
19
- "repository": {
20
- "type": "git",
21
- "url": "git+https://github.com/moriahq/proxima.git"
22
- },
23
15
  "scripts": {
24
16
  "test": "jest --coverage",
25
17
  "dev": "tsc -w",
@@ -34,13 +26,14 @@
34
26
  },
35
27
  "dependencies": {
36
28
  "ajv": "^8.6.3",
29
+ "ajv-errors": "^3.0.0",
37
30
  "ajv-keywords": "^5.0.0",
38
31
  "lodash": "^4.17.21",
39
32
  "yaml": "^2.1.1"
40
33
  },
41
34
  "devDependencies": {
42
- "typescript": "^4.8.3",
43
- "@types/lodash": "^4.14.195",
44
- "jest": "^29.3.1"
35
+ "@types/lodash": "^4.14.195",
36
+ "jest": "^29.3.1",
37
+ "typescript": "^4.8.3"
45
38
  }
46
39
  }