@nocobase/plugin-workflow-test 1.5.0-beta.1 → 1.6.0-alpha.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.
@@ -7,4 +7,4 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
 
10
- (function(e,n){typeof exports=="object"&&typeof module!="undefined"?n(exports,require("@nocobase/client")):typeof define=="function"&&define.amd?define(["exports","@nocobase/client"],n):(e=typeof globalThis!="undefined"?globalThis:e||self,n(e["@nocobase/plugin-workflow-test"]={},e["@nocobase/client"]))})(this,function(e,n){"use strict";class o extends n.Plugin{}e.default=o,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
10
+ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("@nocobase/client")):"function"==typeof define&&define.amd?define("@nocobase/plugin-workflow-test",["@nocobase/client"],e):"object"==typeof exports?exports["@nocobase/plugin-workflow-test"]=e(require("@nocobase/client")):t["@nocobase/plugin-workflow-test"]=e(t["@nocobase/client"])}(self,function(t){return function(){"use strict";var e={772:function(e){e.exports=t}},n={};function o(t){var r=n[t];if(void 0!==r)return r.exports;var u=n[t]={exports:{}};return e[t](u,u.exports,o),u.exports}o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,{a:e}),e},o.d=function(t,e){for(var n in e)o.o(e,n)&&!o.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var r={};o.r(r),o.d(r,{default:function(){return p}});var u=o(772);function c(t,e,n){return(c=a()?Reflect.construct:function(t,e,n){var o=[null];o.push.apply(o,e);var r=new(Function.bind.apply(t,o));return n&&f(r,n.prototype),r}).apply(null,arguments)}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function f(t,e){return(f=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function l(t){var e="function"==typeof Map?new Map:void 0;return(l=function(t){var n;if(null===t||(n=t,-1===Function.toString.call(n).indexOf("[native code]")))return t;if("function"!=typeof t)throw TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,o)}function o(){return c(t,arguments,i(this).constructor)}return o.prototype=Object.create(t.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}),f(o,t)})(t)}function a(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch(t){}return(a=function(){return!!t})()}var p=function(t){function e(){var t,n,o;return!function(t,e){if(!(t instanceof e))throw TypeError("Cannot call a class as a function")}(this,e),t=this,n=e,o=arguments,n=i(n),function(t,e){return e&&("object"===function(t){return t&&"undefined"!=typeof Symbol&&t.constructor===Symbol?"symbol":typeof t}(e)||"function"==typeof e)?e:function(t){if(void 0===t)throw ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,a()?Reflect.construct(n,o||[],i(t).constructor):n.apply(t,o))}return!function(t,e){if("function"!=typeof e&&null!==e)throw TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&f(t,e)}(e,t),e}(l(u.Plugin));return r}()});
@@ -8,11 +8,11 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.5.0-beta.1",
12
- "@nocobase/utils": "1.5.0-beta.1",
11
+ "@nocobase/client": "1.6.0-alpha.2",
12
+ "@nocobase/utils": "1.6.0-alpha.2",
13
13
  "lodash": "4.17.21",
14
- "@nocobase/test": "1.5.0-beta.1",
15
- "@nocobase/server": "1.5.0-beta.1",
16
- "@nocobase/data-source-manager": "1.5.0-beta.1",
17
- "@nocobase/database": "1.5.0-beta.1"
14
+ "@nocobase/test": "1.6.0-alpha.2",
15
+ "@nocobase/server": "1.6.0-alpha.2",
16
+ "@nocobase/data-source-manager": "1.6.0-alpha.2",
17
+ "@nocobase/database": "1.6.0-alpha.2"
18
18
  };
@@ -7,12 +7,16 @@
7
7
  * For more information, please refer to: https://www.nocobase.com/agreement.
8
8
  */
9
9
  import { ApplicationOptions, Plugin } from '@nocobase/server';
10
- import { MockServer } from '@nocobase/test';
11
- export interface MockServerOptions extends ApplicationOptions {
10
+ import { MockClusterOptions, MockServer } from '@nocobase/test';
11
+ export { sleep } from '@nocobase/test';
12
+ interface WorkflowMockServerOptions extends ApplicationOptions {
12
13
  collectionsPath?: string;
13
14
  }
14
- export declare function sleep(ms: number): Promise<unknown>;
15
- export declare function getApp(options?: MockServerOptions): Promise<MockServer>;
15
+ interface WorkflowMockClusterOptions extends MockClusterOptions {
16
+ collectionsPath?: string;
17
+ }
18
+ export declare function getApp({ plugins, collectionsPath, ...options }?: WorkflowMockServerOptions): Promise<MockServer>;
19
+ export declare function getCluster({ plugins, collectionsPath, ...options }: WorkflowMockClusterOptions): Promise<import("@nocobase/test").MockCluster>;
16
20
  export default class WorkflowTestPlugin extends Plugin {
17
21
  load(): Promise<void>;
18
22
  }
@@ -38,7 +38,8 @@ var server_exports = {};
38
38
  __export(server_exports, {
39
39
  default: () => WorkflowTestPlugin,
40
40
  getApp: () => getApp,
41
- sleep: () => sleep
41
+ getCluster: () => getCluster,
42
+ sleep: () => import_test2.sleep
42
43
  });
43
44
  module.exports = __toCommonJS(server_exports);
44
45
  var import_path = __toESM(require("path"));
@@ -49,23 +50,23 @@ var import_triggers = __toESM(require("./triggers"));
49
50
  var import_instructions = __toESM(require("./instructions"));
50
51
  var import_data_source_manager = require("@nocobase/data-source-manager");
51
52
  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
- }
53
+ var import_test2 = require("@nocobase/test");
54
+ class TestCollectionPlugin extends import_server.Plugin {
55
+ async load() {
56
+ if (this.options.collectionsPath) {
57
+ await this.db.import({ directory: this.options.collectionsPath });
64
58
  }
65
59
  }
60
+ }
61
+ async function getApp({
62
+ plugins = [],
63
+ collectionsPath,
64
+ ...options
65
+ } = {}) {
66
66
  const app = await (0, import_test.createMockServer)({
67
- ...others,
67
+ ...options,
68
68
  plugins: [
69
+ "field-sort",
69
70
  [
70
71
  "workflow",
71
72
  {
@@ -75,7 +76,7 @@ async function getApp(options = {}) {
75
76
  }
76
77
  ],
77
78
  "workflow-test",
78
- TestCollectionPlugin,
79
+ [TestCollectionPlugin, { collectionsPath }],
79
80
  ...plugins
80
81
  ]
81
82
  });
@@ -99,6 +100,24 @@ async function getApp(options = {}) {
99
100
  another.acl.allow("*", "*");
100
101
  return app;
101
102
  }
103
+ async function getCluster({ plugins = [], collectionsPath, ...options }) {
104
+ return (0, import_test.createMockCluster)({
105
+ ...options,
106
+ plugins: [
107
+ [
108
+ "workflow",
109
+ {
110
+ triggers: import_triggers.default,
111
+ instructions: import_instructions.default,
112
+ functions: import_functions.default
113
+ }
114
+ ],
115
+ "workflow-test",
116
+ [TestCollectionPlugin, { collectionsPath }],
117
+ ...plugins
118
+ ]
119
+ });
120
+ }
102
121
  class WorkflowTestPlugin extends import_server.Plugin {
103
122
  async load() {
104
123
  await this.importCollections(import_path.default.resolve(__dirname, "collections"));
@@ -107,5 +126,6 @@ class WorkflowTestPlugin extends import_server.Plugin {
107
126
  // Annotate the CommonJS export names for ESM import in node:
108
127
  0 && (module.exports = {
109
128
  getApp,
129
+ getCluster,
110
130
  sleep
111
131
  });
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": "1.5.0-beta.1",
5
+ "version": "1.6.0-alpha.2",
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": "1.x",
12
12
  "@nocobase/test": "1.x"
13
13
  },
14
- "gitHead": "10c6f1f3d90e91f3aabfa80449c7ef062e90f6af"
14
+ "gitHead": "08bbc34c21727fc0ad0880f397a42bf7741091ee"
15
15
  }