@nocobase/plugin-workflow-test 0.17.0-alpha.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/LICENSE +661 -0
- package/README.md +9 -0
- package/dist/client/index.d.ts +0 -0
- package/dist/client/index.js +1 -0
- package/dist/externalVersion.js +6 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +39 -0
- package/dist/server/collections/categories.d.ts +3 -0
- package/dist/server/collections/categories.js +35 -0
- package/dist/server/collections/comments.d.ts +3 -0
- package/dist/server/collections/comments.js +44 -0
- package/dist/server/collections/posts.d.ts +3 -0
- package/dist/server/collections/posts.js +60 -0
- package/dist/server/collections/replies.d.ts +8 -0
- package/dist/server/collections/replies.js +31 -0
- package/dist/server/collections/tags.d.ts +3 -0
- package/dist/server/collections/tags.js +35 -0
- package/dist/server/functions.d.ts +4 -0
- package/dist/server/functions.js +25 -0
- package/dist/server/index.d.ts +13 -0
- package/dist/server/index.js +95 -0
- package/dist/server/instructions.d.ts +41 -0
- package/dist/server/instructions.js +81 -0
- package/package.json +15 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
- package/src/client/index.ts +0 -0
- package/src/index.ts +2 -0
- package/src/server/collections/categories.ts +15 -0
- package/src/server/collections/comments.ts +24 -0
- package/src/server/collections/posts.ts +40 -0
- package/src/server/collections/replies.ts +9 -0
- package/src/server/collections/tags.ts +15 -0
- package/src/server/functions.ts +3 -0
- package/src/server/index.ts +78 -0
- package/src/server/instructions.ts +66 -0
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
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 src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
default: () => import_server.default
|
|
32
|
+
});
|
|
33
|
+
module.exports = __toCommonJS(src_exports);
|
|
34
|
+
__reExport(src_exports, require("./server"), module.exports);
|
|
35
|
+
var import_server = __toESM(require("./server"));
|
|
36
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
37
|
+
0 && (module.exports = {
|
|
38
|
+
...require("./server")
|
|
39
|
+
});
|
|
@@ -0,0 +1,35 @@
|
|
|
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 categories_exports = {};
|
|
19
|
+
__export(categories_exports, {
|
|
20
|
+
default: () => categories_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(categories_exports);
|
|
23
|
+
var categories_default = {
|
|
24
|
+
name: "categories",
|
|
25
|
+
fields: [
|
|
26
|
+
{
|
|
27
|
+
type: "string",
|
|
28
|
+
name: "title"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "hasMany",
|
|
32
|
+
name: "posts"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
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 comments_exports = {};
|
|
19
|
+
__export(comments_exports, {
|
|
20
|
+
default: () => comments_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(comments_exports);
|
|
23
|
+
var comments_default = {
|
|
24
|
+
name: "comments",
|
|
25
|
+
fields: [
|
|
26
|
+
{
|
|
27
|
+
type: "belongsTo",
|
|
28
|
+
name: "post"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "text",
|
|
32
|
+
name: "content"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: "integer",
|
|
36
|
+
name: "status",
|
|
37
|
+
defaultValue: 0
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
type: "hasMany",
|
|
41
|
+
name: "replies"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
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 posts_exports = {};
|
|
19
|
+
__export(posts_exports, {
|
|
20
|
+
default: () => posts_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(posts_exports);
|
|
23
|
+
var posts_default = {
|
|
24
|
+
name: "posts",
|
|
25
|
+
createdBy: true,
|
|
26
|
+
updatedBy: true,
|
|
27
|
+
fields: [
|
|
28
|
+
{
|
|
29
|
+
type: "string",
|
|
30
|
+
name: "title"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
type: "boolean",
|
|
34
|
+
name: "published",
|
|
35
|
+
defaultValue: false
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
type: "integer",
|
|
39
|
+
name: "read",
|
|
40
|
+
defaultValue: 0
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
type: "belongsTo",
|
|
44
|
+
name: "category"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
type: "hasMany",
|
|
48
|
+
name: "comments"
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
type: "belongsToMany",
|
|
52
|
+
name: "tags"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
type: "integer",
|
|
56
|
+
name: "read",
|
|
57
|
+
defaultValue: 0
|
|
58
|
+
}
|
|
59
|
+
]
|
|
60
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
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 replies_exports = {};
|
|
19
|
+
__export(replies_exports, {
|
|
20
|
+
default: () => replies_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(replies_exports);
|
|
23
|
+
var replies_default = {
|
|
24
|
+
name: "replies",
|
|
25
|
+
fields: [
|
|
26
|
+
{
|
|
27
|
+
type: "string",
|
|
28
|
+
name: "content"
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
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 tags_exports = {};
|
|
19
|
+
__export(tags_exports, {
|
|
20
|
+
default: () => tags_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(tags_exports);
|
|
23
|
+
var tags_default = {
|
|
24
|
+
name: "tags",
|
|
25
|
+
fields: [
|
|
26
|
+
{
|
|
27
|
+
type: "belongsToMany",
|
|
28
|
+
name: "posts"
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: "string",
|
|
32
|
+
name: "name"
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
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 functions_exports = {};
|
|
19
|
+
__export(functions_exports, {
|
|
20
|
+
default: () => functions_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(functions_exports);
|
|
23
|
+
var functions_default = {
|
|
24
|
+
no1: () => 1
|
|
25
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Plugin, ApplicationOptions } from '@nocobase/server';
|
|
2
|
+
import { MockServer } from '@nocobase/test';
|
|
3
|
+
interface MockServerOptions extends ApplicationOptions {
|
|
4
|
+
autoStart?: boolean;
|
|
5
|
+
collectionsPath?: string;
|
|
6
|
+
cleanDb?: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function sleep(ms: number): Promise<unknown>;
|
|
9
|
+
export declare function getApp({ autoStart, cleanDb, plugins, ...options }?: MockServerOptions): Promise<MockServer>;
|
|
10
|
+
export default class extends Plugin {
|
|
11
|
+
load(): Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
var server_exports = {};
|
|
29
|
+
__export(server_exports, {
|
|
30
|
+
default: () => server_default,
|
|
31
|
+
getApp: () => getApp,
|
|
32
|
+
sleep: () => sleep
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(server_exports);
|
|
35
|
+
var import_path = __toESM(require("path"));
|
|
36
|
+
var import_server = require("@nocobase/server");
|
|
37
|
+
var import_test = require("@nocobase/test");
|
|
38
|
+
var import_instructions = __toESM(require("./instructions"));
|
|
39
|
+
var import_functions = __toESM(require("./functions"));
|
|
40
|
+
async function createMockServer({ autoStart, collectionsPath, cleanDb, ...options }) {
|
|
41
|
+
const app = (0, import_test.mockServer)(options);
|
|
42
|
+
if (cleanDb) {
|
|
43
|
+
await app.cleanDb();
|
|
44
|
+
}
|
|
45
|
+
await app.load();
|
|
46
|
+
if (collectionsPath) {
|
|
47
|
+
await app.db.import({ directory: collectionsPath });
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
await app.db.sync();
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error(error);
|
|
53
|
+
}
|
|
54
|
+
if (autoStart) {
|
|
55
|
+
await app.start();
|
|
56
|
+
}
|
|
57
|
+
return app;
|
|
58
|
+
}
|
|
59
|
+
function sleep(ms) {
|
|
60
|
+
return new Promise((resolve) => {
|
|
61
|
+
setTimeout(resolve, ms);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
async function getApp({
|
|
65
|
+
autoStart = true,
|
|
66
|
+
cleanDb = true,
|
|
67
|
+
plugins = [],
|
|
68
|
+
...options
|
|
69
|
+
} = {}) {
|
|
70
|
+
return createMockServer({
|
|
71
|
+
...options,
|
|
72
|
+
autoStart,
|
|
73
|
+
cleanDb,
|
|
74
|
+
plugins: ["workflow", "workflow-test", ...plugins]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
class server_default extends import_server.Plugin {
|
|
78
|
+
async load() {
|
|
79
|
+
await this.db.import({
|
|
80
|
+
directory: import_path.default.resolve(__dirname, "collections")
|
|
81
|
+
});
|
|
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
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
getApp,
|
|
94
|
+
sleep
|
|
95
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
echo: {
|
|
3
|
+
run({ config }: any, { result }: {
|
|
4
|
+
result: any;
|
|
5
|
+
}, processor: any): {
|
|
6
|
+
status: number;
|
|
7
|
+
result: any;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
error: {
|
|
11
|
+
run(node: any, input: any, processor: any): never;
|
|
12
|
+
};
|
|
13
|
+
pending: {
|
|
14
|
+
run(node: any, input: any, processor: any): {
|
|
15
|
+
status: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
prompt: {
|
|
19
|
+
run(node: any, input: any, processor: any): {
|
|
20
|
+
status: number;
|
|
21
|
+
};
|
|
22
|
+
resume(node: any, job: any, processor: any): any;
|
|
23
|
+
};
|
|
24
|
+
'prompt->error': {
|
|
25
|
+
run(node: any, input: any, processor: any): {
|
|
26
|
+
status: number;
|
|
27
|
+
};
|
|
28
|
+
resume(node: any, input: any, processor: any): never;
|
|
29
|
+
};
|
|
30
|
+
customizedSuccess: {
|
|
31
|
+
run(node: any, input: any, processor: any): {
|
|
32
|
+
status: number;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
customizedError: {
|
|
36
|
+
run(node: any, input: any, processor: any): {
|
|
37
|
+
status: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export default _default;
|
|
@@ -0,0 +1,81 @@
|
|
|
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 instructions_exports = {};
|
|
19
|
+
__export(instructions_exports, {
|
|
20
|
+
default: () => instructions_default
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(instructions_exports);
|
|
23
|
+
var import_utils = require("@nocobase/utils");
|
|
24
|
+
var instructions_default = {
|
|
25
|
+
echo: {
|
|
26
|
+
run({ config = {} }, { result }, processor) {
|
|
27
|
+
return {
|
|
28
|
+
status: 1,
|
|
29
|
+
result: config.path == null ? result : import_utils.lodash.get(result, config.path)
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
error: {
|
|
34
|
+
run(node, input, processor) {
|
|
35
|
+
throw new Error("definite error");
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
pending: {
|
|
39
|
+
run(node, input, processor) {
|
|
40
|
+
return {
|
|
41
|
+
status: 0
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
prompt: {
|
|
46
|
+
run(node, input, processor) {
|
|
47
|
+
return {
|
|
48
|
+
status: 0
|
|
49
|
+
};
|
|
50
|
+
},
|
|
51
|
+
resume(node, job, processor) {
|
|
52
|
+
return job.set({
|
|
53
|
+
status: 1
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"prompt->error": {
|
|
58
|
+
run(node, input, processor) {
|
|
59
|
+
return {
|
|
60
|
+
status: 0
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
resume(node, input, processor) {
|
|
64
|
+
throw new Error("input failed");
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
customizedSuccess: {
|
|
68
|
+
run(node, input, processor) {
|
|
69
|
+
return {
|
|
70
|
+
status: 100
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
customizedError: {
|
|
75
|
+
run(node, input, processor) {
|
|
76
|
+
return {
|
|
77
|
+
status: -100
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@nocobase/plugin-workflow-test",
|
|
3
|
+
"displayName": "Workflow: test kit",
|
|
4
|
+
"displayName.zh-CN": "工作流:测试工具包",
|
|
5
|
+
"version": "0.17.0-alpha.4",
|
|
6
|
+
"license": "AGPL-3.0",
|
|
7
|
+
"main": "dist/server/index.js",
|
|
8
|
+
"types": "./dist/server/index.d.ts",
|
|
9
|
+
"peerDependencies": {
|
|
10
|
+
"@nocobase/database": "0.x",
|
|
11
|
+
"@nocobase/server": "0.x",
|
|
12
|
+
"@nocobase/test": "0.x"
|
|
13
|
+
},
|
|
14
|
+
"gitHead": "663b03a3799a70ba1a2bc6a0d686e679331a50ad"
|
|
15
|
+
}
|
package/server.d.ts
ADDED
package/server.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('./dist/server/index.js');
|
|
File without changes
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { CollectionOptions } from '@nocobase/database';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: 'comments',
|
|
5
|
+
fields: [
|
|
6
|
+
{
|
|
7
|
+
type: 'belongsTo',
|
|
8
|
+
name: 'post',
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
type: 'text',
|
|
12
|
+
name: 'content',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: 'integer',
|
|
16
|
+
name: 'status',
|
|
17
|
+
defaultValue: 0,
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
type: 'hasMany',
|
|
21
|
+
name: 'replies',
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
} as CollectionOptions;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CollectionOptions } from '@nocobase/database';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
name: 'posts',
|
|
5
|
+
createdBy: true,
|
|
6
|
+
updatedBy: true,
|
|
7
|
+
fields: [
|
|
8
|
+
{
|
|
9
|
+
type: 'string',
|
|
10
|
+
name: 'title',
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
type: 'boolean',
|
|
14
|
+
name: 'published',
|
|
15
|
+
defaultValue: false,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
type: 'integer',
|
|
19
|
+
name: 'read',
|
|
20
|
+
defaultValue: 0,
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
type: 'belongsTo',
|
|
24
|
+
name: 'category',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: 'hasMany',
|
|
28
|
+
name: 'comments',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
type: 'belongsToMany',
|
|
32
|
+
name: 'tags',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
type: 'integer',
|
|
36
|
+
name: 'read',
|
|
37
|
+
defaultValue: 0,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
} as CollectionOptions;
|