@nocobase/server 0.7.2-alpha.6 → 0.7.2-alpha.7

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.
@@ -158,7 +158,12 @@ class ApplicationVersion {
158
158
  return _asyncToGenerator(function* () {
159
159
  if (yield _this3.app.db.collectionExistsInDb('applicationVersion')) {
160
160
  const model = yield _this3.collection.model.findOne();
161
- const version = model.get('value');
161
+ const version = model === null || model === void 0 ? void 0 : model.value;
162
+
163
+ if (!version) {
164
+ return true;
165
+ }
166
+
162
167
  return _semver().default.satisfies(version, range);
163
168
  }
164
169
 
@@ -415,6 +420,7 @@ class Application extends _koa().default {
415
420
  var _this10 = this;
416
421
 
417
422
  return _asyncToGenerator(function* () {
423
+ yield _this10.emitAsync('beforeUpgrade', _this10, options);
418
424
  const force = false;
419
425
  yield _this10.db.migrator.up();
420
426
  yield _this10.db.sync({
@@ -424,6 +430,7 @@ class Application extends _koa().default {
424
430
  }
425
431
  });
426
432
  yield _this10.version.update();
433
+ yield _this10.emitAsync('afterUpgrade', _this10, options);
427
434
  })();
428
435
  }
429
436
 
@@ -13,6 +13,7 @@ var _default = app => {
13
13
  app.command('db:sync').action( /*#__PURE__*/_asyncToGenerator(function* (...cliArgs) {
14
14
  const opts = cliArgs[0];
15
15
  console.log('db sync...');
16
+ yield app.emitAsync('cli.beforeDbSync', ...cliArgs);
16
17
  const force = false;
17
18
  yield app.db.sync({
18
19
  force,
@@ -20,13 +21,6 @@ var _default = app => {
20
21
  drop: force
21
22
  }
22
23
  });
23
- yield app.start();
24
- yield app.db.sync({
25
- force,
26
- alter: {
27
- drop: force
28
- }
29
- });
30
24
  yield app.stop({
31
25
  cliArgs
32
26
  });
@@ -12,8 +12,8 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
12
12
  var _default = app => {
13
13
  app.command('migrator').action( /*#__PURE__*/function () {
14
14
  var _ref = _asyncToGenerator(function* (opts) {
15
- yield app.start();
16
15
  console.log('migrating...');
16
+ yield app.emitAsync('cli.beforeMigrator', opts);
17
17
  yield app.db.migrator.runAsCLI(process.argv.slice(3));
18
18
  yield app.stop();
19
19
  });
@@ -28,7 +28,6 @@ var _default = app => {
28
28
  app.command('upgrade').action( /*#__PURE__*/_asyncToGenerator(function* (...cliArgs) {
29
29
  const opts = cliArgs[0];
30
30
  console.log('upgrading...');
31
- yield app.start();
32
31
  yield app.upgrade();
33
32
  yield app.stop({
34
33
  cliArgs
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/server",
3
- "version": "0.7.2-alpha.6",
3
+ "version": "0.7.2-alpha.7",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -13,10 +13,10 @@
13
13
  "dependencies": {
14
14
  "@koa/cors": "^3.1.0",
15
15
  "@koa/router": "^9.4.0",
16
- "@nocobase/acl": "0.7.2-alpha.6",
17
- "@nocobase/actions": "0.7.2-alpha.6",
18
- "@nocobase/database": "0.7.2-alpha.6",
19
- "@nocobase/resourcer": "0.7.2-alpha.6",
16
+ "@nocobase/acl": "0.7.2-alpha.7",
17
+ "@nocobase/actions": "0.7.2-alpha.7",
18
+ "@nocobase/database": "0.7.2-alpha.7",
19
+ "@nocobase/resourcer": "0.7.2-alpha.7",
20
20
  "chalk": "^4.1.1",
21
21
  "commander": "^9.2.0",
22
22
  "find-package-json": "^1.2.0",
@@ -30,5 +30,5 @@
30
30
  "devDependencies": {
31
31
  "@types/semver": "^7.3.9"
32
32
  },
33
- "gitHead": "c5f7034351f0c85857d0756f033566570a53df54"
33
+ "gitHead": "c34194ae51395346b7cf1d1b6b5e127597d956ab"
34
34
  }