@nocobase/plugin-user-data-sync 2.2.0-beta.9 → 2.2.0

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,18 +10,18 @@
10
10
  module.exports = {
11
11
  "react": "18.2.0",
12
12
  "@formily/react": "2.3.7",
13
- "@nocobase/client": "2.2.0-beta.9",
13
+ "@nocobase/client": "2.2.0",
14
14
  "@ant-design/icons": "5.6.1",
15
15
  "@formily/core": "2.3.7",
16
16
  "antd": "5.24.2",
17
- "@nocobase/utils": "2.2.0-beta.9",
18
- "@nocobase/flow-engine": "2.2.0-beta.9",
17
+ "@nocobase/utils": "2.2.0",
18
+ "@nocobase/flow-engine": "2.2.0",
19
19
  "react-i18next": "11.18.6",
20
- "@nocobase/client-v2": "2.2.0-beta.9",
21
- "@nocobase/server": "2.2.0-beta.9",
22
- "@nocobase/logger": "2.2.0-beta.9",
23
- "@nocobase/actions": "2.2.0-beta.9",
20
+ "@nocobase/client-v2": "2.2.0",
21
+ "@nocobase/server": "2.2.0",
22
+ "@nocobase/logger": "2.2.0",
23
+ "@nocobase/actions": "2.2.0",
24
24
  "dayjs": "1.11.13",
25
- "@nocobase/database": "2.2.0-beta.9",
25
+ "@nocobase/database": "2.2.0",
26
26
  "ahooks": "3.7.8"
27
27
  };
@@ -89,10 +89,10 @@ export declare class UserDataResourceManager {
89
89
  registerResource(resource: UserDataResource, options?: ToposortOptions): void;
90
90
  set db(value: Database);
91
91
  saveOriginRecords(data: UserData): Promise<void>;
92
- findOriginRecords({ sourceName, dataType, sourceUks }: {
93
- sourceName: any;
94
- dataType: any;
95
- sourceUks: any;
92
+ findOriginRecords({ sourceName, dataType, sourceUks, }: {
93
+ sourceName: string;
94
+ dataType: SyncDataType;
95
+ sourceUks: string[];
96
96
  }): Promise<OriginRecord[]>;
97
97
  addResourceToOriginRecord({ recordId, resource, resourcePk }: {
98
98
  recordId: any;
@@ -93,11 +93,24 @@ class UserDataResourceManager {
93
93
  }
94
94
  }
95
95
  }
96
- async findOriginRecords({ sourceName, dataType, sourceUks }) {
97
- return await this.syncRecordRepo.find({
96
+ async findOriginRecords({
97
+ sourceName,
98
+ dataType,
99
+ sourceUks
100
+ }) {
101
+ const originRecords = await this.syncRecordRepo.find({
98
102
  appends: ["resources"],
99
103
  filter: { sourceName, dataType, sourceUk: { $in: sourceUks } }
100
104
  });
105
+ const sourceUkOrder = /* @__PURE__ */ new Map();
106
+ sourceUks.forEach((sourceUk, index) => {
107
+ if (!sourceUkOrder.has(sourceUk)) {
108
+ sourceUkOrder.set(sourceUk, index);
109
+ }
110
+ });
111
+ return originRecords.sort((a, b) => {
112
+ return (sourceUkOrder.get(a.sourceUk) ?? Number.MAX_SAFE_INTEGER) - (sourceUkOrder.get(b.sourceUk) ?? Number.MAX_SAFE_INTEGER);
113
+ });
101
114
  }
102
115
  async addResourceToOriginRecord({ recordId, resource, resourcePk }) {
103
116
  const syncRecord = await this.syncRecordRepo.findOne({
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "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.",
7
7
  "description.ru-RU": "Регистрация и управление расширяемыми источниками синхронизации данных пользователей, по умолчанию предоставляется HTTP API. Поддержка синхронизации данных для таких ресурсов, как пользователи и департаменты.",
8
8
  "description.zh-CN": "注册和管理可扩展的用户数据同步来源,默认提供 HTTP API。支持向用户和部门等资源同步数据。",
9
- "version": "2.2.0-beta.9",
9
+ "version": "2.2.0",
10
10
  "main": "dist/server/index.js",
11
11
  "peerDependencies": {
12
12
  "@nocobase/client": "2.x",
@@ -18,5 +18,5 @@
18
18
  "Users & permissions"
19
19
  ],
20
20
  "license": "Apache-2.0",
21
- "gitHead": "60e3d7abbaa0c7cead76f71a4f3d5eedb6b8acdb"
21
+ "gitHead": "d5052cae37177054c236f1bf7bba3aed6ef029d0"
22
22
  }