@guren/server 2.22.0 → 2.23.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/Job-BxioDEcS.js +165 -0
- package/dist/auth/AuthManager.d.ts +29 -0
- package/dist/auth/AuthenticatableModel.d.ts +15 -0
- package/dist/auth/RequestAuthContext.d.ts +10 -1
- package/dist/auth/SessionGuard.d.ts +2 -0
- package/dist/auth/api-token.d.ts +6 -0
- package/dist/auth/context.d.ts +32 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.js +2 -2
- package/dist/auth/model-capability.d.ts +8 -0
- package/dist/auth/oauth/index.d.ts +5 -0
- package/dist/auth/password/DefaultHasher.d.ts +17 -6
- package/dist/auth/password/configured-hasher.d.ts +23 -0
- package/dist/auth/providers/ModelUserProvider.d.ts +3 -0
- package/dist/auth/providers/unconfigured-user-provider.d.ts +12 -0
- package/dist/auth/types.d.ts +9 -0
- package/dist/{auth-CjE2oO50.js → auth-D_W1cJp3.js} +279 -84
- package/dist/authorization/Gate.d.ts +12 -0
- package/dist/authorization/index.js +1 -1
- package/dist/{authorization-CdEWZZw3.js → authorization-0mCGUFoI.js} +58 -12
- package/dist/broadcasting/BroadcastManager.d.ts +10 -0
- package/dist/broadcasting/index.js +1 -1
- package/dist/{broadcasting-B5RzB0A2.js → broadcasting-BdJnaq1O.js} +17 -3
- package/dist/container/Container.d.ts +18 -1
- package/dist/container/bindings.d.ts +5 -0
- package/dist/container/index.d.ts +4 -2
- package/dist/container/resolve-optional.d.ts +10 -0
- package/dist/context-af2n5abO.js +91 -0
- package/dist/{Job-CvDwk2Gj.js → default-application-Chbrul_m.js} +126 -82
- package/dist/encryption/Encrypter.d.ts +10 -0
- package/dist/encryption/index.js +1 -1
- package/dist/{encryption-uwP3Di4D.js → encryption-BRjZnshr.js} +23 -5
- package/dist/errors/ExceptionHandler.d.ts +10 -0
- package/dist/events/Event.d.ts +18 -0
- package/dist/events/EventManager.d.ts +56 -4
- package/dist/events/index.d.ts +2 -1
- package/dist/events/index.js +2 -2
- package/dist/events/queued.d.ts +8 -0
- package/dist/events/serialize.d.ts +8 -0
- package/dist/events/types.d.ts +19 -2
- package/dist/events-C86rS63h.js +428 -0
- package/dist/health/checks/CacheCheck.d.ts +3 -5
- package/dist/health/checks/StorageCheck.d.ts +3 -5
- package/dist/health/index.js +1 -1
- package/dist/{health-DQSvUplL.js → health-CB0oS_UE.js} +2 -2
- package/dist/http/Application.d.ts +28 -0
- package/dist/http/default-application.d.ts +33 -0
- package/dist/http/middleware/detect-locale.d.ts +2 -1
- package/dist/http/request-container.d.ts +25 -0
- package/dist/i18n/I18nManager.d.ts +16 -3
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/{i18n-BZ2VrSud.js → i18n-DRo1g0AN.js} +34 -10
- package/dist/index.d.ts +14 -9
- package/dist/index.js +179 -84
- package/dist/lambda/index.js +1 -1
- package/dist/logging/LogManager.d.ts +9 -0
- package/dist/logging/index.js +1 -1
- package/dist/{logging-Dmzdb6mL.js → logging-CXotojgW.js} +16 -3
- package/dist/mail/Mail.d.ts +14 -1
- package/dist/mail/MailManager.d.ts +10 -2
- package/dist/mail/index.js +1 -1
- package/dist/{mail-9CrvJyBZ.js → mail-CmxO2Ttx.js} +42 -11
- package/dist/mvc/Controller.d.ts +1 -1
- package/dist/mvc/Router.d.ts +16 -5
- package/dist/mvc/inertia/InertiaEngine.d.ts +18 -3
- package/dist/mvc/inertia/shared.d.ts +7 -0
- package/dist/notifications/NotificationManager.d.ts +15 -0
- package/dist/notifications/index.js +1 -1
- package/dist/{notifications-D0VXkFLF.js → notifications-CE3U7uyg.js} +24 -5
- package/dist/providers/AuthServiceProvider.d.ts +5 -4
- package/dist/providers/AuthorizationServiceProvider.d.ts +2 -2
- package/dist/providers/BroadcastServiceProvider.d.ts +4 -1
- package/dist/providers/EncryptionServiceProvider.d.ts +7 -1
- package/dist/providers/EventServiceProvider.d.ts +1 -0
- package/dist/providers/LogServiceProvider.d.ts +6 -1
- package/dist/providers/MailServiceProvider.d.ts +7 -1
- package/dist/providers/NotificationServiceProvider.d.ts +4 -1
- package/dist/queue/Job.d.ts +39 -0
- package/dist/queue/QueueManager.d.ts +14 -5
- package/dist/queue/Worker.d.ts +2 -1
- package/dist/queue/index.d.ts +1 -1
- package/dist/queue/index.js +3 -3
- package/dist/queue/types.d.ts +7 -0
- package/dist/{queue-zPPYZdif.js → queue-B3x_RKnB.js} +24 -10
- package/dist/redis/RedisSchedulerLock.d.ts +17 -0
- package/dist/redis/index.d.ts +2 -0
- package/dist/redis/index.js +21 -1
- package/dist/runtime/index.js +1 -1
- package/dist/scheduling/MemorySchedulerLock.d.ts +16 -0
- package/dist/scheduling/ScheduledTask.d.ts +19 -2
- package/dist/scheduling/Scheduler.d.ts +25 -0
- package/dist/scheduling/index.d.ts +2 -1
- package/dist/scheduling/index.js +2 -2
- package/dist/scheduling/types.d.ts +26 -2
- package/dist/{scheduling-C6tcOtUl.js → scheduling-DudNXGnh.js} +178 -20
- package/dist/storage/index.js +1 -1
- package/dist/{storage-D_yNe54O.js → storage-6HLaUf9j.js} +2 -13
- package/dist/support/deprecate.d.ts +16 -0
- package/dist/{vite-manifest-D295_7-_.js → vite-manifest-B8720V7w.js} +1 -1
- package/dist/warn-once-p-IlMjra.js +13 -0
- package/package.json +2 -2
- package/dist/context-CXk_umpT.js +0 -21
- package/dist/events-DOmAHDeP.js +0 -230
package/dist/index.js
CHANGED
|
@@ -1,38 +1,40 @@
|
|
|
1
1
|
import { a as parseRequestPayload, i as parseRequestBody, n as flattenRequestQueries, o as parseRequestUploads, r as formatValidationErrors, t as asRecord } from "./request-CLOYytGP.js";
|
|
2
2
|
import { t as HttpException } from "./HttpException-BlQ2yEmT.js";
|
|
3
3
|
import { n as ValidationException } from "./errors-JpkcCjjn.js";
|
|
4
|
-
import { _ as
|
|
4
|
+
import { C as capabilitiesOf, S as tryGetRequestContainer, T as stampCapabilities, _ as resolveGate, a as withAuthorization, b as CONTAINER_CONTEXT_KEY, c as Gate, d as can, f as cannot, h as getGate, i as resourceAbilityForMethod, l as Response$1, m as defineGate, n as authorizeMiddleware, o as Policy, p as createGate, r as authorizeResourceMiddleware, s as definePolicy, t as authorizeAllMiddleware, u as authorize, v as setGate, w as mergeCapabilities, x as getRequestContainer, y as AuthorizationException } from "./authorization-0mCGUFoI.js";
|
|
5
5
|
import { a as mapToolResponse, i as describeBuildFailure, n as advertisesStructuredOutput, r as buildToolRequest, s as AGENT_PREFLIGHT_VERDICT_HEADER, t as PREFLIGHT_ARGUMENT } from "./dispatch-BAwzftws.js";
|
|
6
6
|
import { t as trimSlashes } from "./trim-slashes-BLY9hKAa.js";
|
|
7
7
|
import { PATH_PARAM_PATTERN, extractPathParamNames } from "./internal/route-path.js";
|
|
8
8
|
import { a as generateAppKey, c as parseAppKey, i as encodeDerivedKey, l as parsePreviousAppKeys, n as deriveAppKey, o as getAppKeyringFromEnv, r as deriveAppKeyring, s as normalizeAppKey, t as MessageSigner } from "./MessageSigner-Bd25ZJAV.js";
|
|
9
9
|
import { n as detectServerlessRuntime, t as SERVERLESS_RUNTIME_LABELS } from "./serverless-D96rJb6x.js";
|
|
10
|
-
import { A as verifyOAuthState, B as
|
|
11
|
-
import { _ as parseImportMap, c as isViteProduction, d as startViteDevServer, g as DEFAULT_DEV_STYLES_ENTRY, h as logDevServerBanner, i as clientManifestCandidates, l as loadViteManifest, m as isWildcardHost, n as INJECTED_CLIENT_MANIFEST_SOURCE, o as getManifestFile, p as formatHostPort, r as PUBLIC_ASSETS_URL_PREFIX, s as injectedClientManifest, u as normalizeDevServerUrl } from "./vite-manifest-
|
|
12
|
-
import { a as
|
|
10
|
+
import { $ as SessionGuard, A as verifyOAuthState, B as createBearerTokenMiddleware, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as DEFAULT_PROVIDER, G as parseApiToken, H as getApiTokenOrFail, I as TokenGuard, J as revokeApiToken, K as readBearerToken, L as API_TOKEN_KEY, M as isAppRelativePath, N as normalizeRedirectTarget, O as parseOAuthRedirectUrl, P as AuthManager, Q as verifyApiToken, R as MemoryApiTokenStore, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as getUserApiTokens, V as getApiToken, W as hasBearerHeader, X as tokenCanAll, Y as tokenCan, Z as tokenCanAny, _ as OAUTH_SESSION_BINDING_KEY, _t as getSessionFromContext, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, ct as DefaultHasher, d as completePasswordReset, dt as BaseUserProvider, f as createPasswordResetToken, ft as installAgentPrincipal, g as MemoryOAuthStateStore, gt as defaultCookieSecure, h as AuthenticatableModel, ht as createSessionMiddleware, i as createEmailVerificationToken, j as hostMatchesAllowlist, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, lt as NodeHasher, m as verifyPasswordResetToken, mt as MemorySessionStore, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, pt as readAgentPrincipal, q as revokeAllApiTokens, r as completeEmailVerification, s as requireVerifiedEmail, st as ModelUserProvider, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, ut as ScryptHasher, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as createApiToken } from "./auth-D_W1cJp3.js";
|
|
11
|
+
import { _ as parseImportMap, c as isViteProduction, d as startViteDevServer, g as DEFAULT_DEV_STYLES_ENTRY, h as logDevServerBanner, i as clientManifestCandidates, l as loadViteManifest, m as isWildcardHost, n as INJECTED_CLIENT_MANIFEST_SOURCE, o as getManifestFile, p as formatHostPort, r as PUBLIC_ASSETS_URL_PREFIX, s as injectedClientManifest, u as normalizeDevServerUrl } from "./vite-manifest-B8720V7w.js";
|
|
12
|
+
import { a as getJob, d as resolveQueueDriver, f as setQueueDriver, l as registerJob, n as clearJobRegistry, o as getQueueDriver, p as resolveOptional, r as clearQueueDriver, s as getRegisteredJobs, t as Job, u as resolveJobName } from "./Job-BxioDEcS.js";
|
|
13
|
+
import { t as warnOnce } from "./warn-once-p-IlMjra.js";
|
|
14
|
+
import { a as defaultApplication, c as resolve, d as createContainer, f as getContainer, h as warnDeprecatedSetter, i as bindAmbient, l as useAsDefaultApplication, m as warnDeprecatedGetter, n as ambientBinding, o as defaultContainer, p as setContainer, r as ambientContainer, s as resetDefaultApplication, t as adoptDefaultApplication, u as Container } from "./default-application-Chbrul_m.js";
|
|
13
15
|
import { n as ProviderManager, r as ServiceProvider } from "./loopback-guard-DT9gHF0F.js";
|
|
16
|
+
import { o as AuthenticationException, r as getAuthContext, t as AUTH_CONTEXT_KEY } from "./context-af2n5abO.js";
|
|
14
17
|
import { a as md5, c as sha256, d as verifyPassword, i as hmac, l as sha512, n as hash, o as needsRehash, r as hashPassword, s as secureCompare, t as check, u as verifyHmac } from "./Hash-D2DFd8xX.js";
|
|
15
|
-
import { n as getAuthContext, t as AUTH_CONTEXT_KEY } from "./context-CXk_umpT.js";
|
|
16
18
|
import { a as runInRequestScope, i as keepAlive, n as filterSensitiveData, t as Logger } from "./Logger-DWXdtLSJ.js";
|
|
17
19
|
import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemoryStore, r as TaggedCache, s as resolveLazyRedisClient, t as CacheManager } from "./cache-DikxP7Bk.js";
|
|
18
20
|
import { n as createRedisClient, r as RedisSessionStore } from "./client-C5Wj9P9o.js";
|
|
19
21
|
import { r as isMcpEndpointEnabled } from "./endpoint-Dsw3Acvq.js";
|
|
20
22
|
import { n as isHotReloadRuntime, r as matchingOpenParen, t as claimHotDisposable } from "./hot-disposables-B5BXqaIH.js";
|
|
21
|
-
import { a as
|
|
23
|
+
import { a as resolveI18n, c as tc, d as Translator, f as getPluralizationRule, i as getI18n, l as tryGetI18n, m as selectPluralForm, n as I18nManager, o as setI18n, p as pluralizationRules, r as createI18n, s as t, t as MemoryLoader, u as JsonLoader } from "./i18n-DRo1g0AN.js";
|
|
22
24
|
import { r as isDocsViewerEnabled } from "./endpoint-BXipU2Jj.js";
|
|
23
25
|
import { t as jsx_runtime_exports } from "./jsx-runtime.js";
|
|
24
26
|
import { readObjectSchema, toJsonSchema } from "./internal/zod-json-schema.js";
|
|
25
|
-
import { a as RequestFinished, c as UserLoggedOut, d as
|
|
26
|
-
import { a as NotificationManager, c as setNotificationManager, d as getNotification, f as registerNotification, i as MailChannel, l as resolveNotifiableType, n as SlackChannel, o as createNotificationManager, p as Notification, r as DatabaseChannel, s as getNotificationManager, t as MemoryChannel, u as clearNotificationRegistry } from "./notifications-
|
|
27
|
-
import { a as processJob, c as RedisDriver$1, i as Worker, l as SyncDriver, n as createQueueManager, o as SqsDriver, r as FailedJobReporter, s as createSqsAdapter, t as QueueManager, u as MemoryDriver$1 } from "./queue-
|
|
28
|
-
import { a as MailManager, c as MemoryTransport, i as setMailManager, l as ResendTransport, n as getMailManager, o as createMailManager, r as mail, s as LogTransport, t as Mail, u as SmtpTransport } from "./mail-
|
|
29
|
-
import { a as DailyFileChannel, c as matchDailyFileDate, d as LOG_LEVEL_PRIORITY, i as setLogManager, l as FileChannel, n as createLogManager, o as dailyFileDateStamp, r as getLogManager, s as dailyFilePath, t as LogManager, u as ConsoleChannel } from "./logging-
|
|
30
|
-
import { a as setBroadcastManager, c as PresenceChannel, i as getBroadcastManager, l as PrivateChannel, n as BroadcastManager, o as RedisDriver, r as createBroadcastManager, s as MemoryDriver, t as createTypedBroadcaster, u as Channel } from "./broadcasting-
|
|
27
|
+
import { a as RequestFinished, c as UserLoggedOut, d as EventManager, f as createEventManager, i as JobProcessed, l as createQueueEventDispatcher, n as ApplicationStarted, o as RequestReceived, p as Event, r as JobFailed, s as UserAuthenticated, t as ApplicationShutdown, u as Listener } from "./events-C86rS63h.js";
|
|
28
|
+
import { a as NotificationManager, c as setNotificationManager, d as getNotification, f as registerNotification, i as MailChannel, l as resolveNotifiableType, n as SlackChannel, o as createNotificationManager, p as Notification, r as DatabaseChannel, s as getNotificationManager, t as MemoryChannel, u as clearNotificationRegistry } from "./notifications-CE3U7uyg.js";
|
|
29
|
+
import { a as processJob, c as RedisDriver$1, i as Worker, l as SyncDriver, n as createQueueManager, o as SqsDriver, r as FailedJobReporter, s as createSqsAdapter, t as QueueManager, u as MemoryDriver$1 } from "./queue-B3x_RKnB.js";
|
|
30
|
+
import { a as MailManager, c as MemoryTransport, i as setMailManager, l as ResendTransport, n as getMailManager, o as createMailManager, r as mail, s as LogTransport, t as Mail, u as SmtpTransport } from "./mail-CmxO2Ttx.js";
|
|
31
|
+
import { a as DailyFileChannel, c as matchDailyFileDate, d as LOG_LEVEL_PRIORITY, i as setLogManager, l as FileChannel, n as createLogManager, o as dailyFileDateStamp, r as getLogManager, s as dailyFilePath, t as LogManager, u as ConsoleChannel } from "./logging-CXotojgW.js";
|
|
32
|
+
import { a as setBroadcastManager, c as PresenceChannel, i as getBroadcastManager, l as PrivateChannel, n as BroadcastManager, o as RedisDriver, r as createBroadcastManager, s as MemoryDriver, t as createTypedBroadcaster, u as Channel } from "./broadcasting-BdJnaq1O.js";
|
|
31
33
|
import { a as random, c as randomHex, d as sample, f as shuffle, i as pick, l as randomInt, m as uuid, n as generatePassword, o as randomBase64, p as urlSafeToken, r as generateSlug, s as randomBase64Url, t as generateOtp, u as randomString } from "./Random-S0OvCuR8.js";
|
|
32
|
-
import { a as decrypt, c as getEncrypter, i as createEncrypter, l as setEncrypter, n as verifySignedUrl, o as encrypt, r as Encrypter, s as generateKey, t as signUrl } from "./encryption-
|
|
33
|
-
import { a as LocalDriver, i as S3Driver, n as createStorageManager,
|
|
34
|
-
import { a as CacheCheck, c as HealthManager, i as StorageCheck, l as createHealthManager, n as customCheck, o as RedisCheck, r as MemoryCheck, s as DatabaseCheck, t as CustomCheck, u as HealthCheck } from "./health-
|
|
35
|
-
import { a as ScheduledTask, c as isDue, d as parseCron, f as toTimezone, i as Schedule, l as isDueInTimezone, n as createScheduler, o as getNextOccurrence, r as PendingSchedule, s as getNextOccurrences, t as Scheduler, u as matchesCron } from "./scheduling-
|
|
34
|
+
import { a as decrypt, c as getEncrypter, i as createEncrypter, l as setEncrypter, n as verifySignedUrl, o as encrypt, r as Encrypter, s as generateKey, t as signUrl } from "./encryption-BRjZnshr.js";
|
|
35
|
+
import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver$2, t as StorageManager } from "./storage-6HLaUf9j.js";
|
|
36
|
+
import { a as CacheCheck, c as HealthManager, i as StorageCheck, l as createHealthManager, n as customCheck, o as RedisCheck, r as MemoryCheck, s as DatabaseCheck, t as CustomCheck, u as HealthCheck } from "./health-CB0oS_UE.js";
|
|
37
|
+
import { a as ScheduledTask, c as isDue, d as parseCron, f as toTimezone, i as Schedule, l as isDueInTimezone, n as createScheduler, o as getNextOccurrence, p as MemorySchedulerLock, r as PendingSchedule, s as getNextOccurrences, t as Scheduler, u as matchesCron } from "./scheduling-DudNXGnh.js";
|
|
36
38
|
import { Hono } from "hono";
|
|
37
39
|
import { deleteCookie, getCookie } from "hono/cookie";
|
|
38
40
|
import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
@@ -110,13 +112,17 @@ function mountRoute(app, method, path, ...handlers) {
|
|
|
110
112
|
ensureErrorStackTracePolyfill();
|
|
111
113
|
let documentOptions;
|
|
112
114
|
/**
|
|
113
|
-
* Register app-wide document defaults for server-rendered Inertia responses
|
|
114
|
-
* call it at module scope in the app entry so every runtime picks it up.
|
|
115
|
+
* Register app-wide document defaults for server-rendered Inertia responses.
|
|
115
116
|
* Process-wide, not request-scoped: calling it mid-flight leaks the policy into
|
|
116
117
|
* in-flight requests — use the {@link InertiaOptions} fields per response.
|
|
117
118
|
* Values are emitted verbatim, so never pass user input. `undefined` clears.
|
|
119
|
+
*
|
|
120
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Pass
|
|
121
|
+
* `createApp({ inertia: { document } })`, which binds it on the app rather than
|
|
122
|
+
* the process. The slot stays the engine's second read.
|
|
118
123
|
*/
|
|
119
124
|
function setInertiaDocument(options) {
|
|
125
|
+
warnDeprecatedSetter("setInertiaDocument");
|
|
120
126
|
documentOptions = options;
|
|
121
127
|
}
|
|
122
128
|
let defaultSsrRenderer;
|
|
@@ -125,8 +131,13 @@ let defaultSsrRenderer;
|
|
|
125
131
|
* cannot resolve a runtime path (Workers has no filesystem for
|
|
126
132
|
* `GUREN_INERTIA_SSR_ENTRY`'s dynamic import). Per-call `ssr.render` still
|
|
127
133
|
* wins; `undefined` clears (test isolation).
|
|
134
|
+
*
|
|
135
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Pass
|
|
136
|
+
* `createApp({ inertia: { ssrRenderer } })`, or bind `inertia.ssrRenderer` on
|
|
137
|
+
* the app when the renderer only exists after `createApp()` has run.
|
|
128
138
|
*/
|
|
129
139
|
function setInertiaSsrRenderer(renderer) {
|
|
140
|
+
warnDeprecatedSetter("setInertiaSsrRenderer");
|
|
130
141
|
defaultSsrRenderer = renderer;
|
|
131
142
|
}
|
|
132
143
|
const DEFAULT_TITLE = "Guren";
|
|
@@ -250,7 +261,7 @@ async function tryRenderSsr(page, options) {
|
|
|
250
261
|
const ssrOptions = options.ssr;
|
|
251
262
|
if (ssrOptions?.enabled === false) return;
|
|
252
263
|
const manifest = (ssrOptions?.manifest ?? process.env.GUREN_INERTIA_SSR_MANIFEST)?.trim() || void 0;
|
|
253
|
-
const renderer = ssrOptions?.render ?? defaultSsrRenderer ?? await loadSsrRenderer(ssrOptions?.entry ?? process.env.GUREN_INERTIA_SSR_ENTRY);
|
|
264
|
+
const renderer = ssrOptions?.render ?? resolveOptional(options.container, "inertia.ssrRenderer") ?? defaultSsrRenderer ?? await loadSsrRenderer(ssrOptions?.entry ?? process.env.GUREN_INERTIA_SSR_ENTRY);
|
|
254
265
|
if (!renderer) return;
|
|
255
266
|
try {
|
|
256
267
|
const result = await renderer({
|
|
@@ -322,7 +333,7 @@ function normalizeHeadElement(element) {
|
|
|
322
333
|
function resolveDocumentValue(key, options, componentName) {
|
|
323
334
|
const override = options[key];
|
|
324
335
|
if (override !== void 0) return override;
|
|
325
|
-
const value = documentOptions?.[key];
|
|
336
|
+
const value = (resolveOptional(options.container, "inertia.document") ?? documentOptions)?.[key];
|
|
326
337
|
return (typeof value === "function" ? value({ component: componentName }) : value) ?? "";
|
|
327
338
|
}
|
|
328
339
|
function serializePage(page) {
|
|
@@ -442,16 +453,25 @@ function ensureSharedInertiaPropsRegistry(container) {
|
|
|
442
453
|
/**
|
|
443
454
|
* Replace the module-global shared props resolver. Props registered on an
|
|
444
455
|
* application's container (see {@link shareInertiaProps}) are unaffected.
|
|
456
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
|
|
457
|
+
* `shareInertiaProps(fn, container)`, which scopes the registration to one app.
|
|
458
|
+
* It composes rather than replaces, so a wholesale reset becomes one
|
|
459
|
+
* registration on a fresh container.
|
|
445
460
|
*/
|
|
446
461
|
function setInertiaSharedProps(resolverFn) {
|
|
462
|
+
warnDeprecatedSetter("setInertiaSharedProps");
|
|
447
463
|
globalRegistry.set(resolverFn);
|
|
448
464
|
}
|
|
449
465
|
/**
|
|
450
466
|
* The module-global registrations composed into one resolver, for manual
|
|
451
467
|
* composition. Container-scoped props are not included — get those from
|
|
452
468
|
* `ensureSharedInertiaPropsRegistry(container).get()`.
|
|
469
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
|
|
470
|
+
* `ensureSharedInertiaPropsRegistry(container).get()` on the container that owns
|
|
471
|
+
* the call.
|
|
453
472
|
*/
|
|
454
473
|
function getInertiaSharedPropsResolver() {
|
|
474
|
+
warnDeprecatedGetter("getInertiaSharedPropsResolver");
|
|
455
475
|
return globalRegistry.get();
|
|
456
476
|
}
|
|
457
477
|
/**
|
|
@@ -594,7 +614,10 @@ async function answer(result, c, fixture, shared, deps) {
|
|
|
594
614
|
case "page": return inertia(result.component, {
|
|
595
615
|
...shared,
|
|
596
616
|
...result.props
|
|
597
|
-
}, {
|
|
617
|
+
}, {
|
|
618
|
+
request: c.req.raw,
|
|
619
|
+
container: deps.container
|
|
620
|
+
});
|
|
598
621
|
case "redirect": return c.redirect(deps.routeUrl(result.to, result.params), 303);
|
|
599
622
|
case "location":
|
|
600
623
|
if (c.req.header("X-Inertia")) return new Response(null, {
|
|
@@ -610,7 +633,8 @@ async function answer(result, c, fixture, shared, deps) {
|
|
|
610
633
|
message: "Not Found"
|
|
611
634
|
}, {
|
|
612
635
|
request: c.req.raw,
|
|
613
|
-
status: 404
|
|
636
|
+
status: 404,
|
|
637
|
+
container: deps.container
|
|
614
638
|
});
|
|
615
639
|
throw HttpException.notFound();
|
|
616
640
|
}
|
|
@@ -694,7 +718,12 @@ const RESOURCE_ACTIONS = [
|
|
|
694
718
|
httpMethod: "delete"
|
|
695
719
|
}
|
|
696
720
|
];
|
|
697
|
-
/**
|
|
721
|
+
/**
|
|
722
|
+
* Instance-based router for app-local route registration and mounting.
|
|
723
|
+
*
|
|
724
|
+
* `in M` is an explicit pin, not the source of the contravariance: the
|
|
725
|
+
* `RouteBuilder<M>` return positions already force it (measured).
|
|
726
|
+
*/
|
|
698
727
|
var Router = class {
|
|
699
728
|
registry = [];
|
|
700
729
|
prefixStack = [];
|
|
@@ -2392,7 +2421,7 @@ function detectLocaleMiddleware(options) {
|
|
|
2392
2421
|
}
|
|
2393
2422
|
}
|
|
2394
2423
|
c.set(LOCALE_CONTEXT_KEY, resolved);
|
|
2395
|
-
const i18n = options.i18n === false ? void 0 : options.i18n ??
|
|
2424
|
+
const i18n = options.i18n === false ? void 0 : options.i18n ?? tryGetRequestContainer(c)?.makeOptional("i18n") ?? resolveI18n();
|
|
2396
2425
|
if (i18n) {
|
|
2397
2426
|
await i18n.loadLocale(resolved).catch(() => {});
|
|
2398
2427
|
const current = () => bindingFor(getRequestLocale(c) ?? resolved, i18n);
|
|
@@ -2483,14 +2512,13 @@ function requireGuest(options = {}) {
|
|
|
2483
2512
|
}
|
|
2484
2513
|
//#endregion
|
|
2485
2514
|
//#region src/providers/AuthServiceProvider.ts
|
|
2486
|
-
const DEFAULT_GUARD = "web";
|
|
2487
|
-
const DEFAULT_PROVIDER = "users";
|
|
2488
2515
|
const DOUBLE_SESSION_CONFIG = "Sessions are configured twice: `auth.sessionOptions.store` in createApp() and a \"session\" container binding (SessionProvider). Keep one — the manager, or the explicit store.";
|
|
2489
2516
|
/**
|
|
2490
|
-
* Sets up
|
|
2491
|
-
*
|
|
2492
|
-
*
|
|
2493
|
-
*
|
|
2517
|
+
* Sets up session middleware, CSRF, and the auth context. The default guard is
|
|
2518
|
+
* the `Application` constructor's, registered before this provider. The session
|
|
2519
|
+
* store may come from a `session` container binding (RFC 0020 §1), which an
|
|
2520
|
+
* app's SessionProvider must make in `register()`: the middleware is built in
|
|
2521
|
+
* `boot()`, before any user provider's own boot runs.
|
|
2494
2522
|
*/
|
|
2495
2523
|
var AuthServiceProvider = class extends ServiceProvider {
|
|
2496
2524
|
app;
|
|
@@ -2500,10 +2528,6 @@ var AuthServiceProvider = class extends ServiceProvider {
|
|
|
2500
2528
|
const app = this.container.make("app");
|
|
2501
2529
|
this.app = app;
|
|
2502
2530
|
const auth = this.container.make("auth");
|
|
2503
|
-
if (!auth.guardNames().length) {
|
|
2504
|
-
auth.registerGuard(DEFAULT_GUARD, createDefaultGuardFactory(DEFAULT_PROVIDER));
|
|
2505
|
-
auth.setDefaultGuard(DEFAULT_GUARD);
|
|
2506
|
-
}
|
|
2507
2531
|
const authOptions = app.authOptions ?? {};
|
|
2508
2532
|
if (authOptions.autoSession !== false && !app.hasAutoSessionAttached()) {
|
|
2509
2533
|
app.use("*", (ctx, next) => (this.sessionMiddleware ??= this.buildSessionMiddleware())(ctx, next));
|
|
@@ -2539,15 +2563,6 @@ var AuthServiceProvider = class extends ServiceProvider {
|
|
|
2539
2563
|
});
|
|
2540
2564
|
}
|
|
2541
2565
|
};
|
|
2542
|
-
function createDefaultGuardFactory(providerName) {
|
|
2543
|
-
return ({ session, manager }) => {
|
|
2544
|
-
const provider = manager.getProvider(providerName);
|
|
2545
|
-
return new SessionGuard({
|
|
2546
|
-
provider,
|
|
2547
|
-
session
|
|
2548
|
-
});
|
|
2549
|
-
};
|
|
2550
|
-
}
|
|
2551
2566
|
//#endregion
|
|
2552
2567
|
//#region src/errors/error-page.ts
|
|
2553
2568
|
function escapeHtml$1(value) {
|
|
@@ -2731,12 +2746,25 @@ function createExceptionHandler(options) {
|
|
|
2731
2746
|
return new ExceptionHandler(options);
|
|
2732
2747
|
}
|
|
2733
2748
|
let globalExceptionHandler = null;
|
|
2749
|
+
/**
|
|
2750
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the handler on the
|
|
2751
|
+
* app's container instead — `ErrorServiceProvider` already does, and a provider
|
|
2752
|
+
* of your own reaches it as `this.container.instance('exception.handler', h)`.
|
|
2753
|
+
*/
|
|
2734
2754
|
function setExceptionHandler(handler) {
|
|
2735
|
-
|
|
2755
|
+
warnDeprecatedSetter("setExceptionHandler");
|
|
2756
|
+
globalExceptionHandler = bindAmbient("exception.handler", handler) ? null : handler;
|
|
2736
2757
|
}
|
|
2758
|
+
/**
|
|
2759
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
|
|
2760
|
+
* `this.make('exception.handler')` in a controller, job or command, or
|
|
2761
|
+
* `defaultContainer().make('exception.handler')`.
|
|
2762
|
+
*/
|
|
2737
2763
|
function getExceptionHandler() {
|
|
2738
|
-
|
|
2739
|
-
|
|
2764
|
+
warnDeprecatedGetter("getExceptionHandler");
|
|
2765
|
+
const handler = ambientBinding("exception.handler") ?? globalExceptionHandler;
|
|
2766
|
+
if (!handler) throw new Error("ExceptionHandler not initialized. Construct the app with createApp(), or call setExceptionHandler() first.");
|
|
2767
|
+
return handler;
|
|
2740
2768
|
}
|
|
2741
2769
|
function abort(statusCode, message, errors) {
|
|
2742
2770
|
throw new HttpException(statusCode, message ?? "Error", errors);
|
|
@@ -2792,14 +2820,12 @@ var MethodNotAllowedException = class MethodNotAllowedException extends HttpExce
|
|
|
2792
2820
|
//#endregion
|
|
2793
2821
|
//#region src/providers/AuthorizationServiceProvider.ts
|
|
2794
2822
|
/**
|
|
2795
|
-
* Binds the Gate as a singleton
|
|
2796
|
-
* `
|
|
2823
|
+
* Binds the Gate as a singleton. Controllers, the authorization middleware and
|
|
2824
|
+
* `getGate()` resolve it from there (RFC 0023 §4), so no global is written.
|
|
2797
2825
|
*/
|
|
2798
2826
|
var AuthorizationServiceProvider = class extends ServiceProvider {
|
|
2799
2827
|
register() {
|
|
2800
|
-
|
|
2801
|
-
setGate(gate);
|
|
2802
|
-
this.container.singleton("gate", () => gate);
|
|
2828
|
+
this.container.singleton("gate", () => createGate());
|
|
2803
2829
|
}
|
|
2804
2830
|
};
|
|
2805
2831
|
//#endregion
|
|
@@ -3039,6 +3065,31 @@ var InertiaServiceProvider = class extends ServiceProvider {
|
|
|
3039
3065
|
}
|
|
3040
3066
|
};
|
|
3041
3067
|
//#endregion
|
|
3068
|
+
//#region src/auth/providers/unconfigured-user-provider.ts
|
|
3069
|
+
/** The remediation both the thrown message and the boot warning end on. */
|
|
3070
|
+
const REGISTER_USER_PROVIDER_HINT = "Register one with `auth.useModel(User)` in a service provider (what `guren add auth` scaffolds), or `auth.registerProvider('users', ...)`.";
|
|
3071
|
+
const NO_USER_PROVIDER_MESSAGE = `AuthManager: a login was attempted, but no user provider is registered, so there is nothing to check the credentials against. ${REGISTER_USER_PROVIDER_HINT} An OAuth or passwordless app that only calls \`auth.login(user)\` needs no provider for that call, but does need one to load the user back on the next request.`;
|
|
3072
|
+
function noProvider() {
|
|
3073
|
+
throw new Error(NO_USER_PROVIDER_MESSAGE);
|
|
3074
|
+
}
|
|
3075
|
+
/**
|
|
3076
|
+
* The provider behind the default guard until an app registers `users`. An
|
|
3077
|
+
* anonymous request on an app with no auth is legitimately unauthenticated, so
|
|
3078
|
+
* `retrieveById` answers null; a credential check with nothing to check
|
|
3079
|
+
* against is a misconfiguration, so it throws rather than answering "wrong
|
|
3080
|
+
* password" forever. One object: the guard is built per request.
|
|
3081
|
+
*/
|
|
3082
|
+
const unconfiguredUserProvider = {
|
|
3083
|
+
retrieveById: async () => null,
|
|
3084
|
+
retrieveByCredentials: async () => noProvider(),
|
|
3085
|
+
validateCredentials: async () => noProvider(),
|
|
3086
|
+
getId: (user) => identifierOf(user)
|
|
3087
|
+
};
|
|
3088
|
+
function identifierOf(user) {
|
|
3089
|
+
const record = user;
|
|
3090
|
+
return typeof record?.getAuthIdentifier === "function" ? record.getAuthIdentifier() : record?.id;
|
|
3091
|
+
}
|
|
3092
|
+
//#endregion
|
|
3042
3093
|
//#region src/http/Application.ts
|
|
3043
3094
|
const MANAGED_VITE_ENV_FLAG = "GUREN_MANAGED_VITE_DEV_SERVER";
|
|
3044
3095
|
const DEFAULT_DEV_ENTRY_PATH = "/resources/js/dev-entry.ts";
|
|
@@ -3276,32 +3327,23 @@ var Application = class {
|
|
|
3276
3327
|
this.hono = new Hono();
|
|
3277
3328
|
this.container = new Container();
|
|
3278
3329
|
this.router = new Router();
|
|
3279
|
-
this.authManager = new AuthManager();
|
|
3330
|
+
this.authManager = new AuthManager({ hasher: options.auth?.hasher });
|
|
3280
3331
|
this.providerManager = new ProviderManager(this.container);
|
|
3281
3332
|
this.mountSecurityDefaults();
|
|
3282
3333
|
this.container.instance("app", this);
|
|
3283
3334
|
this.container.instance("hono", this.hono);
|
|
3284
3335
|
this.container.instance("auth", this.authManager);
|
|
3285
3336
|
this.container.instance("router", this.router);
|
|
3286
|
-
if (
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
retrieveById: async () => null,
|
|
3294
|
-
retrieveByCredentials: async () => null,
|
|
3295
|
-
validateCredentials: async () => false
|
|
3296
|
-
};
|
|
3297
|
-
}
|
|
3298
|
-
return new SessionGuard({
|
|
3299
|
-
provider,
|
|
3300
|
-
session
|
|
3301
|
-
});
|
|
3337
|
+
if (options.inertia?.document) this.container.instance("inertia.document", options.inertia.document);
|
|
3338
|
+
if (options.inertia?.ssrRenderer) this.container.instance("inertia.ssrRenderer", options.inertia.ssrRenderer);
|
|
3339
|
+
this.authManager.registerGuard("web", ({ session }) => {
|
|
3340
|
+
const provider = this.authManager.hasProvider("users") ? this.authManager.getProvider(DEFAULT_PROVIDER) : unconfiguredUserProvider;
|
|
3341
|
+
return new SessionGuard({
|
|
3342
|
+
provider,
|
|
3343
|
+
session
|
|
3302
3344
|
});
|
|
3303
|
-
|
|
3304
|
-
|
|
3345
|
+
});
|
|
3346
|
+
this.authManager.setDefaultGuard("web");
|
|
3305
3347
|
if (this.options.auth) this.providerManager.register(AuthServiceProvider);
|
|
3306
3348
|
else this.hono.use("*", attachAuthContext((ctx) => this.authManager.createAuthContext(ctx)));
|
|
3307
3349
|
this.providerManager.register(AuthorizationServiceProvider);
|
|
@@ -3312,7 +3354,7 @@ var Application = class {
|
|
|
3312
3354
|
if (!hasUserProviderOf(ErrorServiceProvider)) this.providerManager.register(ErrorServiceProvider);
|
|
3313
3355
|
if (userProviders.length > 0) this.providerManager.registerMany(userProviders);
|
|
3314
3356
|
if (!hasUserProviderOf(InertiaServiceProvider)) this.providerManager.register(InertiaServiceProvider);
|
|
3315
|
-
|
|
3357
|
+
adoptDefaultApplication(this);
|
|
3316
3358
|
}
|
|
3317
3359
|
get auth() {
|
|
3318
3360
|
return this.authManager;
|
|
@@ -3417,9 +3459,29 @@ var Application = class {
|
|
|
3417
3459
|
await this.mountDevEndpoint(isMcpEndpointEnabled(), async () => (await import("./McpServiceProvider-BvJRcDOm.js").then((n) => n.n)).McpServiceProvider, "GUREN_MCP=1 but the MCP endpoint could not load — is @modelcontextprotocol/sdk installed?");
|
|
3418
3460
|
await this.mountDevEndpoint(isDocsViewerEnabled(), async () => (await import("./DocsViewerServiceProvider-DWnlXx_y.js")).DocsViewerServiceProvider, "GUREN_DOCS=1 but the docs viewer could not load — is @guren/cli resolvable from this app?");
|
|
3419
3461
|
await this.providerManager.bootAll();
|
|
3462
|
+
this.warnOnUnconfiguredAuth();
|
|
3463
|
+
}
|
|
3464
|
+
/**
|
|
3465
|
+
* After every provider has booted: `auth` was asked for, yet the default
|
|
3466
|
+
* guard still runs against the placeholder provider, so a session login
|
|
3467
|
+
* attempt would throw. Silent for an app that authenticates through tokens,
|
|
3468
|
+
* or that mounts its own sessions, since neither reaches that guard.
|
|
3469
|
+
*/
|
|
3470
|
+
warnOnUnconfiguredAuth() {
|
|
3471
|
+
if (!this.options.auth) return;
|
|
3472
|
+
if (this.options.auth.autoSession === false) return;
|
|
3473
|
+
if (this.authManager.getTokenGuard()) return;
|
|
3474
|
+
if (this.authManager.getDefaultGuard() !== "web") return;
|
|
3475
|
+
if (this.authManager.hasProvider("users")) return;
|
|
3476
|
+
console.warn(`[guren] createApp() received \`auth\`, but no "${DEFAULT_PROVIDER}" user provider was registered by the time the app booted. Sessions and CSRF are mounted, and any login attempt will throw. ${REGISTER_USER_PROVIDER_HINT}`);
|
|
3420
3477
|
}
|
|
3421
3478
|
/** Called once, from the constructor — see the note there for why. */
|
|
3422
3479
|
mountSecurityDefaults() {
|
|
3480
|
+
const container = this.container;
|
|
3481
|
+
this.hono.use("*", (ctx, next) => {
|
|
3482
|
+
ctx.set(CONTAINER_CONTEXT_KEY, container);
|
|
3483
|
+
return next();
|
|
3484
|
+
});
|
|
3423
3485
|
const { securityHeaders } = this.options;
|
|
3424
3486
|
if (securityHeaders !== false) this.hono.use("*", createSecurityHeaders(securityHeaders ?? {}));
|
|
3425
3487
|
this.mountHostAuthorization();
|
|
@@ -3753,11 +3815,15 @@ var Controller = class {
|
|
|
3753
3815
|
* record: `await this.authorize('update', [Post, post])`.
|
|
3754
3816
|
*/
|
|
3755
3817
|
async authorize(ability, ...args) {
|
|
3756
|
-
await
|
|
3818
|
+
await this.#resolveGate().forUser(await this.gateUser()).authorize(ability, ...args);
|
|
3757
3819
|
}
|
|
3758
3820
|
/** Check an ability without throwing: `await this.can('update', [Post, post])`. */
|
|
3759
3821
|
async can(ability, ...args) {
|
|
3760
|
-
return
|
|
3822
|
+
return this.#resolveGate().forUser(await this.gateUser()).allows(ability, ...args);
|
|
3823
|
+
}
|
|
3824
|
+
/** This app's `gate` (RFC 0023 §2); the ambient one only off a container, as on a bare Hono app. */
|
|
3825
|
+
#resolveGate() {
|
|
3826
|
+
return resolveOptional(this._container, "gate") ?? resolveGate();
|
|
3761
3827
|
}
|
|
3762
3828
|
async gateUser() {
|
|
3763
3829
|
const auth = getAuthContext(this.ctx);
|
|
@@ -3783,7 +3849,8 @@ var Controller = class {
|
|
|
3783
3849
|
const response = await inertia(component, propsWithShared, {
|
|
3784
3850
|
...options,
|
|
3785
3851
|
lang: options.lang ?? this.#resolveLocale(),
|
|
3786
|
-
request: ctx.req.raw
|
|
3852
|
+
request: ctx.req.raw,
|
|
3853
|
+
container: this._container
|
|
3787
3854
|
});
|
|
3788
3855
|
response.__gurenInertia = {
|
|
3789
3856
|
component,
|
|
@@ -3827,8 +3894,7 @@ var Controller = class {
|
|
|
3827
3894
|
return typeof locale === "string" && locale.length > 0 ? locale : void 0;
|
|
3828
3895
|
}
|
|
3829
3896
|
#resolveI18n() {
|
|
3830
|
-
|
|
3831
|
-
return tryGetI18n();
|
|
3897
|
+
return resolveOptional(this._container, "i18n") ?? resolveI18n();
|
|
3832
3898
|
}
|
|
3833
3899
|
json(data, init = {}) {
|
|
3834
3900
|
return new Response(JSON.stringify(data), {
|
|
@@ -5267,6 +5333,9 @@ var EventServiceProvider = class extends ServiceProvider {
|
|
|
5267
5333
|
register() {
|
|
5268
5334
|
this.container.singleton("events", () => createEventManager());
|
|
5269
5335
|
}
|
|
5336
|
+
boot() {
|
|
5337
|
+
this.container.make("events").setQueueDispatcher(createQueueEventDispatcher());
|
|
5338
|
+
}
|
|
5270
5339
|
};
|
|
5271
5340
|
//#endregion
|
|
5272
5341
|
//#region src/providers/CacheServiceProvider.ts
|
|
@@ -5286,26 +5355,43 @@ var QueueServiceProvider = class extends ServiceProvider {
|
|
|
5286
5355
|
};
|
|
5287
5356
|
//#endregion
|
|
5288
5357
|
//#region src/providers/MailServiceProvider.ts
|
|
5289
|
-
/**
|
|
5358
|
+
/**
|
|
5359
|
+
* Binds the MailManager as a singleton in the container, on the `log`
|
|
5360
|
+
* transport: an app that never configured mail gets every message in the
|
|
5361
|
+
* server output rather than "Mail transport not found: smtp" on the first
|
|
5362
|
+
* send. The scaffolded `MailProvider` rebinds `mail` with the app's own
|
|
5363
|
+
* config, so this default only reaches apps that never ran `guren add mail`.
|
|
5364
|
+
*/
|
|
5290
5365
|
var MailServiceProvider = class extends ServiceProvider {
|
|
5291
5366
|
register() {
|
|
5292
|
-
this.container.singleton("mail", () => createMailManager(
|
|
5367
|
+
this.container.singleton("mail", (container) => createMailManager({
|
|
5368
|
+
default: "log",
|
|
5369
|
+
transports: { log: { driver: "log" } }
|
|
5370
|
+
}, container));
|
|
5293
5371
|
}
|
|
5294
5372
|
};
|
|
5295
5373
|
//#endregion
|
|
5296
5374
|
//#region src/providers/LogServiceProvider.ts
|
|
5297
|
-
/**
|
|
5375
|
+
/**
|
|
5376
|
+
* Binds the LogManager as a singleton in the container. The default channel is
|
|
5377
|
+
* declared, not merely named: `LogManager` resolves channels from `channels`
|
|
5378
|
+
* alone, so a `default` with no matching entry throws on the first write.
|
|
5379
|
+
* `getLogManager()` resolves it from the default application (RFC 0023 §4).
|
|
5380
|
+
*/
|
|
5298
5381
|
var LogServiceProvider = class extends ServiceProvider {
|
|
5299
5382
|
register() {
|
|
5300
5383
|
this.container.singleton("log", () => createLogManager({
|
|
5301
5384
|
default: "console",
|
|
5302
|
-
channels: {}
|
|
5385
|
+
channels: { console: { driver: "console" } }
|
|
5303
5386
|
}));
|
|
5304
5387
|
}
|
|
5305
5388
|
};
|
|
5306
5389
|
//#endregion
|
|
5307
5390
|
//#region src/providers/NotificationServiceProvider.ts
|
|
5308
|
-
/**
|
|
5391
|
+
/**
|
|
5392
|
+
* Binds the NotificationManager as a singleton in the container;
|
|
5393
|
+
* `getNotificationManager()` resolves it from the default application (RFC 0023 §4).
|
|
5394
|
+
*/
|
|
5309
5395
|
var NotificationServiceProvider = class extends ServiceProvider {
|
|
5310
5396
|
register() {
|
|
5311
5397
|
this.container.singleton("notifications", () => createNotificationManager());
|
|
@@ -5316,7 +5402,10 @@ var NotificationServiceProvider = class extends ServiceProvider {
|
|
|
5316
5402
|
};
|
|
5317
5403
|
//#endregion
|
|
5318
5404
|
//#region src/providers/BroadcastServiceProvider.ts
|
|
5319
|
-
/**
|
|
5405
|
+
/**
|
|
5406
|
+
* Binds the BroadcastManager as a singleton in the container;
|
|
5407
|
+
* `getBroadcastManager()` resolves it from the default application (RFC 0023 §4).
|
|
5408
|
+
*/
|
|
5320
5409
|
var BroadcastServiceProvider = class extends ServiceProvider {
|
|
5321
5410
|
register() {
|
|
5322
5411
|
this.container.singleton("broadcast", () => createBroadcastManager());
|
|
@@ -5324,7 +5413,13 @@ var BroadcastServiceProvider = class extends ServiceProvider {
|
|
|
5324
5413
|
};
|
|
5325
5414
|
//#endregion
|
|
5326
5415
|
//#region src/providers/EncryptionServiceProvider.ts
|
|
5327
|
-
/**
|
|
5416
|
+
/**
|
|
5417
|
+
* Binds the Encrypter as a singleton. `encrypt()` / `decrypt()` /
|
|
5418
|
+
* `getEncrypter()` resolve it from the default application's container
|
|
5419
|
+
* (RFC 0023 §4), so no global is written. The keyring is read lazily, so a
|
|
5420
|
+
* provider registering later can still replace `app.keyring` before the
|
|
5421
|
+
* encrypter is built.
|
|
5422
|
+
*/
|
|
5328
5423
|
var EncryptionServiceProvider = class extends ServiceProvider {
|
|
5329
5424
|
register() {
|
|
5330
5425
|
if (!this.container.has("app.keyring")) this.container.instance("app.keyring", getAppKeyringFromEnv());
|
|
@@ -7931,4 +8026,4 @@ function renderEnvironmentSection() {
|
|
|
7931
8026
|
//#region src/index.ts
|
|
7932
8027
|
ensureErrorStackTracePolyfill();
|
|
7933
8028
|
//#endregion
|
|
7934
|
-
export { AGENT_APPROVAL_CONFIG_KEY, AGENT_AUDIT_BINDING, AGENT_REDACTED, AGENT_TOOL_NAME_PATTERN, API_TOKEN_KEY, APPROVAL_STATUS_TOOL_NAME, AUTH_CONTEXT_KEY, AgentApprovalRequested, AgentToolDenied, AgentToolInvoked, Application, ApplicationShutdown, ApplicationStarted, AuthManager, Response$1 as AuthResponse, AuthServiceProvider, AuthenticatableModel, AuthenticationException, AuthorizationException, AuthorizationServiceProvider, AutoDiscovery, BUILT_IN_SESSION_DRIVERS, BaseFactory, BaseFactory as Factory, BaseSeeder, BaseSeeder as Seeder, BaseUserProvider, BroadcastManager, BroadcastServiceProvider, BufferedOutput, CSP_NONCE_KEY, CSRF_FORM_FIELD, CSRF_HEADER_NAME, CSRF_TOKEN_KEY, CacheCheck, CacheManager, CacheServiceProvider, Channel, Command, ConsoleChannel, ConsoleKernel, Container, Controller, CookieSessionStore, CursorPaginator, CustomCheck, DEFAULT_AGENT_APPROVAL_TTL_MS, DEFAULT_AGENT_AUDIT_PATH, DEFAULT_APPROVAL_CONFIGURE_HINT, DEFAULT_SCOPE_SUBJECT, DEFAULT_SESSION_STORE_NAME, DailyFileChannel, DatabaseChannel, DatabaseCheck, DefaultHasher, DefaultHasher as Hash, Encrypter, EncryptionServiceProvider, ErrorServiceProvider, Event, EventManager, EventServiceProvider, ExceptionHandler, FailedJobReporter, FieldValidator, FileStore as FileCacheStore, FileChannel, FormRequest, Gate, HealthCheck, HealthManager, HealthServiceProvider, HttpException, I18nManager, I18nServiceProvider, InertiaServiceProvider, Input, Job, JobFailed, JobProcessed, JsonLoader, JsonResource, LOCALE_CONTEXT_KEY, LOG_LEVEL_PRIORITY, Listener, LocalDriver as LocalStorageDriver, LogManager, LogServiceProvider, LogTransport, Logger, Mail, MailChannel, MailManager, MailServiceProvider, MemoryApiTokenStore, MemoryDriver as MemoryBroadcastDriver, MemoryStore as MemoryCacheStore, MemoryChannel, MemoryCheck, MemoryDriver$1 as MemoryDriver, MemoryDriver$1 as MemoryQueueDriver, MemoryEmailVerificationStore, MemoryLoader, MemoryOAuthStateStore, MemoryPasswordResetStore, MemoryRateLimitStore, MemorySessionStore, MemoryDriver$2 as MemoryStorageDriver, MemoryTransport, MessageSigner, MethodNotAllowedException, ModelUserProvider, NodeHasher, NotFoundHttpException, Notification, NotificationManager, NotificationServiceProvider, OAUTH_SESSION_BINDING_KEY, OAuthManager, OAuthServiceProvider, Output, PER_PROCESS_SESSION_DRIVERS, PORTABLE_AGENT_TOOL_NAME_PATTERN, PREFLIGHT_ARGUMENT, PREFLIGHT_TOOL_NAME, Paginator, PendingSchedule, Policy, PresenceChannel, PrivateChannel, ProviderManager, QueueManager, QueueServiceProvider, RESERVED_AGENT_TOOL_NAMES, RedisDriver as RedisBroadcastDriver, RedisStore as RedisCacheStore, RedisCheck, RedisDriver$1 as RedisDriver, RedisDriver$1 as RedisQueueDriver, RequestFinished, RequestReceived, ResendTransport, Resource, ResourceCollection, Router, S3Driver, SERVERLESS_RUNTIME_LABELS, Schedule, ScheduledTask, Scheduler, SchedulingServiceProvider,
|
|
8029
|
+
export { AGENT_APPROVAL_CONFIG_KEY, AGENT_AUDIT_BINDING, AGENT_REDACTED, AGENT_TOOL_NAME_PATTERN, API_TOKEN_KEY, APPROVAL_STATUS_TOOL_NAME, AUTH_CONTEXT_KEY, AgentApprovalRequested, AgentToolDenied, AgentToolInvoked, Application, ApplicationShutdown, ApplicationStarted, ScryptHasher as Argon2Hasher, ScryptHasher, AuthManager, Response$1 as AuthResponse, AuthServiceProvider, AuthenticatableModel, AuthenticationException, AuthorizationException, AuthorizationServiceProvider, AutoDiscovery, BUILT_IN_SESSION_DRIVERS, BaseFactory, BaseFactory as Factory, BaseSeeder, BaseSeeder as Seeder, BaseUserProvider, BroadcastManager, BroadcastServiceProvider, BufferedOutput, CONTAINER_CONTEXT_KEY, CSP_NONCE_KEY, CSRF_FORM_FIELD, CSRF_HEADER_NAME, CSRF_TOKEN_KEY, CacheCheck, CacheManager, CacheServiceProvider, Channel, Command, ConsoleChannel, ConsoleKernel, Container, Controller, CookieSessionStore, CursorPaginator, CustomCheck, DEFAULT_AGENT_APPROVAL_TTL_MS, DEFAULT_AGENT_AUDIT_PATH, DEFAULT_APPROVAL_CONFIGURE_HINT, DEFAULT_SCOPE_SUBJECT, DEFAULT_SESSION_STORE_NAME, DailyFileChannel, DatabaseChannel, DatabaseCheck, DefaultHasher, DefaultHasher as Hash, Encrypter, EncryptionServiceProvider, ErrorServiceProvider, Event, EventManager, EventServiceProvider, ExceptionHandler, FailedJobReporter, FieldValidator, FileStore as FileCacheStore, FileChannel, FormRequest, Gate, HealthCheck, HealthManager, HealthServiceProvider, HttpException, I18nManager, I18nServiceProvider, InertiaServiceProvider, Input, Job, JobFailed, JobProcessed, JsonLoader, JsonResource, LOCALE_CONTEXT_KEY, LOG_LEVEL_PRIORITY, Listener, LocalDriver as LocalStorageDriver, LogManager, LogServiceProvider, LogTransport, Logger, Mail, MailChannel, MailManager, MailServiceProvider, MemoryApiTokenStore, MemoryDriver as MemoryBroadcastDriver, MemoryStore as MemoryCacheStore, MemoryChannel, MemoryCheck, MemoryDriver$1 as MemoryDriver, MemoryDriver$1 as MemoryQueueDriver, MemoryEmailVerificationStore, MemoryLoader, MemoryOAuthStateStore, MemoryPasswordResetStore, MemoryRateLimitStore, MemorySchedulerLock, MemorySessionStore, MemoryDriver$2 as MemoryStorageDriver, MemoryTransport, MessageSigner, MethodNotAllowedException, ModelUserProvider, NodeHasher, NotFoundHttpException, Notification, NotificationManager, NotificationServiceProvider, OAUTH_SESSION_BINDING_KEY, OAuthManager, OAuthServiceProvider, Output, PER_PROCESS_SESSION_DRIVERS, PORTABLE_AGENT_TOOL_NAME_PATTERN, PREFLIGHT_ARGUMENT, PREFLIGHT_TOOL_NAME, Paginator, PendingSchedule, Policy, PresenceChannel, PrivateChannel, ProviderManager, QueueManager, QueueServiceProvider, RESERVED_AGENT_TOOL_NAMES, RedisDriver as RedisBroadcastDriver, RedisStore as RedisCacheStore, RedisCheck, RedisDriver$1 as RedisDriver, RedisDriver$1 as RedisQueueDriver, RequestFinished, RequestReceived, ResendTransport, Resource, ResourceCollection, Router, S3Driver, SERVERLESS_RUNTIME_LABELS, Schedule, ScheduledTask, Scheduler, SchedulingServiceProvider, SeederRunner, ServiceProvider, SessionGuard, SessionManager, SlackChannel, SlidingWindowRateLimitStore, SmtpTransport, SqsDriver, StorageCheck, StorageManager, StorageServiceProvider, SyncDriver, SyncDriver as SyncQueueDriver, TaggedCache, TokenGuard, Translator, UserAuthenticated, UserLoggedOut, VALIDATED_DATA_KEY, ValidationException, Validator, ViewEngine, Worker, abort, abortIf, abortUnless, advertisesStructuredOutput, after, afterOrEqual, agentApprovalExpiredAt, agentApprovalFingerprint, agentApprovalPrincipalKey, agentApprovalStatusAt, agentApprovalUsableAt, agentApprovalVisibleTo, alpha, alphaDash, alphaNum, ambientBinding, ambientContainer, approvalStatusNotFoundMessage, array as arrayRule, attachAuthContext, authorize as authorizeAbility, authorizeAllMiddleware, authorizeMiddleware, authorizeResourceMiddleware, before, beforeOrEqual, between, boolean as booleanRule, buildAgentApprovalRequest, buildOAuthAuthorizeUrl, buildOAuthRedirectUrl, buildPasswordResetUrl, buildToolRequest, buildVerificationUrl, can, cannot, canonicalizeAgentApprovalInput, check as checkHash, classifyRegistrationScope, clearJobRegistry, clearNotificationRegistry, clearQueueDriver, collect, completeEmailVerification, completePasswordReset, confirmed, createAgentApprovalContext, createAgentAuditRecorder, createAgentInvocationPipeline, createApiToken, createApp, createAuditEmitter, createBearerTokenMiddleware, createBroadcastManager, createCacheManager, createConsoleKernel, createContainer, createCorsMiddleware, createCspMiddleware, createCsrfMiddleware, createDiscordOAuthProviderConfig, createEmailVerificationToken, createEncrypter, createEventManager, createExceptionHandler, createFacade, createFacades, createForceHttpsMiddleware, createGate, createGitHubOAuthProviderConfig, createGoogleOAuthProviderConfig, createHealthManager, createHostAuthorizationMiddleware, createI18n, createLogManager, createMailManager, createNotificationManager, createOAuthManager, createOAuthState, createPasswordResetToken, createQueueEventDispatcher, createQueueManager, createRateLimitMiddleware, createRedirectSafetyMiddleware, createRedisClient, createScheduler, createSecurityHeaders, createSeederRunner, createSessionMiddleware, createSqsAdapter, createStorageManager, createTypedBroadcaster, createValidator, csrfField, cursorPaginate, custom, customCheck, dailyFileDateStamp, dailyFilePath, dateFormat, date as dateRule, debugErrorMiddleware, decodeCursor, decrypt, defaultApplication, defaultContainer, defineFactory, defineGate, defineMiddleware, defineModule, definePlugin, definePolicy, deriveAgentTools, deriveAppKey, deriveAppKeyring, describeBuildFailure, detectLocaleMiddleware, detectServerlessRuntime, different, email as emailRule, encodeCursor, encrypt, endsWith, exchangeOAuthCode, exists, expandToolScopes, fetchOAuthUserProfile, file as fileRule, filterSensitiveData, formatValidationErrors, gateApproval, gatePreflight, gateToolCall, generateAppKey, generateKey, generateOtp, generatePassword, generateSlug, getApiToken, getApiTokenOrFail, getAppKeyringFromEnv, getBroadcastManager, getContainer, getCspNonce, getCsrfToken, getEncrypter, getExceptionHandler, getGate, getI18n, getInertiaSharedPropsResolver, getJob, getLogManager, getMailManager, getNextOccurrence, getNextOccurrences, getNotification, getNotificationManager, getPluralizationRule, getQueueDriver, getRateLimitInfo, getRegisteredJobs, getRequestContainer, getRequestLocale, getRequestTranslator, getSessionFromContext, getUserApiTokens, getValidatedData, hash, hashPassword, hmac, image as imageRule, inValues, inertia, integer, ip, ipv4, ipv6, isDue, isDueInTimezone, isEmailVerified, isReservedAgentToolName, isSafeRedirectUrl, jsonResponse, json as jsonRule, mail, mapToolResponse, matchDailyFileDate, matchesCron, max, maxFileSize, md5, mimes, min, minFileSize, mountModuleRoutes, needsRehash, normalizeAppKey, notIn, notifyApprovers, nullable, numeric, object as objectRule, paginate, parseApiToken, parseAppKey, parseAuditRecord, parseCron, parseOAuthRedirectUrl, parsePasswordResetUrl, parsePreviousAppKeys, parseRequestPayload, parseSignature, parseToolScope, parseVerificationUrl, pick, pluralizationRules, processJob, prototype, quickValidate, quickValidateOrThrow, random, randomBase64, randomBase64Url, randomHex, randomInt, randomString, readBearerToken, redactAgentArguments, regex, registerJob, registerNotification, renderDebugPage, renderDocument, renderErrorPage, requestIdMiddleware, requestLoggingMiddleware, requireAuthenticated, requireGuest, requireVerifiedEmail, required, requiredIf, requiredUnless, requiredWith, requiredWithout, resetCalledSeeders, resetDefaultApplication, resetRateLimit, resolve, resolveJobName, resolveNotifiableType, resolveOptional, resolveQueueDriver, revokeAllApiTokens, revokeApiToken, same, sample, sanitizeOAuthRedirect, scopedShape, scopesAllowTool, secureCompare, selectPluralForm, setBroadcastManager, setContainer, setEncrypter, setExceptionHandler, setGate, setI18n, setInertiaDocument, setInertiaSharedProps, setInertiaSsrRenderer, setLogManager, setMailManager, setNotificationManager, setQueueDriver, sha256, sha512, shareInertiaProps, shuffle, signUrl, size, startsWith, string as stringRule, t, tc, toApprovalStatusReport, toAuditRecord, toTimezone, tokenCan, tokenCanAll, tokenCanAny, tryGetI18n, tryGetRequestContainer, unique, url as urlRule, urlSafeToken, useAsDefaultApplication, uuid, uuid$1 as uuidRule, validate, validateRequest, validateRequestWith, validateSafe, verifyApiToken, verifyCsrfToken, verifyEmailToken, verifyHmac, verifyOAuthState, verifyPassword, verifyPasswordResetToken, verifySignedUrl, viteAsset, withAuthorization };
|
package/dist/lambda/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as detectServerlessRuntime } from "../serverless-D96rJb6x.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as getJob } from "../Job-BxioDEcS.js";
|
|
3
3
|
import { handle } from "hono/aws-lambda";
|
|
4
4
|
//#region src/lambda/index.ts
|
|
5
5
|
/** Create an AWS Lambda handler from an already booted Guren application. */
|
|
@@ -29,5 +29,14 @@ export declare class LogManager {
|
|
|
29
29
|
getChannelNames(): string[];
|
|
30
30
|
}
|
|
31
31
|
export declare function createLogManager(config: LogConfig): LogManager;
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the manager on the
|
|
34
|
+
* app's container instead — `LogServiceProvider` already does, and a provider of
|
|
35
|
+
* your own reaches it as `this.container.instance('log', manager)`.
|
|
36
|
+
*/
|
|
32
37
|
export declare function setLogManager(manager: LogManager): void;
|
|
38
|
+
/**
|
|
39
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use `this.make('log')`
|
|
40
|
+
* in a controller, job or command, or `defaultContainer().make('log')`.
|
|
41
|
+
*/
|
|
33
42
|
export declare function getLogManager(): LogManager;
|
package/dist/logging/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { n as filterSensitiveData, t as Logger } from "../Logger-DWXdtLSJ.js";
|
|
2
|
-
import { a as DailyFileChannel, c as matchDailyFileDate, d as LOG_LEVEL_PRIORITY, i as setLogManager, l as FileChannel, n as createLogManager, o as dailyFileDateStamp, r as getLogManager, s as dailyFilePath, t as LogManager, u as ConsoleChannel } from "../logging-
|
|
2
|
+
import { a as DailyFileChannel, c as matchDailyFileDate, d as LOG_LEVEL_PRIORITY, i as setLogManager, l as FileChannel, n as createLogManager, o as dailyFileDateStamp, r as getLogManager, s as dailyFilePath, t as LogManager, u as ConsoleChannel } from "../logging-CXotojgW.js";
|
|
3
3
|
export { ConsoleChannel, DailyFileChannel, FileChannel, LOG_LEVEL_PRIORITY, LogManager, Logger, createLogManager, dailyFileDateStamp, dailyFilePath, filterSensitiveData, getLogManager, matchDailyFileDate, setLogManager };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-Chbrul_m.js";
|
|
1
2
|
import { r as isPromiseLike, t as Logger } from "./Logger-DWXdtLSJ.js";
|
|
2
3
|
import * as path$1 from "node:path";
|
|
3
4
|
import * as fs from "node:fs";
|
|
@@ -349,12 +350,24 @@ function createLogManager(config) {
|
|
|
349
350
|
return new LogManager(config);
|
|
350
351
|
}
|
|
351
352
|
let globalLogManager = null;
|
|
353
|
+
/**
|
|
354
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the manager on the
|
|
355
|
+
* app's container instead — `LogServiceProvider` already does, and a provider of
|
|
356
|
+
* your own reaches it as `this.container.instance('log', manager)`.
|
|
357
|
+
*/
|
|
352
358
|
function setLogManager(manager) {
|
|
353
|
-
|
|
359
|
+
warnDeprecatedSetter("setLogManager");
|
|
360
|
+
globalLogManager = bindAmbient("log", manager) ? null : manager;
|
|
354
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use `this.make('log')`
|
|
364
|
+
* in a controller, job or command, or `defaultContainer().make('log')`.
|
|
365
|
+
*/
|
|
355
366
|
function getLogManager() {
|
|
356
|
-
|
|
357
|
-
|
|
367
|
+
warnDeprecatedGetter("getLogManager");
|
|
368
|
+
const manager = ambientBinding("log") ?? globalLogManager;
|
|
369
|
+
if (!manager) throw new Error("Log manager has not been initialized. Register LogServiceProvider, or call setLogManager() first.");
|
|
370
|
+
return manager;
|
|
358
371
|
}
|
|
359
372
|
//#endregion
|
|
360
373
|
export { DailyFileChannel as a, matchDailyFileDate as c, LOG_LEVEL_PRIORITY as d, setLogManager as i, FileChannel as l, createLogManager as n, dailyFileDateStamp as o, getLogManager as r, dailyFilePath as s, LogManager as t, ConsoleChannel as u };
|