@nocobase/plugin-user-data-sync 1.6.0-alpha.3 → 1.6.0-alpha.5

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.
@@ -10,15 +10,15 @@
10
10
  module.exports = {
11
11
  "react": "18.2.0",
12
12
  "@formily/react": "2.3.0",
13
- "@nocobase/client": "1.6.0-alpha.3",
13
+ "@nocobase/client": "1.6.0-alpha.5",
14
14
  "@ant-design/icons": "5.2.6",
15
15
  "@formily/core": "2.3.0",
16
16
  "antd": "5.12.8",
17
- "@nocobase/utils": "1.6.0-alpha.3",
18
- "@nocobase/server": "1.6.0-alpha.3",
19
- "@nocobase/logger": "1.6.0-alpha.3",
20
- "@nocobase/actions": "1.6.0-alpha.3",
17
+ "@nocobase/utils": "1.6.0-alpha.5",
18
+ "@nocobase/server": "1.6.0-alpha.5",
19
+ "@nocobase/logger": "1.6.0-alpha.5",
20
+ "@nocobase/actions": "1.6.0-alpha.5",
21
21
  "dayjs": "1.11.10",
22
- "@nocobase/database": "1.6.0-alpha.3",
22
+ "@nocobase/database": "1.6.0-alpha.5",
23
23
  "react-i18next": "11.18.6"
24
24
  };
@@ -46,6 +46,15 @@ var user_data_default = {
46
46
  const data = ctx.action.params.values || {};
47
47
  const plugin = ctx.app.pm.get(import_plugin.PluginUserDataSyncServer);
48
48
  try {
49
+ let supported = false;
50
+ for (const resource of plugin.resourceManager.resources.nodes) {
51
+ if (resource.accepts.includes(data.dataType)) {
52
+ supported = true;
53
+ }
54
+ }
55
+ if (!supported) {
56
+ throw new Error(`dataType ${data.dataType} is not supported`);
57
+ }
49
58
  const result = await plugin.syncService.push(data);
50
59
  ctx.body = { code: 0, message: "success", result };
51
60
  } catch (error) {
@@ -81,7 +81,7 @@ class PluginUserDataSyncServer extends import_server.Plugin {
81
81
  });
82
82
  this.app.acl.registerSnippet({
83
83
  name: `pm.${this.name}`,
84
- actions: ["userData:*", "userDataSyncSources:*"]
84
+ actions: ["userData:*", "userDataSyncSources:*", "userDataSyncTasks:*"]
85
85
  });
86
86
  }
87
87
  async install() {
@@ -129,14 +129,12 @@ class UserDataResourceManager {
129
129
  await this.saveOriginRecords(data);
130
130
  const { dataType, sourceName, records, matchKey } = data;
131
131
  const sourceUks = records.map((record) => record.uid);
132
- let processed = false;
133
132
  const syncResults = [];
134
133
  for (const resource of this.resources.nodes) {
135
134
  if (!resource.accepts.includes(dataType)) {
136
135
  continue;
137
136
  }
138
137
  const associateResource = resource.name;
139
- processed = true;
140
138
  const originRecords = await this.findOriginRecords({ sourceName, sourceUks, dataType });
141
139
  if (!(originRecords && originRecords.length)) {
142
140
  continue;
@@ -201,9 +199,6 @@ class UserDataResourceManager {
201
199
  }
202
200
  });
203
201
  }
204
- if (!processed) {
205
- throw new Error(`dataType "${dataType}" is not support`);
206
- }
207
202
  return syncResults;
208
203
  }
209
204
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "用户数据同步",
5
5
  "description": "Reigster and manage extensible user data synchronization sources, with HTTP API provided by default. Support for synchronizing data to resources such as users and departments.",
6
6
  "description.zh-CN": "注册和管理可扩展的用户数据同步来源,默认提供 HTTP API。支持向用户和部门等资源同步数据。",
7
- "version": "1.6.0-alpha.3",
7
+ "version": "1.6.0-alpha.5",
8
8
  "main": "dist/server/index.js",
9
9
  "peerDependencies": {
10
10
  "@nocobase/client": "1.x",
@@ -14,5 +14,5 @@
14
14
  "keywords": [
15
15
  "Users & permissions"
16
16
  ],
17
- "gitHead": "205b4aca5556d5af70679fa401394943a9e51670"
17
+ "gitHead": "b600efcab7fef54f1456ef079787f0ab4992e249"
18
18
  }