@nocobase/plugin-multi-app-manager 0.7.6-alpha.2 → 0.8.0-alpha.4
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/lib/models/application.js +25 -21
- package/lib/server.d.ts +0 -1
- package/lib/server.js +0 -4
- package/package.json +3 -3
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.ApplicationModel = void 0;
|
|
7
7
|
|
|
8
8
|
function _database() {
|
|
9
|
-
const data = require("@nocobase/database");
|
|
9
|
+
const data = _interopRequireWildcard(require("@nocobase/database"));
|
|
10
10
|
|
|
11
11
|
_database = function _database() {
|
|
12
12
|
return data;
|
|
@@ -35,12 +35,12 @@ function path() {
|
|
|
35
35
|
return data;
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
39
|
+
|
|
38
40
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
39
41
|
|
|
40
42
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
41
43
|
|
|
42
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
43
|
-
|
|
44
44
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
45
45
|
|
|
46
46
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -53,14 +53,15 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
|
|
|
53
53
|
|
|
54
54
|
class ApplicationModel extends _database().Model {
|
|
55
55
|
static getDatabaseConfig(app) {
|
|
56
|
-
|
|
56
|
+
const oldConfig = app.options.database instanceof _database().default ? app.options.database.options : app.options.database;
|
|
57
|
+
return _lodash().default.cloneDeep(_lodash().default.omit(oldConfig, ['migrator']));
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
static handleAppStart(app, options) {
|
|
60
61
|
return _asyncToGenerator(function* () {
|
|
61
62
|
yield app.load();
|
|
62
63
|
|
|
63
|
-
if (!
|
|
64
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipInstall)) {
|
|
64
65
|
yield app.install();
|
|
65
66
|
}
|
|
66
67
|
|
|
@@ -76,17 +77,16 @@ class ApplicationModel extends _database().Model {
|
|
|
76
77
|
|
|
77
78
|
const appOptions = _this.get('options') || {};
|
|
78
79
|
const AppModel = _this.constructor;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
const
|
|
84
|
-
host =
|
|
85
|
-
port =
|
|
86
|
-
username =
|
|
87
|
-
password =
|
|
88
|
-
|
|
89
|
-
dialect = _AppModel$getDatabase.dialect;
|
|
80
|
+
|
|
81
|
+
const createDatabase = /*#__PURE__*/function () {
|
|
82
|
+
var _ref = _asyncToGenerator(function* () {
|
|
83
|
+
const database = appName;
|
|
84
|
+
const _mainApp$db$options = mainApp.db.options,
|
|
85
|
+
host = _mainApp$db$options.host,
|
|
86
|
+
port = _mainApp$db$options.port,
|
|
87
|
+
username = _mainApp$db$options.username,
|
|
88
|
+
password = _mainApp$db$options.password,
|
|
89
|
+
dialect = _mainApp$db$options.dialect;
|
|
90
90
|
|
|
91
91
|
if (dialect === 'mysql') {
|
|
92
92
|
const mysql = require('mysql2/promise');
|
|
@@ -122,12 +122,16 @@ class ApplicationModel extends _database().Model {
|
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
124
|
|
|
125
|
-
function createDatabase() {
|
|
126
|
-
return
|
|
127
|
-
}
|
|
125
|
+
return function createDatabase() {
|
|
126
|
+
return _ref.apply(this, arguments);
|
|
127
|
+
};
|
|
128
|
+
}();
|
|
129
|
+
|
|
130
|
+
if (!(options === null || options === void 0 ? void 0 : options.skipInstall)) {
|
|
131
|
+
yield createDatabase();
|
|
132
|
+
}
|
|
128
133
|
|
|
129
|
-
|
|
130
|
-
}());
|
|
134
|
+
const app = mainApp.appManager.createApplication(appName, _objectSpread(_objectSpread({}, AppModel.initOptions(appName, mainApp)), appOptions));
|
|
131
135
|
yield AppModel.handleAppStart(app, options);
|
|
132
136
|
yield AppModel.update({
|
|
133
137
|
status: 'running'
|
package/lib/server.d.ts
CHANGED
package/lib/server.js
CHANGED
|
@@ -32,10 +32,6 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try
|
|
|
32
32
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
33
33
|
|
|
34
34
|
class PluginMultiAppManager extends _server().Plugin {
|
|
35
|
-
getName() {
|
|
36
|
-
return this.getPackageName(__dirname);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
35
|
install(options) {
|
|
40
36
|
var _this = this;
|
|
41
37
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-multi-app-manager",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-alpha.4",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"licenses": [
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
}
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@nocobase/server": "0.
|
|
13
|
+
"@nocobase/server": "0.8.0-alpha.4"
|
|
14
14
|
},
|
|
15
|
-
"gitHead": "
|
|
15
|
+
"gitHead": "433f068ce4479a53f51d3ceac3f22b710e7bb13e"
|
|
16
16
|
}
|