@nocobase/plugin-workflow-test 2.0.0-alpha.50 → 2.0.0-alpha.52

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.
@@ -8,11 +8,11 @@
8
8
  */
9
9
 
10
10
  module.exports = {
11
- "@nocobase/client": "2.0.0-alpha.50",
12
- "@nocobase/utils": "2.0.0-alpha.50",
11
+ "@nocobase/client": "2.0.0-alpha.52",
12
+ "@nocobase/utils": "2.0.0-alpha.52",
13
13
  "lodash": "4.17.21",
14
- "@nocobase/test": "2.0.0-alpha.50",
15
- "@nocobase/server": "2.0.0-alpha.50",
16
- "@nocobase/data-source-manager": "2.0.0-alpha.50",
17
- "@nocobase/database": "2.0.0-alpha.50"
14
+ "@nocobase/test": "2.0.0-alpha.52",
15
+ "@nocobase/server": "2.0.0-alpha.52",
16
+ "@nocobase/data-source-manager": "2.0.0-alpha.52",
17
+ "@nocobase/database": "2.0.0-alpha.52"
18
18
  };
@@ -58,7 +58,8 @@ var posts_default = {
58
58
  },
59
59
  {
60
60
  type: "belongsToMany",
61
- name: "tags"
61
+ name: "tags",
62
+ through: "postsTags"
62
63
  },
63
64
  {
64
65
  type: "integer",
@@ -36,7 +36,8 @@ var tags_default = {
36
36
  fields: [
37
37
  {
38
38
  type: "belongsToMany",
39
- name: "posts"
39
+ name: "posts",
40
+ through: "postsTags"
40
41
  },
41
42
  {
42
43
  type: "string",
@@ -50,6 +50,7 @@ var import_utils = require("@nocobase/utils");
50
50
  var import_functions = __toESM(require("./functions"));
51
51
  var import_instructions = __toESM(require("./instructions"));
52
52
  var import_triggers = __toESM(require("./triggers"));
53
+ var import_database = require("@nocobase/database");
53
54
  var import_test2 = require("@nocobase/test");
54
55
  class TestCollectionPlugin extends import_server.Plugin {
55
56
  async load() {
@@ -69,6 +70,10 @@ async function getApp({
69
70
  "field-sort",
70
71
  "file-manager",
71
72
  "system-settings",
73
+ "users",
74
+ "auth",
75
+ "acl",
76
+ "data-source-manager",
72
77
  [
73
78
  "workflow",
74
79
  {
@@ -82,24 +87,35 @@ async function getApp({
82
87
  ...plugins
83
88
  ]
84
89
  });
85
- await app.dataSourceManager.add(
86
- new import_data_source_manager.SequelizeDataSource({
87
- name: "another",
88
- collectionManager: {
89
- database: await (0, import_test.createMockDatabase)({
90
+ app.dataSourceManager.factory.register("sequelize", import_data_source_manager.SequelizeDataSource);
91
+ const DataSourceRepo = app.db.getRepository("dataSources");
92
+ await DataSourceRepo.create({
93
+ values: {
94
+ key: "another",
95
+ name: "Another Data Source",
96
+ type: "sequelize",
97
+ options: {
98
+ collectionManager: {
99
+ ...(0, import_database.getConfigByEnv)(),
90
100
  tablePrefix: `t${(0, import_utils.uid)(5)}`
91
- })
92
- },
93
- resourceManager: {}
94
- })
95
- );
96
- const another = app.dataSourceManager.dataSources.get("another");
101
+ }
102
+ }
103
+ }
104
+ });
105
+ const loadStart = Date.now();
106
+ let another = app.dataSourceManager.dataSources.get("another");
107
+ while (!(another == null ? void 0 : another.collectionManager)) {
108
+ if (Date.now() - loadStart >= 5e3) {
109
+ throw new Error('Timed out waiting for the "another" data source to load');
110
+ }
111
+ await (0, import_test.sleep)(1e3);
112
+ another = app.dataSourceManager.dataSources.get("another");
113
+ }
97
114
  const anotherDB = another.collectionManager.db;
98
115
  await anotherDB.import({
99
116
  directory: import_path.default.resolve(__dirname, "collections")
100
117
  });
101
118
  await anotherDB.sync();
102
- another.acl.allow("*", "*", "loggedIn");
103
119
  return app;
104
120
  }
105
121
  async function getCluster({ plugins = [], collectionsPath, ...options }) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "displayName": "Workflow: test kit",
4
4
  "displayName.ru-RU": "Рабочий процесс: Набор тестов",
5
5
  "displayName.zh-CN": "工作流:测试工具包",
6
- "version": "2.0.0-alpha.50",
6
+ "version": "2.0.0-alpha.52",
7
7
  "license": "AGPL-3.0",
8
8
  "main": "dist/server/index.js",
9
9
  "types": "./dist/server/index.d.ts",
@@ -15,5 +15,5 @@
15
15
  "nocobase": {
16
16
  "internal": true
17
17
  },
18
- "gitHead": "a6eb64abf3632e116ad0b295a7f410270a1059d1"
18
+ "gitHead": "b32992d8baeb4ca6616d839ca2f9c023d49476a9"
19
19
  }