@niledatabase/server 3.0.0-alpha.4 → 3.0.0-alpha.40
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 +25 -0
- package/dist/Server.d.ts +2 -25
- package/dist/api/routes/auth/callback.d.ts +2 -1
- package/dist/api/routes/auth/csrf.d.ts +2 -1
- package/dist/api/routes/auth/error.d.ts +2 -1
- package/dist/api/routes/auth/index.d.ts +1 -0
- package/dist/api/routes/auth/providers.d.ts +2 -1
- package/dist/api/routes/auth/signin.d.ts +2 -1
- package/dist/api/routes/auth/signout.d.ts +2 -1
- package/dist/api/routes/auth/verify-request.d.ts +4 -0
- package/dist/api/routes/signup/POST.d.ts +66 -0
- package/dist/api/routes/signup/index.d.ts +4 -0
- package/dist/api/routes/tenants/GET.d.ts +3 -2
- package/dist/api/routes/tenants/POST.d.ts +3 -3
- package/dist/api/routes/tenants/[tenantId]/DELETE.d.ts +3 -3
- package/dist/api/routes/tenants/[tenantId]/GET.d.ts +37 -0
- package/dist/api/routes/tenants/[tenantId]/PUT.d.ts +38 -0
- package/dist/api/routes/tenants/[tenantId]/users/GET.d.ts +3 -3
- package/dist/api/routes/tenants/[tenantId]/users/POST.d.ts +3 -2
- package/dist/api/routes/tenants/[tenantId]/users/PUT.d.ts +3 -3
- package/dist/api/routes/tenants/[tenantId]/users/[userId]/DELETE.d.ts +3 -3
- package/dist/api/routes/users/GET.d.ts +3 -2
- package/dist/api/routes/users/POST.d.ts +3 -3
- package/dist/api/routes/users/[userId]/PUT.d.ts +3 -2
- package/dist/api/types.d.ts +1 -0
- package/dist/api/utils/auth.d.ts +8 -0
- package/dist/api/utils/request.d.ts +1 -1
- package/dist/api/utils/routes/apiRoutes.d.ts +6 -2
- package/dist/api/utils/routes/makeRestUrl.d.ts +2 -1
- package/dist/api/utils/routes/proxyRoutes.d.ts +3 -1
- package/dist/auth/index.d.ts +10 -1
- package/dist/db/DBManager.d.ts +1 -0
- package/dist/db/NileInstance.d.ts +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/server.cjs.development.js +2848 -2055
- 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 +2849 -2057
- package/dist/server.esm.js.map +1 -1
- package/dist/tenants/index.d.ts +11 -8
- package/dist/tenants/types.d.ts +4 -0
- package/dist/types.d.ts +9 -0
- package/dist/users/index.d.ts +14 -39
- package/dist/users/types.d.ts +36 -0
- package/dist/utils/Config/envVars.d.ts +5 -5
- package/dist/utils/Config/index.d.ts +9 -8
- package/dist/utils/Event/index.d.ts +0 -1
- package/dist/utils/Logger.d.ts +5 -4
- package/dist/utils/Requester/index.d.ts +5 -5
- package/dist/utils/Requester/types.d.ts +1 -1
- package/dist/utils/fetch.d.ts +2 -0
- package/package.json +2 -2
- package/dist/utils/Server/index.d.ts +0 -4
package/dist/Api.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Routes } from './api/types';
|
|
2
|
+
import Auth from './auth';
|
|
3
|
+
import Tenants from './tenants';
|
|
4
|
+
import Users from './users';
|
|
5
|
+
import { Config } from './utils/Config';
|
|
6
|
+
export declare class Api {
|
|
7
|
+
config: Config;
|
|
8
|
+
users: Users;
|
|
9
|
+
auth: Auth;
|
|
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
|
+
updateConfig(config: Config): void;
|
|
20
|
+
set headers(headers: Headers);
|
|
21
|
+
login(payload: {
|
|
22
|
+
email: string;
|
|
23
|
+
password: string;
|
|
24
|
+
}): Promise<void>;
|
|
25
|
+
}
|
package/dist/Server.d.ts
CHANGED
|
@@ -1,32 +1,11 @@
|
|
|
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;
|
|
28
8
|
private manager;
|
|
29
|
-
private servers;
|
|
30
9
|
constructor(config?: ServerConfig);
|
|
31
10
|
setConfig(cfg: Config): void;
|
|
32
11
|
init(cfg?: Config): Promise<this>;
|
|
@@ -39,9 +18,7 @@ export declare class Server {
|
|
|
39
18
|
set token(token: string | undefined | null);
|
|
40
19
|
get db(): Pool;
|
|
41
20
|
/**
|
|
42
|
-
* A
|
|
43
|
-
* returns the global Server object, an existing server that's already been configured,
|
|
44
|
-
* or a new one if the config isn't in the cache
|
|
21
|
+
* A convenience function that applies a config and ensures whatever was passed is set properly
|
|
45
22
|
*/
|
|
46
23
|
getInstance(config: ServerConfig): Server;
|
|
47
24
|
}
|
|
@@ -1,3 +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<Response>;
|
|
3
4
|
export declare function matches(configRoutes: Routes, request: Request): boolean;
|
|
@@ -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;
|
|
@@ -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;
|
|
@@ -5,3 +5,4 @@ export { default as handleCsrf, matches as matchCsrf } from './csrf';
|
|
|
5
5
|
export { default as handleCallback, matches as matchCallback, } from './callback';
|
|
6
6
|
export { default as handleSignOut, matches as matchSignOut } from './signout';
|
|
7
7
|
export { default as handleError, matches as matchError } from './error';
|
|
8
|
+
export { default as handleVerifyRequest, matches as matchesVerifyRequest, } from './verify-request';
|
|
@@ -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,6 @@
|
|
|
29
29
|
* content: {}
|
|
30
30
|
*/
|
|
31
31
|
import { Routes } from '../../types';
|
|
32
|
-
|
|
32
|
+
import { Config } from '../../../utils/Config';
|
|
33
|
+
export default function route(req: Request, config: Config): Promise<Response>;
|
|
33
34
|
export declare function matches(configRoutes: Routes, request: Request): boolean;
|
|
@@ -1,3 +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<Response>;
|
|
3
4
|
export declare function matches(configRoutes: Routes, request: Request): boolean;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Config } from '../../../utils/Config';
|
|
2
|
+
/**
|
|
3
|
+
* @swagger
|
|
4
|
+
* /api/signup:
|
|
5
|
+
* post:
|
|
6
|
+
* tags:
|
|
7
|
+
* - users
|
|
8
|
+
* summary: signs a user up
|
|
9
|
+
* description: signs a user up and logs them in. Expects a email and password combo
|
|
10
|
+
* operationId: signUp
|
|
11
|
+
* parameters:
|
|
12
|
+
* - name: tenantId
|
|
13
|
+
* description: A tenant id to add the user to when they are created
|
|
14
|
+
* in: query
|
|
15
|
+
* schema:
|
|
16
|
+
* type: string
|
|
17
|
+
* - name: newTenantName
|
|
18
|
+
* description: A tenant name to create, then the user to when they are created
|
|
19
|
+
* in: query
|
|
20
|
+
* schema:
|
|
21
|
+
* type: string
|
|
22
|
+
* requestBody:
|
|
23
|
+
* description: |-
|
|
24
|
+
* The email and password combination the user will use to authenticate.
|
|
25
|
+
* The `name` is optional; if provided it will be recorded in the `users` table.
|
|
26
|
+
* The `newTenant` is optional; if provided, it is used as the name of a new tenant record associated with the newly created user.
|
|
27
|
+
* content:
|
|
28
|
+
* application/json:
|
|
29
|
+
* schema:
|
|
30
|
+
* $ref: '#/components/schemas/CreateBasicUserRequest'
|
|
31
|
+
* examples:
|
|
32
|
+
* Create User Request:
|
|
33
|
+
* summary: Creates a user with basic credentials
|
|
34
|
+
* description: Create User Request
|
|
35
|
+
* value:
|
|
36
|
+
* email: a.user@somedomain.com
|
|
37
|
+
* password: somepassword
|
|
38
|
+
* name: A. User
|
|
39
|
+
* Create User Request with Tenant:
|
|
40
|
+
* summary: Creates a user and a new tenant for that user
|
|
41
|
+
* description: Create User Request with Tenant
|
|
42
|
+
* value:
|
|
43
|
+
* email: a.user@somedomain.com
|
|
44
|
+
* password: somepassword
|
|
45
|
+
* name: A. User
|
|
46
|
+
* newTenant: My Sandbox
|
|
47
|
+
* responses:
|
|
48
|
+
* "201":
|
|
49
|
+
* description: User and session created
|
|
50
|
+
* content:
|
|
51
|
+
* application/json:
|
|
52
|
+
* schema:
|
|
53
|
+
* $ref: "#/components/schemas/User"
|
|
54
|
+
* "400":
|
|
55
|
+
* description: API/Database failures
|
|
56
|
+
* content:
|
|
57
|
+
* text/plain:
|
|
58
|
+
* schema:
|
|
59
|
+
* type: string
|
|
60
|
+
* "401":
|
|
61
|
+
* description: Unauthorized
|
|
62
|
+
* content: {}
|
|
63
|
+
*/
|
|
64
|
+
export declare function POST(config: Config, init: RequestInit & {
|
|
65
|
+
request: Request;
|
|
66
|
+
}): Promise<Response>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Config } from '../../../utils/Config';
|
|
1
2
|
import { ActiveSession } from '../../utils/auth';
|
|
2
3
|
/**
|
|
3
4
|
* @swagger
|
|
@@ -27,6 +28,6 @@ import { ActiveSession } from '../../utils/auth';
|
|
|
27
28
|
* description: Unauthorized
|
|
28
29
|
* content: {}
|
|
29
30
|
*/
|
|
30
|
-
export declare function GET(session: ActiveSession, init: RequestInit & {
|
|
31
|
+
export declare function GET(config: Config, session: ActiveSession, init: RequestInit & {
|
|
31
32
|
request: Request;
|
|
32
|
-
}
|
|
33
|
+
}): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Config } from '../../../utils/Config';
|
|
2
2
|
/**
|
|
3
3
|
* @swagger
|
|
4
4
|
* /api/tenants:
|
|
@@ -40,6 +40,6 @@ import { ActiveSession } from '../../utils/auth';
|
|
|
40
40
|
* schema:
|
|
41
41
|
* $ref: '#/components/schemas/APIError'
|
|
42
42
|
*/
|
|
43
|
-
export declare function POST(
|
|
43
|
+
export declare function POST(config: Config, init: RequestInit & {
|
|
44
44
|
request: Request;
|
|
45
|
-
}
|
|
45
|
+
}): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Config } from '../../../../utils/Config';
|
|
2
2
|
/**
|
|
3
3
|
* @swagger
|
|
4
4
|
* /api/tenants/{tenantId}:
|
|
@@ -29,6 +29,6 @@ import { ActiveSession } from '../../../utils/auth';
|
|
|
29
29
|
* schema:
|
|
30
30
|
* $ref: '#/components/schemas/APIError'
|
|
31
31
|
*/
|
|
32
|
-
export declare function DELETE(
|
|
32
|
+
export declare function DELETE(config: Config, init: RequestInit & {
|
|
33
33
|
request: Request;
|
|
34
|
-
}
|
|
34
|
+
}): Promise<Response>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Config } from '../../../../utils/Config';
|
|
2
|
+
/**
|
|
3
|
+
* @swagger
|
|
4
|
+
* /api/tenants/{tenantId}:
|
|
5
|
+
* get:
|
|
6
|
+
* tags:
|
|
7
|
+
* - tenants
|
|
8
|
+
* summary: Obtains a specific tenant.
|
|
9
|
+
* operationId: getTenant
|
|
10
|
+
* parameters:
|
|
11
|
+
* - name: tenantId
|
|
12
|
+
* in: path
|
|
13
|
+
* required: true
|
|
14
|
+
* schema:
|
|
15
|
+
* type: string
|
|
16
|
+
* responses:
|
|
17
|
+
* "200":
|
|
18
|
+
* description: the desired tenant
|
|
19
|
+
* application/json:
|
|
20
|
+
* schema:
|
|
21
|
+
* $ref: '#/components/schemas/Tenant'
|
|
22
|
+
* "401":
|
|
23
|
+
* description: Unauthorized
|
|
24
|
+
* content:
|
|
25
|
+
* application/json:
|
|
26
|
+
* schema:
|
|
27
|
+
* $ref: '#/components/schemas/APIError'
|
|
28
|
+
* "404":
|
|
29
|
+
* description: Tenant not found
|
|
30
|
+
* content:
|
|
31
|
+
* application/json:
|
|
32
|
+
* schema:
|
|
33
|
+
* $ref: '#/components/schemas/APIError'
|
|
34
|
+
*/
|
|
35
|
+
export declare function GET(config: Config, init: RequestInit & {
|
|
36
|
+
request: Request;
|
|
37
|
+
}, log: (message: string | unknown, meta?: Record<string, unknown>) => void): Promise<Response>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Config } from '../../../../utils/Config';
|
|
2
|
+
/**
|
|
3
|
+
* @swagger
|
|
4
|
+
* /api/tenants/{tenantId}:
|
|
5
|
+
* put:
|
|
6
|
+
* tags:
|
|
7
|
+
* - tenants
|
|
8
|
+
* summary: Obtains a specific tenant.
|
|
9
|
+
* operationId: updateTenant
|
|
10
|
+
* parameters:
|
|
11
|
+
* - name: tenantId
|
|
12
|
+
* in: path
|
|
13
|
+
* required: true
|
|
14
|
+
* schema:
|
|
15
|
+
* type: string
|
|
16
|
+
* responses:
|
|
17
|
+
* "201":
|
|
18
|
+
* description: update an existing tenant
|
|
19
|
+
* content:
|
|
20
|
+
* application/json:
|
|
21
|
+
* schema:
|
|
22
|
+
* $ref: '#/components/schemas/Tenant'
|
|
23
|
+
* "401":
|
|
24
|
+
* description: Unauthorized
|
|
25
|
+
* content:
|
|
26
|
+
* application/json:
|
|
27
|
+
* schema:
|
|
28
|
+
* $ref: '#/components/schemas/APIError'
|
|
29
|
+
* "404":
|
|
30
|
+
* description: Tenant not found
|
|
31
|
+
* content:
|
|
32
|
+
* application/json:
|
|
33
|
+
* schema:
|
|
34
|
+
* $ref: '#/components/schemas/APIError'
|
|
35
|
+
*/
|
|
36
|
+
export declare function PUT(config: Config, init: RequestInit & {
|
|
37
|
+
request: Request;
|
|
38
|
+
}): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Config } from '../../../../../utils/Config';
|
|
2
2
|
/**
|
|
3
3
|
* @swagger
|
|
4
4
|
* /api/tenants/{tenantId}/users:
|
|
@@ -30,6 +30,6 @@ import { ActiveSession } from '../../../../utils/auth';
|
|
|
30
30
|
* schema:
|
|
31
31
|
* $ref: '#/components/schemas/APIError'
|
|
32
32
|
*/
|
|
33
|
-
export declare function GET(
|
|
33
|
+
export declare function GET(config: Config, init: RequestInit & {
|
|
34
34
|
request: Request;
|
|
35
|
-
}
|
|
35
|
+
}): Promise<Response>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ActiveSession } from '../../../../utils/auth';
|
|
2
|
+
import { Config } from '../../../../../utils/Config';
|
|
2
3
|
/**
|
|
3
4
|
* @swagger
|
|
4
5
|
* /api/tenants/{tenantId}/users:
|
|
@@ -39,6 +40,6 @@ import { ActiveSession } from '../../../../utils/auth';
|
|
|
39
40
|
* schema:
|
|
40
41
|
* $ref: '#/components/schemas/User'
|
|
41
42
|
*/
|
|
42
|
-
export declare function POST(session: ActiveSession, init: RequestInit & {
|
|
43
|
+
export declare function POST(config: Config, session: ActiveSession, init: RequestInit & {
|
|
43
44
|
request: Request;
|
|
44
|
-
}
|
|
45
|
+
}): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Config } from '../../../../../utils/Config';
|
|
2
2
|
/**
|
|
3
3
|
* @swagger
|
|
4
4
|
* /api/tenants/{tenantId}/users:
|
|
@@ -24,6 +24,6 @@ import { ActiveSession } from '../../../../utils/auth';
|
|
|
24
24
|
* "201":
|
|
25
25
|
* description: add user to tenant
|
|
26
26
|
*/
|
|
27
|
-
export declare function PUT(
|
|
27
|
+
export declare function PUT(config: Config, init: RequestInit & {
|
|
28
28
|
request: Request;
|
|
29
|
-
}
|
|
29
|
+
}): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Config } from '../../../../../../utils/Config';
|
|
2
2
|
/**
|
|
3
3
|
* @swagger
|
|
4
4
|
* /api/tenants/{tenantId}/users/{email}:
|
|
@@ -25,6 +25,6 @@ import { ActiveSession } from '../../../../../utils/auth';
|
|
|
25
25
|
* "204":
|
|
26
26
|
* description: User removed
|
|
27
27
|
*/
|
|
28
|
-
export declare function DELETE(
|
|
28
|
+
export declare function DELETE(config: Config, init: RequestInit & {
|
|
29
29
|
request: Request;
|
|
30
|
-
}
|
|
30
|
+
}): Promise<Response>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Config } from '../../../utils/Config';
|
|
1
2
|
/**
|
|
2
3
|
* @swagger
|
|
3
4
|
* /api/users:
|
|
@@ -29,6 +30,6 @@
|
|
|
29
30
|
* description: Unauthorized
|
|
30
31
|
* content: {}
|
|
31
32
|
*/
|
|
32
|
-
export declare function GET(init: RequestInit & {
|
|
33
|
+
export declare function GET(config: Config, init: RequestInit & {
|
|
33
34
|
request: Request;
|
|
34
|
-
}, log: (
|
|
35
|
+
}, log: (message: string | unknown, meta?: Record<string, unknown>) => void): Promise<Response>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Config } from '../../../utils/Config';
|
|
2
2
|
/**
|
|
3
3
|
* @swagger
|
|
4
4
|
* /api/users:
|
|
@@ -61,6 +61,6 @@ import { ActiveSession } from '../../utils/auth';
|
|
|
61
61
|
* description: Unauthorized
|
|
62
62
|
* content: {}
|
|
63
63
|
*/
|
|
64
|
-
export declare function POST(
|
|
64
|
+
export declare function POST(config: Config, init: RequestInit & {
|
|
65
65
|
request: Request;
|
|
66
|
-
}
|
|
66
|
+
}): Promise<Response>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ActiveSession } from '../../../utils/auth';
|
|
2
|
+
import { Config } from '../../../../utils/Config';
|
|
2
3
|
/**
|
|
3
4
|
* @swagger
|
|
4
5
|
* /api/users/{userid}:
|
|
@@ -35,6 +36,6 @@ import { ActiveSession } from '../../../utils/auth';
|
|
|
35
36
|
* description: Unauthorized
|
|
36
37
|
* content: {}
|
|
37
38
|
*/
|
|
38
|
-
export declare function PUT(session: void | ActiveSession, init: RequestInit & {
|
|
39
|
+
export declare function PUT(config: Config, session: void | ActiveSession, init: RequestInit & {
|
|
39
40
|
request: Request;
|
|
40
|
-
}
|
|
41
|
+
}): Promise<Response>;
|
package/dist/api/types.d.ts
CHANGED
package/dist/api/utils/auth.d.ts
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
|
+
import { Config } from '../../../utils/Config';
|
|
1
2
|
type ApiRouteKeys = keyof typeof apiRoutes;
|
|
2
3
|
export type ApiRoutePaths = (typeof apiRoutes)[ApiRouteKeys];
|
|
3
|
-
export declare const apiRoutes: {
|
|
4
|
+
export declare const apiRoutes: (config: Config) => {
|
|
4
5
|
ME: string;
|
|
5
|
-
USERS: (
|
|
6
|
+
USERS: (qp: {
|
|
7
|
+
tenantId?: null | string;
|
|
8
|
+
newTenantName?: null | string;
|
|
9
|
+
}) => string;
|
|
6
10
|
USER: (userId: string) => string;
|
|
7
11
|
TENANTS: string;
|
|
8
12
|
TENANT: (tenantId: string) => string;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { Config } from '../../../utils/Config';
|
|
2
|
+
export declare function makeRestUrl(config: Config, path: string, qp?: Record<string, string | null>): string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { Config } from '../../../utils/Config';
|
|
2
|
+
export declare const proxyRoutes: (config: Config) => {
|
|
2
3
|
SIGNIN: string;
|
|
3
4
|
PROVIDERS: string;
|
|
4
5
|
SESSION: string;
|
|
@@ -6,6 +7,7 @@ export declare const proxyRoutes: {
|
|
|
6
7
|
CALLBACK: string;
|
|
7
8
|
SIGNOUT: string;
|
|
8
9
|
ERROR: string;
|
|
10
|
+
VERIFY_REQUEST: string;
|
|
9
11
|
};
|
|
10
12
|
type ProxyKeys = keyof typeof proxyRoutes;
|
|
11
13
|
export type ProxyPaths = (typeof proxyRoutes)[ProxyKeys];
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { ActiveSession, JWT } from '../api/utils/auth';
|
|
1
2
|
import { Config } from '../utils/Config';
|
|
3
|
+
import { NileRequest } from '../utils/Requester';
|
|
2
4
|
/**
|
|
3
5
|
* a helper function to log in server side.
|
|
4
6
|
*/
|
|
5
|
-
export
|
|
7
|
+
export declare function serverLogin(config: Config, handlers: {
|
|
6
8
|
GET: (req: Request) => Promise<void | Response>;
|
|
7
9
|
POST: (req: Request) => Promise<void | Response>;
|
|
8
10
|
DELETE: (req: Request) => Promise<void | Response>;
|
|
@@ -11,3 +13,10 @@ export default function serverAuth(config: Config, handlers: {
|
|
|
11
13
|
email: string;
|
|
12
14
|
password: string;
|
|
13
15
|
}) => Promise<Headers>;
|
|
16
|
+
export default class Auth extends Config {
|
|
17
|
+
headers?: Headers;
|
|
18
|
+
constructor(config: Config, headers?: Headers);
|
|
19
|
+
handleHeaders(init?: RequestInit): RequestInit | undefined;
|
|
20
|
+
get sessionUrl(): string;
|
|
21
|
+
session: (req: NileRequest<void> | Headers, init?: RequestInit) => Promise<Response | JWT | ActiveSession>;
|
|
22
|
+
}
|
package/dist/db/DBManager.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import NileDatabase from './NileInstance';
|
|
|
4
4
|
export default class DBManager {
|
|
5
5
|
connections: Map<string, NileDatabase>;
|
|
6
6
|
cleared: boolean;
|
|
7
|
+
private poolWatcherFn;
|
|
7
8
|
private makeId;
|
|
8
9
|
constructor(config: ServerConfig);
|
|
9
10
|
poolWatcher: (config: ServerConfig) => (id: undefined | null | string) => void;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
1
|
import { Pool } from 'pg';
|
|
3
2
|
import { Config } from '../utils/Config';
|
|
4
3
|
declare class NileDatabase {
|
|
@@ -10,5 +9,6 @@ declare class NileDatabase {
|
|
|
10
9
|
timer: NodeJS.Timeout | undefined;
|
|
11
10
|
constructor(config: Config, id: string);
|
|
12
11
|
startTimeout(): void;
|
|
12
|
+
shutdown(): void;
|
|
13
13
|
}
|
|
14
14
|
export default NileDatabase;
|
package/dist/index.d.ts
CHANGED