@giteeteam/apps-manifest 0.8.0 → 0.8.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.
package/lib/validate.d.ts CHANGED
@@ -1,75 +1,75 @@
1
- import type { IManifest } from './types';
2
- export declare const validateWorkspacePage: (json: IManifest) => {
3
- pass: boolean;
4
- errors: any[];
5
- };
6
- export declare const validateScheduledTrigger: (json: IManifest) => {
7
- pass: boolean;
8
- errors: any[];
9
- };
10
- export declare const validateAll: (json: IManifest) => {
11
- pass: boolean;
12
- errors: any[];
13
- } | {
14
- pass: boolean;
15
- errors: {
16
- path: string;
17
- message: string | undefined;
18
- }[] | null;
19
- };
20
- export declare const validateApp: (json: IManifest) => {
21
- pass: boolean;
22
- errors: {
23
- path: string;
24
- message: string | undefined;
25
- }[] | null;
26
- };
27
- export declare const validateModules: (json: IManifest) => {
28
- pass: boolean;
29
- errors: {
30
- path: string;
31
- message: string | undefined;
32
- }[] | null;
33
- };
34
- export declare const validateResources: (json: IManifest) => {
35
- pass: boolean;
36
- errors: {
37
- path: string;
38
- message: string | undefined;
39
- }[] | null;
40
- };
41
- export declare const validateTables: (json: IManifest) => {
42
- pass: boolean;
43
- errors: {
44
- path: string;
45
- message: string | undefined;
46
- }[] | null;
47
- };
48
- export declare const validateLocales: (json: IManifest) => {
49
- pass: boolean;
50
- errors: {
51
- path: string;
52
- message: string | undefined;
53
- }[] | null;
54
- };
55
- export declare const validateDependVersion: (json: IManifest) => {
56
- pass: boolean;
57
- errors: {
58
- path: string;
59
- message: string | undefined;
60
- }[] | null;
61
- };
62
- export declare const validateStorage: (json: IManifest) => {
63
- pass: boolean;
64
- errors: {
65
- path: string;
66
- message: string | undefined;
67
- }[] | null;
68
- };
69
- export declare const validateMessageQueues: (json: IManifest) => {
70
- pass: boolean;
71
- errors: {
72
- path: string;
73
- message: string | undefined;
74
- }[] | null;
75
- };
1
+ import type { IManifest } from './types';
2
+ export declare const validateWorkspacePage: (json: IManifest) => {
3
+ pass: boolean;
4
+ errors: any[];
5
+ };
6
+ export declare const validateScheduledTrigger: (json: IManifest) => {
7
+ pass: boolean;
8
+ errors: any[];
9
+ };
10
+ export declare const validateAll: (json: IManifest) => {
11
+ pass: boolean;
12
+ errors: any[];
13
+ } | {
14
+ pass: boolean;
15
+ errors: {
16
+ path: string;
17
+ message: string | undefined;
18
+ }[] | null;
19
+ };
20
+ export declare const validateApp: (json: IManifest) => {
21
+ pass: boolean;
22
+ errors: {
23
+ path: string;
24
+ message: string | undefined;
25
+ }[] | null;
26
+ };
27
+ export declare const validateModules: (json: IManifest) => {
28
+ pass: boolean;
29
+ errors: {
30
+ path: string;
31
+ message: string | undefined;
32
+ }[] | null;
33
+ };
34
+ export declare const validateResources: (json: IManifest) => {
35
+ pass: boolean;
36
+ errors: {
37
+ path: string;
38
+ message: string | undefined;
39
+ }[] | null;
40
+ };
41
+ export declare const validateTables: (json: IManifest) => {
42
+ pass: boolean;
43
+ errors: {
44
+ path: string;
45
+ message: string | undefined;
46
+ }[] | null;
47
+ };
48
+ export declare const validateLocales: (json: IManifest) => {
49
+ pass: boolean;
50
+ errors: {
51
+ path: string;
52
+ message: string | undefined;
53
+ }[] | null;
54
+ };
55
+ export declare const validateDependVersion: (json: IManifest) => {
56
+ pass: boolean;
57
+ errors: {
58
+ path: string;
59
+ message: string | undefined;
60
+ }[] | null;
61
+ };
62
+ export declare const validateStorage: (json: IManifest) => {
63
+ pass: boolean;
64
+ errors: {
65
+ path: string;
66
+ message: string | undefined;
67
+ }[] | null;
68
+ };
69
+ export declare const validateMessageQueues: (json: IManifest) => {
70
+ pass: boolean;
71
+ errors: {
72
+ path: string;
73
+ message: string | undefined;
74
+ }[] | null;
75
+ };
package/lib/validate.js CHANGED
@@ -1,231 +1,231 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
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.validateScheduledTrigger = exports.validateWorkspacePage = void 0;
7
- const ajv_1 = __importDefault(require("ajv"));
8
- const ajv_keywords_1 = __importDefault(require("ajv-keywords"));
9
- const ajv_errors_1 = __importDefault(require("ajv-errors"));
10
- const lodash_1 = require("lodash");
11
- const cron_1 = require("cron");
12
- const all_json_1 = __importDefault(require("./schema/all.json"));
13
- const app_json_1 = __importDefault(require("./schema/app.json"));
14
- const index_json_1 = __importDefault(require("./schema/modules/index.json"));
15
- const base_json_1 = __importDefault(require("./schema/modules/frontend/base.json"));
16
- const workspacePage_json_1 = __importDefault(require("./schema/modules/frontend/workspacePage.json"));
17
- const base_json_2 = __importDefault(require("./schema/modules/trigger/base.json"));
18
- const webtrigger_json_1 = __importDefault(require("./schema/modules/trigger/webtrigger.json"));
19
- const base_json_3 = __importDefault(require("./schema/modules/function/base.json"));
20
- const field_json_1 = __importDefault(require("./schema/modules/custom-field/field.json"));
21
- const type_json_1 = __importDefault(require("./schema/modules/custom-field/type.json"));
22
- const proxima_field_json_1 = __importDefault(require("./schema/modules/custom-field/proxima-field.json"));
23
- const base_json_4 = __importDefault(require("./schema/modules/custom-item-type/base.json"));
24
- const resources_json_1 = __importDefault(require("./schema/resources.json"));
25
- const tables_json_1 = __importDefault(require("./schema/tables.json"));
26
- const locales_json_1 = __importDefault(require("./schema/locales.json"));
27
- const dependVersion_json_1 = __importDefault(require("./schema/dependVersion.json"));
28
- const storage_json_1 = __importDefault(require("./schema/storage.json"));
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"));
34
- const validateResource = (json) => {
35
- const errors = [];
36
- const frontendModules = ['adminPage', 'itemPanel', 'itemActivity', 'appPage'];
37
- const modules = (0, lodash_1.get)(json, 'modules') || {};
38
- const resourcesEntries = (0, lodash_1.keyBy)((0, lodash_1.get)(json, 'resources'), 'key');
39
- const functionEntries = (0, lodash_1.keyBy)((0, lodash_1.get)(json, 'modules.function'), 'key');
40
- const customFieldTypeEntries = (0, lodash_1.keyBy)((0, lodash_1.get)(json, 'modules.customFieldType'), 'key');
41
- const moduleKeys = {};
42
- Object.keys(modules).forEach(moduleKey => {
43
- const module = (0, lodash_1.get)(modules, moduleKey);
44
- if (!module)
45
- return;
46
- const isFrontendModule = frontendModules.indexOf(moduleKey) > -1;
47
- Array.from(module).forEach(({ resource, function: functionRef, type, key }, index) => {
48
- const path = `/modules/${moduleKey}/${index}`;
49
- if (moduleKeys[key]) {
50
- errors.push({
51
- path,
52
- message: `Key '${key}' has already exits! `,
53
- });
54
- }
55
- else {
56
- moduleKeys[key] = true;
57
- }
58
- if (isFrontendModule) {
59
- if (resource && !(0, lodash_1.get)(resourcesEntries, resource)) {
60
- errors.push({
61
- path,
62
- message: `Resource '${resource}' not found! `,
63
- });
64
- }
65
- }
66
- else if (moduleKey === 'trigger' || moduleKey === 'webtrigger') {
67
- if (functionRef && !(0, lodash_1.get)(functionEntries, functionRef)) {
68
- errors.push({
69
- path,
70
- message: `Function '${functionRef}' not found! `,
71
- });
72
- }
73
- }
74
- else if (moduleKey === 'customField' && (0, lodash_1.startsWith)(type, '_self:')) {
75
- const fieldTypeRef = type === null || type === void 0 ? void 0 : type.slice(6);
76
- if (fieldTypeRef && !(0, lodash_1.get)(customFieldTypeEntries, fieldTypeRef)) {
77
- errors.push({
78
- path,
79
- message: `FieldType '${fieldTypeRef}' not found! `,
80
- });
81
- }
82
- }
83
- });
84
- });
85
- return {
86
- pass: errors.length === 0,
87
- errors,
88
- };
89
- };
90
- const validateFactory = (schema) => {
91
- const ajv = new ajv_1.default({
92
- // https://github.com/ajv-validator/ajv/issues/1417
93
- strictTuples: false,
94
- allowMatchingProperties: false,
95
- allErrors: true,
96
- schemas: [
97
- all_json_1.default,
98
- app_json_1.default,
99
- index_json_1.default,
100
- base_json_1.default,
101
- workspacePage_json_1.default,
102
- base_json_2.default,
103
- webtrigger_json_1.default,
104
- base_json_3.default,
105
- field_json_1.default,
106
- type_json_1.default,
107
- base_json_4.default,
108
- proxima_field_json_1.default,
109
- resources_json_1.default,
110
- tables_json_1.default,
111
- locales_json_1.default,
112
- dependVersion_json_1.default,
113
- storage_json_1.default,
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,
119
- ],
120
- });
121
- (0, ajv_keywords_1.default)(ajv);
122
- (0, ajv_errors_1.default)(ajv);
123
- return (json) => {
124
- const validate = ajv.compile(schema);
125
- const pass = validate === null || validate === void 0 ? void 0 : validate(json);
126
- const errors = validate === null || validate === void 0 ? void 0 : validate.errors;
127
- return {
128
- pass,
129
- errors: errors
130
- ? (0, lodash_1.map)(errors, error => ({
131
- path: error.instancePath,
132
- message: error.message,
133
- }))
134
- : null,
135
- };
136
- };
137
- };
138
- const validateWorkspacePage = (json) => {
139
- var _a;
140
- const modules = (_a = json === null || json === void 0 ? void 0 : json.modules) === null || _a === void 0 ? void 0 : _a['workspacePage'];
141
- const errors = [];
142
- if (modules === null || modules === void 0 ? void 0 : modules.length) {
143
- const groupKey = modules.filter(item => item.type === 'group').map(item => item.key);
144
- for (const module of modules) {
145
- if (module.type && !['group', 'board'].includes(module.type)) {
146
- errors.push({
147
- path: `/modules/workspacePage/${module.key}`,
148
- message: `Type must be 'group' or 'board'! `,
149
- });
150
- }
151
- if (module.type === 'group') {
152
- if (module.title && (module.title.length < 2 || module.title.length > 10)) {
153
- errors.push({
154
- path: `/modules/workspacePage/${module.key}`,
155
- message: `Group title length must be between 2 and 10! `,
156
- });
157
- }
158
- }
159
- else {
160
- if (module.parent && !groupKey.includes(module.parent)) {
161
- errors.push({
162
- path: `/modules/workspacePage/${module.key}`,
163
- message: `Parent '${module.parent}' not found! `,
164
- });
165
- }
166
- if (module.title && (module.title.length < 2 || module.title.length > 30)) {
167
- errors.push({
168
- path: `/modules/workspacePage/${module.key}`,
169
- message: `Title length must be between 2 and 30! `,
170
- });
171
- }
172
- }
173
- }
174
- }
175
- return {
176
- pass: errors.length === 0,
177
- errors,
178
- };
179
- };
180
- exports.validateWorkspacePage = validateWorkspacePage;
181
- const validateScheduledTrigger = (json) => {
182
- var _a;
183
- const modules = (_a = json === null || json === void 0 ? void 0 : json.modules) === null || _a === void 0 ? void 0 : _a['scheduledTrigger'];
184
- const errors = [];
185
- if (modules === null || modules === void 0 ? void 0 : modules.length) {
186
- for (const module of modules) {
187
- try {
188
- new cron_1.CronTime(module.cronTime);
189
- }
190
- catch (err) {
191
- errors.push({
192
- path: `/modules/scheduledTrigger/${module.key}`,
193
- message: `CronTime is invalid! `,
194
- });
195
- }
196
- }
197
- }
198
- return {
199
- pass: errors.length === 0,
200
- errors,
201
- };
202
- };
203
- exports.validateScheduledTrigger = validateScheduledTrigger;
204
- const validateAll = (json) => {
205
- const validateFunctions = [
206
- validateFactory(all_json_1.default),
207
- // 校验一下需要的引用是否存在
208
- validateResource,
209
- exports.validateWorkspacePage,
210
- exports.validateScheduledTrigger,
211
- ];
212
- for (const validateFunction of validateFunctions) {
213
- const validateRes = validateFunction(json);
214
- if (!validateRes.pass) {
215
- return validateRes;
216
- }
217
- }
218
- return {
219
- pass: true,
220
- errors: [],
221
- };
222
- };
223
- exports.validateAll = validateAll;
224
- exports.validateApp = validateFactory(app_json_1.default);
225
- exports.validateModules = validateFactory(index_json_1.default);
226
- exports.validateResources = validateFactory(resources_json_1.default);
227
- exports.validateTables = validateFactory(tables_json_1.default);
228
- exports.validateLocales = validateFactory(locales_json_1.default);
229
- exports.validateDependVersion = validateFactory(dependVersion_json_1.default);
230
- exports.validateStorage = validateFactory(storage_json_1.default);
231
- exports.validateMessageQueues = validateFactory(messageQueues_json_1.default);
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
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.validateScheduledTrigger = exports.validateWorkspacePage = void 0;
7
+ const ajv_1 = __importDefault(require("ajv"));
8
+ const ajv_keywords_1 = __importDefault(require("ajv-keywords"));
9
+ const ajv_errors_1 = __importDefault(require("ajv-errors"));
10
+ const lodash_1 = require("lodash");
11
+ const cron_1 = require("cron");
12
+ const all_json_1 = __importDefault(require("./schema/all.json"));
13
+ const app_json_1 = __importDefault(require("./schema/app.json"));
14
+ const index_json_1 = __importDefault(require("./schema/modules/index.json"));
15
+ const base_json_1 = __importDefault(require("./schema/modules/frontend/base.json"));
16
+ const workspacePage_json_1 = __importDefault(require("./schema/modules/frontend/workspacePage.json"));
17
+ const base_json_2 = __importDefault(require("./schema/modules/trigger/base.json"));
18
+ const webtrigger_json_1 = __importDefault(require("./schema/modules/trigger/webtrigger.json"));
19
+ const base_json_3 = __importDefault(require("./schema/modules/function/base.json"));
20
+ const field_json_1 = __importDefault(require("./schema/modules/custom-field/field.json"));
21
+ const type_json_1 = __importDefault(require("./schema/modules/custom-field/type.json"));
22
+ const proxima_field_json_1 = __importDefault(require("./schema/modules/custom-field/proxima-field.json"));
23
+ const base_json_4 = __importDefault(require("./schema/modules/custom-item-type/base.json"));
24
+ const resources_json_1 = __importDefault(require("./schema/resources.json"));
25
+ const tables_json_1 = __importDefault(require("./schema/tables.json"));
26
+ const locales_json_1 = __importDefault(require("./schema/locales.json"));
27
+ const dependVersion_json_1 = __importDefault(require("./schema/dependVersion.json"));
28
+ const storage_json_1 = __importDefault(require("./schema/storage.json"));
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"));
34
+ const validateResource = (json) => {
35
+ const errors = [];
36
+ const frontendModules = ['adminPage', 'itemPanel', 'itemActivity', 'appPage'];
37
+ const modules = (0, lodash_1.get)(json, 'modules') || {};
38
+ const resourcesEntries = (0, lodash_1.keyBy)((0, lodash_1.get)(json, 'resources'), 'key');
39
+ const functionEntries = (0, lodash_1.keyBy)((0, lodash_1.get)(json, 'modules.function'), 'key');
40
+ const customFieldTypeEntries = (0, lodash_1.keyBy)((0, lodash_1.get)(json, 'modules.customFieldType'), 'key');
41
+ const moduleKeys = {};
42
+ Object.keys(modules).forEach(moduleKey => {
43
+ const module = (0, lodash_1.get)(modules, moduleKey);
44
+ if (!module)
45
+ return;
46
+ const isFrontendModule = frontendModules.indexOf(moduleKey) > -1;
47
+ Array.from(module).forEach(({ resource, function: functionRef, type, key }, index) => {
48
+ const path = `/modules/${moduleKey}/${index}`;
49
+ if (moduleKeys[key]) {
50
+ errors.push({
51
+ path,
52
+ message: `Key '${key}' has already exits! `,
53
+ });
54
+ }
55
+ else {
56
+ moduleKeys[key] = true;
57
+ }
58
+ if (isFrontendModule) {
59
+ if (resource && !(0, lodash_1.get)(resourcesEntries, resource)) {
60
+ errors.push({
61
+ path,
62
+ message: `Resource '${resource}' not found! `,
63
+ });
64
+ }
65
+ }
66
+ else if (moduleKey === 'trigger' || moduleKey === 'webtrigger') {
67
+ if (functionRef && !(0, lodash_1.get)(functionEntries, functionRef)) {
68
+ errors.push({
69
+ path,
70
+ message: `Function '${functionRef}' not found! `,
71
+ });
72
+ }
73
+ }
74
+ else if (moduleKey === 'customField' && (0, lodash_1.startsWith)(type, '_self:')) {
75
+ const fieldTypeRef = type === null || type === void 0 ? void 0 : type.slice(6);
76
+ if (fieldTypeRef && !(0, lodash_1.get)(customFieldTypeEntries, fieldTypeRef)) {
77
+ errors.push({
78
+ path,
79
+ message: `FieldType '${fieldTypeRef}' not found! `,
80
+ });
81
+ }
82
+ }
83
+ });
84
+ });
85
+ return {
86
+ pass: errors.length === 0,
87
+ errors,
88
+ };
89
+ };
90
+ const validateFactory = (schema) => {
91
+ const ajv = new ajv_1.default({
92
+ // https://github.com/ajv-validator/ajv/issues/1417
93
+ strictTuples: false,
94
+ allowMatchingProperties: false,
95
+ allErrors: true,
96
+ schemas: [
97
+ all_json_1.default,
98
+ app_json_1.default,
99
+ index_json_1.default,
100
+ base_json_1.default,
101
+ workspacePage_json_1.default,
102
+ base_json_2.default,
103
+ webtrigger_json_1.default,
104
+ base_json_3.default,
105
+ field_json_1.default,
106
+ type_json_1.default,
107
+ base_json_4.default,
108
+ proxima_field_json_1.default,
109
+ resources_json_1.default,
110
+ tables_json_1.default,
111
+ locales_json_1.default,
112
+ dependVersion_json_1.default,
113
+ storage_json_1.default,
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,
119
+ ],
120
+ });
121
+ (0, ajv_keywords_1.default)(ajv);
122
+ (0, ajv_errors_1.default)(ajv);
123
+ return (json) => {
124
+ const validate = ajv.compile(schema);
125
+ const pass = validate === null || validate === void 0 ? void 0 : validate(json);
126
+ const errors = validate === null || validate === void 0 ? void 0 : validate.errors;
127
+ return {
128
+ pass,
129
+ errors: errors
130
+ ? (0, lodash_1.map)(errors, error => ({
131
+ path: error.instancePath,
132
+ message: error.message,
133
+ }))
134
+ : null,
135
+ };
136
+ };
137
+ };
138
+ const validateWorkspacePage = (json) => {
139
+ var _a;
140
+ const modules = (_a = json === null || json === void 0 ? void 0 : json.modules) === null || _a === void 0 ? void 0 : _a['workspacePage'];
141
+ const errors = [];
142
+ if (modules === null || modules === void 0 ? void 0 : modules.length) {
143
+ const groupKey = modules.filter(item => item.type === 'group').map(item => item.key);
144
+ for (const module of modules) {
145
+ if (module.type && !['group', 'board'].includes(module.type)) {
146
+ errors.push({
147
+ path: `/modules/workspacePage/${module.key}`,
148
+ message: `Type must be 'group' or 'board'! `,
149
+ });
150
+ }
151
+ if (module.type === 'group') {
152
+ if (module.title && (module.title.length < 2 || module.title.length > 10)) {
153
+ errors.push({
154
+ path: `/modules/workspacePage/${module.key}`,
155
+ message: `Group title length must be between 2 and 10! `,
156
+ });
157
+ }
158
+ }
159
+ else {
160
+ if (module.parent && !groupKey.includes(module.parent)) {
161
+ errors.push({
162
+ path: `/modules/workspacePage/${module.key}`,
163
+ message: `Parent '${module.parent}' not found! `,
164
+ });
165
+ }
166
+ if (module.title && (module.title.length < 2 || module.title.length > 30)) {
167
+ errors.push({
168
+ path: `/modules/workspacePage/${module.key}`,
169
+ message: `Title length must be between 2 and 30! `,
170
+ });
171
+ }
172
+ }
173
+ }
174
+ }
175
+ return {
176
+ pass: errors.length === 0,
177
+ errors,
178
+ };
179
+ };
180
+ exports.validateWorkspacePage = validateWorkspacePage;
181
+ const validateScheduledTrigger = (json) => {
182
+ var _a;
183
+ const modules = (_a = json === null || json === void 0 ? void 0 : json.modules) === null || _a === void 0 ? void 0 : _a['scheduledTrigger'];
184
+ const errors = [];
185
+ if (modules === null || modules === void 0 ? void 0 : modules.length) {
186
+ for (const module of modules) {
187
+ try {
188
+ new cron_1.CronTime(module.cronTime);
189
+ }
190
+ catch (err) {
191
+ errors.push({
192
+ path: `/modules/scheduledTrigger/${module.key}`,
193
+ message: `CronTime is invalid! `,
194
+ });
195
+ }
196
+ }
197
+ }
198
+ return {
199
+ pass: errors.length === 0,
200
+ errors,
201
+ };
202
+ };
203
+ exports.validateScheduledTrigger = validateScheduledTrigger;
204
+ const validateAll = (json) => {
205
+ const validateFunctions = [
206
+ validateFactory(all_json_1.default),
207
+ // 校验一下需要的引用是否存在
208
+ validateResource,
209
+ exports.validateWorkspacePage,
210
+ exports.validateScheduledTrigger,
211
+ ];
212
+ for (const validateFunction of validateFunctions) {
213
+ const validateRes = validateFunction(json);
214
+ if (!validateRes.pass) {
215
+ return validateRes;
216
+ }
217
+ }
218
+ return {
219
+ pass: true,
220
+ errors: [],
221
+ };
222
+ };
223
+ exports.validateAll = validateAll;
224
+ exports.validateApp = validateFactory(app_json_1.default);
225
+ exports.validateModules = validateFactory(index_json_1.default);
226
+ exports.validateResources = validateFactory(resources_json_1.default);
227
+ exports.validateTables = validateFactory(tables_json_1.default);
228
+ exports.validateLocales = validateFactory(locales_json_1.default);
229
+ exports.validateDependVersion = validateFactory(dependVersion_json_1.default);
230
+ exports.validateStorage = validateFactory(storage_json_1.default);
231
+ 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.8.0",
3
+ "version": "0.8.2",
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,8 +36,9 @@
35
36
  },
36
37
  "devDependencies": {
37
38
  "@types/lodash": "^4.14.195",
38
- "jest": "^29.7.0",
39
+ "@vitest/coverage-v8": "^2.1.3",
39
40
  "prettier": "^3.3.3",
40
- "typescript": "^4.8.3"
41
+ "typescript": "^4.8.3",
42
+ "vitest": "^2.1.3"
41
43
  }
42
44
  }