@nocobase/plugin-users 1.2.12-alpha → 1.3.0-alpha.20240710084543

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.
Files changed (57) hide show
  1. package/package.json +2 -2
  2. package/dist/client/PasswordField.d.ts +0 -10
  3. package/dist/client/RoleUsersManager.d.ts +0 -10
  4. package/dist/client/UserRolesField.d.ts +0 -10
  5. package/dist/client/UsersManagement.d.ts +0 -10
  6. package/dist/client/hooks.d.ts +0 -13
  7. package/dist/client/index.d.ts +0 -13
  8. package/dist/client/index.js +0 -10
  9. package/dist/client/locale.d.ts +0 -9
  10. package/dist/client/schemas/users.d.ts +0 -173
  11. package/dist/client/utils.d.ts +0 -9
  12. package/dist/externalVersion.js +0 -25
  13. package/dist/index.d.ts +0 -10
  14. package/dist/index.js +0 -48
  15. package/dist/locale/en-US.json +0 -7
  16. package/dist/locale/zh-CN.json +0 -7
  17. package/dist/server/actions/users.d.ts +0 -11
  18. package/dist/server/actions/users.js +0 -98
  19. package/dist/server/collections/users.d.ts +0 -10
  20. package/dist/server/collections/users.js +0 -161
  21. package/dist/server/index.d.ts +0 -10
  22. package/dist/server/index.js +0 -49
  23. package/dist/server/locale/en-US.d.ts +0 -17
  24. package/dist/server/locale/en-US.js +0 -39
  25. package/dist/server/locale/es-ES.d.ts +0 -17
  26. package/dist/server/locale/es-ES.js +0 -39
  27. package/dist/server/locale/fr-FR.d.ts +0 -17
  28. package/dist/server/locale/fr-FR.js +0 -39
  29. package/dist/server/locale/index.d.ts +0 -11
  30. package/dist/server/locale/index.js +0 -52
  31. package/dist/server/locale/ja-JP.d.ts +0 -13
  32. package/dist/server/locale/ja-JP.js +0 -35
  33. package/dist/server/locale/pt-BR.d.ts +0 -17
  34. package/dist/server/locale/pt-BR.js +0 -39
  35. package/dist/server/locale/zh-CN.d.ts +0 -17
  36. package/dist/server/locale/zh-CN.js +0 -39
  37. package/dist/server/migrations/20220818072639-add-users-phone-constraint.d.ts +0 -15
  38. package/dist/server/migrations/20220818072639-add-users-phone-constraint.js +0 -66
  39. package/dist/server/migrations/20220818072639-add-users-phone.d.ts +0 -14
  40. package/dist/server/migrations/20220818072639-add-users-phone.js +0 -64
  41. package/dist/server/migrations/20230802170800-add-username-constraint.d.ts +0 -14
  42. package/dist/server/migrations/20230802170800-add-username-constraint.js +0 -64
  43. package/dist/server/migrations/20230802170800-add-username.d.ts +0 -13
  44. package/dist/server/migrations/20230802170800-add-username.js +0 -62
  45. package/dist/server/migrations/20230802183100-update-username.d.ts +0 -14
  46. package/dist/server/migrations/20230802183100-update-username.js +0 -56
  47. package/dist/server/migrations/20230908164036-update-username-interface.d.ts +0 -14
  48. package/dist/server/migrations/20230908164036-update-username-interface.js +0 -55
  49. package/dist/server/migrations/20240410152410-update-phone-interface.d.ts +0 -14
  50. package/dist/server/migrations/20240410152410-update-phone-interface.js +0 -62
  51. package/dist/server/migrations/20240418101937-update-system-fields.d.ts +0 -14
  52. package/dist/server/migrations/20240418101937-update-system-fields.js +0 -146
  53. package/dist/server/models/UserModel.d.ts +0 -12
  54. package/dist/server/models/UserModel.js +0 -49
  55. package/dist/server/server.d.ts +0 -20
  56. package/dist/server/server.js +0 -234
  57. package/dist/swagger/index.json +0 -117
@@ -1,66 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var add_users_phone_constraint_exports = {};
28
- __export(add_users_phone_constraint_exports, {
29
- default: () => AddUsersPhoneMigration
30
- });
31
- module.exports = __toCommonJS(add_users_phone_constraint_exports);
32
- var import_database = require("@nocobase/database");
33
- var import_server = require("@nocobase/server");
34
- class AddUsersPhoneMigration extends import_server.Migration {
35
- on = "beforeLoad";
36
- appVersion = "<0.7.5-alpha.1";
37
- async up() {
38
- const collection = this.db.collection({
39
- name: "users",
40
- fields: [
41
- {
42
- type: "string",
43
- name: "phone"
44
- }
45
- ]
46
- });
47
- const tableNameWithSchema = collection.getTableNameWithSchema();
48
- const field = collection.getField("phone");
49
- const exists = await field.existsInDb();
50
- if (!exists) {
51
- await this.db.sequelize.getQueryInterface().addColumn(tableNameWithSchema, field.columnName(), {
52
- type: import_database.DataTypes.STRING
53
- });
54
- }
55
- try {
56
- await this.db.sequelize.getQueryInterface().addConstraint(tableNameWithSchema, {
57
- type: "unique",
58
- fields: [field.columnName()]
59
- });
60
- } catch (error) {
61
- }
62
- this.db.removeCollection("users");
63
- }
64
- async down() {
65
- }
66
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Migration } from '@nocobase/server';
10
- export default class AddUsersPhoneMigration extends Migration {
11
- appVersion: string;
12
- up(): Promise<void>;
13
- down(): Promise<void>;
14
- }
@@ -1,64 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var add_users_phone_exports = {};
28
- __export(add_users_phone_exports, {
29
- default: () => AddUsersPhoneMigration
30
- });
31
- module.exports = __toCommonJS(add_users_phone_exports);
32
- var import_server = require("@nocobase/server");
33
- class AddUsersPhoneMigration extends import_server.Migration {
34
- appVersion = "<0.7.5-alpha.1";
35
- async up() {
36
- const Field = this.context.db.getRepository("fields");
37
- const existed = await Field.count({
38
- filter: {
39
- name: "phone",
40
- collectionName: "users"
41
- }
42
- });
43
- if (!existed) {
44
- await Field.create({
45
- values: {
46
- name: "phone",
47
- collectionName: "users",
48
- type: "string",
49
- unique: true,
50
- interface: "phone",
51
- uiSchema: {
52
- type: "string",
53
- title: '{{t("Phone")}}',
54
- "x-component": "Input",
55
- "x-validator": "phone",
56
- require: true
57
- }
58
- }
59
- });
60
- }
61
- }
62
- async down() {
63
- }
64
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Migration } from '@nocobase/server';
10
- export default class AddUserNameMigration extends Migration {
11
- on: string;
12
- appVersion: string;
13
- up(): Promise<void>;
14
- }
@@ -1,64 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var add_username_constraint_exports = {};
28
- __export(add_username_constraint_exports, {
29
- default: () => AddUserNameMigration
30
- });
31
- module.exports = __toCommonJS(add_username_constraint_exports);
32
- var import_database = require("@nocobase/database");
33
- var import_server = require("@nocobase/server");
34
- class AddUserNameMigration extends import_server.Migration {
35
- on = "beforeLoad";
36
- appVersion = "<0.13.0-alpha.1";
37
- async up() {
38
- const collection = this.db.collection({
39
- name: "users",
40
- fields: [
41
- {
42
- type: "string",
43
- name: "username"
44
- }
45
- ]
46
- });
47
- const tableNameWithSchema = collection.getTableNameWithSchema();
48
- const field = collection.getField("username");
49
- const exists = await field.existsInDb();
50
- if (!exists) {
51
- await this.db.sequelize.getQueryInterface().addColumn(tableNameWithSchema, field.columnName(), {
52
- type: import_database.DataTypes.STRING
53
- });
54
- }
55
- try {
56
- await this.db.sequelize.getQueryInterface().addConstraint(tableNameWithSchema, {
57
- type: "unique",
58
- fields: [field.columnName()]
59
- });
60
- } catch (error) {
61
- }
62
- this.db.removeCollection("users");
63
- }
64
- }
@@ -1,13 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Migration } from '@nocobase/server';
10
- export default class AddUserNameMigration extends Migration {
11
- appVersion: string;
12
- up(): Promise<void>;
13
- }
@@ -1,62 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var add_username_exports = {};
28
- __export(add_username_exports, {
29
- default: () => AddUserNameMigration
30
- });
31
- module.exports = __toCommonJS(add_username_exports);
32
- var import_server = require("@nocobase/server");
33
- class AddUserNameMigration extends import_server.Migration {
34
- appVersion = "<0.13.0-alpha.1";
35
- async up() {
36
- const Field = this.context.db.getRepository("fields");
37
- const existed = await Field.count({
38
- filter: {
39
- name: "username",
40
- collectionName: "users"
41
- }
42
- });
43
- if (!existed) {
44
- await Field.create({
45
- values: {
46
- name: "username",
47
- collectionName: "users",
48
- type: "string",
49
- unique: true,
50
- interface: "input",
51
- uiSchema: {
52
- type: "string",
53
- title: '{{t("Username")}}',
54
- "x-component": "Input",
55
- "x-validator": { username: true },
56
- required: true
57
- }
58
- }
59
- });
60
- }
61
- }
62
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Migration } from '@nocobase/server';
10
- export default class UpdateUserNameMigration extends Migration {
11
- appVersion: string;
12
- up(): Promise<void>;
13
- down(): Promise<void>;
14
- }
@@ -1,56 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var update_username_exports = {};
28
- __export(update_username_exports, {
29
- default: () => UpdateUserNameMigration
30
- });
31
- module.exports = __toCommonJS(update_username_exports);
32
- var import_server = require("@nocobase/server");
33
- class UpdateUserNameMigration extends import_server.Migration {
34
- appVersion = "<0.13.0-alpha.1";
35
- async up() {
36
- const repo = this.context.db.getRepository("users");
37
- const user = await repo.findOne({
38
- filter: {
39
- email: "admin@nocobase.com",
40
- username: null
41
- }
42
- });
43
- if (user) {
44
- await repo.update({
45
- values: {
46
- username: process.env.INIT_ROOT_USERNAME || "nocobase"
47
- },
48
- filter: {
49
- id: user.id
50
- }
51
- });
52
- }
53
- }
54
- async down() {
55
- }
56
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Migration } from '@nocobase/server';
10
- export default class UpdateUserNameInterfaceMigration extends Migration {
11
- appVersion: string;
12
- up(): Promise<void>;
13
- down(): Promise<void>;
14
- }
@@ -1,55 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var update_username_interface_exports = {};
28
- __export(update_username_interface_exports, {
29
- default: () => UpdateUserNameInterfaceMigration
30
- });
31
- module.exports = __toCommonJS(update_username_interface_exports);
32
- var import_server = require("@nocobase/server");
33
- class UpdateUserNameInterfaceMigration extends import_server.Migration {
34
- appVersion = "<0.13.0-alpha.10";
35
- async up() {
36
- const match = await this.app.version.satisfies("<=0.13.0-alpha.8");
37
- if (!match) {
38
- return;
39
- }
40
- const Field = this.context.db.getRepository("fields");
41
- const field = await Field.findOne({
42
- filter: {
43
- name: "username",
44
- collectionName: "users",
45
- interface: "username"
46
- }
47
- });
48
- if (!field) {
49
- return;
50
- }
51
- await field.update({ interface: "input" });
52
- }
53
- async down() {
54
- }
55
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Migration } from '@nocobase/server';
10
- export default class extends Migration {
11
- on: string;
12
- appVersion: string;
13
- up(): Promise<void>;
14
- }
@@ -1,62 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var update_phone_interface_exports = {};
28
- __export(update_phone_interface_exports, {
29
- default: () => update_phone_interface_default
30
- });
31
- module.exports = __toCommonJS(update_phone_interface_exports);
32
- var import_server = require("@nocobase/server");
33
- class update_phone_interface_default extends import_server.Migration {
34
- on = "afterLoad";
35
- // 'beforeLoad' or 'afterLoad'
36
- appVersion = "<0.21.0-alpha.7";
37
- async up() {
38
- const Field = this.context.db.getRepository("fields");
39
- const field = await Field.findOne({
40
- filter: {
41
- name: "phone",
42
- collectionName: "users",
43
- interface: "phone"
44
- }
45
- });
46
- if (!field) {
47
- return;
48
- }
49
- await field.update({
50
- interface: "input",
51
- options: {
52
- ...field.options,
53
- uiSchema: {
54
- type: "string",
55
- title: '{{t("Phone")}}',
56
- "x-component": "Input",
57
- required: true
58
- }
59
- }
60
- });
61
- }
62
- }
@@ -1,14 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
- import { Migration } from '@nocobase/server';
10
- export default class extends Migration {
11
- on: string;
12
- appVersion: string;
13
- up(): Promise<void>;
14
- }
@@ -1,146 +0,0 @@
1
- /**
2
- * This file is part of the NocoBase (R) project.
3
- * Copyright (c) 2020-2024 NocoBase Co., Ltd.
4
- * Authors: NocoBase Team.
5
- *
6
- * This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
7
- * For more information, please refer to: https://www.nocobase.com/agreement.
8
- */
9
-
10
- var __defProp = Object.defineProperty;
11
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
12
- var __getOwnPropNames = Object.getOwnPropertyNames;
13
- var __hasOwnProp = Object.prototype.hasOwnProperty;
14
- var __export = (target, all) => {
15
- for (var name in all)
16
- __defProp(target, name, { get: all[name], enumerable: true });
17
- };
18
- var __copyProps = (to, from, except, desc) => {
19
- if (from && typeof from === "object" || typeof from === "function") {
20
- for (let key of __getOwnPropNames(from))
21
- if (!__hasOwnProp.call(to, key) && key !== except)
22
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
- }
24
- return to;
25
- };
26
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
- var update_system_fields_exports = {};
28
- __export(update_system_fields_exports, {
29
- default: () => update_system_fields_default
30
- });
31
- module.exports = __toCommonJS(update_system_fields_exports);
32
- var import_server = require("@nocobase/server");
33
- class update_system_fields_default extends import_server.Migration {
34
- on = "afterLoad";
35
- // 'beforeLoad' or 'afterLoad'
36
- appVersion = "<0.21.0-alpha.11";
37
- async up() {
38
- const Field = this.context.db.getRepository("fields");
39
- const createdByField = await Field.findOne({
40
- filter: {
41
- name: "createdBy",
42
- collectionName: "users",
43
- interface: null
44
- }
45
- });
46
- if (createdByField) {
47
- await createdByField.update({
48
- interface: "createdBy",
49
- options: {
50
- ...createdByField.options,
51
- uiSchema: {
52
- type: "object",
53
- title: '{{t("Created by")}}',
54
- "x-component": "AssociationField",
55
- "x-component-props": {
56
- fieldNames: {
57
- value: "id",
58
- label: "nickname"
59
- }
60
- },
61
- "x-read-pretty": true
62
- }
63
- }
64
- });
65
- }
66
- const updatedByField = await Field.findOne({
67
- filter: {
68
- name: "updatedBy",
69
- collectionName: "users",
70
- interface: null
71
- }
72
- });
73
- if (updatedByField) {
74
- await updatedByField.update({
75
- interface: "updatedBy",
76
- options: {
77
- ...updatedByField.options,
78
- uiSchema: {
79
- type: "object",
80
- title: '{{t("Last updated by")}}',
81
- "x-component": "AssociationField",
82
- "x-component-props": {
83
- fieldNames: {
84
- value: "id",
85
- label: "nickname"
86
- }
87
- },
88
- "x-read-pretty": true
89
- }
90
- }
91
- });
92
- }
93
- const createdAtField = await Field.count({
94
- filter: {
95
- name: "createdAt",
96
- collectionName: "users"
97
- }
98
- });
99
- if (!createdAtField) {
100
- await Field.create({
101
- values: {
102
- collectionName: "users",
103
- uiSchema: {
104
- "x-component-props": {
105
- dateFormat: "YYYY-MM-DD"
106
- },
107
- type: "datetime",
108
- title: '{{t("Created at")}}',
109
- "x-component": "DatePicker",
110
- "x-read-pretty": true
111
- },
112
- name: "createdAt",
113
- field: "createdAt",
114
- type: "date",
115
- interface: "createdAt"
116
- }
117
- });
118
- }
119
- const updatedAtField = await Field.count({
120
- filter: {
121
- name: "updatedAt",
122
- collectionName: "users"
123
- }
124
- });
125
- if (!updatedAtField) {
126
- await Field.create({
127
- values: {
128
- collectionName: "users",
129
- uiSchema: {
130
- "x-component-props": {
131
- dateFormat: "YYYY-MM-DD"
132
- },
133
- type: "datetime",
134
- title: '{{t("Last updated at")}}',
135
- "x-component": "DatePicker",
136
- "x-read-pretty": true
137
- },
138
- name: "updatedAt",
139
- field: "updatedAt",
140
- type: "date",
141
- interface: "updatedAt"
142
- }
143
- });
144
- }
145
- }
146
- }