@nocobase/plugin-multi-app-manager 1.3.49-beta → 1.3.51

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 (38) hide show
  1. package/dist/externalVersion.js +4 -4
  2. package/dist/node_modules/mariadb/package.json +1 -1
  3. package/dist/node_modules/mariadb/promise.js +2 -2
  4. package/dist/server/server.d.ts +2 -0
  5. package/dist/server/server.js +19 -9
  6. package/package.json +2 -2
  7. package/dist/node_modules/mariadb/node_modules/iconv-lite/.github/dependabot.yml +0 -11
  8. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/Project.xml +0 -47
  9. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/codeStyles/codeStyleConfig.xml +0 -5
  10. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/iconv-lite.iml +0 -12
  11. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/inspectionProfiles/Project_Default.xml +0 -6
  12. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/modules.xml +0 -8
  13. package/dist/node_modules/mariadb/node_modules/iconv-lite/.idea/vcs.xml +0 -6
  14. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -597
  15. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/dbcs-data.js +0 -188
  16. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/index.js +0 -23
  17. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/internal.js +0 -198
  18. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
  19. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  20. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/sbcs-data.js +0 -179
  21. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  22. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  23. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  24. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  25. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  26. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  27. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -56
  28. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  29. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf16.js +0 -197
  30. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf32.js +0 -319
  31. package/dist/node_modules/mariadb/node_modules/iconv-lite/encodings/utf7.js +0 -290
  32. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/bom-handling.js +0 -52
  33. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.d.ts +0 -41
  34. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/index.js +0 -180
  35. package/dist/node_modules/mariadb/node_modules/iconv-lite/lib/streams.js +0 -109
  36. package/dist/node_modules/mariadb/node_modules/iconv-lite/package.json +0 -44
  37. /package/dist/locale/{ja_JP.json → ja-JP.json} +0 -0
  38. /package/dist/locale/{ko_KR.json → ko-KR.json} +0 -0
@@ -8,8 +8,10 @@
8
8
  */
9
9
  import { IDatabaseOptions, Transactionable } from '@nocobase/database';
10
10
  import Application, { Plugin } from '@nocobase/server';
11
+ import { ApplicationModel } from '../server';
11
12
  export type AppDbCreator = (app: Application, options?: Transactionable & {
12
13
  context?: any;
14
+ applicationModel?: ApplicationModel;
13
15
  }) => Promise<void>;
14
16
  export type AppOptionsFactory = (appName: string, mainApp: Application) => any;
15
17
  export type SubAppUpgradeHandler = (mainApp: Application) => Promise<void>;
@@ -78,7 +78,7 @@ const defaultSubAppUpgradeHandle = async (mainApp) => {
78
78
  };
79
79
  const defaultDbCreator = async (app) => {
80
80
  const databaseOptions = app.options.database;
81
- const { host, port, username, password, dialect, database } = databaseOptions;
81
+ const { host, port, username, password, dialect, database, schema } = databaseOptions;
82
82
  if (dialect === "mysql") {
83
83
  const mysql = require("mysql2/promise");
84
84
  const connection = await mysql.createConnection({ host, port, user: username, password });
@@ -91,18 +91,22 @@ const defaultDbCreator = async (app) => {
91
91
  await connection.query(`CREATE DATABASE IF NOT EXISTS \`${database}\`;`);
92
92
  await connection.end();
93
93
  }
94
- if (dialect === "postgres") {
94
+ if (["postgres", "kingbase"].includes(dialect)) {
95
95
  const { Client } = require("pg");
96
96
  const client = new Client({
97
97
  host,
98
98
  port,
99
99
  user: username,
100
100
  password,
101
- database: "postgres"
101
+ database: dialect
102
102
  });
103
103
  await client.connect();
104
104
  try {
105
- await client.query(`CREATE DATABASE "${database}"`);
105
+ if (process.env.USE_DB_SCHEMA_IN_SUBAPP === "true") {
106
+ await client.query(`CREATE SCHEMA IF NOT EXISTS ${schema}`);
107
+ } else {
108
+ await client.query(`CREATE DATABASE "${database}"`);
109
+ }
106
110
  } catch (e) {
107
111
  console.log(e);
108
112
  }
@@ -117,6 +121,8 @@ const defaultAppOptionsFactory = (appName, mainApp) => {
117
121
  const mainStorageDir = import_path.default.dirname(mainAppStorage);
118
122
  rawDatabaseOptions.storage = import_path.default.join(mainStorageDir, `${appName}.sqlite`);
119
123
  }
124
+ } else if (process.env.USE_DB_SCHEMA_IN_SUBAPP === "true" && ["postgres", "kingbase"].includes(rawDatabaseOptions.dialect)) {
125
+ rawDatabaseOptions.schema = appName;
120
126
  } else {
121
127
  rawDatabaseOptions.database = appName;
122
128
  }
@@ -170,11 +176,15 @@ class PluginMultiAppManagerServer extends import_server.Plugin {
170
176
  const subApp = model.registerToSupervisor(this.app, {
171
177
  appOptionsFactory: this.appOptionsFactory
172
178
  });
173
- await this.appDbCreator(subApp, {
174
- transaction,
175
- context: options.context
176
- });
177
- const startPromise = subApp.runCommand("start", "--quickstart");
179
+ const quickstart = async () => {
180
+ await this.appDbCreator(subApp, {
181
+ transaction,
182
+ applicationModel: model,
183
+ context: options.context
184
+ });
185
+ await subApp.runCommand("start", "--quickstart");
186
+ };
187
+ const startPromise = quickstart();
178
188
  if ((_a = options == null ? void 0 : options.context) == null ? void 0 : _a.waitSubAppInstall) {
179
189
  await startPromise;
180
190
  }
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "displayName.zh-CN": "多应用管理器",
5
5
  "description": "Dynamically create multiple apps without separate deployments.",
6
6
  "description.zh-CN": "无需单独部署即可动态创建多个应用。",
7
- "version": "1.3.49-beta",
7
+ "version": "1.3.51",
8
8
  "license": "AGPL-3.0",
9
9
  "main": "./dist/server/index.js",
10
10
  "homepage": "https://docs.nocobase.com/handbook/multi-app-manager",
@@ -28,7 +28,7 @@
28
28
  "@nocobase/test": "1.x",
29
29
  "@nocobase/utils": "1.x"
30
30
  },
31
- "gitHead": "46dde74e2c220ae19bc275bb40be9ddf52485fa9",
31
+ "gitHead": "01f2b933a0681d99c5928d91d41f3f0c0ecae988",
32
32
  "keywords": [
33
33
  "system"
34
34
  ]
@@ -1,11 +0,0 @@
1
- # Please see the documentation for all configuration options:
2
- # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
3
-
4
- version: 2
5
- updates:
6
- - package-ecosystem: "npm"
7
- directory: "/"
8
- schedule:
9
- interval: "daily"
10
- allow:
11
- - dependency-type: production
@@ -1,47 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <code_scheme name="Project" version="173">
3
- <HTMLCodeStyleSettings>
4
- <option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
5
- <option name="HTML_ENFORCE_QUOTES" value="true" />
6
- </HTMLCodeStyleSettings>
7
- <JSCodeStyleSettings version="0">
8
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
9
- <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
10
- <option name="FORCE_QUOTE_STYlE" value="true" />
11
- <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
12
- <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
13
- <option name="SPACES_WITHIN_IMPORTS" value="true" />
14
- </JSCodeStyleSettings>
15
- <TypeScriptCodeStyleSettings version="0">
16
- <option name="FORCE_SEMICOLON_STYLE" value="true" />
17
- <option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
18
- <option name="FORCE_QUOTE_STYlE" value="true" />
19
- <option name="ENFORCE_TRAILING_COMMA" value="Remove" />
20
- <option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
21
- <option name="SPACES_WITHIN_IMPORTS" value="true" />
22
- </TypeScriptCodeStyleSettings>
23
- <VueCodeStyleSettings>
24
- <option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
25
- <option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
26
- </VueCodeStyleSettings>
27
- <codeStyleSettings language="HTML">
28
- <option name="SOFT_MARGINS" value="100" />
29
- <indentOptions>
30
- <option name="CONTINUATION_INDENT_SIZE" value="4" />
31
- </indentOptions>
32
- </codeStyleSettings>
33
- <codeStyleSettings language="JavaScript">
34
- <option name="SOFT_MARGINS" value="100" />
35
- </codeStyleSettings>
36
- <codeStyleSettings language="TypeScript">
37
- <option name="SOFT_MARGINS" value="100" />
38
- </codeStyleSettings>
39
- <codeStyleSettings language="Vue">
40
- <option name="SOFT_MARGINS" value="100" />
41
- <indentOptions>
42
- <option name="INDENT_SIZE" value="4" />
43
- <option name="TAB_SIZE" value="4" />
44
- </indentOptions>
45
- </codeStyleSettings>
46
- </code_scheme>
47
- </component>
@@ -1,5 +0,0 @@
1
- <component name="ProjectCodeStyleConfiguration">
2
- <state>
3
- <option name="USE_PER_PROJECT_SETTINGS" value="true" />
4
- </state>
5
- </component>
@@ -1,12 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <module type="WEB_MODULE" version="4">
3
- <component name="NewModuleRootManager">
4
- <content url="file://$MODULE_DIR$">
5
- <excludeFolder url="file://$MODULE_DIR$/temp" />
6
- <excludeFolder url="file://$MODULE_DIR$/.tmp" />
7
- <excludeFolder url="file://$MODULE_DIR$/tmp" />
8
- </content>
9
- <orderEntry type="inheritedJdk" />
10
- <orderEntry type="sourceFolder" forTests="false" />
11
- </component>
12
- </module>
@@ -1,6 +0,0 @@
1
- <component name="InspectionProjectProfileManager">
2
- <profile version="1.0">
3
- <option name="myName" value="Project Default" />
4
- <inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
5
- </profile>
6
- </component>
@@ -1,8 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="ProjectModuleManager">
4
- <modules>
5
- <module fileurl="file://$PROJECT_DIR$/.idea/iconv-lite.iml" filepath="$PROJECT_DIR$/.idea/iconv-lite.iml" />
6
- </modules>
7
- </component>
8
- </project>
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <project version="4">
3
- <component name="VcsDirectoryMappings">
4
- <mapping directory="$PROJECT_DIR$" vcs="Git" />
5
- </component>
6
- </project>