@tachybase/module-data-source 0.23.8

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 (122) hide show
  1. package/.turbo/turbo-build.log +14 -0
  2. package/LICENSE +201 -0
  3. package/README.md +1 -0
  4. package/client.d.ts +2 -0
  5. package/client.js +1 -0
  6. package/dist/client/DatabaseConnectionProvider.d.ts +3 -0
  7. package/dist/client/ThridDataSource.d.ts +4 -0
  8. package/dist/client/component/BreadcumbTitle.d.ts +2 -0
  9. package/dist/client/component/CollectionsManager/AddFieldAction.d.ts +5 -0
  10. package/dist/client/component/CollectionsManager/CollectionFields.d.ts +8 -0
  11. package/dist/client/component/CollectionsManager/ConfigurationTable.d.ts +2 -0
  12. package/dist/client/component/CollectionsManager/ConfigurationTabs.d.ts +2 -0
  13. package/dist/client/component/CollectionsManager/EditCollectionAction.d.ts +6 -0
  14. package/dist/client/component/CollectionsManager/EditFieldAction.d.ts +2 -0
  15. package/dist/client/component/CollectionsManager/components/CollectionFieldInterfaceSelect.d.ts +2 -0
  16. package/dist/client/component/CollectionsManager/components/CollectionName.d.ts +1 -0
  17. package/dist/client/component/CollectionsManager/components/FieldTitleInput.d.ts +2 -0
  18. package/dist/client/component/CollectionsManager/components/FieldType.d.ts +2 -0
  19. package/dist/client/component/CollectionsManager/components/TitleField.d.ts +2 -0
  20. package/dist/client/component/CollectionsManager/components/UnSupportFields.d.ts +2 -0
  21. package/dist/client/component/CollectionsManager/components/index.d.ts +6 -0
  22. package/dist/client/component/CollectionsManager/hooks.d.ts +12 -0
  23. package/dist/client/component/CollectionsManager/index.d.ts +2 -0
  24. package/dist/client/component/CollectionsManager/schema/collectionFields.d.ts +4 -0
  25. package/dist/client/component/CollectionsManager/schema/collections.d.ts +8 -0
  26. package/dist/client/component/CreateDatabaseConnectAction.d.ts +2 -0
  27. package/dist/client/component/DatabaseConnectionManager.d.ts +2 -0
  28. package/dist/client/component/DatasourceLink.d.ts +2 -0
  29. package/dist/client/component/EditDatabaseConnectionAction.d.ts +2 -0
  30. package/dist/client/component/MainDataSourceManager/Configuration/AddCategoryAction.d.ts +3 -0
  31. package/dist/client/component/MainDataSourceManager/Configuration/CollectionFields.d.ts +2 -0
  32. package/dist/client/component/MainDataSourceManager/Configuration/CollectionFieldsTable.d.ts +15 -0
  33. package/dist/client/component/MainDataSourceManager/Configuration/CollectionFieldsTableArray.d.ts +8 -0
  34. package/dist/client/component/MainDataSourceManager/Configuration/ConfigurationTable.d.ts +2 -0
  35. package/dist/client/component/MainDataSourceManager/Configuration/ConfigurationTabs.d.ts +2 -0
  36. package/dist/client/component/MainDataSourceManager/Configuration/EditCategoryAction.d.ts +3 -0
  37. package/dist/client/component/MainDataSourceManager/Configuration/index.d.ts +6 -0
  38. package/dist/client/component/MainDataSourceManager/Configuration/interfaces.d.ts +16 -0
  39. package/dist/client/component/MainDataSourceManager/Configuration/schemas/collectionFields.d.ts +5 -0
  40. package/dist/client/component/MainDataSourceManager/Configuration/schemas/collections.d.ts +7 -0
  41. package/dist/client/component/MainDataSourceManager/index.d.ts +2 -0
  42. package/dist/client/component/PermissionManager/DataSourceTable.d.ts +3 -0
  43. package/dist/client/component/PermissionManager/PermisionProvider.d.ts +5 -0
  44. package/dist/client/component/PermissionManager/RoleConfigure.d.ts +2 -0
  45. package/dist/client/component/PermissionManager/RolesResourcesActions.d.ts +3 -0
  46. package/dist/client/component/PermissionManager/ScopeSelect.d.ts +3 -0
  47. package/dist/client/component/PermissionManager/StrategyActions.d.ts +2 -0
  48. package/dist/client/component/PermissionManager/index.d.ts +3 -0
  49. package/dist/client/component/PermissionManager/schemas/dataSourceTable.d.ts +2 -0
  50. package/dist/client/component/PermissionManager/schemas/roleCollections.d.ts +2 -0
  51. package/dist/client/component/PermissionManager/schemas/scopes.d.ts +11 -0
  52. package/dist/client/component/PermissionManager/schemas/useRoleResourceValues.d.ts +8 -0
  53. package/dist/client/component/PermissionManager/schemas/useSaveRoleResourceAction.d.ts +3 -0
  54. package/dist/client/component/PermissionManager/style.d.ts +1 -0
  55. package/dist/client/component/ViewDatabaseConnectionAction.d.ts +2 -0
  56. package/dist/client/constant.d.ts +4 -0
  57. package/dist/client/hooks/index.d.ts +6 -0
  58. package/dist/client/index.d.ts +9 -0
  59. package/dist/client/index.js +56 -0
  60. package/dist/client/locale/index.d.ts +3 -0
  61. package/dist/client/schema/index.d.ts +7 -0
  62. package/dist/externalVersion.js +19 -0
  63. package/dist/index.d.ts +2 -0
  64. package/dist/index.js +39 -0
  65. package/dist/locale/zh-CN.json +35 -0
  66. package/dist/server/collections/data-sources-collections.d.ts +2 -0
  67. package/dist/server/collections/data-sources-collections.js +66 -0
  68. package/dist/server/collections/data-sources-fields.d.ts +2 -0
  69. package/dist/server/collections/data-sources-fields.js +87 -0
  70. package/dist/server/collections/data-sources-roles-resources-actions.d.ts +2 -0
  71. package/dist/server/collections/data-sources-roles-resources-actions.js +52 -0
  72. package/dist/server/collections/data-sources-roles-resources-scopes.d.ts +2 -0
  73. package/dist/server/collections/data-sources-roles-resources-scopes.js +56 -0
  74. package/dist/server/collections/data-sources-roles-resources.d.ts +2 -0
  75. package/dist/server/collections/data-sources-roles-resources.js +62 -0
  76. package/dist/server/collections/data-sources-roles.d.ts +2 -0
  77. package/dist/server/collections/data-sources-roles.js +54 -0
  78. package/dist/server/collections/data-sources.d.ts +2 -0
  79. package/dist/server/collections/data-sources.js +71 -0
  80. package/dist/server/errors/type-infer-error.d.ts +2 -0
  81. package/dist/server/errors/type-infer-error.js +28 -0
  82. package/dist/server/index.d.ts +2 -0
  83. package/dist/server/index.js +39 -0
  84. package/dist/server/migrations/20240301164024-migrate-acl-resources.d.ts +7 -0
  85. package/dist/server/migrations/20240301164024-migrate-acl-resources.js +117 -0
  86. package/dist/server/models/connections-roles-resources-action.d.ts +3 -0
  87. package/dist/server/models/connections-roles-resources-action.js +29 -0
  88. package/dist/server/models/connections-roles-resources.d.ts +3 -0
  89. package/dist/server/models/connections-roles-resources.js +29 -0
  90. package/dist/server/models/data-source.d.ts +18 -0
  91. package/dist/server/models/data-source.js +170 -0
  92. package/dist/server/models/data-sources-collection-model.d.ts +7 -0
  93. package/dist/server/models/data-sources-collection-model.js +37 -0
  94. package/dist/server/models/data-sources-field-model.d.ts +10 -0
  95. package/dist/server/models/data-sources-field-model.js +54 -0
  96. package/dist/server/models/data-sources-roles-model.d.ts +13 -0
  97. package/dist/server/models/data-sources-roles-model.js +58 -0
  98. package/dist/server/plugin.d.ts +13 -0
  99. package/dist/server/plugin.js +448 -0
  100. package/dist/server/resourcers/data-sources-collections-fields.d.ts +11 -0
  101. package/dist/server/resourcers/data-sources-collections-fields.js +131 -0
  102. package/dist/server/resourcers/data-sources-collections.d.ts +8 -0
  103. package/dist/server/resourcers/data-sources-collections.js +106 -0
  104. package/dist/server/resourcers/data-sources-resources.d.ts +9 -0
  105. package/dist/server/resourcers/data-sources-resources.js +88 -0
  106. package/dist/server/resourcers/data-sources-roles.d.ts +8 -0
  107. package/dist/server/resourcers/data-sources-roles.js +89 -0
  108. package/dist/server/resourcers/roles-data-sources-collections.d.ts +7 -0
  109. package/dist/server/resourcers/roles-data-sources-collections.js +102 -0
  110. package/dist/server/services/collection-manager.d.ts +6 -0
  111. package/dist/server/services/collection-manager.js +33 -0
  112. package/dist/server/services/database-introspector.d.ts +70 -0
  113. package/dist/server/services/database-introspector.js +235 -0
  114. package/dist/server/services/full-data-repository.d.ts +8 -0
  115. package/dist/server/services/full-data-repository.js +51 -0
  116. package/dist/server/services/type-interface-map.d.ts +183 -0
  117. package/dist/server/services/type-interface-map.js +243 -0
  118. package/dist/server/utils.d.ts +1 -0
  119. package/dist/server/utils.js +38 -0
  120. package/package.json +36 -0
  121. package/server.d.ts +2 -0
  122. package/server.js +1 -0
@@ -0,0 +1,87 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var data_sources_fields_exports = {};
19
+ __export(data_sources_fields_exports, {
20
+ default: () => data_sources_fields_default
21
+ });
22
+ module.exports = __toCommonJS(data_sources_fields_exports);
23
+ var import_database = require("@tachybase/database");
24
+ var data_sources_fields_default = (0, import_database.defineCollection)({
25
+ name: "dataSourcesFields",
26
+ model: "DataSourcesFieldModel",
27
+ dumpRules: "required",
28
+ shared: true,
29
+ autoGenId: false,
30
+ timestamps: false,
31
+ indexes: [
32
+ {
33
+ unique: true,
34
+ fields: ["name", "collectionName", "dataSourceKey"]
35
+ }
36
+ ],
37
+ fields: [
38
+ {
39
+ type: "uid",
40
+ name: "key",
41
+ primaryKey: true
42
+ },
43
+ {
44
+ type: "string",
45
+ name: "name"
46
+ },
47
+ {
48
+ type: "string",
49
+ name: "collectionName"
50
+ },
51
+ {
52
+ type: "string",
53
+ name: "interface",
54
+ allowNull: true
55
+ },
56
+ {
57
+ type: "string",
58
+ name: "description",
59
+ allowNull: true
60
+ },
61
+ {
62
+ type: "json",
63
+ name: "uiSchema",
64
+ default: {}
65
+ },
66
+ {
67
+ type: "belongsTo",
68
+ name: "collection",
69
+ target: "dataSourcesCollections",
70
+ foreignKey: "collectionKey",
71
+ targetKey: "key",
72
+ onDelete: "CASCADE"
73
+ },
74
+ {
75
+ type: "belongsTo",
76
+ name: "dataSources",
77
+ foreignKey: "dataSourceKey",
78
+ onDelete: "CASCADE"
79
+ },
80
+ {
81
+ type: "json",
82
+ name: "options",
83
+ defaultValue: {},
84
+ translation: true
85
+ }
86
+ ]
87
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@tachybase/database").CollectionOptions;
2
+ export default _default;
@@ -0,0 +1,52 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var data_sources_roles_resources_actions_exports = {};
19
+ __export(data_sources_roles_resources_actions_exports, {
20
+ default: () => data_sources_roles_resources_actions_default
21
+ });
22
+ module.exports = __toCommonJS(data_sources_roles_resources_actions_exports);
23
+ var import_database = require("@tachybase/database");
24
+ var data_sources_roles_resources_actions_default = (0, import_database.defineCollection)({
25
+ dumpRules: "required",
26
+ name: "dataSourcesRolesResourcesActions",
27
+ model: "DataSourcesRolesResourcesActionModel",
28
+ fields: [
29
+ {
30
+ type: "belongsTo",
31
+ name: "resource",
32
+ foreignKey: "rolesResourceId",
33
+ target: "dataSourcesRolesResources"
34
+ },
35
+ {
36
+ type: "string",
37
+ name: "name"
38
+ },
39
+ {
40
+ type: "array",
41
+ name: "fields",
42
+ defaultValue: []
43
+ },
44
+ {
45
+ type: "belongsTo",
46
+ name: "scope",
47
+ target: "dataSourcesRolesResourcesScopes",
48
+ onDelete: "RESTRICT",
49
+ foreignKey: "scopeId"
50
+ }
51
+ ]
52
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@tachybase/database").CollectionOptions;
2
+ export default _default;
@@ -0,0 +1,56 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var data_sources_roles_resources_scopes_exports = {};
19
+ __export(data_sources_roles_resources_scopes_exports, {
20
+ default: () => data_sources_roles_resources_scopes_default
21
+ });
22
+ module.exports = __toCommonJS(data_sources_roles_resources_scopes_exports);
23
+ var import_database = require("@tachybase/database");
24
+ var data_sources_roles_resources_scopes_default = (0, import_database.defineCollection)({
25
+ dumpRules: "required",
26
+ name: "dataSourcesRolesResourcesScopes",
27
+ fields: [
28
+ {
29
+ type: "uid",
30
+ name: "key"
31
+ },
32
+ {
33
+ name: "dataSourceKey",
34
+ type: "string",
35
+ defaultValue: "main"
36
+ },
37
+ {
38
+ type: "belongsTo",
39
+ name: "dataSources",
40
+ foreignKey: "dataSourceKey",
41
+ onDelete: "CASCADE"
42
+ },
43
+ {
44
+ type: "string",
45
+ name: "name"
46
+ },
47
+ {
48
+ type: "string",
49
+ name: "resourceName"
50
+ },
51
+ {
52
+ type: "json",
53
+ name: "scope"
54
+ }
55
+ ]
56
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@tachybase/database").CollectionOptions;
2
+ export default _default;
@@ -0,0 +1,62 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var data_sources_roles_resources_exports = {};
19
+ __export(data_sources_roles_resources_exports, {
20
+ default: () => data_sources_roles_resources_default
21
+ });
22
+ module.exports = __toCommonJS(data_sources_roles_resources_exports);
23
+ var import_database = require("@tachybase/database");
24
+ var data_sources_roles_resources_default = (0, import_database.defineCollection)({
25
+ dumpRules: "required",
26
+ name: "dataSourcesRolesResources",
27
+ model: "DataSourcesRolesResourcesModel",
28
+ fields: [
29
+ {
30
+ name: "dataSourceKey",
31
+ type: "string",
32
+ defaultValue: "main"
33
+ },
34
+ {
35
+ type: "belongsTo",
36
+ name: "dataSources",
37
+ foreignKey: "dataSourceKey",
38
+ onDelete: "CASCADE"
39
+ },
40
+ {
41
+ type: "belongsTo",
42
+ name: "role",
43
+ target: "roles",
44
+ foreignKey: "roleName",
45
+ onDelete: "CASCADE"
46
+ },
47
+ {
48
+ type: "string",
49
+ name: "name"
50
+ },
51
+ {
52
+ type: "boolean",
53
+ name: "usingActionsConfig"
54
+ },
55
+ {
56
+ type: "hasMany",
57
+ name: "actions",
58
+ target: "dataSourcesRolesResourcesActions",
59
+ foreignKey: "rolesResourceId"
60
+ }
61
+ ]
62
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@tachybase/database").CollectionOptions;
2
+ export default _default;
@@ -0,0 +1,54 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var data_sources_roles_exports = {};
19
+ __export(data_sources_roles_exports, {
20
+ default: () => data_sources_roles_default
21
+ });
22
+ module.exports = __toCommonJS(data_sources_roles_exports);
23
+ var import_database = require("@tachybase/database");
24
+ var data_sources_roles_default = (0, import_database.defineCollection)({
25
+ name: "dataSourcesRoles",
26
+ dumpRules: "required",
27
+ autoGenId: false,
28
+ timestamps: false,
29
+ model: "DataSourcesRolesModel",
30
+ fields: [
31
+ {
32
+ type: "uid",
33
+ name: "id",
34
+ primaryKey: true
35
+ },
36
+ {
37
+ type: "belongsTo",
38
+ name: "dataSources",
39
+ foreignKey: "dataSourceKey",
40
+ onDelete: "CASCADE"
41
+ },
42
+ {
43
+ type: "belongsTo",
44
+ name: "role",
45
+ target: "roles",
46
+ foreignKey: "roleName",
47
+ onDelete: "CASCADE"
48
+ },
49
+ {
50
+ type: "json",
51
+ name: "strategy"
52
+ }
53
+ ]
54
+ });
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@tachybase/database").CollectionOptions;
2
+ export default _default;
@@ -0,0 +1,71 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var data_sources_exports = {};
19
+ __export(data_sources_exports, {
20
+ default: () => data_sources_default
21
+ });
22
+ module.exports = __toCommonJS(data_sources_exports);
23
+ var import_database = require("@tachybase/database");
24
+ var data_sources_default = (0, import_database.defineCollection)({
25
+ name: "dataSources",
26
+ model: "DataSourceModel",
27
+ autoGenId: false,
28
+ shared: true,
29
+ dumpRules: "required",
30
+ fields: [
31
+ {
32
+ type: "string",
33
+ name: "key",
34
+ primaryKey: true
35
+ },
36
+ {
37
+ type: "string",
38
+ name: "displayName"
39
+ },
40
+ {
41
+ type: "string",
42
+ name: "type"
43
+ },
44
+ {
45
+ type: "json",
46
+ name: "options"
47
+ },
48
+ {
49
+ type: "boolean",
50
+ name: "enabled",
51
+ defaultValue: true
52
+ },
53
+ {
54
+ type: "boolean",
55
+ name: "fixed",
56
+ defaultValue: false
57
+ },
58
+ {
59
+ type: "hasMany",
60
+ name: "collections",
61
+ target: "dataSourcesCollections",
62
+ foreignKey: "dataSourceKey"
63
+ },
64
+ {
65
+ type: "hasMany",
66
+ name: "rolesResourcesScopes",
67
+ target: "dataSourcesRolesResourcesScopes",
68
+ foreignKey: "dataSourceKey"
69
+ }
70
+ ]
71
+ });
@@ -0,0 +1,2 @@
1
+ export declare class TypeInferError extends Error {
2
+ }
@@ -0,0 +1,28 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var type_infer_error_exports = {};
19
+ __export(type_infer_error_exports, {
20
+ TypeInferError: () => TypeInferError
21
+ });
22
+ module.exports = __toCommonJS(type_infer_error_exports);
23
+ class TypeInferError extends Error {
24
+ }
25
+ // Annotate the CommonJS export names for ESM import in node:
26
+ 0 && (module.exports = {
27
+ TypeInferError
28
+ });
@@ -0,0 +1,2 @@
1
+ export { default } from './plugin';
2
+ export * from './utils';
@@ -0,0 +1,39 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+ var server_exports = {};
30
+ __export(server_exports, {
31
+ default: () => import_plugin.default
32
+ });
33
+ module.exports = __toCommonJS(server_exports);
34
+ var import_plugin = __toESM(require("./plugin"));
35
+ __reExport(server_exports, require("./utils"), module.exports);
36
+ // Annotate the CommonJS export names for ESM import in node:
37
+ 0 && (module.exports = {
38
+ ...require("./utils")
39
+ });
@@ -0,0 +1,7 @@
1
+ import { Migration } from '@tachybase/server';
2
+ export default class extends Migration {
3
+ on: string;
4
+ appVersion: string;
5
+ up(): Promise<void>;
6
+ doUp(transaction: any): Promise<void>;
7
+ }
@@ -0,0 +1,117 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var migrate_acl_resources_exports = {};
19
+ __export(migrate_acl_resources_exports, {
20
+ default: () => migrate_acl_resources_default
21
+ });
22
+ module.exports = __toCommonJS(migrate_acl_resources_exports);
23
+ var import_server = require("@tachybase/server");
24
+ var import_utils = require("@tachybase/utils");
25
+ class migrate_acl_resources_default extends import_server.Migration {
26
+ on = "afterSync";
27
+ // 'beforeLoad' or 'afterLoad'
28
+ appVersion = "<0.19.0-alpha.10";
29
+ async up() {
30
+ const transaction = await this.db.sequelize.transaction();
31
+ try {
32
+ await this.doUp(transaction);
33
+ await transaction.commit();
34
+ } catch (e) {
35
+ throw e;
36
+ }
37
+ }
38
+ async doUp(transaction) {
39
+ const scopeMap = {};
40
+ const oldScopes = await this.db.getRepository("rolesResourcesScopes").find({
41
+ transaction
42
+ });
43
+ for (const oldScope of oldScopes) {
44
+ const key = oldScope.key;
45
+ const newScope = await this.db.getRepository("dataSourcesRolesResourcesScopes").firstOrCreate({
46
+ values: {
47
+ key,
48
+ name: oldScope.name,
49
+ resourceName: oldScope.resourceName,
50
+ scope: oldScope.scope,
51
+ dataSourceKey: "main"
52
+ },
53
+ filterKeys: ["key", "dataSourceKey"],
54
+ hooks: false,
55
+ transaction
56
+ });
57
+ scopeMap[key] = newScope.id;
58
+ }
59
+ const roles = await this.db.getRepository("roles").find({
60
+ transaction
61
+ });
62
+ for (const role of roles) {
63
+ await this.app.db.getRepository("dataSourcesRoles").updateOrCreate({
64
+ values: {
65
+ roleName: role.get("name"),
66
+ dataSourceKey: "main",
67
+ strategy: role.get("strategy"),
68
+ id: (0, import_utils.uid)()
69
+ },
70
+ filterKeys: ["roleName", "dataSourceKey"],
71
+ hooks: false,
72
+ transaction
73
+ });
74
+ }
75
+ const oldResources = await this.db.getRepository("rolesResources").find({
76
+ appends: ["actions"],
77
+ transaction
78
+ });
79
+ for (const oldResource of oldResources) {
80
+ const role = await this.db.getRepository("roles").findOne({
81
+ filter: {
82
+ name: oldResource.roleName
83
+ },
84
+ transaction
85
+ });
86
+ if (!role) {
87
+ continue;
88
+ }
89
+ const newResource = await this.db.getRepository("dataSourcesRolesResources").firstOrCreate({
90
+ values: {
91
+ name: oldResource.name,
92
+ roleName: oldResource.roleName,
93
+ usingActionsConfig: oldResource.usingActionsConfig,
94
+ dataSourceKey: "main"
95
+ },
96
+ transaction,
97
+ filterKeys: ["name"],
98
+ hooks: false
99
+ });
100
+ for (const oldAction of oldResource.actions) {
101
+ const newActionValues = {
102
+ resource: newResource.id,
103
+ name: oldAction.name,
104
+ fields: oldAction.fields
105
+ };
106
+ if (oldAction.scope) {
107
+ newActionValues.scope = scopeMap[oldAction.scope];
108
+ }
109
+ await this.db.getRepository("dataSourcesRolesResourcesActions").create({
110
+ values: newActionValues,
111
+ hooks: false,
112
+ transaction
113
+ });
114
+ }
115
+ }
116
+ }
117
+ }
@@ -0,0 +1,3 @@
1
+ import { RoleResourceActionModel } from '@tachybase/module-acl';
2
+ export declare class DataSourcesRolesResourcesActionModel extends RoleResourceActionModel {
3
+ }
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var connections_roles_resources_action_exports = {};
19
+ __export(connections_roles_resources_action_exports, {
20
+ DataSourcesRolesResourcesActionModel: () => DataSourcesRolesResourcesActionModel
21
+ });
22
+ module.exports = __toCommonJS(connections_roles_resources_action_exports);
23
+ var import_module_acl = require("@tachybase/module-acl");
24
+ class DataSourcesRolesResourcesActionModel extends import_module_acl.RoleResourceActionModel {
25
+ }
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {
28
+ DataSourcesRolesResourcesActionModel
29
+ });
@@ -0,0 +1,3 @@
1
+ import { RoleResourceModel } from '@tachybase/module-acl';
2
+ export declare class DataSourcesRolesResourcesModel extends RoleResourceModel {
3
+ }
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var connections_roles_resources_exports = {};
19
+ __export(connections_roles_resources_exports, {
20
+ DataSourcesRolesResourcesModel: () => DataSourcesRolesResourcesModel
21
+ });
22
+ module.exports = __toCommonJS(connections_roles_resources_exports);
23
+ var import_module_acl = require("@tachybase/module-acl");
24
+ class DataSourcesRolesResourcesModel extends import_module_acl.RoleResourceModel {
25
+ }
26
+ // Annotate the CommonJS export names for ESM import in node:
27
+ 0 && (module.exports = {
28
+ DataSourcesRolesResourcesModel
29
+ });