@iskra-bun/web-kit 0.1.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/CHANGELOG.md +7 -0
- package/README.md +31 -0
- package/dist/chunk-POXNRNTC.js +51 -0
- package/dist/chunk-POXNRNTC.js.map +1 -0
- package/dist/index.d.ts +966 -0
- package/dist/index.js +2824 -0
- package/dist/index.js.map +1 -0
- package/dist/mailgun-Z46GZJNI.js +83 -0
- package/dist/mailgun-Z46GZJNI.js.map +1 -0
- package/dist/s3-7IG4ESFW.js +171 -0
- package/dist/s3-7IG4ESFW.js.map +1 -0
- package/dist/sendgrid-UK2GSBEF.js +43 -0
- package/dist/sendgrid-UK2GSBEF.js.map +1 -0
- package/dist/smtp-WJDLYKD5.js +50 -0
- package/dist/smtp-WJDLYKD5.js.map +1 -0
- package/package.json +74 -0
- package/src/driver.ts +55 -0
- package/src/errors.ts +66 -0
- package/src/features/api-key.ts +243 -0
- package/src/features/auth/better-auth-config.ts +160 -0
- package/src/features/auth/index.ts +229 -0
- package/src/features/auth/schema.ts +174 -0
- package/src/features/auth/types.ts +114 -0
- package/src/features/cache.ts +144 -0
- package/src/features/cors.ts +33 -0
- package/src/features/csrf.ts +94 -0
- package/src/features/db.ts +90 -0
- package/src/features/email/index.ts +103 -0
- package/src/features/email/providers/mailgun.ts +99 -0
- package/src/features/email/providers/sendgrid.ts +42 -0
- package/src/features/email/providers/smtp.ts +51 -0
- package/src/features/error-handler.ts +147 -0
- package/src/features/health.ts +94 -0
- package/src/features/json-schema-validation.ts +186 -0
- package/src/features/logger.ts +70 -0
- package/src/features/openapi.ts +107 -0
- package/src/features/permissions.ts +128 -0
- package/src/features/rate-limit.ts +173 -0
- package/src/features/request-id.ts +45 -0
- package/src/features/session.ts +322 -0
- package/src/features/storage/adapters/local.ts +133 -0
- package/src/features/storage/adapters/s3.ts +193 -0
- package/src/features/storage/base.ts +112 -0
- package/src/features/storage/index.ts +53 -0
- package/src/features/tracing.ts +49 -0
- package/src/features/upload/helper.ts +85 -0
- package/src/features/upload/index.ts +140 -0
- package/src/features/validation.ts +105 -0
- package/src/index.ts +29 -0
- package/src/kernel.ts +257 -0
- package/src/responses.ts +37 -0
- package/src/router.ts +31 -0
- package/src/server.ts +135 -0
- package/src/types.ts +272 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,966 @@
|
|
|
1
|
+
import * as hono from 'hono';
|
|
2
|
+
import { Hono, Context, Next, Handler } from 'hono';
|
|
3
|
+
import { Driver, App, IskraError, ErrorCode } from '@iskra-bun/core';
|
|
4
|
+
export { ErrorCode, ErrorCodes } from '@iskra-bun/core';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { HTTPException } from 'hono/http-exception';
|
|
7
|
+
import { Auth as Auth$1 } from 'better-auth';
|
|
8
|
+
import * as hono_utils_types from 'hono/utils/types';
|
|
9
|
+
import { ErrorObject } from 'ajv';
|
|
10
|
+
export { OpenAPIHono, createRoute, z } from '@hono/zod-openapi';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Core microkernel orchestrator that manages features, dependencies, and application lifecycle.
|
|
14
|
+
*/
|
|
15
|
+
declare class Kernel {
|
|
16
|
+
private app;
|
|
17
|
+
private config;
|
|
18
|
+
private features;
|
|
19
|
+
private initialized;
|
|
20
|
+
constructor(config?: KernelConfig);
|
|
21
|
+
initialize(): Promise<void>;
|
|
22
|
+
private applySecurityHeaders;
|
|
23
|
+
registerFeature(feature: Feature): void;
|
|
24
|
+
private validateFeatureDependencies;
|
|
25
|
+
private validatePeerDependencies;
|
|
26
|
+
private sortFeaturesByDependencies;
|
|
27
|
+
private initializeFeature;
|
|
28
|
+
getApp(): Hono;
|
|
29
|
+
getFeature<T extends Feature>(name: string): T | undefined;
|
|
30
|
+
private server;
|
|
31
|
+
start(): Promise<void>;
|
|
32
|
+
shutdown(): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
interface Sink {
|
|
36
|
+
(record: Record<string, unknown>): void;
|
|
37
|
+
}
|
|
38
|
+
interface KernelConfig {
|
|
39
|
+
port?: number;
|
|
40
|
+
hostname?: string;
|
|
41
|
+
environment?: "development" | "production" | "test";
|
|
42
|
+
securityHeaders?: SecurityHeadersConfig;
|
|
43
|
+
}
|
|
44
|
+
interface SecurityHeadersConfig {
|
|
45
|
+
contentSecurityPolicy?: string | {
|
|
46
|
+
directives?: Record<string, string | string[]>;
|
|
47
|
+
};
|
|
48
|
+
xFrameOptions?: "DENY" | "SAMEORIGIN" | string;
|
|
49
|
+
xContentTypeOptions?: boolean;
|
|
50
|
+
strictTransportSecurity?: {
|
|
51
|
+
maxAge?: number;
|
|
52
|
+
includeSubDomains?: boolean;
|
|
53
|
+
preload?: boolean;
|
|
54
|
+
};
|
|
55
|
+
xXssProtection?: boolean;
|
|
56
|
+
referrerPolicy?: "no-referrer" | "no-referrer-when-downgrade" | "origin" | "origin-when-cross-origin" | "same-origin" | "strict-origin" | "strict-origin-when-cross-origin" | "unsafe-url";
|
|
57
|
+
permissionsPolicy?: Record<string, string[]>;
|
|
58
|
+
}
|
|
59
|
+
interface ApiKeyValidationResult {
|
|
60
|
+
isValid: boolean;
|
|
61
|
+
key?: ApiKeyMetadata;
|
|
62
|
+
error?: string;
|
|
63
|
+
}
|
|
64
|
+
interface ApiKeyMetadata {
|
|
65
|
+
id: string;
|
|
66
|
+
key: string;
|
|
67
|
+
name?: string;
|
|
68
|
+
scopes?: string[];
|
|
69
|
+
rateLimit?: {
|
|
70
|
+
max: number;
|
|
71
|
+
windowMs: number;
|
|
72
|
+
};
|
|
73
|
+
expiresAt?: Date;
|
|
74
|
+
createdAt: Date;
|
|
75
|
+
lastUsedAt?: Date;
|
|
76
|
+
metadata?: Record<string, any>;
|
|
77
|
+
}
|
|
78
|
+
interface ApiKeyConfig {
|
|
79
|
+
staticKeys?: Array<Partial<ApiKeyMetadata> & {
|
|
80
|
+
key: string;
|
|
81
|
+
}>;
|
|
82
|
+
headerName?: string;
|
|
83
|
+
queryParamName?: string;
|
|
84
|
+
extractStrategies?: ("header" | "bearer" | "query" | "custom")[];
|
|
85
|
+
vaultService?: any;
|
|
86
|
+
customExtractor?: (c: any) => string | null;
|
|
87
|
+
enableCache?: boolean;
|
|
88
|
+
cacheTtl?: number;
|
|
89
|
+
requireScopes?: boolean;
|
|
90
|
+
skipPaths?: string[];
|
|
91
|
+
onError?: (error: string, c: any) => Response | Promise<Response>;
|
|
92
|
+
onValidated?: (key: ApiKeyMetadata, c: any) => void | Promise<void>;
|
|
93
|
+
}
|
|
94
|
+
interface CsrfConfig {
|
|
95
|
+
secret: string;
|
|
96
|
+
cookieName?: string;
|
|
97
|
+
headerName?: string;
|
|
98
|
+
ignoreMethods?: string[];
|
|
99
|
+
cookieOptions?: {
|
|
100
|
+
httpOnly?: boolean;
|
|
101
|
+
secure?: boolean;
|
|
102
|
+
sameSite?: "Strict" | "Lax" | "None";
|
|
103
|
+
maxAge?: number;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
interface Feature {
|
|
107
|
+
name: string;
|
|
108
|
+
dependencies?: string[];
|
|
109
|
+
peerDependencies?: string[];
|
|
110
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
111
|
+
routes?: (app: any) => void;
|
|
112
|
+
shutdown?(): Promise<void>;
|
|
113
|
+
}
|
|
114
|
+
interface CorsConfig {
|
|
115
|
+
origin?: string | string[] | ((origin: string) => boolean);
|
|
116
|
+
credentials?: boolean;
|
|
117
|
+
allowMethods?: string[];
|
|
118
|
+
allowHeaders?: string[];
|
|
119
|
+
exposeHeaders?: string[];
|
|
120
|
+
maxAge?: number;
|
|
121
|
+
}
|
|
122
|
+
interface RateLimitConfig {
|
|
123
|
+
windowMs?: number;
|
|
124
|
+
max?: number;
|
|
125
|
+
keyGenerator?: (c: any) => string;
|
|
126
|
+
skip?: (c: any) => boolean;
|
|
127
|
+
handler?: (c: any) => Response;
|
|
128
|
+
standardHeaders?: boolean;
|
|
129
|
+
store?: "memory" | "cache";
|
|
130
|
+
}
|
|
131
|
+
interface HealthCheckConfig {
|
|
132
|
+
path?: string;
|
|
133
|
+
readinessPath?: string;
|
|
134
|
+
livenessPath?: string;
|
|
135
|
+
includeDetails?: boolean;
|
|
136
|
+
checks?: {
|
|
137
|
+
[key: string]: (context?: any) => Promise<{
|
|
138
|
+
status: "ok" | "error";
|
|
139
|
+
message?: string;
|
|
140
|
+
details?: any;
|
|
141
|
+
}>;
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
interface RequestIdConfig {
|
|
145
|
+
headerName?: string;
|
|
146
|
+
generator?: () => string;
|
|
147
|
+
}
|
|
148
|
+
interface ErrorHandlerConfig {
|
|
149
|
+
includeStack?: boolean;
|
|
150
|
+
customHandlers?: {
|
|
151
|
+
[key: number]: (error: Error, c: any) => Response;
|
|
152
|
+
};
|
|
153
|
+
logger?: (error: Error, c: any) => void;
|
|
154
|
+
}
|
|
155
|
+
interface LoggerConfig {
|
|
156
|
+
level?: "debug" | "info" | "error" | "trace" | "warning" | "fatal" | null | undefined;
|
|
157
|
+
format?: "json" | "pretty";
|
|
158
|
+
sinks?: Array<{
|
|
159
|
+
type: "console" | "file";
|
|
160
|
+
path?: string;
|
|
161
|
+
level?: "debug" | "info" | "warn" | "error";
|
|
162
|
+
} | Sink>;
|
|
163
|
+
logRequests?: boolean;
|
|
164
|
+
logResponses?: boolean;
|
|
165
|
+
}
|
|
166
|
+
interface AuthConfig {
|
|
167
|
+
secret: string;
|
|
168
|
+
basePath?: string;
|
|
169
|
+
baseURL?: string;
|
|
170
|
+
trustedOrigins?: string[];
|
|
171
|
+
disableCSRFCheck?: boolean;
|
|
172
|
+
authMode?: "oidc" | "email";
|
|
173
|
+
enableSelfRegistration?: boolean;
|
|
174
|
+
socialProviders?: Record<string, any>;
|
|
175
|
+
oidcConfig?: {
|
|
176
|
+
clientId: string;
|
|
177
|
+
clientSecret: string;
|
|
178
|
+
issuer: string;
|
|
179
|
+
providerId?: string;
|
|
180
|
+
authorizationEndpoint?: string;
|
|
181
|
+
tokenEndpoint?: string;
|
|
182
|
+
userinfoEndpoint?: string;
|
|
183
|
+
jwksEndpoint?: string;
|
|
184
|
+
discoveryEndpoint?: string;
|
|
185
|
+
scopes?: string[];
|
|
186
|
+
pkce?: boolean;
|
|
187
|
+
mapping?: {
|
|
188
|
+
id?: string;
|
|
189
|
+
email?: string;
|
|
190
|
+
emailVerified?: string;
|
|
191
|
+
name?: string;
|
|
192
|
+
image?: string;
|
|
193
|
+
extraFields?: Record<string, string>;
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
interface SessionConfig {
|
|
198
|
+
store: "db" | "cache" | "memory";
|
|
199
|
+
secret: string;
|
|
200
|
+
ttl?: number;
|
|
201
|
+
cookieName?: string;
|
|
202
|
+
cookieOptions?: {
|
|
203
|
+
secure?: boolean;
|
|
204
|
+
sameSite?: "Strict" | "Lax" | "None";
|
|
205
|
+
domain?: string;
|
|
206
|
+
path?: string;
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
interface DbConfig {
|
|
210
|
+
adapter: "postgres" | "mysql" | "sqlite";
|
|
211
|
+
connection?: {
|
|
212
|
+
host?: string;
|
|
213
|
+
port?: number;
|
|
214
|
+
database?: string;
|
|
215
|
+
user?: string;
|
|
216
|
+
password?: string;
|
|
217
|
+
connectionString?: string;
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
interface CacheConfig {
|
|
221
|
+
adapter: "redis" | "memory";
|
|
222
|
+
connection?: {
|
|
223
|
+
host?: string;
|
|
224
|
+
port?: number;
|
|
225
|
+
password?: string;
|
|
226
|
+
db?: number;
|
|
227
|
+
};
|
|
228
|
+
secret?: string;
|
|
229
|
+
ttl?: number;
|
|
230
|
+
}
|
|
231
|
+
interface PermissionsConfig {
|
|
232
|
+
loadPermissions?: (userId: string) => Promise<string[]>;
|
|
233
|
+
loadRoles?: (userId: string) => Promise<string[]>;
|
|
234
|
+
anonymousPermissions?: string[];
|
|
235
|
+
enableRBAC?: boolean;
|
|
236
|
+
cachePermissions?: boolean;
|
|
237
|
+
cacheTTL?: number;
|
|
238
|
+
}
|
|
239
|
+
interface Role {
|
|
240
|
+
name: string;
|
|
241
|
+
permissions: string[];
|
|
242
|
+
description?: string;
|
|
243
|
+
}
|
|
244
|
+
interface OpenAPIConfig {
|
|
245
|
+
title: string;
|
|
246
|
+
version: string;
|
|
247
|
+
description?: string;
|
|
248
|
+
servers?: Array<{
|
|
249
|
+
url: string;
|
|
250
|
+
description?: string;
|
|
251
|
+
}>;
|
|
252
|
+
tags?: Array<{
|
|
253
|
+
name: string;
|
|
254
|
+
description?: string;
|
|
255
|
+
}>;
|
|
256
|
+
contact?: {
|
|
257
|
+
name?: string;
|
|
258
|
+
email?: string;
|
|
259
|
+
url?: string;
|
|
260
|
+
};
|
|
261
|
+
license?: {
|
|
262
|
+
name: string;
|
|
263
|
+
url?: string;
|
|
264
|
+
};
|
|
265
|
+
externalDocs?: {
|
|
266
|
+
description: string;
|
|
267
|
+
url: string;
|
|
268
|
+
};
|
|
269
|
+
security?: Array<Record<string, string[]>>;
|
|
270
|
+
securitySchemes?: Record<string, any>;
|
|
271
|
+
}
|
|
272
|
+
interface UploadConfig {
|
|
273
|
+
projectName: string;
|
|
274
|
+
maxFileSize?: number;
|
|
275
|
+
allowedExtensions?: string[];
|
|
276
|
+
exposeRoutes?: boolean;
|
|
277
|
+
routePrefix?: string;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
interface WebPluginConfig extends KernelConfig {
|
|
281
|
+
router?: Hono;
|
|
282
|
+
features?: Feature[];
|
|
283
|
+
}
|
|
284
|
+
declare class WebPlugin implements Driver {
|
|
285
|
+
name: string;
|
|
286
|
+
private app;
|
|
287
|
+
private kernel;
|
|
288
|
+
private runningServer;
|
|
289
|
+
private router?;
|
|
290
|
+
constructor(config?: WebPluginConfig);
|
|
291
|
+
init(app: App): Promise<void>;
|
|
292
|
+
getHonoApp(): Hono;
|
|
293
|
+
start(): Promise<void>;
|
|
294
|
+
stop(): Promise<void>;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
interface RouteOptions<B = any, Q = any> {
|
|
298
|
+
method: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH';
|
|
299
|
+
path: string;
|
|
300
|
+
schema?: {
|
|
301
|
+
body?: z.ZodType<B>;
|
|
302
|
+
query?: z.ZodType<Q>;
|
|
303
|
+
params?: z.ZodType;
|
|
304
|
+
};
|
|
305
|
+
handler: (ctx: WebContext<B, Q>) => Promise<any> | any;
|
|
306
|
+
doc?: {
|
|
307
|
+
summary?: string;
|
|
308
|
+
tags?: string[];
|
|
309
|
+
description?: string;
|
|
310
|
+
};
|
|
311
|
+
}
|
|
312
|
+
interface WebContext<B = any, Q = any> {
|
|
313
|
+
raw: Context;
|
|
314
|
+
body: B;
|
|
315
|
+
query: Q;
|
|
316
|
+
params: Record<string, string>;
|
|
317
|
+
app: App;
|
|
318
|
+
}
|
|
319
|
+
declare const createRouter: (routes: RouteOptions[]) => RouteOptions<any, any>[];
|
|
320
|
+
|
|
321
|
+
interface WebServerOptions {
|
|
322
|
+
port?: number;
|
|
323
|
+
routes?: RouteOptions[];
|
|
324
|
+
debug?: boolean;
|
|
325
|
+
openApi?: {
|
|
326
|
+
path: string;
|
|
327
|
+
title: string;
|
|
328
|
+
version: string;
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
declare class WebDriver implements Driver {
|
|
332
|
+
name: string;
|
|
333
|
+
private app;
|
|
334
|
+
private server;
|
|
335
|
+
private options;
|
|
336
|
+
private runningServer;
|
|
337
|
+
constructor(options?: WebServerOptions);
|
|
338
|
+
init(app: App): void;
|
|
339
|
+
private setupOpenApi;
|
|
340
|
+
private setupRoutes;
|
|
341
|
+
start(): void;
|
|
342
|
+
stop(): void;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
declare class CorsFeature implements Feature {
|
|
346
|
+
private config;
|
|
347
|
+
name: string;
|
|
348
|
+
constructor(config?: CorsConfig);
|
|
349
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
declare class ErrorHandlerFeature implements Feature {
|
|
353
|
+
name: string;
|
|
354
|
+
private config;
|
|
355
|
+
constructor(config?: ErrorHandlerConfig);
|
|
356
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
357
|
+
private handleError;
|
|
358
|
+
private getStatusText;
|
|
359
|
+
}
|
|
360
|
+
declare function createHttpError(status: number, message: string): HTTPException;
|
|
361
|
+
|
|
362
|
+
declare class HealthCheckFeature implements Feature {
|
|
363
|
+
name: string;
|
|
364
|
+
private kernel?;
|
|
365
|
+
private config;
|
|
366
|
+
constructor(config?: HealthCheckConfig);
|
|
367
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
368
|
+
private handleHealthCheck;
|
|
369
|
+
private checkFeatureHealth;
|
|
370
|
+
private handleReadinessCheck;
|
|
371
|
+
private handleLivenessCheck;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
declare module "hono" {
|
|
375
|
+
interface ContextVariableMap {
|
|
376
|
+
logger: any;
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
declare class LoggerFeature implements Feature {
|
|
380
|
+
name: string;
|
|
381
|
+
private config;
|
|
382
|
+
private logger;
|
|
383
|
+
constructor(config?: LoggerConfig);
|
|
384
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
declare module "hono" {
|
|
388
|
+
interface ContextVariableMap {
|
|
389
|
+
requestId: string;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
declare class RequestIdFeature implements Feature {
|
|
393
|
+
name: string;
|
|
394
|
+
private config;
|
|
395
|
+
constructor(config?: RequestIdConfig);
|
|
396
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
397
|
+
private defaultGenerator;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
interface StorageConfig {
|
|
401
|
+
adapter: "local" | "minio" | "s3";
|
|
402
|
+
basePath?: string;
|
|
403
|
+
connection?: {
|
|
404
|
+
endpoint?: string;
|
|
405
|
+
accessKey?: string;
|
|
406
|
+
secretKey?: string;
|
|
407
|
+
bucket?: string;
|
|
408
|
+
region?: string;
|
|
409
|
+
useSSL?: boolean;
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
interface StorageFile {
|
|
413
|
+
name: string;
|
|
414
|
+
path: string;
|
|
415
|
+
size: number;
|
|
416
|
+
mimeType?: string;
|
|
417
|
+
lastModified?: Date;
|
|
418
|
+
url?: string;
|
|
419
|
+
}
|
|
420
|
+
interface PutOptions {
|
|
421
|
+
contentType?: string;
|
|
422
|
+
metadata?: Record<string, string>;
|
|
423
|
+
public?: boolean;
|
|
424
|
+
}
|
|
425
|
+
interface StorageAdapter {
|
|
426
|
+
connect(): Promise<void>;
|
|
427
|
+
disconnect(): Promise<void>;
|
|
428
|
+
put(path: string, data: Uint8Array | Buffer | ReadableStream, options?: PutOptions): Promise<StorageFile>;
|
|
429
|
+
get(path: string): Promise<Uint8Array | null>;
|
|
430
|
+
delete(path: string): Promise<void>;
|
|
431
|
+
exists(path: string): Promise<boolean>;
|
|
432
|
+
list(prefix?: string): Promise<StorageFile[]>;
|
|
433
|
+
url(path: string, expiresIn?: number): Promise<string>;
|
|
434
|
+
copy(from: string, to: string): Promise<void>;
|
|
435
|
+
move(from: string, to: string): Promise<void>;
|
|
436
|
+
isDirectory(path: string): Promise<boolean>;
|
|
437
|
+
}
|
|
438
|
+
declare abstract class BaseStorageAdapter implements StorageAdapter {
|
|
439
|
+
protected connected: boolean;
|
|
440
|
+
abstract connect(): Promise<void>;
|
|
441
|
+
abstract disconnect(): Promise<void>;
|
|
442
|
+
abstract put(path: string, data: Uint8Array | Buffer | ReadableStream, options?: PutOptions): Promise<StorageFile>;
|
|
443
|
+
abstract get(path: string): Promise<Uint8Array | null>;
|
|
444
|
+
abstract delete(path: string): Promise<void>;
|
|
445
|
+
abstract exists(path: string): Promise<boolean>;
|
|
446
|
+
abstract list(prefix?: string): Promise<StorageFile[]>;
|
|
447
|
+
abstract url(path: string, expiresIn?: number): Promise<string>;
|
|
448
|
+
abstract isDirectory(path: string): Promise<boolean>;
|
|
449
|
+
isConnected(): boolean;
|
|
450
|
+
protected ensureConnected(): void;
|
|
451
|
+
copy(from: string, to: string): Promise<void>;
|
|
452
|
+
move(from: string, to: string): Promise<void>;
|
|
453
|
+
protected generateFileName(originalName: string): string;
|
|
454
|
+
protected sanitizePath(path: string): string;
|
|
455
|
+
protected getMimeType(filename: string): string;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
declare class LocalStorageAdapter extends BaseStorageAdapter {
|
|
459
|
+
private basePath;
|
|
460
|
+
constructor(config: StorageConfig);
|
|
461
|
+
connect(): Promise<void>;
|
|
462
|
+
disconnect(): Promise<void>;
|
|
463
|
+
put(filePath: string, data: Uint8Array | Buffer, options?: PutOptions): Promise<StorageFile>;
|
|
464
|
+
get(filePath: string): Promise<Uint8Array | null>;
|
|
465
|
+
delete(filePath: string): Promise<void>;
|
|
466
|
+
exists(filePath: string): Promise<boolean>;
|
|
467
|
+
isDirectory(filePath: string): Promise<boolean>;
|
|
468
|
+
list(prefix?: string): Promise<StorageFile[]>;
|
|
469
|
+
url(filePath: string, _expiresIn?: number): Promise<string>;
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
declare module "hono" {
|
|
473
|
+
interface ContextVariableMap {
|
|
474
|
+
storage: BaseStorageAdapter;
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
declare class StorageFeature implements Feature {
|
|
478
|
+
private config;
|
|
479
|
+
name: string;
|
|
480
|
+
private adapter?;
|
|
481
|
+
constructor(config: StorageConfig);
|
|
482
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
483
|
+
shutdown(): Promise<void>;
|
|
484
|
+
getAdapter(): BaseStorageAdapter | undefined;
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
declare module "hono" {
|
|
488
|
+
interface ContextVariableMap {
|
|
489
|
+
db: any;
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
declare class DbFeature implements Feature {
|
|
493
|
+
private config;
|
|
494
|
+
name: string;
|
|
495
|
+
private client;
|
|
496
|
+
db: any;
|
|
497
|
+
readonly adapter: string;
|
|
498
|
+
constructor(config: DbConfig);
|
|
499
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
500
|
+
shutdown(): Promise<void>;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
interface CacheAdapter {
|
|
504
|
+
get(key: string): Promise<any>;
|
|
505
|
+
set(key: string, value: any, ttl?: number): Promise<void>;
|
|
506
|
+
delete(key: string): Promise<void>;
|
|
507
|
+
exists(key: string): Promise<boolean>;
|
|
508
|
+
increment?(key: string): Promise<number>;
|
|
509
|
+
disconnect?(): Promise<void>;
|
|
510
|
+
}
|
|
511
|
+
declare module "hono" {
|
|
512
|
+
interface ContextVariableMap {
|
|
513
|
+
cache: CacheAdapter;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
declare class CacheFeature implements Feature {
|
|
517
|
+
private config;
|
|
518
|
+
name: string;
|
|
519
|
+
client: CacheAdapter;
|
|
520
|
+
constructor(config?: CacheConfig);
|
|
521
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
522
|
+
shutdown(): Promise<void>;
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
declare module "hono" {
|
|
526
|
+
interface ContextVariableMap {
|
|
527
|
+
session: Record<string, any>;
|
|
528
|
+
sessionId: string;
|
|
529
|
+
destroySession: () => Promise<void>;
|
|
530
|
+
}
|
|
531
|
+
}
|
|
532
|
+
declare class SessionFeature implements Feature {
|
|
533
|
+
private config;
|
|
534
|
+
name: string;
|
|
535
|
+
dependencies?: string[];
|
|
536
|
+
private store?;
|
|
537
|
+
private ttl;
|
|
538
|
+
private cookieName;
|
|
539
|
+
constructor(config: SessionConfig);
|
|
540
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
541
|
+
shutdown(): Promise<void>;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
interface BetterAuthConfigOptions {
|
|
545
|
+
db: any;
|
|
546
|
+
adapterType: "postgres" | "mysql" | "sqlite";
|
|
547
|
+
secret: string;
|
|
548
|
+
baseURL?: string;
|
|
549
|
+
basePath?: string;
|
|
550
|
+
trustedOrigins?: string[];
|
|
551
|
+
enableEmailPassword?: boolean;
|
|
552
|
+
disableCSRFCheck?: boolean;
|
|
553
|
+
socialProviders?: Record<string, any>;
|
|
554
|
+
oidcConfig?: {
|
|
555
|
+
clientId: string;
|
|
556
|
+
clientSecret: string;
|
|
557
|
+
issuer: string;
|
|
558
|
+
providerId?: string;
|
|
559
|
+
authorizationEndpoint?: string;
|
|
560
|
+
tokenEndpoint?: string;
|
|
561
|
+
userinfoEndpoint?: string;
|
|
562
|
+
jwksEndpoint?: string;
|
|
563
|
+
discoveryEndpoint?: string;
|
|
564
|
+
scopes?: string[];
|
|
565
|
+
pkce?: boolean;
|
|
566
|
+
mapping?: {
|
|
567
|
+
id?: string;
|
|
568
|
+
email?: string;
|
|
569
|
+
emailVerified?: string;
|
|
570
|
+
name?: string;
|
|
571
|
+
image?: string;
|
|
572
|
+
extraFields?: Record<string, string>;
|
|
573
|
+
};
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
declare function createBetterAuth(options: BetterAuthConfigOptions): Auth$1;
|
|
577
|
+
type Auth = ReturnType<typeof createBetterAuth>;
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Auth feature types and interfaces
|
|
581
|
+
*/
|
|
582
|
+
interface User {
|
|
583
|
+
id: string;
|
|
584
|
+
email: string;
|
|
585
|
+
emailVerified: boolean;
|
|
586
|
+
name?: string | null;
|
|
587
|
+
image?: string | null;
|
|
588
|
+
createdAt: Date;
|
|
589
|
+
updatedAt: Date;
|
|
590
|
+
[key: string]: any;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
declare module "hono" {
|
|
594
|
+
interface ContextVariableMap {
|
|
595
|
+
user: User | null;
|
|
596
|
+
authUser: User | null;
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
declare class AuthFeature implements Feature {
|
|
600
|
+
name: string;
|
|
601
|
+
dependencies: string[];
|
|
602
|
+
private auth;
|
|
603
|
+
private config;
|
|
604
|
+
private kernel?;
|
|
605
|
+
private authMode;
|
|
606
|
+
constructor(config: AuthConfig);
|
|
607
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
608
|
+
routes(app: Hono): void;
|
|
609
|
+
getAuth(): Auth | undefined;
|
|
610
|
+
}
|
|
611
|
+
declare function requireAuth(kernel: Kernel): (c: Context, next: Next) => Promise<void>;
|
|
612
|
+
|
|
613
|
+
declare class RateLimitFeature implements Feature {
|
|
614
|
+
name: string;
|
|
615
|
+
private config;
|
|
616
|
+
private store?;
|
|
617
|
+
private cleanupInterval?;
|
|
618
|
+
constructor(config?: RateLimitConfig);
|
|
619
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
620
|
+
private middleware;
|
|
621
|
+
private defaultKeyGenerator;
|
|
622
|
+
shutdown(): Promise<void>;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
declare module "hono" {
|
|
626
|
+
interface ContextVariableMap {
|
|
627
|
+
userPermissions: string[];
|
|
628
|
+
checkPermission: (permission: string) => boolean;
|
|
629
|
+
hasRole: (role: string) => boolean;
|
|
630
|
+
hasAnyRole: (...roles: string[]) => boolean;
|
|
631
|
+
hasAllRoles: (...roles: string[]) => boolean;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
declare class PermissionsFeature implements Feature {
|
|
635
|
+
name: string;
|
|
636
|
+
dependencies: string[];
|
|
637
|
+
private config;
|
|
638
|
+
private roles;
|
|
639
|
+
constructor(config?: PermissionsConfig);
|
|
640
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
641
|
+
private permissionsMiddleware;
|
|
642
|
+
private checkPermission;
|
|
643
|
+
}
|
|
644
|
+
declare function requirePermission(permission: string): (c: Context, next: Next) => Promise<void>;
|
|
645
|
+
declare function requireRole(role: string): (c: Context, next: Next) => Promise<void>;
|
|
646
|
+
|
|
647
|
+
declare class ApiKeyStore {
|
|
648
|
+
private config;
|
|
649
|
+
private kernel;
|
|
650
|
+
private staticKeysMap;
|
|
651
|
+
private cache?;
|
|
652
|
+
constructor(config: Required<ApiKeyConfig>, kernel: Kernel);
|
|
653
|
+
private getCache;
|
|
654
|
+
private initializeStaticKeys;
|
|
655
|
+
private generateId;
|
|
656
|
+
private compareKeys;
|
|
657
|
+
private isExpired;
|
|
658
|
+
validate(key: string): Promise<ApiKeyValidationResult>;
|
|
659
|
+
hasScopes(key: ApiKeyMetadata, requiredScopes: string[]): boolean;
|
|
660
|
+
}
|
|
661
|
+
declare module "hono" {
|
|
662
|
+
interface ContextVariableMap {
|
|
663
|
+
apiKey?: ApiKeyMetadata;
|
|
664
|
+
apiKeyScopes?: string[];
|
|
665
|
+
hasScope?: (scope: string) => boolean;
|
|
666
|
+
hasAnyScope?: (...scopes: string[]) => boolean;
|
|
667
|
+
hasAllScopes?: (...scopes: string[]) => boolean;
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
declare class ApiKeyFeature implements Feature {
|
|
671
|
+
name: string;
|
|
672
|
+
private store?;
|
|
673
|
+
private config;
|
|
674
|
+
constructor(config?: ApiKeyConfig);
|
|
675
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
676
|
+
private shouldSkipPath;
|
|
677
|
+
private extractApiKey;
|
|
678
|
+
}
|
|
679
|
+
declare function requireApiKey(): (c: Context, next: Next) => Promise<void>;
|
|
680
|
+
declare function requireScope(...scopes: string[]): (c: Context, next: Next) => Promise<void>;
|
|
681
|
+
|
|
682
|
+
declare module "hono" {
|
|
683
|
+
interface ContextVariableMap {
|
|
684
|
+
csrfToken: string;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
declare class CsrfFeature implements Feature {
|
|
688
|
+
name: string;
|
|
689
|
+
private config;
|
|
690
|
+
constructor(config: CsrfConfig);
|
|
691
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
692
|
+
private middleware;
|
|
693
|
+
private validateToken;
|
|
694
|
+
}
|
|
695
|
+
declare function requireCsrf(): (c: Context, next: Next) => Promise<void>;
|
|
696
|
+
|
|
697
|
+
declare module "hono" {
|
|
698
|
+
interface Context {
|
|
699
|
+
valid<T = any>(): T;
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
interface ValidationSchema {
|
|
703
|
+
params?: z.ZodSchema<any>;
|
|
704
|
+
query?: z.ZodSchema<any>;
|
|
705
|
+
body?: z.ZodSchema<any>;
|
|
706
|
+
}
|
|
707
|
+
interface ValidationOptions {
|
|
708
|
+
logErrors?: boolean;
|
|
709
|
+
status?: number;
|
|
710
|
+
}
|
|
711
|
+
declare function createValidationMiddleware(schema: ValidationSchema, options?: ValidationOptions): (c: Context, next: Next) => Promise<(Response & hono.TypedResponse<{
|
|
712
|
+
success: false;
|
|
713
|
+
error: string;
|
|
714
|
+
code?: string | undefined;
|
|
715
|
+
details?: hono_utils_types.JSONValue | undefined;
|
|
716
|
+
timestamp?: string | undefined;
|
|
717
|
+
}, any, "json">) | undefined>;
|
|
718
|
+
declare class ValidationFeature implements Feature {
|
|
719
|
+
name: string;
|
|
720
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
declare module "hono" {
|
|
724
|
+
interface Hono {
|
|
725
|
+
getJsonValidated(path: string, schema: JsonValidationSchema, handler: Handler, options?: JsonValidationOptions): Hono;
|
|
726
|
+
postJsonValidated(path: string, schema: JsonValidationSchema, handler: Handler, options?: JsonValidationOptions): Hono;
|
|
727
|
+
putJsonValidated(path: string, schema: JsonValidationSchema, handler: Handler, options?: JsonValidationOptions): Hono;
|
|
728
|
+
deleteJsonValidated(path: string, schema: JsonValidationSchema, handler: Handler, options?: JsonValidationOptions): Hono;
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
interface JsonValidationSchema {
|
|
732
|
+
params?: Record<string, unknown>;
|
|
733
|
+
query?: Record<string, unknown>;
|
|
734
|
+
body?: Record<string, unknown>;
|
|
735
|
+
}
|
|
736
|
+
interface JsonValidationOptions {
|
|
737
|
+
logErrors?: boolean;
|
|
738
|
+
status?: number;
|
|
739
|
+
allErrors?: boolean;
|
|
740
|
+
coerceTypes?: boolean;
|
|
741
|
+
}
|
|
742
|
+
interface FormattedValidationErrors {
|
|
743
|
+
fields: Record<string, string[]>;
|
|
744
|
+
errors: string[];
|
|
745
|
+
}
|
|
746
|
+
declare function formatAjvErrors(errors: ErrorObject[] | null | undefined): FormattedValidationErrors;
|
|
747
|
+
declare function createJsonSchemaValidationMiddleware(schema: JsonValidationSchema, options?: JsonValidationOptions): (c: Context, next: Next) => Promise<(Response & hono.TypedResponse<{
|
|
748
|
+
success: false;
|
|
749
|
+
error: string;
|
|
750
|
+
code?: string | undefined;
|
|
751
|
+
details?: hono_utils_types.JSONValue | undefined;
|
|
752
|
+
timestamp?: string | undefined;
|
|
753
|
+
}, any, "json">) | undefined>;
|
|
754
|
+
declare class JsonSchemaValidationFeature implements Feature {
|
|
755
|
+
name: string;
|
|
756
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
declare class OpenAPIFeature implements Feature {
|
|
760
|
+
name: string;
|
|
761
|
+
private app?;
|
|
762
|
+
private config;
|
|
763
|
+
private kernel?;
|
|
764
|
+
private autoGeneratedRoutes;
|
|
765
|
+
private queuedRoutes;
|
|
766
|
+
constructor(config: OpenAPIConfig);
|
|
767
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
768
|
+
addRoute(route: any, handler: Handler): void;
|
|
769
|
+
private processQueuedRoutes;
|
|
770
|
+
routes(app: Hono): void;
|
|
771
|
+
private generateScalarHTML;
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
interface UploadOptions {
|
|
775
|
+
metadata?: Record<string, string>;
|
|
776
|
+
contentType?: string;
|
|
777
|
+
}
|
|
778
|
+
interface UploadResult {
|
|
779
|
+
path: string;
|
|
780
|
+
filename: string;
|
|
781
|
+
size: number;
|
|
782
|
+
uploadedAt: Date;
|
|
783
|
+
}
|
|
784
|
+
declare class UploadHelper {
|
|
785
|
+
private storage;
|
|
786
|
+
private projectName;
|
|
787
|
+
private basePath;
|
|
788
|
+
constructor(storage: BaseStorageAdapter, projectName: string);
|
|
789
|
+
getBasePath(): string;
|
|
790
|
+
private buildPath;
|
|
791
|
+
upload(filename: string, data: Uint8Array | string, subfolder?: string, options?: UploadOptions): Promise<UploadResult>;
|
|
792
|
+
uploadFromRequest(request: Request, fieldName: string, subfolder?: string, options?: UploadOptions): Promise<UploadResult>;
|
|
793
|
+
list(subfolder?: string): Promise<StorageFile[]>;
|
|
794
|
+
get(filename: string, subfolder?: string): Promise<Uint8Array<ArrayBufferLike> | null>;
|
|
795
|
+
delete(filename: string, subfolder?: string): Promise<void>;
|
|
796
|
+
getUrl(filename: string, subfolder?: string, expiresIn?: number): Promise<string>;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
declare module "hono" {
|
|
800
|
+
interface ContextVariableMap {
|
|
801
|
+
upload: UploadHelper;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
declare class UploadFeature implements Feature {
|
|
805
|
+
name: string;
|
|
806
|
+
dependencies: string[];
|
|
807
|
+
private helper?;
|
|
808
|
+
private config;
|
|
809
|
+
constructor(config: UploadConfig);
|
|
810
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
811
|
+
routes(app: Hono): void;
|
|
812
|
+
}
|
|
813
|
+
|
|
814
|
+
interface OtelTracingConfig {
|
|
815
|
+
serviceName: string;
|
|
816
|
+
serviceVersion?: string;
|
|
817
|
+
captureRequestHeaders?: string[];
|
|
818
|
+
captureResponseHeaders?: string[];
|
|
819
|
+
tracerProvider?: any;
|
|
820
|
+
meterProvider?: any;
|
|
821
|
+
tracer?: any;
|
|
822
|
+
spanNameFactory?: (c: any) => string;
|
|
823
|
+
getTime?: () => number;
|
|
824
|
+
}
|
|
825
|
+
declare class OtelTracingFeature implements Feature {
|
|
826
|
+
name: string;
|
|
827
|
+
private config;
|
|
828
|
+
constructor(config: OtelTracingConfig);
|
|
829
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
830
|
+
}
|
|
831
|
+
|
|
832
|
+
interface EmailConfig {
|
|
833
|
+
provider: "smtp" | "sendgrid" | "mock" | "mailgun" | "ses";
|
|
834
|
+
smtp?: {
|
|
835
|
+
host: string;
|
|
836
|
+
port: number;
|
|
837
|
+
username: string;
|
|
838
|
+
password: string;
|
|
839
|
+
secure?: boolean;
|
|
840
|
+
};
|
|
841
|
+
apiKey?: string;
|
|
842
|
+
apiSecret?: string;
|
|
843
|
+
region?: string;
|
|
844
|
+
domain?: string;
|
|
845
|
+
baseUrl?: string;
|
|
846
|
+
from?: {
|
|
847
|
+
name?: string;
|
|
848
|
+
email: string;
|
|
849
|
+
};
|
|
850
|
+
templateDir?: string;
|
|
851
|
+
}
|
|
852
|
+
interface EmailMessage {
|
|
853
|
+
to: string | string[];
|
|
854
|
+
from?: {
|
|
855
|
+
name?: string;
|
|
856
|
+
email: string;
|
|
857
|
+
};
|
|
858
|
+
subject: string;
|
|
859
|
+
text?: string;
|
|
860
|
+
html?: string;
|
|
861
|
+
cc?: string | string[];
|
|
862
|
+
bcc?: string | string[];
|
|
863
|
+
replyTo?: string;
|
|
864
|
+
attachments?: Array<{
|
|
865
|
+
filename: string;
|
|
866
|
+
content: Uint8Array | string;
|
|
867
|
+
contentType?: string;
|
|
868
|
+
}>;
|
|
869
|
+
headers?: Record<string, string>;
|
|
870
|
+
}
|
|
871
|
+
interface TemplateData {
|
|
872
|
+
[key: string]: unknown;
|
|
873
|
+
}
|
|
874
|
+
interface EmailAdapter {
|
|
875
|
+
send(message: EmailMessage): Promise<{
|
|
876
|
+
messageId: string;
|
|
877
|
+
success: boolean;
|
|
878
|
+
}>;
|
|
879
|
+
sendTemplate(templateName: string, to: string | string[], data: TemplateData): Promise<{
|
|
880
|
+
messageId: string;
|
|
881
|
+
success: boolean;
|
|
882
|
+
}>;
|
|
883
|
+
}
|
|
884
|
+
declare class MockEmailAdapter implements EmailAdapter {
|
|
885
|
+
send(message: EmailMessage): Promise<{
|
|
886
|
+
messageId: string;
|
|
887
|
+
success: boolean;
|
|
888
|
+
}>;
|
|
889
|
+
sendTemplate(name: string, to: string | string[], data: TemplateData): Promise<{
|
|
890
|
+
messageId: string;
|
|
891
|
+
success: boolean;
|
|
892
|
+
}>;
|
|
893
|
+
}
|
|
894
|
+
declare module "hono" {
|
|
895
|
+
interface ContextVariableMap {
|
|
896
|
+
email: EmailAdapter;
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
declare class EmailFeature implements Feature {
|
|
900
|
+
private config;
|
|
901
|
+
name: string;
|
|
902
|
+
private adapter?;
|
|
903
|
+
constructor(config: EmailConfig);
|
|
904
|
+
initialize(kernel: Kernel): Promise<void>;
|
|
905
|
+
private createAdapter;
|
|
906
|
+
getAdapter(): EmailAdapter;
|
|
907
|
+
}
|
|
908
|
+
|
|
909
|
+
interface SuccessResponse<T = unknown> {
|
|
910
|
+
success: true;
|
|
911
|
+
data?: T;
|
|
912
|
+
message?: string;
|
|
913
|
+
}
|
|
914
|
+
interface ErrorResponse {
|
|
915
|
+
success: false;
|
|
916
|
+
error: string;
|
|
917
|
+
code?: string;
|
|
918
|
+
details?: unknown;
|
|
919
|
+
timestamp?: string;
|
|
920
|
+
}
|
|
921
|
+
type ApiResponse<T = unknown> = SuccessResponse<T> | ErrorResponse;
|
|
922
|
+
declare function successResponse<T = unknown>(data?: T, message?: string): SuccessResponse<T>;
|
|
923
|
+
declare function errorResponse(error: string | Error, code?: string, details?: unknown): ErrorResponse;
|
|
924
|
+
|
|
925
|
+
declare class HttpError extends IskraError {
|
|
926
|
+
readonly status: number;
|
|
927
|
+
constructor(status: number, message: string, options?: {
|
|
928
|
+
code?: ErrorCode;
|
|
929
|
+
cause?: Error;
|
|
930
|
+
context?: Record<string, unknown>;
|
|
931
|
+
});
|
|
932
|
+
toHTTPException(): HTTPException;
|
|
933
|
+
}
|
|
934
|
+
declare class ValidationError extends HttpError {
|
|
935
|
+
readonly details: unknown;
|
|
936
|
+
constructor(message: string, details?: unknown, options?: {
|
|
937
|
+
cause?: Error;
|
|
938
|
+
context?: Record<string, unknown>;
|
|
939
|
+
});
|
|
940
|
+
}
|
|
941
|
+
declare class AuthError extends HttpError {
|
|
942
|
+
constructor(message?: string, options?: {
|
|
943
|
+
cause?: Error;
|
|
944
|
+
context?: Record<string, unknown>;
|
|
945
|
+
});
|
|
946
|
+
}
|
|
947
|
+
declare class ForbiddenError extends HttpError {
|
|
948
|
+
constructor(message?: string, options?: {
|
|
949
|
+
cause?: Error;
|
|
950
|
+
context?: Record<string, unknown>;
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
declare class NotFoundError extends HttpError {
|
|
954
|
+
constructor(message?: string, options?: {
|
|
955
|
+
cause?: Error;
|
|
956
|
+
context?: Record<string, unknown>;
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
declare class ConflictError extends HttpError {
|
|
960
|
+
constructor(message?: string, options?: {
|
|
961
|
+
cause?: Error;
|
|
962
|
+
context?: Record<string, unknown>;
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
export { type ApiKeyConfig, ApiKeyFeature, type ApiKeyMetadata, ApiKeyStore, type ApiKeyValidationResult, type ApiResponse, type AuthConfig, AuthError, AuthFeature, BaseStorageAdapter, type CacheAdapter, type CacheConfig, CacheFeature, ConflictError, type CorsConfig, CorsFeature, type CsrfConfig, CsrfFeature, type DbConfig, DbFeature, type EmailAdapter, type EmailConfig, EmailFeature, type EmailMessage, type ErrorHandlerConfig, ErrorHandlerFeature, type ErrorResponse, type Feature, ForbiddenError, type FormattedValidationErrors, type HealthCheckConfig, HealthCheckFeature, HttpError, JsonSchemaValidationFeature, type JsonValidationOptions, type JsonValidationSchema, Kernel, type KernelConfig, LocalStorageAdapter, type LoggerConfig, LoggerFeature, MockEmailAdapter, NotFoundError, type OpenAPIConfig, OpenAPIFeature, type OtelTracingConfig, OtelTracingFeature, type PermissionsConfig, PermissionsFeature, type RateLimitConfig, RateLimitFeature, type RequestIdConfig, RequestIdFeature, type Role, type RouteOptions, type SecurityHeadersConfig, type SessionConfig, SessionFeature, type Sink, type StorageConfig, StorageFeature, type StorageFile, type SuccessResponse, type TemplateData, type UploadConfig, UploadFeature, ValidationError, ValidationFeature, type ValidationOptions, type ValidationSchema, type WebContext, WebDriver, WebPlugin, type WebPluginConfig, type WebServerOptions, createHttpError, createJsonSchemaValidationMiddleware, createRouter, createValidationMiddleware, errorResponse, formatAjvErrors, requireApiKey, requireAuth, requireCsrf, requirePermission, requireRole, requireScope, successResponse };
|