@niledatabase/server 3.0.0-alpha.9 → 3.0.0

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.
Files changed (75) hide show
  1. package/dist/express.d.mts +24 -0
  2. package/dist/express.d.ts +24 -0
  3. package/dist/express.js +147 -0
  4. package/dist/express.js.map +1 -0
  5. package/dist/express.mjs +144 -0
  6. package/dist/express.mjs.map +1 -0
  7. package/dist/index.d.mts +323 -0
  8. package/dist/index.d.ts +323 -5
  9. package/dist/index.js +2382 -5
  10. package/dist/index.js.map +1 -0
  11. package/dist/index.mjs +2377 -0
  12. package/dist/index.mjs.map +1 -0
  13. package/package.json +17 -4
  14. package/dist/Api.d.ts +0 -22
  15. package/dist/Server.d.ts +0 -29
  16. package/dist/api/handlers/DELETE.d.ts +0 -3
  17. package/dist/api/handlers/GET.d.ts +0 -3
  18. package/dist/api/handlers/POST.d.ts +0 -3
  19. package/dist/api/handlers/PUT.d.ts +0 -3
  20. package/dist/api/handlers/index.d.ts +0 -8
  21. package/dist/api/routes/auth/callback.d.ts +0 -3
  22. package/dist/api/routes/auth/csrf.d.ts +0 -3
  23. package/dist/api/routes/auth/error.d.ts +0 -3
  24. package/dist/api/routes/auth/index.d.ts +0 -7
  25. package/dist/api/routes/auth/providers.d.ts +0 -3
  26. package/dist/api/routes/auth/session.d.ts +0 -4
  27. package/dist/api/routes/auth/signin.d.ts +0 -33
  28. package/dist/api/routes/auth/signout.d.ts +0 -3
  29. package/dist/api/routes/me/index.d.ts +0 -4
  30. package/dist/api/routes/tenants/GET.d.ts +0 -32
  31. package/dist/api/routes/tenants/POST.d.ts +0 -45
  32. package/dist/api/routes/tenants/[tenantId]/DELETE.d.ts +0 -34
  33. package/dist/api/routes/tenants/[tenantId]/users/GET.d.ts +0 -35
  34. package/dist/api/routes/tenants/[tenantId]/users/POST.d.ts +0 -44
  35. package/dist/api/routes/tenants/[tenantId]/users/PUT.d.ts +0 -29
  36. package/dist/api/routes/tenants/[tenantId]/users/[userId]/DELETE.d.ts +0 -30
  37. package/dist/api/routes/tenants/[tenantId]/users/index.d.ts +0 -4
  38. package/dist/api/routes/tenants/index.d.ts +0 -4
  39. package/dist/api/routes/users/GET.d.ts +0 -34
  40. package/dist/api/routes/users/POST.d.ts +0 -66
  41. package/dist/api/routes/users/[userId]/PUT.d.ts +0 -40
  42. package/dist/api/routes/users/index.d.ts +0 -4
  43. package/dist/api/swagger.d.ts +0 -152
  44. package/dist/api/types.d.ts +0 -18
  45. package/dist/api/utils/auth.d.ts +0 -14
  46. package/dist/api/utils/request.d.ts +0 -4
  47. package/dist/api/utils/routes/apiRoutes.d.ts +0 -14
  48. package/dist/api/utils/routes/defaultRoutes.d.ts +0 -2
  49. package/dist/api/utils/routes/makeRestUrl.d.ts +0 -1
  50. package/dist/api/utils/routes/proxyRoutes.d.ts +0 -12
  51. package/dist/api/utils/routes/urlMatches.d.ts +0 -1
  52. package/dist/auth/index.d.ts +0 -13
  53. package/dist/db/DBManager.d.ts +0 -12
  54. package/dist/db/NileInstance.d.ts +0 -14
  55. package/dist/db/PoolProxy.d.ts +0 -3
  56. package/dist/db/index.d.ts +0 -1
  57. package/dist/db/isUUID.d.ts +0 -1
  58. package/dist/server.cjs.development.js +0 -3976
  59. package/dist/server.cjs.development.js.map +0 -1
  60. package/dist/server.cjs.production.min.js +0 -2
  61. package/dist/server.cjs.production.min.js.map +0 -1
  62. package/dist/server.esm.js +0 -3974
  63. package/dist/server.esm.js.map +0 -1
  64. package/dist/tenants/index.d.ts +0 -21
  65. package/dist/types.d.ts +0 -37
  66. package/dist/users/index.d.ts +0 -52
  67. package/dist/utils/Config/envVars.d.ts +0 -22
  68. package/dist/utils/Config/index.d.ts +0 -47
  69. package/dist/utils/Event/index.d.ts +0 -12
  70. package/dist/utils/Logger.d.ts +0 -7
  71. package/dist/utils/Requester/index.d.ts +0 -23
  72. package/dist/utils/Requester/types.d.ts +0 -88
  73. package/dist/utils/ResponseError.d.ts +0 -4
  74. package/dist/utils/Server/index.d.ts +0 -4
  75. package/dist/utils/fetch.d.ts +0 -9
@@ -1,3 +0,0 @@
1
- import { Routes } from '../../types';
2
- export default function route(request: Request): Promise<Response>;
3
- export declare function matches(configRoutes: Routes, request: Request): boolean;
@@ -1,3 +0,0 @@
1
- import { Routes } from '../../types';
2
- export default function route(req: Request): Promise<Response>;
3
- export declare function matches(configRoutes: Routes, request: Request): boolean;
@@ -1,3 +0,0 @@
1
- import { Routes } from '../../types';
2
- export default function route(req: Request): Promise<Response>;
3
- export declare function matches(configRoutes: Routes, request: Request): boolean;
@@ -1,7 +0,0 @@
1
- export { default as handleSignIn, matches as matchSignIn } from './signin';
2
- export { default as handleSession, matches as matchSession } from './session';
3
- export { default as handleProviders, matches as matchProviders, } from './providers';
4
- export { default as handleCsrf, matches as matchCsrf } from './csrf';
5
- export { default as handleCallback, matches as matchCallback, } from './callback';
6
- export { default as handleSignOut, matches as matchSignOut } from './signout';
7
- export { default as handleError, matches as matchError } from './error';
@@ -1,3 +0,0 @@
1
- import { Routes } from '../../types';
2
- export default function route(req: Request): Promise<Response>;
3
- export declare function matches(configRoutes: Routes, request: Request): boolean;
@@ -1,4 +0,0 @@
1
- import { Routes } from '../../types';
2
- import { Config } from '../../../utils/Config';
3
- export default function route(req: Request, config: Config): Promise<Response>;
4
- export declare function matches(configRoutes: Routes, request: Request): boolean;
@@ -1,33 +0,0 @@
1
- /**
2
- * @swagger
3
- * /api/auth/signin:
4
- * get:
5
- * tags:
6
- * - authentication
7
- * summary: lists users in the tenant
8
- * description: Returns information about the users within the tenant
9
- * provided
10
- * operationId: signin
11
- * parameters:
12
- * - name: tenantId
13
- * in: path
14
- * required: true
15
- * schema:
16
- * type: string
17
- * responses:
18
- * "200":
19
- * description: A list of users
20
- * content:
21
- * application/json:
22
- * schema:
23
- * $ref: '#/components/schemas/User'
24
- * "404":
25
- * description: Not found
26
- * content: {}
27
- * "401":
28
- * description: Unauthorized
29
- * content: {}
30
- */
31
- import { Routes } from '../../types';
32
- export default function route(req: Request): Promise<Response>;
33
- export declare function matches(configRoutes: Routes, request: Request): boolean;
@@ -1,3 +0,0 @@
1
- import { Routes } from '../../types';
2
- export default function route(request: Request): Promise<Response>;
3
- export declare function matches(configRoutes: Routes, request: Request): boolean;
@@ -1,4 +0,0 @@
1
- import { Routes } from '../../types';
2
- import { Config } from '../../../utils/Config';
3
- export default function route(request: Request, config: Config): Promise<Response>;
4
- export declare function matches(configRoutes: Routes, request: Request): boolean;
@@ -1,32 +0,0 @@
1
- import { ActiveSession } from '../../utils/auth';
2
- /**
3
- * @swagger
4
- * /api/tenants:
5
- * get:
6
- * tags:
7
- * - tenants
8
- * summary: list tenants by user
9
- * description: Creates a user in the database
10
- * operationId: listTenants
11
- * responses:
12
- * "200":
13
- * description: a list of tenants
14
- * content:
15
- * application/json:
16
- * schema:
17
- * type: array
18
- * items:
19
- * $ref: "#/components/schemas/Tenant"
20
- * "400":
21
- * description: API/Database failures
22
- * content:
23
- * text/plain:
24
- * schema:
25
- * type: string
26
- * "401":
27
- * description: Unauthorized
28
- * content: {}
29
- */
30
- export declare function GET(session: ActiveSession, init: RequestInit & {
31
- request: Request;
32
- }, log: (...args: string[]) => void): Promise<Response>;
@@ -1,45 +0,0 @@
1
- import { ActiveSession } from '../../utils/auth';
2
- /**
3
- * @swagger
4
- * /api/tenants:
5
- * post:
6
- * tags:
7
- * - tenants
8
- * summary: Create a tenant
9
- * description: Creates a new tenant in a database.
10
- * operationId: createTenant
11
- * requestBody:
12
- * description: A wrapper for the tenant name.
13
- * content:
14
- * application/json:
15
- * schema:
16
- * $ref: '#/components/schemas/CreateTenantRequest'
17
- * examples:
18
- * Create Tenant Request:
19
- * summary: Creates a named tenant
20
- * description: Create Tenant Request
21
- * value:
22
- * name: My Sandbox
23
- * responses:
24
- * "201":
25
- * description: Tenant created
26
- * content:
27
- * application/json:
28
- * schema:
29
- * $ref: '#/components/schemas/Tenant'
30
- * "401":
31
- * description: Unauthorized
32
- * content:
33
- * application/json:
34
- * schema:
35
- * $ref: '#/components/schemas/APIError'
36
- * "404":
37
- * description: Database not found
38
- * content:
39
- * application/json:
40
- * schema:
41
- * $ref: '#/components/schemas/APIError'
42
- */
43
- export declare function POST(session: ActiveSession, init: RequestInit & {
44
- request: Request;
45
- }, log: (...args: string[]) => void): Promise<Response>;
@@ -1,34 +0,0 @@
1
- import { ActiveSession } from '../../../utils/auth';
2
- /**
3
- * @swagger
4
- * /api/tenants/{tenantId}:
5
- * delete:
6
- * tags:
7
- * - tenants
8
- * summary: Deletes a tenant.
9
- * operationId: deleteTenant
10
- * parameters:
11
- * - name: tenantId
12
- * in: path
13
- * required: true
14
- * schema:
15
- * type: string
16
- * responses:
17
- * "204":
18
- * description: Tenant deleted
19
- * "401":
20
- * description: Unauthorized
21
- * content:
22
- * application/json:
23
- * schema:
24
- * $ref: '#/components/schemas/APIError'
25
- * "404":
26
- * description: Tenant not found
27
- * content:
28
- * application/json:
29
- * schema:
30
- * $ref: '#/components/schemas/APIError'
31
- */
32
- export declare function DELETE(session: ActiveSession, init: RequestInit & {
33
- request: Request;
34
- }, log: (...args: string[]) => void): Promise<Response>;
@@ -1,35 +0,0 @@
1
- import { ActiveSession } from '../../../../utils/auth';
2
- /**
3
- * @swagger
4
- * /api/tenants/{tenantId}/users:
5
- * get:
6
- * tags:
7
- * - users
8
- * summary: List tenant users
9
- * description: Lists users that are associated with the specified tenant.
10
- * operationId: listTenantUsers
11
- * parameters:
12
- * - name: tenantId
13
- * in: path
14
- * required: true
15
- * schema:
16
- * type: string
17
- * responses:
18
- * "200":
19
- * description: Users found
20
- * content:
21
- * application/json:
22
- * schema:
23
- * type: array
24
- * items:
25
- * $ref: '#/components/schemas/User'
26
- * "401":
27
- * description: Unauthorized
28
- * content:
29
- * application/json:
30
- * schema:
31
- * $ref: '#/components/schemas/APIError'
32
- */
33
- export declare function GET(session: ActiveSession, init: RequestInit & {
34
- request: Request;
35
- }, log: (...args: string[]) => void): Promise<Response>;
@@ -1,44 +0,0 @@
1
- import { ActiveSession } from '../../../../utils/auth';
2
- /**
3
- * @swagger
4
- * /api/tenants/{tenantId}/users:
5
- * post:
6
- * tags:
7
- * - users
8
- * summary: Create a user in a tenant
9
- * description: Creates a new user and associates that user with the specified
10
- * tenant.
11
- * operationId: createTenantUser
12
- * parameters:
13
- * - name: tenantId
14
- * in: path
15
- * required: true
16
- * schema:
17
- * type: string
18
- * requestBody:
19
- * description: |
20
- * The email and password combination the user will use to authenticate.
21
- * The `name` is optional; if provided it will be recorded in the `users` table.
22
- * content:
23
- * application/json:
24
- * schema:
25
- * $ref: '#/components/schemas/CreateBasicUserRequest'
26
- * examples:
27
- * Create User Request:
28
- * summary: Creates a user with basic credentials
29
- * description: Create User Request
30
- * value:
31
- * email: a.user@somedomain.com
32
- * password: somepassword
33
- * name: A. User
34
- * responses:
35
- * "201":
36
- * description: User created
37
- * content:
38
- * application/json:
39
- * schema:
40
- * $ref: '#/components/schemas/User'
41
- */
42
- export declare function POST(session: ActiveSession, init: RequestInit & {
43
- request: Request;
44
- }, log: (...args: string[]) => void): Promise<Response>;
@@ -1,29 +0,0 @@
1
- import { ActiveSession } from '../../../../utils/auth';
2
- /**
3
- * @swagger
4
- * /api/tenants/{tenantId}/users:
5
- * put:
6
- * tags:
7
- * - tenants
8
- * summary: associates an existing user with the tenant
9
- * operationId: linkUser
10
- * parameters:
11
- * - name: tenantId
12
- * in: path
13
- * required: true
14
- * schema:
15
- * type: string
16
- * requestBody:
17
- * description: |
18
- * The email of the user you want to add to a tenant.
19
- * content:
20
- * application/json:
21
- * schema:
22
- * $ref: '#/components/schemas/AssociateUserRequest'
23
- * responses:
24
- * "201":
25
- * description: add user to tenant
26
- */
27
- export declare function PUT(session: ActiveSession, init: RequestInit & {
28
- request: Request;
29
- }, log: (...args: string[]) => void): Promise<Response>;
@@ -1,30 +0,0 @@
1
- import { ActiveSession } from '../../../../../utils/auth';
2
- /**
3
- * @swagger
4
- * /api/tenants/{tenantId}/users/{email}:
5
- * delete:
6
- * tags:
7
- * - tenants
8
- * summary: removes a user from a tenant
9
- * description: removes an associated user from a specified
10
- * tenant.
11
- * operationId: unlinkUser
12
- * parameters:
13
- * - name: tenantId
14
- * in: path
15
- * required: true
16
- * schema:
17
- * type: string
18
- * - name: email
19
- * in: path
20
- * required: true
21
- * schema:
22
- * type: string
23
-
24
- * responses:
25
- * "204":
26
- * description: User removed
27
- */
28
- export declare function DELETE(session: ActiveSession, init: RequestInit & {
29
- request: Request;
30
- }, log: (...args: string[]) => void): Promise<Response>;
@@ -1,4 +0,0 @@
1
- import { Config } from '../../../../../utils/Config';
2
- import { Routes } from '../../../../types';
3
- export default function route(request: Request, config: Config): Promise<Response>;
4
- export declare function matches(configRoutes: Routes, request: Request): boolean;
@@ -1,4 +0,0 @@
1
- import { Config } from '../../../utils/Config';
2
- import { Routes } from '../../types';
3
- export default function route(request: Request, config: Config): Promise<Response>;
4
- export declare function matches(configRoutes: Routes, request: Request): boolean;
@@ -1,34 +0,0 @@
1
- /**
2
- * @swagger
3
- * /api/users:
4
- * get:
5
- * tags:
6
- * - users
7
- * summary: lists users in the tenant
8
- * description: Returns information about the users within the tenant
9
- * provided. You can also pass the a `niledb-tenant-id` in the header or in a cookie.
10
- * operationId: listUsers
11
- * parameters:
12
- * - name: tenantId
13
- * in: query
14
- * schema:
15
- * type: string
16
- * responses:
17
- * "200":
18
- * description: A list of users
19
- * content:
20
- * application/json:
21
- * schema:
22
- * type: array
23
- * items:
24
- * $ref: '#/components/schemas/TenantUser'
25
- * "404":
26
- * description: Not found
27
- * content: {}
28
- * "401":
29
- * description: Unauthorized
30
- * content: {}
31
- */
32
- export declare function GET(init: RequestInit & {
33
- request: Request;
34
- }, log: (...args: string[]) => void): Promise<Response>;
@@ -1,66 +0,0 @@
1
- import { ActiveSession } from '../../utils/auth';
2
- /**
3
- * @swagger
4
- * /api/users:
5
- * post:
6
- * tags:
7
- * - users
8
- * summary: Creates a user
9
- * description: Creates a user in the database
10
- * operationId: createUser
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 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(session: void | ActiveSession, init: RequestInit & {
65
- request: Request;
66
- }, log?: (...args: string[]) => void): Promise<Response>;
@@ -1,40 +0,0 @@
1
- import { ActiveSession } from '../../../utils/auth';
2
- /**
3
- * @swagger
4
- * /api/users/{userid}:
5
- * put:
6
- * tags:
7
- * - users
8
- * summary: update a user
9
- * description: updates a user within the tenant
10
- * operationId: updateUser
11
- * parameters:
12
- * - name: userid
13
- * in: path
14
- * required: true
15
- * schema:
16
- * type: string
17
- * requestBody:
18
- * description: |-
19
- * Update a user
20
- * content:
21
- * application/json:
22
- * schema:
23
- * $ref: '#/components/schemas/UpdateUserRequest'
24
- * responses:
25
- * "200":
26
- * description: An updated user
27
- * content:
28
- * application/json:
29
- * schema:
30
- * $ref: '#/components/schemas/User'
31
- * "404":
32
- * description: Not found
33
- * content: {}
34
- * "401":
35
- * description: Unauthorized
36
- * content: {}
37
- */
38
- export declare function PUT(session: void | ActiveSession, init: RequestInit & {
39
- request: Request;
40
- }, log: (...args: string[]) => void): Promise<Response>;
@@ -1,4 +0,0 @@
1
- import { Routes } from '../../types';
2
- import { Config } from '../../../utils/Config';
3
- export default function route(request: Request, config: Config): Promise<Response>;
4
- export declare function matches(configRoutes: Routes, request: Request): boolean;
@@ -1,152 +0,0 @@
1
- /**
2
- *
3
- * @swagger
4
- * components:
5
- * schemas:
6
- * CreateBasicUserRequest:
7
- * required:
8
- * - email
9
- * - password
10
- * type: object
11
- * properties:
12
- * email:
13
- * type: string
14
- * password:
15
- * type: string
16
- * name:
17
- * type: string
18
- * givenName:
19
- * type: string
20
- * familyName:
21
- * type: string
22
- * picture:
23
- * type: string
24
- * newTenantName:
25
- * type: string
26
- * AssociateUserRequest:
27
- * type: object
28
- * required:
29
- * - email
30
- * properties:
31
- * email:
32
- * type: string
33
- * UpdateUserRequest:
34
- * type: object
35
- * properties:
36
- * name:
37
- * type: string
38
- * givenName:
39
- * type: string
40
- * familyName:
41
- * type: string
42
- * picture:
43
- * type: string
44
- * CreateTenantRequest:
45
- * required:
46
- * - name
47
- * type: object
48
- * properties:
49
- * name:
50
- * type: string
51
- * Tenant:
52
- * required:
53
- * - id
54
- * type: object
55
- * properties:
56
- * id:
57
- * type: string
58
- * name:
59
- * type: string
60
- * User:
61
- * type: object
62
- * properties:
63
- * id:
64
- * type: string
65
- * tenants:
66
- * uniqueItems: true
67
- * type: array
68
- * items:
69
- * type: string
70
- * email:
71
- * type: string
72
- * name:
73
- * type: string
74
- * givenName:
75
- * type: string
76
- * familyName:
77
- * type: string
78
- * picture:
79
- * type: string
80
- * created:
81
- * type: string
82
- * format: date-time
83
- * updated:
84
- * type: string
85
- * format: date-time
86
- * TenantUser:
87
- * type: object
88
- * properties:
89
- * id:
90
- * type: string
91
- * email:
92
- * type: string
93
- * name:
94
- * type: string
95
- * givenName:
96
- * type: string
97
- * familyName:
98
- * type: string
99
- * picture:
100
- * type: string
101
- * created:
102
- * type: string
103
- * format: date-time
104
- * updated:
105
- * type: string
106
- * format: date-time
107
- * APIError:
108
- * required:
109
- * - errorCode
110
- * - message
111
- * - statusCode
112
- * type: object
113
- * properties:
114
- * errorCode:
115
- * type: string
116
- * enum:
117
- * - internal_error
118
- * - bad_request
119
- * - unsupported_operation
120
- * - entity_not_found
121
- * - duplicate_entity
122
- * - invalid_credentials
123
- * - unknown_oidc_provider
124
- * - unknown_oidc_party
125
- * - provider_already_exists
126
- * - provider_config_error
127
- * - provider_mismatch
128
- * - provider_update_error
129
- * - provider_disabled
130
- * - session_state_missing
131
- * - session_state_mismatch
132
- * - oidc_code_missing
133
- * - tenant_not_found
134
- * - constraint_violation
135
- * - sql_exception
136
- * - db_creation_failure
137
- * - db_status_failure
138
- * - db_initialization_failure
139
- * - db_config_missing
140
- * - unauthorized_workspace_access
141
- * - email_send_failure
142
- * - jdbc_exception
143
- * - oidc_exception
144
- * - region_mismatch
145
- * - credential_creation_failure
146
- * - credential_propagation_failure
147
- * message:
148
- * type: string
149
- * statusCode:
150
- * type: integer
151
- * format: int32
152
- */
@@ -1,18 +0,0 @@
1
- import { ApiRoutePaths } from './utils/routes/apiRoutes';
2
- import { ProxyPaths } from './utils/routes/proxyRoutes';
3
- export type Paths = ProxyPaths & ApiRoutePaths;
4
- export type Routes = {
5
- SIGNIN: string;
6
- SESSION: string;
7
- PROVIDERS: string;
8
- CSRF: string;
9
- CALLBACK: string;
10
- SIGNOUT: string;
11
- ERROR: string;
12
- ME: string;
13
- USERS: string;
14
- TENANTS: string;
15
- TENANT_USER: string;
16
- TENANT_USERS: string;
17
- SIGNUP: string;
18
- };