@niledatabase/server 3.0.0-alpha.0 → 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 +22 -0
- package/dist/Server.d.ts +1 -21
- package/dist/api/handlers/DELETE.d.ts +1 -1
- package/dist/api/handlers/GET.d.ts +1 -1
- package/dist/api/handlers/POST.d.ts +1 -1
- package/dist/api/handlers/PUT.d.ts +1 -1
- package/dist/api/handlers/index.d.ts +4 -4
- package/dist/api/routes/auth/csrf.d.ts +1 -1
- package/dist/api/routes/auth/error.d.ts +1 -1
- package/dist/api/routes/auth/providers.d.ts +1 -1
- package/dist/api/routes/auth/session.d.ts +2 -1
- package/dist/api/routes/auth/signin.d.ts +1 -1
- package/dist/api/routes/auth/signout.d.ts +1 -1
- package/dist/api/routes/me/index.d.ts +1 -1
- package/dist/api/routes/tenants/GET.d.ts +1 -1
- package/dist/api/routes/tenants/POST.d.ts +1 -1
- package/dist/api/routes/tenants/[tenantId]/DELETE.d.ts +1 -1
- package/dist/api/routes/tenants/[tenantId]/users/GET.d.ts +1 -1
- package/dist/api/routes/tenants/[tenantId]/users/POST.d.ts +1 -1
- package/dist/api/routes/tenants/[tenantId]/users/PUT.d.ts +2 -3
- package/dist/api/routes/tenants/[tenantId]/users/[userId]/DELETE.d.ts +3 -3
- package/dist/api/routes/tenants/[tenantId]/users/index.d.ts +1 -1
- package/dist/api/routes/tenants/index.d.ts +1 -1
- package/dist/api/routes/users/GET.d.ts +2 -2
- package/dist/api/routes/users/POST.d.ts +1 -1
- package/dist/api/routes/users/[userId]/PUT.d.ts +1 -1
- package/dist/api/routes/users/index.d.ts +1 -1
- package/dist/api/utils/auth.d.ts +8 -0
- package/dist/api/utils/request.d.ts +2 -1
- package/dist/db/isUUID.d.ts +1 -0
- package/dist/server.cjs.development.js +1663 -1535
- package/dist/server.cjs.development.js.map +1 -1
- package/dist/server.cjs.production.min.js +1 -1
- package/dist/server.cjs.production.min.js.map +1 -1
- package/dist/server.esm.js +1663 -1535
- package/dist/server.esm.js.map +1 -1
- package/dist/tenants/index.d.ts +7 -3
- package/dist/types.d.ts +1 -0
- package/dist/users/index.d.ts +7 -7
- package/dist/utils/Requester/index.d.ts +5 -5
- package/dist/utils/Requester/types.d.ts +1 -1
- package/package.json +2 -2
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
|
|
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;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Routes } from '../types';
|
|
2
2
|
import { Config } from '../../utils/Config';
|
|
3
|
-
export default function DELETER(configRoutes: Routes, config: Config): (req: Request) => Promise<
|
|
3
|
+
export default function DELETER(configRoutes: Routes, config: Config): (req: Request) => Promise<Response>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Routes } from '../types';
|
|
2
2
|
import { Config } from '../../utils/Config';
|
|
3
|
-
export default function GETTER(configRoutes: Routes, config: Config): (req: Request) => Promise<
|
|
3
|
+
export default function GETTER(configRoutes: Routes, config: Config): (req: Request) => Promise<Response>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Routes } from '../types';
|
|
2
2
|
import { Config } from '../../utils/Config';
|
|
3
|
-
export default function POSTER(configRoutes: Routes, config: Config): (req: Request) => Promise<
|
|
3
|
+
export default function POSTER(configRoutes: Routes, config: Config): (req: Request) => Promise<Response>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { Routes } from '../types';
|
|
2
2
|
import { Config } from '../../utils/Config';
|
|
3
|
-
export default function PUTER(configRoutes: Routes, config: Config): (req: Request) => Promise<
|
|
3
|
+
export default function PUTER(configRoutes: Routes, config: Config): (req: Request) => Promise<Response>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Config } from '../../utils/Config';
|
|
2
2
|
import { Routes } from '../types';
|
|
3
3
|
export default function Handlers(configRoutes: Routes, config: Config): {
|
|
4
|
-
GET: (req: Request) => Promise<
|
|
5
|
-
POST: (req: Request) => Promise<
|
|
6
|
-
DELETE: (req: Request) => Promise<
|
|
7
|
-
PUT: (req: Request) => Promise<
|
|
4
|
+
GET: (req: Request) => Promise<Response>;
|
|
5
|
+
POST: (req: Request) => Promise<Response>;
|
|
6
|
+
DELETE: (req: Request) => Promise<Response>;
|
|
7
|
+
PUT: (req: Request) => Promise<Response>;
|
|
8
8
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Routes } from '../../types';
|
|
2
|
-
|
|
2
|
+
import { Config } from '../../../utils/Config';
|
|
3
|
+
export default function route(req: Request, config: Config): Promise<Response>;
|
|
3
4
|
export declare function matches(configRoutes: Routes, request: Request): boolean;
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
* content: {}
|
|
30
30
|
*/
|
|
31
31
|
import { Routes } from '../../types';
|
|
32
|
-
export default function route(
|
|
32
|
+
export default function route(req: Request): Promise<Response>;
|
|
33
33
|
export declare function matches(configRoutes: Routes, request: Request): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Routes } from '../../types';
|
|
2
2
|
import { Config } from '../../../utils/Config';
|
|
3
|
-
export default function route(request: Request, config: Config): Promise<
|
|
3
|
+
export default function route(request: Request, config: Config): Promise<Response>;
|
|
4
4
|
export declare function matches(configRoutes: Routes, request: Request): boolean;
|
|
@@ -29,4 +29,4 @@ import { ActiveSession } from '../../utils/auth';
|
|
|
29
29
|
*/
|
|
30
30
|
export declare function GET(session: ActiveSession, init: RequestInit & {
|
|
31
31
|
request: Request;
|
|
32
|
-
}, log: (...args: string[]) => void): Promise<
|
|
32
|
+
}, log: (...args: string[]) => void): Promise<Response>;
|
|
@@ -42,4 +42,4 @@ import { ActiveSession } from '../../utils/auth';
|
|
|
42
42
|
*/
|
|
43
43
|
export declare function POST(session: ActiveSession, init: RequestInit & {
|
|
44
44
|
request: Request;
|
|
45
|
-
}, log: (...args: string[]) => void): Promise<
|
|
45
|
+
}, log: (...args: string[]) => void): Promise<Response>;
|
|
@@ -31,4 +31,4 @@ import { ActiveSession } from '../../../utils/auth';
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function DELETE(session: ActiveSession, init: RequestInit & {
|
|
33
33
|
request: Request;
|
|
34
|
-
}, log: (...args: string[]) => void): Promise<
|
|
34
|
+
}, log: (...args: string[]) => void): Promise<Response>;
|
|
@@ -32,4 +32,4 @@ import { ActiveSession } from '../../../../utils/auth';
|
|
|
32
32
|
*/
|
|
33
33
|
export declare function GET(session: ActiveSession, init: RequestInit & {
|
|
34
34
|
request: Request;
|
|
35
|
-
}, log: (...args: string[]) => void): Promise<
|
|
35
|
+
}, log: (...args: string[]) => void): Promise<Response>;
|
|
@@ -41,4 +41,4 @@ import { ActiveSession } from '../../../../utils/auth';
|
|
|
41
41
|
*/
|
|
42
42
|
export declare function POST(session: ActiveSession, init: RequestInit & {
|
|
43
43
|
request: Request;
|
|
44
|
-
}, log: (...args: string[]) => void): Promise<
|
|
44
|
+
}, log: (...args: string[]) => void): Promise<Response>;
|
|
@@ -15,8 +15,7 @@ import { ActiveSession } from '../../../../utils/auth';
|
|
|
15
15
|
* type: string
|
|
16
16
|
* requestBody:
|
|
17
17
|
* description: |
|
|
18
|
-
* The email
|
|
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:
|
|
@@ -27,4 +26,4 @@ import { ActiveSession } from '../../../../utils/auth';
|
|
|
27
26
|
*/
|
|
28
27
|
export declare function PUT(session: ActiveSession, init: RequestInit & {
|
|
29
28
|
request: Request;
|
|
30
|
-
}, log: (...args: string[]) => void): Promise<
|
|
29
|
+
}, log: (...args: string[]) => void): Promise<Response>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActiveSession } from '../../../../../utils/auth';
|
|
2
2
|
/**
|
|
3
3
|
* @swagger
|
|
4
|
-
* /api/tenants/{tenantId}/users/{
|
|
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:
|
|
18
|
+
* - name: email
|
|
19
19
|
* in: path
|
|
20
20
|
* required: true
|
|
21
21
|
* schema:
|
|
@@ -27,4 +27,4 @@ import { ActiveSession } from '../../../../../utils/auth';
|
|
|
27
27
|
*/
|
|
28
28
|
export declare function DELETE(session: ActiveSession, init: RequestInit & {
|
|
29
29
|
request: Request;
|
|
30
|
-
}, log: (...args: string[]) => void): Promise<
|
|
30
|
+
}, log: (...args: string[]) => void): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Config } from '../../../../../utils/Config';
|
|
2
2
|
import { Routes } from '../../../../types';
|
|
3
|
-
export default function route(request: Request, config: Config): Promise<
|
|
3
|
+
export default function route(request: Request, config: Config): Promise<Response>;
|
|
4
4
|
export declare function matches(configRoutes: Routes, request: Request): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Config } from '../../../utils/Config';
|
|
2
2
|
import { Routes } from '../../types';
|
|
3
|
-
export default function route(request: Request, config: Config): Promise<
|
|
3
|
+
export default function route(request: Request, config: Config): Promise<Response>;
|
|
4
4
|
export declare function matches(configRoutes: Routes, request: Request): boolean;
|
|
@@ -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-
|
|
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
|
|
@@ -31,4 +31,4 @@
|
|
|
31
31
|
*/
|
|
32
32
|
export declare function GET(init: RequestInit & {
|
|
33
33
|
request: Request;
|
|
34
|
-
}, log: (...args: string[]) => void): Promise<
|
|
34
|
+
}, log: (...args: string[]) => void): Promise<Response>;
|
|
@@ -63,4 +63,4 @@ import { ActiveSession } from '../../utils/auth';
|
|
|
63
63
|
*/
|
|
64
64
|
export declare function POST(session: void | ActiveSession, init: RequestInit & {
|
|
65
65
|
request: Request;
|
|
66
|
-
}, log?: (...args: string[]) => void): Promise<
|
|
66
|
+
}, log?: (...args: string[]) => void): Promise<Response>;
|
|
@@ -37,4 +37,4 @@ import { ActiveSession } from '../../../utils/auth';
|
|
|
37
37
|
*/
|
|
38
38
|
export declare function PUT(session: void | ActiveSession, init: RequestInit & {
|
|
39
39
|
request: Request;
|
|
40
|
-
}, log: (...args: string[]) => void): Promise<
|
|
40
|
+
}, log: (...args: string[]) => void): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Routes } from '../../types';
|
|
2
2
|
import { Config } from '../../../utils/Config';
|
|
3
|
-
export default function route(request: Request, config: Config): Promise<
|
|
3
|
+
export default function route(request: Request, config: Config): Promise<Response>;
|
|
4
4
|
export declare function matches(configRoutes: Routes, request: Request): boolean;
|
package/dist/api/utils/auth.d.ts
CHANGED
|
@@ -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;
|