@guren/server 2.26.0 → 2.27.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/{DocsViewerServiceProvider-CIRNHQ2I.js → DocsViewerServiceProvider-BMbcTYVw.js} +1 -1
- package/dist/{McpServiceProvider-B-LioPSz.js → McpServiceProvider-PGFPlYTy.js} +1 -1
- package/dist/{Resource-gki0_2B6.js → Resource-q3tJpJ0K.js} +22 -17
- package/dist/{ServiceProvider-DDW3MqQJ.js → ServiceProvider-G0YclITd.js} +60 -8
- package/dist/agent/dispatch.d.ts +4 -4
- package/dist/agent/public.js +1 -1
- package/dist/agent-request-Caj6bnbj.js +18 -0
- package/dist/auth/AuthManager.d.ts +4 -0
- package/dist/auth/email-verification.d.ts +2 -1
- package/dist/auth/index.js +1 -1
- package/dist/auth/password/describe-hasher.d.ts +11 -0
- package/dist/{auth-DiyWALZT.js → auth-DIugW0O-.js} +70 -4
- package/dist/authorization/index.js +1 -1
- package/dist/authorization/middleware.d.ts +8 -0
- package/dist/{authorization-E6X6Y-B6.js → authorization-Daa6CxCg.js} +16 -1
- package/dist/broadcasting/BroadcastManager.d.ts +23 -6
- package/dist/broadcasting/index.d.ts +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/broadcasting/types.d.ts +13 -1
- package/dist/{broadcasting-D0vMkKcq.js → broadcasting-N4cRV42s.js} +204 -33
- package/dist/cache/CacheManager.d.ts +5 -0
- package/dist/cache/TaggedCache.d.ts +2 -0
- package/dist/cache/index.js +1 -1
- package/dist/cache/pending-computations.d.ts +22 -0
- package/dist/cache/stores/FileStore.d.ts +1 -1
- package/dist/cache/stores/file-lock.d.ts +1 -0
- package/dist/{cache-DcnRufMe.js → cache-BlXopnH1.js} +179 -39
- package/dist/container/ServiceProvider.d.ts +27 -2
- package/dist/container/defineModule.d.ts +4 -5
- package/dist/container/definePlugin.d.ts +2 -0
- package/dist/dev-banner-CfQDnkfQ.js +51 -0
- package/dist/{dispatch-BAwzftws.js → dispatch-ENWpBxbE.js} +26 -4
- package/dist/driver-map-CkQc52j-.js +12 -0
- package/dist/host-port-t6wQFaRu.js +15 -0
- package/dist/hot-reload/testing.d.ts +2 -1
- package/dist/http/Application.d.ts +19 -1
- package/dist/http/dev-banner.d.ts +0 -8
- package/dist/http/host-port.d.ts +8 -0
- package/dist/http/middleware/force-https.d.ts +2 -1
- package/dist/http/middleware/index.d.ts +1 -0
- package/dist/http/middleware/session-manager.d.ts +5 -0
- package/dist/http/middleware/websocket-origin.d.ts +22 -0
- package/dist/http/public-assets.d.ts +6 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +694 -234
- package/dist/internal/agent-request.d.ts +18 -0
- package/dist/internal/dispatched-request.d.ts +4 -0
- package/dist/internal/testing.js +2 -2
- package/dist/internal/zod-json-schema.js +1 -1
- package/dist/introspection/driver-map.d.ts +3 -0
- package/dist/introspection/flag.d.ts +12 -0
- package/dist/introspection/manifest.d.ts +17 -0
- package/dist/introspection/plain-json.d.ts +7 -0
- package/dist/introspection/types.d.ts +167 -0
- package/dist/mcp/index.js +1 -1
- package/dist/mvc/Router.d.ts +33 -0
- package/dist/providers/ConfigServiceProvider.d.ts +7 -0
- package/dist/queue/QueueManager.d.ts +3 -0
- package/dist/queue/index.js +1 -1
- package/dist/{queue-Bo4Q857L.js → queue-C8s3buYz.js} +5 -0
- package/dist/runtime/index.js +15 -2
- package/dist/storage/StorageManager.d.ts +5 -0
- package/dist/storage/index.js +1 -1
- package/dist/{storage-wFsUJHZW.js → storage-IlUesK2t.js} +13 -1
- package/dist/{vite-manifest-DlU94f3Z.js → vite-manifest-wPxfAzjW.js} +1 -57
- package/package.json +2 -2
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A wildcard bind answers on every interface but is not itself dialable on
|
|
3
|
+
* every platform. The dev banner and `Application.listen()`'s returned address
|
|
4
|
+
* both render this fact.
|
|
5
|
+
*/
|
|
6
|
+
export declare function isWildcardHost(hostname: string): boolean;
|
|
7
|
+
/** `host:port`, bracketing an IPv6 literal so the result is dialable. */
|
|
8
|
+
export declare function formatHostPort(hostname: string, port: number): string;
|
|
@@ -11,6 +11,7 @@ export interface ForceHttpsOptions {
|
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
13
|
* Redirects HTTP to HTTPS and sets Strict-Transport-Security. Equivalent to
|
|
14
|
-
* Rails' `force_ssl`.
|
|
14
|
+
* Rails' `force_ssl`. An agent tool call the dispatcher re-enters in process
|
|
15
|
+
* passes through.
|
|
15
16
|
*/
|
|
16
17
|
export declare function createForceHttpsMiddleware(options?: ForceHttpsOptions): MiddlewareHandler;
|
|
@@ -18,6 +18,7 @@ export { createSecurityHeaders, type SecurityHeadersOptions, type HstsOptions, }
|
|
|
18
18
|
export { createCspMiddleware, getCspNonce, CSP_NONCE_KEY, type CspOptions, type CspDirectives, } from './csp.js';
|
|
19
19
|
export { createHostAuthorizationMiddleware, type HostAuthorizationOptions, } from './host-authorization.js';
|
|
20
20
|
export { createCorsMiddleware, type CorsOptions, } from './cors.js';
|
|
21
|
+
export { createWebSocketOriginGuard, type WebSocketOriginOptions, } from './websocket-origin.js';
|
|
21
22
|
export { createRedirectSafetyMiddleware, isSafeRedirectUrl, type RedirectSafetyOptions, } from './redirect-safety.js';
|
|
22
23
|
export { createForceHttpsMiddleware, type ForceHttpsOptions, } from './force-https.js';
|
|
23
24
|
export { requestIdMiddleware } from './request-id.js';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type SessionCookieOptions, type SessionStore } from './session.js';
|
|
2
|
+
import type { SessionEntry } from '../../introspection/types.js';
|
|
2
3
|
export interface MemorySessionDriverOptions {
|
|
3
4
|
/** Clock for expiry, injectable for tests. @default Date.now */
|
|
4
5
|
now?: () => number;
|
|
@@ -48,6 +49,8 @@ export declare const PER_PROCESS_SESSION_DRIVERS: ReadonlySet<string>;
|
|
|
48
49
|
* manifest instead, and a name in neither is unverifiable, not absent.
|
|
49
50
|
*/
|
|
50
51
|
export declare const BUILT_IN_SESSION_DRIVERS: ReadonlyMap<string, boolean>;
|
|
52
|
+
/** Null for a driver outside {@link BUILT_IN_SESSION_DRIVERS}: a plugin's `gurenPlugin` manifest says which it is. */
|
|
53
|
+
export declare function sessionDriverIsPerProcess(driver: string): boolean | null;
|
|
51
54
|
/** Cookie and TTL settings plus the named stores one of which is the default. */
|
|
52
55
|
export interface SessionConfig extends SessionCookieOptions {
|
|
53
56
|
/** @default 'memory' */
|
|
@@ -82,6 +85,8 @@ export declare class SessionManager {
|
|
|
82
85
|
registerDriver<K extends keyof SessionDrivers>(name: K, factory: SessionDriverFactory<SessionDrivers[K]>): void;
|
|
83
86
|
registerDriver(name: string, factory: SessionDriverFactory): void;
|
|
84
87
|
getStoreNames(): string[];
|
|
88
|
+
/** The declared stores and the default, building none of them (RFC 0026 §1). */
|
|
89
|
+
describe(): Omit<SessionEntry, 'source'>;
|
|
85
90
|
/**
|
|
86
91
|
* Sweep expired sessions from the default store and from any other store
|
|
87
92
|
* already built, on stores that support it (`deleteExpired`). Stores that
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The check against Cross-Site WebSocket Hijacking. CORS does not cover a
|
|
3
|
+
* WebSocket handshake and the browser sends the app's cookies with it, so a page
|
|
4
|
+
* on another site could open a socket as the signed-in user. The browser sets
|
|
5
|
+
* both `Origin` and `Host`, and a page elsewhere cannot make them agree.
|
|
6
|
+
*/
|
|
7
|
+
import type { Context, MiddlewareHandler } from 'hono';
|
|
8
|
+
export interface WebSocketOriginOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Origins that may open a socket besides the request's own host, such as
|
|
11
|
+
* `https://app.example.com` behind a proxy that rewrites `Host`.
|
|
12
|
+
*/
|
|
13
|
+
allowedOrigins?: string[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Hosts are compared, not schemes: TLS usually ends at a proxy, so the app sees
|
|
17
|
+
* `http:`. No `Origin` is not a browser and carries no ambient cookies; `null`
|
|
18
|
+
* (sandboxed frames, file://) fails to parse and is refused.
|
|
19
|
+
*/
|
|
20
|
+
export declare function webSocketOriginCheck(allowedOrigins?: string[]): (ctx: Context) => boolean;
|
|
21
|
+
/** Refuses, with 403, a request whose `Origin` is neither the app's own host nor listed. */
|
|
22
|
+
export declare function createWebSocketOriginGuard(options?: WebSocketOriginOptions): MiddlewareHandler;
|
|
@@ -5,7 +5,12 @@ import type { Application } from './Application.js';
|
|
|
5
5
|
* extending it — an app that wants one more extension spreads this rather
|
|
6
6
|
* than restating it, so additions here reach it.
|
|
7
7
|
*/
|
|
8
|
-
export declare const DEFAULT_ROOT_PUBLIC_ASSET_EXTENSIONS: readonly ['.svg', '.png', '.jpg', '.jpeg', '.gif', '.ico', '.webp', '.avif', '.webmanifest', '.txt'];
|
|
8
|
+
export declare const DEFAULT_ROOT_PUBLIC_ASSET_EXTENSIONS: readonly ['.svg', '.png', '.jpg', '.jpeg', '.gif', '.ico', '.webp', '.avif', '.webmanifest', '.txt', '.woff2', '.woff', '.ttf', '.otf'];
|
|
9
|
+
/**
|
|
10
|
+
* Must give each extension the media type Hono's `getMimeType` does
|
|
11
|
+
* (`public-assets.test.ts`): `serveStatic` types the same file under `/public/*`.
|
|
12
|
+
*/
|
|
13
|
+
export declare const DEFAULT_CONTENT_TYPES: Readonly<Record<string, string>>;
|
|
9
14
|
export type RootPublicAssetsConfig = boolean | RootPublicAssetsOptions;
|
|
10
15
|
export interface RootPublicAssetsOptions {
|
|
11
16
|
/** Enable or disable root-level public asset serving. Defaults to true. */
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export { ambientBinding, ambientContainer, defaultApplication, defaultContainer,
|
|
|
3
3
|
export { CONTAINER_CONTEXT_KEY, getRequestContainer, tryGetRequestContainer } from './http/request-container.js';
|
|
4
4
|
export type { RequestContextLike } from './http/request-container.js';
|
|
5
5
|
export type { Context, ApplicationListenOptions, ListenAddress, ServiceProviderConstructor, } from './http/Application.js';
|
|
6
|
+
export { isIntrospecting } from './introspection/flag.js';
|
|
7
|
+
export type { AppManifest, AttachmentsDescription, AttachmentsEntry, AuthEntry, AuthProviderEntry, ControllerRef, DriverMapEntry, JsonSchema, ManifestWarning, MiddlewareEntry, ModuleEntry, ProviderEntry, ProviderRegisterOutcome, ProviderSource, RouteEntry, RouteSchemaEntry, SessionEntry, SessionStoreEntry, } from './introspection/types.js';
|
|
6
8
|
export { parseRequestPayload, formatValidationErrors } from './http/request.js';
|
|
7
9
|
export { Controller } from './mvc/Controller.js';
|
|
8
10
|
export type { InertiaResponse, InferInertiaProps, ControllerInertiaProps, AuthPayload } from './mvc/Controller.js';
|
|
@@ -55,9 +57,9 @@ export { InertiaServiceProvider, AuthServiceProvider, OAuthServiceProvider, Even
|
|
|
55
57
|
export { FormRequest } from './http/FormRequest.js';
|
|
56
58
|
export { AuthManager, SessionGuard, TokenGuard, ModelUserProvider, BaseUserProvider, AuthenticatableModel, Argon2Hasher, ScryptHasher, createPasswordResetToken, verifyPasswordResetToken, completePasswordReset, buildPasswordResetUrl, parsePasswordResetUrl, MemoryPasswordResetStore, createEmailVerificationToken, verifyEmailToken, completeEmailVerification, buildVerificationUrl, parseVerificationUrl, isEmailVerified, requireVerifiedEmail, MemoryEmailVerificationStore, createApiToken, parseApiToken, readBearerToken, verifyApiToken, tokenCan, tokenCanAll, tokenCanAny, revokeApiToken, revokeAllApiTokens, getUserApiTokens, createBearerTokenMiddleware, getApiToken, getApiTokenOrFail, MemoryApiTokenStore, API_TOKEN_KEY, OAuthManager, MemoryOAuthStateStore, createOAuthManager, createOAuthState, verifyOAuthState, sanitizeOAuthRedirect, OAUTH_SESSION_BINDING_KEY, buildOAuthAuthorizeUrl, exchangeOAuthCode, fetchOAuthUserProfile, createGitHubOAuthProviderConfig, createGoogleOAuthProviderConfig, createDiscordOAuthProviderConfig, buildOAuthRedirectUrl, parseOAuthRedirectUrl, } from './auth/index.js';
|
|
57
59
|
export type { AuthContext as AuthRuntimeContext, AuthCredentials, AuthManagerOptions, Authenticatable, Guard, GuardContext, GuardFactory, UserProvider, ProviderFactory, DefaultSanitizedKeys, Sanitized, PasswordResetConfig, PasswordResetTokenStore, PasswordResetTokenResult, EmailVerificationConfig, EmailVerificationTokenStore, EmailVerificationToken, EmailVerificationTokenResult, ApiToken, ApiTokenGuardOptions, ApiTokenStore, CreateApiTokenOptions, CreateApiTokenResult, BearerTokenMiddlewareOptions, VerifiedApiToken, TokenGuardOptions, OAuthProviderConfig, OAuthTokenResult, OAuthUserProfile, OAuthFallbackEmail, OAuthStatePayload, OAuthStateStore, OAuthStateConfig, OAuthAuthorizeOptions, OAuthCallbackPayload, OAuthManagerOptions, OAuthProviderFactoryInput, OAuthBindingSession, } from './auth/index.js';
|
|
58
|
-
export { defineMiddleware, jsonResponse, createSessionMiddleware, MemorySessionStore, SessionManager, CookieSessionStore, DEFAULT_SESSION_STORE_NAME, BUILT_IN_SESSION_DRIVERS, PER_PROCESS_SESSION_DRIVERS, getSessionFromContext, requireAuthenticated, requireGuest, attachAuthContext, createCsrfMiddleware, getCsrfToken, csrfField, verifyCsrfToken, CSRF_TOKEN_KEY, CSRF_HEADER_NAME, CSRF_FORM_FIELD, validateRequest, validateRequestWith, getValidatedData, validate, validateSafe, VALIDATED_DATA_KEY, createRateLimitMiddleware, getRateLimitInfo, resetRateLimit, MemoryRateLimitStore, SlidingWindowRateLimitStore, createSecurityHeaders, createCspMiddleware, getCspNonce, CSP_NONCE_KEY, createHostAuthorizationMiddleware, createCorsMiddleware, createRedirectSafetyMiddleware, isSafeRedirectUrl, createForceHttpsMiddleware, requestIdMiddleware, requestLoggingMiddleware, detectLocaleMiddleware, LOCALE_CONTEXT_KEY, getRequestLocale, getRequestTranslator, } from './http/middleware/index.js';
|
|
60
|
+
export { defineMiddleware, jsonResponse, createSessionMiddleware, MemorySessionStore, SessionManager, CookieSessionStore, DEFAULT_SESSION_STORE_NAME, BUILT_IN_SESSION_DRIVERS, PER_PROCESS_SESSION_DRIVERS, getSessionFromContext, requireAuthenticated, requireGuest, attachAuthContext, createCsrfMiddleware, getCsrfToken, csrfField, verifyCsrfToken, CSRF_TOKEN_KEY, CSRF_HEADER_NAME, CSRF_FORM_FIELD, validateRequest, validateRequestWith, getValidatedData, validate, validateSafe, VALIDATED_DATA_KEY, createRateLimitMiddleware, getRateLimitInfo, resetRateLimit, MemoryRateLimitStore, SlidingWindowRateLimitStore, createSecurityHeaders, createCspMiddleware, getCspNonce, CSP_NONCE_KEY, createHostAuthorizationMiddleware, createCorsMiddleware, createWebSocketOriginGuard, createRedirectSafetyMiddleware, isSafeRedirectUrl, createForceHttpsMiddleware, requestIdMiddleware, requestLoggingMiddleware, detectLocaleMiddleware, LOCALE_CONTEXT_KEY, getRequestLocale, getRequestTranslator, } from './http/middleware/index.js';
|
|
59
61
|
export { AUTH_CONTEXT_KEY } from './http/middleware/auth.js';
|
|
60
|
-
export type { Middleware, Session, SessionData, SessionStore, SessionConfig, SessionDrivers, SessionStoreConfig, SessionDriverFactory, SessionCookieOptions, SessionInlineCodec, CookieSessionStoreOptions, CookieSessionDriverOptions, MemorySessionDriverOptions, RedisSessionDriverOptions, AuthContext, RequireAuthOptions, CsrfOptions, CookielessAuthEndpoints, ValidationSchema, ValidateRequestOptions, RateLimitOptions, RateLimitStore, RateLimitEntry, RateLimitInfo, SecurityHeadersOptions, HstsOptions, CspOptions, CspDirectives, HostAuthorizationOptions, CorsOptions, RedirectSafetyOptions, ForceHttpsOptions, DetectLocaleOptions, DetectLocaleVariables, TranslatorBinding, LocaleSource, } from './http/middleware/index.js';
|
|
62
|
+
export type { Middleware, Session, SessionData, SessionStore, SessionConfig, SessionDrivers, SessionStoreConfig, SessionDriverFactory, SessionCookieOptions, SessionInlineCodec, CookieSessionStoreOptions, CookieSessionDriverOptions, MemorySessionDriverOptions, RedisSessionDriverOptions, AuthContext, RequireAuthOptions, CsrfOptions, CookielessAuthEndpoints, ValidationSchema, ValidateRequestOptions, RateLimitOptions, RateLimitStore, RateLimitEntry, RateLimitInfo, SecurityHeadersOptions, HstsOptions, CspOptions, CspDirectives, HostAuthorizationOptions, CorsOptions, WebSocketOriginOptions, RedirectSafetyOptions, ForceHttpsOptions, DetectLocaleOptions, DetectLocaleVariables, TranslatorBinding, LocaleSource, } from './http/middleware/index.js';
|
|
61
63
|
export { Validator, FieldValidator, createValidator, quickValidate, quickValidateOrThrow, required, nullable, requiredIf, requiredUnless, requiredWith, requiredWithout, string as stringRule, numeric, integer, boolean as booleanRule, array as arrayRule, object as objectRule, email as emailRule, url as urlRule, uuid as uuidRule, ip, ipv4, ipv6, json as jsonRule, alpha, alphaNum, alphaDash, regex, min, max, between, size, inValues, notIn, confirmed, same, different, date as dateRule, dateFormat, after, afterOrEqual, before, beforeOrEqual, startsWith, endsWith, file as fileRule, image as imageRule, mimes, maxFileSize, minFileSize, custom, unique, exists, } from './http/validation/index.js';
|
|
62
64
|
export type { ValidationRule, RuleDefinition, ValidationResult, FileValidationOptions, ImageValidationOptions, ValidatorOptions, FileLike, } from './http/validation/index.js';
|
|
63
65
|
export { Event, EventManager, createEventManager, createQueueEventDispatcher, Listener, RequestReceived, RequestFinished, UserAuthenticated, UserLoggedOut, JobProcessed, JobFailed, ApplicationStarted, ApplicationShutdown, } from './events/index.js';
|
|
@@ -85,7 +87,7 @@ export type { HealthStatus, CheckResult, HealthReport, HealthCheckOptions, Healt
|
|
|
85
87
|
export { Notification, NotificationManager, createNotificationManager, setNotificationManager, getNotificationManager, MailChannel, DatabaseChannel, SlackChannel, MemoryChannel, registerNotification, getNotification, clearNotificationRegistry, resolveNotifiableType, } from './notifications/index.js';
|
|
86
88
|
export type { NotificationConstructor, NotificationChannel, Notifiable, DatabaseNotification, NotificationMailMessage, NotificationAttachment, SlackMessage, SlackBlock, SlackAttachment, NotificationChannelFactory, NotificationManagerOptions, DatabaseChannelOptions, SentNotification, NotificationClass, MailChannelOptions, SlackChannelOptions, } from './notifications/index.js';
|
|
87
89
|
export { BroadcastManager, createBroadcastManager, setBroadcastManager, getBroadcastManager, Channel, PrivateChannel, PresenceChannel, MemoryDriver as MemoryBroadcastDriver, RedisDriver as RedisBroadcastDriver, } from './broadcasting/index.js';
|
|
88
|
-
export type { BroadcastEvent, BroadcastDriver, PresenceBroadcastDriver, ChannelAuthorizer, PresenceChannelAuthorizer, PresenceMember, SSEClient, WebSocketClient, BroadcastManagerOptions, BroadcastDriverFactory, ChannelRegistration, SSEMiddlewareOptions, AuthMiddlewareOptions, BroadcastableEvent, MemoryDriverOptions as BroadcastMemoryDriverOptions, RedisClient as BroadcastRedisClient, RedisDriverOptions as BroadcastRedisDriverOptions, } from './broadcasting/index.js';
|
|
90
|
+
export type { BroadcastEvent, BroadcastDriver, PresenceBroadcastDriver, ChannelAuthorizer, PresenceChannelAuthorizer, PresenceMember, SSEClient, WebSocketClient, BroadcastManagerOptions, BroadcastDriverFactory, ChannelRegistration, SSEMiddlewareOptions, WebSocketMiddlewareOptions, AuthMiddlewareOptions, BroadcastableEvent, MemoryDriverOptions as BroadcastMemoryDriverOptions, RedisClient as BroadcastRedisClient, RedisDriverOptions as BroadcastRedisDriverOptions, } from './broadcasting/index.js';
|
|
89
91
|
export { Container, createContainer, resolveOptional, setContainer, getContainer, resolve, ServiceProvider, ProviderManager, definePlugin, defineModule, mountModuleRoutes, } from './container/index.js';
|
|
90
92
|
export type { ContainerLike, PluginDefinition, PluginFactory, ModuleDefinition, GurenModule, ServiceFactory, ServiceClass, ServiceBinding, ServiceBindings, ContextualBindingBuilder, ContextualNeedsBuilder, ContextualBinding, ServiceProviderOptions, Provider as ContainerProvider, ServiceProviderClass, } from './container/index.js';
|
|
91
93
|
export { HttpException, ExceptionHandler, createExceptionHandler, setExceptionHandler, getExceptionHandler, abort, abortIf, abortUnless, ValidationException, AuthenticationException, AuthorizationException, NotFoundHttpException, MethodNotAllowedException, } from './errors/index.js';
|