@nocobase/plugin-workflow-test 1.5.0-alpha.5 → 1.5.0-beta.1

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(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}()});
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"}})});
@@ -8,11 +8,11 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "1.5.0-alpha.5",
12
- "@nocobase/utils": "1.5.0-alpha.5",
11
+ "@nocobase/client": "1.5.0-beta.1",
12
+ "@nocobase/utils": "1.5.0-beta.1",
13
13
  "lodash": "4.17.21",
14
- "@nocobase/test": "1.5.0-alpha.5",
15
- "@nocobase/server": "1.5.0-alpha.5",
16
- "@nocobase/data-source-manager": "1.5.0-alpha.5",
17
- "@nocobase/database": "1.5.0-alpha.5"
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"
18
18
  };
@@ -7,16 +7,12 @@
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 { MockClusterOptions, MockServer } from '@nocobase/test';
11
- export { sleep } from '@nocobase/test';
12
- interface WorkflowMockServerOptions extends ApplicationOptions {
10
+ import { MockServer } from '@nocobase/test';
11
+ export interface MockServerOptions extends ApplicationOptions {
13
12
  collectionsPath?: string;
14
13
  }
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>;
14
+ export declare function sleep(ms: number): Promise<unknown>;
15
+ export declare function getApp(options?: MockServerOptions): Promise<MockServer>;
20
16
  export default class WorkflowTestPlugin extends Plugin {
21
17
  load(): Promise<void>;
22
18
  }
@@ -38,8 +38,7 @@ var server_exports = {};
38
38
  __export(server_exports, {
39
39
  default: () => WorkflowTestPlugin,
40
40
  getApp: () => getApp,
41
- getCluster: () => getCluster,
42
- sleep: () => import_test2.sleep
41
+ sleep: () => sleep
43
42
  });
44
43
  module.exports = __toCommonJS(server_exports);
45
44
  var import_path = __toESM(require("path"));
@@ -50,23 +49,23 @@ var import_triggers = __toESM(require("./triggers"));
50
49
  var import_instructions = __toESM(require("./instructions"));
51
50
  var import_data_source_manager = require("@nocobase/data-source-manager");
52
51
  var import_utils = require("@nocobase/utils");
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 });
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
+ }
58
64
  }
59
65
  }
60
- }
61
- async function getApp({
62
- plugins = [],
63
- collectionsPath,
64
- ...options
65
- } = {}) {
66
66
  const app = await (0, import_test.createMockServer)({
67
- ...options,
67
+ ...others,
68
68
  plugins: [
69
- "field-sort",
70
69
  [
71
70
  "workflow",
72
71
  {
@@ -76,7 +75,7 @@ async function getApp({
76
75
  }
77
76
  ],
78
77
  "workflow-test",
79
- [TestCollectionPlugin, { collectionsPath }],
78
+ TestCollectionPlugin,
80
79
  ...plugins
81
80
  ]
82
81
  });
@@ -100,24 +99,6 @@ async function getApp({
100
99
  another.acl.allow("*", "*");
101
100
  return app;
102
101
  }
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
- }
121
102
  class WorkflowTestPlugin extends import_server.Plugin {
122
103
  async load() {
123
104
  await this.importCollections(import_path.default.resolve(__dirname, "collections"));
@@ -126,6 +107,5 @@ class WorkflowTestPlugin extends import_server.Plugin {
126
107
  // Annotate the CommonJS export names for ESM import in node:
127
108
  0 && (module.exports = {
128
109
  getApp,
129
- getCluster,
130
110
  sleep
131
111
  });
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-alpha.5",
5
+ "version": "1.5.0-beta.1",
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": "8d24e8d2c0f3f57ceaa271438fd93db2b4150011"
14
+ "gitHead": "10c6f1f3d90e91f3aabfa80449c7ef062e90f6af"
15
15
  }