@niledatabase/server 3.0.0-alpha.15 → 3.0.0-alpha.16

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.
@@ -2,12 +2,7 @@ import { Config } from '../utils/Config';
2
2
  /**
3
3
  * a helper function to log in server side.
4
4
  */
5
- export default function serverAuth(config: Config, handlers: {
6
- GET: (req: Request) => Promise<void | Response>;
7
- POST: (req: Request) => Promise<void | Response>;
8
- DELETE: (req: Request) => Promise<void | Response>;
9
- PUT: (req: Request) => Promise<void | Response>;
10
- }): ({ email, password, }: {
5
+ export default function login(config: Config): ({ email, password, }: {
11
6
  email: string;
12
7
  password: string;
13
8
  }) => Promise<Headers>;
@@ -3071,7 +3071,7 @@ var appRoutes = function appRoutes(prefix) {
3071
3071
  /**
3072
3072
  * a helper function to log in server side.
3073
3073
  */
3074
- function serverAuth(config, handlers) {
3074
+ function login(config) {
3075
3075
  var _Logger = Logger(config, '[server side login]'),
3076
3076
  info = _Logger.info,
3077
3077
  error = _Logger.error;
@@ -3099,7 +3099,7 @@ function serverAuth(config, handlers) {
3099
3099
  })
3100
3100
  });
3101
3101
  _context.next = 8;
3102
- return handlers.POST(sessionReq);
3102
+ return fetch(sessionReq);
3103
3103
  case 8:
3104
3104
  sessionRes = _context.sent;
3105
3105
  _context.prev = 9;
@@ -3124,7 +3124,7 @@ function serverAuth(config, handlers) {
3124
3124
  })
3125
3125
  });
3126
3126
  _context.next = 24;
3127
- return handlers.POST(csrfReq);
3127
+ return fetch(csrfReq);
3128
3128
  case 24:
3129
3129
  csrfRes = _context.sent;
3130
3130
  _context.prev = 25;
@@ -3182,7 +3182,7 @@ function serverAuth(config, handlers) {
3182
3182
  })
3183
3183
  });
3184
3184
  _context.next = 53;
3185
- return handlers.POST(postReq);
3185
+ return fetch(postReq);
3186
3186
  case 53:
3187
3187
  loginRes = _context.sent;
3188
3188
  authCookie = loginRes == null ? void 0 : loginRes.headers.get('set-cookie');
@@ -3807,7 +3807,7 @@ var Api = /*#__PURE__*/function () {
3807
3807
  while (1) switch (_context.prev = _context.next) {
3808
3808
  case 0:
3809
3809
  _context.next = 2;
3810
- return serverAuth(this.config, this.handlers)(payload);
3810
+ return login(this.config)(payload);
3811
3811
  case 2:
3812
3812
  this.headers = _context.sent;
3813
3813
  case 3:
@@ -3816,10 +3816,10 @@ var Api = /*#__PURE__*/function () {
3816
3816
  }
3817
3817
  }, _callee, this);
3818
3818
  }));
3819
- function login(_x) {
3819
+ function login$1(_x) {
3820
3820
  return _login.apply(this, arguments);
3821
3821
  }
3822
- return login;
3822
+ return login$1;
3823
3823
  }();
3824
3824
  return _createClass(Api, [{
3825
3825
  key: "headers",