@nocobase/server 0.7.0-alpha.9 → 0.7.1-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.
Files changed (130) hide show
  1. package/lib/acl/available-action.js +37 -35
  2. package/lib/acl/index.js +45 -21
  3. package/lib/app-manager.d.ts +3 -3
  4. package/lib/app-manager.js +151 -72
  5. package/lib/application.d.ts +16 -4
  6. package/lib/application.js +414 -152
  7. package/lib/commands/console.d.ts +2 -3
  8. package/lib/commands/console.js +33 -24
  9. package/lib/commands/db-auth.d.ts +3 -0
  10. package/lib/commands/db-auth.js +26 -0
  11. package/lib/commands/db-clean.d.ts +3 -0
  12. package/lib/commands/db-clean.js +27 -0
  13. package/lib/commands/db-sync.d.ts +2 -4
  14. package/lib/commands/db-sync.js +25 -23
  15. package/lib/commands/index.d.ts +1 -2
  16. package/lib/commands/index.js +31 -29
  17. package/lib/commands/install.d.ts +2 -4
  18. package/lib/commands/install.js +66 -20
  19. package/lib/commands/migrator.d.ts +3 -0
  20. package/lib/commands/migrator.js +27 -0
  21. package/lib/commands/start.d.ts +2 -4
  22. package/lib/commands/start.js +28 -22
  23. package/lib/commands/upgrade.d.ts +6 -0
  24. package/lib/commands/upgrade.js +39 -0
  25. package/lib/helper.js +132 -61
  26. package/lib/index.d.ts +1 -0
  27. package/lib/index.js +100 -33
  28. package/lib/middlewares/data-wrapping.js +65 -55
  29. package/lib/middlewares/index.js +30 -14
  30. package/lib/middlewares/table2resource.js +89 -52
  31. package/lib/migration.d.ts +7 -0
  32. package/lib/migration.js +29 -0
  33. package/lib/plugin-manager.js +124 -55
  34. package/lib/plugin.d.ts +1 -0
  35. package/lib/plugin.js +67 -45
  36. package/lib/read-config.js +159 -64
  37. package/package.json +13 -14
  38. package/esm/acl/available-action.d.ts +0 -5
  39. package/esm/acl/available-action.js +0 -36
  40. package/esm/acl/available-action.js.map +0 -1
  41. package/esm/acl/index.d.ts +0 -2
  42. package/esm/acl/index.js +0 -19
  43. package/esm/acl/index.js.map +0 -1
  44. package/esm/app-manager.d.ts +0 -19
  45. package/esm/app-manager.js +0 -69
  46. package/esm/app-manager.js.map +0 -1
  47. package/esm/application.d.ts +0 -97
  48. package/esm/application.js +0 -156
  49. package/esm/application.js.map +0 -1
  50. package/esm/commands/console.d.ts +0 -4
  51. package/esm/commands/console.js +0 -25
  52. package/esm/commands/console.js.map +0 -1
  53. package/esm/commands/create-plugin/create-plugin.d.ts +0 -2
  54. package/esm/commands/create-plugin/create-plugin.js +0 -29
  55. package/esm/commands/create-plugin/create-plugin.js.map +0 -1
  56. package/esm/commands/create-plugin/index.d.ts +0 -5
  57. package/esm/commands/create-plugin/index.js +0 -6
  58. package/esm/commands/create-plugin/index.js.map +0 -1
  59. package/esm/commands/create-plugin/resources/templates/package-json.d.ts +0 -11
  60. package/esm/commands/create-plugin/resources/templates/package-json.js +0 -11
  61. package/esm/commands/create-plugin/resources/templates/package-json.js.map +0 -1
  62. package/esm/commands/create-plugin/resources/templates/plugin.d.ts +0 -4
  63. package/esm/commands/create-plugin/resources/templates/plugin.js +0 -12
  64. package/esm/commands/create-plugin/resources/templates/plugin.js.map +0 -1
  65. package/esm/commands/db-sync.d.ts +0 -5
  66. package/esm/commands/db-sync.js +0 -25
  67. package/esm/commands/db-sync.js.map +0 -1
  68. package/esm/commands/index.d.ts +0 -3
  69. package/esm/commands/index.js +0 -26
  70. package/esm/commands/index.js.map +0 -1
  71. package/esm/commands/install.d.ts +0 -5
  72. package/esm/commands/install.js +0 -23
  73. package/esm/commands/install.js.map +0 -1
  74. package/esm/commands/start.d.ts +0 -5
  75. package/esm/commands/start.js +0 -23
  76. package/esm/commands/start.js.map +0 -1
  77. package/esm/helper.d.ts +0 -7
  78. package/esm/helper.js +0 -59
  79. package/esm/helper.js.map +0 -1
  80. package/esm/index.d.ts +0 -7
  81. package/esm/index.js +0 -9
  82. package/esm/index.js.map +0 -1
  83. package/esm/middlewares/data-wrapping.d.ts +0 -3
  84. package/esm/middlewares/data-wrapping.js +0 -54
  85. package/esm/middlewares/data-wrapping.js.map +0 -1
  86. package/esm/middlewares/index.d.ts +0 -2
  87. package/esm/middlewares/index.js +0 -3
  88. package/esm/middlewares/index.js.map +0 -1
  89. package/esm/middlewares/table2resource.d.ts +0 -6
  90. package/esm/middlewares/table2resource.js +0 -51
  91. package/esm/middlewares/table2resource.js.map +0 -1
  92. package/esm/plugin-manager.d.ts +0 -23
  93. package/esm/plugin-manager.js +0 -57
  94. package/esm/plugin-manager.js.map +0 -1
  95. package/esm/plugin.d.ts +0 -32
  96. package/esm/plugin.js +0 -43
  97. package/esm/plugin.js.map +0 -1
  98. package/esm/read-config.d.ts +0 -8
  99. package/esm/read-config.js +0 -63
  100. package/esm/read-config.js.map +0 -1
  101. package/lib/acl/available-action.js.map +0 -1
  102. package/lib/acl/index.js.map +0 -1
  103. package/lib/app-manager.js.map +0 -1
  104. package/lib/application.js.map +0 -1
  105. package/lib/commands/console.js.map +0 -1
  106. package/lib/commands/create-plugin/create-plugin.d.ts +0 -2
  107. package/lib/commands/create-plugin/create-plugin.js +0 -31
  108. package/lib/commands/create-plugin/create-plugin.js.map +0 -1
  109. package/lib/commands/create-plugin/index.d.ts +0 -5
  110. package/lib/commands/create-plugin/index.js +0 -8
  111. package/lib/commands/create-plugin/index.js.map +0 -1
  112. package/lib/commands/create-plugin/resources/templates/package-json.d.ts +0 -11
  113. package/lib/commands/create-plugin/resources/templates/package-json.js +0 -13
  114. package/lib/commands/create-plugin/resources/templates/package-json.js.map +0 -1
  115. package/lib/commands/create-plugin/resources/templates/plugin.d.ts +0 -4
  116. package/lib/commands/create-plugin/resources/templates/plugin.js +0 -33
  117. package/lib/commands/create-plugin/resources/templates/plugin.js.map +0 -1
  118. package/lib/commands/db-sync.js.map +0 -1
  119. package/lib/commands/index.js.map +0 -1
  120. package/lib/commands/install.js.map +0 -1
  121. package/lib/commands/start.js.map +0 -1
  122. package/lib/helper.js.map +0 -1
  123. package/lib/index.js.map +0 -1
  124. package/lib/middlewares/data-wrapping.js.map +0 -1
  125. package/lib/middlewares/index.js.map +0 -1
  126. package/lib/middlewares/table2resource.js.map +0 -1
  127. package/lib/plugin-manager.js.map +0 -1
  128. package/lib/plugin.js.map +0 -1
  129. package/lib/read-config.js.map +0 -1
  130. package/tsconfig.build.json +0 -9
@@ -1,39 +1,41 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
3
6
  exports.availableActions = void 0;
4
7
  const availableActions = {
5
- create: {
6
- displayName: '{{t("Add new")}}',
7
- type: 'new-data',
8
- onNewRecord: true,
9
- allowConfigureFields: true,
10
- },
11
- // import: {
12
- // displayName: '{{t("Import")}}',
13
- // type: 'new-data',
14
- // scope: false,
15
- // },
16
- export: {
17
- displayName: '{{t("Export")}}',
18
- type: 'old-data',
19
- allowConfigureFields: true,
20
- },
21
- view: {
22
- displayName: '{{t("View")}}',
23
- type: 'old-data',
24
- aliases: ['get', 'list'],
25
- allowConfigureFields: true,
26
- },
27
- update: {
28
- displayName: '{{t("Edit")}}',
29
- type: 'old-data',
30
- aliases: ['update', 'move'],
31
- allowConfigureFields: true,
32
- },
33
- destroy: {
34
- displayName: '{{t("Delete")}}',
35
- type: 'old-data',
36
- },
8
+ create: {
9
+ displayName: '{{t("Add new")}}',
10
+ type: 'new-data',
11
+ onNewRecord: true,
12
+ allowConfigureFields: true
13
+ },
14
+ // import: {
15
+ // displayName: '{{t("Import")}}',
16
+ // type: 'new-data',
17
+ // scope: false,
18
+ // },
19
+ // export: {
20
+ // displayName: '{{t("Export")}}',
21
+ // type: 'old-data',
22
+ // allowConfigureFields: true,
23
+ // },
24
+ view: {
25
+ displayName: '{{t("View")}}',
26
+ type: 'old-data',
27
+ aliases: ['get', 'list'],
28
+ allowConfigureFields: true
29
+ },
30
+ update: {
31
+ displayName: '{{t("Edit")}}',
32
+ type: 'old-data',
33
+ aliases: ['update', 'move'],
34
+ allowConfigureFields: true
35
+ },
36
+ destroy: {
37
+ displayName: '{{t("Delete")}}',
38
+ type: 'old-data'
39
+ }
37
40
  };
38
- exports.availableActions = availableActions;
39
- //# sourceMappingURL=available-action.js.map
41
+ exports.availableActions = availableActions;
package/lib/acl/index.js CHANGED
@@ -1,23 +1,47 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createACL = void 0;
4
- const acl_1 = require("@nocobase/acl");
5
- const available_action_1 = require("./available-action");
6
- const configureResources = [
7
- 'roles',
8
- 'collections',
9
- 'roles.collections',
10
- 'roles.resources',
11
- 'rolesResourcesScopes',
12
- 'availableActions',
13
- ];
14
- function createACL() {
15
- const acl = new acl_1.ACL();
16
- for (const [actionName, actionParams] of Object.entries(available_action_1.availableActions)) {
17
- acl.setAvailableAction(actionName, actionParams);
18
- }
19
- acl.registerConfigResources(configureResources);
20
- return acl;
21
- }
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
22
6
  exports.createACL = createACL;
23
- //# sourceMappingURL=index.js.map
7
+
8
+ function _acl() {
9
+ const data = require("@nocobase/acl");
10
+
11
+ _acl = function _acl() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ var _availableAction = require("./available-action");
19
+
20
+ function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
21
+
22
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
23
+
24
+ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
25
+
26
+ function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
27
+
28
+ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
29
+
30
+ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
+
32
+ const configureResources = ['roles', 'collections', 'roles.collections', 'roles.resources', 'rolesResourcesScopes', 'availableActions'];
33
+
34
+ function createACL() {
35
+ const acl = new (_acl().ACL)();
36
+
37
+ for (var _i = 0, _Object$entries = Object.entries(_availableAction.availableActions); _i < _Object$entries.length; _i++) {
38
+ const _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),
39
+ actionName = _Object$entries$_i[0],
40
+ actionParams = _Object$entries$_i[1];
41
+
42
+ acl.setAvailableAction(actionName, actionParams);
43
+ }
44
+
45
+ acl.registerConfigResources(configureResources);
46
+ return acl;
47
+ }
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
- import Application, { ApplicationOptions } from './application';
3
- import http, { IncomingMessage } from 'http';
4
2
  import EventEmitter from 'events';
3
+ import http, { IncomingMessage, ServerResponse } from 'http';
4
+ import Application, { ApplicationOptions } from './application';
5
5
  declare type AppSelector = (req: IncomingMessage) => Application | string | undefined | null;
6
6
  export declare class AppManager extends EventEmitter {
7
7
  private app;
@@ -13,7 +13,7 @@ export declare class AppManager extends EventEmitter {
13
13
  setAppSelector(selector: AppSelector): void;
14
14
  listen(...args: any[]): http.Server;
15
15
  getApplication(appName: string): Promise<null | Application>;
16
- callback(): (req: any, res: any) => Promise<void>;
16
+ callback(): (req: IncomingMessage, res: ServerResponse) => Promise<void>;
17
17
  emitAsync: (event: string | symbol, ...args: any[]) => Promise<boolean>;
18
18
  }
19
19
  export {};
@@ -1,76 +1,155 @@
1
1
  "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
15
6
  exports.AppManager = void 0;
16
- const application_1 = __importDefault(require("./application"));
17
- const http_1 = __importDefault(require("http"));
18
- const events_1 = __importDefault(require("events"));
19
- const utils_1 = require("@nocobase/utils");
20
- class AppManager extends events_1.default {
21
- constructor(app) {
22
- super();
23
- this.app = app;
24
- this.applications = new Map();
25
- this.appSelector = (req) => this.app;
26
- app.on('beforeStop', (mainApp, options) => __awaiter(this, void 0, void 0, function* () {
27
- return yield Promise.all([...this.applications.values()].map((application) => application.stop(options)));
28
- }));
29
- app.on('afterDestroy', (mainApp, options) => __awaiter(this, void 0, void 0, function* () {
30
- return yield Promise.all([...this.applications.values()].map((application) => application.destroy(options)));
31
- }));
32
- }
33
- createApplication(name, options) {
34
- const application = new application_1.default(options);
35
- this.applications.set(name, application);
36
- return application;
37
- }
38
- removeApplication(name) {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- const application = this.applications.get(name);
41
- if (!application) {
42
- return;
43
- }
44
- yield application.destroy();
45
- this.applications.delete(name);
46
- });
47
- }
48
- setAppSelector(selector) {
49
- this.appSelector = selector;
50
- }
51
- listen(...args) {
52
- const server = http_1.default.createServer(this.callback());
53
- return server.listen(...args);
54
- }
55
- getApplication(appName) {
56
- return __awaiter(this, void 0, void 0, function* () {
57
- yield this.emitAsync('beforeGetApplication', {
58
- appManager: this,
59
- name: appName,
60
- });
61
- return this.applications.get(appName);
62
- });
63
- }
64
- callback() {
65
- return (req, res) => __awaiter(this, void 0, void 0, function* () {
66
- let handleApp = this.appSelector(req) || this.app;
67
- if (typeof handleApp === 'string') {
68
- handleApp = (yield this.getApplication(handleApp)) || this.app;
69
- }
70
- handleApp.callback()(req, res);
71
- });
72
- }
7
+
8
+ function _utils() {
9
+ const data = require("@nocobase/utils");
10
+
11
+ _utils = function _utils() {
12
+ return data;
13
+ };
14
+
15
+ return data;
73
16
  }
17
+
18
+ function _events() {
19
+ const data = _interopRequireDefault(require("events"));
20
+
21
+ _events = function _events() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _http() {
29
+ const data = _interopRequireDefault(require("http"));
30
+
31
+ _http = function _http() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ var _application = _interopRequireDefault(require("./application"));
39
+
40
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
41
+
42
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
43
+
44
+ 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); }); }; }
45
+
46
+ class AppManager extends _events().default {
47
+ constructor(app) {
48
+ var _this;
49
+
50
+ super();
51
+ _this = this;
52
+ this.app = void 0;
53
+ this.applications = new Map();
54
+
55
+ this.appSelector = req => this.app;
56
+
57
+ this.app = app;
58
+ app.on('beforeStop', /*#__PURE__*/function () {
59
+ var _ref = _asyncToGenerator(function* (mainApp, options) {
60
+ return yield Promise.all([..._this.applications.values()].map(application => application.stop(options)));
61
+ });
62
+
63
+ return function (_x, _x2) {
64
+ return _ref.apply(this, arguments);
65
+ };
66
+ }());
67
+ app.on('afterDestroy', /*#__PURE__*/function () {
68
+ var _ref2 = _asyncToGenerator(function* (mainApp, options) {
69
+ return yield Promise.all([..._this.applications.values()].map(application => application.destroy(options)));
70
+ });
71
+
72
+ return function (_x3, _x4) {
73
+ return _ref2.apply(this, arguments);
74
+ };
75
+ }());
76
+ }
77
+
78
+ createApplication(name, options) {
79
+ const application = new _application.default(options);
80
+ this.applications.set(name, application);
81
+ return application;
82
+ }
83
+
84
+ removeApplication(name) {
85
+ var _this2 = this;
86
+
87
+ return _asyncToGenerator(function* () {
88
+ const application = _this2.applications.get(name);
89
+
90
+ if (!application) {
91
+ return;
92
+ }
93
+
94
+ yield application.destroy();
95
+
96
+ _this2.applications.delete(name);
97
+ })();
98
+ }
99
+
100
+ setAppSelector(selector) {
101
+ this.appSelector = selector;
102
+ }
103
+
104
+ listen(...args) {
105
+ const server = _http().default.createServer(this.callback());
106
+
107
+ return server.listen(...args);
108
+ }
109
+
110
+ getApplication(appName) {
111
+ var _this3 = this;
112
+
113
+ return _asyncToGenerator(function* () {
114
+ yield _this3.emitAsync('beforeGetApplication', {
115
+ appManager: _this3,
116
+ name: appName
117
+ });
118
+ return _this3.applications.get(appName);
119
+ })();
120
+ }
121
+
122
+ callback() {
123
+ var _this4 = this;
124
+
125
+ return /*#__PURE__*/function () {
126
+ var _ref3 = _asyncToGenerator(function* (req, res) {
127
+ let handleApp = _this4.appSelector(req) || _this4.app;
128
+
129
+ if (typeof handleApp === 'string') {
130
+ handleApp = yield _this4.getApplication(handleApp);
131
+
132
+ if (!handleApp) {
133
+ res.statusCode = 404;
134
+ return res.end(JSON.stringify({
135
+ redirectTo: process.env.APP_NOT_FOUND_REDIRECT_TO,
136
+ errors: [{
137
+ message: 'Not Found'
138
+ }]
139
+ }));
140
+ }
141
+ }
142
+
143
+ handleApp.callback()(req, res);
144
+ });
145
+
146
+ return function (_x5, _x6) {
147
+ return _ref3.apply(this, arguments);
148
+ };
149
+ }();
150
+ }
151
+
152
+ }
153
+
74
154
  exports.AppManager = AppManager;
75
- (0, utils_1.applyMixins)(AppManager, [utils_1.AsyncEmitter]);
76
- //# sourceMappingURL=app-manager.js.map
155
+ (0, _utils().applyMixins)(AppManager, [_utils().AsyncEmitter]);
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  /// <reference types="koa-bodyparser" />
3
3
  import { ACL } from '@nocobase/acl';
4
- import Database, { CollectionOptions, IDatabaseOptions } from '@nocobase/database';
4
+ import Database, { Collection, CollectionOptions, IDatabaseOptions } from '@nocobase/database';
5
5
  import Resourcer, { ResourceOptions } from '@nocobase/resourcer';
6
6
  import { AsyncEmitter } from '@nocobase/utils';
7
7
  import { Command, CommandOptions } from 'commander';
@@ -26,11 +26,11 @@ export interface ApplicationOptions {
26
26
  i18n?: i18n | InitOptions;
27
27
  plugins?: PluginsConfigurations;
28
28
  }
29
- interface DefaultState {
29
+ export interface DefaultState {
30
30
  currentUser?: any;
31
31
  [key: string]: any;
32
32
  }
33
- interface DefaultContext {
33
+ export interface DefaultContext {
34
34
  db: Database;
35
35
  resourcer: Resourcer;
36
36
  [key: string]: any;
@@ -64,6 +64,14 @@ interface StartOptions {
64
64
  cliArgs?: any[];
65
65
  listen?: ListenOptions;
66
66
  }
67
+ export declare class ApplicationVersion {
68
+ protected app: Application;
69
+ protected collection: Collection;
70
+ constructor(app: Application);
71
+ get(): Promise<any>;
72
+ update(): Promise<void>;
73
+ satisfies(range: string): Promise<boolean>;
74
+ }
67
75
  export declare class Application<StateT = DefaultState, ContextT = DefaultContext> extends Koa implements AsyncEmitter {
68
76
  options: ApplicationOptions;
69
77
  readonly db: Database;
@@ -73,13 +81,16 @@ export declare class Application<StateT = DefaultState, ContextT = DefaultContex
73
81
  readonly pm: PluginManager;
74
82
  readonly acl: ACL;
75
83
  readonly appManager: AppManager;
84
+ readonly version: ApplicationVersion;
76
85
  protected plugins: Map<string, Plugin<any>>;
77
86
  listenServer: Server;
78
87
  constructor(options: ApplicationOptions);
88
+ private createDatabase;
89
+ getVersion(): any;
79
90
  plugin<O = any>(pluginClass: any, options?: O): Plugin<O>;
80
91
  loadPluginConfig(pluginsConfigurations: PluginsConfigurations): void;
81
92
  use<NewStateT = {}, NewContextT = {}>(middleware: Koa.Middleware<StateT & NewStateT, ContextT & NewContextT>, options?: MiddlewareOptions): Koa<Koa.DefaultState & StateT & NewStateT, Koa.DefaultContext & ContextT & NewContextT>;
82
- collection(options: CollectionOptions): import("@nocobase/database").Collection<any, any>;
93
+ collection(options: CollectionOptions): Collection<any, any>;
83
94
  resource(options: ResourceOptions): import("@nocobase/resourcer").Resource;
84
95
  actions(handlers: any, options?: ActionsOptions): void;
85
96
  command(name: string, desc?: string, opts?: CommandOptions): Command;
@@ -92,6 +103,7 @@ export declare class Application<StateT = DefaultState, ContextT = DefaultContex
92
103
  stop(options?: any): Promise<void>;
93
104
  destroy(options?: any): Promise<void>;
94
105
  install(options?: InstallOptions): Promise<void>;
106
+ upgrade(options?: any): Promise<void>;
95
107
  emitAsync: (event: string | symbol, ...args: any[]) => Promise<boolean>;
96
108
  }
97
109
  export default Application;