@nocobase/plugin-workflow-test 1.2.12-alpha → 1.3.0-alpha.20240710084543

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.
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { CollectionOptions } from '@nocobase/database';
10
- declare const _default: CollectionOptions;
11
- export default _default;
@@ -1,53 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var comments_exports = {};
28
- __export(comments_exports, {
29
- default: () => comments_default
30
- });
31
- module.exports = __toCommonJS(comments_exports);
32
- var comments_default = {
33
- name: "comments",
34
- fields: [
35
- {
36
- type: "belongsTo",
37
- name: "post"
38
- },
39
- {
40
- type: "text",
41
- name: "content"
42
- },
43
- {
44
- type: "integer",
45
- name: "status",
46
- defaultValue: 0
47
- },
48
- {
49
- type: "hasMany",
50
- name: "replies"
51
- }
52
- ]
53
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { CollectionOptions } from '@nocobase/database';
10
- declare const _default: CollectionOptions;
11
- export default _default;
@@ -1,69 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var posts_exports = {};
28
- __export(posts_exports, {
29
- default: () => posts_default
30
- });
31
- module.exports = __toCommonJS(posts_exports);
32
- var posts_default = {
33
- name: "posts",
34
- createdBy: true,
35
- updatedBy: true,
36
- fields: [
37
- {
38
- type: "string",
39
- name: "title"
40
- },
41
- {
42
- type: "boolean",
43
- name: "published",
44
- defaultValue: false
45
- },
46
- {
47
- type: "integer",
48
- name: "read",
49
- defaultValue: 0
50
- },
51
- {
52
- type: "belongsTo",
53
- name: "category"
54
- },
55
- {
56
- type: "hasMany",
57
- name: "comments"
58
- },
59
- {
60
- type: "belongsToMany",
61
- name: "tags"
62
- },
63
- {
64
- type: "integer",
65
- name: "read",
66
- defaultValue: 0
67
- }
68
- ]
69
- };
@@ -1,16 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- name: string;
11
- fields: {
12
- type: string;
13
- name: string;
14
- }[];
15
- };
16
- export default _default;
@@ -1,40 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var replies_exports = {};
28
- __export(replies_exports, {
29
- default: () => replies_default
30
- });
31
- module.exports = __toCommonJS(replies_exports);
32
- var replies_default = {
33
- name: "replies",
34
- fields: [
35
- {
36
- type: "string",
37
- name: "content"
38
- }
39
- ]
40
- };
@@ -1,11 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { CollectionOptions } from '@nocobase/database';
10
- declare const _default: CollectionOptions;
11
- export default _default;
@@ -1,44 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var tags_exports = {};
28
- __export(tags_exports, {
29
- default: () => tags_default
30
- });
31
- module.exports = __toCommonJS(tags_exports);
32
- var tags_default = {
33
- name: "tags",
34
- fields: [
35
- {
36
- type: "belongsToMany",
37
- name: "posts"
38
- },
39
- {
40
- type: "string",
41
- name: "name"
42
- }
43
- ]
44
- };
@@ -1,12 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- no1: () => number;
11
- };
12
- export default _default;
@@ -1,34 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var functions_exports = {};
28
- __export(functions_exports, {
29
- default: () => functions_default
30
- });
31
- module.exports = __toCommonJS(functions_exports);
32
- var functions_default = {
33
- no1: () => 1
34
- };
@@ -1,18 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { ApplicationOptions, Plugin } from '@nocobase/server';
10
- import { MockServer } from '@nocobase/test';
11
- export interface MockServerOptions extends ApplicationOptions {
12
- collectionsPath?: string;
13
- }
14
- export declare function sleep(ms: number): Promise<unknown>;
15
- export declare function getApp(options?: MockServerOptions): Promise<MockServer>;
16
- export default class WorkflowTestPlugin extends Plugin {
17
- load(): Promise<void>;
18
- }
@@ -1,111 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
29
- // If the importer is in node compatibility mode or this is not an ESM
30
- // file that has been converted to a CommonJS file using a Babel-
31
- // compatible transform (i.e. "__esModule" has not been set), then set
32
- // "default" to the CommonJS "module.exports" for node compatibility.
33
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
34
- mod
35
- ));
36
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
37
- var server_exports = {};
38
- __export(server_exports, {
39
- default: () => WorkflowTestPlugin,
40
- getApp: () => getApp,
41
- sleep: () => sleep
42
- });
43
- module.exports = __toCommonJS(server_exports);
44
- var import_path = __toESM(require("path"));
45
- var import_server = require("@nocobase/server");
46
- var import_test = require("@nocobase/test");
47
- var import_functions = __toESM(require("./functions"));
48
- var import_triggers = __toESM(require("./triggers"));
49
- var import_instructions = __toESM(require("./instructions"));
50
- var import_data_source_manager = require("@nocobase/data-source-manager");
51
- var import_utils = require("@nocobase/utils");
52
- function sleep(ms) {
53
- return new Promise((resolve) => {
54
- setTimeout(resolve, ms);
55
- });
56
- }
57
- async function getApp(options = {}) {
58
- const { plugins = [], collectionsPath, ...others } = options;
59
- class TestCollectionPlugin extends import_server.Plugin {
60
- async load() {
61
- if (collectionsPath) {
62
- await this.db.import({ directory: collectionsPath });
63
- }
64
- }
65
- }
66
- const app = await (0, import_test.createMockServer)({
67
- ...others,
68
- plugins: [
69
- [
70
- "workflow",
71
- {
72
- triggers: import_triggers.default,
73
- instructions: import_instructions.default,
74
- functions: import_functions.default
75
- }
76
- ],
77
- "workflow-test",
78
- TestCollectionPlugin,
79
- ...plugins
80
- ]
81
- });
82
- await app.dataSourceManager.add(
83
- new import_data_source_manager.SequelizeDataSource({
84
- name: "another",
85
- collectionManager: {
86
- database: (0, import_test.mockDatabase)({
87
- tablePrefix: `t${(0, import_utils.uid)(5)}`
88
- })
89
- },
90
- resourceManager: {}
91
- })
92
- );
93
- const another = app.dataSourceManager.dataSources.get("another");
94
- const anotherDB = another.collectionManager.db;
95
- await anotherDB.import({
96
- directory: import_path.default.resolve(__dirname, "collections")
97
- });
98
- await anotherDB.sync();
99
- another.acl.allow("*", "*");
100
- return app;
101
- }
102
- class WorkflowTestPlugin extends import_server.Plugin {
103
- async load() {
104
- await this.importCollections(import_path.default.resolve(__dirname, "collections"));
105
- }
106
- }
107
- // Annotate the CommonJS export names for ESM import in node:
108
- 0 && (module.exports = {
109
- getApp,
110
- sleep
111
- });
@@ -1,49 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- echo: {
11
- run({ config }: any, { result }: {
12
- result: any;
13
- }, processor: any): {
14
- status: number;
15
- result: any;
16
- };
17
- };
18
- error: {
19
- run(node: any, input: any, processor: any): never;
20
- };
21
- pending: {
22
- run(node: any, input: any, processor: any): {
23
- status: number;
24
- };
25
- };
26
- prompt: {
27
- run(node: any, input: any, processor: any): {
28
- status: number;
29
- };
30
- resume(node: any, job: any, processor: any): any;
31
- };
32
- 'prompt->error': {
33
- run(node: any, input: any, processor: any): {
34
- status: number;
35
- };
36
- resume(node: any, input: any, processor: any): any;
37
- };
38
- customizedSuccess: {
39
- run(node: any, input: any, processor: any): {
40
- status: number;
41
- };
42
- };
43
- customizedError: {
44
- run(node: any, input: any, processor: any): {
45
- status: number;
46
- };
47
- };
48
- };
49
- export default _default;
@@ -1,91 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var instructions_exports = {};
28
- __export(instructions_exports, {
29
- default: () => instructions_default
30
- });
31
- module.exports = __toCommonJS(instructions_exports);
32
- var import_utils = require("@nocobase/utils");
33
- var instructions_default = {
34
- echo: {
35
- run({ config = {} }, { result }, processor) {
36
- return {
37
- status: 1,
38
- result: config.path == null ? result : import_utils.lodash.get(result, config.path)
39
- };
40
- }
41
- },
42
- error: {
43
- run(node, input, processor) {
44
- throw new Error("definite error");
45
- }
46
- },
47
- pending: {
48
- run(node, input, processor) {
49
- return {
50
- status: 0
51
- };
52
- }
53
- },
54
- prompt: {
55
- run(node, input, processor) {
56
- return {
57
- status: 0
58
- };
59
- },
60
- resume(node, job, processor) {
61
- return job.set({
62
- status: 1
63
- });
64
- }
65
- },
66
- "prompt->error": {
67
- run(node, input, processor) {
68
- return {
69
- status: 0
70
- };
71
- },
72
- resume(node, input, processor) {
73
- throw new Error("input failed");
74
- return null;
75
- }
76
- },
77
- customizedSuccess: {
78
- run(node, input, processor) {
79
- return {
80
- status: 100
81
- };
82
- }
83
- },
84
- customizedError: {
85
- run(node, input, processor) {
86
- return {
87
- status: -100
88
- };
89
- }
90
- }
91
- };
@@ -1,28 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- declare const _default: {
10
- syncTrigger: {
11
- new (workflow: any): {
12
- readonly workflow: any;
13
- on(): void;
14
- off(): void;
15
- sync: boolean;
16
- validateEvent(): boolean;
17
- };
18
- };
19
- asyncTrigger: {
20
- new (workflow: any): {
21
- readonly workflow: any;
22
- on(): void;
23
- off(): void;
24
- validateEvent(): boolean;
25
- };
26
- };
27
- };
28
- export default _default;
@@ -1,58 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var triggers_exports = {};
28
- __export(triggers_exports, {
29
- default: () => triggers_default
30
- });
31
- module.exports = __toCommonJS(triggers_exports);
32
- var triggers_default = {
33
- syncTrigger: class {
34
- constructor(workflow) {
35
- this.workflow = workflow;
36
- }
37
- on() {
38
- }
39
- off() {
40
- }
41
- sync = true;
42
- validateEvent() {
43
- return true;
44
- }
45
- },
46
- asyncTrigger: class {
47
- constructor(workflow) {
48
- this.workflow = workflow;
49
- }
50
- on() {
51
- }
52
- off() {
53
- }
54
- validateEvent() {
55
- return true;
56
- }
57
- }
58
- };