acebase-server 1.16.2 → 1.18.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.
- package/README.md +180 -10
- package/bin/acebase-server.js +8 -0
- package/build-vars.js +2 -1
- package/dist/cjs/auth.js +88 -88
- package/dist/cjs/cluster.js +6 -56
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js +24 -24
- package/dist/cjs/logger.js +73 -73
- package/dist/cjs/middleware/404.js +14 -14
- package/dist/cjs/middleware/admin-only.js +28 -28
- package/dist/cjs/middleware/cache.js +14 -14
- package/dist/cjs/middleware/connection.js +49 -49
- package/dist/cjs/middleware/context.js +20 -20
- package/dist/cjs/middleware/cors.js +50 -50
- package/dist/cjs/middleware/swagger.js +17 -17
- package/dist/cjs/middleware/user.js +57 -57
- package/dist/cjs/oauth-providers/dropbox.js +109 -109
- package/dist/cjs/oauth-providers/facebook.js +85 -85
- package/dist/cjs/oauth-providers/google.js +119 -119
- package/dist/cjs/oauth-providers/index.js +26 -26
- package/dist/cjs/oauth-providers/instagram.js +80 -80
- package/dist/cjs/oauth-providers/oauth-provider.js +20 -20
- package/dist/cjs/oauth-providers/spotify.js +113 -113
- package/dist/cjs/routes/auth-change-password.js +87 -87
- package/dist/cjs/routes/auth-delete.js +52 -52
- package/dist/cjs/routes/auth-forgot-password.js +77 -77
- package/dist/cjs/routes/auth-reset-password.js +97 -97
- package/dist/cjs/routes/auth-signin.js +46 -46
- package/dist/cjs/routes/auth-signout.js +61 -61
- package/dist/cjs/routes/auth-signup.js +142 -142
- package/dist/cjs/routes/auth-state.js +25 -25
- package/dist/cjs/routes/auth-update.js +131 -131
- package/dist/cjs/routes/auth-verify-email.js +71 -71
- package/dist/cjs/routes/auth.js +57 -54
- package/dist/cjs/routes/data-exists.js +33 -33
- package/dist/cjs/routes/data-export.js +48 -48
- package/dist/cjs/routes/data-get.js +70 -66
- package/dist/cjs/routes/data-import.js +54 -54
- package/dist/cjs/routes/data-index-create.js +42 -42
- package/dist/cjs/routes/data-index-delete.js +33 -33
- package/dist/cjs/routes/data-index-list.js +31 -31
- package/dist/cjs/routes/data-query.js +80 -70
- package/dist/cjs/routes/data-reflect.js +97 -86
- package/dist/cjs/routes/data-schema-get.js +36 -36
- package/dist/cjs/routes/data-schema-set.js +30 -30
- package/dist/cjs/routes/data-schema-test.js +43 -43
- package/dist/cjs/routes/data-schemas-list.js +32 -32
- package/dist/cjs/routes/data-set.js +85 -75
- package/dist/cjs/routes/data-sync-changes.js +81 -67
- package/dist/cjs/routes/data-sync-mutations.js +81 -67
- package/dist/cjs/routes/data-transaction.js +159 -139
- package/dist/cjs/routes/data-update.js +86 -75
- package/dist/cjs/routes/data.js +62 -62
- package/dist/cjs/routes/docs.js +258 -251
- package/dist/cjs/routes/meta-info.js +63 -63
- package/dist/cjs/routes/meta-logs.js +49 -49
- package/dist/cjs/routes/meta-ping.js +11 -11
- package/dist/cjs/routes/meta-stats.js +27 -27
- package/dist/cjs/routes/meta.js +19 -19
- package/dist/cjs/routes/oauth2-init.js +54 -54
- package/dist/cjs/routes/oauth2-refresh.js +42 -42
- package/dist/cjs/routes/oauth2-signin.js +265 -265
- package/dist/cjs/routes/webmanager.js +26 -26
- package/dist/cjs/rules.js +380 -167
- package/dist/cjs/sandbox.js +28 -0
- package/dist/cjs/schema/user.js +24 -24
- package/dist/cjs/server.js +410 -407
- package/dist/cjs/settings/email.js +2 -2
- package/dist/cjs/settings/index.js +175 -172
- package/dist/cjs/shared/clients.js +26 -26
- package/dist/cjs/shared/email.js +2 -2
- package/dist/cjs/shared/env.js +2 -2
- package/dist/cjs/shared/error.js +33 -33
- package/dist/cjs/shared/http.js +28 -28
- package/dist/cjs/shared/password.js +45 -45
- package/dist/cjs/shared/rootpath.js +16 -16
- package/dist/cjs/shared/signin.js +143 -143
- package/dist/cjs/shared/simple-fetch.js +76 -76
- package/dist/cjs/shared/tokens.js +79 -79
- package/dist/cjs/shared/validate.js +61 -61
- package/dist/cjs/start.js +119 -53
- package/dist/cjs/test.js +10 -10
- package/dist/cjs/websocket/index.js +331 -319
- package/dist/cjs/websocket/manager.js +15 -15
- package/dist/cjs/websocket/socket.io.js +76 -76
- package/dist/esm/auth.js +75 -75
- package/dist/esm/cluster.js +6 -54
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js +4 -4
- package/dist/esm/logger.js +51 -51
- package/dist/esm/middleware/404.js +10 -10
- package/dist/esm/middleware/admin-only.js +24 -24
- package/dist/esm/middleware/cache.js +10 -10
- package/dist/esm/middleware/connection.js +45 -45
- package/dist/esm/middleware/context.js +16 -16
- package/dist/esm/middleware/cors.js +44 -44
- package/dist/esm/middleware/swagger.js +13 -13
- package/dist/esm/middleware/user.js +44 -44
- package/dist/esm/oauth-providers/dropbox.js +90 -90
- package/dist/esm/oauth-providers/facebook.js +66 -66
- package/dist/esm/oauth-providers/google.js +96 -96
- package/dist/esm/oauth-providers/index.js +18 -18
- package/dist/esm/oauth-providers/instagram.js +61 -61
- package/dist/esm/oauth-providers/oauth-provider.js +16 -16
- package/dist/esm/oauth-providers/spotify.js +92 -92
- package/dist/esm/routes/auth-change-password.js +72 -72
- package/dist/esm/routes/auth-delete.js +37 -37
- package/dist/esm/routes/auth-forgot-password.js +62 -62
- package/dist/esm/routes/auth-reset-password.js +81 -81
- package/dist/esm/routes/auth-signin.js +33 -33
- package/dist/esm/routes/auth-signout.js +47 -47
- package/dist/esm/routes/auth-signup.js +127 -127
- package/dist/esm/routes/auth-state.js +12 -12
- package/dist/esm/routes/auth-update.js +116 -116
- package/dist/esm/routes/auth-verify-email.js +57 -57
- package/dist/esm/routes/auth.js +53 -50
- package/dist/esm/routes/data-exists.js +20 -20
- package/dist/esm/routes/data-export.js +35 -35
- package/dist/esm/routes/data-get.js +56 -52
- package/dist/esm/routes/data-import.js +41 -41
- package/dist/esm/routes/data-index-create.js +28 -28
- package/dist/esm/routes/data-index-delete.js +20 -20
- package/dist/esm/routes/data-index-list.js +18 -18
- package/dist/esm/routes/data-query.js +66 -56
- package/dist/esm/routes/data-reflect.js +83 -72
- package/dist/esm/routes/data-schema-get.js +23 -23
- package/dist/esm/routes/data-schema-set.js +17 -17
- package/dist/esm/routes/data-schema-test.js +29 -29
- package/dist/esm/routes/data-schemas-list.js +19 -19
- package/dist/esm/routes/data-set.js +70 -60
- package/dist/esm/routes/data-sync-changes.js +67 -53
- package/dist/esm/routes/data-sync-mutations.js +67 -53
- package/dist/esm/routes/data-transaction.js +142 -123
- package/dist/esm/routes/data-update.js +71 -60
- package/dist/esm/routes/data.js +58 -58
- package/dist/esm/routes/docs.js +252 -245
- package/dist/esm/routes/meta-info.js +59 -59
- package/dist/esm/routes/meta-logs.js +35 -35
- package/dist/esm/routes/meta-ping.js +7 -7
- package/dist/esm/routes/meta-stats.js +14 -14
- package/dist/esm/routes/meta.js +15 -15
- package/dist/esm/routes/oauth2-init.js +41 -41
- package/dist/esm/routes/oauth2-refresh.js +29 -29
- package/dist/esm/routes/oauth2-signin.js +251 -251
- package/dist/esm/routes/webmanager.js +22 -22
- package/dist/esm/rules.js +374 -163
- package/dist/esm/sandbox.js +12 -0
- package/dist/esm/schema/user.js +19 -19
- package/dist/esm/server.js +395 -387
- package/dist/esm/settings/email.js +1 -1
- package/dist/esm/settings/index.js +168 -165
- package/dist/esm/shared/clients.js +22 -22
- package/dist/esm/shared/email.js +1 -1
- package/dist/esm/shared/env.js +1 -1
- package/dist/esm/shared/error.js +25 -25
- package/dist/esm/shared/http.js +22 -22
- package/dist/esm/shared/password.js +38 -38
- package/dist/esm/shared/rootpath.js +13 -13
- package/dist/esm/shared/signin.js +128 -128
- package/dist/esm/shared/simple-fetch.js +59 -59
- package/dist/esm/shared/tokens.js +72 -72
- package/dist/esm/shared/validate.js +41 -41
- package/dist/esm/start.js +116 -50
- package/dist/esm/test.js +8 -8
- package/dist/esm/websocket/index.js +313 -302
- package/dist/esm/websocket/manager.js +11 -11
- package/dist/esm/websocket/socket.io.js +71 -71
- package/dist/types/auth.d.ts +3 -3
- package/dist/types/cluster.d.ts +6 -1
- package/dist/types/index.d.ts +4 -4
- package/dist/types/logger.d.ts +35 -35
- package/dist/types/middleware/404.d.ts +7 -7
- package/dist/types/middleware/admin-only.d.ts +19 -19
- package/dist/types/middleware/cache.d.ts +3 -3
- package/dist/types/middleware/connection.d.ts +7 -7
- package/dist/types/middleware/context.d.ts +3 -3
- package/dist/types/middleware/cors.d.ts +25 -25
- package/dist/types/middleware/swagger.d.ts +3 -3
- package/dist/types/middleware/user.d.ts +2 -2
- package/dist/types/oauth-providers/dropbox.d.ts +52 -52
- package/dist/types/oauth-providers/facebook.d.ts +41 -41
- package/dist/types/oauth-providers/google.d.ts +43 -43
- package/dist/types/oauth-providers/index.d.ts +10 -10
- package/dist/types/oauth-providers/instagram.d.ts +50 -50
- package/dist/types/oauth-providers/oauth-provider.d.ts +74 -74
- package/dist/types/oauth-providers/spotify.d.ts +53 -53
- package/dist/types/routes/auth-change-password.d.ts +20 -20
- package/dist/types/routes/auth-delete.d.ts +16 -16
- package/dist/types/routes/auth-forgot-password.d.ts +16 -16
- package/dist/types/routes/auth-reset-password.d.ts +23 -23
- package/dist/types/routes/auth-signin.d.ts +24 -24
- package/dist/types/routes/auth-signout.d.ts +14 -14
- package/dist/types/routes/auth-signup.d.ts +32 -32
- package/dist/types/routes/auth-state.d.ts +13 -13
- package/dist/types/routes/auth-update.d.ts +33 -33
- package/dist/types/routes/auth-verify-email.d.ts +21 -21
- package/dist/types/routes/auth.d.ts +6 -6
- package/dist/types/routes/data-exists.d.ts +9 -9
- package/dist/types/routes/data-export.d.ts +10 -10
- package/dist/types/routes/data-get.d.ts +14 -14
- package/dist/types/routes/data-import.d.ts +13 -13
- package/dist/types/routes/data-index-create.d.ts +51 -51
- package/dist/types/routes/data-index-delete.d.ts +17 -17
- package/dist/types/routes/data-index-list.d.ts +21 -21
- package/dist/types/routes/data-query.d.ts +49 -49
- package/dist/types/routes/data-reflect.d.ts +29 -29
- package/dist/types/routes/data-schema-get.d.ts +11 -11
- package/dist/types/routes/data-schema-set.d.ts +20 -19
- package/dist/types/routes/data-schema-test.d.ts +19 -19
- package/dist/types/routes/data-schemas-list.d.ts +11 -11
- package/dist/types/routes/data-set.d.ts +27 -27
- package/dist/types/routes/data-sync-changes.d.ts +25 -28
- package/dist/types/routes/data-sync-mutations.d.ts +25 -28
- package/dist/types/routes/data-transaction.d.ts +34 -34
- package/dist/types/routes/data-update.d.ts +27 -27
- package/dist/types/routes/data.d.ts +3 -3
- package/dist/types/routes/docs.d.ts +3 -3
- package/dist/types/routes/meta-info.d.ts +11 -11
- package/dist/types/routes/meta-logs.d.ts +20 -20
- package/dist/types/routes/meta-ping.d.ts +7 -7
- package/dist/types/routes/meta-stats.d.ts +13 -13
- package/dist/types/routes/meta.d.ts +3 -3
- package/dist/types/routes/oauth2-init.d.ts +13 -13
- package/dist/types/routes/oauth2-refresh.d.ts +17 -17
- package/dist/types/routes/oauth2-signin.d.ts +15 -15
- package/dist/types/routes/webmanager.d.ts +3 -3
- package/dist/types/rules.d.ts +73 -34
- package/dist/types/sandbox.d.ts +3 -0
- package/dist/types/schema/user.d.ts +85 -85
- package/dist/types/server.d.ts +117 -111
- package/dist/types/settings/email.d.ts +14 -14
- package/dist/types/settings/index.d.ts +195 -187
- package/dist/types/shared/clients.d.ts +46 -46
- package/dist/types/shared/email.d.ts +34 -34
- package/dist/types/shared/env.d.ts +47 -44
- package/dist/types/shared/error.d.ts +15 -15
- package/dist/types/shared/http.d.ts +22 -21
- package/dist/types/shared/password.d.ts +19 -19
- package/dist/types/shared/rootpath.d.ts +2 -2
- package/dist/types/shared/signin.d.ts +31 -31
- package/dist/types/shared/simple-fetch.d.ts +21 -21
- package/dist/types/shared/tokens.d.ts +24 -24
- package/dist/types/shared/validate.d.ts +22 -22
- package/dist/types/start.d.ts +1 -1
- package/dist/types/test.d.ts +1 -1
- package/dist/types/websocket/index.d.ts +6 -6
- package/dist/types/websocket/manager.d.ts +99 -99
- package/dist/types/websocket/socket.io.d.ts +10 -10
- package/package.json +7 -4
- package/src/routes/data-schema-set.yaml +4 -0
- package/src/routes/data-set.yaml +5 -5
- package/src/routes/data-update.yaml +4 -4
|
@@ -1,188 +1,196 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { AceBaseStorageSettings } from 'acebase';
|
|
4
|
-
import { AceBaseServerEmailSettings } from './email';
|
|
5
|
-
import { Server } from 'http';
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
*
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
readonly
|
|
178
|
-
readonly
|
|
179
|
-
readonly
|
|
180
|
-
readonly
|
|
181
|
-
readonly
|
|
182
|
-
readonly
|
|
183
|
-
readonly
|
|
184
|
-
readonly
|
|
185
|
-
readonly
|
|
186
|
-
|
|
187
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { AceBaseStorageSettings } from 'acebase';
|
|
4
|
+
import { AceBaseServerEmailSettings } from './email';
|
|
5
|
+
import { Server } from 'http';
|
|
6
|
+
import type { AceBaseServer } from '../server';
|
|
7
|
+
export type AceBaseServerHttpsSettings = {
|
|
8
|
+
enabled?: boolean;
|
|
9
|
+
keyPath?: string;
|
|
10
|
+
certPath?: string;
|
|
11
|
+
pfxPath?: string;
|
|
12
|
+
passphrase?: string;
|
|
13
|
+
} & ({
|
|
14
|
+
keyPath: string;
|
|
15
|
+
certPath: string;
|
|
16
|
+
} | {
|
|
17
|
+
pfxPath: string;
|
|
18
|
+
passphrase: string;
|
|
19
|
+
} | {});
|
|
20
|
+
export declare class AceBaseServerHttpsConfig {
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
key?: Buffer;
|
|
23
|
+
cert?: Buffer;
|
|
24
|
+
pfx?: Buffer;
|
|
25
|
+
passphrase?: string;
|
|
26
|
+
constructor(settings: AceBaseServerHttpsSettings);
|
|
27
|
+
}
|
|
28
|
+
export type AuthAccessDefault = 'deny' | 'allow' | 'auth';
|
|
29
|
+
export declare const AUTH_ACCESS_DEFAULT: {
|
|
30
|
+
[key: string]: AuthAccessDefault;
|
|
31
|
+
};
|
|
32
|
+
export declare class AceBaseServerAuthenticationSettings {
|
|
33
|
+
/**
|
|
34
|
+
* Whether to enable authorization. Without authorization the entire db can be read and written to by anyone (not recommended 🤷🏼♂️)
|
|
35
|
+
*/
|
|
36
|
+
readonly enabled: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Whether new users creation is allowed for anyone, or just the admin
|
|
39
|
+
*/
|
|
40
|
+
readonly allowUserSignup: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* How many new users can sign up per hour per IP address. not implemented yet
|
|
43
|
+
*/
|
|
44
|
+
readonly newUserRateLimit: number;
|
|
45
|
+
/**
|
|
46
|
+
* How many minutes before access tokens expire. 0 for no expiration. (not implemented yet)
|
|
47
|
+
*/
|
|
48
|
+
readonly tokensExpire: number;
|
|
49
|
+
/**
|
|
50
|
+
* When the server runs for the first time, what defaults to use to generate the rules.json file with. Options are: 'auth' (only authenticated access to db, default), 'deny' (deny access to anyone except admin user), 'allow' (allow access to anyone)
|
|
51
|
+
*/
|
|
52
|
+
readonly defaultAccessRule: AuthAccessDefault;
|
|
53
|
+
/**
|
|
54
|
+
* When the server runs for the first time, what password to use for the admin user. If not supplied, a generated password will be used and shown ONCE in the console output.
|
|
55
|
+
*/
|
|
56
|
+
readonly defaultAdminPassword?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Whether to use a separate database for auth and logging. 'v2' will store data in auth.db, which is NOT TESTED YET!
|
|
59
|
+
*/
|
|
60
|
+
readonly separateDb: boolean | 'v2';
|
|
61
|
+
constructor(settings: Partial<AceBaseServerAuthenticationSettings>);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* TODO: Use AceBaseTransactionLogSettings from acebase
|
|
65
|
+
*/
|
|
66
|
+
export declare class AceBaseServerTransactionSettings {
|
|
67
|
+
/**
|
|
68
|
+
* Whether to enable transaction logging
|
|
69
|
+
*/
|
|
70
|
+
log: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Max age in days to keep transactions in the log file
|
|
73
|
+
*/
|
|
74
|
+
maxAge: number;
|
|
75
|
+
/**
|
|
76
|
+
* Whether database write operations should not wait until transaction has been logged
|
|
77
|
+
*/
|
|
78
|
+
noWait: boolean;
|
|
79
|
+
constructor(settings: Partial<AceBaseServerTransactionSettings>);
|
|
80
|
+
}
|
|
81
|
+
export interface IPCClientSettings {
|
|
82
|
+
/**
|
|
83
|
+
* IPC Server host to connect to. Default is `"localhost"`
|
|
84
|
+
*/
|
|
85
|
+
host?: string;
|
|
86
|
+
/**
|
|
87
|
+
* IPC Server port number
|
|
88
|
+
*/
|
|
89
|
+
port: number;
|
|
90
|
+
/**
|
|
91
|
+
* Whether to use a secure connection to the server. Strongly recommended if `host` is not `"localhost"`. Default is `false`
|
|
92
|
+
*/
|
|
93
|
+
ssl?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Token used in the IPC Server configuration (optional). The server will refuse connections using the wrong token.
|
|
96
|
+
*/
|
|
97
|
+
token?: string;
|
|
98
|
+
/**
|
|
99
|
+
* Determines the role of this IPC client. Only 1 process can be assigned the 'master' role, all other processes must use the role 'worker'
|
|
100
|
+
*/
|
|
101
|
+
role: 'master' | 'worker';
|
|
102
|
+
}
|
|
103
|
+
export type AceBaseServerSettings = Partial<{
|
|
104
|
+
/**
|
|
105
|
+
* Level of messages logged to console
|
|
106
|
+
*/
|
|
107
|
+
logLevel: 'verbose' | 'log' | 'warn' | 'error';
|
|
108
|
+
/**
|
|
109
|
+
* ip or hostname to start the server on
|
|
110
|
+
*/
|
|
111
|
+
host: string;
|
|
112
|
+
/**
|
|
113
|
+
* port number the server will be listening
|
|
114
|
+
*/
|
|
115
|
+
port: number;
|
|
116
|
+
/**
|
|
117
|
+
* target directory path to store/open the database. Default is '.'
|
|
118
|
+
*/
|
|
119
|
+
path: string;
|
|
120
|
+
/**
|
|
121
|
+
* Whether to use secure sockets layer (ssl)
|
|
122
|
+
*/
|
|
123
|
+
https: AceBaseServerHttpsSettings;
|
|
124
|
+
/**
|
|
125
|
+
* Provide your own server for AceBase to use
|
|
126
|
+
*/
|
|
127
|
+
server: Server;
|
|
128
|
+
/**
|
|
129
|
+
* Root path for the AceBase routes
|
|
130
|
+
*/
|
|
131
|
+
rootPath: string;
|
|
132
|
+
/**
|
|
133
|
+
* settings that define if and how authentication is used
|
|
134
|
+
*/
|
|
135
|
+
authentication: Partial<AceBaseServerAuthenticationSettings>;
|
|
136
|
+
/**
|
|
137
|
+
* maximum size to allow for posted data, eg for updating nodes. Default is '10mb'
|
|
138
|
+
*/
|
|
139
|
+
maxPayloadSize: string;
|
|
140
|
+
/**
|
|
141
|
+
* Value to use for Access-Control-Allow-Origin CORS header. Default is '*'
|
|
142
|
+
*/
|
|
143
|
+
allowOrigin: string;
|
|
144
|
+
/**
|
|
145
|
+
* Email settings that enable AceBaseServer to send e-mails, eg for welcoming new users, to reset passwords, notify of new sign ins etc
|
|
146
|
+
*/
|
|
147
|
+
email: AceBaseServerEmailSettings;
|
|
148
|
+
/**
|
|
149
|
+
* Transaction logging settings. Warning: BETA stage, do NOT use in production yet
|
|
150
|
+
*/
|
|
151
|
+
transactions: Partial<AceBaseServerTransactionSettings>;
|
|
152
|
+
/**
|
|
153
|
+
* IPC settings for pm2 or cloud-based clusters. BETA stage, see https://github.com/appy-one/acebase-ipc-server
|
|
154
|
+
*/
|
|
155
|
+
ipc: IPCClientSettings | 'socket';
|
|
156
|
+
/**
|
|
157
|
+
* Allows overriding of default storage settings used by the database. ALPHA stage
|
|
158
|
+
*/
|
|
159
|
+
storage: AceBaseStorageSettings;
|
|
160
|
+
/**
|
|
161
|
+
* You can turn this on if you are a sponsor. See https://github.com/appy-one/acebase/discussions/100 for more info
|
|
162
|
+
*/
|
|
163
|
+
sponsor: boolean;
|
|
164
|
+
/**
|
|
165
|
+
* Whether to use colors in the console logs output
|
|
166
|
+
* @default true
|
|
167
|
+
*/
|
|
168
|
+
logColors: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Init callback that runs before the server adds 404 middleware and starts listening to incoming calls.
|
|
171
|
+
* Use this callback to extend the server with custom routes, add data validation rules, wait for external events, etc.
|
|
172
|
+
* @param server Instance of the `AceBaseServer`
|
|
173
|
+
*/
|
|
174
|
+
init?: (server: AceBaseServer) => Promise<void>;
|
|
175
|
+
}>;
|
|
176
|
+
export declare class AceBaseServerConfig {
|
|
177
|
+
readonly logLevel: 'verbose' | 'log' | 'warn' | 'error';
|
|
178
|
+
readonly host: string;
|
|
179
|
+
readonly port: number;
|
|
180
|
+
readonly path: string;
|
|
181
|
+
readonly maxPayloadSize: string;
|
|
182
|
+
readonly allowOrigin: string;
|
|
183
|
+
readonly https: AceBaseServerHttpsConfig;
|
|
184
|
+
readonly server?: Server;
|
|
185
|
+
readonly rootPath: string;
|
|
186
|
+
readonly auth: AceBaseServerAuthenticationSettings;
|
|
187
|
+
readonly email: AceBaseServerEmailSettings;
|
|
188
|
+
readonly transactions: AceBaseServerTransactionSettings;
|
|
189
|
+
readonly ipc: AceBaseServerSettings['ipc'];
|
|
190
|
+
readonly storage?: AceBaseStorageSettings;
|
|
191
|
+
readonly sponsor: boolean;
|
|
192
|
+
readonly logColors: boolean;
|
|
193
|
+
readonly init?: (server: AceBaseServer) => Promise<void>;
|
|
194
|
+
constructor(settings: AceBaseServerSettings);
|
|
195
|
+
}
|
|
188
196
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventSubscriptionCallback, Query, QueryOptions } from 'acebase-core';
|
|
3
|
-
import { DbUserAccountDetails } from '../schema/user';
|
|
4
|
-
import { HttpSocket } from './http';
|
|
5
|
-
export declare class ConnectedClient {
|
|
6
|
-
socket: HttpSocket;
|
|
7
|
-
readonly id: string;
|
|
8
|
-
/**
|
|
9
|
-
*
|
|
10
|
-
* @param socket Socket object used by the framework
|
|
11
|
-
* @param id optional: use if the socket object does not have an `id` property.
|
|
12
|
-
*/
|
|
13
|
-
constructor(socket: HttpSocket, id?: string);
|
|
14
|
-
readonly connectedDate: Date;
|
|
15
|
-
/** user details if this socket client is signed in */
|
|
16
|
-
user?: DbUserAccountDetails;
|
|
17
|
-
/** Active event subscriptions for this client */
|
|
18
|
-
subscriptions: {
|
|
19
|
-
[path: string]: Array<{
|
|
20
|
-
path: string;
|
|
21
|
-
event: string;
|
|
22
|
-
callback: EventSubscriptionCallback;
|
|
23
|
-
}>;
|
|
24
|
-
};
|
|
25
|
-
/** Active realtime query subscriptions for this client */
|
|
26
|
-
realtimeQueries: {
|
|
27
|
-
[id: string]: {
|
|
28
|
-
path: string;
|
|
29
|
-
query: Query;
|
|
30
|
-
options: QueryOptions;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
/** Currently running transactions */
|
|
34
|
-
transactions: {
|
|
35
|
-
[id: string]: {
|
|
36
|
-
id: string;
|
|
37
|
-
started: number;
|
|
38
|
-
path: string;
|
|
39
|
-
context: any;
|
|
40
|
-
finish?: (val?: any) => Promise<{
|
|
41
|
-
cursor?: string;
|
|
42
|
-
}>;
|
|
43
|
-
timeout: NodeJS.Timeout;
|
|
44
|
-
};
|
|
45
|
-
};
|
|
46
|
-
}
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { EventSubscriptionCallback, Query, QueryOptions } from 'acebase-core';
|
|
3
|
+
import { DbUserAccountDetails } from '../schema/user';
|
|
4
|
+
import { HttpSocket } from './http';
|
|
5
|
+
export declare class ConnectedClient {
|
|
6
|
+
socket: HttpSocket;
|
|
7
|
+
readonly id: string;
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @param socket Socket object used by the framework
|
|
11
|
+
* @param id optional: use if the socket object does not have an `id` property.
|
|
12
|
+
*/
|
|
13
|
+
constructor(socket: HttpSocket, id?: string);
|
|
14
|
+
readonly connectedDate: Date;
|
|
15
|
+
/** user details if this socket client is signed in */
|
|
16
|
+
user?: DbUserAccountDetails;
|
|
17
|
+
/** Active event subscriptions for this client */
|
|
18
|
+
subscriptions: {
|
|
19
|
+
[path: string]: Array<{
|
|
20
|
+
path: string;
|
|
21
|
+
event: string;
|
|
22
|
+
callback: EventSubscriptionCallback;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
/** Active realtime query subscriptions for this client */
|
|
26
|
+
realtimeQueries: {
|
|
27
|
+
[id: string]: {
|
|
28
|
+
path: string;
|
|
29
|
+
query: Query;
|
|
30
|
+
options: QueryOptions;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/** Currently running transactions */
|
|
34
|
+
transactions: {
|
|
35
|
+
[id: string]: {
|
|
36
|
+
id: string;
|
|
37
|
+
started: number;
|
|
38
|
+
path: string;
|
|
39
|
+
context: any;
|
|
40
|
+
finish?: (val?: any) => Promise<{
|
|
41
|
+
cursor?: string;
|
|
42
|
+
}>;
|
|
43
|
+
timeout: NodeJS.Timeout;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
47
|
//# sourceMappingURL=clients.d.ts.map
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
export interface AceBaseEmailRequest {
|
|
2
|
-
/** email request type */
|
|
3
|
-
type: string;
|
|
4
|
-
}
|
|
5
|
-
export interface AceBaseUserEmailRequest extends AceBaseEmailRequest {
|
|
6
|
-
user: {
|
|
7
|
-
uid: string;
|
|
8
|
-
email: string;
|
|
9
|
-
username?: string;
|
|
10
|
-
displayName?: string;
|
|
11
|
-
settings?: any;
|
|
12
|
-
};
|
|
13
|
-
ip: string;
|
|
14
|
-
date: Date;
|
|
15
|
-
}
|
|
16
|
-
export interface AceBaseUserSignupEmailRequest extends AceBaseUserEmailRequest {
|
|
17
|
-
type: 'user_signup';
|
|
18
|
-
activationCode: string;
|
|
19
|
-
emailVerified: boolean;
|
|
20
|
-
provider: string;
|
|
21
|
-
}
|
|
22
|
-
export interface AceBaseUserSignInEmailRequest extends AceBaseUserEmailRequest {
|
|
23
|
-
type: 'user_signin';
|
|
24
|
-
activationCode: string;
|
|
25
|
-
emailVerified: boolean;
|
|
26
|
-
provider: string;
|
|
27
|
-
}
|
|
28
|
-
export interface AceBaseUserResetPasswordEmailRequest extends AceBaseUserEmailRequest {
|
|
29
|
-
type: 'user_reset_password';
|
|
30
|
-
resetCode: string;
|
|
31
|
-
}
|
|
32
|
-
export interface AceBaseUserResetPasswordSuccessEmailRequest extends AceBaseUserEmailRequest {
|
|
33
|
-
type: 'user_reset_password_success';
|
|
34
|
-
}
|
|
1
|
+
export interface AceBaseEmailRequest {
|
|
2
|
+
/** email request type */
|
|
3
|
+
type: string;
|
|
4
|
+
}
|
|
5
|
+
export interface AceBaseUserEmailRequest extends AceBaseEmailRequest {
|
|
6
|
+
user: {
|
|
7
|
+
uid: string;
|
|
8
|
+
email: string;
|
|
9
|
+
username?: string;
|
|
10
|
+
displayName?: string;
|
|
11
|
+
settings?: any;
|
|
12
|
+
};
|
|
13
|
+
ip: string;
|
|
14
|
+
date: Date;
|
|
15
|
+
}
|
|
16
|
+
export interface AceBaseUserSignupEmailRequest extends AceBaseUserEmailRequest {
|
|
17
|
+
type: 'user_signup';
|
|
18
|
+
activationCode: string;
|
|
19
|
+
emailVerified: boolean;
|
|
20
|
+
provider: string;
|
|
21
|
+
}
|
|
22
|
+
export interface AceBaseUserSignInEmailRequest extends AceBaseUserEmailRequest {
|
|
23
|
+
type: 'user_signin';
|
|
24
|
+
activationCode: string;
|
|
25
|
+
emailVerified: boolean;
|
|
26
|
+
provider: string;
|
|
27
|
+
}
|
|
28
|
+
export interface AceBaseUserResetPasswordEmailRequest extends AceBaseUserEmailRequest {
|
|
29
|
+
type: 'user_reset_password';
|
|
30
|
+
resetCode: string;
|
|
31
|
+
}
|
|
32
|
+
export interface AceBaseUserResetPasswordSuccessEmailRequest extends AceBaseUserEmailRequest {
|
|
33
|
+
type: 'user_reset_password_success';
|
|
34
|
+
}
|
|
35
35
|
//# sourceMappingURL=email.d.ts.map
|
|
@@ -1,45 +1,48 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
/// <reference types="express" />
|
|
4
|
-
import type { HttpApp, Request } from './http';
|
|
5
|
-
import type { AceBase, DataReference } from 'acebase';
|
|
6
|
-
import type { AceBaseServerConfig } from '../settings';
|
|
7
|
-
import type { DbUserAccountDetails } from '../schema/user';
|
|
8
|
-
import type { ConnectedClient } from './clients';
|
|
9
|
-
import type { DebugLogger, SimpleCache, Api } from 'acebase-core';
|
|
10
|
-
import type { OAuth2Provider } from '../oauth-providers/oauth-provider';
|
|
11
|
-
import type { Server as HttpServer } from 'http';
|
|
12
|
-
import type { Server as SecureHttpServer } from 'https';
|
|
13
|
-
import type { PathBasedRules } from '../rules';
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
/// <reference types="express" />
|
|
4
|
+
import type { HttpApp, HttpRouter, Request } from './http';
|
|
5
|
+
import type { AceBase, DataReference } from 'acebase';
|
|
6
|
+
import type { AceBaseServerConfig } from '../settings';
|
|
7
|
+
import type { DbUserAccountDetails } from '../schema/user';
|
|
8
|
+
import type { ConnectedClient } from './clients';
|
|
9
|
+
import type { DebugLogger, SimpleCache, Api } from 'acebase-core';
|
|
10
|
+
import type { OAuth2Provider } from '../oauth-providers/oauth-provider';
|
|
11
|
+
import type { Server as HttpServer } from 'http';
|
|
12
|
+
import type { Server as SecureHttpServer } from 'https';
|
|
13
|
+
import type { PathBasedRules } from '../rules';
|
|
14
|
+
import type { AceBaseServer } from '../server';
|
|
15
|
+
import { DatabaseLog } from '../logger';
|
|
16
|
+
export interface RouteInitEnvironment {
|
|
17
|
+
rootPath: string;
|
|
18
|
+
server: HttpServer | SecureHttpServer;
|
|
19
|
+
app: HttpApp;
|
|
20
|
+
router: HttpRouter;
|
|
21
|
+
config: AceBaseServerConfig;
|
|
22
|
+
db: AceBase & {
|
|
23
|
+
api: Api;
|
|
24
|
+
};
|
|
25
|
+
authDb: AceBase;
|
|
26
|
+
debug: DebugLogger;
|
|
27
|
+
securityRef: DataReference;
|
|
28
|
+
authRef: DataReference;
|
|
29
|
+
log: DatabaseLog;
|
|
30
|
+
tokenSalt: string;
|
|
31
|
+
clients: Map<string, ConnectedClient>;
|
|
32
|
+
authCache: SimpleCache<string, DbUserAccountDetails>;
|
|
33
|
+
authProviders: {
|
|
34
|
+
[providerName: string]: OAuth2Provider;
|
|
35
|
+
};
|
|
36
|
+
rules: PathBasedRules;
|
|
37
|
+
instance: AceBaseServer;
|
|
38
|
+
}
|
|
39
|
+
export interface RouteRequestEnvironment {
|
|
40
|
+
/** If the request has an Authentication: bearer token, the user will be bound to the incoming request */
|
|
41
|
+
user?: DbUserAccountDetails;
|
|
42
|
+
/** If context is sent through AceBase-Context header, it will be bound to the incoming request */
|
|
43
|
+
context: {
|
|
44
|
+
[key: string]: any;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
export type RouteRequest<ReqQuery = any, ReqBody = any, ResBody = any> = Request<any, ResBody, ReqBody, ReqQuery> & RouteRequestEnvironment;
|
|
45
48
|
//# sourceMappingURL=env.d.ts.map
|