@niledatabase/server 3.0.0-alpha.25 → 3.0.0-alpha.26

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/dist/Api.d.ts CHANGED
@@ -14,6 +14,7 @@ export declare class Api {
14
14
  PUT: (req: Request) => Promise<void | Response>;
15
15
  };
16
16
  constructor(config: Config);
17
+ updateConfig(config: Config): void;
17
18
  set headers(headers: Headers);
18
19
  login(payload: {
19
20
  email: string;
@@ -4059,6 +4059,10 @@ var Api = /*#__PURE__*/function () {
4059
4059
  this.handlers = Handlers(this.routes, config);
4060
4060
  }
4061
4061
  var _proto = Api.prototype;
4062
+ _proto.updateConfig = function updateConfig(config) {
4063
+ this.config = config;
4064
+ this.handlers = Handlers(this.routes, config);
4065
+ };
4062
4066
  _proto.login = /*#__PURE__*/function () {
4063
4067
  var _login = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(payload) {
4064
4068
  return _regeneratorRuntime().wrap(function _callee$(_context) {
@@ -4110,6 +4114,7 @@ var Server = /*#__PURE__*/function () {
4110
4114
  var _proto = Server.prototype;
4111
4115
  _proto.setConfig = function setConfig(cfg) {
4112
4116
  this.config = new Config(cfg);
4117
+ this.api.updateConfig(this.config);
4113
4118
  };
4114
4119
  _proto.init = /*#__PURE__*/function () {
4115
4120
  var _init = /*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(cfg) {
@@ -4218,11 +4223,20 @@ function _create() {
4218
4223
  if (!server) {
4219
4224
  server = new Server(config);
4220
4225
  }
4221
- _context2.next = 3;
4226
+ if (!config) {
4227
+ _context2.next = 5;
4228
+ break;
4229
+ }
4230
+ _context2.next = 4;
4231
+ return server.init(new Config(config));
4232
+ case 4:
4233
+ return _context2.abrupt("return", _context2.sent);
4234
+ case 5:
4235
+ _context2.next = 7;
4222
4236
  return server.init();
4223
- case 3:
4237
+ case 7:
4224
4238
  return _context2.abrupt("return", _context2.sent);
4225
- case 4:
4239
+ case 8:
4226
4240
  case "end":
4227
4241
  return _context2.stop();
4228
4242
  }