@niledatabase/server 3.0.0-alpha.43 → 3.0.0-alpha.45

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 (81) hide show
  1. package/dist/express.d.mts +20 -0
  2. package/dist/express.d.ts +20 -0
  3. package/dist/express.js +119 -0
  4. package/dist/express.js.map +1 -0
  5. package/dist/express.mjs +116 -0
  6. package/dist/express.mjs.map +1 -0
  7. package/dist/index.d.mts +319 -0
  8. package/dist/index.d.ts +319 -8
  9. package/dist/index.js +2328 -5
  10. package/dist/index.js.map +1 -0
  11. package/dist/index.mjs +2323 -0
  12. package/dist/index.mjs.map +1 -0
  13. package/package.json +17 -4
  14. package/dist/Api.d.ts +0 -25
  15. package/dist/Server.d.ts +0 -26
  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 -4
  22. package/dist/api/routes/auth/csrf.d.ts +0 -4
  23. package/dist/api/routes/auth/error.d.ts +0 -4
  24. package/dist/api/routes/auth/index.d.ts +0 -9
  25. package/dist/api/routes/auth/password-reset.d.ts +0 -4
  26. package/dist/api/routes/auth/providers.d.ts +0 -4
  27. package/dist/api/routes/auth/session.d.ts +0 -4
  28. package/dist/api/routes/auth/signin.d.ts +0 -34
  29. package/dist/api/routes/auth/signout.d.ts +0 -4
  30. package/dist/api/routes/auth/verify-request.d.ts +0 -4
  31. package/dist/api/routes/me/index.d.ts +0 -4
  32. package/dist/api/routes/signup/POST.d.ts +0 -66
  33. package/dist/api/routes/signup/index.d.ts +0 -4
  34. package/dist/api/routes/tenants/GET.d.ts +0 -33
  35. package/dist/api/routes/tenants/POST.d.ts +0 -45
  36. package/dist/api/routes/tenants/[tenantId]/DELETE.d.ts +0 -34
  37. package/dist/api/routes/tenants/[tenantId]/GET.d.ts +0 -37
  38. package/dist/api/routes/tenants/[tenantId]/PUT.d.ts +0 -38
  39. package/dist/api/routes/tenants/[tenantId]/users/GET.d.ts +0 -35
  40. package/dist/api/routes/tenants/[tenantId]/users/POST.d.ts +0 -45
  41. package/dist/api/routes/tenants/[tenantId]/users/PUT.d.ts +0 -29
  42. package/dist/api/routes/tenants/[tenantId]/users/[userId]/DELETE.d.ts +0 -30
  43. package/dist/api/routes/tenants/[tenantId]/users/index.d.ts +0 -4
  44. package/dist/api/routes/tenants/index.d.ts +0 -4
  45. package/dist/api/routes/users/GET.d.ts +0 -35
  46. package/dist/api/routes/users/POST.d.ts +0 -66
  47. package/dist/api/routes/users/[userId]/PUT.d.ts +0 -41
  48. package/dist/api/routes/users/index.d.ts +0 -4
  49. package/dist/api/swagger.d.ts +0 -152
  50. package/dist/api/types.d.ts +0 -20
  51. package/dist/api/utils/auth.d.ts +0 -22
  52. package/dist/api/utils/request.d.ts +0 -4
  53. package/dist/api/utils/routes/apiRoutes.d.ts +0 -18
  54. package/dist/api/utils/routes/defaultRoutes.d.ts +0 -2
  55. package/dist/api/utils/routes/makeRestUrl.d.ts +0 -2
  56. package/dist/api/utils/routes/proxyRoutes.d.ts +0 -15
  57. package/dist/api/utils/routes/urlMatches.d.ts +0 -1
  58. package/dist/auth/index.d.ts +0 -22
  59. package/dist/db/DBManager.d.ts +0 -13
  60. package/dist/db/NileInstance.d.ts +0 -14
  61. package/dist/db/PoolProxy.d.ts +0 -3
  62. package/dist/db/index.d.ts +0 -1
  63. package/dist/server.cjs.development.js +0 -4776
  64. package/dist/server.cjs.development.js.map +0 -1
  65. package/dist/server.cjs.production.min.js +0 -2
  66. package/dist/server.cjs.production.min.js.map +0 -1
  67. package/dist/server.esm.js +0 -4773
  68. package/dist/server.esm.js.map +0 -1
  69. package/dist/tenants/index.d.ts +0 -22
  70. package/dist/tenants/types.d.ts +0 -4
  71. package/dist/types.d.ts +0 -45
  72. package/dist/users/index.d.ts +0 -27
  73. package/dist/users/types.d.ts +0 -36
  74. package/dist/utils/Config/envVars.d.ts +0 -22
  75. package/dist/utils/Config/index.d.ts +0 -48
  76. package/dist/utils/Event/index.d.ts +0 -11
  77. package/dist/utils/Logger.d.ts +0 -8
  78. package/dist/utils/Requester/index.d.ts +0 -23
  79. package/dist/utils/Requester/types.d.ts +0 -88
  80. package/dist/utils/ResponseError.d.ts +0 -4
  81. package/dist/utils/fetch.d.ts +0 -11
@@ -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,20 +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
- VERIFY_REQUEST: string;
19
- PASSWORD_RESET: string;
20
- };
@@ -1,22 +0,0 @@
1
- import { Config } from '../../utils/Config';
2
- export type JWT = {
3
- email: string;
4
- sub: string;
5
- id: string;
6
- iat: number;
7
- exp: number;
8
- jti: string;
9
- };
10
- export type ActiveSession = {
11
- id: string;
12
- email: string;
13
- expires: Date;
14
- user?: {
15
- id: string;
16
- name: string;
17
- image: string;
18
- email: string;
19
- emailVerified: void | Date;
20
- };
21
- };
22
- export default function auth(req: Request, config: Config): Promise<void | ActiveSession>;
@@ -1,4 +0,0 @@
1
- import { Config } from '../../utils/Config';
2
- export default function request(url: string, _init: RequestInit & {
3
- request: Request;
4
- }, config: Config): Promise<Response>;
@@ -1,18 +0,0 @@
1
- import { Config } from '../../../utils/Config';
2
- type ApiRouteKeys = keyof typeof apiRoutes;
3
- export type ApiRoutePaths = (typeof apiRoutes)[ApiRouteKeys];
4
- export declare const apiRoutes: (config: Config) => {
5
- ME: string;
6
- USERS: (qp: {
7
- tenantId?: null | string;
8
- newTenantName?: null | string;
9
- }) => string;
10
- USER: (userId: string) => string;
11
- TENANTS: string;
12
- TENANT: (tenantId: string) => string;
13
- SIGNUP: string;
14
- TENANT_USERS: (tenantId: string) => string;
15
- TENANT_USER: (tenantId: string, userId: string) => string;
16
- USER_TENANTS: (userId: string) => string;
17
- };
18
- export {};
@@ -1,2 +0,0 @@
1
- import { Routes } from '../../types';
2
- export declare const appRoutes: (prefix?: string) => Routes;
@@ -1,2 +0,0 @@
1
- import { Config } from '../../../utils/Config';
2
- export declare function makeRestUrl(config: Config, path: string, qp?: Record<string, string | null>): string;
@@ -1,15 +0,0 @@
1
- import { Config } from '../../../utils/Config';
2
- export declare const proxyRoutes: (config: Config) => {
3
- SIGNIN: string;
4
- PROVIDERS: string;
5
- SESSION: string;
6
- CSRF: string;
7
- CALLBACK: string;
8
- SIGNOUT: string;
9
- ERROR: string;
10
- VERIFY_REQUEST: string;
11
- PASSWORD_RESET: string;
12
- };
13
- type ProxyKeys = keyof typeof proxyRoutes;
14
- export type ProxyPaths = (typeof proxyRoutes)[ProxyKeys];
15
- export {};
@@ -1 +0,0 @@
1
- export default function urlMatches(requestUrl: string, route: string): boolean;
@@ -1,22 +0,0 @@
1
- import { ActiveSession, JWT } from '../api/utils/auth';
2
- import { Config } from '../utils/Config';
3
- import { NileRequest } from '../utils/Requester';
4
- /**
5
- * a helper function to log in server side.
6
- */
7
- export declare function serverLogin(config: Config, handlers: {
8
- GET: (req: Request) => Promise<void | Response>;
9
- POST: (req: Request) => Promise<void | Response>;
10
- DELETE: (req: Request) => Promise<void | Response>;
11
- PUT: (req: Request) => Promise<void | Response>;
12
- }): ({ email, password, }: {
13
- email: string;
14
- password: string;
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
- }
@@ -1,13 +0,0 @@
1
- import { Pool } from 'pg';
2
- import { ServerConfig } from '../types';
3
- import NileDatabase from './NileInstance';
4
- export default class DBManager {
5
- connections: Map<string, NileDatabase>;
6
- cleared: boolean;
7
- private poolWatcherFn;
8
- private makeId;
9
- constructor(config: ServerConfig);
10
- poolWatcher: (config: ServerConfig) => (id: undefined | null | string) => void;
11
- getConnection: (config: ServerConfig) => Pool;
12
- clear: (config: ServerConfig) => void;
13
- }
@@ -1,14 +0,0 @@
1
- import { Pool } from 'pg';
2
- import { Config } from '../utils/Config';
3
- declare class NileDatabase {
4
- pool: Pool;
5
- tenantId?: undefined | null | string;
6
- userId?: undefined | null | string;
7
- id: string;
8
- config: Config;
9
- timer: NodeJS.Timeout | undefined;
10
- constructor(config: Config, id: string);
11
- startTimeout(): void;
12
- shutdown(): void;
13
- }
14
- export default NileDatabase;
@@ -1,3 +0,0 @@
1
- import { Pool } from 'pg';
2
- import { Config } from '../utils/Config';
3
- export declare function createProxyForPool(pool: Pool, config: Config): Pool;
@@ -1 +0,0 @@
1
- export { default } from './DBManager';