@niledatabase/server 3.0.0-alpha.33 → 3.0.0-alpha.34

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.
@@ -1356,7 +1356,7 @@ function _request() {
1356
1356
  return _request.apply(this, arguments);
1357
1357
  }
1358
1358
 
1359
- var key$7 = 'ME';
1359
+ var key$8 = 'ME';
1360
1360
  /**
1361
1361
  * @swagger
1362
1362
  * /api/me:
@@ -1407,16 +1407,16 @@ function _GET$4() {
1407
1407
  }));
1408
1408
  return _GET$4.apply(this, arguments);
1409
1409
  }
1410
- function route$a(_x4, _x5) {
1411
- return _route$a.apply(this, arguments);
1410
+ function route$b(_x4, _x5) {
1411
+ return _route$b.apply(this, arguments);
1412
1412
  }
1413
- function _route$a() {
1414
- _route$a = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request, config) {
1413
+ function _route$b() {
1414
+ _route$b = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(request, config) {
1415
1415
  var url;
1416
1416
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1417
1417
  while (1) switch (_context2.prev = _context2.next) {
1418
1418
  case 0:
1419
- url = apiRoutes(config)[key$7];
1419
+ url = apiRoutes(config)[key$8];
1420
1420
  _context2.t0 = request.method;
1421
1421
  _context2.next = _context2.t0 === 'GET' ? 4 : 7;
1422
1422
  break;
@@ -1437,10 +1437,10 @@ function _route$a() {
1437
1437
  }
1438
1438
  }, _callee2);
1439
1439
  }));
1440
- return _route$a.apply(this, arguments);
1440
+ return _route$b.apply(this, arguments);
1441
1441
  }
1442
- function matches$a(configRoutes, request) {
1443
- return urlMatches(request.url, configRoutes[key$7]);
1442
+ function matches$b(configRoutes, request) {
1443
+ return urlMatches(request.url, configRoutes[key$8]);
1444
1444
  }
1445
1445
 
1446
1446
  function auth(_x, _x2) {
@@ -1808,11 +1808,11 @@ function _fetch2() {
1808
1808
  * description: Unauthorized
1809
1809
  * content: {}
1810
1810
  */
1811
- function POST$2(_x, _x2) {
1812
- return _POST$2.apply(this, arguments);
1811
+ function POST$3(_x, _x2) {
1812
+ return _POST$3.apply(this, arguments);
1813
1813
  }
1814
- function _POST$2() {
1815
- _POST$2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, init) {
1814
+ function _POST$3() {
1815
+ _POST$3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, init) {
1816
1816
  var yurl, tenantId, newTenantName, tenant, url;
1817
1817
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1818
1818
  while (1) switch (_context.prev = _context.next) {
@@ -1837,7 +1837,7 @@ function _POST$2() {
1837
1837
  }
1838
1838
  }, _callee);
1839
1839
  }));
1840
- return _POST$2.apply(this, arguments);
1840
+ return _POST$3.apply(this, arguments);
1841
1841
  }
1842
1842
 
1843
1843
  /**
@@ -1978,19 +1978,19 @@ function _PUT$2() {
1978
1978
  return _PUT$2.apply(this, arguments);
1979
1979
  }
1980
1980
 
1981
- var key$6 = 'USERS';
1982
- function route$9(_x, _x2) {
1983
- return _route$9.apply(this, arguments);
1981
+ var key$7 = 'USERS';
1982
+ function route$a(_x, _x2) {
1983
+ return _route$a.apply(this, arguments);
1984
1984
  }
1985
- function _route$9() {
1986
- _route$9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request, config) {
1985
+ function _route$a() {
1986
+ _route$a = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request, config) {
1987
1987
  var _Logger, info, session;
1988
1988
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1989
1989
  while (1) switch (_context.prev = _context.next) {
1990
1990
  case 0:
1991
1991
  _Logger = Logger(_extends({}, config, {
1992
1992
  debug: config.debug
1993
- }), "[ROUTES][" + key$6 + "]"), info = _Logger.info;
1993
+ }), "[ROUTES][" + key$7 + "]"), info = _Logger.info;
1994
1994
  _context.next = 3;
1995
1995
  return auth(request, config);
1996
1996
  case 3:
@@ -2007,7 +2007,7 @@ function _route$9() {
2007
2007
  return _context.abrupt("return", _context.sent);
2008
2008
  case 10:
2009
2009
  _context.next = 12;
2010
- return POST$2(config, {
2010
+ return POST$3(config, {
2011
2011
  request: request
2012
2012
  });
2013
2013
  case 12:
@@ -2029,10 +2029,10 @@ function _route$9() {
2029
2029
  }
2030
2030
  }, _callee);
2031
2031
  }));
2032
- return _route$9.apply(this, arguments);
2032
+ return _route$a.apply(this, arguments);
2033
2033
  }
2034
- function matches$9(configRoutes, request) {
2035
- return urlMatches(request.url, configRoutes[key$6]);
2034
+ function matches$a(configRoutes, request) {
2035
+ return urlMatches(request.url, configRoutes[key$7]);
2036
2036
  }
2037
2037
 
2038
2038
  /**
@@ -2131,11 +2131,11 @@ function _GET$2() {
2131
2131
  * schema:
2132
2132
  * $ref: '#/components/schemas/User'
2133
2133
  */
2134
- function POST$1(_x, _x2, _x3) {
2135
- return _POST$1.apply(this, arguments);
2134
+ function POST$2(_x, _x2, _x3) {
2135
+ return _POST$2.apply(this, arguments);
2136
2136
  }
2137
- function _POST$1() {
2138
- _POST$1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, session, init) {
2137
+ function _POST$2() {
2138
+ _POST$2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, session, init) {
2139
2139
  var yurl, _yurl$pathname$split$, tenantId, url;
2140
2140
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2141
2141
  while (1) switch (_context.prev = _context.next) {
@@ -2158,7 +2158,7 @@ function _POST$1() {
2158
2158
  }
2159
2159
  }, _callee);
2160
2160
  }));
2161
- return _POST$1.apply(this, arguments);
2161
+ return _POST$2.apply(this, arguments);
2162
2162
  }
2163
2163
 
2164
2164
  /**
@@ -2267,19 +2267,19 @@ function _PUT$1() {
2267
2267
  return _PUT$1.apply(this, arguments);
2268
2268
  }
2269
2269
 
2270
- var key$5 = 'TENANT_USERS';
2271
- function route$8(_x, _x2) {
2272
- return _route$8.apply(this, arguments);
2270
+ var key$6 = 'TENANT_USERS';
2271
+ function route$9(_x, _x2) {
2272
+ return _route$9.apply(this, arguments);
2273
2273
  }
2274
- function _route$8() {
2275
- _route$8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request, config) {
2274
+ function _route$9() {
2275
+ _route$9 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request, config) {
2276
2276
  var _Logger, info, session, yurl, _yurl$pathname$split$, tenantId;
2277
2277
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2278
2278
  while (1) switch (_context.prev = _context.next) {
2279
2279
  case 0:
2280
2280
  _Logger = Logger(_extends({}, config, {
2281
2281
  debug: config.debug
2282
- }), "[ROUTES][" + key$5 + "]"), info = _Logger.info;
2282
+ }), "[ROUTES][" + key$6 + "]"), info = _Logger.info;
2283
2283
  _context.next = 3;
2284
2284
  return auth(request, config);
2285
2285
  case 3:
@@ -2316,7 +2316,7 @@ function _route$8() {
2316
2316
  return _context.abrupt("return", _context.sent);
2317
2317
  case 18:
2318
2318
  _context.next = 20;
2319
- return POST$1(config, session, {
2319
+ return POST$2(config, session, {
2320
2320
  request: request
2321
2321
  });
2322
2322
  case 20:
@@ -2345,17 +2345,17 @@ function _route$8() {
2345
2345
  }
2346
2346
  }, _callee);
2347
2347
  }));
2348
- return _route$8.apply(this, arguments);
2348
+ return _route$9.apply(this, arguments);
2349
2349
  }
2350
- function matches$8(configRoutes, request) {
2350
+ function matches$9(configRoutes, request) {
2351
2351
  var url = new URL(request.url);
2352
2352
  var _url$pathname$split$r = url.pathname.split('/').reverse(),
2353
2353
  userId = _url$pathname$split$r[0],
2354
2354
  possibleTenantId = _url$pathname$split$r[1],
2355
2355
  tenantId = _url$pathname$split$r[2];
2356
- var route = configRoutes[key$5].replace('{tenantId}', tenantId).replace('{userId}', userId);
2356
+ var route = configRoutes[key$6].replace('{tenantId}', tenantId).replace('{userId}', userId);
2357
2357
  if (userId === 'users') {
2358
- route = configRoutes[key$5].replace('{tenantId}', possibleTenantId);
2358
+ route = configRoutes[key$6].replace('{tenantId}', possibleTenantId);
2359
2359
  }
2360
2360
  return urlMatches(request.url, route);
2361
2361
  }
@@ -2657,11 +2657,11 @@ function _PUT() {
2657
2657
  * schema:
2658
2658
  * $ref: '#/components/schemas/APIError'
2659
2659
  */
2660
- function POST(_x, _x2) {
2661
- return _POST.apply(this, arguments);
2660
+ function POST$1(_x, _x2) {
2661
+ return _POST$1.apply(this, arguments);
2662
2662
  }
2663
- function _POST() {
2664
- _POST = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, init) {
2663
+ function _POST$1() {
2664
+ _POST$1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, init) {
2665
2665
  var url;
2666
2666
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2667
2667
  while (1) switch (_context.prev = _context.next) {
@@ -2679,7 +2679,7 @@ function _POST() {
2679
2679
  }
2680
2680
  }, _callee);
2681
2681
  }));
2682
- return _POST.apply(this, arguments);
2682
+ return _POST$1.apply(this, arguments);
2683
2683
  }
2684
2684
 
2685
2685
  function isUUID(value) {
@@ -2690,19 +2690,19 @@ function isUUID(value) {
2690
2690
  var regex = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5|7][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/;
2691
2691
  return regex.test(value);
2692
2692
  }
2693
- var key$4 = 'TENANTS';
2694
- function route$7(_x, _x2) {
2695
- return _route$7.apply(this, arguments);
2693
+ var key$5 = 'TENANTS';
2694
+ function route$8(_x, _x2) {
2695
+ return _route$8.apply(this, arguments);
2696
2696
  }
2697
- function _route$7() {
2698
- _route$7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request, config) {
2697
+ function _route$8() {
2698
+ _route$8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request, config) {
2699
2699
  var _Logger, info, session, _request$url$split$re, possibleTenantId;
2700
2700
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2701
2701
  while (1) switch (_context.prev = _context.next) {
2702
2702
  case 0:
2703
2703
  _Logger = Logger(_extends({}, config, {
2704
2704
  debug: config.debug
2705
- }), "[ROUTES][" + key$4 + "]"), info = _Logger.info;
2705
+ }), "[ROUTES][" + key$5 + "]"), info = _Logger.info;
2706
2706
  _context.next = 3;
2707
2707
  return auth(request, config);
2708
2708
  case 3:
@@ -2740,7 +2740,7 @@ function _route$7() {
2740
2740
  return _context.abrupt("return", _context.sent);
2741
2741
  case 18:
2742
2742
  _context.next = 20;
2743
- return POST(config, {
2743
+ return POST$1(config, {
2744
2744
  request: request
2745
2745
  });
2746
2746
  case 20:
@@ -2769,10 +2769,10 @@ function _route$7() {
2769
2769
  }
2770
2770
  }, _callee);
2771
2771
  }));
2772
- return _route$7.apply(this, arguments);
2772
+ return _route$8.apply(this, arguments);
2773
2773
  }
2774
- function matches$7(configRoutes, request) {
2775
- return urlMatches(request.url, configRoutes[key$4]);
2774
+ function matches$8(configRoutes, request) {
2775
+ return urlMatches(request.url, configRoutes[key$5]);
2776
2776
  }
2777
2777
 
2778
2778
  var proxyRoutes = function proxyRoutes(config) {
@@ -2787,17 +2787,17 @@ var proxyRoutes = function proxyRoutes(config) {
2787
2787
  };
2788
2788
  };
2789
2789
 
2790
- var key$3 = 'SIGNIN';
2791
- function route$6(_x, _x2) {
2792
- return _route$6.apply(this, arguments);
2790
+ var key$4 = 'SIGNIN';
2791
+ function route$7(_x, _x2) {
2792
+ return _route$7.apply(this, arguments);
2793
2793
  }
2794
- function _route$6() {
2795
- _route$6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, config) {
2794
+ function _route$7() {
2795
+ _route$7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, config) {
2796
2796
  var url, init, _URL$pathname$split$r, provider, passThroughUrl, params, res;
2797
2797
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2798
2798
  while (1) switch (_context.prev = _context.next) {
2799
2799
  case 0:
2800
- url = proxyRoutes(config)[key$3];
2800
+ url = proxyRoutes(config)[key$4];
2801
2801
  init = {
2802
2802
  method: req.method,
2803
2803
  headers: req.headers
@@ -2807,7 +2807,7 @@ function _route$6() {
2807
2807
  init.body = req.clone().body;
2808
2808
  }
2809
2809
  _URL$pathname$split$r = new URL(req.url).pathname.split('/').reverse(), provider = _URL$pathname$split$r[0];
2810
- url = proxyRoutes(config)[key$3] + "/" + provider;
2810
+ url = proxyRoutes(config)[key$4] + "/" + provider;
2811
2811
  }
2812
2812
  passThroughUrl = new URL(req.url);
2813
2813
  params = new URLSearchParams(passThroughUrl.search);
@@ -2825,17 +2825,17 @@ function _route$6() {
2825
2825
  }
2826
2826
  }, _callee);
2827
2827
  }));
2828
- return _route$6.apply(this, arguments);
2828
+ return _route$7.apply(this, arguments);
2829
2829
  }
2830
- function matches$6(configRoutes, request) {
2831
- return urlMatches(request.url, configRoutes[key$3]);
2830
+ function matches$7(configRoutes, request) {
2831
+ return urlMatches(request.url, configRoutes[key$4]);
2832
2832
  }
2833
2833
 
2834
- function route$5(_x, _x2) {
2835
- return _route$5.apply(this, arguments);
2834
+ function route$6(_x, _x2) {
2835
+ return _route$6.apply(this, arguments);
2836
2836
  }
2837
- function _route$5() {
2838
- _route$5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, config) {
2837
+ function _route$6() {
2838
+ _route$6 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, config) {
2839
2839
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2840
2840
  while (1) switch (_context.prev = _context.next) {
2841
2841
  case 0:
@@ -2849,17 +2849,17 @@ function _route$5() {
2849
2849
  }
2850
2850
  }, _callee);
2851
2851
  }));
2852
- return _route$5.apply(this, arguments);
2852
+ return _route$6.apply(this, arguments);
2853
2853
  }
2854
- function matches$5(configRoutes, request) {
2854
+ function matches$6(configRoutes, request) {
2855
2855
  return urlMatches(request.url, configRoutes.SESSION);
2856
2856
  }
2857
2857
 
2858
- function route$4(_x, _x2) {
2859
- return _route$4.apply(this, arguments);
2858
+ function route$5(_x, _x2) {
2859
+ return _route$5.apply(this, arguments);
2860
2860
  }
2861
- function _route$4() {
2862
- _route$4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, config) {
2861
+ function _route$5() {
2862
+ _route$5 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, config) {
2863
2863
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2864
2864
  while (1) switch (_context.prev = _context.next) {
2865
2865
  case 0:
@@ -2873,17 +2873,17 @@ function _route$4() {
2873
2873
  }
2874
2874
  }, _callee);
2875
2875
  }));
2876
- return _route$4.apply(this, arguments);
2876
+ return _route$5.apply(this, arguments);
2877
2877
  }
2878
- function matches$4(configRoutes, request) {
2878
+ function matches$5(configRoutes, request) {
2879
2879
  return urlMatches(request.url, configRoutes.PROVIDERS);
2880
2880
  }
2881
2881
 
2882
- function route$3(_x, _x2) {
2883
- return _route$3.apply(this, arguments);
2882
+ function route$4(_x, _x2) {
2883
+ return _route$4.apply(this, arguments);
2884
2884
  }
2885
- function _route$3() {
2886
- _route$3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, config) {
2885
+ function _route$4() {
2886
+ _route$4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, config) {
2887
2887
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2888
2888
  while (1) switch (_context.prev = _context.next) {
2889
2889
  case 0:
@@ -2897,25 +2897,25 @@ function _route$3() {
2897
2897
  }
2898
2898
  }, _callee);
2899
2899
  }));
2900
- return _route$3.apply(this, arguments);
2900
+ return _route$4.apply(this, arguments);
2901
2901
  }
2902
- function matches$3(configRoutes, request) {
2902
+ function matches$4(configRoutes, request) {
2903
2903
  return urlMatches(request.url, configRoutes.CSRF);
2904
2904
  }
2905
2905
 
2906
- var key$2 = 'CALLBACK';
2907
- function route$2(_x, _x2) {
2908
- return _route$2.apply(this, arguments);
2906
+ var key$3 = 'CALLBACK';
2907
+ function route$3(_x, _x2) {
2908
+ return _route$3.apply(this, arguments);
2909
2909
  }
2910
- function _route$2() {
2911
- _route$2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request$1, config) {
2910
+ function _route$3() {
2911
+ _route$3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request$1, config) {
2912
2912
  var _Logger, error, _URL$pathname$split$r, provider, passThroughUrl, params, url, res, location;
2913
2913
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2914
2914
  while (1) switch (_context.prev = _context.next) {
2915
2915
  case 0:
2916
2916
  _Logger = Logger(_extends({}, config, {
2917
2917
  debug: config.debug
2918
- }), "[ROUTES][" + key$2 + "]"), error = _Logger.error;
2918
+ }), "[ROUTES][" + key$3 + "]"), error = _Logger.error;
2919
2919
  _URL$pathname$split$r = new URL(request$1.url).pathname.split('/').reverse(), provider = _URL$pathname$split$r[0];
2920
2920
  passThroughUrl = new URL(request$1.url);
2921
2921
  params = new URLSearchParams(passThroughUrl.search);
@@ -2949,30 +2949,30 @@ function _route$2() {
2949
2949
  }
2950
2950
  }, _callee);
2951
2951
  }));
2952
- return _route$2.apply(this, arguments);
2952
+ return _route$3.apply(this, arguments);
2953
2953
  }
2954
- function matches$2(configRoutes, request) {
2954
+ function matches$3(configRoutes, request) {
2955
2955
  return urlMatches(request.url, configRoutes.CALLBACK);
2956
2956
  }
2957
2957
 
2958
- var key$1 = 'SIGNOUT';
2959
- function route$1(_x, _x2) {
2960
- return _route$1.apply(this, arguments);
2958
+ var key$2 = 'SIGNOUT';
2959
+ function route$2(_x, _x2) {
2960
+ return _route$2.apply(this, arguments);
2961
2961
  }
2962
- function _route$1() {
2963
- _route$1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request$1, config) {
2962
+ function _route$2() {
2963
+ _route$2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request$1, config) {
2964
2964
  var url, init, _URL$pathname$split$r, provider, res;
2965
2965
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2966
2966
  while (1) switch (_context.prev = _context.next) {
2967
2967
  case 0:
2968
- url = proxyRoutes(config)[key$1];
2968
+ url = proxyRoutes(config)[key$2];
2969
2969
  init = {
2970
2970
  method: request$1.method
2971
2971
  };
2972
2972
  if (request$1.method === 'POST') {
2973
2973
  init.body = request$1.body;
2974
2974
  _URL$pathname$split$r = new URL(request$1.url).pathname.split('/').reverse(), provider = _URL$pathname$split$r[0];
2975
- url = proxyRoutes(config)[key$1] + "/" + provider;
2975
+ url = proxyRoutes(config)[key$2] + "/" + provider;
2976
2976
  }
2977
2977
  _context.next = 5;
2978
2978
  return request(url, _extends({}, init, {
@@ -2987,22 +2987,22 @@ function _route$1() {
2987
2987
  }
2988
2988
  }, _callee);
2989
2989
  }));
2990
- return _route$1.apply(this, arguments);
2990
+ return _route$2.apply(this, arguments);
2991
2991
  }
2992
- function matches$1(configRoutes, request) {
2993
- return urlMatches(request.url, configRoutes[key$1]);
2992
+ function matches$2(configRoutes, request) {
2993
+ return urlMatches(request.url, configRoutes[key$2]);
2994
2994
  }
2995
2995
 
2996
- var key = 'ERROR';
2997
- function route(_x, _x2) {
2998
- return _route.apply(this, arguments);
2996
+ var key$1 = 'ERROR';
2997
+ function route$1(_x, _x2) {
2998
+ return _route$1.apply(this, arguments);
2999
2999
  }
3000
- function _route() {
3001
- _route = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, config) {
3000
+ function _route$1() {
3001
+ _route$1 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(req, config) {
3002
3002
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3003
3003
  while (1) switch (_context.prev = _context.next) {
3004
3004
  case 0:
3005
- return _context.abrupt("return", request(proxyRoutes(config)[key], {
3005
+ return _context.abrupt("return", request(proxyRoutes(config)[key$1], {
3006
3006
  method: req.method,
3007
3007
  request: req
3008
3008
  }, config));
@@ -3012,10 +3012,10 @@ function _route() {
3012
3012
  }
3013
3013
  }, _callee);
3014
3014
  }));
3015
- return _route.apply(this, arguments);
3015
+ return _route$1.apply(this, arguments);
3016
3016
  }
3017
- function matches(configRoutes, request) {
3018
- return urlMatches(request.url, configRoutes[key]);
3017
+ function matches$1(configRoutes, request) {
3018
+ return urlMatches(request.url, configRoutes[key$1]);
3019
3019
  }
3020
3020
 
3021
3021
  function GETTER(configRoutes, config) {
@@ -3027,82 +3027,82 @@ function GETTER(configRoutes, config) {
3027
3027
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3028
3028
  while (1) switch (_context.prev = _context.next) {
3029
3029
  case 0:
3030
- if (!matches$a(configRoutes, req)) {
3030
+ if (!matches$b(configRoutes, req)) {
3031
3031
  _context.next = 3;
3032
3032
  break;
3033
3033
  }
3034
3034
  info('matches me');
3035
- return _context.abrupt("return", route$a(req, config));
3035
+ return _context.abrupt("return", route$b(req, config));
3036
3036
  case 3:
3037
- if (!matches$8(configRoutes, req)) {
3037
+ if (!matches$9(configRoutes, req)) {
3038
3038
  _context.next = 6;
3039
3039
  break;
3040
3040
  }
3041
3041
  info('matches tenant users');
3042
- return _context.abrupt("return", route$8(req, config));
3042
+ return _context.abrupt("return", route$9(req, config));
3043
3043
  case 6:
3044
- if (!matches$9(configRoutes, req)) {
3044
+ if (!matches$a(configRoutes, req)) {
3045
3045
  _context.next = 9;
3046
3046
  break;
3047
3047
  }
3048
3048
  info('matches users');
3049
- return _context.abrupt("return", route$9(req, config));
3049
+ return _context.abrupt("return", route$a(req, config));
3050
3050
  case 9:
3051
- if (!matches$7(configRoutes, req)) {
3051
+ if (!matches$8(configRoutes, req)) {
3052
3052
  _context.next = 12;
3053
3053
  break;
3054
3054
  }
3055
3055
  info('matches tenants');
3056
- return _context.abrupt("return", route$7(req, config));
3056
+ return _context.abrupt("return", route$8(req, config));
3057
3057
  case 12:
3058
- if (!matches$5(configRoutes, req)) {
3058
+ if (!matches$6(configRoutes, req)) {
3059
3059
  _context.next = 15;
3060
3060
  break;
3061
3061
  }
3062
3062
  info('matches session');
3063
- return _context.abrupt("return", route$5(req, config));
3063
+ return _context.abrupt("return", route$6(req, config));
3064
3064
  case 15:
3065
- if (!matches$6(configRoutes, req)) {
3065
+ if (!matches$7(configRoutes, req)) {
3066
3066
  _context.next = 18;
3067
3067
  break;
3068
3068
  }
3069
3069
  info('matches signin');
3070
- return _context.abrupt("return", route$6(req, config));
3070
+ return _context.abrupt("return", route$7(req, config));
3071
3071
  case 18:
3072
- if (!matches$4(configRoutes, req)) {
3072
+ if (!matches$5(configRoutes, req)) {
3073
3073
  _context.next = 21;
3074
3074
  break;
3075
3075
  }
3076
3076
  info('matches providers');
3077
- return _context.abrupt("return", route$4(req, config));
3077
+ return _context.abrupt("return", route$5(req, config));
3078
3078
  case 21:
3079
- if (!matches$3(configRoutes, req)) {
3079
+ if (!matches$4(configRoutes, req)) {
3080
3080
  _context.next = 24;
3081
3081
  break;
3082
3082
  }
3083
3083
  info('matches csrf');
3084
- return _context.abrupt("return", route$3(req, config));
3084
+ return _context.abrupt("return", route$4(req, config));
3085
3085
  case 24:
3086
- if (!matches$2(configRoutes, req)) {
3086
+ if (!matches$3(configRoutes, req)) {
3087
3087
  _context.next = 27;
3088
3088
  break;
3089
3089
  }
3090
3090
  info('matches callback');
3091
- return _context.abrupt("return", route$2(req, config));
3091
+ return _context.abrupt("return", route$3(req, config));
3092
3092
  case 27:
3093
- if (!matches$1(configRoutes, req)) {
3093
+ if (!matches$2(configRoutes, req)) {
3094
3094
  _context.next = 30;
3095
3095
  break;
3096
3096
  }
3097
3097
  info('matches signout');
3098
- return _context.abrupt("return", route$1(req, config));
3098
+ return _context.abrupt("return", route$2(req, config));
3099
3099
  case 30:
3100
- if (!matches(configRoutes, req)) {
3100
+ if (!matches$1(configRoutes, req)) {
3101
3101
  _context.next = 33;
3102
3102
  break;
3103
3103
  }
3104
3104
  info('matches error');
3105
- return _context.abrupt("return", route(req, config));
3105
+ return _context.abrupt("return", route$1(req, config));
3106
3106
  case 33:
3107
3107
  warn('No GET routes matched');
3108
3108
  return _context.abrupt("return", new Response(null, {
@@ -3121,6 +3121,128 @@ function GETTER(configRoutes, config) {
3121
3121
  }();
3122
3122
  }
3123
3123
 
3124
+ /**
3125
+ * @swagger
3126
+ * /api/signup:
3127
+ * post:
3128
+ * tags:
3129
+ * - users
3130
+ * summary: signs a user up
3131
+ * description: signs a user up and logs them in. Expects a email and password combo
3132
+ * operationId: signUp
3133
+ * parameters:
3134
+ * - name: tenantId
3135
+ * description: A tenant id to add the user to when they are created
3136
+ * in: query
3137
+ * schema:
3138
+ * type: string
3139
+ * - name: newTenantName
3140
+ * description: A tenant name to create, then the user to when they are created
3141
+ * in: query
3142
+ * schema:
3143
+ * type: string
3144
+ * requestBody:
3145
+ * description: |-
3146
+ * The email and password combination the user will use to authenticate.
3147
+ * The `name` is optional; if provided it will be recorded in the `users` table.
3148
+ * The `newTenant` is optional; if provided, it is used as the name of a new tenant record associated with the newly created user.
3149
+ * content:
3150
+ * application/json:
3151
+ * schema:
3152
+ * $ref: '#/components/schemas/CreateBasicUserRequest'
3153
+ * examples:
3154
+ * Create User Request:
3155
+ * summary: Creates a user with basic credentials
3156
+ * description: Create User Request
3157
+ * value:
3158
+ * email: a.user@somedomain.com
3159
+ * password: somepassword
3160
+ * name: A. User
3161
+ * Create User Request with Tenant:
3162
+ * summary: Creates a user and a new tenant for that user
3163
+ * description: Create User Request with Tenant
3164
+ * value:
3165
+ * email: a.user@somedomain.com
3166
+ * password: somepassword
3167
+ * name: A. User
3168
+ * newTenant: My Sandbox
3169
+ * responses:
3170
+ * "201":
3171
+ * description: User and session created
3172
+ * content:
3173
+ * application/json:
3174
+ * schema:
3175
+ * $ref: "#/components/schemas/User"
3176
+ * "400":
3177
+ * description: API/Database failures
3178
+ * content:
3179
+ * text/plain:
3180
+ * schema:
3181
+ * type: string
3182
+ * "401":
3183
+ * description: Unauthorized
3184
+ * content: {}
3185
+ */
3186
+ function POST(_x, _x2) {
3187
+ return _POST.apply(this, arguments);
3188
+ }
3189
+ function _POST() {
3190
+ _POST = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(config, init) {
3191
+ var url;
3192
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3193
+ while (1) switch (_context.prev = _context.next) {
3194
+ case 0:
3195
+ init.body = init.request.body;
3196
+ init.method = 'POST';
3197
+ url = "" + apiRoutes(config).SIGNUP;
3198
+ _context.next = 5;
3199
+ return request(url, init, config);
3200
+ case 5:
3201
+ return _context.abrupt("return", _context.sent);
3202
+ case 6:
3203
+ case "end":
3204
+ return _context.stop();
3205
+ }
3206
+ }, _callee);
3207
+ }));
3208
+ return _POST.apply(this, arguments);
3209
+ }
3210
+
3211
+ var key = 'SIGNUP';
3212
+ function route(_x, _x2) {
3213
+ return _route.apply(this, arguments);
3214
+ }
3215
+ function _route() {
3216
+ _route = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(request, config) {
3217
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3218
+ while (1) switch (_context.prev = _context.next) {
3219
+ case 0:
3220
+ _context.t0 = request.method;
3221
+ _context.next = _context.t0 === 'POST' ? 3 : 6;
3222
+ break;
3223
+ case 3:
3224
+ _context.next = 5;
3225
+ return POST(config, {
3226
+ request: request
3227
+ });
3228
+ case 5:
3229
+ return _context.abrupt("return", _context.sent);
3230
+ case 6:
3231
+ return _context.abrupt("return", new Response('method not allowed', {
3232
+ status: 405
3233
+ }));
3234
+ case 7:
3235
+ case "end":
3236
+ return _context.stop();
3237
+ }
3238
+ }, _callee);
3239
+ }));
3240
+ return _route.apply(this, arguments);
3241
+ }
3242
+ function matches(configRoutes, request) {
3243
+ return urlMatches(request.url, configRoutes[key]);
3244
+ }
3245
+
3124
3246
  function POSTER(configRoutes, config) {
3125
3247
  var _Logger = Logger(config, '[POST MATCHER]'),
3126
3248
  info = _Logger.info,
@@ -3130,74 +3252,81 @@ function POSTER(configRoutes, config) {
3130
3252
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3131
3253
  while (1) switch (_context.prev = _context.next) {
3132
3254
  case 0:
3133
- if (!matches$8(configRoutes, req)) {
3255
+ if (!matches$9(configRoutes, req)) {
3134
3256
  _context.next = 3;
3135
3257
  break;
3136
3258
  }
3137
3259
  info('matches tenant users');
3138
- return _context.abrupt("return", route$8(req, config));
3260
+ return _context.abrupt("return", route$9(req, config));
3139
3261
  case 3:
3140
- if (!matches$9(configRoutes, req)) {
3262
+ if (!matches(configRoutes, req)) {
3141
3263
  _context.next = 6;
3142
3264
  break;
3143
3265
  }
3144
- info('matches users');
3145
- return _context.abrupt("return", route$9(req, config));
3266
+ info('matches signup');
3267
+ return _context.abrupt("return", route(req, config));
3146
3268
  case 6:
3147
- if (!matches$7(configRoutes, req)) {
3269
+ if (!matches$a(configRoutes, req)) {
3148
3270
  _context.next = 9;
3149
3271
  break;
3150
3272
  }
3151
- info('matches tenants');
3152
- return _context.abrupt("return", route$7(req, config));
3273
+ info('matches users');
3274
+ return _context.abrupt("return", route$a(req, config));
3153
3275
  case 9:
3154
- if (!matches$5(configRoutes, req)) {
3276
+ if (!matches$8(configRoutes, req)) {
3155
3277
  _context.next = 12;
3156
3278
  break;
3157
3279
  }
3158
- info('matches session');
3159
- return _context.abrupt("return", route$5(req, config));
3280
+ info('matches tenants');
3281
+ return _context.abrupt("return", route$8(req, config));
3160
3282
  case 12:
3161
3283
  if (!matches$6(configRoutes, req)) {
3162
3284
  _context.next = 15;
3163
3285
  break;
3164
3286
  }
3165
- info('matches signin');
3287
+ info('matches session');
3166
3288
  return _context.abrupt("return", route$6(req, config));
3167
3289
  case 15:
3168
- if (!matches$4(configRoutes, req)) {
3290
+ if (!matches$7(configRoutes, req)) {
3169
3291
  _context.next = 18;
3170
3292
  break;
3171
3293
  }
3172
- info('matches providers');
3173
- return _context.abrupt("return", route$4(req, config));
3294
+ info('matches signin');
3295
+ return _context.abrupt("return", route$7(req, config));
3174
3296
  case 18:
3175
- if (!matches$3(configRoutes, req)) {
3297
+ if (!matches$5(configRoutes, req)) {
3176
3298
  _context.next = 21;
3177
3299
  break;
3178
3300
  }
3179
- info('matches csrf');
3180
- return _context.abrupt("return", route$3(req, config));
3301
+ info('matches providers');
3302
+ return _context.abrupt("return", route$5(req, config));
3181
3303
  case 21:
3182
- if (!matches$2(configRoutes, req)) {
3304
+ if (!matches$4(configRoutes, req)) {
3183
3305
  _context.next = 24;
3184
3306
  break;
3185
3307
  }
3186
- info('matches callback');
3187
- return _context.abrupt("return", route$2(req, config));
3308
+ info('matches csrf');
3309
+ return _context.abrupt("return", route$4(req, config));
3188
3310
  case 24:
3189
- if (!matches$1(configRoutes, req)) {
3311
+ if (!matches$3(configRoutes, req)) {
3190
3312
  _context.next = 27;
3191
3313
  break;
3192
3314
  }
3193
- info('matches signout');
3194
- return _context.abrupt("return", route$1(req, config));
3315
+ info('matches callback');
3316
+ return _context.abrupt("return", route$3(req, config));
3195
3317
  case 27:
3318
+ if (!matches$2(configRoutes, req)) {
3319
+ _context.next = 30;
3320
+ break;
3321
+ }
3322
+ info('matches signout');
3323
+ return _context.abrupt("return", route$2(req, config));
3324
+ case 30:
3196
3325
  warn('No POST routes matched');
3197
3326
  return _context.abrupt("return", new Response(null, {
3198
3327
  status: 404
3199
3328
  }));
3200
- case 29:
3329
+ case 32:
3201
3330
  case "end":
3202
3331
  return _context.stop();
3203
3332
  }
@@ -3219,19 +3348,19 @@ function DELETER(configRoutes, config) {
3219
3348
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3220
3349
  while (1) switch (_context.prev = _context.next) {
3221
3350
  case 0:
3222
- if (!matches$8(configRoutes, req)) {
3351
+ if (!matches$9(configRoutes, req)) {
3223
3352
  _context.next = 3;
3224
3353
  break;
3225
3354
  }
3226
3355
  info('matches tenant users');
3227
- return _context.abrupt("return", route$8(req, config));
3356
+ return _context.abrupt("return", route$9(req, config));
3228
3357
  case 3:
3229
- if (!matches$7(configRoutes, req)) {
3358
+ if (!matches$8(configRoutes, req)) {
3230
3359
  _context.next = 6;
3231
3360
  break;
3232
3361
  }
3233
3362
  info('matches tenants');
3234
- return _context.abrupt("return", route$7(req, config));
3363
+ return _context.abrupt("return", route$8(req, config));
3235
3364
  case 6:
3236
3365
  warn('No DELETE routes matched');
3237
3366
  return _context.abrupt("return", new Response(null, {
@@ -3259,26 +3388,26 @@ function PUTER(configRoutes, config) {
3259
3388
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3260
3389
  while (1) switch (_context.prev = _context.next) {
3261
3390
  case 0:
3262
- if (!matches$8(configRoutes, req)) {
3391
+ if (!matches$9(configRoutes, req)) {
3263
3392
  _context.next = 3;
3264
3393
  break;
3265
3394
  }
3266
3395
  info('matches tenant users');
3267
- return _context.abrupt("return", route$8(req, config));
3396
+ return _context.abrupt("return", route$9(req, config));
3268
3397
  case 3:
3269
- if (!matches$9(configRoutes, req)) {
3398
+ if (!matches$a(configRoutes, req)) {
3270
3399
  _context.next = 6;
3271
3400
  break;
3272
3401
  }
3273
3402
  info('matches users');
3274
- return _context.abrupt("return", route$9(req, config));
3403
+ return _context.abrupt("return", route$a(req, config));
3275
3404
  case 6:
3276
- if (!matches$7(configRoutes, req)) {
3405
+ if (!matches$8(configRoutes, req)) {
3277
3406
  _context.next = 9;
3278
3407
  break;
3279
3408
  }
3280
3409
  info('matches tenants');
3281
- return _context.abrupt("return", route$7(req, config));
3410
+ return _context.abrupt("return", route$8(req, config));
3282
3411
  case 9:
3283
3412
  warn('No PUT routes matched');
3284
3413
  return _context.abrupt("return", new Response(null, {