@nocobase/plugin-workflow-test 0.17.0-alpha.7 → 0.18.0-alpha.8
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/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/index.d.ts +3 -0
- package/dist/client/index.js +1 -1
- package/dist/e2e/e2eCollectionModel.d.ts +2830 -0
- package/dist/e2e/e2eCollectionModel.js +4264 -0
- package/dist/e2e/e2ePageObjectModel.d.ts +263 -0
- package/dist/e2e/e2ePageObjectModel.js +533 -0
- package/dist/e2e/e2eUtils.d.ts +31 -0
- package/dist/e2e/e2eUtils.js +318 -0
- package/dist/e2e/index.d.ts +4 -0
- package/dist/e2e/index.js +43 -0
- package/dist/externalVersion.js +6 -4
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.js +13 -10
- package/dist/server/instructions.d.ts +2 -2
- package/dist/server/instructions.js +2 -0
- package/e2e.d.ts +2 -0
- package/e2e.js +1 -0
- package/package.json +2 -2
- package/src/client/index.ts +3 -0
- package/src/e2e/e2eCollectionModel.ts +4250 -0
- package/src/e2e/e2ePageObjectModel.ts +528 -0
- package/src/e2e/e2eUtils.ts +747 -0
- package/src/e2e/index.ts +4 -0
- package/src/server/index.ts +12 -12
- package/src/server/instructions.ts +2 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var e2eUtils_exports = {};
|
|
19
|
+
__export(e2eUtils_exports, {
|
|
20
|
+
apiCreateRecordTriggerFormEvent: () => apiCreateRecordTriggerFormEvent,
|
|
21
|
+
apiCreateWorkflow: () => apiCreateWorkflow,
|
|
22
|
+
apiCreateWorkflowNode: () => apiCreateWorkflowNode,
|
|
23
|
+
apiDeleteWorkflow: () => apiDeleteWorkflow,
|
|
24
|
+
apiGetList: () => apiGetList,
|
|
25
|
+
apiGetRecord: () => apiGetRecord,
|
|
26
|
+
apiGetWorkflow: () => apiGetWorkflow,
|
|
27
|
+
apiGetWorkflowNode: () => apiGetWorkflowNode,
|
|
28
|
+
apiGetWorkflowNodeExecutions: () => apiGetWorkflowNodeExecutions,
|
|
29
|
+
apiSubmitRecordTriggerFormEvent: () => apiSubmitRecordTriggerFormEvent,
|
|
30
|
+
apiUpdateRecord: () => apiUpdateRecord,
|
|
31
|
+
apiUpdateWorkflow: () => apiUpdateWorkflow,
|
|
32
|
+
apiUpdateWorkflowNode: () => apiUpdateWorkflowNode,
|
|
33
|
+
apiUpdateWorkflowTrigger: () => apiUpdateWorkflowTrigger,
|
|
34
|
+
default: () => e2eUtils_default
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(e2eUtils_exports);
|
|
37
|
+
var import_e2e = require("@nocobase/test/e2e");
|
|
38
|
+
const PORT = process.env.APP_PORT || 2e4;
|
|
39
|
+
const APP_BASE_URL = process.env.APP_BASE_URL || `http://localhost:${PORT}`;
|
|
40
|
+
const apiCreateWorkflow = async (data) => {
|
|
41
|
+
const api = await import_e2e.request.newContext({
|
|
42
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
43
|
+
});
|
|
44
|
+
const state = await api.storageState();
|
|
45
|
+
const headers = getHeaders(state);
|
|
46
|
+
const result = await api.post(`/api/workflows:create`, {
|
|
47
|
+
headers,
|
|
48
|
+
data
|
|
49
|
+
});
|
|
50
|
+
if (!result.ok()) {
|
|
51
|
+
throw new Error(await result.text());
|
|
52
|
+
}
|
|
53
|
+
return (await result.json()).data;
|
|
54
|
+
};
|
|
55
|
+
const apiUpdateWorkflow = async (id, data) => {
|
|
56
|
+
const api = await import_e2e.request.newContext({
|
|
57
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
58
|
+
});
|
|
59
|
+
const state = await api.storageState();
|
|
60
|
+
const headers = getHeaders(state);
|
|
61
|
+
const result = await api.post(`/api/workflows:update?filterByTk=${id}`, {
|
|
62
|
+
headers,
|
|
63
|
+
data
|
|
64
|
+
});
|
|
65
|
+
if (!result.ok()) {
|
|
66
|
+
throw new Error(await result.text());
|
|
67
|
+
}
|
|
68
|
+
return (await result.json()).data;
|
|
69
|
+
};
|
|
70
|
+
const apiDeleteWorkflow = async (id) => {
|
|
71
|
+
const api = await import_e2e.request.newContext({
|
|
72
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
73
|
+
});
|
|
74
|
+
const state = await api.storageState();
|
|
75
|
+
const headers = getHeaders(state);
|
|
76
|
+
const result = await api.post(`/api/workflows:destroy?filterByTk=${id}`, {
|
|
77
|
+
headers
|
|
78
|
+
});
|
|
79
|
+
if (!result.ok()) {
|
|
80
|
+
throw new Error(await result.text());
|
|
81
|
+
}
|
|
82
|
+
return (await result.json()).data;
|
|
83
|
+
};
|
|
84
|
+
const apiGetWorkflow = async (id) => {
|
|
85
|
+
const api = await import_e2e.request.newContext({
|
|
86
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
87
|
+
});
|
|
88
|
+
const state = await api.storageState();
|
|
89
|
+
const headers = getHeaders(state);
|
|
90
|
+
const result = await api.get(`/api/workflows:get?filterByTk=${id}`, {
|
|
91
|
+
headers
|
|
92
|
+
});
|
|
93
|
+
if (!result.ok()) {
|
|
94
|
+
throw new Error(await result.text());
|
|
95
|
+
}
|
|
96
|
+
return (await result.json()).data;
|
|
97
|
+
};
|
|
98
|
+
const apiUpdateWorkflowTrigger = async (id, data) => {
|
|
99
|
+
const api = await import_e2e.request.newContext({
|
|
100
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
101
|
+
});
|
|
102
|
+
const state = await api.storageState();
|
|
103
|
+
const headers = getHeaders(state);
|
|
104
|
+
const result = await api.post(`/api/workflows:update?filterByTk=${id}`, {
|
|
105
|
+
headers,
|
|
106
|
+
data
|
|
107
|
+
});
|
|
108
|
+
if (!result.ok()) {
|
|
109
|
+
throw new Error(await result.text());
|
|
110
|
+
}
|
|
111
|
+
return (await result.json()).data;
|
|
112
|
+
};
|
|
113
|
+
const apiCreateWorkflowNode = async (workflowId, data) => {
|
|
114
|
+
const api = await import_e2e.request.newContext({
|
|
115
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
116
|
+
});
|
|
117
|
+
const state = await api.storageState();
|
|
118
|
+
const headers = getHeaders(state);
|
|
119
|
+
const result = await api.post(`/api/workflows/${workflowId}/nodes:create`, {
|
|
120
|
+
headers,
|
|
121
|
+
data
|
|
122
|
+
});
|
|
123
|
+
if (!result.ok()) {
|
|
124
|
+
throw new Error(await result.text());
|
|
125
|
+
}
|
|
126
|
+
return (await result.json()).data;
|
|
127
|
+
};
|
|
128
|
+
const apiGetWorkflowNode = async (id) => {
|
|
129
|
+
const api = await import_e2e.request.newContext({
|
|
130
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
131
|
+
});
|
|
132
|
+
const state = await api.storageState();
|
|
133
|
+
const headers = getHeaders(state);
|
|
134
|
+
const result = await api.get(`/api/flow_nodes:get?filterByTk=${id}`, {
|
|
135
|
+
headers
|
|
136
|
+
});
|
|
137
|
+
if (!result.ok()) {
|
|
138
|
+
throw new Error(await result.text());
|
|
139
|
+
}
|
|
140
|
+
return (await result.json()).data;
|
|
141
|
+
};
|
|
142
|
+
const apiUpdateWorkflowNode = async (id, data) => {
|
|
143
|
+
const api = await import_e2e.request.newContext({
|
|
144
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
145
|
+
});
|
|
146
|
+
const state = await api.storageState();
|
|
147
|
+
const headers = getHeaders(state);
|
|
148
|
+
const result = await api.post(`/api/flow_nodes:update?filterByTk=${id}`, {
|
|
149
|
+
headers,
|
|
150
|
+
data
|
|
151
|
+
});
|
|
152
|
+
if (!result.ok()) {
|
|
153
|
+
throw new Error(await result.text());
|
|
154
|
+
}
|
|
155
|
+
return (await result.json()).data;
|
|
156
|
+
};
|
|
157
|
+
const apiGetWorkflowNodeExecutions = async (id) => {
|
|
158
|
+
const api = await import_e2e.request.newContext({
|
|
159
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
160
|
+
});
|
|
161
|
+
const state = await api.storageState();
|
|
162
|
+
const headers = getHeaders(state);
|
|
163
|
+
const url = `/api/executions:list?appends[]=jobs&filter[workflowId]=${id}&fields=id,createdAt,updatedAt,key,status,workflowId,jobs`;
|
|
164
|
+
const result = await api.get(url, {
|
|
165
|
+
headers
|
|
166
|
+
});
|
|
167
|
+
if (!result.ok()) {
|
|
168
|
+
throw new Error(await result.text());
|
|
169
|
+
}
|
|
170
|
+
return (await result.json()).data;
|
|
171
|
+
};
|
|
172
|
+
const apiUpdateRecord = async (collectionName, id, data) => {
|
|
173
|
+
const api = await import_e2e.request.newContext({
|
|
174
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
175
|
+
});
|
|
176
|
+
const state = await api.storageState();
|
|
177
|
+
const headers = getHeaders(state);
|
|
178
|
+
const result = await api.post(`/api/${collectionName}:update?filterByTk=${id}`, {
|
|
179
|
+
headers,
|
|
180
|
+
data
|
|
181
|
+
});
|
|
182
|
+
if (!result.ok()) {
|
|
183
|
+
throw new Error(await result.text());
|
|
184
|
+
}
|
|
185
|
+
return (await result.json()).data;
|
|
186
|
+
};
|
|
187
|
+
const apiGetRecord = async (collectionName, id) => {
|
|
188
|
+
const api = await import_e2e.request.newContext({
|
|
189
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
190
|
+
});
|
|
191
|
+
const state = await api.storageState();
|
|
192
|
+
const headers = getHeaders(state);
|
|
193
|
+
const result = await api.get(`/api/${collectionName}:get?filterByTk=${id}`, {
|
|
194
|
+
headers
|
|
195
|
+
});
|
|
196
|
+
if (!result.ok()) {
|
|
197
|
+
throw new Error(await result.text());
|
|
198
|
+
}
|
|
199
|
+
return (await result.json()).data;
|
|
200
|
+
};
|
|
201
|
+
const apiGetList = async (collectionName) => {
|
|
202
|
+
const api = await import_e2e.request.newContext({
|
|
203
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
204
|
+
});
|
|
205
|
+
const state = await api.storageState();
|
|
206
|
+
const headers = getHeaders(state);
|
|
207
|
+
const result = await api.get(`/api/${collectionName}:list`, {
|
|
208
|
+
headers
|
|
209
|
+
});
|
|
210
|
+
if (!result.ok()) {
|
|
211
|
+
throw new Error(await result.text());
|
|
212
|
+
}
|
|
213
|
+
return await result.json();
|
|
214
|
+
};
|
|
215
|
+
const apiCreateRecordTriggerFormEvent = async (collectionName, triggerWorkflows, data) => {
|
|
216
|
+
const api = await import_e2e.request.newContext({
|
|
217
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
218
|
+
});
|
|
219
|
+
const state = await api.storageState();
|
|
220
|
+
const headers = getHeaders(state);
|
|
221
|
+
const result = await api.post(`/api/${collectionName}:create?triggerWorkflows=${triggerWorkflows}`, {
|
|
222
|
+
headers,
|
|
223
|
+
data
|
|
224
|
+
});
|
|
225
|
+
if (!result.ok()) {
|
|
226
|
+
throw new Error(await result.text());
|
|
227
|
+
}
|
|
228
|
+
return (await result.json()).data;
|
|
229
|
+
};
|
|
230
|
+
const apiSubmitRecordTriggerFormEvent = async (triggerWorkflows, data) => {
|
|
231
|
+
const api = await import_e2e.request.newContext({
|
|
232
|
+
storageState: process.env.PLAYWRIGHT_AUTH_FILE
|
|
233
|
+
});
|
|
234
|
+
const state = await api.storageState();
|
|
235
|
+
const headers = getHeaders(state);
|
|
236
|
+
const result = await api.post(`/api/workflows:trigger?triggerWorkflows=${triggerWorkflows}`, {
|
|
237
|
+
headers,
|
|
238
|
+
data
|
|
239
|
+
});
|
|
240
|
+
if (!result.ok()) {
|
|
241
|
+
throw new Error(await result.text());
|
|
242
|
+
}
|
|
243
|
+
return await result.json();
|
|
244
|
+
};
|
|
245
|
+
const getStorageItem = (key, storageState) => {
|
|
246
|
+
var _a, _b;
|
|
247
|
+
return (_b = (_a = storageState.origins.find((item) => item.origin === APP_BASE_URL)) == null ? void 0 : _a.localStorage.find((item) => item.name === key)) == null ? void 0 : _b.value;
|
|
248
|
+
};
|
|
249
|
+
function getHeaders(storageState) {
|
|
250
|
+
var _a;
|
|
251
|
+
const headers = {};
|
|
252
|
+
const token = getStorageItem("NOCOBASE_TOKEN", storageState);
|
|
253
|
+
const auth = getStorageItem("NOCOBASE_AUTH", storageState);
|
|
254
|
+
const subAppName = (_a = new URL(APP_BASE_URL).pathname.match(/^\/apps\/([^/]*)\/*/)) == null ? void 0 : _a[1];
|
|
255
|
+
const hostName = new URL(APP_BASE_URL).host;
|
|
256
|
+
const locale = getStorageItem("NOCOBASE_LOCALE", storageState);
|
|
257
|
+
const timezone = "+08:00";
|
|
258
|
+
const withAclMeta = "true";
|
|
259
|
+
const role = getStorageItem("NOCOBASE_ROLE", storageState);
|
|
260
|
+
if (token) {
|
|
261
|
+
headers.Authorization = `Bearer ${token}`;
|
|
262
|
+
}
|
|
263
|
+
if (auth) {
|
|
264
|
+
headers["X-Authenticator"] = auth;
|
|
265
|
+
}
|
|
266
|
+
if (subAppName) {
|
|
267
|
+
headers["X-App"] = subAppName;
|
|
268
|
+
}
|
|
269
|
+
if (hostName) {
|
|
270
|
+
headers["X-Hostname"] = hostName;
|
|
271
|
+
}
|
|
272
|
+
if (locale) {
|
|
273
|
+
headers["X-Locale"] = locale;
|
|
274
|
+
}
|
|
275
|
+
if (timezone) {
|
|
276
|
+
headers["X-Timezone"] = timezone;
|
|
277
|
+
}
|
|
278
|
+
if (withAclMeta) {
|
|
279
|
+
headers["X-With-Acl-Meta"] = withAclMeta;
|
|
280
|
+
}
|
|
281
|
+
if (role) {
|
|
282
|
+
headers["X-Role"] = role;
|
|
283
|
+
}
|
|
284
|
+
return headers;
|
|
285
|
+
}
|
|
286
|
+
var e2eUtils_default = module.exports = {
|
|
287
|
+
apiCreateWorkflow,
|
|
288
|
+
apiUpdateWorkflow,
|
|
289
|
+
apiDeleteWorkflow,
|
|
290
|
+
apiGetWorkflow,
|
|
291
|
+
apiUpdateWorkflowTrigger,
|
|
292
|
+
apiGetWorkflowNodeExecutions,
|
|
293
|
+
apiCreateWorkflowNode,
|
|
294
|
+
apiUpdateWorkflowNode,
|
|
295
|
+
apiGetWorkflowNode,
|
|
296
|
+
apiUpdateRecord,
|
|
297
|
+
apiGetRecord,
|
|
298
|
+
apiGetList,
|
|
299
|
+
apiCreateRecordTriggerFormEvent,
|
|
300
|
+
apiSubmitRecordTriggerFormEvent
|
|
301
|
+
};
|
|
302
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
303
|
+
0 && (module.exports = {
|
|
304
|
+
apiCreateRecordTriggerFormEvent,
|
|
305
|
+
apiCreateWorkflow,
|
|
306
|
+
apiCreateWorkflowNode,
|
|
307
|
+
apiDeleteWorkflow,
|
|
308
|
+
apiGetList,
|
|
309
|
+
apiGetRecord,
|
|
310
|
+
apiGetWorkflow,
|
|
311
|
+
apiGetWorkflowNode,
|
|
312
|
+
apiGetWorkflowNodeExecutions,
|
|
313
|
+
apiSubmitRecordTriggerFormEvent,
|
|
314
|
+
apiUpdateRecord,
|
|
315
|
+
apiUpdateWorkflow,
|
|
316
|
+
apiUpdateWorkflowNode,
|
|
317
|
+
apiUpdateWorkflowTrigger
|
|
318
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var e2e_exports = {};
|
|
30
|
+
__export(e2e_exports, {
|
|
31
|
+
default: () => import_e2ePageObjectModel.default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(e2e_exports);
|
|
34
|
+
__reExport(e2e_exports, require("./e2eCollectionModel"), module.exports);
|
|
35
|
+
__reExport(e2e_exports, require("./e2ePageObjectModel"), module.exports);
|
|
36
|
+
var import_e2ePageObjectModel = __toESM(require("./e2ePageObjectModel"));
|
|
37
|
+
__reExport(e2e_exports, require("./e2eUtils"), module.exports);
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {
|
|
40
|
+
...require("./e2eCollectionModel"),
|
|
41
|
+
...require("./e2ePageObjectModel"),
|
|
42
|
+
...require("./e2eUtils")
|
|
43
|
+
});
|
package/dist/externalVersion.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
"@nocobase/
|
|
3
|
-
"@nocobase/
|
|
4
|
-
"
|
|
5
|
-
"@nocobase/
|
|
2
|
+
"@nocobase/client": "0.18.0-alpha.8",
|
|
3
|
+
"@nocobase/utils": "0.18.0-alpha.8",
|
|
4
|
+
"lodash": "4.17.21",
|
|
5
|
+
"@nocobase/test": "0.18.0-alpha.8",
|
|
6
|
+
"@nocobase/server": "0.18.0-alpha.8",
|
|
7
|
+
"@nocobase/database": "0.18.0-alpha.8"
|
|
6
8
|
};
|
package/dist/server/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ interface MockServerOptions extends ApplicationOptions {
|
|
|
7
7
|
}
|
|
8
8
|
export declare function sleep(ms: number): Promise<unknown>;
|
|
9
9
|
export declare function getApp({ autoStart, cleanDb, plugins, ...options }?: MockServerOptions): Promise<MockServer>;
|
|
10
|
-
export default class extends Plugin {
|
|
10
|
+
export default class WorkflowTestPlugin extends Plugin {
|
|
11
11
|
load(): Promise<void>;
|
|
12
12
|
}
|
|
13
13
|
export {};
|
package/dist/server/index.js
CHANGED
|
@@ -27,7 +27,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
27
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
28
|
var server_exports = {};
|
|
29
29
|
__export(server_exports, {
|
|
30
|
-
default: () =>
|
|
30
|
+
default: () => WorkflowTestPlugin,
|
|
31
31
|
getApp: () => getApp,
|
|
32
32
|
sleep: () => sleep
|
|
33
33
|
});
|
|
@@ -71,21 +71,24 @@ async function getApp({
|
|
|
71
71
|
...options,
|
|
72
72
|
autoStart,
|
|
73
73
|
cleanDb,
|
|
74
|
-
plugins: [
|
|
74
|
+
plugins: [
|
|
75
|
+
[
|
|
76
|
+
"workflow",
|
|
77
|
+
{
|
|
78
|
+
instructions: import_instructions.default,
|
|
79
|
+
functions: import_functions.default
|
|
80
|
+
}
|
|
81
|
+
],
|
|
82
|
+
WorkflowTestPlugin,
|
|
83
|
+
...plugins
|
|
84
|
+
]
|
|
75
85
|
});
|
|
76
86
|
}
|
|
77
|
-
class
|
|
87
|
+
class WorkflowTestPlugin extends import_server.Plugin {
|
|
78
88
|
async load() {
|
|
79
89
|
await this.db.import({
|
|
80
90
|
directory: import_path.default.resolve(__dirname, "collections")
|
|
81
91
|
});
|
|
82
|
-
const workflow = this.app.getPlugin("workflow");
|
|
83
|
-
for (const [key, instruction] of Object.entries(import_instructions.default)) {
|
|
84
|
-
workflow.instructions.register(key, instruction);
|
|
85
|
-
}
|
|
86
|
-
for (const [key, func] of Object.entries(import_functions.default)) {
|
|
87
|
-
workflow.functions.register(key, func);
|
|
88
|
-
}
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
94
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -8,7 +8,7 @@ declare const _default: {
|
|
|
8
8
|
};
|
|
9
9
|
};
|
|
10
10
|
error: {
|
|
11
|
-
run(node: any, input: any, processor: any):
|
|
11
|
+
run(node: any, input: any, processor: any): any;
|
|
12
12
|
};
|
|
13
13
|
pending: {
|
|
14
14
|
run(node: any, input: any, processor: any): {
|
|
@@ -25,7 +25,7 @@ declare const _default: {
|
|
|
25
25
|
run(node: any, input: any, processor: any): {
|
|
26
26
|
status: number;
|
|
27
27
|
};
|
|
28
|
-
resume(node: any, input: any, processor: any):
|
|
28
|
+
resume(node: any, input: any, processor: any): any;
|
|
29
29
|
};
|
|
30
30
|
customizedSuccess: {
|
|
31
31
|
run(node: any, input: any, processor: any): {
|
|
@@ -33,6 +33,7 @@ var instructions_default = {
|
|
|
33
33
|
error: {
|
|
34
34
|
run(node, input, processor) {
|
|
35
35
|
throw new Error("definite error");
|
|
36
|
+
return null;
|
|
36
37
|
}
|
|
37
38
|
},
|
|
38
39
|
pending: {
|
|
@@ -62,6 +63,7 @@ var instructions_default = {
|
|
|
62
63
|
},
|
|
63
64
|
resume(node, input, processor) {
|
|
64
65
|
throw new Error("input failed");
|
|
66
|
+
return null;
|
|
65
67
|
}
|
|
66
68
|
},
|
|
67
69
|
customizedSuccess: {
|
package/e2e.d.ts
ADDED
package/e2e.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/e2e/index.js');
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@nocobase/plugin-workflow-test",
|
|
3
3
|
"displayName": "Workflow: test kit",
|
|
4
4
|
"displayName.zh-CN": "工作流:测试工具包",
|
|
5
|
-
"version": "0.
|
|
5
|
+
"version": "0.18.0-alpha.8",
|
|
6
6
|
"license": "AGPL-3.0",
|
|
7
7
|
"main": "dist/server/index.js",
|
|
8
8
|
"types": "./dist/server/index.d.ts",
|
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
"@nocobase/server": "0.x",
|
|
12
12
|
"@nocobase/test": "0.x"
|
|
13
13
|
},
|
|
14
|
-
"gitHead": "
|
|
14
|
+
"gitHead": "727d42f6f14e5f863831da3dbf3255ba1165b567"
|
|
15
15
|
}
|
package/src/client/index.ts
CHANGED