@giteeteam/apps-manifest 0.7.3 → 0.7.5

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;
@@ -24,5 +24,8 @@
24
24
  "type",
25
25
  "endpoint"
26
26
  ]
27
+ },
28
+ "errorMessage": {
29
+ "uniqueItemProperties": "key must be unique"
27
30
  }
28
31
  }
@@ -0,0 +1,19 @@
1
+ {
2
+ "type": "object",
3
+ "$id": "http://proxima.com/schemas/modules/custom-field/proxima-field.json",
4
+ "additionalProperties": true,
5
+ "properties": {
6
+ "key": {
7
+ "type": "string"
8
+ },
9
+ "name": {
10
+ "type": "string"
11
+ },
12
+ "fieldType": {
13
+ "type": "string"
14
+ }
15
+ },
16
+ "required": [
17
+ "key", "name", "fieldType"
18
+ ]
19
+ }
@@ -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
+ }
@@ -9,12 +9,12 @@
9
9
  "key"
10
10
  ],
11
11
  "minItems": 1,
12
- "additionalItems": true,
13
- "items": [
14
- {
15
- "$ref": "frontend/base.json"
16
- }
17
- ]
12
+ "items": {
13
+ "$ref": "frontend/base.json"
14
+ },
15
+ "errorMessage": {
16
+ "uniqueItemProperties": "key must be unique"
17
+ }
18
18
  },
19
19
  "^(workspacePage)$": {
20
20
  "type": "array",
@@ -23,12 +23,12 @@
23
23
  "key"
24
24
  ],
25
25
  "minItems": 1,
26
- "additionalItems": true,
27
- "items": [
28
- {
29
- "$ref": "frontend/workspacePage.json"
30
- }
31
- ]
26
+ "items": {
27
+ "$ref": "frontend/workspacePage.json"
28
+ },
29
+ "errorMessage": {
30
+ "uniqueItemProperties": "key must be unique"
31
+ }
32
32
  },
33
33
  "^(webtrigger)$": {
34
34
  "type": "array",
@@ -37,12 +37,12 @@
37
37
  "key"
38
38
  ],
39
39
  "minItems": 1,
40
- "additionalItems": true,
41
- "items": [
42
- {
43
- "$ref": "trigger/webtrigger.json"
44
- }
45
- ]
40
+ "items": {
41
+ "$ref": "trigger/webtrigger.json"
42
+ },
43
+ "errorMessage": {
44
+ "uniqueItemProperties": "key must be unique"
45
+ }
46
46
  },
47
47
  "^(trigger)$": {
48
48
  "type": "array",
@@ -51,12 +51,12 @@
51
51
  "key"
52
52
  ],
53
53
  "minItems": 1,
54
- "additionalItems": true,
55
- "items": [
56
- {
57
- "$ref": "trigger/base.json"
58
- }
59
- ]
54
+ "items": {
55
+ "$ref": "trigger/base.json"
56
+ },
57
+ "errorMessage": {
58
+ "uniqueItemProperties": "key must be unique"
59
+ }
60
60
  },
61
61
  "^(function)$": {
62
62
  "type": "array",
@@ -65,40 +65,72 @@
65
65
  "key"
66
66
  ],
67
67
  "minItems": 1,
68
- "additionalItems": true,
69
- "items": [
70
- {
71
- "$ref": "function/base.json"
72
- }
73
- ]
68
+ "items": {
69
+ "$ref": "function/base.json"
70
+ },
71
+ "errorMessage": {
72
+ "uniqueItemProperties": "key must be unique"
73
+ }
74
74
  },
75
- "^(customFieldType)$": {
75
+ "^(customFieldType|proxima:FieldType)$": {
76
76
  "type": "array",
77
77
  "uniqueItems": true,
78
78
  "uniqueItemProperties": [
79
- "key"
79
+ "key",
80
+ "name"
80
81
  ],
81
82
  "minItems": 1,
82
- "additionalItems": true,
83
- "items": [
84
- {
85
- "$ref": "custom-field/type.json"
86
- }
87
- ]
83
+ "items": {
84
+ "$ref": "custom-field/type.json"
85
+ },
86
+ "errorMessage": {
87
+ "uniqueItemProperties": "key and name must be unique"
88
+ }
88
89
  },
89
90
  "^(customField)$": {
90
91
  "type": "array",
91
92
  "uniqueItems": true,
92
93
  "uniqueItemProperties": [
93
- "key"
94
+ "key",
95
+ "name"
96
+ ],
97
+ "minItems": 1,
98
+ "items": {
99
+ "$ref": "custom-field/field.json"
100
+ },
101
+ "errorMessage": {
102
+ "uniqueItemProperties": "key and name must be unique"
103
+ }
104
+ },
105
+ "^(proxima:CustomField)$": {
106
+ "type": "array",
107
+ "uniqueItems": true,
108
+ "uniqueItemProperties": [
109
+ "key",
110
+ "name"
111
+ ],
112
+ "minItems": 1,
113
+ "items": {
114
+ "$ref": "custom-field/proxima-field.json"
115
+ },
116
+ "errorMessage": {
117
+ "uniqueItemProperties": "key and name must be unique"
118
+ }
119
+ },
120
+ "^(customItemType|proxima:ItemType)$": {
121
+ "type": "array",
122
+ "uniqueItems": true,
123
+ "uniqueItemProperties": [
124
+ "key",
125
+ "name"
94
126
  ],
95
127
  "minItems": 1,
96
- "additionalItems": true,
97
- "items": [
98
- {
99
- "$ref": "custom-field/field.json"
100
- }
101
- ]
128
+ "items": {
129
+ "$ref": "custom-item-type/base.json"
130
+ },
131
+ "errorMessage": {
132
+ "uniqueItemProperties": "key and name must be unique"
133
+ }
102
134
  }
103
135
  },
104
136
  "additionalProperties": true,
@@ -20,5 +20,8 @@
20
20
  "key",
21
21
  "path"
22
22
  ]
23
+ },
24
+ "errorMessage": {
25
+ "uniqueItemProperties": "key must be unique"
23
26
  }
24
27
  }
@@ -58,6 +58,9 @@
58
58
  "name",
59
59
  "attributes"
60
60
  ]
61
+ },
62
+ "errorMessage": {
63
+ "uniqueItemProperties": "name must be unique"
61
64
  }
62
65
  }
63
66
  },
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,8 @@ 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 proxima_field_json_1 = __importDefault(require("./schema/modules/custom-field/proxima-field.json"));
22
+ const base_json_4 = __importDefault(require("./schema/modules/custom-item-type/base.json"));
20
23
  const resources_json_1 = __importDefault(require("./schema/resources.json"));
21
24
  const tables_json_1 = __importDefault(require("./schema/tables.json"));
22
25
  const locales_json_1 = __importDefault(require("./schema/locales.json"));
@@ -84,6 +87,7 @@ const validateFactory = (schema) => {
84
87
  // https://github.com/ajv-validator/ajv/issues/1417
85
88
  strictTuples: false,
86
89
  allowMatchingProperties: false,
90
+ allErrors: true,
87
91
  schemas: [
88
92
  all_json_1.default,
89
93
  app_json_1.default,
@@ -95,6 +99,8 @@ const validateFactory = (schema) => {
95
99
  base_json_3.default,
96
100
  field_json_1.default,
97
101
  type_json_1.default,
102
+ base_json_4.default,
103
+ proxima_field_json_1.default,
98
104
  resources_json_1.default,
99
105
  tables_json_1.default,
100
106
  locales_json_1.default,
@@ -104,8 +110,9 @@ const validateFactory = (schema) => {
104
110
  ],
105
111
  });
106
112
  (0, ajv_keywords_1.default)(ajv);
113
+ (0, ajv_errors_1.default)(ajv);
107
114
  return (json) => {
108
- const validate = ajv.getSchema(schema);
115
+ const validate = ajv.compile(schema);
109
116
  const pass = validate === null || validate === void 0 ? void 0 : validate(json);
110
117
  const errors = validate === null || validate === void 0 ? void 0 : validate.errors;
111
118
  return {
@@ -164,7 +171,7 @@ const validateWorkspacePage = (json) => {
164
171
  exports.validateWorkspacePage = validateWorkspacePage;
165
172
  const validateAll = (json) => {
166
173
  const validateFunctions = [
167
- validateFactory('http://proxima.com/schemas/all.json'),
174
+ validateFactory(all_json_1.default),
168
175
  // 校验一下需要的引用是否存在
169
176
  validateResource,
170
177
  exports.validateWorkspacePage,
@@ -181,11 +188,11 @@ const validateAll = (json) => {
181
188
  };
182
189
  };
183
190
  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');
191
+ exports.validateApp = validateFactory(app_json_1.default);
192
+ exports.validateModules = validateFactory(index_json_1.default);
193
+ exports.validateResources = validateFactory(resources_json_1.default);
194
+ exports.validateTables = validateFactory(tables_json_1.default);
195
+ exports.validateLocales = validateFactory(locales_json_1.default);
196
+ exports.validateDependVersion = validateFactory(dependVersion_json_1.default);
197
+ exports.validateStorage = validateFactory(storage_json_1.default);
198
+ 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.3",
3
+ "version": "0.7.5",
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
  }