@guren/server 1.0.0-rc.9 → 1.0.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/dist/{Application-DtWDHXr1.d.ts → Application-BnsyCKXY.d.ts} +79 -8
- package/dist/AuthManager-SfhCNkAU.d.ts +79 -0
- package/dist/{BroadcastManager-AkIWUGJo.d.ts → BroadcastManager-CGWl9rUO.d.ts} +5 -0
- package/dist/{ConsoleKernel-CqCVrdZs.d.ts → ConsoleKernel-BDtBETjm.d.ts} +1 -1
- package/dist/{Gate-CNkBYf8m.d.ts → Gate-CynjZCtS.d.ts} +5 -0
- package/dist/{I18nManager-Dtgzsf5n.d.ts → I18nManager-BiSoczfV.d.ts} +6 -1
- package/dist/McpServiceProvider-JW6PDVMD.js +7 -0
- package/dist/api-token-BSSCLlFW.d.ts +541 -0
- package/dist/auth/index.d.ts +9 -327
- package/dist/auth/index.js +59 -6684
- package/dist/authorization/index.d.ts +2 -2
- package/dist/authorization/index.js +19 -604
- package/dist/broadcasting/index.d.ts +2 -2
- package/dist/broadcasting/index.js +12 -895
- package/dist/cache/index.js +8 -809
- package/dist/chunk-2T6JN4VR.js +1563 -0
- package/dist/chunk-44F7JQ7I.js +950 -0
- package/dist/chunk-74HTZG3V.js +331 -0
- package/dist/chunk-A3ISJVEV.js +598 -0
- package/dist/chunk-CSDKWLFD.js +652 -0
- package/dist/chunk-CSRQTEQA.js +839 -0
- package/dist/chunk-DAQKYKLH.js +182 -0
- package/dist/chunk-EDRGAM6G.js +647 -0
- package/dist/chunk-EGU5KB7V.js +818 -0
- package/dist/chunk-H32L2NE3.js +372 -0
- package/dist/chunk-HKQSAFSN.js +837 -0
- package/dist/chunk-IOTWFHZU.js +558 -0
- package/dist/chunk-ONSDE37A.js +125 -0
- package/dist/chunk-QQKTH5KX.js +114 -0
- package/dist/chunk-R2TCP7D7.js +409 -0
- package/dist/chunk-SIP34GBE.js +380 -0
- package/dist/chunk-THSX7OOR.js +454 -0
- package/dist/chunk-UY3AZSYL.js +14 -0
- package/dist/chunk-VT5KRDPH.js +134 -0
- package/dist/chunk-VXXZIXAP.js +255 -0
- package/dist/chunk-WJJ5CTNI.js +907 -0
- package/dist/chunk-WVY45EIW.js +359 -0
- package/dist/chunk-ZRBLZY3M.js +462 -0
- package/dist/client-CKXJLsTe.d.ts +232 -0
- package/dist/email-verification-CAeArjui.d.ts +327 -0
- package/dist/encryption/index.js +48 -556
- package/dist/errors-JOOPDDQ6.js +34 -0
- package/dist/events/index.js +14 -316
- package/dist/health/index.js +12 -367
- package/dist/i18n/index.d.ts +2 -2
- package/dist/i18n/index.js +14 -583
- package/dist/index.d.ts +37 -239
- package/dist/index.js +2873 -19166
- package/dist/lambda/index.d.ts +9 -7
- package/dist/lambda/index.js +4 -9
- package/dist/logging/index.js +12 -545
- package/dist/mail/index.d.ts +29 -1
- package/dist/mail/index.js +15 -684
- package/dist/mcp/index.d.ts +7 -5
- package/dist/mcp/index.js +5 -378
- package/dist/notifications/index.d.ts +8 -6
- package/dist/notifications/index.js +13 -730
- package/dist/queue/index.d.ts +37 -7
- package/dist/queue/index.js +22 -940
- package/dist/redis/index.d.ts +366 -0
- package/dist/redis/index.js +597 -0
- package/dist/runtime/index.d.ts +8 -6
- package/dist/runtime/index.js +26 -244
- package/dist/scheduling/index.js +14 -822
- package/dist/storage/index.d.ts +1 -0
- package/dist/storage/index.js +6 -824
- package/package.json +15 -7
- package/dist/api-token-JOif2CtG.d.ts +0 -1792
package/dist/index.d.ts
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
|
-
import { E as ErrorResponse, S as ServiceProvider, C as Container, c as ServiceBindings, Q as QueueManager, N as NotificationManager } from './Application-
|
|
2
|
-
export { A as Application, d as ApplicationListenOptions, e as
|
|
1
|
+
import { E as ErrorResponse, S as ServiceProvider, C as Container, c as ServiceBindings, Q as QueueManager, N as NotificationManager } from './Application-BnsyCKXY.js';
|
|
2
|
+
export { A as Application, d as ApplicationListenOptions, e as ApplicationOptions, f as AuthPayload, g as AuthPluginOptions, h as CSRF_FORM_FIELD, i as CSRF_HEADER_NAME, j as CSRF_TOKEN_KEY, P as ContainerProvider, k as ContextualBinding, m as ContextualBindingBuilder, n as ContextualNeedsBuilder, o as Controller, p as ControllerInertiaProps, q as CsrfOptions, r as DatabaseChannelOptions, t as DatabaseNotification, u as ExceptionClass, v as ExceptionHandler, w as ExceptionHandlerOptions, x as ExceptionRenderer, y as ExceptionReporter, F as FailedJob, H as HostAuthorizationOptions, z as HstsOptions, I as InertiaOptions, B as InertiaPagePayload, J as InertiaResponse, K as InertiaSharedProps, L as InertiaSsrContext, M as InertiaSsrOptions, O as InertiaSsrRenderer, R as InertiaSsrResult, T as InferInertiaProps, U as Job, V as JobClass, W as JobFailureHandler, X as JobHandler, Y as JobOptions, Z as Notifiable, _ as Notification, $ as NotificationAttachment, a0 as NotificationChannel, a1 as NotificationChannelFactory, a2 as NotificationClass, a3 as NotificationMailMessage, a4 as NotificationManagerOptions, a5 as ProviderManager, a6 as QueueConfig, a7 as QueueDriver, a8 as QueueDriverFactory, a9 as QueuedJob, aa as RendererRegistration, ab as ResolvedSharedInertiaProps, ac as ResourceRouteOptions, ad as RouteBuilder, ae as RouteContractOptions, af as RouteDefinition, ag as RouteOpenApiMetadata, ah as RouteResourceAction, ai as Router, aj as SecurityHeadersOptions, ak as SentNotification, al as ServiceBinding, am as ServiceClass, an as ServiceFactory, ao as ServiceProviderClass, ap as ServiceProviderConstructor, aq as ServiceProviderOptions, ar as SharedInertiaPropsResolver, as as SlackAttachment, at as SlackBlock, au as SlackMessage, av as VALIDATED_DATA_KEY, aw as ValidateRequestOptions, ax as ValidationSchema, ay as WorkerOptions, az as abort, aA as abortIf, aB as abortUnless, aC as clearJobRegistry, aD as createApp, aE as createContainer, aF as createCsrfMiddleware, aG as createExceptionHandler, aH as createHostAuthorizationMiddleware, aI as createNotificationManager, aJ as createQueueManager, aK as createSecurityHeaders, aL as csrfField, aM as formatValidationErrors, aN as getContainer, aO as getCsrfToken, aP as getExceptionHandler, aQ as getInertiaSharedPropsResolver, aR as getJob, aS as getNotificationManager, aT as getQueueDriver, aU as getRegisteredJobs, aV as getValidatedData, aW as inertia, aX as parseRequestPayload, aY as registerJob, aZ as resolve, a_ as setContainer, a$ as setExceptionHandler, b0 as setInertiaSharedProps, b1 as setNotificationManager, b2 as setQueueDriver, b3 as shareInertiaProps, b4 as validate, b5 as validateRequest, b6 as validateRequestWith, b7 as validateSafe, b8 as verifyCsrfToken } from './Application-BnsyCKXY.js';
|
|
3
3
|
import * as hono from 'hono';
|
|
4
4
|
import { Context, MiddlewareHandler } from 'hono';
|
|
5
5
|
export { Context } from 'hono';
|
|
6
|
-
import {
|
|
7
|
-
export {
|
|
8
|
-
export { AuthenticatableModel,
|
|
6
|
+
import { P as PasswordHasher } from './AuthManager-SfhCNkAU.js';
|
|
7
|
+
export { A as AuthManager, B as BaseUserProvider, M as ModelUserProvider } from './AuthManager-SfhCNkAU.js';
|
|
8
|
+
export { AuthenticatableModel, NodeHasher, ScryptHasher, SessionGuard } from './auth/index.js';
|
|
9
|
+
export { b as EmailVerificationConfig, a as EmailVerificationToken, c as EmailVerificationTokenResult, E as EmailVerificationTokenStore, M as MemoryEmailVerificationStore, d as MemoryPasswordResetStore, e as PasswordResetConfig, f as PasswordResetTokenResult, P as PasswordResetTokenStore, g as buildPasswordResetUrl, h as buildVerificationUrl, i as completeEmailVerification, j as completePasswordReset, k as createEmailVerificationToken, l as createPasswordResetToken, m as isEmailVerified, p as parsePasswordResetUrl, n as parseVerificationUrl, r as requireVerifiedEmail, v as verifyEmailToken, o as verifyPasswordResetToken } from './email-verification-CAeArjui.js';
|
|
10
|
+
import { g as AuthContext } from './api-token-BSSCLlFW.js';
|
|
11
|
+
export { m as API_TOKEN_KEY, j as ApiToken, i as ApiTokenStore, a as AuthCredentials, c as AuthManagerOptions, A as Authenticatable, B as BearerTokenMiddlewareOptions, n as CreateApiTokenOptions, o as CreateApiTokenResult, e as Guard, d as GuardContext, G as GuardFactory, M as MemoryApiTokenStore, p as MemoryOAuthStateStore, q as MemorySessionStore, r as OAuthAuthorizeOptions, s as OAuthCallbackPayload, l as OAuthManager, t as OAuthManagerOptions, u as OAuthProviderConfig, v as OAuthProviderFactoryInput, w as OAuthStateConfig, k as OAuthStatePayload, O as OAuthStateStore, x as OAuthTokenResult, y as OAuthUserProfile, P as ProviderFactory, z as Session, h as SessionData, S as SessionStore, U as UserProvider, D as buildOAuthAuthorizeUrl, E as buildOAuthRedirectUrl, F as createApiToken, H as createBearerTokenMiddleware, I as createDiscordOAuthProviderConfig, J as createGitHubOAuthProviderConfig, K as createGoogleOAuthProviderConfig, L as createOAuthManager, N as createOAuthState, Q as createSessionMiddleware, R as exchangeOAuthCode, T as fetchOAuthUserProfile, V as getApiToken, W as getApiTokenOrFail, X as getSessionFromContext, Y as getUserApiTokens, Z as parseApiToken, _ as parseOAuthRedirectUrl, $ as revokeAllApiTokens, a0 as revokeApiToken, a1 as tokenCan, a2 as tokenCanAll, a3 as tokenCanAny, a4 as verifyApiToken, a5 as verifyOAuthState } from './api-token-BSSCLlFW.js';
|
|
9
12
|
export { M as Middleware, d as defineMiddleware, j as jsonResponse } from './index-9_Jzj5jo.js';
|
|
10
13
|
import { E as EventManager } from './EventManager-CmIoLt7r.js';
|
|
11
14
|
export { a as Event, b as EventClass, c as EventListener, d as EventSubscription, L as ListenerOptions, R as RegisteredListener, e as createEventManager } from './EventManager-CmIoLt7r.js';
|
|
12
15
|
export { ApplicationShutdown, ApplicationStarted, JobFailed, JobProcessed, Listener, ListenerClass, RequestFinished, RequestReceived, UserAuthenticated, UserLoggedOut } from './events/index.js';
|
|
13
|
-
export { FailedJobHandler, FailedJobInfo, FailedJobReporter, MemoryDriver, RedisDriver, RedisDriverOptions, SqsDriver, Worker, WorkerEvents, createSqsAdapter, processJob } from './queue/index.js';
|
|
16
|
+
export { FailedJobHandler, FailedJobInfo, FailedJobReporter, MemoryDriver, MemoryDriver as MemoryQueueDriver, RedisDriver, RedisDriverOptions, RedisDriver as RedisQueueDriver, SqsDriver, SyncDriver, SyncDriver as SyncQueueDriver, Worker, WorkerEvents, createSqsAdapter, processJob } from './queue/index.js';
|
|
14
17
|
import { M as MailManager } from './MailManager-DpMvYiP9.js';
|
|
15
18
|
export { a as MailAddress, b as MailAttachment, c as MailConfig, d as MailMessage, e as MailTransport, f as MailTransportConfig, g as MailTransportFactory, h as MemoryTransportOptions, R as ResendTransportOptions, S as SendResult, i as SmtpTransportOptions, j as createMailManager } from './MailManager-DpMvYiP9.js';
|
|
16
|
-
export { Mail, MemoryTransport, ResendTransport, SmtpTransport, getMailManager, mail, setMailManager } from './mail/index.js';
|
|
19
|
+
export { LogTransport, Mail, MemoryTransport, ResendTransport, SmtpTransport, getMailManager, mail, setMailManager } from './mail/index.js';
|
|
17
20
|
import { C as CacheManager } from './CacheManager-BkvHEOZX.js';
|
|
18
21
|
export { a as CacheConfig, b as CacheStore, c as CacheStoreFactory, d as createCacheManager } from './CacheManager-BkvHEOZX.js';
|
|
19
22
|
export { FileStore as FileCacheStore, MemoryStore as MemoryCacheStore, RedisStore as RedisCacheStore, TaggedCache } from './cache/index.js';
|
|
@@ -26,24 +29,26 @@ export { getNextOccurrence, getNextOccurrences, isDue, isDueInTimezone, matchesC
|
|
|
26
29
|
import { L as LogManager } from './LogManager-7mxnkaPM.js';
|
|
27
30
|
export { C as ConsoleChannelConfig, D as DailyFileChannelConfig, F as FileChannelConfig, a as LOG_LEVEL_PRIORITY, b as LogChannel, c as LogChannelConfig, d as LogChannelFactory, e as LogConfig, f as LogContext, g as LogEntry, h as LogFormatter, i as LogLevel, j as Logger, k as LoggerOptions, S as StackChannelConfig, l as createLogManager, m as filterSensitiveData, n as getLogManager, s as setLogManager } from './LogManager-7mxnkaPM.js';
|
|
28
31
|
export { ConsoleChannel, DailyFileChannel, FileChannel } from './logging/index.js';
|
|
29
|
-
import { I as I18nManager } from './I18nManager-
|
|
30
|
-
export { a as I18nConfig, P as PluralizationRule, R as ReplacementValues, T as TranslationLoader, b as TranslationLoaderFactory, c as TranslationMessages, d as Translator, e as TranslatorOptions, f as createI18n, g as getI18n, s as setI18n, t, h as tc } from './I18nManager-
|
|
32
|
+
import { I as I18nManager } from './I18nManager-BiSoczfV.js';
|
|
33
|
+
export { a as I18nConfig, P as PluralizationRule, R as ReplacementValues, T as TranslationLoader, b as TranslationLoaderFactory, c as TranslationMessages, d as Translator, e as TranslatorOptions, f as createI18n, g as getI18n, s as setI18n, t, h as tc } from './I18nManager-BiSoczfV.js';
|
|
31
34
|
export { JsonLoader, MemoryLoader, getPluralizationRule, pluralizationRules, selectPluralForm } from './i18n/index.js';
|
|
32
35
|
export { C as CheckResult, a as HealthCheck, b as HealthCheckOptions, H as HealthManager, c as HealthMiddlewareOptions, d as HealthReport, e as HealthStatus, f as createHealthManager } from './HealthManager-DUyMIzsZ.js';
|
|
33
36
|
export { CacheCheck, CacheCheckOptions, CacheStoreInterface, CustomCheck, CustomCheckCallback, DatabaseCheck, DatabaseCheckOptions, DatabaseConnection, MemoryCheck, MemoryCheckOptions, RedisCheck, RedisCheckOptions, RedisClient, StorageCheck, StorageCheckOptions, StorageDriverInterface, customCheck } from './health/index.js';
|
|
34
37
|
export { DatabaseChannel, MailChannel, MailChannelOptions, MemoryChannel, SlackChannel, SlackChannelOptions } from './notifications/index.js';
|
|
35
|
-
import { B as BroadcastManager } from './BroadcastManager-
|
|
36
|
-
export { A as AuthMiddlewareOptions, a as BroadcastDriver, b as BroadcastDriverFactory, c as BroadcastEvent, d as BroadcastManagerOptions, e as BroadcastableEvent, C as Channel, f as ChannelAuthorizer, g as ChannelRegistration, P as PresenceBroadcastDriver, h as PresenceChannel, i as PresenceChannelAuthorizer, j as PresenceMember, k as PrivateChannel, S as SSEClient, l as SSEMiddlewareOptions, W as WebSocketClient, m as createBroadcastManager, n as getBroadcastManager, s as setBroadcastManager } from './BroadcastManager-
|
|
38
|
+
import { B as BroadcastManager } from './BroadcastManager-CGWl9rUO.js';
|
|
39
|
+
export { A as AuthMiddlewareOptions, a as BroadcastDriver, b as BroadcastDriverFactory, c as BroadcastEvent, d as BroadcastManagerOptions, e as BroadcastableEvent, C as Channel, f as ChannelAuthorizer, g as ChannelRegistration, P as PresenceBroadcastDriver, h as PresenceChannel, i as PresenceChannelAuthorizer, j as PresenceMember, k as PrivateChannel, S as SSEClient, l as SSEMiddlewareOptions, W as WebSocketClient, m as createBroadcastManager, n as getBroadcastManager, s as setBroadcastManager } from './BroadcastManager-CGWl9rUO.js';
|
|
37
40
|
export { RedisClient as BroadcastRedisClient, RedisDriverOptions as BroadcastRedisDriverOptions, MemoryDriver as MemoryBroadcastDriver, RedisDriver as RedisBroadcastDriver, createTypedBroadcaster } from './broadcasting/index.js';
|
|
38
|
-
import { I as InputInterface, P as ParsedSignature, O as OptionDefinition, a as CommandInstance, b as OutputInterface } from './ConsoleKernel-
|
|
39
|
-
export { A as ArgumentDefinition, c as CommandClass, C as ConsoleKernel, d as ConsoleKernelOptions, e as ProgressInterface, f as PromptInterface, S as ScheduledCommand, g as createConsoleKernel } from './ConsoleKernel-
|
|
41
|
+
import { I as InputInterface, P as ParsedSignature, O as OptionDefinition, a as CommandInstance, b as OutputInterface } from './ConsoleKernel-BDtBETjm.js';
|
|
42
|
+
export { A as ArgumentDefinition, c as CommandClass, C as ConsoleKernel, d as ConsoleKernelOptions, e as ProgressInterface, f as PromptInterface, S as ScheduledCommand, g as createConsoleKernel } from './ConsoleKernel-BDtBETjm.js';
|
|
40
43
|
import * as readline from 'readline';
|
|
41
|
-
export { R as AuthResponse, A as AuthUser, a as AuthorizationResponse, b as AuthorizeOptions, G as Gate, c as GateCallback, d as GateDefinition, e as GateOptions, P as PolicyClass, f as PolicyInterface, g as PolicyMethod, h as PolicyRegistration, i as ResourceAction, j as ResponseBuilder, k as authorizeAbility, l as can, m as cannot, n as createGate, o as defineGate, p as getGate, s as setGate } from './Gate-
|
|
44
|
+
export { R as AuthResponse, A as AuthUser, a as AuthorizationResponse, b as AuthorizeOptions, G as Gate, c as GateCallback, d as GateDefinition, e as GateOptions, P as PolicyClass, f as PolicyInterface, g as PolicyMethod, h as PolicyRegistration, i as ResourceAction, j as ResponseBuilder, k as authorizeAbility, l as can, m as cannot, n as createGate, o as defineGate, p as getGate, s as setGate } from './Gate-CynjZCtS.js';
|
|
42
45
|
export { AuthorizedContext, Policy, authorizeAllMiddleware, authorizeMiddleware, authorizeResourceMiddleware, definePolicy, withAuthorization } from './authorization/index.js';
|
|
43
46
|
export { A as AppKeyring, D as DecryptOptions, a as EncryptOptions, b as EncryptedPayload, E as Encrypter, c as EncrypterConfig, H as HashAlgorithm, d as HmacOptions, P as PasswordHashOptions, R as RandomStringOptions, e as createEncrypter, f as decrypt, g as deriveAppKey, h as deriveAppKeyring, i as encrypt, j as generateAppKey, k as generateKey, l as getAppKeyringFromEnv, m as getEncrypter, n as normalizeAppKey, p as parseAppKey, o as parsePreviousAppKeys, s as setEncrypter } from './app-key-CsBfRC_Q.js';
|
|
44
47
|
export { MessageSigner, SignMessageOptions, SignedMessageClaims, SignedUrlOptions, VerifySignedMessageOptions, VerifySignedUrlOptions, check as checkHash, generateOtp, generatePassword, generateSlug, hash, hashPassword, hmac, md5, needsRehash, pick, random, randomBase64, randomBase64Url, randomHex, randomInt, randomString, sample, secureCompare, sha256, sha512, shuffle, signUrl, urlSafeToken, uuid, verifyHmac, verifyPassword, verifySignedUrl } from './encryption/index.js';
|
|
45
|
-
|
|
48
|
+
export { M as MemoryRateLimitStore, a as RateLimitEntry, d as RateLimitInfo, e as RateLimitOptions, R as RateLimitStore, S as SlidingWindowRateLimitStore, f as createRateLimitMiddleware, c as createRedisClient, g as getRateLimitInfo, r as resetRateLimit } from './client-CKXJLsTe.js';
|
|
46
49
|
import 'vite';
|
|
50
|
+
import '@guren/orm';
|
|
51
|
+
import 'ioredis';
|
|
47
52
|
|
|
48
53
|
interface RequireAuthOptions {
|
|
49
54
|
redirectTo?: string;
|
|
@@ -55,188 +60,6 @@ declare function attachAuthContext(contextFactory: (ctx: Context) => AuthContext
|
|
|
55
60
|
declare function requireAuthenticated(options?: RequireAuthOptions): MiddlewareHandler;
|
|
56
61
|
declare function requireGuest(options?: RequireAuthOptions): MiddlewareHandler;
|
|
57
62
|
|
|
58
|
-
/**
|
|
59
|
-
* Rate limit entry stored in the backing store.
|
|
60
|
-
*/
|
|
61
|
-
interface RateLimitEntry {
|
|
62
|
-
count: number;
|
|
63
|
-
resetAt: number;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Store interface for rate limit data.
|
|
67
|
-
* Implement this for Redis or database-backed storage.
|
|
68
|
-
*/
|
|
69
|
-
interface RateLimitStore {
|
|
70
|
-
/**
|
|
71
|
-
* Get the current rate limit entry for a key.
|
|
72
|
-
*/
|
|
73
|
-
get(key: string): Promise<RateLimitEntry | null>;
|
|
74
|
-
/**
|
|
75
|
-
* Increment the count for a key and return the new entry.
|
|
76
|
-
* If the key doesn't exist, create it with count=1.
|
|
77
|
-
*/
|
|
78
|
-
increment(key: string, windowMs: number): Promise<RateLimitEntry>;
|
|
79
|
-
/**
|
|
80
|
-
* Reset the count for a key.
|
|
81
|
-
*/
|
|
82
|
-
reset(key: string): Promise<void>;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Base class for in-memory rate limit stores with automatic cleanup.
|
|
86
|
-
*/
|
|
87
|
-
declare abstract class BaseMemoryStore implements RateLimitStore {
|
|
88
|
-
protected cleanupInterval?: ReturnType<typeof setInterval>;
|
|
89
|
-
constructor(cleanupIntervalMs?: number);
|
|
90
|
-
abstract get(key: string): Promise<RateLimitEntry | null>;
|
|
91
|
-
abstract increment(key: string, windowMs: number): Promise<RateLimitEntry>;
|
|
92
|
-
abstract reset(key: string): Promise<void>;
|
|
93
|
-
abstract cleanup(): void;
|
|
94
|
-
abstract clear(): void;
|
|
95
|
-
abstract get size(): number;
|
|
96
|
-
destroy(): void;
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* In-memory rate limit store.
|
|
100
|
-
* Suitable for single-process development, not for production clusters.
|
|
101
|
-
*/
|
|
102
|
-
declare class MemoryRateLimitStore extends BaseMemoryStore {
|
|
103
|
-
private entries;
|
|
104
|
-
get(key: string): Promise<RateLimitEntry | null>;
|
|
105
|
-
increment(key: string, windowMs: number): Promise<RateLimitEntry>;
|
|
106
|
-
reset(key: string): Promise<void>;
|
|
107
|
-
cleanup(): void;
|
|
108
|
-
clear(): void;
|
|
109
|
-
get size(): number;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Configuration options for rate limiting.
|
|
113
|
-
*/
|
|
114
|
-
interface RateLimitOptions {
|
|
115
|
-
/**
|
|
116
|
-
* Maximum number of requests allowed in the time window.
|
|
117
|
-
* @default 100
|
|
118
|
-
*/
|
|
119
|
-
limit?: number;
|
|
120
|
-
/**
|
|
121
|
-
* Time window in milliseconds.
|
|
122
|
-
* @default 60000 (1 minute)
|
|
123
|
-
*/
|
|
124
|
-
windowMs?: number;
|
|
125
|
-
/**
|
|
126
|
-
* Function to extract the rate limit key from the request.
|
|
127
|
-
* Defaults to using the client IP address.
|
|
128
|
-
*/
|
|
129
|
-
keyGenerator?: (ctx: Context) => string | Promise<string>;
|
|
130
|
-
/**
|
|
131
|
-
* Rate limit store implementation.
|
|
132
|
-
* Defaults to in-memory store.
|
|
133
|
-
*/
|
|
134
|
-
store?: RateLimitStore;
|
|
135
|
-
/**
|
|
136
|
-
* Whether to skip rate limiting for certain requests.
|
|
137
|
-
*/
|
|
138
|
-
skip?: (ctx: Context) => boolean | Promise<boolean>;
|
|
139
|
-
/**
|
|
140
|
-
* Custom handler when rate limit is exceeded.
|
|
141
|
-
*/
|
|
142
|
-
onRateLimited?: (ctx: Context, retryAfter: number) => Response | Promise<Response>;
|
|
143
|
-
/**
|
|
144
|
-
* Whether to add rate limit headers to all responses.
|
|
145
|
-
* @default true
|
|
146
|
-
*/
|
|
147
|
-
headers?: boolean;
|
|
148
|
-
/**
|
|
149
|
-
* Custom message when rate limit is exceeded.
|
|
150
|
-
* @default 'Too many requests, please try again later.'
|
|
151
|
-
*/
|
|
152
|
-
message?: string;
|
|
153
|
-
/**
|
|
154
|
-
* HTTP status code when rate limit is exceeded.
|
|
155
|
-
* @default 429
|
|
156
|
-
*/
|
|
157
|
-
statusCode?: number;
|
|
158
|
-
/**
|
|
159
|
-
* Prefix for rate limit keys.
|
|
160
|
-
* @default 'rl:'
|
|
161
|
-
*/
|
|
162
|
-
keyPrefix?: string;
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Create a rate limiting middleware.
|
|
166
|
-
*
|
|
167
|
-
* @example
|
|
168
|
-
* ```ts
|
|
169
|
-
* // Basic usage - 100 requests per minute per IP
|
|
170
|
-
* app.use('*', createRateLimitMiddleware())
|
|
171
|
-
*
|
|
172
|
-
* // Stricter limit for login endpoint
|
|
173
|
-
* router.post('/login', [AuthController, 'login'],
|
|
174
|
-
* createRateLimitMiddleware({
|
|
175
|
-
* limit: 5,
|
|
176
|
-
* windowMs: 15 * 60 * 1000, // 15 minutes
|
|
177
|
-
* })
|
|
178
|
-
* )
|
|
179
|
-
*
|
|
180
|
-
* // Custom key based on authenticated user
|
|
181
|
-
* app.use('/api/*', createRateLimitMiddleware({
|
|
182
|
-
* limit: 1000,
|
|
183
|
-
* windowMs: 60 * 60 * 1000, // 1 hour
|
|
184
|
-
* keyGenerator: async (ctx) => {
|
|
185
|
-
* const user = await ctx.get('user')
|
|
186
|
-
* return user?.id?.toString() ?? defaultKeyGenerator(ctx)
|
|
187
|
-
* },
|
|
188
|
-
* }))
|
|
189
|
-
* ```
|
|
190
|
-
*/
|
|
191
|
-
declare function createRateLimitMiddleware(options?: RateLimitOptions): MiddlewareHandler;
|
|
192
|
-
/**
|
|
193
|
-
* Rate limit result information.
|
|
194
|
-
*/
|
|
195
|
-
interface RateLimitInfo {
|
|
196
|
-
limit: number;
|
|
197
|
-
remaining: number;
|
|
198
|
-
resetAt: Date;
|
|
199
|
-
isLimited: boolean;
|
|
200
|
-
}
|
|
201
|
-
/**
|
|
202
|
-
* Get rate limit information for a key without incrementing.
|
|
203
|
-
*
|
|
204
|
-
* @example
|
|
205
|
-
* ```ts
|
|
206
|
-
* const info = await getRateLimitInfo('user:123', store, { limit: 100 })
|
|
207
|
-
* console.log(`${info.remaining} requests remaining`)
|
|
208
|
-
* ```
|
|
209
|
-
*/
|
|
210
|
-
declare function getRateLimitInfo(key: string, store: RateLimitStore, options?: {
|
|
211
|
-
limit: number;
|
|
212
|
-
keyPrefix?: string;
|
|
213
|
-
}): Promise<RateLimitInfo>;
|
|
214
|
-
/**
|
|
215
|
-
* Reset rate limit for a specific key.
|
|
216
|
-
*
|
|
217
|
-
* @example
|
|
218
|
-
* ```ts
|
|
219
|
-
* // Reset rate limit after successful captcha
|
|
220
|
-
* await resetRateLimit(clientIp, store)
|
|
221
|
-
* ```
|
|
222
|
-
*/
|
|
223
|
-
declare function resetRateLimit(key: string, store: RateLimitStore, options?: {
|
|
224
|
-
keyPrefix?: string;
|
|
225
|
-
}): Promise<void>;
|
|
226
|
-
/**
|
|
227
|
-
* Sliding window rate limit store.
|
|
228
|
-
* More accurate than fixed window but uses more memory.
|
|
229
|
-
*/
|
|
230
|
-
declare class SlidingWindowRateLimitStore extends BaseMemoryStore {
|
|
231
|
-
private requests;
|
|
232
|
-
get(key: string): Promise<RateLimitEntry | null>;
|
|
233
|
-
increment(key: string, windowMs: number): Promise<RateLimitEntry>;
|
|
234
|
-
reset(key: string): Promise<void>;
|
|
235
|
-
cleanup(): void;
|
|
236
|
-
clear(): void;
|
|
237
|
-
get size(): number;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
63
|
interface CspDirectives {
|
|
241
64
|
defaultSrc?: string[];
|
|
242
65
|
scriptSrc?: string[];
|
|
@@ -732,11 +555,6 @@ declare class MethodNotAllowedException extends HttpException {
|
|
|
732
555
|
static forMethod(method: string, allowedMethods: string[]): MethodNotAllowedException;
|
|
733
556
|
}
|
|
734
557
|
|
|
735
|
-
/**
|
|
736
|
-
* Generate a production-friendly HTML error page.
|
|
737
|
-
* Shows status code, a generic message, and a link back to the home page.
|
|
738
|
-
* No stack traces or internal details are exposed.
|
|
739
|
-
*/
|
|
740
558
|
declare function renderErrorPage(statusCode: number, message?: string): string;
|
|
741
559
|
|
|
742
560
|
type ViewRenderer = (template: string, props: Record<string, unknown>) => Response | Promise<Response>;
|
|
@@ -868,7 +686,9 @@ declare class SchedulingServiceProvider extends ServiceProvider {
|
|
|
868
686
|
}
|
|
869
687
|
|
|
870
688
|
/**
|
|
871
|
-
* Binds the Gate as a singleton in the container
|
|
689
|
+
* Binds the Gate as a singleton in the container and exposes it as the
|
|
690
|
+
* global gate so `getGate()`, `can()`, and controller authorization helpers
|
|
691
|
+
* work without manual wiring.
|
|
872
692
|
*/
|
|
873
693
|
declare class AuthorizationServiceProvider extends ServiceProvider {
|
|
874
694
|
register(): void;
|
|
@@ -1014,6 +834,10 @@ interface FileLike {
|
|
|
1014
834
|
* // data is typed as StorePostData
|
|
1015
835
|
* ```
|
|
1016
836
|
*/
|
|
837
|
+
/**
|
|
838
|
+
* @deprecated Legacy compatibility layer — prefer schema-first validation
|
|
839
|
+
* via `this.validateBody()` / `validateQuery()` / `validateParams()`.
|
|
840
|
+
*/
|
|
1017
841
|
declare abstract class FormRequest<T = Record<string, unknown>> {
|
|
1018
842
|
protected ctx: Context;
|
|
1019
843
|
/**
|
|
@@ -2293,10 +2117,6 @@ declare abstract class Command implements CommandInstance {
|
|
|
2293
2117
|
* Call another command.
|
|
2294
2118
|
*/
|
|
2295
2119
|
call(command: string, args?: string[]): Promise<number>;
|
|
2296
|
-
/**
|
|
2297
|
-
* Call another command silently.
|
|
2298
|
-
*/
|
|
2299
|
-
callSilent(command: string, args?: string[]): Promise<number>;
|
|
2300
2120
|
/**
|
|
2301
2121
|
* Resolve a service from the container.
|
|
2302
2122
|
*/
|
|
@@ -2642,38 +2462,16 @@ declare function renderDebugPage(error: Error, request?: Request): string;
|
|
|
2642
2462
|
declare function debugErrorMiddleware(): MiddlewareHandler;
|
|
2643
2463
|
|
|
2644
2464
|
/**
|
|
2645
|
-
*
|
|
2465
|
+
* Runtime-detecting password hasher: uses Bun's native scrypt implementation
|
|
2466
|
+
* when running on Bun, and the Node.js crypto implementation otherwise
|
|
2467
|
+
* (e.g. AWS Lambda on the Node runtime). This is the hasher behind the
|
|
2468
|
+
* `Hash` export, so code written against `Hash` runs on both runtimes.
|
|
2646
2469
|
*/
|
|
2647
|
-
|
|
2648
|
-
|
|
2649
|
-
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
url?: string;
|
|
2653
|
-
/**
|
|
2654
|
-
* Key prefix for all operations.
|
|
2655
|
-
* @default ''
|
|
2656
|
-
*/
|
|
2657
|
-
keyPrefix?: string;
|
|
2470
|
+
declare class DefaultHasher implements PasswordHasher {
|
|
2471
|
+
private readonly delegate;
|
|
2472
|
+
constructor();
|
|
2473
|
+
hash(plain: string): Promise<string>;
|
|
2474
|
+
verify(hashed: string, plain: string): Promise<boolean>;
|
|
2658
2475
|
}
|
|
2659
|
-
/**
|
|
2660
|
-
* Create a Redis client with the given options.
|
|
2661
|
-
*
|
|
2662
|
-
* @example
|
|
2663
|
-
* ```ts
|
|
2664
|
-
* // Using URL
|
|
2665
|
-
* const redis = createRedisClient({ url: 'redis://localhost:6379' })
|
|
2666
|
-
*
|
|
2667
|
-
* // Using host/port
|
|
2668
|
-
* const redis = createRedisClient({ host: 'localhost', port: 6379 })
|
|
2669
|
-
*
|
|
2670
|
-
* // With key prefix
|
|
2671
|
-
* const redis = createRedisClient({
|
|
2672
|
-
* url: process.env.REDIS_URL,
|
|
2673
|
-
* keyPrefix: 'myapp:',
|
|
2674
|
-
* })
|
|
2675
|
-
* ```
|
|
2676
|
-
*/
|
|
2677
|
-
declare function createRedisClient(options?: RedisClientOptions): Redis;
|
|
2678
2476
|
|
|
2679
|
-
export { AUTH_CONTEXT_KEY, AuthContext, AuthContext as AuthRuntimeContext, AuthServiceProvider, AuthenticationException, AuthorizationException, AuthorizationServiceProvider, AutoDiscovery, BaseFactory, type BaseResource, BaseSeeder, BroadcastManager, BroadcastServiceProvider, BufferedOutput, CSP_NONCE_KEY, CacheManager, CacheServiceProvider, Command, CommandInstance, Container, type CorsOptions, type CspDirectives, type CspOptions, type CursorPaginatedResponse, type CursorPaginationMeta, CursorPaginator, type CursorPaginatorOptions, type DiscoveryOptions, type DiscoveryResult, EncryptionServiceProvider, ErrorResponse, ErrorServiceProvider, EventManager, EventServiceProvider, BaseFactory as Factory, type FactoryClass, type Factory as FactoryInterface, FieldValidator, type FileLike, type FileValidationOptions, type ForceHttpsOptions, FormRequest, HealthServiceProvider, HttpException, I18nManager, I18nServiceProvider, type ImageValidationOptions, InertiaServiceProvider, type InferResourceData, Input, InputInterface, JsonResource, LogManager, LogServiceProvider, MailManager, MailServiceProvider,
|
|
2477
|
+
export { AUTH_CONTEXT_KEY, AuthContext, AuthContext as AuthRuntimeContext, AuthServiceProvider, AuthenticationException, AuthorizationException, AuthorizationServiceProvider, AutoDiscovery, BaseFactory, type BaseResource, BaseSeeder, BroadcastManager, BroadcastServiceProvider, BufferedOutput, CSP_NONCE_KEY, CacheManager, CacheServiceProvider, Command, CommandInstance, Container, type CorsOptions, type CspDirectives, type CspOptions, type CursorPaginatedResponse, type CursorPaginationMeta, CursorPaginator, type CursorPaginatorOptions, DefaultHasher, type DiscoveryOptions, type DiscoveryResult, EncryptionServiceProvider, ErrorResponse, ErrorServiceProvider, EventManager, EventServiceProvider, BaseFactory as Factory, type FactoryClass, type Factory as FactoryInterface, FieldValidator, type FileLike, type FileValidationOptions, type ForceHttpsOptions, FormRequest, DefaultHasher as Hash, HealthServiceProvider, HttpException, I18nManager, I18nServiceProvider, type ImageValidationOptions, InertiaServiceProvider, type InferResourceData, Input, InputInterface, JsonResource, LogManager, LogServiceProvider, MailManager, MailServiceProvider, MethodNotAllowedException, NotFoundHttpException, NotificationManager, NotificationServiceProvider, OAuthServiceProvider, OptionDefinition, Output, OutputInterface, type PaginatedPageProps, type PaginatedResponse, type PaginatedResultLike, type PaginationLinks, type PaginationMeta, type PaginationPageLink, Paginator, type PaginatorOptions, ParsedSignature, QueueManager, QueueServiceProvider, type RedirectSafetyOptions, type RequireAuthOptions, Resource, type ResourceClass, ResourceCollection, type ResourceData, type RuleDefinition, Scheduler, SchedulingServiceProvider, BaseSeeder as Seeder, type SeederClass, type Seeder as SeederInterface, SeederRunner, type SeederRunnerOptions, ServiceBindings, ServiceProvider, StorageManager, StorageServiceProvider, type ValidationErrors, ValidationException, type ValidationResult, type ValidationRule, Validator, type ValidatorOptions, ViewEngine, after, afterOrEqual, alpha, alphaDash, alphaNum, array as arrayRule, attachAuthContext, before, beforeOrEqual, between, boolean as booleanRule, collect, confirmed, createCorsMiddleware, createCspMiddleware, createFacade, createFacades, createForceHttpsMiddleware, createRedirectSafetyMiddleware, createSeederRunner, createValidator, cursorPaginate, custom, dateFormat, date as dateRule, debugErrorMiddleware, decodeCursor, defineFactory, different, email as emailRule, encodeCursor, endsWith, exists, file as fileRule, getCspNonce, image as imageRule, inValues, integer, ip, ipv4, ipv6, isSafeRedirectUrl, json as jsonRule, max, maxFileSize, mimes, min, minFileSize, notIn, nullable, numeric, object as objectRule, paginate, parseSignature, quickValidate, quickValidateOrThrow, regex, renderDebugPage, renderErrorPage, requestIdMiddleware, requestLoggingMiddleware, requireAuthenticated, requireGuest, required, requiredIf, requiredUnless, requiredWith, requiredWithout, resetCalledSeeders, same, size, startsWith, string as stringRule, unique, url as urlRule, uuid as uuidRule };
|