@server/next 0.28.16 → 0.30.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/index.d.ts +29 -3
- package/index.js +733 -214
- package/package.json +19 -25
- package/readme.md +1 -1
- package/src/jsx/jsx-runtime.js +1 -1
package/index.d.ts
CHANGED
|
@@ -33,9 +33,13 @@ type RouteOptions = {
|
|
|
33
33
|
description?: string;
|
|
34
34
|
};
|
|
35
35
|
type Cookie = {
|
|
36
|
-
value?: string;
|
|
36
|
+
value?: string | null;
|
|
37
37
|
path?: string;
|
|
38
38
|
expires?: number | string | Date;
|
|
39
|
+
maxAge?: number;
|
|
40
|
+
httpOnly?: boolean;
|
|
41
|
+
secure?: boolean;
|
|
42
|
+
sameSite?: "Strict" | "Lax" | "None";
|
|
39
43
|
};
|
|
40
44
|
type RouterMethod = "*" | Method;
|
|
41
45
|
type Bucket = {
|
|
@@ -54,11 +58,13 @@ type CorsSettings = {
|
|
|
54
58
|
origin: string | boolean;
|
|
55
59
|
methods: string;
|
|
56
60
|
headers: string;
|
|
61
|
+
credentials?: boolean;
|
|
57
62
|
};
|
|
58
63
|
type CorsOptions = boolean | string | string[] | {
|
|
59
64
|
origin?: string | string[];
|
|
60
65
|
methods?: string | Method[];
|
|
61
66
|
headers?: string | string[];
|
|
67
|
+
credentials?: boolean;
|
|
62
68
|
};
|
|
63
69
|
type BasicValue = string | number | boolean | null;
|
|
64
70
|
type SerializableValue = BasicValue | {
|
|
@@ -75,7 +81,7 @@ type KVStore = {
|
|
|
75
81
|
del: (key: string) => Promise<void | string>;
|
|
76
82
|
keys: () => Promise<string[]>;
|
|
77
83
|
};
|
|
78
|
-
type Provider = "email" | "github";
|
|
84
|
+
type Provider = "email" | "github" | "google" | "microsoft" | "discord" | "facebook" | "apple";
|
|
79
85
|
type Strategy = "cookie" | "jwt" | "token";
|
|
80
86
|
type AuthSession = {
|
|
81
87
|
id: string;
|
|
@@ -106,6 +112,19 @@ type AuthSettings = {
|
|
|
106
112
|
cleanUser: <T = AuthUser>(user: T) => T | Promise<T>;
|
|
107
113
|
redirect: string;
|
|
108
114
|
};
|
|
115
|
+
type LogLevel = "info";
|
|
116
|
+
type Logger = {
|
|
117
|
+
level?: LogLevel;
|
|
118
|
+
message: (scope: string, message: string) => void;
|
|
119
|
+
start: (url: string) => void;
|
|
120
|
+
request: (ctx: Context, res: Response) => void;
|
|
121
|
+
};
|
|
122
|
+
type SecurityOptions = {
|
|
123
|
+
trustProxy?: boolean;
|
|
124
|
+
};
|
|
125
|
+
type SecuritySettings = {
|
|
126
|
+
trustProxy: boolean;
|
|
127
|
+
};
|
|
109
128
|
type OnError = (error: Error, ctx: Context) => Response | Promise<Response>;
|
|
110
129
|
type Options = {
|
|
111
130
|
port?: number;
|
|
@@ -122,6 +141,9 @@ type Options = {
|
|
|
122
141
|
auth?: AuthOption;
|
|
123
142
|
openapi?: any;
|
|
124
143
|
onError?: OnError;
|
|
144
|
+
log?: LogLevel | boolean;
|
|
145
|
+
favicon?: string | Bucket;
|
|
146
|
+
security?: SecurityOptions;
|
|
125
147
|
};
|
|
126
148
|
type Settings = {
|
|
127
149
|
port: number;
|
|
@@ -138,6 +160,9 @@ type Settings = {
|
|
|
138
160
|
auth?: AuthSettings;
|
|
139
161
|
openapi?: any;
|
|
140
162
|
onError?: OnError;
|
|
163
|
+
log: Logger;
|
|
164
|
+
favicon?: string | Bucket;
|
|
165
|
+
security: SecuritySettings;
|
|
141
166
|
};
|
|
142
167
|
type Time = {
|
|
143
168
|
(name: string): void;
|
|
@@ -170,6 +195,7 @@ type Events = Record<string, EventCallback[]> & {
|
|
|
170
195
|
};
|
|
171
196
|
type Context<Params extends Record<string, string | undefined> = Record<string, string>, O extends ServerConfig = object> = {
|
|
172
197
|
method: Method;
|
|
198
|
+
ip: string;
|
|
173
199
|
headers: Record<string, string | string[]>;
|
|
174
200
|
cookies: Record<string, string>;
|
|
175
201
|
body?: SerializableValue;
|
|
@@ -426,4 +452,4 @@ declare class Server<O extends ServerConfig = {}> extends Router<O> {
|
|
|
426
452
|
}
|
|
427
453
|
declare function server<Session extends Record<string, any> = {}, User extends Record<string, any> = {}>(options?: Options): Server<ServerConfig<Session, User>>;
|
|
428
454
|
|
|
429
|
-
export { type AuthOption, type AuthSession, type AuthSettings, type AuthUser, type BasicValue, type Body, type Bucket, type BunEnv, type Context, type Cookie, type CorsSettings, type EventCallback, type ExtractPathParams, type InferParamType, type InlineReply, type KVStore, type LimitOptions, type Method, type Middleware, type Options, type ParamTypeMap, type ParamsToObject, type PathToParams, type Platform, type Provider, type RouteOptions, type RouterMethod, type SerializableValue, Server, type ServerConfig, TypedServerError as ServerError, type Settings, type Strategy, type Time, UploadPipeline, type UploadedFile, cookies, server as default, download, file, headers, json, redirect, router, send, status, type, upload };
|
|
455
|
+
export { type AuthOption, type AuthSession, type AuthSettings, type AuthUser, type BasicValue, type Body, type Bucket, type BunEnv, type Context, type Cookie, type CorsSettings, type EventCallback, type ExtractPathParams, type InferParamType, type InlineReply, type KVStore, type LimitOptions, type LogLevel, type Logger, type Method, type Middleware, type Options, type ParamTypeMap, type ParamsToObject, type PathToParams, type Platform, type Provider, type RouteOptions, type RouterMethod, type SecurityOptions, type SecuritySettings, type SerializableValue, Server, type ServerConfig, TypedServerError as ServerError, type Settings, type Strategy, type Time, UploadPipeline, type UploadedFile, cookies, server as default, download, file, headers, json, redirect, router, send, status, type, upload };
|