@niledatabase/server 3.0.0-alpha.1 → 3.0.0-alpha.10

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 ADDED
@@ -0,0 +1,22 @@
1
+ import { Routes } from './api/types';
2
+ import Tenants from './tenants';
3
+ import Users from './users';
4
+ import { Config } from './utils/Config';
5
+ export declare class Api {
6
+ config: Config;
7
+ users: Users;
8
+ tenants: Tenants;
9
+ routes: Routes;
10
+ handlers: {
11
+ GET: (req: Request) => Promise<void | Response>;
12
+ POST: (req: Request) => Promise<void | Response>;
13
+ DELETE: (req: Request) => Promise<void | Response>;
14
+ PUT: (req: Request) => Promise<void | Response>;
15
+ };
16
+ constructor(config: Config);
17
+ set headers(headers: Headers);
18
+ login(payload: {
19
+ email: string;
20
+ password: string;
21
+ }): Promise<void>;
22
+ }
package/dist/Server.d.ts CHANGED
@@ -1,27 +1,7 @@
1
1
  import { Pool } from 'pg';
2
2
  import { ServerConfig } from './types';
3
3
  import { Config } from './utils/Config';
4
- import Users from './users';
5
- import Tenants from './tenants';
6
- import { Routes } from './api/types';
7
- declare class Api {
8
- config: Config;
9
- users: Users;
10
- tenants: Tenants;
11
- routes: Routes;
12
- handlers: {
13
- GET: (req: Request) => Promise<void | Response>;
14
- POST: (req: Request) => Promise<void | Response>;
15
- DELETE: (req: Request) => Promise<void | Response>;
16
- PUT: (req: Request) => Promise<void | Response>;
17
- };
18
- constructor(config: Config);
19
- set headers(headers: Headers);
20
- login(payload: {
21
- email: string;
22
- password: string;
23
- }): Promise<void>;
24
- }
4
+ import { Api } from './Api';
25
5
  export declare class Server {
26
6
  config: Config;
27
7
  api: Api;
@@ -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:
@@ -6,7 +6,7 @@
6
6
  * - users
7
7
  * summary: lists users in the tenant
8
8
  * description: Returns information about the users within the tenant
9
- * provided. You can also pass the a `niledb-tenantId` in the header or in a cookie.
9
+ * provided. You can also pass the a `niledb-tenant-id` in the header or in a cookie.
10
10
  * operationId: listUsers
11
11
  * parameters:
12
12
  * - name: tenantId
@@ -2,5 +2,13 @@ import { Config } from '../../utils/Config';
2
2
  export type ActiveSession = {
3
3
  id: string;
4
4
  email: string;
5
+ expires: Date;
6
+ user?: {
7
+ id: string;
8
+ name: string;
9
+ image: string;
10
+ email: string;
11
+ emailVerified: void | Date;
12
+ };
5
13
  };
6
14
  export default function auth(req: Request, config: Config): Promise<void | ActiveSession>;
@@ -0,0 +1 @@
1
+ export declare function isUUID(value: string | null | undefined): boolean;