@niledatabase/server 3.0.0-alpha.2 → 3.0.0-alpha.4

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.
@@ -15,8 +15,7 @@ import { ActiveSession } from '../../../../utils/auth';
15
15
  * type: string
16
16
  * requestBody:
17
17
  * description: |
18
- * The email and password combination the user will use to authenticate.
19
- * The `name` is optional; if provided it will be recorded in the `users` table.
18
+ * The email of the user you want to add to a tenant.
20
19
  * content:
21
20
  * application/json:
22
21
  * schema:
@@ -1,7 +1,7 @@
1
1
  import { ActiveSession } from '../../../../../utils/auth';
2
2
  /**
3
3
  * @swagger
4
- * /api/tenants/{tenantId}/users/{userId}:
4
+ * /api/tenants/{tenantId}/users/{email}:
5
5
  * delete:
6
6
  * tags:
7
7
  * - tenants
@@ -15,7 +15,7 @@ import { ActiveSession } from '../../../../../utils/auth';
15
15
  * required: true
16
16
  * schema:
17
17
  * type: string
18
- * - name: userId
18
+ * - name: email
19
19
  * in: path
20
20
  * required: true
21
21
  * schema:
@@ -1655,6 +1655,25 @@ var Tenants = /*#__PURE__*/function (_Config) {
1655
1655
  return _ref2.apply(this, arguments);
1656
1656
  };
1657
1657
  }();
1658
+ _this.listTenants = /*#__PURE__*/function () {
1659
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(req, init) {
1660
+ var _requester, _init;
1661
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1662
+ while (1) switch (_context3.prev = _context3.next) {
1663
+ case 0:
1664
+ _requester = new Requester(_this);
1665
+ _init = _this.handleHeaders(init);
1666
+ return _context3.abrupt("return", _requester.get(req, _this.tenantListUrl, _init));
1667
+ case 3:
1668
+ case "end":
1669
+ return _context3.stop();
1670
+ }
1671
+ }, _callee3);
1672
+ }));
1673
+ return function (_x5, _x6) {
1674
+ return _ref3.apply(this, arguments);
1675
+ };
1676
+ }();
1658
1677
  _this.headers = headers;
1659
1678
  return _this;
1660
1679
  }
@@ -1686,6 +1705,12 @@ var Tenants = /*#__PURE__*/function (_Config) {
1686
1705
  var _this$tenantId;
1687
1706
  return "/tenants/" + ((_this$tenantId = this.tenantId) != null ? _this$tenantId : '{tenantId}');
1688
1707
  }
1708
+ }, {
1709
+ key: "tenantListUrl",
1710
+ get: function get() {
1711
+ var _this$userId;
1712
+ return "/users/" + ((_this$userId = this.userId) != null ? _this$userId : '{userId}') + "/tenants";
1713
+ }
1689
1714
  }]);
1690
1715
  }(Config);
1691
1716
 
@@ -2730,7 +2755,7 @@ function _POST$1() {
2730
2755
 
2731
2756
  /**
2732
2757
  * @swagger
2733
- * /api/tenants/{tenantId}/users/{userId}:
2758
+ * /api/tenants/{tenantId}/users/{email}:
2734
2759
  * delete:
2735
2760
  * tags:
2736
2761
  * - tenants
@@ -2744,7 +2769,7 @@ function _POST$1() {
2744
2769
  * required: true
2745
2770
  * schema:
2746
2771
  * type: string
2747
- * - name: userId
2772
+ * - name: email
2748
2773
  * in: path
2749
2774
  * required: true
2750
2775
  * schema:
@@ -2774,13 +2799,16 @@ function _DELETE$1() {
2774
2799
  }));
2775
2800
  case 4:
2776
2801
  init.method = 'DELETE';
2802
+ init.body = JSON.stringify({
2803
+ email: userId
2804
+ });
2777
2805
  url = "" + apiRoutes.TENANT_USER(tenantId, userId);
2778
2806
  log('[DELETE]', url);
2779
- _context.next = 9;
2807
+ _context.next = 10;
2780
2808
  return request(url, init);
2781
- case 9:
2782
- return _context.abrupt("return", _context.sent);
2783
2809
  case 10:
2810
+ return _context.abrupt("return", _context.sent);
2811
+ case 11:
2784
2812
  case "end":
2785
2813
  return _context.stop();
2786
2814
  }
@@ -2805,8 +2833,7 @@ function _DELETE$1() {
2805
2833
  * type: string
2806
2834
  * requestBody:
2807
2835
  * description: |
2808
- * The email and password combination the user will use to authenticate.
2809
- * The `name` is optional; if provided it will be recorded in the `users` table.
2836
+ * The email of the user you want to add to a tenant.
2810
2837
  * content:
2811
2838
  * application/json:
2812
2839
  * schema: