@nocobase/server 0.10.1-alpha.1 → 0.11.1-alpha.1

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.
@@ -1,8 +1,8 @@
1
1
  /// <reference types="node" />
2
2
  import http, { IncomingMessage, ServerResponse } from 'http';
3
3
  import Application from './application';
4
- declare type AppSelectorReturn = Application | string | undefined | null;
5
- declare type AppSelector = (req: IncomingMessage) => AppSelectorReturn | Promise<AppSelectorReturn>;
4
+ type AppSelectorReturn = Application | string | undefined | null;
5
+ type AppSelector = (req: IncomingMessage) => AppSelectorReturn | Promise<AppSelectorReturn>;
6
6
  export declare class AppManager {
7
7
  applications: Map<string, Application>;
8
8
  app: Application;
@@ -14,7 +14,7 @@ import Koa, { DefaultContext as KoaDefaultContext, DefaultState as KoaDefaultSta
14
14
  import { AppManager } from './app-manager';
15
15
  import { Plugin } from './plugin';
16
16
  import { InstallOptions, PluginManager } from './plugin-manager';
17
- export declare type PluginConfiguration = string | [string, any];
17
+ export type PluginConfiguration = string | [string, any];
18
18
  export interface ResourcerOptions {
19
19
  prefix?: string;
20
20
  }
@@ -339,7 +339,7 @@ class Application extends _koa().default {
339
339
  load(options) {
340
340
  var _this4 = this;
341
341
  return _asyncToGenerator(function* () {
342
- if (options === null || options === void 0 ? void 0 : options.reload) {
342
+ if (options !== null && options !== void 0 && options.reload) {
343
343
  console.log(`Reload the ${_this4.name} application configuration`);
344
344
  const oldDb = _this4._db;
345
345
  _this4.init();
@@ -403,7 +403,7 @@ class Application extends _koa().default {
403
403
  yield _this8.db.sync();
404
404
  }
405
405
  yield _this8.emitAsync('beforeStart', _this8, options);
406
- if (options === null || options === void 0 ? void 0 : (_options$listen = options.listen) === null || _options$listen === void 0 ? void 0 : _options$listen.port) {
406
+ if (options !== null && options !== void 0 && (_options$listen = options.listen) !== null && _options$listen !== void 0 && _options$listen.port) {
407
407
  const pmServer = yield _this8.pm.listen();
408
408
  const listen = () => new Promise((resolve, reject) => {
409
409
  const Server = _this8.listen(options === null || options === void 0 ? void 0 : options.listen, () => {
@@ -476,7 +476,7 @@ class Application extends _koa().default {
476
476
  });
477
477
  if (!r) {
478
478
  console.log(_chalk().default.red('The database only supports MySQL 8.0.17 and above, SQLite 3.x and PostgreSQL 10+'));
479
- if (options === null || options === void 0 ? void 0 : options.exit) {
479
+ if (options !== null && options !== void 0 && options.exit) {
480
480
  process.exit();
481
481
  }
482
482
  return false;
@@ -487,7 +487,7 @@ class Application extends _koa().default {
487
487
  });
488
488
  if ((result === null || result === void 0 ? void 0 : result.Value) === '1' && !_this11.db.options.underscored) {
489
489
  console.log(`Your database lower_case_table_names=1, please add ${_chalk().default.yellow('DB_UNDERSCORED=true')} to the .env file`);
490
- if (options === null || options === void 0 ? void 0 : options.exit) {
490
+ if (options !== null && options !== void 0 && options.exit) {
491
491
  process.exit();
492
492
  }
493
493
  return false;
@@ -507,7 +507,7 @@ class Application extends _koa().default {
507
507
  return _asyncToGenerator(function* () {
508
508
  var _options$sync;
509
509
  console.log('Database dialect: ' + _this13.db.sequelize.getDialect());
510
- if ((options === null || options === void 0 ? void 0 : options.clean) || (options === null || options === void 0 ? void 0 : (_options$sync = options.sync) === null || _options$sync === void 0 ? void 0 : _options$sync.force)) {
510
+ if (options !== null && options !== void 0 && options.clean || options !== null && options !== void 0 && (_options$sync = options.sync) !== null && _options$sync !== void 0 && _options$sync.force) {
511
511
  console.log('Truncate database and reload app configuration');
512
512
  yield _this13.db.clean({
513
513
  drop: true
@@ -24,7 +24,7 @@ var _default = app => {
24
24
  return;
25
25
  }
26
26
  }
27
- if (!(opts === null || opts === void 0 ? void 0 : opts.clean) && !(opts === null || opts === void 0 ? void 0 : opts.force)) {
27
+ if (!(opts !== null && opts !== void 0 && opts.clean) && !(opts !== null && opts !== void 0 && opts.force)) {
28
28
  if (yield app.isInstalled()) {
29
29
  installed = true;
30
30
  if (!opts.silent) {
@@ -1,6 +1,6 @@
1
1
  import Application from '../application';
2
- declare const _default: (app: Application) => void;
3
2
  /**
4
3
  * TODO
5
4
  */
5
+ declare const _default: (app: Application) => void;
6
6
  export default _default;
@@ -118,7 +118,7 @@ class PluginManager {
118
118
  });
119
119
  this.app.on('beforeLoad', /*#__PURE__*/function () {
120
120
  var _ref2 = _asyncToGenerator(function* (app, options) {
121
- if ((options === null || options === void 0 ? void 0 : options.method) && ['install', 'upgrade'].includes(options.method)) {
121
+ if (options !== null && options !== void 0 && options.method && ['install', 'upgrade'].includes(options.method)) {
122
122
  yield _this.collection.sync();
123
123
  }
124
124
  const exists = yield _this.app.db.collectionExistsInDb('applicationPlugins');
@@ -271,7 +271,7 @@ class PluginManager {
271
271
  return pm;
272
272
  }
273
273
  addStatic(plugin, options) {
274
- if (!(options === null || options === void 0 ? void 0 : options.async)) {
274
+ if (!(options !== null && options !== void 0 && options.async)) {
275
275
  this._tmpPluginArgs.push([plugin, options]);
276
276
  }
277
277
  let name;
package/lib/plugin.d.ts CHANGED
@@ -16,7 +16,7 @@ export interface PluginOptions {
16
16
  plugin?: typeof Plugin;
17
17
  [key: string]: any;
18
18
  }
19
- export declare type PluginType = typeof Plugin;
19
+ export type PluginType = typeof Plugin;
20
20
  export declare abstract class Plugin<O = any> implements PluginInterface {
21
21
  options: any;
22
22
  app: Application;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/server",
3
- "version": "0.10.1-alpha.1",
3
+ "version": "0.11.1-alpha.1",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -8,27 +8,27 @@
8
8
  "@hapi/topo": "^6.0.0",
9
9
  "@koa/cors": "^3.1.0",
10
10
  "@koa/router": "^9.4.0",
11
- "@nocobase/acl": "0.10.1-alpha.1",
12
- "@nocobase/actions": "0.10.1-alpha.1",
13
- "@nocobase/auth": "0.10.1-alpha.1",
14
- "@nocobase/database": "0.10.1-alpha.1",
15
- "@nocobase/logger": "0.10.1-alpha.1",
16
- "@nocobase/resourcer": "0.10.1-alpha.1",
17
- "@nocobase/utils": "0.10.1-alpha.1",
11
+ "@nocobase/acl": "0.11.1-alpha.1",
12
+ "@nocobase/actions": "0.11.1-alpha.1",
13
+ "@nocobase/auth": "0.11.1-alpha.1",
14
+ "@nocobase/database": "0.11.1-alpha.1",
15
+ "@nocobase/logger": "0.11.1-alpha.1",
16
+ "@nocobase/resourcer": "0.11.1-alpha.1",
17
+ "@nocobase/utils": "0.11.1-alpha.1",
18
18
  "chalk": "^4.1.1",
19
19
  "commander": "^9.2.0",
20
+ "dayjs": "^1.11.8",
20
21
  "find-package-json": "^1.2.0",
21
22
  "i18next": "^22.4.9",
22
23
  "koa": "^2.13.4",
23
24
  "koa-bodyparser": "^4.3.0",
24
25
  "koa-static": "^5.0.0",
25
26
  "lodash": "^4.17.21",
26
- "moment": "^2.29.1",
27
27
  "semver": "^7.3.7",
28
28
  "xpipe": "^1.0.5"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@types/semver": "^7.3.9"
32
32
  },
33
- "gitHead": "8f415f5e0ee2e72d681f9ab16af5911b52c374a9"
33
+ "gitHead": "9ed1dba520bc5f3a7cb1255ea8d92ccbefc11bc8"
34
34
  }