@guren/server 1.2.0 → 1.4.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-DN9Ndl37.d.ts → Application-BvBqgc2k.d.ts} +204 -22
- package/dist/{AuthManager-SfhCNkAU.d.ts → AuthManager-C84xF5ks.d.ts} +1 -1
- package/dist/{BroadcastManager-CGWl9rUO.d.ts → BroadcastManager-D8KoJxiV.d.ts} +21 -0
- package/dist/{CacheManager-BkvHEOZX.d.ts → CacheManager-BmDzUKrF.d.ts} +17 -0
- package/dist/{ConsoleKernel-DxmUxdAz.d.ts → ConsoleKernel-Dw9X9qZY.d.ts} +1 -1
- package/dist/{I18nManager-BiSoczfV.d.ts → I18nManager-CmUqj6bU.d.ts} +1 -1
- package/dist/{McpServiceProvider-JW6PDVMD.js → McpServiceProvider-TZWQWXCT.js} +2 -2
- package/dist/{Scheduler-BstvSca7.d.ts → Scheduler-pZiT8i57.d.ts} +2 -0
- package/dist/{api-token-BSSCLlFW.d.ts → api-token-COQHXyM_.d.ts} +123 -1
- package/dist/auth/index.d.ts +5 -5
- package/dist/auth/index.js +3 -1
- package/dist/authorization/index.js +2 -2
- package/dist/broadcasting/index.d.ts +2 -2
- package/dist/broadcasting/index.js +2 -1
- package/dist/cache/index.d.ts +2 -2
- package/dist/cache/index.js +2 -1
- package/dist/{chunk-EGU5KB7V.js → chunk-4SBGSJNT.js} +31 -1
- package/dist/{chunk-THSX7OOR.js → chunk-63SKW5PS.js} +3 -0
- package/dist/{chunk-2T6JN4VR.js → chunk-AUXQISW5.js} +169 -14
- package/dist/chunk-DCYKSYAT.js +63 -0
- package/dist/{chunk-ZRBLZY3M.js → chunk-FZD2AKJI.js} +1 -1
- package/dist/{chunk-HLXL2AYJ.js → chunk-JIT7QVMJ.js} +2 -2
- package/dist/{chunk-HKQSAFSN.js → chunk-MC752CQT.js} +15 -0
- package/dist/{chunk-WVY45EIW.js → chunk-NQCZQAJL.js} +93 -28
- package/dist/{chunk-VT5KRDPH.js → chunk-NYQGAWDN.js} +49 -1
- package/dist/{chunk-44F7JQ7I.js → chunk-XMQZENBP.js} +35 -1
- package/dist/{client-CKXJLsTe.d.ts → client-BQwF2b9Y.d.ts} +7 -0
- package/dist/{email-verification-CAeArjui.d.ts → email-verification-H_WlpsVH.d.ts} +1 -1
- package/dist/{errors-JOOPDDQ6.js → errors-PUNHAFL2.js} +1 -1
- package/dist/i18n/index.d.ts +2 -2
- package/dist/index.d.ts +129 -19
- package/dist/index.js +314 -105
- package/dist/lambda/index.d.ts +8 -8
- package/dist/mcp/index.d.ts +54 -20
- package/dist/mcp/index.js +2 -2
- package/dist/notifications/index.d.ts +8 -8
- package/dist/queue/index.d.ts +8 -8
- package/dist/redis/index.d.ts +11 -21
- package/dist/redis/index.js +42 -6
- package/dist/runtime/index.d.ts +8 -8
- package/dist/runtime/index.js +1 -1
- package/dist/scheduling/index.d.ts +2 -2
- package/dist/scheduling/index.js +2 -1
- package/package.json +2 -2
|
@@ -45,6 +45,11 @@ var ProviderManager = class {
|
|
|
45
45
|
);
|
|
46
46
|
}
|
|
47
47
|
const provider = providerOrClass instanceof ServiceProvider ? providerOrClass : new providerOrClass(this.container);
|
|
48
|
+
if (provider.isDeferred() && provider.provides().length === 0) {
|
|
49
|
+
throw new Error(
|
|
50
|
+
`Deferred provider "${provider.constructor.name}" must declare at least one service in "provides", otherwise it can never be loaded.`
|
|
51
|
+
);
|
|
52
|
+
}
|
|
48
53
|
if (provider.isDeferred()) {
|
|
49
54
|
for (const service of provider.provides()) {
|
|
50
55
|
this.deferredProviders.set(service, provider);
|
|
@@ -128,7 +133,50 @@ var ProviderManager = class {
|
|
|
128
133
|
}
|
|
129
134
|
};
|
|
130
135
|
|
|
136
|
+
// src/mcp/endpoint.ts
|
|
137
|
+
var MCP_ENDPOINT_PATH = "/_guren/mcp";
|
|
138
|
+
function isMcpEndpointEnabled() {
|
|
139
|
+
return typeof process !== "undefined" && process.env?.NODE_ENV !== "production" && process.env?.GUREN_MCP === "1";
|
|
140
|
+
}
|
|
141
|
+
var LOOPBACK_HOSTNAMES = /* @__PURE__ */ new Set(["localhost", "[::1]"]);
|
|
142
|
+
var LOOPBACK_IPV4 = /^127\.\d+\.\d+\.\d+$/;
|
|
143
|
+
function isLoopbackOrigin(origin) {
|
|
144
|
+
try {
|
|
145
|
+
const { hostname } = new URL(origin);
|
|
146
|
+
return LOOPBACK_HOSTNAMES.has(hostname) || LOOPBACK_IPV4.test(hostname);
|
|
147
|
+
} catch {
|
|
148
|
+
return false;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function isLoopbackAddress(address) {
|
|
152
|
+
const normalized = address.startsWith("::ffff:") ? address.slice("::ffff:".length) : address;
|
|
153
|
+
return normalized === "::1" || LOOPBACK_IPV4.test(normalized);
|
|
154
|
+
}
|
|
155
|
+
function clientAddress(ctx) {
|
|
156
|
+
const env = ctx.env;
|
|
157
|
+
if (typeof env?.server?.requestIP !== "function") {
|
|
158
|
+
return void 0;
|
|
159
|
+
}
|
|
160
|
+
return env.server.requestIP(ctx.req.raw)?.address;
|
|
161
|
+
}
|
|
162
|
+
function createMcpAccessGuard() {
|
|
163
|
+
return async (ctx, next) => {
|
|
164
|
+
const origin = ctx.req.header("origin");
|
|
165
|
+
if (origin !== void 0 && !isLoopbackOrigin(origin)) {
|
|
166
|
+
return ctx.json({ message: "Forbidden: cross-origin request to the MCP endpoint" }, 403);
|
|
167
|
+
}
|
|
168
|
+
const address = clientAddress(ctx);
|
|
169
|
+
if (address !== void 0 && !isLoopbackAddress(address)) {
|
|
170
|
+
return ctx.json({ message: "Forbidden: remote request to the MCP endpoint" }, 403);
|
|
171
|
+
}
|
|
172
|
+
await next();
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
|
|
131
176
|
export {
|
|
132
177
|
ServiceProvider,
|
|
133
|
-
ProviderManager
|
|
178
|
+
ProviderManager,
|
|
179
|
+
MCP_ENDPOINT_PATH,
|
|
180
|
+
isMcpEndpointEnabled,
|
|
181
|
+
createMcpAccessGuard
|
|
134
182
|
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
claimHotDisposable,
|
|
3
|
+
isHotReloadRuntime
|
|
4
|
+
} from "./chunk-DCYKSYAT.js";
|
|
5
|
+
|
|
1
6
|
// src/broadcasting/channels/Channel.ts
|
|
2
7
|
var Channel = class {
|
|
3
8
|
constructor(name, driver) {
|
|
@@ -884,6 +889,28 @@ data: ${JSON.stringify(data)}
|
|
|
884
889
|
getChannelClients(channel) {
|
|
885
890
|
return this.getClients().filter((client) => client.channels.has(channel));
|
|
886
891
|
}
|
|
892
|
+
/**
|
|
893
|
+
* Close every SSE connection this manager is holding.
|
|
894
|
+
*
|
|
895
|
+
* Each connection owns a ping timer that is only cleared when the stream is
|
|
896
|
+
* cancelled or the request aborts. `Bun.serve().stop()` without forcing waits
|
|
897
|
+
* for in-flight requests instead of cutting them, and an SSE response never
|
|
898
|
+
* finishes — so on a hot reload those connections outlive the manager, and
|
|
899
|
+
* their timers go on pinging a stream nobody reads.
|
|
900
|
+
*
|
|
901
|
+
* `getClients()` returns a snapshot. A `Map` iterator does tolerate an entry
|
|
902
|
+
* deleting itself, which is all `cleanup()` does today — but not a `close()`
|
|
903
|
+
* that reaches another client, which would drop that one from the iteration
|
|
904
|
+
* unvisited and leave its timer running.
|
|
905
|
+
*/
|
|
906
|
+
disconnectAll() {
|
|
907
|
+
for (const client of this.getClients()) {
|
|
908
|
+
try {
|
|
909
|
+
client.close();
|
|
910
|
+
} catch {
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
887
914
|
/**
|
|
888
915
|
* Generate a unique client ID.
|
|
889
916
|
*/
|
|
@@ -904,7 +931,14 @@ function getBroadcastManager() {
|
|
|
904
931
|
return globalBroadcastManager;
|
|
905
932
|
}
|
|
906
933
|
function createBroadcastManager(options) {
|
|
907
|
-
|
|
934
|
+
const manager = new BroadcastManager(options);
|
|
935
|
+
claimHotDisposable(
|
|
936
|
+
"broadcast-manager",
|
|
937
|
+
isHotReloadRuntime() ? new Error().stack : void 0,
|
|
938
|
+
options?.default ?? "memory",
|
|
939
|
+
() => manager.disconnectAll()
|
|
940
|
+
);
|
|
941
|
+
return manager;
|
|
908
942
|
}
|
|
909
943
|
|
|
910
944
|
// src/broadcasting/typed.ts
|
|
@@ -32,6 +32,13 @@ interface RateLimitStore {
|
|
|
32
32
|
*/
|
|
33
33
|
declare abstract class BaseMemoryStore implements RateLimitStore {
|
|
34
34
|
protected cleanupInterval?: ReturnType<typeof setInterval>;
|
|
35
|
+
/**
|
|
36
|
+
* This store's claim on its hot-reload slot, if it holds one.
|
|
37
|
+
*
|
|
38
|
+
* Unlike the cache sweep, this interval is not `unref()`ed, so a leaked one
|
|
39
|
+
* both duplicates work and keeps the process alive on its own.
|
|
40
|
+
*/
|
|
41
|
+
private readonly hotReloadClaim;
|
|
35
42
|
constructor(cleanupIntervalMs?: number);
|
|
36
43
|
abstract get(key: string): Promise<RateLimitEntry | null>;
|
|
37
44
|
abstract increment(key: string, windowMs: number): Promise<RateLimitEntry>;
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { P as PluralizationRule,
|
|
2
|
-
export { a as I18nConfig, I as I18nManager, R as ReplacementValues,
|
|
1
|
+
import { P as PluralizationRule, b as TranslationLoader, d as TranslationMessages } from '../I18nManager-CmUqj6bU.js';
|
|
2
|
+
export { a as I18nConfig, I as I18nManager, R as ReplacementValues, c as TranslationLoaderFactory, T as Translator, e as TranslatorOptions, f as createI18n, g as getI18n, s as setI18n, t, h as tc } from '../I18nManager-CmUqj6bU.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Default pluralization rules for common languages.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { E as ErrorResponse,
|
|
2
|
-
export { A as Application,
|
|
1
|
+
import { E as ErrorResponse, C as Container, c as ServiceProviderConstructor, S as ServiceProvider, d as ServiceBindings, Q as QueueManager, N as NotificationManager } from './Application-BvBqgc2k.js';
|
|
2
|
+
export { A as Application, e as ApplicationListenOptions, f as ApplicationOptions, g as AuthPayload, h as AuthPluginOptions, i as CSRF_FORM_FIELD, j as CSRF_HEADER_NAME, k as CSRF_TOKEN_KEY, P as ContainerProvider, m as ContextualBinding, n as ContextualBindingBuilder, o as ContextualNeedsBuilder, p as Controller, q as ControllerInertiaProps, r as CsrfOptions, t as DatabaseChannelOptions, u as DatabaseNotification, v as ExceptionClass, w as ExceptionHandler, x as ExceptionHandlerOptions, y as ExceptionRenderer, z as ExceptionReporter, F as FailedJob, B as GurenModule, H as HostAuthorizationOptions, I as HstsOptions, J as InertiaDocumentContext, K as InertiaDocumentOptions, L as InertiaOptions, M as InertiaPagePayload, O as InertiaResponse, R as InertiaSharedProps, T as InertiaSsrContext, U as InertiaSsrOptions, V as InertiaSsrRenderer, W as InertiaSsrResult, X as InferInertiaProps, Y as Job, Z as JobClass, _ as JobFailureHandler, $ as JobHandler, a0 as JobOptions, a1 as ModuleDefinition, a2 as Notifiable, a3 as Notification, a4 as NotificationAttachment, a5 as NotificationChannel, a6 as NotificationChannelFactory, a7 as NotificationClass, a8 as NotificationMailMessage, a9 as NotificationManagerOptions, aa as ProviderManager, ab as QueueConfig, ac as QueueDriver, ad as QueueDriverFactory, ae as QueuedJob, af as RendererRegistration, ag as ResolvedSharedInertiaProps, ah as ResourceRouteOptions, ai as RouteBuilder, aj as RouteContractOptions, ak as RouteDefinition, al as RouteOpenApiMetadata, am as RouteResourceAction, an as Router, ao as SecurityHeadersOptions, ap as SentNotification, aq as ServiceBinding, ar as ServiceClass, as as ServiceFactory, at as ServiceProviderClass, au as ServiceProviderOptions, av as SharedInertiaPropsResolver, aw as SlackAttachment, ax as SlackBlock, ay as SlackMessage, az as VALIDATED_DATA_KEY, aA as ValidateRequestOptions, aB as ValidationSchema, aC as WorkerOptions, aD as abort, aE as abortIf, aF as abortUnless, aG as clearJobRegistry, aH as createApp, aI as createContainer, aJ as createCsrfMiddleware, aK as createExceptionHandler, aL as createHostAuthorizationMiddleware, aM as createNotificationManager, aN as createQueueManager, aO as createSecurityHeaders, aP as csrfField, aQ as defineModule, aR as formatValidationErrors, aS as getContainer, aT as getCsrfToken, aU as getExceptionHandler, aV as getInertiaSharedPropsResolver, aW as getJob, aX as getNotificationManager, aY as getQueueDriver, aZ as getRegisteredJobs, a_ as getValidatedData, a$ as inertia, b0 as mountModuleRoutes, b1 as parseRequestPayload, b2 as registerJob, b3 as resolve, b4 as setContainer, b5 as setExceptionHandler, b6 as setInertiaDocument, b7 as setInertiaSharedProps, b8 as setInertiaSsrRenderer, b9 as setNotificationManager, ba as setQueueDriver, bb as shareInertiaProps, bc as validate, bd as validateRequest, be as validateRequestWith, bf as validateSafe, bg as verifyCsrfToken } from './Application-BvBqgc2k.js';
|
|
3
3
|
import * as hono from 'hono';
|
|
4
4
|
import { Context, MiddlewareHandler } from 'hono';
|
|
5
5
|
export { Context } from 'hono';
|
|
6
|
-
import { P as PasswordHasher } from './AuthManager-
|
|
7
|
-
export { A as AuthManager, B as BaseUserProvider, M as ModelUserProvider } from './AuthManager-
|
|
6
|
+
import { P as PasswordHasher } from './AuthManager-C84xF5ks.js';
|
|
7
|
+
export { A as AuthManager, B as BaseUserProvider, M as ModelUserProvider } from './AuthManager-C84xF5ks.js';
|
|
8
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-
|
|
10
|
-
import { g as AuthContext } from './api-token-
|
|
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,
|
|
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-H_WlpsVH.js';
|
|
10
|
+
import { g as AuthContext } from './api-token-COQHXyM_.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, D as DefaultSanitizedKeys, e as Guard, d as GuardContext, G as GuardFactory, M as MemoryApiTokenStore, p as MemoryOAuthStateStore, q as MemorySessionStore, r as OAuthAuthorizeOptions, s as OAuthCallbackPayload, t as OAuthFallbackEmail, l as OAuthManager, u as OAuthManagerOptions, v as OAuthProviderConfig, w as OAuthProviderFactoryInput, x as OAuthStateConfig, k as OAuthStatePayload, O as OAuthStateStore, y as OAuthTokenResult, z as OAuthUserProfile, P as ProviderFactory, E as Sanitized, F as Session, h as SessionData, S as SessionStore, U as UserProvider, H as buildOAuthAuthorizeUrl, I as buildOAuthRedirectUrl, J as createApiToken, K as createBearerTokenMiddleware, L as createDiscordOAuthProviderConfig, N as createGitHubOAuthProviderConfig, Q as createGoogleOAuthProviderConfig, R as createOAuthManager, T as createOAuthState, V as createSessionMiddleware, W as exchangeOAuthCode, X as fetchOAuthUserProfile, Y as getApiToken, Z as getApiTokenOrFail, _ as getSessionFromContext, $ as getUserApiTokens, a0 as parseApiToken, a1 as parseOAuthRedirectUrl, a2 as revokeAllApiTokens, a3 as revokeApiToken, a4 as sanitizeOAuthRedirect, a5 as tokenCan, a6 as tokenCanAll, a7 as tokenCanAny, a8 as verifyApiToken, a9 as verifyOAuthState } from './api-token-COQHXyM_.js';
|
|
12
12
|
export { M as Middleware, d as defineMiddleware, j as jsonResponse } from './index-9_Jzj5jo.js';
|
|
13
13
|
import { E as EventManager } from './EventManager-CmIoLt7r.js';
|
|
14
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';
|
|
@@ -17,35 +17,35 @@ export { FailedJobHandler, FailedJobInfo, FailedJobReporter, MemoryDriver, Memor
|
|
|
17
17
|
import { M as MailManager } from './MailManager-DpMvYiP9.js';
|
|
18
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';
|
|
19
19
|
export { LogTransport, Mail, MemoryTransport, ResendTransport, SmtpTransport, getMailManager, mail, setMailManager } from './mail/index.js';
|
|
20
|
-
import { C as CacheManager } from './CacheManager-
|
|
21
|
-
export { a as CacheConfig, b as CacheStore, c as CacheStoreFactory, d as createCacheManager } from './CacheManager-
|
|
20
|
+
import { C as CacheManager } from './CacheManager-BmDzUKrF.js';
|
|
21
|
+
export { a as CacheConfig, b as CacheStore, c as CacheStoreFactory, d as createCacheManager } from './CacheManager-BmDzUKrF.js';
|
|
22
22
|
export { FileStore as FileCacheStore, MemoryStore as MemoryCacheStore, RedisStore as RedisCacheStore, TaggedCache } from './cache/index.js';
|
|
23
23
|
import { S as StorageManager } from './StorageManager-oZTHqaza.js';
|
|
24
24
|
export { D as DiskConfig, F as FileMetadata, P as PutOptions, a as StorageConfig, b as StorageDriver, c as StorageDriverFactory, d as createStorageManager } from './StorageManager-oZTHqaza.js';
|
|
25
25
|
export { LocalDriver as LocalStorageDriver, MemoryDriver as MemoryStorageDriver, S3Driver } from './storage/index.js';
|
|
26
|
-
import { S as Scheduler } from './Scheduler-
|
|
27
|
-
export { P as ParsedCron, a as PendingSchedule, b as Schedule, J as ScheduledJobClass, c as ScheduledTask, d as SchedulerOptions, T as TaskCallback, e as TaskDefinition, f as createScheduler } from './Scheduler-
|
|
26
|
+
import { S as Scheduler } from './Scheduler-pZiT8i57.js';
|
|
27
|
+
export { P as ParsedCron, a as PendingSchedule, b as Schedule, J as ScheduledJobClass, c as ScheduledTask, d as SchedulerOptions, T as TaskCallback, e as TaskDefinition, f as createScheduler } from './Scheduler-pZiT8i57.js';
|
|
28
28
|
export { getNextOccurrence, getNextOccurrences, isDue, isDueInTimezone, matchesCron, parseCron, toTimezone } from './scheduling/index.js';
|
|
29
29
|
import { L as LogManager } from './LogManager-7mxnkaPM.js';
|
|
30
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';
|
|
31
31
|
export { ConsoleChannel, DailyFileChannel, FileChannel } from './logging/index.js';
|
|
32
|
-
import { I as I18nManager } from './I18nManager-
|
|
33
|
-
export { a as I18nConfig, P as PluralizationRule, R as ReplacementValues,
|
|
32
|
+
import { I as I18nManager, T as Translator } from './I18nManager-CmUqj6bU.js';
|
|
33
|
+
export { a as I18nConfig, P as PluralizationRule, R as ReplacementValues, b as TranslationLoader, c as TranslationLoaderFactory, d as TranslationMessages, e as TranslatorOptions, f as createI18n, g as getI18n, s as setI18n, t, h as tc } from './I18nManager-CmUqj6bU.js';
|
|
34
34
|
export { JsonLoader, MemoryLoader, getPluralizationRule, pluralizationRules, selectPluralForm } from './i18n/index.js';
|
|
35
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';
|
|
36
36
|
export { CacheCheck, CacheCheckOptions, CacheStoreInterface, CustomCheck, CustomCheckCallback, DatabaseCheck, DatabaseCheckOptions, DatabaseConnection, MemoryCheck, MemoryCheckOptions, RedisCheck, RedisCheckOptions, RedisClient, StorageCheck, StorageCheckOptions, StorageDriverInterface, customCheck } from './health/index.js';
|
|
37
37
|
export { DatabaseChannel, MailChannel, MailChannelOptions, MemoryChannel, SlackChannel, SlackChannelOptions } from './notifications/index.js';
|
|
38
|
-
import { B as BroadcastManager } from './BroadcastManager-
|
|
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-
|
|
38
|
+
import { B as BroadcastManager } from './BroadcastManager-D8KoJxiV.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-D8KoJxiV.js';
|
|
40
40
|
export { RedisClient as BroadcastRedisClient, RedisDriverOptions as BroadcastRedisDriverOptions, MemoryDriver as MemoryBroadcastDriver, RedisDriver as RedisBroadcastDriver, createTypedBroadcaster } from './broadcasting/index.js';
|
|
41
|
-
import { I as InputInterface, P as ParsedSignature, O as OptionDefinition, a as CommandInstance, b as OutputInterface } from './ConsoleKernel-
|
|
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-
|
|
41
|
+
import { I as InputInterface, P as ParsedSignature, O as OptionDefinition, a as CommandInstance, b as OutputInterface } from './ConsoleKernel-Dw9X9qZY.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-Dw9X9qZY.js';
|
|
43
43
|
import * as readline from 'readline';
|
|
44
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';
|
|
45
45
|
export { AuthorizedContext, Policy, authorizeAllMiddleware, authorizeMiddleware, authorizeResourceMiddleware, definePolicy, withAuthorization } from './authorization/index.js';
|
|
46
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';
|
|
47
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';
|
|
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-
|
|
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-BQwF2b9Y.js';
|
|
49
49
|
import 'vite';
|
|
50
50
|
import '@guren/orm';
|
|
51
51
|
import 'ioredis';
|
|
@@ -259,6 +259,55 @@ declare function requestIdMiddleware(): hono.MiddlewareHandler<{
|
|
|
259
259
|
*/
|
|
260
260
|
declare function requestLoggingMiddleware(): hono.MiddlewareHandler<any, string, {}, Response>;
|
|
261
261
|
|
|
262
|
+
/** Context key for the resolved request locale (read by Inertia for `<html lang>`). */
|
|
263
|
+
declare const LOCALE_CONTEXT_KEY = "locale";
|
|
264
|
+
type LocaleSource = 'query' | 'cookie' | 'header';
|
|
265
|
+
/** Context variables set by {@link detectLocaleMiddleware}, for typing Hono apps. */
|
|
266
|
+
type DetectLocaleVariables = {
|
|
267
|
+
locale: string;
|
|
268
|
+
t?: Translator['t'];
|
|
269
|
+
tc?: Translator['tc'];
|
|
270
|
+
};
|
|
271
|
+
interface DetectLocaleOptions {
|
|
272
|
+
/** Locales the app supports. Detection only ever resolves to one of these. */
|
|
273
|
+
supported: readonly string[];
|
|
274
|
+
/** Locale used when no source matches (defaults to the first supported locale). */
|
|
275
|
+
fallback?: string;
|
|
276
|
+
/** Detection order (defaults to `['query', 'cookie', 'header']`). */
|
|
277
|
+
sources?: readonly LocaleSource[];
|
|
278
|
+
/** Query parameter to read (defaults to `locale`). */
|
|
279
|
+
queryParam?: string;
|
|
280
|
+
/** Cookie to read (defaults to `locale`). */
|
|
281
|
+
cookieName?: string;
|
|
282
|
+
/**
|
|
283
|
+
* i18n manager used to bind request-scoped `t`/`tc` translator helpers.
|
|
284
|
+
* Defaults to the global manager when one was registered via `setI18n()`;
|
|
285
|
+
* pass a manager explicitly (e.g. `app.container.make('i18n')`), or `false`
|
|
286
|
+
* to skip the translator binding entirely.
|
|
287
|
+
*/
|
|
288
|
+
i18n?: I18nManager | false;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Middleware that resolves the request locale from the query string, a cookie,
|
|
292
|
+
* or the `Accept-Language` header — in that order by default — restricted to
|
|
293
|
+
* the `supported` allowlist.
|
|
294
|
+
*
|
|
295
|
+
* The result is stored as the `locale` context variable, which Inertia
|
|
296
|
+
* responses pick up for the root `<html lang>` attribute. When an i18n manager
|
|
297
|
+
* is available (see the `i18n` option), request-scoped `t`/`tc` translator
|
|
298
|
+
* helpers are attached as well.
|
|
299
|
+
*
|
|
300
|
+
* @example
|
|
301
|
+
* ```ts
|
|
302
|
+
* import { detectLocaleMiddleware } from '@guren/core'
|
|
303
|
+
*
|
|
304
|
+
* app.use('*', detectLocaleMiddleware({ supported: ['en', 'ja'] }))
|
|
305
|
+
* ```
|
|
306
|
+
*/
|
|
307
|
+
declare function detectLocaleMiddleware(options: DetectLocaleOptions): hono.MiddlewareHandler<{
|
|
308
|
+
Variables: DetectLocaleVariables;
|
|
309
|
+
}, string, {}, Response>;
|
|
310
|
+
|
|
262
311
|
/**
|
|
263
312
|
* Base HTTP exception class.
|
|
264
313
|
*
|
|
@@ -557,6 +606,67 @@ declare class MethodNotAllowedException extends HttpException {
|
|
|
557
606
|
|
|
558
607
|
declare function renderErrorPage(statusCode: number, message?: string): string;
|
|
559
608
|
|
|
609
|
+
/**
|
|
610
|
+
* Declarative definition of a plugin's lifecycle hooks.
|
|
611
|
+
*
|
|
612
|
+
* `register` and `boot` mirror the ServiceProvider hooks and receive the
|
|
613
|
+
* container plus the configuration captured by the plugin factory.
|
|
614
|
+
*/
|
|
615
|
+
interface PluginDefinition<TConfig = void> {
|
|
616
|
+
/**
|
|
617
|
+
* Diagnostic name for the plugin (e.g. 'analytics').
|
|
618
|
+
* Used to derive the generated provider class name.
|
|
619
|
+
*/
|
|
620
|
+
name: string;
|
|
621
|
+
/**
|
|
622
|
+
* Register services into the container.
|
|
623
|
+
* Called before any provider has booted.
|
|
624
|
+
*/
|
|
625
|
+
register(container: Container, config: TConfig): void | Promise<void>;
|
|
626
|
+
/**
|
|
627
|
+
* Bootstrap after all providers have registered.
|
|
628
|
+
*/
|
|
629
|
+
boot?(container: Container, config: TConfig): void | Promise<void>;
|
|
630
|
+
/**
|
|
631
|
+
* Defer instantiation until one of the `provides` services is resolved.
|
|
632
|
+
* Maps to `ServiceProvider.deferred`.
|
|
633
|
+
*/
|
|
634
|
+
deferred?: boolean;
|
|
635
|
+
/**
|
|
636
|
+
* Services bound by this plugin (required when `deferred` is true).
|
|
637
|
+
* Maps to `ServiceProvider.provides`.
|
|
638
|
+
*/
|
|
639
|
+
provides?: string[];
|
|
640
|
+
}
|
|
641
|
+
/**
|
|
642
|
+
* A factory returned by `definePlugin()`. Each call produces an independent
|
|
643
|
+
* ServiceProvider subclass with the given configuration captured in a closure.
|
|
644
|
+
*/
|
|
645
|
+
type PluginFactory<TConfig = void> = (config: TConfig) => ServiceProviderConstructor;
|
|
646
|
+
/**
|
|
647
|
+
* Define a configurable Guren plugin without ServiceProvider boilerplate.
|
|
648
|
+
*
|
|
649
|
+
* Unlike storing configuration on a static class property, each factory call
|
|
650
|
+
* returns a fresh provider class, so the same plugin can be registered twice
|
|
651
|
+
* with different configurations.
|
|
652
|
+
*
|
|
653
|
+
* @example
|
|
654
|
+
* ```typescript
|
|
655
|
+
* export const analyticsPlugin = definePlugin<AnalyticsConfig>({
|
|
656
|
+
* name: 'analytics',
|
|
657
|
+
* register(container, config) {
|
|
658
|
+
* container.singleton('analytics', () => new AnalyticsClient(config))
|
|
659
|
+
* },
|
|
660
|
+
* })
|
|
661
|
+
*
|
|
662
|
+
* // In the application:
|
|
663
|
+
* createApp({
|
|
664
|
+
* providers: [analyticsPlugin({ apiKey: process.env.ANALYTICS_API_KEY! })],
|
|
665
|
+
* })
|
|
666
|
+
* ```
|
|
667
|
+
*/
|
|
668
|
+
declare function definePlugin<TConfig = void>(definition: PluginDefinition<TConfig>): PluginFactory<TConfig>;
|
|
669
|
+
|
|
560
670
|
type ViewRenderer = (template: string, props: Record<string, unknown>) => Response | Promise<Response>;
|
|
561
671
|
/**
|
|
562
672
|
* Registry for view renderers. Engines are typically registered via service
|
|
@@ -2474,4 +2584,4 @@ declare class DefaultHasher implements PasswordHasher {
|
|
|
2474
2584
|
verify(hashed: string, plain: string): Promise<boolean>;
|
|
2475
2585
|
}
|
|
2476
2586
|
|
|
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 };
|
|
2587
|
+
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 DetectLocaleOptions, type DetectLocaleVariables, 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, LOCALE_CONTEXT_KEY, type LocaleSource, 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, type PluginDefinition, type PluginFactory, 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, ServiceProviderConstructor, StorageManager, StorageServiceProvider, Translator, 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, definePlugin, detectLocaleMiddleware, 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 };
|