@giteeteam/apps-manifest 0.7.8 → 0.8.1

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.js CHANGED
@@ -82,7 +82,7 @@ class Manifest {
82
82
  * @returns
83
83
  */
84
84
  getFunctionKeyByKey(key) {
85
- var _a, _b, _c;
85
+ var _a, _b, _c, _d;
86
86
  const { modules } = this.manifest;
87
87
  for (const k in modules) {
88
88
  if (k === 'function') {
@@ -90,12 +90,12 @@ class Manifest {
90
90
  }
91
91
  else if (k === 'importer') {
92
92
  // importer扩展点需要判断function和validate
93
- if (key === ((_a = modules[k]) === null || _a === void 0 ? void 0 : _a.function) || key === ((_b = modules[k]) === null || _b === void 0 ? void 0 : _b.validate)) {
93
+ if (key === ((_a = modules[k]) === null || _a === void 0 ? void 0 : _a.function) || key === ((_b = modules[k]) === null || _b === void 0 ? void 0 : _b.validate) || key === ((_c = modules[k]) === null || _c === void 0 ? void 0 : _c.after)) {
94
94
  return key;
95
95
  }
96
96
  }
97
97
  else if (Array.isArray(modules[k])) {
98
- const targetModule = (_c = modules[k]) === null || _c === void 0 ? void 0 : _c.find(v => v.key === key);
98
+ const targetModule = (_d = modules[k]) === null || _d === void 0 ? void 0 : _d.find(v => v.key === key);
99
99
  if (targetModule) {
100
100
  return targetModule.function;
101
101
  }
@@ -131,6 +131,48 @@
131
131
  "errorMessage": {
132
132
  "uniqueItemProperties": "key and name must be unique"
133
133
  }
134
+ },
135
+ "proxima:workflowCondition": {
136
+ "type": "array",
137
+ "uniqueItems": true,
138
+ "uniqueItemProperties": [
139
+ "key"
140
+ ],
141
+ "minItems": 1,
142
+ "items": {
143
+ "$ref": "proxima-workflow/condition.json"
144
+ },
145
+ "errorMessage": {
146
+ "uniqueItemProperties": "key must be unique"
147
+ }
148
+ },
149
+ "proxima:workflowValidator": {
150
+ "type": "array",
151
+ "uniqueItems": true,
152
+ "uniqueItemProperties": [
153
+ "key"
154
+ ],
155
+ "minItems": 1,
156
+ "items": {
157
+ "$ref": "proxima-workflow/validator.json"
158
+ },
159
+ "errorMessage": {
160
+ "uniqueItemProperties": "key must be unique"
161
+ }
162
+ },
163
+ "proxima:workflowPostFunction": {
164
+ "type": "array",
165
+ "uniqueItems": true,
166
+ "uniqueItemProperties": [
167
+ "key"
168
+ ],
169
+ "minItems": 1,
170
+ "items": {
171
+ "$ref": "proxima-workflow/post-function.json"
172
+ },
173
+ "errorMessage": {
174
+ "uniqueItemProperties": "key must be unique"
175
+ }
134
176
  }
135
177
  },
136
178
  "additionalProperties": true,
@@ -0,0 +1,39 @@
1
+ {
2
+ "type": "object",
3
+ "$id": "http://proxima.com/schemas/modules/proxima-workflow/condition.json",
4
+ "properties": {
5
+ "key": {
6
+ "type": "string"
7
+ },
8
+ "title": {
9
+ "type": "string"
10
+ },
11
+ "description": {
12
+ "type": "string"
13
+ },
14
+ "expression": {
15
+ "type": "string"
16
+ },
17
+ "errorMessage": {
18
+ "type": "string"
19
+ },
20
+ "resource": {
21
+ "type": "string"
22
+ },
23
+ "loadType": {
24
+ "type": "string"
25
+ },
26
+ "create": {
27
+ "$ref": "resource.json"
28
+ },
29
+ "edit": {
30
+ "$ref": "resource.json"
31
+ },
32
+ "view": {
33
+ "$ref": "resource.json"
34
+ }
35
+ },
36
+ "required": [
37
+ "key"
38
+ ]
39
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "type": "object",
3
+ "$id": "http://proxima.com/schemas/modules/proxima-workflow/post-function.json",
4
+ "properties": {
5
+ "key": {
6
+ "type": "string"
7
+ },
8
+ "title": {
9
+ "type": "string"
10
+ },
11
+ "description": {
12
+ "type": "string"
13
+ },
14
+ "function": {
15
+ "type": "string"
16
+ },
17
+ "resource": {
18
+ "type": "string"
19
+ },
20
+ "loadType": {
21
+ "type": "string"
22
+ },
23
+ "create": {
24
+ "$ref": "resource.json"
25
+ },
26
+ "edit": {
27
+ "$ref": "resource.json"
28
+ },
29
+ "view": {
30
+ "$ref": "resource.json"
31
+ }
32
+ },
33
+ "required": [
34
+ "key", "function"
35
+ ]
36
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "type": "object",
3
+ "$id": "http://proxima.com/schemas/modules/proxima-workflow/resource.json",
4
+ "properties": {
5
+ "route": {
6
+ "type": "string"
7
+ },
8
+ "title": {
9
+ "type": "string"
10
+ }
11
+ },
12
+ "required": [
13
+ "route"
14
+ ]
15
+ }
@@ -0,0 +1,56 @@
1
+ {
2
+ "type": "object",
3
+ "$id": "http://proxima.com/schemas/modules/proxima-workflow/validator.json",
4
+ "properties": {
5
+ "key": {
6
+ "type": "string"
7
+ },
8
+ "title": {
9
+ "type": "string"
10
+ },
11
+ "description": {
12
+ "type": "string"
13
+ },
14
+ "expression": {
15
+ "type": "string"
16
+ },
17
+ "errorMessage": {
18
+ "type": "string"
19
+ },
20
+ "function": {
21
+ "type": "string"
22
+ },
23
+ "resource": {
24
+ "type": "string"
25
+ },
26
+ "loadType": {
27
+ "type": "string"
28
+ },
29
+ "create": {
30
+ "$ref": "resource.json"
31
+ },
32
+ "edit": {
33
+ "$ref": "resource.json"
34
+ },
35
+ "view": {
36
+ "$ref": "resource.json"
37
+ }
38
+ },
39
+ "required": [
40
+ "key"
41
+ ],
42
+ "oneOf": [
43
+ {
44
+ "required": ["expression"],
45
+ "not": {
46
+ "required": ["function"]
47
+ }
48
+ },
49
+ {
50
+ "required": ["function"],
51
+ "not": {
52
+ "required": ["expression"]
53
+ }
54
+ }
55
+ ]
56
+ }
package/lib/types.d.ts CHANGED
@@ -41,6 +41,7 @@ export interface IManifestImporterItemField {
41
41
  export interface IManifestImporter {
42
42
  function: string;
43
43
  validate: string;
44
+ after?: string;
44
45
  itemFields: IManifestImporterItemField[];
45
46
  }
46
47
  export interface IManifestTrigger {
package/lib/validate.js CHANGED
@@ -27,6 +27,10 @@ const locales_json_1 = __importDefault(require("./schema/locales.json"));
27
27
  const dependVersion_json_1 = __importDefault(require("./schema/dependVersion.json"));
28
28
  const storage_json_1 = __importDefault(require("./schema/storage.json"));
29
29
  const messageQueues_json_1 = __importDefault(require("./schema/messageQueues.json"));
30
+ const condition_json_1 = __importDefault(require("./schema/modules/proxima-workflow/condition.json"));
31
+ const validator_json_1 = __importDefault(require("./schema/modules/proxima-workflow/validator.json"));
32
+ const post_function_json_1 = __importDefault(require("./schema/modules/proxima-workflow/post-function.json"));
33
+ const resource_json_1 = __importDefault(require("./schema/modules/proxima-workflow/resource.json"));
30
34
  const validateResource = (json) => {
31
35
  const errors = [];
32
36
  const frontendModules = ['adminPage', 'itemPanel', 'itemActivity', 'appPage'];
@@ -108,6 +112,10 @@ const validateFactory = (schema) => {
108
112
  dependVersion_json_1.default,
109
113
  storage_json_1.default,
110
114
  messageQueues_json_1.default,
115
+ condition_json_1.default,
116
+ validator_json_1.default,
117
+ post_function_json_1.default,
118
+ resource_json_1.default,
111
119
  ],
112
120
  });
113
121
  (0, ajv_keywords_1.default)(ajv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-manifest",
3
- "version": "0.7.8",
3
+ "version": "0.8.1",
4
4
  "description": "Giteeteam Apps Manifest",
5
5
  "keywords": [
6
6
  "typescript",
@@ -13,12 +13,13 @@
13
13
  "lib"
14
14
  ],
15
15
  "scripts": {
16
- "test": "jest --coverage",
16
+ "test": "pnpm build && vitest run --coverage",
17
17
  "dev": "tsc -w",
18
18
  "build": "rm -rf lib && tsc",
19
19
  "prepack": "pnpm build",
20
20
  "prepublish": "pnpm build",
21
- "prepublishOnly": "pnpm build"
21
+ "prepublishOnly": "pnpm build",
22
+ "publish:alpha": "npm publish --tag alpha"
22
23
  },
23
24
  "publishConfig": {
24
25
  "conventionalCommits": true,
@@ -35,7 +36,9 @@
35
36
  },
36
37
  "devDependencies": {
37
38
  "@types/lodash": "^4.14.195",
38
- "jest": "^29.3.1",
39
- "typescript": "^4.8.3"
39
+ "@vitest/coverage-v8": "^2.1.3",
40
+ "prettier": "^3.3.3",
41
+ "typescript": "^4.8.3",
42
+ "vitest": "^2.1.3"
40
43
  }
41
44
  }