mikroserve 0.0.1
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/LICENSE +7 -0
- package/README.md +3 -0
- package/lib/MikroServe.d.mts +106 -0
- package/lib/MikroServe.d.ts +106 -0
- package/lib/MikroServe.js +621 -0
- package/lib/MikroServe.mjs +8 -0
- package/lib/RateLimiter.d.mts +16 -0
- package/lib/RateLimiter.d.ts +16 -0
- package/lib/RateLimiter.js +73 -0
- package/lib/RateLimiter.mjs +6 -0
- package/lib/Router.d.mts +64 -0
- package/lib/Router.d.ts +64 -0
- package/lib/Router.js +224 -0
- package/lib/Router.mjs +6 -0
- package/lib/chunk-GGGGATKH.mjs +349 -0
- package/lib/chunk-KJT4SET2.mjs +200 -0
- package/lib/chunk-ZFBBESGU.mjs +49 -0
- package/lib/index.d.mts +4 -0
- package/lib/index.d.ts +4 -0
- package/lib/index.js +623 -0
- package/lib/index.mjs +8 -0
- package/lib/interfaces/index.d.mts +264 -0
- package/lib/interfaces/index.d.ts +264 -0
- package/lib/interfaces/index.js +18 -0
- package/lib/interfaces/index.mjs +0 -0
- package/package.json +58 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import http from 'node:http';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Storage interface for MikroAuth.
|
|
5
|
+
*/
|
|
6
|
+
interface StorageProvider {
|
|
7
|
+
set(key: string, value: string, expirySeconds?: number): Promise<void>;
|
|
8
|
+
get(key: string): Promise<string | null>;
|
|
9
|
+
delete(key: string): Promise<void>;
|
|
10
|
+
addToCollection(collectionKey: string, item: string, expirySeconds?: number): Promise<void>;
|
|
11
|
+
removeFromCollection(collectionKey: string, item: string): Promise<void>;
|
|
12
|
+
getCollection(collectionKey: string): Promise<string[]>;
|
|
13
|
+
getCollectionSize(collectionKey: string): Promise<number>;
|
|
14
|
+
removeOldestFromCollection(collectionKey: string): Promise<string | null>;
|
|
15
|
+
findKeys(pattern: string): Promise<string[]>;
|
|
16
|
+
}
|
|
17
|
+
interface EmailMessage {
|
|
18
|
+
from: string;
|
|
19
|
+
to: string;
|
|
20
|
+
subject: string;
|
|
21
|
+
text: string;
|
|
22
|
+
html: string;
|
|
23
|
+
}
|
|
24
|
+
interface EmailProvider {
|
|
25
|
+
sendMail(message: EmailMessage): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
interface JwtHeader {
|
|
28
|
+
alg: string;
|
|
29
|
+
typ: string;
|
|
30
|
+
}
|
|
31
|
+
interface JwtClaims {
|
|
32
|
+
iss?: string;
|
|
33
|
+
sub?: string;
|
|
34
|
+
aud?: string;
|
|
35
|
+
exp?: number;
|
|
36
|
+
nbf?: number;
|
|
37
|
+
iat?: number;
|
|
38
|
+
jti?: string;
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}
|
|
41
|
+
interface JwtSignOptions {
|
|
42
|
+
expiresIn?: number;
|
|
43
|
+
notBefore?: number;
|
|
44
|
+
issuer?: string;
|
|
45
|
+
audience?: string;
|
|
46
|
+
subject?: string;
|
|
47
|
+
jwtid?: string;
|
|
48
|
+
}
|
|
49
|
+
interface JwtVerifyOptions {
|
|
50
|
+
issuer?: string;
|
|
51
|
+
audience?: string;
|
|
52
|
+
subject?: string;
|
|
53
|
+
clockTolerance?: number;
|
|
54
|
+
}
|
|
55
|
+
interface DecodedJwt {
|
|
56
|
+
header: JwtHeader;
|
|
57
|
+
payload: JwtClaims;
|
|
58
|
+
signature: string;
|
|
59
|
+
}
|
|
60
|
+
interface JwtPayload {
|
|
61
|
+
sub: string;
|
|
62
|
+
jti: string;
|
|
63
|
+
iat?: number;
|
|
64
|
+
exp?: number;
|
|
65
|
+
lastLogin: number;
|
|
66
|
+
metadata?: {
|
|
67
|
+
ip?: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* JWT payload structure
|
|
72
|
+
*/
|
|
73
|
+
interface JwtPayload {
|
|
74
|
+
sub: string;
|
|
75
|
+
jti: string;
|
|
76
|
+
iat?: number;
|
|
77
|
+
exp?: number;
|
|
78
|
+
lastLogin: number;
|
|
79
|
+
metadata?: {
|
|
80
|
+
ip?: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
interface RequestContext {
|
|
84
|
+
body?: Record<string, any>;
|
|
85
|
+
query?: Record<string, any>;
|
|
86
|
+
headers?: Record<string, any>;
|
|
87
|
+
ip?: string;
|
|
88
|
+
log?: {
|
|
89
|
+
error: (message: string, error: Error) => void;
|
|
90
|
+
info?: (message: string, ...args: any[]) => void;
|
|
91
|
+
};
|
|
92
|
+
user?: {
|
|
93
|
+
email: string;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Request context interface
|
|
98
|
+
*/
|
|
99
|
+
interface RequestContext {
|
|
100
|
+
body?: Record<string, any>;
|
|
101
|
+
query?: Record<string, any>;
|
|
102
|
+
headers?: Record<string, any>;
|
|
103
|
+
ip?: string;
|
|
104
|
+
log?: {
|
|
105
|
+
error: (message: string, error: Error) => void;
|
|
106
|
+
info?: (message: string, ...args: any[]) => void;
|
|
107
|
+
};
|
|
108
|
+
user?: {
|
|
109
|
+
email: string;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
interface MagicLinkRequest {
|
|
113
|
+
email: string;
|
|
114
|
+
ip?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Magic link request parameters
|
|
118
|
+
*/
|
|
119
|
+
interface MagicLinkRequest {
|
|
120
|
+
email: string;
|
|
121
|
+
ip?: string;
|
|
122
|
+
}
|
|
123
|
+
interface MagicLinkUrlParams {
|
|
124
|
+
token: string;
|
|
125
|
+
email: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Parameters for creating a magic link URL
|
|
129
|
+
*/
|
|
130
|
+
interface MagicLinkUrlParams {
|
|
131
|
+
token: string;
|
|
132
|
+
email: string;
|
|
133
|
+
}
|
|
134
|
+
interface VerifyTokenRequest {
|
|
135
|
+
token: string;
|
|
136
|
+
email: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Verify token request parameters
|
|
140
|
+
*/
|
|
141
|
+
interface VerifyTokenRequest {
|
|
142
|
+
token: string;
|
|
143
|
+
email: string;
|
|
144
|
+
}
|
|
145
|
+
interface SessionInfo {
|
|
146
|
+
id: string;
|
|
147
|
+
createdAt: number;
|
|
148
|
+
lastLogin: number;
|
|
149
|
+
lastUsed?: number;
|
|
150
|
+
metadata?: {
|
|
151
|
+
ip?: string;
|
|
152
|
+
};
|
|
153
|
+
isCurrentSession?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Session information interface
|
|
157
|
+
*/
|
|
158
|
+
interface SessionInfo {
|
|
159
|
+
id: string;
|
|
160
|
+
createdAt: number;
|
|
161
|
+
lastLogin: number;
|
|
162
|
+
lastUsed?: number;
|
|
163
|
+
metadata?: {
|
|
164
|
+
ip?: string;
|
|
165
|
+
};
|
|
166
|
+
isCurrentSession?: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface TokenResponse {
|
|
169
|
+
accessToken: string;
|
|
170
|
+
refreshToken: string;
|
|
171
|
+
expiresIn: number;
|
|
172
|
+
tokenType: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Token response interface
|
|
176
|
+
*/
|
|
177
|
+
interface TokenResponse {
|
|
178
|
+
accessToken: string;
|
|
179
|
+
refreshToken: string;
|
|
180
|
+
expiresIn: number;
|
|
181
|
+
tokenType: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Options when configuring any providers.
|
|
185
|
+
*/
|
|
186
|
+
type ProviderConfiguration = {
|
|
187
|
+
[providerType: string]: Record<string, any>;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Response utilities for handlers
|
|
191
|
+
*/
|
|
192
|
+
interface ResponseHelpers {
|
|
193
|
+
text(content: string, status?: number): HandlerResponse;
|
|
194
|
+
json(data: any, status?: number): HandlerResponse;
|
|
195
|
+
html(content: string, status?: number): HandlerResponse;
|
|
196
|
+
form(content: any, status?: number): HandlerResponse;
|
|
197
|
+
redirect(url: string, status?: 301 | 302 | 307 | 308): HandlerResponse;
|
|
198
|
+
status(code: number): ResponseHelpers;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Context object passed to route handlers
|
|
202
|
+
*/
|
|
203
|
+
interface Context extends ResponseHelpers {
|
|
204
|
+
req: http.IncomingMessage;
|
|
205
|
+
res: http.ServerResponse;
|
|
206
|
+
params: Record<string, string>;
|
|
207
|
+
query: Record<string, string>;
|
|
208
|
+
body: any;
|
|
209
|
+
headers: http.IncomingHttpHeaders;
|
|
210
|
+
path: string;
|
|
211
|
+
state: Record<string, any>;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Handler response object
|
|
215
|
+
*/
|
|
216
|
+
interface HandlerResponse {
|
|
217
|
+
statusCode: number;
|
|
218
|
+
body: any;
|
|
219
|
+
headers?: Record<string, string>;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Route handler function signature
|
|
223
|
+
*/
|
|
224
|
+
type RouteHandler = (context: Context) => Promise<HandlerResponse> | HandlerResponse;
|
|
225
|
+
/**
|
|
226
|
+
* Middleware function signature
|
|
227
|
+
*/
|
|
228
|
+
type Middleware = (context: Context, next: () => Promise<HandlerResponse>) => Promise<HandlerResponse> | HandlerResponse;
|
|
229
|
+
/**
|
|
230
|
+
* Route definition
|
|
231
|
+
*/
|
|
232
|
+
interface Route {
|
|
233
|
+
method: string;
|
|
234
|
+
path: string;
|
|
235
|
+
handler: RouteHandler;
|
|
236
|
+
middlewares: Middleware[];
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Path pattern parameter extraction
|
|
240
|
+
*/
|
|
241
|
+
interface PathPattern {
|
|
242
|
+
pattern: RegExp;
|
|
243
|
+
paramNames: string[];
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Server configuration options
|
|
247
|
+
*/
|
|
248
|
+
interface MikroServeConfiguration {
|
|
249
|
+
port?: number;
|
|
250
|
+
host?: string;
|
|
251
|
+
useHttps?: boolean;
|
|
252
|
+
sslCert?: string;
|
|
253
|
+
sslKey?: string;
|
|
254
|
+
sslCa?: string;
|
|
255
|
+
debug?: boolean;
|
|
256
|
+
encryptionKey?: string;
|
|
257
|
+
rateLimit?: {
|
|
258
|
+
requestsPerMinute: number;
|
|
259
|
+
enabled: boolean;
|
|
260
|
+
};
|
|
261
|
+
allowedDomains?: string[];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export type { Context, DecodedJwt, EmailMessage, EmailProvider, HandlerResponse, JwtClaims, JwtHeader, JwtPayload, JwtSignOptions, JwtVerifyOptions, MagicLinkRequest, MagicLinkUrlParams, Middleware, MikroServeConfiguration, PathPattern, ProviderConfiguration, RequestContext, ResponseHelpers, Route, RouteHandler, SessionInfo, StorageProvider, TokenResponse, VerifyTokenRequest };
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import http from 'node:http';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description Storage interface for MikroAuth.
|
|
5
|
+
*/
|
|
6
|
+
interface StorageProvider {
|
|
7
|
+
set(key: string, value: string, expirySeconds?: number): Promise<void>;
|
|
8
|
+
get(key: string): Promise<string | null>;
|
|
9
|
+
delete(key: string): Promise<void>;
|
|
10
|
+
addToCollection(collectionKey: string, item: string, expirySeconds?: number): Promise<void>;
|
|
11
|
+
removeFromCollection(collectionKey: string, item: string): Promise<void>;
|
|
12
|
+
getCollection(collectionKey: string): Promise<string[]>;
|
|
13
|
+
getCollectionSize(collectionKey: string): Promise<number>;
|
|
14
|
+
removeOldestFromCollection(collectionKey: string): Promise<string | null>;
|
|
15
|
+
findKeys(pattern: string): Promise<string[]>;
|
|
16
|
+
}
|
|
17
|
+
interface EmailMessage {
|
|
18
|
+
from: string;
|
|
19
|
+
to: string;
|
|
20
|
+
subject: string;
|
|
21
|
+
text: string;
|
|
22
|
+
html: string;
|
|
23
|
+
}
|
|
24
|
+
interface EmailProvider {
|
|
25
|
+
sendMail(message: EmailMessage): Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
interface JwtHeader {
|
|
28
|
+
alg: string;
|
|
29
|
+
typ: string;
|
|
30
|
+
}
|
|
31
|
+
interface JwtClaims {
|
|
32
|
+
iss?: string;
|
|
33
|
+
sub?: string;
|
|
34
|
+
aud?: string;
|
|
35
|
+
exp?: number;
|
|
36
|
+
nbf?: number;
|
|
37
|
+
iat?: number;
|
|
38
|
+
jti?: string;
|
|
39
|
+
[key: string]: any;
|
|
40
|
+
}
|
|
41
|
+
interface JwtSignOptions {
|
|
42
|
+
expiresIn?: number;
|
|
43
|
+
notBefore?: number;
|
|
44
|
+
issuer?: string;
|
|
45
|
+
audience?: string;
|
|
46
|
+
subject?: string;
|
|
47
|
+
jwtid?: string;
|
|
48
|
+
}
|
|
49
|
+
interface JwtVerifyOptions {
|
|
50
|
+
issuer?: string;
|
|
51
|
+
audience?: string;
|
|
52
|
+
subject?: string;
|
|
53
|
+
clockTolerance?: number;
|
|
54
|
+
}
|
|
55
|
+
interface DecodedJwt {
|
|
56
|
+
header: JwtHeader;
|
|
57
|
+
payload: JwtClaims;
|
|
58
|
+
signature: string;
|
|
59
|
+
}
|
|
60
|
+
interface JwtPayload {
|
|
61
|
+
sub: string;
|
|
62
|
+
jti: string;
|
|
63
|
+
iat?: number;
|
|
64
|
+
exp?: number;
|
|
65
|
+
lastLogin: number;
|
|
66
|
+
metadata?: {
|
|
67
|
+
ip?: string;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* JWT payload structure
|
|
72
|
+
*/
|
|
73
|
+
interface JwtPayload {
|
|
74
|
+
sub: string;
|
|
75
|
+
jti: string;
|
|
76
|
+
iat?: number;
|
|
77
|
+
exp?: number;
|
|
78
|
+
lastLogin: number;
|
|
79
|
+
metadata?: {
|
|
80
|
+
ip?: string;
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
interface RequestContext {
|
|
84
|
+
body?: Record<string, any>;
|
|
85
|
+
query?: Record<string, any>;
|
|
86
|
+
headers?: Record<string, any>;
|
|
87
|
+
ip?: string;
|
|
88
|
+
log?: {
|
|
89
|
+
error: (message: string, error: Error) => void;
|
|
90
|
+
info?: (message: string, ...args: any[]) => void;
|
|
91
|
+
};
|
|
92
|
+
user?: {
|
|
93
|
+
email: string;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Request context interface
|
|
98
|
+
*/
|
|
99
|
+
interface RequestContext {
|
|
100
|
+
body?: Record<string, any>;
|
|
101
|
+
query?: Record<string, any>;
|
|
102
|
+
headers?: Record<string, any>;
|
|
103
|
+
ip?: string;
|
|
104
|
+
log?: {
|
|
105
|
+
error: (message: string, error: Error) => void;
|
|
106
|
+
info?: (message: string, ...args: any[]) => void;
|
|
107
|
+
};
|
|
108
|
+
user?: {
|
|
109
|
+
email: string;
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
interface MagicLinkRequest {
|
|
113
|
+
email: string;
|
|
114
|
+
ip?: string;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Magic link request parameters
|
|
118
|
+
*/
|
|
119
|
+
interface MagicLinkRequest {
|
|
120
|
+
email: string;
|
|
121
|
+
ip?: string;
|
|
122
|
+
}
|
|
123
|
+
interface MagicLinkUrlParams {
|
|
124
|
+
token: string;
|
|
125
|
+
email: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Parameters for creating a magic link URL
|
|
129
|
+
*/
|
|
130
|
+
interface MagicLinkUrlParams {
|
|
131
|
+
token: string;
|
|
132
|
+
email: string;
|
|
133
|
+
}
|
|
134
|
+
interface VerifyTokenRequest {
|
|
135
|
+
token: string;
|
|
136
|
+
email: string;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Verify token request parameters
|
|
140
|
+
*/
|
|
141
|
+
interface VerifyTokenRequest {
|
|
142
|
+
token: string;
|
|
143
|
+
email: string;
|
|
144
|
+
}
|
|
145
|
+
interface SessionInfo {
|
|
146
|
+
id: string;
|
|
147
|
+
createdAt: number;
|
|
148
|
+
lastLogin: number;
|
|
149
|
+
lastUsed?: number;
|
|
150
|
+
metadata?: {
|
|
151
|
+
ip?: string;
|
|
152
|
+
};
|
|
153
|
+
isCurrentSession?: boolean;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Session information interface
|
|
157
|
+
*/
|
|
158
|
+
interface SessionInfo {
|
|
159
|
+
id: string;
|
|
160
|
+
createdAt: number;
|
|
161
|
+
lastLogin: number;
|
|
162
|
+
lastUsed?: number;
|
|
163
|
+
metadata?: {
|
|
164
|
+
ip?: string;
|
|
165
|
+
};
|
|
166
|
+
isCurrentSession?: boolean;
|
|
167
|
+
}
|
|
168
|
+
interface TokenResponse {
|
|
169
|
+
accessToken: string;
|
|
170
|
+
refreshToken: string;
|
|
171
|
+
expiresIn: number;
|
|
172
|
+
tokenType: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Token response interface
|
|
176
|
+
*/
|
|
177
|
+
interface TokenResponse {
|
|
178
|
+
accessToken: string;
|
|
179
|
+
refreshToken: string;
|
|
180
|
+
expiresIn: number;
|
|
181
|
+
tokenType: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Options when configuring any providers.
|
|
185
|
+
*/
|
|
186
|
+
type ProviderConfiguration = {
|
|
187
|
+
[providerType: string]: Record<string, any>;
|
|
188
|
+
};
|
|
189
|
+
/**
|
|
190
|
+
* Response utilities for handlers
|
|
191
|
+
*/
|
|
192
|
+
interface ResponseHelpers {
|
|
193
|
+
text(content: string, status?: number): HandlerResponse;
|
|
194
|
+
json(data: any, status?: number): HandlerResponse;
|
|
195
|
+
html(content: string, status?: number): HandlerResponse;
|
|
196
|
+
form(content: any, status?: number): HandlerResponse;
|
|
197
|
+
redirect(url: string, status?: 301 | 302 | 307 | 308): HandlerResponse;
|
|
198
|
+
status(code: number): ResponseHelpers;
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Context object passed to route handlers
|
|
202
|
+
*/
|
|
203
|
+
interface Context extends ResponseHelpers {
|
|
204
|
+
req: http.IncomingMessage;
|
|
205
|
+
res: http.ServerResponse;
|
|
206
|
+
params: Record<string, string>;
|
|
207
|
+
query: Record<string, string>;
|
|
208
|
+
body: any;
|
|
209
|
+
headers: http.IncomingHttpHeaders;
|
|
210
|
+
path: string;
|
|
211
|
+
state: Record<string, any>;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* Handler response object
|
|
215
|
+
*/
|
|
216
|
+
interface HandlerResponse {
|
|
217
|
+
statusCode: number;
|
|
218
|
+
body: any;
|
|
219
|
+
headers?: Record<string, string>;
|
|
220
|
+
}
|
|
221
|
+
/**
|
|
222
|
+
* Route handler function signature
|
|
223
|
+
*/
|
|
224
|
+
type RouteHandler = (context: Context) => Promise<HandlerResponse> | HandlerResponse;
|
|
225
|
+
/**
|
|
226
|
+
* Middleware function signature
|
|
227
|
+
*/
|
|
228
|
+
type Middleware = (context: Context, next: () => Promise<HandlerResponse>) => Promise<HandlerResponse> | HandlerResponse;
|
|
229
|
+
/**
|
|
230
|
+
* Route definition
|
|
231
|
+
*/
|
|
232
|
+
interface Route {
|
|
233
|
+
method: string;
|
|
234
|
+
path: string;
|
|
235
|
+
handler: RouteHandler;
|
|
236
|
+
middlewares: Middleware[];
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Path pattern parameter extraction
|
|
240
|
+
*/
|
|
241
|
+
interface PathPattern {
|
|
242
|
+
pattern: RegExp;
|
|
243
|
+
paramNames: string[];
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Server configuration options
|
|
247
|
+
*/
|
|
248
|
+
interface MikroServeConfiguration {
|
|
249
|
+
port?: number;
|
|
250
|
+
host?: string;
|
|
251
|
+
useHttps?: boolean;
|
|
252
|
+
sslCert?: string;
|
|
253
|
+
sslKey?: string;
|
|
254
|
+
sslCa?: string;
|
|
255
|
+
debug?: boolean;
|
|
256
|
+
encryptionKey?: string;
|
|
257
|
+
rateLimit?: {
|
|
258
|
+
requestsPerMinute: number;
|
|
259
|
+
enabled: boolean;
|
|
260
|
+
};
|
|
261
|
+
allowedDomains?: string[];
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
export type { Context, DecodedJwt, EmailMessage, EmailProvider, HandlerResponse, JwtClaims, JwtHeader, JwtPayload, JwtSignOptions, JwtVerifyOptions, MagicLinkRequest, MagicLinkUrlParams, Middleware, MikroServeConfiguration, PathPattern, ProviderConfiguration, RequestContext, ResponseHelpers, Route, RouteHandler, SessionInfo, StorageProvider, TokenResponse, VerifyTokenRequest };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
|
|
16
|
+
// src/interfaces/index.ts
|
|
17
|
+
var interfaces_exports = {};
|
|
18
|
+
module.exports = __toCommonJS(interfaces_exports);
|
|
File without changes
|
package/package.json
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mikroserve",
|
|
3
|
+
"description": "TODO",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"author": "Mikael Vesavuori",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"keywords": [],
|
|
8
|
+
"main": "lib/index.js",
|
|
9
|
+
"module": "lib/index.mjs",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/mikaelvesavuori/mikroserve"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/mikaelvesavuori/mikroserve/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/mikaelvesavuori/mikroserve",
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"require": "./lib/index.js",
|
|
21
|
+
"import": "./lib/index.mjs"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"files": [
|
|
25
|
+
"/lib",
|
|
26
|
+
"!/lib/**/*.map",
|
|
27
|
+
"!/tests"
|
|
28
|
+
],
|
|
29
|
+
"bin": {
|
|
30
|
+
"mikroserve": "lib/index.js"
|
|
31
|
+
},
|
|
32
|
+
"scripts": {
|
|
33
|
+
"start": "npx tsx src/index.ts --force",
|
|
34
|
+
"test": "npm run test:licenses && npm run test:types && npm run lint && npm run test:unit",
|
|
35
|
+
"test:types": "npx type-coverage --at-least 85 --strict --ignore-files \"tests/**/*.ts\" --ignore-files \"*.ts\" --ignore-files \"src/application/errors/*.ts\" --ignore-files \"testdata/*.ts\"",
|
|
36
|
+
"test:licenses": "npx license-compliance --direct --allow 'MIT;ISC;0BSD;BSD-2-Clause;BSD-3-Clause;Apache-2.0;Unlicense;CC0-1.0'",
|
|
37
|
+
"test:unit": "npx vitest run --coverage",
|
|
38
|
+
"test:watch": "npx vitest --watch",
|
|
39
|
+
"build": "npm run clean && tsup src --format esm,cjs --dts && mv dist lib",
|
|
40
|
+
"clean": "rm -rf test-* && rm -rf mikroserve-demo && rm -rf lib",
|
|
41
|
+
"lint": "npx @biomejs/biome check --write ./src ./tests",
|
|
42
|
+
"package": "npm pack",
|
|
43
|
+
"prepublishOnly": "npm run build",
|
|
44
|
+
"prepare": "husky"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@biomejs/biome": "1",
|
|
48
|
+
"@types/node": "latest",
|
|
49
|
+
"@vitest/coverage-v8": "2",
|
|
50
|
+
"husky": "9",
|
|
51
|
+
"license-compliance": "latest",
|
|
52
|
+
"tsup": "8",
|
|
53
|
+
"tsx": "latest",
|
|
54
|
+
"type-coverage": "2",
|
|
55
|
+
"typescript": "5",
|
|
56
|
+
"vitest": "2"
|
|
57
|
+
}
|
|
58
|
+
}
|