@server/next 0.40.4 → 0.42.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 (4) hide show
  1. package/index.d.ts +150 -103
  2. package/index.js +433 -284
  3. package/package.json +15 -16
  4. package/readme.md +6 -5
package/index.d.ts CHANGED
@@ -41,10 +41,14 @@ declare const redirect: (...args: Params<"redirect">) => Response;
41
41
 
42
42
  type Reply = ReturnType<typeof status>;
43
43
  type Method = "get" | "post" | "put" | "patch" | "delete" | "head" | "options" | "socket";
44
- type ServerConfig<Session = {}, User = {}> = {
45
- Session?: Session;
46
- User?: User;
44
+ type ContextTypes = {
45
+ session?: any;
46
+ user?: any;
47
+ params?: any;
48
+ query?: any;
49
+ body?: any;
47
50
  };
51
+ type Field<C, K extends keyof ContextTypes, Fallback> = K extends keyof C ? SchemaOutput<C[K], C[K]> : Fallback;
48
52
  declare namespace JSX {
49
53
  interface Element {
50
54
  type: any;
@@ -55,16 +59,49 @@ declare namespace JSX {
55
59
  }
56
60
  }
57
61
  type BodyMode = "parse" | "raw" | "stream";
58
- type BodyOption = BodyMode | {
59
- mode?: BodyMode;
60
- max?: number | string | false;
62
+ type StandardIssue = {
63
+ readonly message: string;
64
+ readonly path?: readonly (PropertyKey | {
65
+ readonly key: PropertyKey;
66
+ })[];
61
67
  };
68
+ interface StandardSchemaV1<Input = unknown, Output = Input> {
69
+ readonly "~standard": {
70
+ readonly version: 1;
71
+ readonly vendor: string;
72
+ readonly validate: (value: unknown) => {
73
+ value: Output;
74
+ issues?: undefined;
75
+ } | {
76
+ issues: readonly StandardIssue[];
77
+ } | Promise<{
78
+ value: Output;
79
+ issues?: undefined;
80
+ } | {
81
+ issues: readonly StandardIssue[];
82
+ }>;
83
+ readonly types?: {
84
+ readonly input: Input;
85
+ readonly output: Output;
86
+ };
87
+ };
88
+ }
89
+ type SchemaOutput<S, Fallback> = [S] extends [
90
+ StandardSchemaV1<any, infer Output>
91
+ ] ? Output : Fallback;
62
92
  type CacheOption = string | number | false;
63
- type RouteOptions = {
93
+ type RouteSchema = {
64
94
  tags?: string | string[];
65
95
  title?: string;
66
96
  description?: string;
67
- body?: BodyOption;
97
+ };
98
+ type RouteOptions = {
99
+ schema?: RouteSchema;
100
+ parser?: BodyMode;
101
+ body?: StandardSchemaV1<any, any>;
102
+ query?: StandardSchemaV1<any, any>;
103
+ params?: StandardSchemaV1<any, any>;
104
+ response?: StandardSchemaV1<any, any>;
68
105
  cache?: CacheOption;
69
106
  };
70
107
  type Route = {
@@ -145,10 +182,9 @@ type KVStore = {
145
182
  type Provider = "email" | "github" | "google" | "microsoft" | "discord" | "facebook" | "apple";
146
183
  type Strategy = "cookie" | "jwt" | "token";
147
184
  type AuthSession = {
148
- id: string;
149
- provider: Provider;
150
- strategy: Strategy;
151
185
  user: string;
186
+ provider: Provider;
187
+ created: string;
152
188
  };
153
189
  type AuthUser<T = Record<string, any>> = T & {
154
190
  id: string | number;
@@ -163,22 +199,22 @@ type ProfileUser = {
163
199
  type AuthOption = `${Strategy}:${Provider}` | {
164
200
  strategy: Strategy;
165
201
  providers?: Provider | Provider[];
166
- session?: StoreSource;
167
- store?: StoreSource;
202
+ users?: StoreSource;
168
203
  redirect?: string;
169
204
  onProfile?: (raw: any, provider: Provider) => ProfileUser | Promise<ProfileUser>;
170
205
  onLogin?: (loginUser: AuthUser, existingUser: AuthUser | null, ctx: Context) => ProfileUser | Promise<ProfileUser>;
171
206
  onUser?: <T = AuthUser>(user: T, ctx: Context) => T | Promise<T>;
207
+ onToken?: (user: AuthUser, ctx: Context) => ProfileUser | Promise<ProfileUser>;
172
208
  onLogout?: (ctx: Context) => unknown;
173
209
  };
174
210
  type AuthSettings = {
175
211
  providers: Provider[];
176
212
  strategy: Strategy;
177
- store: KVStore;
178
- session: KVStore;
213
+ users: KVStore;
179
214
  onProfile?: (raw: any, provider: Provider) => ProfileUser | Promise<ProfileUser>;
180
215
  onLogin?: (loginUser: AuthUser, existingUser: AuthUser | null, ctx: Context) => ProfileUser | Promise<ProfileUser>;
181
216
  onUser: <T = AuthUser>(user: T, ctx: Context) => T | Promise<T>;
217
+ onToken: (user: AuthUser, ctx: Context) => ProfileUser | Promise<ProfileUser>;
182
218
  onLogout?: (ctx: Context) => unknown;
183
219
  redirect: string;
184
220
  };
@@ -197,6 +233,7 @@ type SecurityOptions = {
197
233
  hsts?: boolean | string;
198
234
  xssProtection?: boolean;
199
235
  traversalProtection?: boolean;
236
+ maxBody?: number | string | false;
200
237
  csp?: boolean | string;
201
238
  coop?: boolean | string;
202
239
  corp?: boolean | string;
@@ -205,6 +242,7 @@ type SecurityOptions = {
205
242
  type SecuritySettings = {
206
243
  trustProxy: boolean;
207
244
  traversalProtection: boolean;
245
+ maxBody: number;
208
246
  headers: Record<string, string>;
209
247
  hsts: string | null;
210
248
  };
@@ -215,10 +253,7 @@ type Options = {
215
253
  secret?: string;
216
254
  public?: string | Bucket;
217
255
  uploads?: string | Bucket | UploadOptions;
218
- store?: StoreSource;
219
- session?: StoreSource | {
220
- store: StoreSource;
221
- };
256
+ sessions?: StoreSource;
222
257
  cors?: CorsOptions;
223
258
  auth?: AuthOption;
224
259
  openapi?: any;
@@ -227,7 +262,7 @@ type Options = {
227
262
  log?: LogLevel | boolean;
228
263
  favicon?: string | BucketFile;
229
264
  security?: boolean | SecurityOptions;
230
- body?: BodyOption;
265
+ parser?: BodyMode;
231
266
  cache?: CacheOption;
232
267
  };
233
268
  type Settings = {
@@ -237,10 +272,8 @@ type Settings = {
237
272
  uploads?: ({
238
273
  bucket: Bucket;
239
274
  } & LimitOptions) | null;
240
- store?: KVStore;
241
- session?: {
242
- store: KVStore;
243
- };
275
+ sessions: KVStore;
276
+ sessionsDefault?: boolean;
244
277
  cors?: CorsSettings;
245
278
  auth?: AuthSettings;
246
279
  openapi?: any;
@@ -249,7 +282,7 @@ type Settings = {
249
282
  log: Logger;
250
283
  favicon?: string | BucketFile;
251
284
  security: SecuritySettings;
252
- body: BodyOption;
285
+ parser: BodyMode;
253
286
  cache?: CacheOption;
254
287
  };
255
288
  type Time = {
@@ -280,27 +313,23 @@ type BunEnv = Record<string, string> & {
280
313
  };
281
314
  interface ContextExtension {
282
315
  }
283
- type Context<Params extends Record<string, string | undefined> = Record<string, string>, O extends ServerConfig = object> = {
316
+ type Context<C extends ContextTypes = {}> = {
284
317
  method: Method;
285
318
  ip: string;
286
319
  headers: Record<string, string | string[]>;
287
320
  cookies: Record<string, string>;
288
- body?: SerializableValue | Buffer | ReadableStream;
321
+ body?: Field<C, "body", SerializableValue | Buffer | ReadableStream>;
289
322
  url: URL & {
290
- params: Params;
291
- query: Record<string, string>;
323
+ params: Field<C, "params", Record<string, any>>;
324
+ query: Field<C, "query", Record<string, any>>;
292
325
  };
293
326
  options: Settings;
294
327
  platform: Platform;
295
328
  time?: Time;
296
329
  socket?: WebSocket;
297
330
  sockets?: WebSocket[];
298
- session: O extends {
299
- Session?: infer S;
300
- } ? S extends Record<"Session", infer Inner> ? Inner : Record<string, any> : Record<string, any>;
301
- user?: O extends {
302
- User?: infer U;
303
- } ? U extends Record<"User", infer Inner> ? Inner : AuthUser : AuthUser;
331
+ session: Field<C, "session", Record<string, any>>;
332
+ user?: Field<C, "user", Record<string, any>>;
304
333
  init: number;
305
334
  req?: Request;
306
335
  res?: Response & {
@@ -313,7 +342,7 @@ type InlineReply = Response | Reply | BucketFile | {
313
342
  headers?: Headers;
314
343
  } | SerializableValue | JSX.Element | Buffer | ReadableStream;
315
344
  type Body = InlineReply;
316
- type Middleware<O extends ServerConfig = object, Params extends Record<string, string | undefined> = Record<string, string>> = (ctx: Context<Params, O>) => InlineReply | Promise<InlineReply> | void | Promise<void>;
345
+ type Middleware<C extends ContextTypes = {}> = (ctx: Context<C>) => InlineReply | Promise<InlineReply> | void | Promise<void>;
317
346
 
318
347
  type Variables = Record<string, string | string[]>;
319
348
  type ExtendError = string | {
@@ -336,50 +365,68 @@ declare global {
336
365
  var env: Record<string, any>;
337
366
  }
338
367
 
339
- type Mids<O extends ServerConfig, Path extends string> = Middleware<O, PathToParams<Path>>[];
340
- declare class Router<O extends ServerConfig = object> {
368
+ type Fn<C extends ContextTypes> = (ctx: Context<C>) => ReturnType<Middleware>;
369
+ type RouteCtx<C extends ContextTypes, RO extends RouteOptions, Params> = Omit<C, "params" | "query" | "body"> & {
370
+ params: [RO["params"]] extends [StandardSchemaV1<any, any>] ? RO["params"] : Params;
371
+ } & Pick<RO, keyof RO & ("query" | "body")>;
372
+ type Mids<C extends ContextTypes, Path extends string, RO extends RouteOptions = {}> = Fn<RouteCtx<C, RO, PathToParams<Path>>>[];
373
+ type Exact<RO> = RouteOptions & {
374
+ [K in Exclude<keyof RO, keyof RouteOptions>]: never;
375
+ };
376
+ declare class Router<C extends ContextTypes = {}> {
341
377
  middleware: Middleware[];
342
378
  handlers: Record<Method, Route[]>;
343
379
  self(): this;
344
380
  handle(method: Method, pathOrFn?: any, ...rest: any[]): this;
345
- socket<Path extends string>(path: Path, ...middleware: Mids<O, Path>): this;
346
- socket<Path extends string>(path: Path, options: RouteOptions, ...middleware: Mids<O, Path>): this;
347
- socket(...middleware: Middleware<O>[]): this;
348
- socket(options: RouteOptions, ...middleware: Middleware<O>[]): this;
349
- get<Path extends string>(path: Path, ...middleware: Mids<O, Path>): this;
350
- get<Path extends string>(path: Path, options: RouteOptions, ...middleware: Mids<O, Path>): this;
351
- get(...middleware: Middleware<O>[]): this;
352
- get(options: RouteOptions, ...middleware: Middleware<O>[]): this;
353
- head<Path extends string>(path: Path, ...middleware: Mids<O, Path>): this;
354
- head<Path extends string>(path: Path, options: RouteOptions, ...middleware: Mids<O, Path>): this;
355
- head(...middleware: Middleware<O>[]): this;
356
- head(options: RouteOptions, ...middleware: Middleware<O>[]): this;
357
- post<Path extends string>(path: Path, ...middleware: Mids<O, Path>): this;
358
- post<Path extends string>(path: Path, options: RouteOptions, ...middleware: Mids<O, Path>): this;
359
- post(...middleware: Middleware<O>[]): this;
360
- post(options: RouteOptions, ...middleware: Middleware<O>[]): this;
361
- put<Path extends string>(path: Path, ...middleware: Mids<O, Path>): this;
362
- put<Path extends string>(path: Path, options: RouteOptions, ...middleware: Mids<O, Path>): this;
363
- put(...middleware: Middleware<O>[]): this;
364
- put(options: RouteOptions, ...middleware: Middleware<O>[]): this;
365
- patch<Path extends string>(path: Path, ...middleware: Mids<O, Path>): this;
366
- patch<Path extends string>(path: Path, options: RouteOptions, ...middleware: Mids<O, Path>): this;
367
- patch(...middleware: Middleware<O>[]): this;
368
- patch(options: RouteOptions, ...middleware: Middleware<O>[]): this;
369
- delete<Path extends string>(path: Path, ...middleware: Mids<O, Path>): this;
370
- delete<Path extends string>(path: Path, options: RouteOptions, ...middleware: Mids<O, Path>): this;
371
- delete(...middleware: Middleware<O>[]): this;
372
- delete(options: RouteOptions, ...middleware: Middleware<O>[]): this;
373
- options<Path extends string>(path: Path, ...middleware: Mids<O, Path>): this;
374
- options<Path extends string>(path: Path, options: RouteOptions, ...mid: Mids<O, Path>): this;
375
- options(...middleware: Middleware<O>[]): this;
376
- options(options: RouteOptions, ...middleware: Middleware<O>[]): this;
377
- use(...middleware: Middleware[]): this;
378
- use(router: Router): this;
381
+ socket<Path extends string>(path: Path, ...middleware: Mids<C, Path>): this;
382
+ socket(...middleware: Fn<C>[]): this;
383
+ socket<RO extends Exact<RO>>(options: RO, ...middleware: Fn<RouteCtx<C, RO, Record<string, string>>>[]): this;
384
+ socket<Path extends string, RO extends Exact<RO>>(path: Path, options: RO, ...middleware: Mids<C, Path, RO>): this;
385
+ get<Path extends string>(path: Path, ...middleware: Mids<C, Path>): this;
386
+ get(...middleware: Fn<C>[]): this;
387
+ get<RO extends Exact<RO>>(options: RO, ...middleware: Fn<RouteCtx<C, RO, Record<string, string>>>[]): this;
388
+ get<Path extends string, RO extends Exact<RO>>(path: Path, options: RO, ...middleware: Mids<C, Path, RO>): this;
389
+ head<Path extends string>(path: Path, ...middleware: Mids<C, Path>): this;
390
+ head(...middleware: Fn<C>[]): this;
391
+ head<RO extends Exact<RO>>(options: RO, ...middleware: Fn<RouteCtx<C, RO, Record<string, string>>>[]): this;
392
+ head<Path extends string, RO extends Exact<RO>>(path: Path, options: RO, ...middleware: Mids<C, Path, RO>): this;
393
+ post<Path extends string>(path: Path, ...middleware: Mids<C, Path>): this;
394
+ post(...middleware: Fn<C>[]): this;
395
+ post<RO extends Exact<RO>>(options: RO, ...middleware: Fn<RouteCtx<C, RO, Record<string, string>>>[]): this;
396
+ post<Path extends string, RO extends Exact<RO>>(path: Path, options: RO, ...middleware: Mids<C, Path, RO>): this;
397
+ put<Path extends string>(path: Path, ...middleware: Mids<C, Path>): this;
398
+ put(...middleware: Fn<C>[]): this;
399
+ put<RO extends Exact<RO>>(options: RO, ...middleware: Fn<RouteCtx<C, RO, Record<string, string>>>[]): this;
400
+ put<Path extends string, RO extends Exact<RO>>(path: Path, options: RO, ...middleware: Mids<C, Path, RO>): this;
401
+ patch<Path extends string>(path: Path, ...middleware: Mids<C, Path>): this;
402
+ patch(...middleware: Fn<C>[]): this;
403
+ patch<RO extends Exact<RO>>(options: RO, ...middleware: Fn<RouteCtx<C, RO, Record<string, string>>>[]): this;
404
+ patch<Path extends string, RO extends Exact<RO>>(path: Path, options: RO, ...middleware: Mids<C, Path, RO>): this;
405
+ delete<Path extends string>(path: Path, ...middleware: Mids<C, Path>): this;
406
+ delete(...middleware: Fn<C>[]): this;
407
+ delete<RO extends Exact<RO>>(options: RO, ...middleware: Fn<RouteCtx<C, RO, Record<string, string>>>[]): this;
408
+ delete<Path extends string, RO extends Exact<RO>>(path: Path, options: RO, ...middleware: Mids<C, Path, RO>): this;
409
+ options<Path extends string>(path: Path, ...middleware: Mids<C, Path>): this;
410
+ options(...middleware: Fn<C>[]): this;
411
+ options<RO extends Exact<RO>>(options: RO, ...middleware: Fn<RouteCtx<C, RO, Record<string, string>>>[]): this;
412
+ options<Path extends string, RO extends Exact<RO>>(path: Path, options: RO, ...mid: Mids<C, Path, RO>): this;
413
+ use(...middleware: Fn<C>[]): this;
414
+ use(router: Router<any>): this;
379
415
  }
380
- declare function router(): Router;
416
+ declare function router<C extends ContextTypes = {}>(): Router<C>;
381
417
 
382
- declare class Server<O extends ServerConfig = {}> extends Router<O> {
418
+ declare class StatusError extends Error {
419
+ status: number;
420
+ constructor(msg: string, status?: number);
421
+ }
422
+
423
+ declare class ValidationError extends StatusError {
424
+ source: "body" | "query" | "params" | "response";
425
+ issues: readonly StandardIssue[];
426
+ constructor(source: "body" | "query" | "params" | "response", issues: readonly StandardIssue[]);
427
+ }
428
+
429
+ declare class Server<C extends ContextTypes = {}> extends Router<C> {
383
430
  settings: Settings;
384
431
  platform: Platform;
385
432
  sockets: any[];
@@ -397,111 +444,111 @@ declare class Server<O extends ServerConfig = {}> extends Router<O> {
397
444
  callback(request: Request, context: unknown): Promise<Response>;
398
445
  test(): {
399
446
  get: (path: string, options?: {
447
+ method?: string;
448
+ headers?: HeadersInit;
400
449
  cache?: RequestCache;
450
+ redirect?: RequestRedirect;
401
451
  credentials?: RequestCredentials;
402
- headers?: HeadersInit;
403
452
  integrity?: string;
404
453
  keepalive?: boolean;
405
- method?: string;
406
454
  mode?: RequestMode;
407
455
  priority?: RequestPriority;
408
- redirect?: RequestRedirect;
409
456
  referrer?: string;
410
457
  referrerPolicy?: ReferrerPolicy;
411
458
  signal?: AbortSignal | null;
412
459
  window?: null;
413
460
  }) => Promise<Response>;
414
461
  head: (path: string, options?: {
462
+ method?: string;
463
+ headers?: HeadersInit;
415
464
  cache?: RequestCache;
465
+ redirect?: RequestRedirect;
416
466
  credentials?: RequestCredentials;
417
- headers?: HeadersInit;
418
467
  integrity?: string;
419
468
  keepalive?: boolean;
420
- method?: string;
421
469
  mode?: RequestMode;
422
470
  priority?: RequestPriority;
423
- redirect?: RequestRedirect;
424
471
  referrer?: string;
425
472
  referrerPolicy?: ReferrerPolicy;
426
473
  signal?: AbortSignal | null;
427
474
  window?: null;
428
475
  }) => Promise<Response>;
429
- post: (path: string, body?: string | number | boolean | ArrayBuffer | ReadableStream<any> | Blob | ArrayBufferView<ArrayBuffer> | FormData | URLSearchParams | {
476
+ post: (path: string, body?: string | number | boolean | ArrayBuffer | {
430
477
  [key: string]: SerializableValue;
431
- } | SerializableValue[], options?: {
478
+ } | SerializableValue[] | ReadableStream<any> | Blob | ArrayBufferView<ArrayBuffer> | FormData | URLSearchParams, options?: {
479
+ method?: string;
480
+ headers?: HeadersInit;
432
481
  cache?: RequestCache;
482
+ redirect?: RequestRedirect;
433
483
  credentials?: RequestCredentials;
434
- headers?: HeadersInit;
435
484
  integrity?: string;
436
485
  keepalive?: boolean;
437
- method?: string;
438
486
  mode?: RequestMode;
439
487
  priority?: RequestPriority;
440
- redirect?: RequestRedirect;
441
488
  referrer?: string;
442
489
  referrerPolicy?: ReferrerPolicy;
443
490
  signal?: AbortSignal | null;
444
491
  window?: null;
445
492
  }) => Promise<Response>;
446
- put: (path: string, body?: string | number | boolean | ArrayBuffer | ReadableStream<any> | Blob | ArrayBufferView<ArrayBuffer> | FormData | URLSearchParams | {
493
+ put: (path: string, body?: string | number | boolean | ArrayBuffer | {
447
494
  [key: string]: SerializableValue;
448
- } | SerializableValue[], options?: {
495
+ } | SerializableValue[] | ReadableStream<any> | Blob | ArrayBufferView<ArrayBuffer> | FormData | URLSearchParams, options?: {
496
+ method?: string;
497
+ headers?: HeadersInit;
449
498
  cache?: RequestCache;
499
+ redirect?: RequestRedirect;
450
500
  credentials?: RequestCredentials;
451
- headers?: HeadersInit;
452
501
  integrity?: string;
453
502
  keepalive?: boolean;
454
- method?: string;
455
503
  mode?: RequestMode;
456
504
  priority?: RequestPriority;
457
- redirect?: RequestRedirect;
458
505
  referrer?: string;
459
506
  referrerPolicy?: ReferrerPolicy;
460
507
  signal?: AbortSignal | null;
461
508
  window?: null;
462
509
  }) => Promise<Response>;
463
- patch: (path: string, body?: string | number | boolean | ArrayBuffer | ReadableStream<any> | Blob | ArrayBufferView<ArrayBuffer> | FormData | URLSearchParams | {
510
+ patch: (path: string, body?: string | number | boolean | ArrayBuffer | {
464
511
  [key: string]: SerializableValue;
465
- } | SerializableValue[], options?: {
512
+ } | SerializableValue[] | ReadableStream<any> | Blob | ArrayBufferView<ArrayBuffer> | FormData | URLSearchParams, options?: {
513
+ method?: string;
514
+ headers?: HeadersInit;
466
515
  cache?: RequestCache;
516
+ redirect?: RequestRedirect;
467
517
  credentials?: RequestCredentials;
468
- headers?: HeadersInit;
469
518
  integrity?: string;
470
519
  keepalive?: boolean;
471
- method?: string;
472
520
  mode?: RequestMode;
473
521
  priority?: RequestPriority;
474
- redirect?: RequestRedirect;
475
522
  referrer?: string;
476
523
  referrerPolicy?: ReferrerPolicy;
477
524
  signal?: AbortSignal | null;
478
525
  window?: null;
479
526
  }) => Promise<Response>;
480
527
  delete: (path: string, options?: {
528
+ method?: string;
529
+ headers?: HeadersInit;
481
530
  cache?: RequestCache;
531
+ redirect?: RequestRedirect;
482
532
  credentials?: RequestCredentials;
483
- headers?: HeadersInit;
484
533
  integrity?: string;
485
534
  keepalive?: boolean;
486
- method?: string;
487
535
  mode?: RequestMode;
488
536
  priority?: RequestPriority;
489
- redirect?: RequestRedirect;
490
537
  referrer?: string;
491
538
  referrerPolicy?: ReferrerPolicy;
492
539
  signal?: AbortSignal | null;
493
540
  window?: null;
494
541
  }) => Promise<Response>;
495
542
  options: (path: string, options?: {
543
+ method?: string;
544
+ headers?: HeadersInit;
496
545
  cache?: RequestCache;
546
+ redirect?: RequestRedirect;
497
547
  credentials?: RequestCredentials;
498
- headers?: HeadersInit;
499
548
  integrity?: string;
500
549
  keepalive?: boolean;
501
- method?: string;
502
550
  mode?: RequestMode;
503
551
  priority?: RequestPriority;
504
- redirect?: RequestRedirect;
505
552
  referrer?: string;
506
553
  referrerPolicy?: ReferrerPolicy;
507
554
  signal?: AbortSignal | null;
@@ -509,6 +556,6 @@ declare class Server<O extends ServerConfig = {}> extends Router<O> {
509
556
  }) => Promise<Response>;
510
557
  };
511
558
  }
512
- declare function server<Session extends Record<string, any> = {}, User extends Record<string, any> = {}>(options?: Options): Server<ServerConfig<Session, User>>;
559
+ declare function server<C extends ContextTypes = {}>(options?: Options): Server<C>;
513
560
 
514
- export { type AuthOption, type AuthSession, type AuthSettings, type AuthUser, type BasicValue, type Body, type BodyMode, type BodyOption, type Bucket, type BucketFile, type BunEnv, type CacheOption, type Context, type ContextExtension, type Cookie, type CorsSettings, type ExtractPathParams, type FileInfo, type InferParamType, type InlineReply, type KVStore, type LogLevel, type Logger, type Method, type Middleware, type Options, type ParamTypeMap, type ParamsToObject, type PathToParams, type Platform, type ProfileUser, type Provider, type Route, type RouteOptions, type RouterMethod, type SecurityOptions, type SecuritySettings, type SerializableValue, Server, type ServerConfig, TypedServerError as ServerError, type Settings, type StoreSource, type Strategy, type Time, type UploadOptions, type UploadedFile, cache, cookies, server as default, download, file, headers, json, redirect, router, send, status, type };
561
+ export { type AuthOption, type AuthSession, type AuthSettings, type AuthUser, type BasicValue, type Body, type BodyMode, type Bucket, type BucketFile, type BunEnv, type CacheOption, type Context, type ContextExtension, type ContextTypes, type Cookie, type CorsSettings, type ExtractPathParams, type FileInfo, type InferParamType, type InlineReply, type KVStore, type LogLevel, type Logger, type Method, type Middleware, type Options, type ParamTypeMap, type ParamsToObject, type PathToParams, type Platform, type ProfileUser, type Provider, type Route, type RouteOptions, type RouteSchema, type RouterMethod, type SchemaOutput, type SecurityOptions, type SecuritySettings, type SerializableValue, Server, TypedServerError as ServerError, type Settings, type StandardIssue, type StandardSchemaV1, type StoreSource, type Strategy, type Time, type UploadOptions, type UploadedFile, ValidationError, cache, cookies, server as default, download, file, headers, json, redirect, router, send, status, type };