@nocobase/plugin-multi-portal 2.2.0-alpha.10
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.
- package/LICENSE.txt +107 -0
- package/README.md +14 -0
- package/client-v2.d.ts +2 -0
- package/client-v2.js +1 -0
- package/client.d.ts +2 -0
- package/client.js +1 -0
- package/dist/client/index.d.ts +9 -0
- package/dist/client/index.js +10 -0
- package/dist/client/locale.d.ts +10 -0
- package/dist/client/models/index.d.ts +11 -0
- package/dist/client/plugin.d.ts +13 -0
- package/dist/client-v2/354.ead3e96143164cd5.js +10 -0
- package/dist/client-v2/499.ef2ff0c022687485.js +10 -0
- package/dist/client-v2/778.23ba409a924ee34a.js +10 -0
- package/dist/client-v2/845.f2b0ce44ae4be707.js +10 -0
- package/dist/client-v2/entryActions/PortalEntryActionModel.d.ts +52 -0
- package/dist/client-v2/entryActions/portalEntryActionStore.d.ts +36 -0
- package/dist/client-v2/entryActions/registerPortalEntryActions.d.ts +10 -0
- package/dist/client-v2/entryActions/types.d.ts +41 -0
- package/dist/client-v2/entryActions/url.d.ts +10 -0
- package/dist/client-v2/index.d.ts +9 -0
- package/dist/client-v2/index.js +10 -0
- package/dist/client-v2/layoutRegistration.d.ts +38 -0
- package/dist/client-v2/locale.d.ts +13 -0
- package/dist/client-v2/models/MultiPortalBlockModel.d.ts +13 -0
- package/dist/client-v2/models/MultiPortalMobilePageModels.d.ts +34 -0
- package/dist/client-v2/pages/MultiPortalsPage.d.ts +80 -0
- package/dist/client-v2/permissions/MultiPortalPermissionsTab.d.ts +21 -0
- package/dist/client-v2/permissions/multiPortalPermissions.d.ts +12 -0
- package/dist/client-v2/plugin.d.ts +13 -0
- package/dist/client-v2/routeRepositoryScope.d.ts +11 -0
- package/dist/client-v2/routeUrl.d.ts +18 -0
- package/dist/externalVersion.js +25 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +48 -0
- package/dist/locale/en-US.json +82 -0
- package/dist/locale/zh-CN.json +82 -0
- package/dist/node_modules/tar/dist/commonjs/create.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/create.js +82 -0
- package/dist/node_modules/tar/dist/commonjs/cwd-error.d.ts +8 -0
- package/dist/node_modules/tar/dist/commonjs/cwd-error.js +18 -0
- package/dist/node_modules/tar/dist/commonjs/extract.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/extract.js +88 -0
- package/dist/node_modules/tar/dist/commonjs/get-write-flag.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/get-write-flag.js +32 -0
- package/dist/node_modules/tar/dist/commonjs/header.d.ts +53 -0
- package/dist/node_modules/tar/dist/commonjs/header.js +312 -0
- package/dist/node_modules/tar/dist/commonjs/index.d.ts +20 -0
- package/dist/node_modules/tar/dist/commonjs/index.js +64 -0
- package/dist/node_modules/tar/dist/commonjs/index.min.js +1 -0
- package/dist/node_modules/tar/dist/commonjs/large-numbers.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/large-numbers.js +99 -0
- package/dist/node_modules/tar/dist/commonjs/list.d.ts +7 -0
- package/dist/node_modules/tar/dist/commonjs/list.js +145 -0
- package/dist/node_modules/tar/dist/commonjs/make-command.d.ts +49 -0
- package/dist/node_modules/tar/dist/commonjs/make-command.js +52 -0
- package/dist/node_modules/tar/dist/commonjs/mkdir.d.ts +25 -0
- package/dist/node_modules/tar/dist/commonjs/mkdir.js +187 -0
- package/dist/node_modules/tar/dist/commonjs/mode-fix.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/mode-fix.js +29 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-unicode.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-unicode.js +38 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/normalize-windows-path.js +12 -0
- package/dist/node_modules/tar/dist/commonjs/options.d.ts +596 -0
- package/dist/node_modules/tar/dist/commonjs/options.js +66 -0
- package/dist/node_modules/tar/dist/commonjs/pack.d.ts +105 -0
- package/dist/node_modules/tar/dist/commonjs/pack.js +545 -0
- package/dist/node_modules/tar/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/dist/commonjs/parse.d.ts +85 -0
- package/dist/node_modules/tar/dist/commonjs/parse.js +610 -0
- package/dist/node_modules/tar/dist/commonjs/path-reservations.d.ts +11 -0
- package/dist/node_modules/tar/dist/commonjs/path-reservations.js +170 -0
- package/dist/node_modules/tar/dist/commonjs/pax.d.ts +26 -0
- package/dist/node_modules/tar/dist/commonjs/pax.js +158 -0
- package/dist/node_modules/tar/dist/commonjs/process-umask.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/process-umask.js +7 -0
- package/dist/node_modules/tar/dist/commonjs/read-entry.d.ts +36 -0
- package/dist/node_modules/tar/dist/commonjs/read-entry.js +136 -0
- package/dist/node_modules/tar/dist/commonjs/replace.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/replace.js +227 -0
- package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/strip-absolute-path.js +29 -0
- package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/strip-trailing-slashes.js +18 -0
- package/dist/node_modules/tar/dist/commonjs/symlink-error.d.ts +9 -0
- package/dist/node_modules/tar/dist/commonjs/symlink-error.js +19 -0
- package/dist/node_modules/tar/dist/commonjs/types.d.ts +7 -0
- package/dist/node_modules/tar/dist/commonjs/types.js +50 -0
- package/dist/node_modules/tar/dist/commonjs/unpack.d.ts +101 -0
- package/dist/node_modules/tar/dist/commonjs/unpack.js +932 -0
- package/dist/node_modules/tar/dist/commonjs/update.d.ts +2 -0
- package/dist/node_modules/tar/dist/commonjs/update.js +33 -0
- package/dist/node_modules/tar/dist/commonjs/warn-method.d.ts +24 -0
- package/dist/node_modules/tar/dist/commonjs/warn-method.js +31 -0
- package/dist/node_modules/tar/dist/commonjs/winchars.d.ts +3 -0
- package/dist/node_modules/tar/dist/commonjs/winchars.js +14 -0
- package/dist/node_modules/tar/dist/commonjs/write-entry.d.ts +129 -0
- package/dist/node_modules/tar/dist/commonjs/write-entry.js +698 -0
- package/dist/node_modules/tar/dist/esm/create.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/create.js +76 -0
- package/dist/node_modules/tar/dist/esm/cwd-error.d.ts +8 -0
- package/dist/node_modules/tar/dist/esm/cwd-error.js +14 -0
- package/dist/node_modules/tar/dist/esm/extract.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/extract.js +49 -0
- package/dist/node_modules/tar/dist/esm/get-write-flag.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/get-write-flag.js +26 -0
- package/dist/node_modules/tar/dist/esm/header.d.ts +53 -0
- package/dist/node_modules/tar/dist/esm/header.js +275 -0
- package/dist/node_modules/tar/dist/esm/index.d.ts +20 -0
- package/dist/node_modules/tar/dist/esm/index.js +20 -0
- package/dist/node_modules/tar/dist/esm/index.min.js +4 -0
- package/dist/node_modules/tar/dist/esm/large-numbers.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/large-numbers.js +94 -0
- package/dist/node_modules/tar/dist/esm/list.d.ts +7 -0
- package/dist/node_modules/tar/dist/esm/list.js +105 -0
- package/dist/node_modules/tar/dist/esm/make-command.d.ts +49 -0
- package/dist/node_modules/tar/dist/esm/make-command.js +48 -0
- package/dist/node_modules/tar/dist/esm/mkdir.d.ts +25 -0
- package/dist/node_modules/tar/dist/esm/mkdir.js +179 -0
- package/dist/node_modules/tar/dist/esm/mode-fix.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/mode-fix.js +25 -0
- package/dist/node_modules/tar/dist/esm/normalize-unicode.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/normalize-unicode.js +34 -0
- package/dist/node_modules/tar/dist/esm/normalize-windows-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/normalize-windows-path.js +9 -0
- package/dist/node_modules/tar/dist/esm/options.d.ts +596 -0
- package/dist/node_modules/tar/dist/esm/options.js +54 -0
- package/dist/node_modules/tar/dist/esm/pack.d.ts +105 -0
- package/dist/node_modules/tar/dist/esm/pack.js +503 -0
- package/dist/node_modules/tar/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/dist/esm/parse.d.ts +85 -0
- package/dist/node_modules/tar/dist/esm/parse.js +606 -0
- package/dist/node_modules/tar/dist/esm/path-reservations.d.ts +11 -0
- package/dist/node_modules/tar/dist/esm/path-reservations.js +166 -0
- package/dist/node_modules/tar/dist/esm/pax.d.ts +26 -0
- package/dist/node_modules/tar/dist/esm/pax.js +154 -0
- package/dist/node_modules/tar/dist/esm/process-umask.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/process-umask.js +3 -0
- package/dist/node_modules/tar/dist/esm/read-entry.d.ts +36 -0
- package/dist/node_modules/tar/dist/esm/read-entry.js +132 -0
- package/dist/node_modules/tar/dist/esm/replace.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/replace.js +221 -0
- package/dist/node_modules/tar/dist/esm/strip-absolute-path.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/strip-absolute-path.js +25 -0
- package/dist/node_modules/tar/dist/esm/strip-trailing-slashes.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/strip-trailing-slashes.js +14 -0
- package/dist/node_modules/tar/dist/esm/symlink-error.d.ts +9 -0
- package/dist/node_modules/tar/dist/esm/symlink-error.js +15 -0
- package/dist/node_modules/tar/dist/esm/types.d.ts +7 -0
- package/dist/node_modules/tar/dist/esm/types.js +45 -0
- package/dist/node_modules/tar/dist/esm/unpack.d.ts +101 -0
- package/dist/node_modules/tar/dist/esm/unpack.js +891 -0
- package/dist/node_modules/tar/dist/esm/update.d.ts +2 -0
- package/dist/node_modules/tar/dist/esm/update.js +30 -0
- package/dist/node_modules/tar/dist/esm/warn-method.d.ts +24 -0
- package/dist/node_modules/tar/dist/esm/warn-method.js +27 -0
- package/dist/node_modules/tar/dist/esm/winchars.d.ts +3 -0
- package/dist/node_modules/tar/dist/esm/winchars.js +9 -0
- package/dist/node_modules/tar/dist/esm/write-entry.d.ts +129 -0
- package/dist/node_modules/tar/dist/esm/write-entry.js +656 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/index.d.ts +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/index.js +93 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/index.d.ts +3 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/index.js +85 -0
- package/dist/node_modules/tar/node_modules/chownr/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/chownr/package.json +69 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/index.d.ts +549 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/index.js +1028 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/index.d.ts +549 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/index.js +1018 -0
- package/dist/node_modules/tar/node_modules/minipass/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minipass/package.json +82 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/constants.d.ts +2 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/constants.js +123 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/index.d.ts +99 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/index.js +416 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/constants.d.ts +2 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/constants.js +117 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/index.d.ts +99 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/index.js +363 -0
- package/dist/node_modules/tar/node_modules/minizlib/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/minizlib/package.json +80 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/index.d.ts +39 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/index.js +384 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/commonjs/package.json +3 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/index.d.ts +39 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/index.js +379 -0
- package/dist/node_modules/tar/node_modules/yallist/dist/esm/package.json +3 -0
- package/dist/node_modules/tar/node_modules/yallist/package.json +68 -0
- package/dist/node_modules/tar/package.json +1 -0
- package/dist/server/collections/desktopRoutes.d.ts +14 -0
- package/dist/server/collections/desktopRoutes.js +48 -0
- package/dist/server/collections/extendRoleField.d.ts +14 -0
- package/dist/server/collections/extendRoleField.js +51 -0
- package/dist/server/collections/multiPortals.d.ts +10 -0
- package/dist/server/collections/multiPortals.js +128 -0
- package/dist/server/collections/rolesMultiPortalDesktopRoutes.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortalDesktopRoutes.js +76 -0
- package/dist/server/collections/rolesMultiPortalRoutePolicies.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortalRoutePolicies.js +73 -0
- package/dist/server/collections/rolesMultiPortals.d.ts +10 -0
- package/dist/server/collections/rolesMultiPortals.js +68 -0
- package/dist/server/ensureDefaultRoleMultiPortalAccess.d.ts +11 -0
- package/dist/server/ensureDefaultRoleMultiPortalAccess.js +70 -0
- package/dist/server/index.d.ts +9 -0
- package/dist/server/index.js +42 -0
- package/dist/server/migrations/20260723105200-drop-ui-layout-foreign-key-constraint.d.ts +13 -0
- package/dist/server/migrations/20260723105200-drop-ui-layout-foreign-key-constraint.js +104 -0
- package/dist/server/plugin.d.ts +63 -0
- package/dist/server/plugin.js +2130 -0
- package/package.json +34 -0
- package/server.d.ts +2 -0
- package/server.js +1 -0
|
@@ -0,0 +1,128 @@
|
|
|
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 multiPortals_exports = {};
|
|
28
|
+
__export(multiPortals_exports, {
|
|
29
|
+
default: () => multiPortals_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(multiPortals_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var multiPortals_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "multiPortals",
|
|
35
|
+
dumpRules: "required",
|
|
36
|
+
migrationRules: ["overwrite", "schema-only"],
|
|
37
|
+
autoGenId: false,
|
|
38
|
+
timestamps: true,
|
|
39
|
+
indexes: [
|
|
40
|
+
{
|
|
41
|
+
type: "UNIQUE",
|
|
42
|
+
fields: ["portalName"]
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
fields: [
|
|
46
|
+
{
|
|
47
|
+
name: "uid",
|
|
48
|
+
type: "string",
|
|
49
|
+
unique: true,
|
|
50
|
+
primaryKey: true,
|
|
51
|
+
allowNull: false
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: "title",
|
|
55
|
+
type: "string",
|
|
56
|
+
defaultValue: "Untitled",
|
|
57
|
+
allowNull: false
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: "icon",
|
|
61
|
+
type: "string",
|
|
62
|
+
allowNull: true
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "portalType",
|
|
66
|
+
type: "string",
|
|
67
|
+
allowNull: true
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: "portalName",
|
|
71
|
+
type: "string",
|
|
72
|
+
field: "routeName",
|
|
73
|
+
allowNull: false
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
name: "routePath",
|
|
77
|
+
type: "string",
|
|
78
|
+
allowNull: false
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "authCheck",
|
|
82
|
+
type: "boolean",
|
|
83
|
+
defaultValue: true,
|
|
84
|
+
allowNull: false
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "enabled",
|
|
88
|
+
type: "boolean",
|
|
89
|
+
defaultValue: true,
|
|
90
|
+
allowNull: false
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "options",
|
|
94
|
+
type: "json",
|
|
95
|
+
defaultValue: {},
|
|
96
|
+
allowNull: true
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: "uiLayoutUid",
|
|
100
|
+
type: "string",
|
|
101
|
+
allowNull: true,
|
|
102
|
+
hidden: true
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "createdAt",
|
|
106
|
+
type: "date",
|
|
107
|
+
field: "createdAt",
|
|
108
|
+
interface: "createdAt",
|
|
109
|
+
allowNull: true
|
|
110
|
+
},
|
|
111
|
+
{
|
|
112
|
+
name: "updatedAt",
|
|
113
|
+
type: "date",
|
|
114
|
+
field: "updatedAt",
|
|
115
|
+
interface: "updatedAt",
|
|
116
|
+
allowNull: true
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
type: "belongsTo",
|
|
120
|
+
name: "uiLayout",
|
|
121
|
+
target: "uiLayouts",
|
|
122
|
+
targetKey: "uid",
|
|
123
|
+
foreignKey: "uiLayoutUid",
|
|
124
|
+
onDelete: "RESTRICT"
|
|
125
|
+
}
|
|
126
|
+
],
|
|
127
|
+
filterTargetKey: "uid"
|
|
128
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,76 @@
|
|
|
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 rolesMultiPortalDesktopRoutes_exports = {};
|
|
28
|
+
__export(rolesMultiPortalDesktopRoutes_exports, {
|
|
29
|
+
default: () => rolesMultiPortalDesktopRoutes_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(rolesMultiPortalDesktopRoutes_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var rolesMultiPortalDesktopRoutes_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "rolesMultiPortalDesktopRoutes",
|
|
35
|
+
dumpRules: "required",
|
|
36
|
+
migrationRules: ["overwrite", "schema-only"],
|
|
37
|
+
autoGenId: false,
|
|
38
|
+
indexes: [
|
|
39
|
+
{
|
|
40
|
+
unique: true,
|
|
41
|
+
fields: ["roleName", "multiPortalUid", "desktopRouteId"]
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
fields: [
|
|
45
|
+
{
|
|
46
|
+
name: "id",
|
|
47
|
+
type: "snowflakeId",
|
|
48
|
+
primaryKey: true,
|
|
49
|
+
allowNull: false
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: "belongsTo",
|
|
53
|
+
name: "role",
|
|
54
|
+
target: "roles",
|
|
55
|
+
targetKey: "name",
|
|
56
|
+
foreignKey: "roleName",
|
|
57
|
+
onDelete: "CASCADE"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: "belongsTo",
|
|
61
|
+
name: "multiPortal",
|
|
62
|
+
target: "multiPortals",
|
|
63
|
+
targetKey: "uid",
|
|
64
|
+
foreignKey: "multiPortalUid",
|
|
65
|
+
onDelete: "CASCADE"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "belongsTo",
|
|
69
|
+
name: "desktopRoute",
|
|
70
|
+
target: "desktopRoutes",
|
|
71
|
+
targetKey: "id",
|
|
72
|
+
foreignKey: "desktopRouteId",
|
|
73
|
+
onDelete: "CASCADE"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,73 @@
|
|
|
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 rolesMultiPortalRoutePolicies_exports = {};
|
|
28
|
+
__export(rolesMultiPortalRoutePolicies_exports, {
|
|
29
|
+
default: () => rolesMultiPortalRoutePolicies_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(rolesMultiPortalRoutePolicies_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var rolesMultiPortalRoutePolicies_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "rolesMultiPortalRoutePolicies",
|
|
35
|
+
dumpRules: "required",
|
|
36
|
+
migrationRules: ["overwrite", "schema-only"],
|
|
37
|
+
autoGenId: false,
|
|
38
|
+
indexes: [
|
|
39
|
+
{
|
|
40
|
+
unique: true,
|
|
41
|
+
fields: ["roleName", "multiPortalUid"]
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
fields: [
|
|
45
|
+
{
|
|
46
|
+
name: "id",
|
|
47
|
+
type: "snowflakeId",
|
|
48
|
+
primaryKey: true,
|
|
49
|
+
allowNull: false
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: "belongsTo",
|
|
53
|
+
name: "role",
|
|
54
|
+
target: "roles",
|
|
55
|
+
targetKey: "name",
|
|
56
|
+
foreignKey: "roleName",
|
|
57
|
+
onDelete: "CASCADE"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: "belongsTo",
|
|
61
|
+
name: "multiPortal",
|
|
62
|
+
target: "multiPortals",
|
|
63
|
+
targetKey: "uid",
|
|
64
|
+
foreignKey: "multiPortalUid",
|
|
65
|
+
onDelete: "CASCADE"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "boolean",
|
|
69
|
+
name: "allowNewMenu",
|
|
70
|
+
defaultValue: false
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
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
|
+
declare const _default: import("@nocobase/database").CollectionOptions;
|
|
10
|
+
export default _default;
|
|
@@ -0,0 +1,68 @@
|
|
|
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 rolesMultiPortals_exports = {};
|
|
28
|
+
__export(rolesMultiPortals_exports, {
|
|
29
|
+
default: () => rolesMultiPortals_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(rolesMultiPortals_exports);
|
|
32
|
+
var import_database = require("@nocobase/database");
|
|
33
|
+
var rolesMultiPortals_default = (0, import_database.defineCollection)({
|
|
34
|
+
name: "rolesMultiPortals",
|
|
35
|
+
dumpRules: "required",
|
|
36
|
+
migrationRules: ["overwrite", "schema-only"],
|
|
37
|
+
autoGenId: false,
|
|
38
|
+
indexes: [
|
|
39
|
+
{
|
|
40
|
+
unique: true,
|
|
41
|
+
fields: ["roleName", "multiPortalUid"]
|
|
42
|
+
}
|
|
43
|
+
],
|
|
44
|
+
fields: [
|
|
45
|
+
{
|
|
46
|
+
name: "id",
|
|
47
|
+
type: "snowflakeId",
|
|
48
|
+
primaryKey: true,
|
|
49
|
+
allowNull: false
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
type: "belongsTo",
|
|
53
|
+
name: "role",
|
|
54
|
+
target: "roles",
|
|
55
|
+
targetKey: "name",
|
|
56
|
+
foreignKey: "roleName",
|
|
57
|
+
onDelete: "CASCADE"
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: "belongsTo",
|
|
61
|
+
name: "multiPortal",
|
|
62
|
+
target: "multiPortals",
|
|
63
|
+
targetKey: "uid",
|
|
64
|
+
foreignKey: "multiPortalUid",
|
|
65
|
+
onDelete: "CASCADE"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
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 type { Database, Model } from '@nocobase/database';
|
|
10
|
+
export declare function applyDefaultRoleMultiPortalAccess(role: Model): void;
|
|
11
|
+
export declare function ensureDefaultRoleMultiPortalAccess(db: Database): Promise<void>;
|
|
@@ -0,0 +1,70 @@
|
|
|
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 ensureDefaultRoleMultiPortalAccess_exports = {};
|
|
28
|
+
__export(ensureDefaultRoleMultiPortalAccess_exports, {
|
|
29
|
+
applyDefaultRoleMultiPortalAccess: () => applyDefaultRoleMultiPortalAccess,
|
|
30
|
+
ensureDefaultRoleMultiPortalAccess: () => ensureDefaultRoleMultiPortalAccess
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(ensureDefaultRoleMultiPortalAccess_exports);
|
|
33
|
+
const DEFAULT_ROLE_NAMES_WITH_NEW_MULTI_PORTAL_ACCESS = ["admin", "member"];
|
|
34
|
+
function isDefaultRoleNameWithNewMultiPortalAccess(value) {
|
|
35
|
+
return typeof value === "string" && DEFAULT_ROLE_NAMES_WITH_NEW_MULTI_PORTAL_ACCESS.includes(value);
|
|
36
|
+
}
|
|
37
|
+
function applyDefaultRoleMultiPortalAccess(role) {
|
|
38
|
+
if (role.get("allowNewMultiPortal") == null && isDefaultRoleNameWithNewMultiPortalAccess(role.get("name"))) {
|
|
39
|
+
role.set("allowNewMultiPortal", true);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function ensureDefaultRoleMultiPortalAccess(db) {
|
|
43
|
+
const rolesCollection = db.getCollection("roles");
|
|
44
|
+
if (!(rolesCollection == null ? void 0 : rolesCollection.getField("allowNewMultiPortal"))) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
const repository = db.getRepository("roles");
|
|
48
|
+
const roles = await repository.find({
|
|
49
|
+
filter: {
|
|
50
|
+
name: [...DEFAULT_ROLE_NAMES_WITH_NEW_MULTI_PORTAL_ACCESS]
|
|
51
|
+
},
|
|
52
|
+
fields: ["name", "allowNewMultiPortal"]
|
|
53
|
+
});
|
|
54
|
+
for (const role of roles) {
|
|
55
|
+
if (role.get("allowNewMultiPortal") != null) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
await repository.update({
|
|
59
|
+
filterByTk: role.get("name"),
|
|
60
|
+
values: {
|
|
61
|
+
allowNewMultiPortal: true
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
67
|
+
0 && (module.exports = {
|
|
68
|
+
applyDefaultRoleMultiPortalAccess,
|
|
69
|
+
ensureDefaultRoleMultiPortalAccess
|
|
70
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
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
|
+
export { default } from './plugin';
|
|
@@ -0,0 +1,42 @@
|
|
|
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 __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var server_exports = {};
|
|
38
|
+
__export(server_exports, {
|
|
39
|
+
default: () => import_plugin.default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(server_exports);
|
|
42
|
+
var import_plugin = __toESM(require("./plugin"));
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
up(): Promise<void>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
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 drop_ui_layout_foreign_key_constraint_exports = {};
|
|
28
|
+
__export(drop_ui_layout_foreign_key_constraint_exports, {
|
|
29
|
+
default: () => drop_ui_layout_foreign_key_constraint_default
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(drop_ui_layout_foreign_key_constraint_exports);
|
|
32
|
+
var import_server = require("@nocobase/server");
|
|
33
|
+
function toConstraintInfoList(value) {
|
|
34
|
+
if (!Array.isArray(value)) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
return value.filter((item) => !!item && typeof item === "object");
|
|
38
|
+
}
|
|
39
|
+
function getConstraintNames(rows) {
|
|
40
|
+
return rows.map((row) => row.constraintName).filter((constraintName) => typeof constraintName === "string" && !!constraintName);
|
|
41
|
+
}
|
|
42
|
+
class drop_ui_layout_foreign_key_constraint_default extends import_server.Migration {
|
|
43
|
+
on = "afterLoad";
|
|
44
|
+
async up() {
|
|
45
|
+
const collection = this.db.getCollection("multiPortals");
|
|
46
|
+
if (!collection) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (!this.db.isMySQLCompatibleDialect() && !this.db.isPostgresCompatibleDialect()) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const tableName = collection.getTableNameWithSchema();
|
|
53
|
+
const rawTableName = collection.model.tableName;
|
|
54
|
+
const columnName = collection.model.getAttributes().uiLayoutUid.field || "uiLayoutUid";
|
|
55
|
+
const queryInterface = this.db.sequelize.getQueryInterface();
|
|
56
|
+
const constraints = await (async () => {
|
|
57
|
+
if (this.db.isMySQLCompatibleDialect()) {
|
|
58
|
+
const [rows2] = await this.db.sequelize.query(
|
|
59
|
+
`
|
|
60
|
+
SELECT CONSTRAINT_NAME AS constraintName
|
|
61
|
+
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
|
62
|
+
WHERE TABLE_SCHEMA = DATABASE()
|
|
63
|
+
AND TABLE_NAME = :tableName
|
|
64
|
+
AND COLUMN_NAME = :columnName
|
|
65
|
+
AND REFERENCED_TABLE_NAME IS NOT NULL
|
|
66
|
+
`,
|
|
67
|
+
{
|
|
68
|
+
replacements: {
|
|
69
|
+
tableName: rawTableName,
|
|
70
|
+
columnName
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
return toConstraintInfoList(rows2);
|
|
75
|
+
}
|
|
76
|
+
const tableSchema = typeof tableName === "string" ? null : tableName.schema;
|
|
77
|
+
const [rows] = await this.db.sequelize.query(
|
|
78
|
+
`
|
|
79
|
+
SELECT kcu.constraint_name AS "constraintName"
|
|
80
|
+
FROM information_schema.key_column_usage kcu
|
|
81
|
+
JOIN information_schema.table_constraints tc
|
|
82
|
+
ON tc.constraint_catalog = kcu.constraint_catalog
|
|
83
|
+
AND tc.constraint_schema = kcu.constraint_schema
|
|
84
|
+
AND tc.constraint_name = kcu.constraint_name
|
|
85
|
+
WHERE tc.constraint_type = 'FOREIGN KEY'
|
|
86
|
+
AND kcu.table_schema = COALESCE(:tableSchema, current_schema())
|
|
87
|
+
AND kcu.table_name = :tableName
|
|
88
|
+
AND kcu.column_name = :columnName
|
|
89
|
+
`,
|
|
90
|
+
{
|
|
91
|
+
replacements: {
|
|
92
|
+
tableSchema,
|
|
93
|
+
tableName: rawTableName,
|
|
94
|
+
columnName
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
);
|
|
98
|
+
return toConstraintInfoList(rows);
|
|
99
|
+
})();
|
|
100
|
+
for (const constraintName of getConstraintNames(constraints)) {
|
|
101
|
+
await queryInterface.removeConstraint(tableName, constraintName);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|