@nocobase/plugin-data-source-manager 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 (113) hide show
  1. package/package.json +2 -2
  2. package/dist/client/DatabaseConnectionProvider.d.ts +0 -11
  3. package/dist/client/ThridDataSource.d.ts +0 -12
  4. package/dist/client/component/BreadcumbTitle.d.ts +0 -10
  5. package/dist/client/component/CollectionsManager/AddFieldAction.d.ts +0 -13
  6. package/dist/client/component/CollectionsManager/CollectionFields.d.ts +0 -16
  7. package/dist/client/component/CollectionsManager/CollectionTitle.d.ts +0 -9
  8. package/dist/client/component/CollectionsManager/ConfigurationTable.d.ts +0 -10
  9. package/dist/client/component/CollectionsManager/ConfigurationTabs.d.ts +0 -10
  10. package/dist/client/component/CollectionsManager/EditCollectionAction.d.ts +0 -14
  11. package/dist/client/component/CollectionsManager/EditFieldAction.d.ts +0 -10
  12. package/dist/client/component/CollectionsManager/FilterTargetKeyAlert.d.ts +0 -12
  13. package/dist/client/component/CollectionsManager/SetFilterTargetKey.d.ts +0 -10
  14. package/dist/client/component/CollectionsManager/components/CollectionFieldInterfaceSelect.d.ts +0 -10
  15. package/dist/client/component/CollectionsManager/components/CollectionName.d.ts +0 -9
  16. package/dist/client/component/CollectionsManager/components/FieldTitleInput.d.ts +0 -10
  17. package/dist/client/component/CollectionsManager/components/FieldType.d.ts +0 -10
  18. package/dist/client/component/CollectionsManager/components/TitleField.d.ts +0 -10
  19. package/dist/client/component/CollectionsManager/components/UnSupportFields.d.ts +0 -10
  20. package/dist/client/component/CollectionsManager/components/index.d.ts +0 -14
  21. package/dist/client/component/CollectionsManager/hooks.d.ts +0 -20
  22. package/dist/client/component/CollectionsManager/index.d.ts +0 -10
  23. package/dist/client/component/CollectionsManager/schema/collectionFields.d.ts +0 -12
  24. package/dist/client/component/CollectionsManager/schema/collections.d.ts +0 -72
  25. package/dist/client/component/CreateDatabaseConnectAction.d.ts +0 -10
  26. package/dist/client/component/DatabaseConnectionManager.d.ts +0 -10
  27. package/dist/client/component/EditDatabaseConnectionAction.d.ts +0 -10
  28. package/dist/client/component/MainDataSourceManager/Configuration/AddCategoryAction.d.ts +0 -11
  29. package/dist/client/component/MainDataSourceManager/Configuration/CollectionFields.d.ts +0 -11
  30. package/dist/client/component/MainDataSourceManager/Configuration/ConfigurationTable.d.ts +0 -10
  31. package/dist/client/component/MainDataSourceManager/Configuration/ConfigurationTabs.d.ts +0 -10
  32. package/dist/client/component/MainDataSourceManager/Configuration/EditCategoryAction.d.ts +0 -11
  33. package/dist/client/component/MainDataSourceManager/Configuration/index.d.ts +0 -13
  34. package/dist/client/component/MainDataSourceManager/Configuration/interfaces.d.ts +0 -24
  35. package/dist/client/component/MainDataSourceManager/Configuration/schemas/collectionFields.d.ts +0 -10
  36. package/dist/client/component/MainDataSourceManager/Configuration/schemas/collections.d.ts +0 -15
  37. package/dist/client/component/MainDataSourceManager/index.d.ts +0 -10
  38. package/dist/client/component/PermissionManager/DataSourceTable.d.ts +0 -11
  39. package/dist/client/component/PermissionManager/PermisionProvider.d.ts +0 -13
  40. package/dist/client/component/PermissionManager/RoleConfigure.d.ts +0 -10
  41. package/dist/client/component/PermissionManager/RolesResourcesActions.d.ts +0 -11
  42. package/dist/client/component/PermissionManager/ScopeSelect.d.ts +0 -11
  43. package/dist/client/component/PermissionManager/StrategyActions.d.ts +0 -10
  44. package/dist/client/component/PermissionManager/index.d.ts +0 -11
  45. package/dist/client/component/PermissionManager/schemas/dataSourceTable.d.ts +0 -10
  46. package/dist/client/component/PermissionManager/schemas/roleCollections.d.ts +0 -10
  47. package/dist/client/component/PermissionManager/schemas/scopes.d.ts +0 -130
  48. package/dist/client/component/PermissionManager/schemas/useRoleResourceValues.d.ts +0 -16
  49. package/dist/client/component/PermissionManager/schemas/useSaveRoleResourceAction.d.ts +0 -11
  50. package/dist/client/component/PermissionManager/style.d.ts +0 -9
  51. package/dist/client/component/ViewDatabaseConnectionAction.d.ts +0 -10
  52. package/dist/client/constant.d.ts +0 -9
  53. package/dist/client/hooks/index.d.ts +0 -14
  54. package/dist/client/index.d.ts +0 -17
  55. package/dist/client/index.js +0 -59
  56. package/dist/client/locale/index.d.ts +0 -11
  57. package/dist/client/schema/index.d.ts +0 -15
  58. package/dist/externalVersion.js +0 -33
  59. package/dist/index.d.ts +0 -10
  60. package/dist/index.js +0 -48
  61. package/dist/locale/zh-CN.json +0 -40
  62. package/dist/server/collections/data-sources-collections.d.ts +0 -10
  63. package/dist/server/collections/data-sources-collections.js +0 -75
  64. package/dist/server/collections/data-sources-fields.d.ts +0 -10
  65. package/dist/server/collections/data-sources-fields.js +0 -96
  66. package/dist/server/collections/data-sources-roles-resources-actions.d.ts +0 -10
  67. package/dist/server/collections/data-sources-roles-resources-actions.js +0 -61
  68. package/dist/server/collections/data-sources-roles-resources-scopes.d.ts +0 -10
  69. package/dist/server/collections/data-sources-roles-resources-scopes.js +0 -65
  70. package/dist/server/collections/data-sources-roles-resources.d.ts +0 -10
  71. package/dist/server/collections/data-sources-roles-resources.js +0 -71
  72. package/dist/server/collections/data-sources-roles.d.ts +0 -10
  73. package/dist/server/collections/data-sources-roles.js +0 -63
  74. package/dist/server/collections/data-sources.d.ts +0 -10
  75. package/dist/server/collections/data-sources.js +0 -80
  76. package/dist/server/errors/type-infer-error.d.ts +0 -10
  77. package/dist/server/errors/type-infer-error.js +0 -37
  78. package/dist/server/index.d.ts +0 -10
  79. package/dist/server/index.js +0 -48
  80. package/dist/server/migrations/20240301164024-migrate-acl-resources.d.ts +0 -15
  81. package/dist/server/migrations/20240301164024-migrate-acl-resources.js +0 -127
  82. package/dist/server/migrations/20240414103927-update-snippet-name.d.ts +0 -14
  83. package/dist/server/migrations/20240414103927-update-snippet-name.js +0 -60
  84. package/dist/server/models/connections-roles-resources-action.d.ts +0 -11
  85. package/dist/server/models/connections-roles-resources-action.js +0 -38
  86. package/dist/server/models/connections-roles-resources.d.ts +0 -11
  87. package/dist/server/models/connections-roles-resources.js +0 -38
  88. package/dist/server/models/data-source.d.ts +0 -25
  89. package/dist/server/models/data-source.js +0 -173
  90. package/dist/server/models/data-sources-collection-model.d.ts +0 -15
  91. package/dist/server/models/data-sources-collection-model.js +0 -46
  92. package/dist/server/models/data-sources-field-model.d.ts +0 -18
  93. package/dist/server/models/data-sources-field-model.js +0 -63
  94. package/dist/server/models/data-sources-roles-model.d.ts +0 -17
  95. package/dist/server/models/data-sources-roles-model.js +0 -64
  96. package/dist/server/plugin.d.ts +0 -21
  97. package/dist/server/plugin.js +0 -443
  98. package/dist/server/resourcers/data-sources-collections-fields.d.ts +0 -19
  99. package/dist/server/resourcers/data-sources-collections-fields.js +0 -140
  100. package/dist/server/resourcers/data-sources-collections.d.ts +0 -16
  101. package/dist/server/resourcers/data-sources-collections.js +0 -115
  102. package/dist/server/resourcers/data-sources-resources.d.ts +0 -17
  103. package/dist/server/resourcers/data-sources-resources.js +0 -97
  104. package/dist/server/resourcers/data-sources-roles.d.ts +0 -16
  105. package/dist/server/resourcers/data-sources-roles.js +0 -98
  106. package/dist/server/resourcers/roles-data-sources-collections.d.ts +0 -15
  107. package/dist/server/resourcers/roles-data-sources-collections.js +0 -111
  108. package/dist/server/services/full-data-repository.d.ts +0 -16
  109. package/dist/server/services/full-data-repository.js +0 -60
  110. package/dist/server/services/type-interface-map.d.ts +0 -191
  111. package/dist/server/services/type-interface-map.js +0 -253
  112. package/dist/server/utils.d.ts +0 -9
  113. package/dist/server/utils.js +0 -47
@@ -1,48 +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 __create = Object.create;
11
- var __defProp = Object.defineProperty;
12
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
13
- var __getOwnPropNames = Object.getOwnPropertyNames;
14
- var __getProtoOf = Object.getPrototypeOf;
15
- var __hasOwnProp = Object.prototype.hasOwnProperty;
16
- var __export = (target, all) => {
17
- for (var name in all)
18
- __defProp(target, name, { get: all[name], enumerable: true });
19
- };
20
- var __copyProps = (to, from, except, desc) => {
21
- if (from && typeof from === "object" || typeof from === "function") {
22
- for (let key of __getOwnPropNames(from))
23
- if (!__hasOwnProp.call(to, key) && key !== except)
24
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
25
- }
26
- return to;
27
- };
28
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
29
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
30
- // If the importer is in node compatibility mode or this is not an ESM
31
- // file that has been converted to a CommonJS file using a Babel-
32
- // compatible transform (i.e. "__esModule" has not been set), then set
33
- // "default" to the CommonJS "module.exports" for node compatibility.
34
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
35
- mod
36
- ));
37
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
38
- var server_exports = {};
39
- __export(server_exports, {
40
- default: () => import_plugin.default
41
- });
42
- module.exports = __toCommonJS(server_exports);
43
- var import_plugin = __toESM(require("./plugin"));
44
- __reExport(server_exports, require("./utils"), module.exports);
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- ...require("./utils")
48
- });
@@ -1,15 +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
- doUp(transaction: any): Promise<void>;
15
- }
@@ -1,127 +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 migrate_acl_resources_exports = {};
28
- __export(migrate_acl_resources_exports, {
29
- default: () => migrate_acl_resources_default
30
- });
31
- module.exports = __toCommonJS(migrate_acl_resources_exports);
32
- var import_server = require("@nocobase/server");
33
- var import_utils = require("@nocobase/utils");
34
- /* istanbul ignore file -- @preserve */
35
- class migrate_acl_resources_default extends import_server.Migration {
36
- on = "afterSync";
37
- // 'beforeLoad' or 'afterLoad'
38
- appVersion = "<0.19.0-alpha.10";
39
- async up() {
40
- const transaction = await this.db.sequelize.transaction();
41
- try {
42
- await this.doUp(transaction);
43
- await transaction.commit();
44
- } catch (e) {
45
- throw e;
46
- }
47
- }
48
- async doUp(transaction) {
49
- const scopeMap = {};
50
- const oldScopes = await this.db.getRepository("rolesResourcesScopes").find({
51
- transaction
52
- });
53
- for (const oldScope of oldScopes) {
54
- const key = oldScope.key;
55
- const newScope = await this.db.getRepository("dataSourcesRolesResourcesScopes").firstOrCreate({
56
- values: {
57
- key,
58
- name: oldScope.name,
59
- resourceName: oldScope.resourceName,
60
- scope: oldScope.scope,
61
- dataSourceKey: "main"
62
- },
63
- filterKeys: ["key", "dataSourceKey"],
64
- hooks: false,
65
- transaction
66
- });
67
- scopeMap[key] = newScope.id;
68
- }
69
- const roles = await this.db.getRepository("roles").find({
70
- transaction
71
- });
72
- for (const role of roles) {
73
- await this.app.db.getRepository("dataSourcesRoles").updateOrCreate({
74
- values: {
75
- roleName: role.get("name"),
76
- dataSourceKey: "main",
77
- strategy: role.get("strategy"),
78
- id: (0, import_utils.uid)()
79
- },
80
- filterKeys: ["roleName", "dataSourceKey"],
81
- hooks: false,
82
- transaction
83
- });
84
- }
85
- const oldResources = await this.db.getRepository("rolesResources").find({
86
- appends: ["actions"],
87
- transaction
88
- });
89
- for (const oldResource of oldResources) {
90
- const role = await this.db.getRepository("roles").findOne({
91
- filter: {
92
- name: oldResource.roleName
93
- },
94
- transaction
95
- });
96
- if (!role) {
97
- continue;
98
- }
99
- const newResource = await this.db.getRepository("dataSourcesRolesResources").firstOrCreate({
100
- values: {
101
- name: oldResource.name,
102
- roleName: oldResource.roleName,
103
- usingActionsConfig: oldResource.usingActionsConfig,
104
- dataSourceKey: "main"
105
- },
106
- transaction,
107
- filterKeys: ["name"],
108
- hooks: false
109
- });
110
- for (const oldAction of oldResource.actions) {
111
- const newActionValues = {
112
- resource: newResource.id,
113
- name: oldAction.name,
114
- fields: oldAction.fields
115
- };
116
- if (oldAction.scope) {
117
- newActionValues.scope = scopeMap[oldAction.scope];
118
- }
119
- await this.db.getRepository("dataSourcesRolesResourcesActions").create({
120
- values: newActionValues,
121
- hooks: false,
122
- transaction
123
- });
124
- }
125
- }
126
- }
127
- }
@@ -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,60 +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_snippet_name_exports = {};
28
- __export(update_snippet_name_exports, {
29
- default: () => update_snippet_name_default
30
- });
31
- module.exports = __toCommonJS(update_snippet_name_exports);
32
- var import_server = require("@nocobase/server");
33
- class update_snippet_name_default extends import_server.Migration {
34
- on = "afterLoad";
35
- // 'beforeLoad' or 'afterLoad'
36
- appVersion = "<0.21.0-alpha.8";
37
- async up() {
38
- const roles = await this.db.getRepository("roles").find();
39
- for (const role of roles) {
40
- const snippets = await role.get("snippets");
41
- let roleNeedsUpdate = false;
42
- for (let i = 0; i < snippets.length; i++) {
43
- if (snippets[i].includes("pm.database-connections.manager")) {
44
- snippets[i] = snippets[i].replace("pm.database-connections.manager", "pm.data-source-manager");
45
- roleNeedsUpdate = true;
46
- }
47
- }
48
- if (roleNeedsUpdate) {
49
- await this.db.getRepository("roles").update({
50
- filter: {
51
- name: role.get("name")
52
- },
53
- values: {
54
- snippets: JSON.parse(JSON.stringify(snippets))
55
- }
56
- });
57
- }
58
- }
59
- }
60
- }
@@ -1,11 +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 { RoleResourceActionModel } from '@nocobase/plugin-acl';
10
- export declare class DataSourcesRolesResourcesActionModel extends RoleResourceActionModel {
11
- }
@@ -1,38 +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 connections_roles_resources_action_exports = {};
28
- __export(connections_roles_resources_action_exports, {
29
- DataSourcesRolesResourcesActionModel: () => DataSourcesRolesResourcesActionModel
30
- });
31
- module.exports = __toCommonJS(connections_roles_resources_action_exports);
32
- var import_plugin_acl = require("@nocobase/plugin-acl");
33
- class DataSourcesRolesResourcesActionModel extends import_plugin_acl.RoleResourceActionModel {
34
- }
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- DataSourcesRolesResourcesActionModel
38
- });
@@ -1,11 +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 { RoleResourceModel } from '@nocobase/plugin-acl';
10
- export declare class DataSourcesRolesResourcesModel extends RoleResourceModel {
11
- }
@@ -1,38 +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 connections_roles_resources_exports = {};
28
- __export(connections_roles_resources_exports, {
29
- DataSourcesRolesResourcesModel: () => DataSourcesRolesResourcesModel
30
- });
31
- module.exports = __toCommonJS(connections_roles_resources_exports);
32
- var import_plugin_acl = require("@nocobase/plugin-acl");
33
- class DataSourcesRolesResourcesModel extends import_plugin_acl.RoleResourceModel {
34
- }
35
- // Annotate the CommonJS export names for ESM import in node:
36
- 0 && (module.exports = {
37
- DataSourcesRolesResourcesModel
38
- });
@@ -1,25 +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 { Model, Transaction } from '@nocobase/database';
10
- import { Application } from '@nocobase/server';
11
- import { ACL } from '@nocobase/acl';
12
- export declare class DataSourceModel extends Model {
13
- isMainRecord(): boolean;
14
- loadIntoACL(options: {
15
- app: Application;
16
- acl: ACL;
17
- transaction?: Transaction;
18
- }): Promise<void>;
19
- loadIntoApplication(options: {
20
- app: Application;
21
- transaction?: Transaction;
22
- loadAtAfterStart?: boolean;
23
- }): Promise<void>;
24
- private loadLocalData;
25
- }
@@ -1,173 +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 data_source_exports = {};
28
- __export(data_source_exports, {
29
- DataSourceModel: () => DataSourceModel
30
- });
31
- module.exports = __toCommonJS(data_source_exports);
32
- var import_database = require("@nocobase/database");
33
- var import_plugin_acl = require("@nocobase/plugin-acl");
34
- const availableActions = {
35
- create: {
36
- displayName: '{{t("Add new")}}',
37
- type: "new-data",
38
- onNewRecord: true,
39
- allowConfigureFields: true
40
- },
41
- // import: {
42
- // displayName: '{{t("Import")}}',
43
- // type: 'new-data',
44
- // scope: false,
45
- // },
46
- // export: {
47
- // displayName: '{{t("Export")}}',
48
- // type: 'old-data',
49
- // allowConfigureFields: true,
50
- // },
51
- view: {
52
- displayName: '{{t("View")}}',
53
- type: "old-data",
54
- aliases: ["get", "list"],
55
- allowConfigureFields: true
56
- },
57
- update: {
58
- displayName: '{{t("Edit")}}',
59
- type: "old-data",
60
- aliases: ["update", "move"],
61
- allowConfigureFields: true
62
- },
63
- destroy: {
64
- displayName: '{{t("Delete")}}',
65
- type: "old-data"
66
- }
67
- };
68
- class DataSourceModel extends import_database.Model {
69
- isMainRecord() {
70
- return this.get("type") === "main";
71
- }
72
- async loadIntoACL(options) {
73
- const { app, acl } = options;
74
- const loadRoleIntoACL = async (model) => {
75
- await model.writeToAcl({
76
- acl
77
- });
78
- };
79
- const rolesModel = await app.db.getRepository("dataSourcesRoles").find({
80
- transaction: options.transaction,
81
- filter: {
82
- dataSourceKey: this.get("key")
83
- }
84
- });
85
- for (const roleModel of rolesModel) {
86
- await loadRoleIntoACL(roleModel);
87
- }
88
- }
89
- async loadIntoApplication(options) {
90
- const { app, loadAtAfterStart } = options;
91
- const dataSourceKey = this.get("key");
92
- const pluginDataSourceManagerServer = app.pm.get("data-source-manager");
93
- if (pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] === "loaded") {
94
- pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] = "reloading";
95
- } else {
96
- pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] = "loading";
97
- }
98
- const type = this.get("type");
99
- const createOptions = this.get("options");
100
- const dataSource = app.dataSourceManager.factory.create(type, {
101
- ...createOptions,
102
- name: dataSourceKey,
103
- logger: app.logger.child({ dataSourceKey })
104
- });
105
- if (loadAtAfterStart) {
106
- dataSource.on("loadMessage", ({ message }) => {
107
- app.setMaintainingMessage(`${message} in data source ${this.get("displayName")}`);
108
- });
109
- }
110
- const acl = dataSource.acl;
111
- for (const [actionName, actionParams] of Object.entries(availableActions)) {
112
- acl.setAvailableAction(actionName, actionParams);
113
- }
114
- acl.allow("*", "*", (ctx) => {
115
- return ctx.state.currentRole === "root";
116
- });
117
- dataSource.resourceManager.use(import_plugin_acl.setCurrentRole, { tag: "setCurrentRole", before: "acl", after: "auth" });
118
- await this.loadIntoACL({ app, acl, transaction: options.transaction });
119
- try {
120
- await app.dataSourceManager.add(dataSource, {
121
- localData: await this.loadLocalData()
122
- });
123
- } catch (e) {
124
- app.logger.error(`load data source failed, ${e}`);
125
- if (pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] === "loading") {
126
- pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] = "loading-failed";
127
- }
128
- if (pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] === "reloading") {
129
- pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] = "reloading-failed";
130
- }
131
- pluginDataSourceManagerServer.dataSourceErrors[dataSourceKey] = e;
132
- return;
133
- }
134
- pluginDataSourceManagerServer.dataSourceStatus[dataSourceKey] = "loaded";
135
- }
136
- async loadLocalData() {
137
- const dataSourceKey = this.get("key");
138
- const remoteCollections = await this.db.getRepository("dataSourcesCollections").find({
139
- filter: {
140
- dataSourceKey
141
- }
142
- });
143
- const remoteFields = await this.db.getRepository("dataSourcesFields").find({
144
- filter: {
145
- dataSourceKey
146
- }
147
- });
148
- const localData = {};
149
- for (const remoteCollection of remoteCollections) {
150
- const remoteCollectionOptions = remoteCollection.toJSON();
151
- localData[remoteCollectionOptions.name] = remoteCollectionOptions;
152
- }
153
- for (const remoteField of remoteFields) {
154
- const remoteFieldOptions = remoteField.toJSON();
155
- const collectionName = remoteFieldOptions.collectionName;
156
- if (!localData[collectionName]) {
157
- localData[collectionName] = {
158
- name: collectionName,
159
- fields: []
160
- };
161
- }
162
- if (!localData[collectionName].fields) {
163
- localData[collectionName].fields = [];
164
- }
165
- localData[collectionName].fields.push(remoteFieldOptions);
166
- }
167
- return localData;
168
- }
169
- }
170
- // Annotate the CommonJS export names for ESM import in node:
171
- 0 && (module.exports = {
172
- DataSourceModel
173
- });
@@ -1,15 +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 { MagicAttributeModel } from '@nocobase/database';
10
- import { Application } from '@nocobase/server';
11
- export declare class DataSourcesCollectionModel extends MagicAttributeModel {
12
- load(loadOptions: {
13
- app: Application;
14
- }): void;
15
- }
@@ -1,46 +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 data_sources_collection_model_exports = {};
28
- __export(data_sources_collection_model_exports, {
29
- DataSourcesCollectionModel: () => DataSourcesCollectionModel
30
- });
31
- module.exports = __toCommonJS(data_sources_collection_model_exports);
32
- var import_database = require("@nocobase/database");
33
- class DataSourcesCollectionModel extends import_database.MagicAttributeModel {
34
- load(loadOptions) {
35
- const { app } = loadOptions;
36
- const collectionOptions = this.get();
37
- const dataSourceName = this.get("dataSourceKey");
38
- const dataSource = app.dataSourceManager.dataSources.get(dataSourceName);
39
- const collection = dataSource.collectionManager.getCollection(collectionOptions.name);
40
- collection.updateOptions(collectionOptions);
41
- }
42
- }
43
- // Annotate the CommonJS export names for ESM import in node:
44
- 0 && (module.exports = {
45
- DataSourcesCollectionModel
46
- });
@@ -1,18 +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 { MagicAttributeModel } from '@nocobase/database';
10
- import { Application } from '@nocobase/server';
11
- type LoadOptions = {
12
- app: Application;
13
- };
14
- export declare class DataSourcesFieldModel extends MagicAttributeModel {
15
- load(loadOptions: LoadOptions): void;
16
- unload(loadOptions: LoadOptions): void;
17
- }
18
- export {};