@nocobase/plugin-multi-app-manager 1.2.13-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 (175) hide show
  1. package/package.json +2 -2
  2. package/dist/client/AppManager.d.ts +0 -10
  3. package/dist/client/AppNameInput.d.ts +0 -10
  4. package/dist/client/MultiAppManagerProvider.d.ts +0 -10
  5. package/dist/client/MultiAppManagerProvider.style.d.ts +0 -13
  6. package/dist/client/Settings.d.ts +0 -10
  7. package/dist/client/index.d.ts +0 -14
  8. package/dist/client/index.js +0 -10
  9. package/dist/client/settings/schemas/applications.d.ts +0 -18
  10. package/dist/client/utils.d.ts +0 -12
  11. package/dist/externalVersion.js +0 -25
  12. package/dist/index.d.ts +0 -10
  13. package/dist/index.js +0 -48
  14. package/dist/locale/en-US.json +0 -11
  15. package/dist/locale/es-ES.json +0 -9
  16. package/dist/locale/index.d.ts +0 -9
  17. package/dist/locale/index.js +0 -36
  18. package/dist/locale/ko_KR.json +0 -11
  19. package/dist/locale/pt-BR.json +0 -9
  20. package/dist/locale/zh-CN.json +0 -14
  21. package/dist/node_modules/mariadb/LICENSE +0 -502
  22. package/dist/node_modules/mariadb/callback.js +0 -41
  23. package/dist/node_modules/mariadb/lib/cmd/batch-bulk.js +0 -278
  24. package/dist/node_modules/mariadb/lib/cmd/batch-rewrite.js +0 -372
  25. package/dist/node_modules/mariadb/lib/cmd/change-user.js +0 -149
  26. package/dist/node_modules/mariadb/lib/cmd/class/ok-packet.js +0 -17
  27. package/dist/node_modules/mariadb/lib/cmd/column-definition.js +0 -102
  28. package/dist/node_modules/mariadb/lib/cmd/command.js +0 -168
  29. package/dist/node_modules/mariadb/lib/cmd/common-binary-cmd.js +0 -327
  30. package/dist/node_modules/mariadb/lib/cmd/common-text-cmd.js +0 -427
  31. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/caching-sha2-password-auth.js +0 -168
  32. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/clear-password-auth.js +0 -23
  33. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/ed25519-password-auth.js +0 -761
  34. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/native-password-auth.js +0 -55
  35. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/pam-password-auth.js +0 -58
  36. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/plugin-auth.js +0 -19
  37. package/dist/node_modules/mariadb/lib/cmd/handshake/auth/sha256-password-auth.js +0 -142
  38. package/dist/node_modules/mariadb/lib/cmd/handshake/client-capabilities.js +0 -74
  39. package/dist/node_modules/mariadb/lib/cmd/handshake/client-handshake-response.js +0 -126
  40. package/dist/node_modules/mariadb/lib/cmd/handshake/handshake.js +0 -292
  41. package/dist/node_modules/mariadb/lib/cmd/handshake/initial-handshake.js +0 -74
  42. package/dist/node_modules/mariadb/lib/cmd/handshake/ssl-request.js +0 -29
  43. package/dist/node_modules/mariadb/lib/cmd/ping.js +0 -52
  44. package/dist/node_modules/mariadb/lib/cmd/query.js +0 -255
  45. package/dist/node_modules/mariadb/lib/cmd/quit.js +0 -28
  46. package/dist/node_modules/mariadb/lib/cmd/reset.js +0 -54
  47. package/dist/node_modules/mariadb/lib/cmd/resultset.js +0 -607
  48. package/dist/node_modules/mariadb/lib/cmd/stream.js +0 -45
  49. package/dist/node_modules/mariadb/lib/config/connection-options.js +0 -258
  50. package/dist/node_modules/mariadb/lib/config/pool-cluster-options.js +0 -19
  51. package/dist/node_modules/mariadb/lib/config/pool-options.js +0 -47
  52. package/dist/node_modules/mariadb/lib/connection-callback.js +0 -160
  53. package/dist/node_modules/mariadb/lib/connection.js +0 -1460
  54. package/dist/node_modules/mariadb/lib/const/capabilities.js +0 -64
  55. package/dist/node_modules/mariadb/lib/const/collations.js +0 -473
  56. package/dist/node_modules/mariadb/lib/const/connection_status.js +0 -13
  57. package/dist/node_modules/mariadb/lib/const/error-code.js +0 -1282
  58. package/dist/node_modules/mariadb/lib/const/field-detail.js +0 -35
  59. package/dist/node_modules/mariadb/lib/const/field-type.js +0 -71
  60. package/dist/node_modules/mariadb/lib/const/server-status.js +0 -30
  61. package/dist/node_modules/mariadb/lib/const/state-change.js +0 -12
  62. package/dist/node_modules/mariadb/lib/filtered-pool-cluster.js +0 -81
  63. package/dist/node_modules/mariadb/lib/io/bulk-packet.js +0 -590
  64. package/dist/node_modules/mariadb/lib/io/compression-input-stream.js +0 -141
  65. package/dist/node_modules/mariadb/lib/io/compression-output-stream.js +0 -171
  66. package/dist/node_modules/mariadb/lib/io/packet-input-stream.js +0 -193
  67. package/dist/node_modules/mariadb/lib/io/packet-node-encoded.js +0 -36
  68. package/dist/node_modules/mariadb/lib/io/packet-node-iconv.js +0 -37
  69. package/dist/node_modules/mariadb/lib/io/packet-output-stream.js +0 -502
  70. package/dist/node_modules/mariadb/lib/io/packet.js +0 -515
  71. package/dist/node_modules/mariadb/lib/io/rewrite-packet.js +0 -481
  72. package/dist/node_modules/mariadb/lib/misc/connection-information.js +0 -96
  73. package/dist/node_modules/mariadb/lib/misc/errors.js +0 -123
  74. package/dist/node_modules/mariadb/lib/misc/parse.js +0 -1033
  75. package/dist/node_modules/mariadb/lib/misc/utils.js +0 -298
  76. package/dist/node_modules/mariadb/lib/pool-base.js +0 -611
  77. package/dist/node_modules/mariadb/lib/pool-callback.js +0 -202
  78. package/dist/node_modules/mariadb/lib/pool-cluster-callback.js +0 -66
  79. package/dist/node_modules/mariadb/lib/pool-cluster.js +0 -407
  80. package/dist/node_modules/mariadb/lib/pool-promise.js +0 -108
  81. package/dist/node_modules/mariadb/node_modules/@types/node/assert/strict.d.ts +0 -8
  82. package/dist/node_modules/mariadb/node_modules/@types/node/assert.d.ts +0 -912
  83. package/dist/node_modules/mariadb/node_modules/@types/node/async_hooks.d.ts +0 -501
  84. package/dist/node_modules/mariadb/node_modules/@types/node/buffer.d.ts +0 -2232
  85. package/dist/node_modules/mariadb/node_modules/@types/node/child_process.d.ts +0 -1366
  86. package/dist/node_modules/mariadb/node_modules/@types/node/cluster.d.ts +0 -414
  87. package/dist/node_modules/mariadb/node_modules/@types/node/console.d.ts +0 -412
  88. package/dist/node_modules/mariadb/node_modules/@types/node/constants.d.ts +0 -18
  89. package/dist/node_modules/mariadb/node_modules/@types/node/crypto.d.ts +0 -3338
  90. package/dist/node_modules/mariadb/node_modules/@types/node/dgram.d.ts +0 -545
  91. package/dist/node_modules/mariadb/node_modules/@types/node/diagnostics_channel.d.ts +0 -152
  92. package/dist/node_modules/mariadb/node_modules/@types/node/dns/promises.d.ts +0 -370
  93. package/dist/node_modules/mariadb/node_modules/@types/node/dns.d.ts +0 -659
  94. package/dist/node_modules/mariadb/node_modules/@types/node/domain.d.ts +0 -169
  95. package/dist/node_modules/mariadb/node_modules/@types/node/events.d.ts +0 -651
  96. package/dist/node_modules/mariadb/node_modules/@types/node/fs/promises.d.ts +0 -1091
  97. package/dist/node_modules/mariadb/node_modules/@types/node/fs.d.ts +0 -3869
  98. package/dist/node_modules/mariadb/node_modules/@types/node/globals.d.ts +0 -294
  99. package/dist/node_modules/mariadb/node_modules/@types/node/globals.global.d.ts +0 -1
  100. package/dist/node_modules/mariadb/node_modules/@types/node/http.d.ts +0 -1396
  101. package/dist/node_modules/mariadb/node_modules/@types/node/http2.d.ts +0 -2101
  102. package/dist/node_modules/mariadb/node_modules/@types/node/https.d.ts +0 -391
  103. package/dist/node_modules/mariadb/node_modules/@types/node/index.d.ts +0 -129
  104. package/dist/node_modules/mariadb/node_modules/@types/node/inspector.d.ts +0 -2744
  105. package/dist/node_modules/mariadb/node_modules/@types/node/module.d.ts +0 -114
  106. package/dist/node_modules/mariadb/node_modules/@types/node/net.d.ts +0 -791
  107. package/dist/node_modules/mariadb/node_modules/@types/node/os.d.ts +0 -455
  108. package/dist/node_modules/mariadb/node_modules/@types/node/package.json +0 -220
  109. package/dist/node_modules/mariadb/node_modules/@types/node/path.d.ts +0 -180
  110. package/dist/node_modules/mariadb/node_modules/@types/node/perf_hooks.d.ts +0 -557
  111. package/dist/node_modules/mariadb/node_modules/@types/node/process.d.ts +0 -1481
  112. package/dist/node_modules/mariadb/node_modules/@types/node/punycode.d.ts +0 -117
  113. package/dist/node_modules/mariadb/node_modules/@types/node/querystring.d.ts +0 -131
  114. package/dist/node_modules/mariadb/node_modules/@types/node/readline.d.ts +0 -650
  115. package/dist/node_modules/mariadb/node_modules/@types/node/repl.d.ts +0 -424
  116. package/dist/node_modules/mariadb/node_modules/@types/node/stream/consumers.d.ts +0 -24
  117. package/dist/node_modules/mariadb/node_modules/@types/node/stream/promises.d.ts +0 -42
  118. package/dist/node_modules/mariadb/node_modules/@types/node/stream/web.d.ts +0 -330
  119. package/dist/node_modules/mariadb/node_modules/@types/node/stream.d.ts +0 -1249
  120. package/dist/node_modules/mariadb/node_modules/@types/node/string_decoder.d.ts +0 -67
  121. package/dist/node_modules/mariadb/node_modules/@types/node/timers/promises.d.ts +0 -68
  122. package/dist/node_modules/mariadb/node_modules/@types/node/timers.d.ts +0 -94
  123. package/dist/node_modules/mariadb/node_modules/@types/node/tls.d.ts +0 -1020
  124. package/dist/node_modules/mariadb/node_modules/@types/node/trace_events.d.ts +0 -161
  125. package/dist/node_modules/mariadb/node_modules/@types/node/tty.d.ts +0 -204
  126. package/dist/node_modules/mariadb/node_modules/@types/node/url.d.ts +0 -891
  127. package/dist/node_modules/mariadb/node_modules/@types/node/util.d.ts +0 -1594
  128. package/dist/node_modules/mariadb/node_modules/@types/node/v8.d.ts +0 -378
  129. package/dist/node_modules/mariadb/node_modules/@types/node/vm.d.ts +0 -507
  130. package/dist/node_modules/mariadb/node_modules/@types/node/wasi.d.ts +0 -158
  131. package/dist/node_modules/mariadb/node_modules/@types/node/worker_threads.d.ts +0 -649
  132. package/dist/node_modules/mariadb/node_modules/@types/node/zlib.d.ts +0 -517
  133. package/dist/node_modules/mariadb/node_modules/iconv-lite/.github/dependabot.yml +0 -11
  134. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/Project.xml +0 -47
  135. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +0 -5
  136. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/iconv-lite.iml +0 -12
  137. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +0 -6
  138. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/modules.xml +0 -8
  139. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/vcs.xml +0 -6
  140. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -597
  141. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-data.js +0 -188
  142. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/index.js +0 -23
  143. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/internal.js +0 -198
  144. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
  145. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  146. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data.js +0 -179
  147. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  148. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  149. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  150. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  151. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  152. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  153. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -56
  154. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  155. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf16.js +0 -197
  156. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf32.js +0 -319
  157. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf7.js +0 -290
  158. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/bom-handling.js +0 -52
  159. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.d.ts +0 -41
  160. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.js +0 -180
  161. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/streams.js +0 -109
  162. package/dist/node_modules/mariadb/node_modules/iconv-lite/package.json +0 -44
  163. package/dist/node_modules/mariadb/package.json +0 -1
  164. package/dist/node_modules/mariadb/promise.js +0 -34
  165. package/dist/node_modules/mariadb/types/index.d.ts +0 -870
  166. package/dist/server/collections/applications.d.ts +0 -10
  167. package/dist/server/collections/applications.js +0 -75
  168. package/dist/server/index.d.ts +0 -11
  169. package/dist/server/index.js +0 -40
  170. package/dist/server/models/application.d.ts +0 -18
  171. package/dist/server/models/application.js +0 -50
  172. package/dist/server/server.d.ts +0 -26
  173. package/dist/server/server.js +0 -310
  174. package/dist/swagger/index.d.ts +0 -195
  175. package/dist/swagger/index.js +0 -226
@@ -1,10 +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
- declare const _default: import("@nocobase/database").CollectionOptions;
10
- export default _default;
@@ -1,75 +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 applications_exports = {};
28
- __export(applications_exports, {
29
- default: () => applications_default
30
- });
31
- module.exports = __toCommonJS(applications_exports);
32
- var import_database = require("@nocobase/database");
33
- var applications_default = (0, import_database.defineCollection)({
34
- dumpRules: {
35
- group: "third-party"
36
- },
37
- name: "applications",
38
- model: "ApplicationModel",
39
- autoGenId: false,
40
- sortable: "sort",
41
- filterTargetKey: "name",
42
- fields: [
43
- {
44
- type: "uid",
45
- name: "name",
46
- primaryKey: true
47
- },
48
- {
49
- type: "string",
50
- name: "displayName"
51
- },
52
- {
53
- type: "string",
54
- name: "cname",
55
- unique: true
56
- },
57
- {
58
- type: "boolean",
59
- name: "pinned"
60
- },
61
- {
62
- type: "string",
63
- name: "icon"
64
- },
65
- {
66
- type: "string",
67
- name: "status",
68
- defaultValue: "pending"
69
- },
70
- {
71
- type: "json",
72
- name: "options"
73
- }
74
- ]
75
- });
@@ -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 { ApplicationModel, registerAppOptions } from './models/application';
10
- export { PluginMultiAppManagerServer as default } from './server';
11
- export { ApplicationModel, registerAppOptions };
@@ -1,40 +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 server_exports = {};
28
- __export(server_exports, {
29
- ApplicationModel: () => import_application.ApplicationModel,
30
- default: () => import_server.PluginMultiAppManagerServer,
31
- registerAppOptions: () => import_application.registerAppOptions
32
- });
33
- module.exports = __toCommonJS(server_exports);
34
- var import_application = require("./models/application");
35
- var import_server = require("./server");
36
- // Annotate the CommonJS export names for ESM import in node:
37
- 0 && (module.exports = {
38
- ApplicationModel,
39
- registerAppOptions
40
- });
@@ -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 { Model, Transactionable } from '@nocobase/database';
10
- import { Application } from '@nocobase/server';
11
- import { AppOptionsFactory } from '../server';
12
- export interface registerAppOptions extends Transactionable {
13
- skipInstall?: boolean;
14
- appOptionsFactory: AppOptionsFactory;
15
- }
16
- export declare class ApplicationModel extends Model {
17
- registerToSupervisor(mainApp: Application, options: registerAppOptions): Application<import("@nocobase/server").DefaultState, import("@nocobase/server").DefaultContext>;
18
- }
@@ -1,50 +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 application_exports = {};
28
- __export(application_exports, {
29
- ApplicationModel: () => ApplicationModel
30
- });
31
- module.exports = __toCommonJS(application_exports);
32
- var import_database = require("@nocobase/database");
33
- var import_server = require("@nocobase/server");
34
- var import_utils = require("@nocobase/utils");
35
- class ApplicationModel extends import_database.Model {
36
- registerToSupervisor(mainApp, options) {
37
- const appName = this.get("name");
38
- const appModelOptions = this.get("options") || {};
39
- const appOptions = options.appOptionsFactory(appName, mainApp);
40
- const subAppOptions = {
41
- ...(0, import_utils.merge)(appOptions, appModelOptions),
42
- name: appName
43
- };
44
- return new import_server.Application(subAppOptions);
45
- }
46
- }
47
- // Annotate the CommonJS export names for ESM import in node:
48
- 0 && (module.exports = {
49
- ApplicationModel
50
- });
@@ -1,26 +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 { IDatabaseOptions, Transactionable } from '@nocobase/database';
10
- import Application, { Plugin } from '@nocobase/server';
11
- export type AppDbCreator = (app: Application, options?: Transactionable & {
12
- context?: any;
13
- }) => Promise<void>;
14
- export type AppOptionsFactory = (appName: string, mainApp: Application) => any;
15
- export type SubAppUpgradeHandler = (mainApp: Application) => Promise<void>;
16
- export declare class PluginMultiAppManagerServer extends Plugin {
17
- appDbCreator: AppDbCreator;
18
- appOptionsFactory: AppOptionsFactory;
19
- subAppUpgradeHandler: SubAppUpgradeHandler;
20
- static getDatabaseConfig(app: Application): IDatabaseOptions;
21
- setSubAppUpgradeHandler(handler: SubAppUpgradeHandler): void;
22
- setAppOptionsFactory(factory: AppOptionsFactory): void;
23
- setAppDbCreator(appDbCreator: AppDbCreator): void;
24
- beforeLoad(): void;
25
- load(): Promise<void>;
26
- }
@@ -1,310 +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 __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
- PluginMultiAppManagerServer: () => PluginMultiAppManagerServer
40
- });
41
- module.exports = __toCommonJS(server_exports);
42
- var import_database = require("@nocobase/database");
43
- var import_server = require("@nocobase/server");
44
- var import_lodash = __toESM(require("lodash"));
45
- var import_path = __toESM(require("path"));
46
- var import_server2 = require("../server");
47
- const defaultSubAppUpgradeHandle = async (mainApp) => {
48
- const repository = mainApp.db.getRepository("applications");
49
- const findOptions = {};
50
- const appSupervisor = import_server.AppSupervisor.getInstance();
51
- if (appSupervisor.runningMode == "single") {
52
- findOptions["filter"] = {
53
- name: appSupervisor.singleAppName
54
- };
55
- }
56
- const instances = await repository.find(findOptions);
57
- for (const instance of instances) {
58
- const instanceOptions = instance.get("options");
59
- if ((instanceOptions == null ? void 0 : instanceOptions.standaloneDeployment) && appSupervisor.runningMode !== "single") {
60
- continue;
61
- }
62
- const beforeSubAppStatus = import_server.AppSupervisor.getInstance().getAppStatus(instance.name);
63
- const subApp = await appSupervisor.getApp(instance.name, {
64
- upgrading: true
65
- });
66
- try {
67
- mainApp.setMaintainingMessage(`upgrading sub app ${instance.name}...`);
68
- await subApp.runAsCLI(["upgrade"], { from: "user" });
69
- if (!beforeSubAppStatus && import_server.AppSupervisor.getInstance().getAppStatus(instance.name) === "initialized") {
70
- await import_server.AppSupervisor.getInstance().removeApp(instance.name);
71
- }
72
- } catch (error) {
73
- console.log(`${instance.name}: upgrade failed`);
74
- mainApp.logger.error(error);
75
- console.error(error);
76
- }
77
- }
78
- };
79
- const defaultDbCreator = async (app) => {
80
- const databaseOptions = app.options.database;
81
- const { host, port, username, password, dialect, database } = databaseOptions;
82
- if (dialect === "mysql") {
83
- const mysql = require("mysql2/promise");
84
- const connection = await mysql.createConnection({ host, port, user: username, password });
85
- await connection.query(`CREATE DATABASE IF NOT EXISTS \`${database}\`;`);
86
- await connection.close();
87
- }
88
- if (dialect === "mariadb") {
89
- const mariadb = require("mariadb");
90
- const connection = await mariadb.createConnection({ host, port, user: username, password });
91
- await connection.query(`CREATE DATABASE IF NOT EXISTS \`${database}\`;`);
92
- await connection.end();
93
- }
94
- if (dialect === "postgres") {
95
- const { Client } = require("pg");
96
- const client = new Client({
97
- host,
98
- port,
99
- user: username,
100
- password,
101
- database: "postgres"
102
- });
103
- await client.connect();
104
- try {
105
- await client.query(`CREATE DATABASE "${database}"`);
106
- } catch (e) {
107
- console.log(e);
108
- }
109
- await client.end();
110
- }
111
- };
112
- const defaultAppOptionsFactory = (appName, mainApp) => {
113
- const rawDatabaseOptions = PluginMultiAppManagerServer.getDatabaseConfig(mainApp);
114
- if (rawDatabaseOptions.dialect === "sqlite") {
115
- const mainAppStorage = rawDatabaseOptions.storage;
116
- if (mainAppStorage !== ":memory:") {
117
- const mainStorageDir = import_path.default.dirname(mainAppStorage);
118
- rawDatabaseOptions.storage = import_path.default.join(mainStorageDir, `${appName}.sqlite`);
119
- }
120
- } else {
121
- rawDatabaseOptions.database = appName;
122
- }
123
- return {
124
- database: {
125
- ...rawDatabaseOptions,
126
- tablePrefix: ""
127
- },
128
- plugins: ["nocobase"],
129
- resourcer: {
130
- prefix: process.env.API_BASE_PATH
131
- }
132
- };
133
- };
134
- class PluginMultiAppManagerServer extends import_server.Plugin {
135
- appDbCreator = defaultDbCreator;
136
- appOptionsFactory = defaultAppOptionsFactory;
137
- subAppUpgradeHandler = defaultSubAppUpgradeHandle;
138
- static getDatabaseConfig(app) {
139
- let oldConfig = app.options.database instanceof import_database.Database ? app.options.database.options : app.options.database;
140
- if (!oldConfig && app.db) {
141
- oldConfig = app.db.options;
142
- }
143
- return import_lodash.default.cloneDeep(import_lodash.default.omit(oldConfig, ["migrator"]));
144
- }
145
- setSubAppUpgradeHandler(handler) {
146
- this.subAppUpgradeHandler = handler;
147
- }
148
- setAppOptionsFactory(factory) {
149
- this.appOptionsFactory = factory;
150
- }
151
- setAppDbCreator(appDbCreator) {
152
- this.appDbCreator = appDbCreator;
153
- }
154
- beforeLoad() {
155
- this.db.registerModels({
156
- ApplicationModel: import_server2.ApplicationModel
157
- });
158
- }
159
- async load() {
160
- await this.importCollections(import_path.default.resolve(__dirname, "collections"));
161
- this.db.on(
162
- "applications.afterCreateWithAssociations",
163
- async (model, options) => {
164
- var _a;
165
- const { transaction } = options;
166
- const name = model.get("name");
167
- if (name === "main") {
168
- throw new Error('Application name "main" is reserved');
169
- }
170
- const subApp = model.registerToSupervisor(this.app, {
171
- appOptionsFactory: this.appOptionsFactory
172
- });
173
- await this.appDbCreator(subApp, {
174
- transaction,
175
- context: options.context
176
- });
177
- const startPromise = subApp.runCommand("start", "--quickstart");
178
- if ((_a = options == null ? void 0 : options.context) == null ? void 0 : _a.waitSubAppInstall) {
179
- await startPromise;
180
- }
181
- }
182
- );
183
- this.db.on("applications.afterDestroy", async (model) => {
184
- await import_server.AppSupervisor.getInstance().removeApp(model.get("name"));
185
- });
186
- const self = this;
187
- async function LazyLoadApplication({
188
- appSupervisor,
189
- appName,
190
- options
191
- }) {
192
- const loadButNotStart = options == null ? void 0 : options.upgrading;
193
- const name = appName;
194
- if (appSupervisor.hasApp(name)) {
195
- return;
196
- }
197
- const mainApp = await appSupervisor.getApp("main");
198
- const applicationRecord = await mainApp.db.getRepository("applications").findOne({
199
- filter: {
200
- name
201
- }
202
- });
203
- if (!applicationRecord) {
204
- return;
205
- }
206
- const instanceOptions = applicationRecord.get("options");
207
- if ((instanceOptions == null ? void 0 : instanceOptions.standaloneDeployment) && appSupervisor.runningMode !== "single") {
208
- return;
209
- }
210
- if (!applicationRecord) {
211
- return;
212
- }
213
- const subApp = applicationRecord.registerToSupervisor(mainApp, {
214
- appOptionsFactory: self.appOptionsFactory
215
- });
216
- if (!loadButNotStart) {
217
- await subApp.runCommand("start", "--quickstart");
218
- }
219
- }
220
- import_server.AppSupervisor.getInstance().setAppBootstrapper(LazyLoadApplication.bind(this));
221
- import_server.Gateway.getInstance().addAppSelectorMiddleware(async (ctx, next) => {
222
- const { req } = ctx;
223
- if (!ctx.resolvedAppName && req.headers["x-hostname"]) {
224
- const repository = this.db.getRepository("applications");
225
- if (!repository) {
226
- await next();
227
- return;
228
- }
229
- const appInstance = await repository.findOne({
230
- filter: {
231
- cname: req.headers["x-hostname"]
232
- }
233
- });
234
- if (appInstance) {
235
- ctx.resolvedAppName = appInstance.name;
236
- }
237
- }
238
- await next();
239
- });
240
- this.app.on("afterStart", async (app) => {
241
- const repository = this.db.getRepository("applications");
242
- const appSupervisor = import_server.AppSupervisor.getInstance();
243
- this.app.setMaintainingMessage("starting sub applications...");
244
- if (appSupervisor.runningMode == "single") {
245
- import_server.Gateway.getInstance().addAppSelectorMiddleware((ctx) => ctx.resolvedAppName = appSupervisor.singleAppName);
246
- try {
247
- await import_server.AppSupervisor.getInstance().getApp(appSupervisor.singleAppName);
248
- } catch (err) {
249
- console.error("Auto register sub application in single mode failed: ", appSupervisor.singleAppName, err);
250
- }
251
- return;
252
- }
253
- try {
254
- const subApps = await repository.find({
255
- filter: {
256
- "options.autoStart": true
257
- }
258
- });
259
- const promises = [];
260
- for (const subAppInstance of subApps) {
261
- promises.push(
262
- (async () => {
263
- if (!appSupervisor.hasApp(subAppInstance.name)) {
264
- await import_server.AppSupervisor.getInstance().getApp(subAppInstance.name);
265
- } else if (appSupervisor.getAppStatus(subAppInstance.name) === "initialized") {
266
- (await import_server.AppSupervisor.getInstance().getApp(subAppInstance.name)).runCommand("start", "--quickstart");
267
- }
268
- })()
269
- );
270
- }
271
- await Promise.all(promises);
272
- } catch (err) {
273
- console.error("Auto register sub applications failed: ", err);
274
- }
275
- });
276
- this.app.on("afterUpgrade", async (app, options) => {
277
- await this.subAppUpgradeHandler(app);
278
- });
279
- this.app.resourcer.registerActionHandlers({
280
- "applications:listPinned": async (ctx, next) => {
281
- const items = await this.db.getRepository("applications").find({
282
- filter: {
283
- pinned: true
284
- }
285
- });
286
- ctx.body = items;
287
- }
288
- });
289
- this.app.acl.allow("applications", "listPinned", "loggedIn");
290
- this.app.acl.registerSnippet({
291
- name: `pm.${this.name}.applications`,
292
- actions: ["applications:*"]
293
- });
294
- this.app.resourcer.use(async (ctx, next) => {
295
- await next();
296
- const { actionName, resourceName, params } = ctx.action;
297
- if (actionName === "list" && resourceName === "applications") {
298
- const applications = ctx.body.rows;
299
- for (const application of applications) {
300
- const appStatus = import_server.AppSupervisor.getInstance().getAppStatus(application.name, "stopped");
301
- application.status = appStatus;
302
- }
303
- }
304
- });
305
- }
306
- }
307
- // Annotate the CommonJS export names for ESM import in node:
308
- 0 && (module.exports = {
309
- PluginMultiAppManagerServer
310
- });