@guren/server 2.25.0 → 2.26.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/README.md +42 -0
- package/dist/{Gate-YOt54xGF.js → Gate-BL_zW82W.js} +1 -1
- package/dist/{Job-COMzBNOL.js → Job-DsFMcXVk.js} +35 -3
- package/dist/{Resource-BdYd4J9a.js → Resource-gki0_2B6.js} +172 -37
- package/dist/agent/scopes.d.ts +1 -3
- package/dist/auth/email-verification.d.ts +6 -0
- package/dist/auth/index.js +1 -1
- package/dist/auth/password-reset.d.ts +8 -2
- package/dist/{auth-vFeem6uM.js → auth-DiyWALZT.js} +38 -9
- package/dist/authorization/index.js +2 -2
- package/dist/{authorization-BLhwA2Yh.js → authorization-E6X6Y-B6.js} +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/{broadcasting-BUBCPCnu.js → broadcasting-D0vMkKcq.js} +1 -1
- package/dist/cache/index.js +1 -1
- package/dist/cache/stores/FileStore.d.ts +2 -0
- package/dist/cache/stores/MemoryStore.d.ts +1 -0
- package/dist/cache/stores/RedisStore.d.ts +1 -0
- package/dist/cache/types.d.ts +2 -0
- package/dist/{cache-93n2PCnB.js → cache-DcnRufMe.js} +94 -25
- package/dist/contained-path-BkNSBljW.js +78 -0
- package/dist/container/Container.d.ts +6 -2
- package/dist/container/defineModule.d.ts +10 -0
- package/dist/{default-application-D5ezhhiV.js → default-application-DWwscxfW.js} +14 -18
- package/dist/encryption/index.js +1 -1
- package/dist/{encryption-D1dxfMqD.js → encryption-CWK5l22W.js} +1 -1
- package/dist/events/EventManager.d.ts +2 -0
- package/dist/events/index.js +1 -1
- package/dist/{events-c94CdUFc.js → events-DQavGm8W.js} +20 -7
- package/dist/health/HealthManager.d.ts +0 -1
- package/dist/health/index.js +1 -1
- package/dist/{health-CB0oS_UE.js → health-Bg0Xj3aD.js} +8 -8
- package/dist/http/Application.d.ts +12 -1
- package/dist/http/middleware/rate-limit.d.ts +1 -4
- package/dist/i18n/index.js +1 -1
- package/dist/{i18n-DqcRD4qL.js → i18n-DmMKcbqj.js} +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +61 -50
- package/dist/internal/app-conventions.d.ts +6 -0
- package/dist/internal/app-conventions.js +9 -0
- package/dist/internal/testing.d.ts +1 -1
- package/dist/internal/testing.js +2 -2
- package/dist/lambda/index.js +66 -28
- package/dist/logging/index.js +1 -1
- package/dist/{logging-YbKmbAd7.js → logging-Ci0mBk5k.js} +1 -1
- package/dist/mail/index.js +1 -1
- package/dist/{mail-uRBrUl9q.js → mail-CI2Kfe8P.js} +2 -2
- package/dist/mvc/Controller.d.ts +3 -2
- package/dist/mvc/inertia/InertiaEngine.d.ts +31 -0
- package/dist/mvc/inertia/props.d.ts +71 -0
- package/dist/notifications/index.js +1 -1
- package/dist/notifications/registry.d.ts +2 -2
- package/dist/{notifications-LHuujttf.js → notifications-Bp2uamzD.js} +7 -5
- package/dist/providers/ConfigServiceProvider.d.ts +5 -5
- package/dist/queue/Job.d.ts +5 -0
- package/dist/queue/Worker.d.ts +6 -1
- package/dist/queue/drivers/RedisDriver.d.ts +4 -2
- package/dist/queue/drivers/SqsDriver.d.ts +31 -2
- package/dist/queue/drivers/redis-queue-scripts.d.ts +83 -0
- package/dist/queue/index.js +2 -2
- package/dist/queue/serialize.d.ts +7 -0
- package/dist/queue/types.d.ts +13 -2
- package/dist/{queue-BiBn5Sff.js → queue-Bo4Q857L.js} +294 -125
- package/dist/redis/RedisEmailVerificationStore.d.ts +2 -0
- package/dist/redis/RedisPasswordResetStore.d.ts +2 -0
- package/dist/redis/auth-token-scripts.d.ts +4 -0
- package/dist/redis/index.js +50 -0
- package/dist/runtime/index.js +3 -36
- package/dist/scheduling/ScheduledTask.d.ts +2 -1
- package/dist/scheduling/index.js +1 -1
- package/dist/{scheduling-DhYfbJFj.js → scheduling-DNV5tj44.js} +32 -38
- package/dist/serialize-CKXek0Tr.js +17 -0
- package/dist/storage/drivers/LocalDriver.d.ts +15 -0
- package/dist/storage/index.js +1 -1
- package/dist/storage/url-path.d.ts +2 -0
- package/dist/{storage-6HLaUf9j.js → storage-wFsUJHZW.js} +78 -28
- package/dist/support/contained-path.d.ts +8 -0
- package/dist/support/registry-collision.d.ts +12 -0
- package/dist/{vite-manifest-C5kqRoBV.js → vite-manifest-DlU94f3Z.js} +2 -2
- package/package.json +20 -2
- package/dist/trim-slashes-BLY9hKAa.js +0 -22
package/dist/index.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as setInertiaSsrRenderer, D as isDeferredProp, E as isAlwaysProp, O as ensureErrorStackTracePolyfill, S as setInertiaDocument, T as defer, a as renderDocument, b as inertia, c as getRequestLocale, d as mountModuleRoutes, f as definePlugin, g as shareInertiaProps, h as setInertiaSharedProps, i as Controller, l as getRequestTranslator, m as resolveSharedInertiaProps, n as Resource, o as LOCALE_CONTEXT_KEY, p as getInertiaSharedPropsResolver, r as collect, s as detectLocaleMiddleware, t as JsonResource, u as defineModule, w as always } from "./Resource-gki0_2B6.js";
|
|
2
2
|
import { a as parseRequestPayload, i as parseRequestBody, n as flattenRequestQueries, r as formatValidationErrors } from "./request-CLOYytGP.js";
|
|
3
3
|
import { i as setValidatedInput, n as getValidatedInput } from "./validated-input-D84J8wcC.js";
|
|
4
4
|
import { t as HttpException } from "./HttpException-BlQ2yEmT.js";
|
|
5
5
|
import { n as ValidationException } from "./errors-JpkcCjjn.js";
|
|
6
|
-
import { a as withAuthorization, c as capabilitiesOf, i as resourceAbilityForMethod, l as mergeCapabilities, n as authorizeMiddleware, o as Policy, r as authorizeResourceMiddleware, s as definePolicy, t as authorizeAllMiddleware, u as stampCapabilities } from "./authorization-
|
|
6
|
+
import { a as withAuthorization, c as capabilitiesOf, i as resourceAbilityForMethod, l as mergeCapabilities, n as authorizeMiddleware, o as Policy, r as authorizeResourceMiddleware, s as definePolicy, t as authorizeAllMiddleware, u as stampCapabilities } from "./authorization-E6X6Y-B6.js";
|
|
7
7
|
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";
|
|
8
|
-
import {
|
|
8
|
+
import { i as trimSlashes } from "./contained-path-BkNSBljW.js";
|
|
9
9
|
import { PATH_PARAM_PATTERN, extractPathParamNames } from "./internal/route-path.js";
|
|
10
10
|
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";
|
|
11
11
|
import { n as detectServerlessRuntime, t as SERVERLESS_RUNTIME_LABELS } from "./serverless-D96rJb6x.js";
|
|
12
|
-
import { A as verifyOAuthState, B as NodeHasher, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as DEFAULT_PROVIDER, G as MemorySessionStore, H as BaseUserProvider, I as TokenGuard, J as getSessionFromContext, K as createSessionMiddleware, L as SessionGuard, M as isAppRelativePath, N as normalizeRedirectTarget, O as parseOAuthRedirectUrl, P as AuthManager, R as ModelUserProvider, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as installAgentPrincipal, V as ScryptHasher, W as readAgentPrincipal, _ as OAUTH_SESSION_BINDING_KEY, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, d as completePasswordReset, f as createPasswordResetToken, g as MemoryOAuthStateStore, h as AuthenticatableModel, i as createEmailVerificationToken, j as hostMatchesAllowlist, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, m as verifyPasswordResetToken, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, q as defaultCookieSecure, r as completeEmailVerification, s as requireVerifiedEmail, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as DefaultHasher } from "./auth-
|
|
12
|
+
import { A as verifyOAuthState, B as NodeHasher, C as createGoogleOAuthProviderConfig, D as fetchOAuthUserProfile, E as exchangeOAuthCode, F as DEFAULT_PROVIDER, G as MemorySessionStore, H as BaseUserProvider, I as TokenGuard, J as getSessionFromContext, K as createSessionMiddleware, L as SessionGuard, M as isAppRelativePath, N as normalizeRedirectTarget, O as parseOAuthRedirectUrl, P as AuthManager, R as ModelUserProvider, S as createGitHubOAuthProviderConfig, T as createOAuthState, U as installAgentPrincipal, V as ScryptHasher, W as readAgentPrincipal, _ as OAUTH_SESSION_BINDING_KEY, a as isEmailVerified, b as buildOAuthRedirectUrl, c as verifyEmailToken, d as completePasswordReset, f as createPasswordResetToken, g as MemoryOAuthStateStore, h as AuthenticatableModel, i as createEmailVerificationToken, j as hostMatchesAllowlist, k as sanitizeOAuthRedirect, l as MemoryPasswordResetStore, m as verifyPasswordResetToken, n as buildVerificationUrl, o as parseVerificationUrl, p as parsePasswordResetUrl, q as defaultCookieSecure, r as completeEmailVerification, s as requireVerifiedEmail, t as MemoryEmailVerificationStore, u as buildPasswordResetUrl, v as OAuthManager, w as createOAuthManager, x as createDiscordOAuthProviderConfig, y as buildOAuthAuthorizeUrl, z as DefaultHasher } from "./auth-DiyWALZT.js";
|
|
13
13
|
import { t as resolveOptional } from "./resolve-optional-ax6gPWTp.js";
|
|
14
14
|
import { t as warnOnce } from "./warn-once-p-IlMjra.js";
|
|
15
|
-
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-
|
|
15
|
+
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-DWwscxfW.js";
|
|
16
16
|
import { n as ServiceProvider, t as ProviderManager } from "./ServiceProvider-DDW3MqQJ.js";
|
|
17
17
|
import { o as AuthenticationException, r as getAuthContext, t as AUTH_CONTEXT_KEY } from "./context-af2n5abO.js";
|
|
18
18
|
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";
|
|
19
19
|
import { _ as verifyApiToken, a as getApiToken, c as hasBearerHeader, d as revokeAllApiTokens, f as revokeApiToken, g as tokenCanAny, h as tokenCanAll, i as createBearerTokenMiddleware, l as parseApiToken, m as tokenCan, n as MemoryApiTokenStore, o as getApiTokenOrFail, r as createApiToken, s as getUserApiTokens, t as API_TOKEN_KEY, u as readBearerToken } from "./api-token-BbgDEd6j.js";
|
|
20
20
|
import { a as runInRequestScope, i as keepAlive, n as filterSensitiveData, t as Logger } from "./Logger-DWXdtLSJ.js";
|
|
21
|
-
import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemoryStore, r as TaggedCache, s as resolveLazyRedisClient, t as CacheManager } from "./cache-
|
|
21
|
+
import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemoryStore, r as TaggedCache, s as resolveLazyRedisClient, t as CacheManager } from "./cache-DcnRufMe.js";
|
|
22
22
|
import { n as createRedisClient, r as RedisSessionStore } from "./client-C5Wj9P9o.js";
|
|
23
23
|
import { r as isMcpEndpointEnabled } from "./endpoint-Coq0K_6I.js";
|
|
24
24
|
import { n as isHotReloadRuntime, r as matchingOpenParen, t as claimHotDisposable } from "./hot-disposables-W2fH-GID.js";
|
|
25
|
-
import { 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-
|
|
26
|
-
import { a as cannot, f as setGate, g as tryGetRequestContainer, h as getRequestContainer, i as can, l as getGate, m as CONTAINER_CONTEXT_KEY, n as Response$1, o as createGate, p as AuthorizationException, r as authorize, s as defineGate, t as Gate } from "./Gate-
|
|
25
|
+
import { 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-DmMKcbqj.js";
|
|
26
|
+
import { a as cannot, f as setGate, g as tryGetRequestContainer, h as getRequestContainer, i as can, l as getGate, m as CONTAINER_CONTEXT_KEY, n as Response$1, o as createGate, p as AuthorizationException, r as authorize, s as defineGate, t as Gate } from "./Gate-BL_zW82W.js";
|
|
27
27
|
import { r as isDocsViewerEnabled } from "./endpoint-CTIzcagh.js";
|
|
28
|
-
import { c as isViteProduction, d as startViteDevServer, 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-
|
|
28
|
+
import { c as isViteProduction, d as startViteDevServer, 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-DlU94f3Z.js";
|
|
29
29
|
import { readObjectSchema, toJsonSchema } from "./internal/zod-json-schema.js";
|
|
30
|
-
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-
|
|
31
|
-
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-
|
|
32
|
-
import { a as getJob, d as resolveQueueDriver, f as setQueueDriver, l as registerJob, n as clearJobRegistry, o as getQueueDriver, r as clearQueueDriver, s as getRegisteredJobs, t as Job, u as resolveJobName } from "./Job-
|
|
33
|
-
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-
|
|
34
|
-
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-
|
|
30
|
+
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-DQavGm8W.js";
|
|
31
|
+
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-Bp2uamzD.js";
|
|
32
|
+
import { a as getJob, d as resolveQueueDriver, f as setQueueDriver, l as registerJob, n as clearJobRegistry, o as getQueueDriver, r as clearQueueDriver, s as getRegisteredJobs, t as Job, u as resolveJobName } from "./Job-DsFMcXVk.js";
|
|
33
|
+
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-Bo4Q857L.js";
|
|
34
|
+
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-CI2Kfe8P.js";
|
|
35
35
|
import { a as LOG_LEVEL_PRIORITY, i as matchDailyFileDate, n as dailyFileDateStamp, r as dailyFilePath, t as DailyFileChannel } from "./DailyFileChannel-CTTPA0EF.js";
|
|
36
|
-
import { a as FileChannel, i as setLogManager, n as createLogManager, o as ConsoleChannel, r as getLogManager, t as LogManager } from "./logging-
|
|
37
|
-
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-
|
|
36
|
+
import { a as FileChannel, i as setLogManager, n as createLogManager, o as ConsoleChannel, r as getLogManager, t as LogManager } from "./logging-Ci0mBk5k.js";
|
|
37
|
+
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-D0vMkKcq.js";
|
|
38
38
|
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";
|
|
39
|
-
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-
|
|
40
|
-
import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver$2, t as StorageManager } from "./storage-
|
|
41
|
-
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-
|
|
42
|
-
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-
|
|
39
|
+
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-CWK5l22W.js";
|
|
40
|
+
import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver$2, t as StorageManager } from "./storage-wFsUJHZW.js";
|
|
41
|
+
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-Bg0Xj3aD.js";
|
|
42
|
+
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-DNV5tj44.js";
|
|
43
43
|
import { Hono } from "hono";
|
|
44
44
|
import { deleteCookie, getCookie } from "hono/cookie";
|
|
45
45
|
import { createCipheriv, createDecipheriv, randomBytes } from "node:crypto";
|
|
@@ -1346,15 +1346,13 @@ function validateSafe(schema, data) {
|
|
|
1346
1346
|
var BaseMemoryStore = class {
|
|
1347
1347
|
now;
|
|
1348
1348
|
cleanupInterval;
|
|
1349
|
-
/**
|
|
1350
|
-
* Unlike the cache sweep, this interval is not `unref()`ed, so a leaked one
|
|
1351
|
-
* both duplicates work and keeps the process alive on its own.
|
|
1352
|
-
*/
|
|
1349
|
+
/** A sweep leaked across a hot reload would run beside this one. */
|
|
1353
1350
|
hotReloadClaim;
|
|
1354
1351
|
constructor(cleanupIntervalMs = 6e4, now = () => Date.now()) {
|
|
1355
1352
|
this.now = now;
|
|
1356
1353
|
if (cleanupIntervalMs <= 0) return;
|
|
1357
1354
|
this.cleanupInterval = setInterval(() => this.cleanup(), cleanupIntervalMs);
|
|
1355
|
+
this.cleanupInterval.unref?.();
|
|
1358
1356
|
this.hotReloadClaim = claimHotDisposable("rate-limit-store", isHotReloadRuntime() ? (/* @__PURE__ */ new Error()).stack : void 0, this.constructor.name, () => this.destroy());
|
|
1359
1357
|
}
|
|
1360
1358
|
destroy() {
|
|
@@ -1375,21 +1373,21 @@ var MemoryRateLimitStore = class extends BaseMemoryStore {
|
|
|
1375
1373
|
this.entries.delete(key);
|
|
1376
1374
|
return null;
|
|
1377
1375
|
}
|
|
1378
|
-
return entry;
|
|
1376
|
+
return { ...entry };
|
|
1379
1377
|
}
|
|
1380
1378
|
async increment(key, windowMs) {
|
|
1381
1379
|
const now = this.now();
|
|
1382
1380
|
const existing = this.entries.get(key);
|
|
1383
1381
|
if (existing && now < existing.resetAt) {
|
|
1384
1382
|
existing.count++;
|
|
1385
|
-
return existing;
|
|
1383
|
+
return { ...existing };
|
|
1386
1384
|
}
|
|
1387
1385
|
const entry = {
|
|
1388
1386
|
count: 1,
|
|
1389
1387
|
resetAt: now + windowMs
|
|
1390
1388
|
};
|
|
1391
1389
|
this.entries.set(key, entry);
|
|
1392
|
-
return entry;
|
|
1390
|
+
return { ...entry };
|
|
1393
1391
|
}
|
|
1394
1392
|
async reset(key) {
|
|
1395
1393
|
this.entries.delete(key);
|
|
@@ -2524,10 +2522,10 @@ var InertiaServiceProvider = class extends ServiceProvider {
|
|
|
2524
2522
|
const session = getSessionFromContext(ctx);
|
|
2525
2523
|
if (session) {
|
|
2526
2524
|
const errors = session.getFlash("errors");
|
|
2527
|
-
return errors && Object.keys(errors).length > 0 ? { errors } : {};
|
|
2525
|
+
return errors && Object.keys(errors).length > 0 ? { errors: always(errors) } : {};
|
|
2528
2526
|
}
|
|
2529
2527
|
const errors = readValidationErrorsCookie(ctx);
|
|
2530
|
-
return errors ? { errors } : {};
|
|
2528
|
+
return errors ? { errors: always(errors) } : {};
|
|
2531
2529
|
}, this.container);
|
|
2532
2530
|
}
|
|
2533
2531
|
};
|
|
@@ -2571,11 +2569,11 @@ function recordEnvReads(values) {
|
|
|
2571
2569
|
//#endregion
|
|
2572
2570
|
//#region src/providers/ConfigServiceProvider.ts
|
|
2573
2571
|
/**
|
|
2574
|
-
* Validates `createApp({ env })` and binds it as `env`, then resolves and binds
|
|
2575
|
-
*
|
|
2576
|
-
*
|
|
2577
|
-
*
|
|
2578
|
-
*
|
|
2572
|
+
* Validates `createApp({ env })` and binds it as `env`, then resolves and binds each
|
|
2573
|
+
* `createApp({ config })` definition, then each module's (RFC 0027 §1-§3, RFC 0002).
|
|
2574
|
+
* Registered first: a bad environment fails the boot before anything registers,
|
|
2575
|
+
* every later register() sees the configured managers, and a later provider that
|
|
2576
|
+
* rebinds one fails the boot through {@link ownedBindings}.
|
|
2579
2577
|
*/
|
|
2580
2578
|
var ConfigServiceProvider = class extends ServiceProvider {
|
|
2581
2579
|
env = {};
|
|
@@ -2587,9 +2585,10 @@ var ConfigServiceProvider = class extends ServiceProvider {
|
|
|
2587
2585
|
this.env = this.parseEnv(app);
|
|
2588
2586
|
this.resolved = [];
|
|
2589
2587
|
this.owned = /* @__PURE__ */ new Map();
|
|
2590
|
-
const
|
|
2591
|
-
assertDistinctKeys(
|
|
2592
|
-
for (const
|
|
2588
|
+
const entries = app.configEntries;
|
|
2589
|
+
assertDistinctKeys(entries);
|
|
2590
|
+
for (const entry of entries) {
|
|
2591
|
+
const { definition } = entry;
|
|
2593
2592
|
const { env, read } = recordEnvReads(this.env);
|
|
2594
2593
|
const config = definition.resolve(env);
|
|
2595
2594
|
const placeholders = [...read].filter((key) => this.unset.has(key));
|
|
@@ -2603,7 +2602,7 @@ var ConfigServiceProvider = class extends ServiceProvider {
|
|
|
2603
2602
|
const binding = this.container.bindingOf(key);
|
|
2604
2603
|
if (binding !== before.get(key)) this.owned.set(key, {
|
|
2605
2604
|
binding,
|
|
2606
|
-
source: `config/${definition.key}.ts`
|
|
2605
|
+
source: `config/${definition.key}.ts${entry.module === void 0 ? "" : ` of the "${entry.module}" module`}`
|
|
2607
2606
|
});
|
|
2608
2607
|
}
|
|
2609
2608
|
this.resolved.push({
|
|
@@ -2632,13 +2631,16 @@ var ConfigServiceProvider = class extends ServiceProvider {
|
|
|
2632
2631
|
return parsed.values;
|
|
2633
2632
|
}
|
|
2634
2633
|
};
|
|
2635
|
-
function assertDistinctKeys(
|
|
2634
|
+
function assertDistinctKeys(entries) {
|
|
2636
2635
|
const seen = /* @__PURE__ */ new Map();
|
|
2637
|
-
|
|
2638
|
-
const first = seen.get(definition.key);
|
|
2639
|
-
if (first !== void 0) throw new Error(`[guren]
|
|
2640
|
-
seen.set(definition.key,
|
|
2641
|
-
}
|
|
2636
|
+
for (const entry of entries) {
|
|
2637
|
+
const first = seen.get(entry.definition.key);
|
|
2638
|
+
if (first !== void 0) throw new Error(`[guren] "${entry.definition.key}" has two config definitions, at ${listedAt(first)} and ${listedAt(entry)}. Keep one.`);
|
|
2639
|
+
seen.set(entry.definition.key, entry);
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
function listedAt(entry) {
|
|
2643
|
+
return entry.module === void 0 ? `createApp({ config })[${entry.index}]` : `the "${entry.module}" module's config[${entry.index}]`;
|
|
2642
2644
|
}
|
|
2643
2645
|
//#endregion
|
|
2644
2646
|
//#region src/http/Application.ts
|
|
@@ -2871,10 +2873,20 @@ var Application = class {
|
|
|
2871
2873
|
disposeBunTeardown;
|
|
2872
2874
|
autoSessionAttached = false;
|
|
2873
2875
|
cookielessAuthPaths = /* @__PURE__ */ new Set();
|
|
2876
|
+
/** {@link configDefinitions} with where each was listed, which ConfigServiceProvider's errors name. */
|
|
2877
|
+
configEntries;
|
|
2874
2878
|
routesRegistered = false;
|
|
2875
2879
|
bootPromise;
|
|
2876
2880
|
constructor(options = {}) {
|
|
2877
2881
|
this.options = options;
|
|
2882
|
+
this.configEntries = [...(options.config ?? []).map((definition, index) => ({
|
|
2883
|
+
definition,
|
|
2884
|
+
index
|
|
2885
|
+
})), ...(options.modules ?? []).flatMap((gurenModule) => (gurenModule.config ?? []).map((definition, index) => ({
|
|
2886
|
+
definition,
|
|
2887
|
+
index,
|
|
2888
|
+
module: gurenModule.name
|
|
2889
|
+
})))];
|
|
2878
2890
|
this.hono = new Hono();
|
|
2879
2891
|
this.container = new Container();
|
|
2880
2892
|
this.router = new Router();
|
|
@@ -2888,7 +2900,7 @@ var Application = class {
|
|
|
2888
2900
|
if (options.inertia?.document) this.container.instance("inertia.document", options.inertia.document);
|
|
2889
2901
|
if (options.inertia?.ssrRenderer) this.container.instance("inertia.ssrRenderer", options.inertia.ssrRenderer);
|
|
2890
2902
|
if (options.inertia?.share) shareInertiaProps(options.inertia.share, this.container);
|
|
2891
|
-
if (options.env ||
|
|
2903
|
+
if (options.env || this.configEntries.length > 0) this.providerManager.register(ConfigServiceProvider);
|
|
2892
2904
|
this.authManager.registerGuard("web", ({ session }) => {
|
|
2893
2905
|
const provider = this.authManager.hasProvider("users") ? this.authManager.getProvider(DEFAULT_PROVIDER) : unconfiguredUserProvider;
|
|
2894
2906
|
return new SessionGuard({
|
|
@@ -2921,8 +2933,9 @@ var Application = class {
|
|
|
2921
2933
|
get envSchema() {
|
|
2922
2934
|
return this.options.env;
|
|
2923
2935
|
}
|
|
2936
|
+
/** `createApp({ config })`, then each module's `config` in `modules` order (RFC 0002, RFC 0027 §2). */
|
|
2924
2937
|
get configDefinitions() {
|
|
2925
|
-
return this.
|
|
2938
|
+
return this.configEntries.map((entry) => entry.definition);
|
|
2926
2939
|
}
|
|
2927
2940
|
markAutoSessionAttached() {
|
|
2928
2941
|
this.autoSessionAttached = true;
|
|
@@ -3541,9 +3554,7 @@ function isReservedAgentToolName(name) {
|
|
|
3541
3554
|
*/
|
|
3542
3555
|
/**
|
|
3543
3556
|
* The MCP tool-name grammar (SEP-986), which a `tool:` scope names and a
|
|
3544
|
-
* `tools:<prefix>.*` scope must stay inside.
|
|
3545
|
-
* holds the same pattern; collapsing the two needs a built server, so it waits
|
|
3546
|
-
* for the PR doing that build-order work. `*` is not in the charset, so
|
|
3557
|
+
* `tools:<prefix>.*` scope must stay inside. `*` is not in the charset, so
|
|
3547
3558
|
* `tool:posts.*` is rejected with no special case.
|
|
3548
3559
|
*/
|
|
3549
3560
|
const AGENT_TOOL_NAME_PATTERN = /^[A-Za-z0-9._-]{1,128}$/;
|
|
@@ -7491,4 +7502,4 @@ function defineStorageConfig(resolve) {
|
|
|
7491
7502
|
//#region src/index.ts
|
|
7492
7503
|
ensureErrorStackTracePolyfill();
|
|
7493
7504
|
//#endregion
|
|
7494
|
-
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, Env, EnvSchema, EnvValidationError, EnvVar, 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, createAgentCallBudget, 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, defineCacheConfig, defineConfig, defineEnv, defineFactory, defineGate, defineHttpConfig, defineMailConfig, defineMiddleware, defineModule, defineOAuthConfig, definePlugin, definePolicy, defineQueueConfig, defineStorageConfig, 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, isRawEnvKey, 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, recordEnvReads, redactAgentArguments, regex, registerJob, registerNotification, renderDebugPage, renderDocument, renderErrorPage, requestIdMiddleware, requestLoggingMiddleware, requireAuthenticated, requireGuest, requireVerifiedEmail, required, requiredIf, requiredUnless, requiredWith, requiredWithout, resetCalledSeeders, resetDefaultApplication, resetRateLimit, resolve, resolveAgentAuditSink, 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 };
|
|
7505
|
+
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, Env, EnvSchema, EnvValidationError, EnvVar, 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, always, 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, createAgentCallBudget, 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, defer, defineCacheConfig, defineConfig, defineEnv, defineFactory, defineGate, defineHttpConfig, defineMailConfig, defineMiddleware, defineModule, defineOAuthConfig, definePlugin, definePolicy, defineQueueConfig, defineStorageConfig, 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, isAlwaysProp, isDeferredProp, isDue, isDueInTimezone, isEmailVerified, isRawEnvKey, 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, recordEnvReads, redactAgentArguments, regex, registerJob, registerNotification, renderDebugPage, renderDocument, renderErrorPage, requestIdMiddleware, requestLoggingMiddleware, requireAuthenticated, requireGuest, requireVerifiedEmail, required, requiredIf, requiredUnless, requiredWith, requiredWithout, resetCalledSeeders, resetDefaultApplication, resetRateLimit, resolve, resolveAgentAuditSink, 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 };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where an app registers its durable agents (RFC 0017). A leaf with no imports:
|
|
3
|
+
* `@guren/core/internal/deploy-build` reads it at plugin build time, where the
|
|
4
|
+
* runtime barrel must not load, and the CLI checks read it without depending on core.
|
|
5
|
+
*/
|
|
6
|
+
export declare const AGENTS_CONFIG_FILE = "config/agents.ts";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/internal/app-conventions.ts
|
|
2
|
+
/**
|
|
3
|
+
* Where an app registers its durable agents (RFC 0017). A leaf with no imports:
|
|
4
|
+
* `@guren/core/internal/deploy-build` reads it at plugin build time, where the
|
|
5
|
+
* runtime barrel must not load, and the CLI checks read it without depending on core.
|
|
6
|
+
*/
|
|
7
|
+
const AGENTS_CONFIG_FILE = "config/agents.ts";
|
|
8
|
+
//#endregion
|
|
9
|
+
export { AGENTS_CONFIG_FILE };
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
export { Controller } from '../mvc/Controller.js';
|
|
9
9
|
export type { InertiaPageContractLike, InertiaResponseOptions } from '../mvc/Controller.js';
|
|
10
|
-
export { acceptsJson, serializePage } from '../mvc/inertia/InertiaEngine.js';
|
|
10
|
+
export { acceptsJson, buildInertiaPage, INERTIA_VARY, serializePage } from '../mvc/inertia/InertiaEngine.js';
|
|
11
11
|
export { Resource, JsonResource, collect } from '../http/resources/Resource.js';
|
|
12
12
|
export { ValidationException } from '../errors/exceptions/ValidationException.js';
|
|
13
13
|
export { AuthenticationException } from '../errors/exceptions/AuthenticationException.js';
|
package/dist/internal/testing.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { _ as
|
|
1
|
+
import { _ as INERTIA_VARY, f as definePlugin, i as Controller, n as Resource, r as collect, t as JsonResource, u as defineModule, v as acceptsJson, x as serializePage, y as buildInertiaPage } from "../Resource-gki0_2B6.js";
|
|
2
2
|
import { r as formatValidationErrors } from "../request-CLOYytGP.js";
|
|
3
3
|
import { n as ValidationException } from "../errors-JpkcCjjn.js";
|
|
4
4
|
import { n as ServiceProvider } from "../ServiceProvider-DDW3MqQJ.js";
|
|
5
5
|
import { o as AuthenticationException } from "../context-af2n5abO.js";
|
|
6
|
-
export { AuthenticationException, Controller, JsonResource, Resource, ServiceProvider, ValidationException, acceptsJson, collect, defineModule, definePlugin, formatValidationErrors, serializePage };
|
|
6
|
+
export { AuthenticationException, Controller, INERTIA_VARY, JsonResource, Resource, ServiceProvider, ValidationException, acceptsJson, buildInertiaPage, collect, defineModule, definePlugin, formatValidationErrors, serializePage };
|
package/dist/lambda/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { n as detectServerlessRuntime } from "../serverless-D96rJb6x.js";
|
|
2
|
-
import { a as getJob } from "../Job-
|
|
2
|
+
import { a as getJob } from "../Job-DsFMcXVk.js";
|
|
3
|
+
import { t as deserializeQueuedJob } from "../serialize-CKXek0Tr.js";
|
|
3
4
|
import { handle } from "hono/aws-lambda";
|
|
4
5
|
//#region src/lambda/index.ts
|
|
5
6
|
/** Create an AWS Lambda handler from an already booted Guren application. */
|
|
@@ -12,26 +13,73 @@ function createLambdaHandler(app) {
|
|
|
12
13
|
*/
|
|
13
14
|
function createSqsHandler() {
|
|
14
15
|
return async (event) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
await instance.failed(job.payload, error);
|
|
27
|
-
} catch {}
|
|
28
|
-
throw error;
|
|
16
|
+
if (event.Records.some((record) => record.eventSourceARN.endsWith(".fifo"))) {
|
|
17
|
+
for (let index = 0; index < event.Records.length; index++) try {
|
|
18
|
+
await processSqsRecord(event.Records[index]);
|
|
19
|
+
} catch {
|
|
20
|
+
const stopped = event.Records.slice(index);
|
|
21
|
+
for (const record of stopped.slice(1)) logSqsFailure({
|
|
22
|
+
msg: "SQS record left unprocessed",
|
|
23
|
+
messageId: record.messageId,
|
|
24
|
+
stoppedAt: stopped[0].messageId
|
|
25
|
+
});
|
|
26
|
+
return { batchItemFailures: stopped.map((record) => ({ itemIdentifier: record.messageId })) };
|
|
29
27
|
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
return { batchItemFailures: [] };
|
|
29
|
+
}
|
|
30
|
+
const results = await Promise.allSettled(event.Records.map(processSqsRecord));
|
|
31
|
+
const batchItemFailures = [];
|
|
32
|
+
for (let index = 0; index < results.length; index++) if (results[index].status === "rejected") batchItemFailures.push({ itemIdentifier: event.Records[index].messageId });
|
|
33
|
+
return { batchItemFailures };
|
|
33
34
|
};
|
|
34
35
|
}
|
|
36
|
+
/** The tests parse these lines, so the envelope is a contract, not formatting. */
|
|
37
|
+
function logSqsFailure(fields) {
|
|
38
|
+
console.error(JSON.stringify({
|
|
39
|
+
level: "error",
|
|
40
|
+
...fields
|
|
41
|
+
}));
|
|
42
|
+
}
|
|
43
|
+
async function processSqsRecord(record) {
|
|
44
|
+
let job;
|
|
45
|
+
try {
|
|
46
|
+
job = deserializeQueuedJob(record.body);
|
|
47
|
+
const JobClass = getJob(job.name);
|
|
48
|
+
if (!JobClass) throw new Error(`Job class not found: ${job.name}`);
|
|
49
|
+
const receiveCount = Number(record.attributes.ApproximateReceiveCount);
|
|
50
|
+
if (!Number.isSafeInteger(receiveCount) || receiveCount < 1) throw new Error("SQS records require a positive ApproximateReceiveCount.");
|
|
51
|
+
if (!Number.isSafeInteger(job.attempts) || job.attempts < 0 || !Number.isSafeInteger(job.maxAttempts) || job.maxAttempts < 1) throw new Error("SQS jobs require valid attempts and maxAttempts counts.");
|
|
52
|
+
job.attempts += receiveCount;
|
|
53
|
+
if (job.attempts > job.maxAttempts) throw new Error(`SQS job exceeded maxAttempts (${job.maxAttempts}).`);
|
|
54
|
+
const instance = new JobClass();
|
|
55
|
+
try {
|
|
56
|
+
await instance.handle(job.payload);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
if (job.attempts >= job.maxAttempts && instance.failed) try {
|
|
59
|
+
await instance.failed(job.payload, error);
|
|
60
|
+
} catch (hookError) {
|
|
61
|
+
logSqsFailure({
|
|
62
|
+
msg: "Error in job.failed() handler",
|
|
63
|
+
messageId: record.messageId,
|
|
64
|
+
job: job.name,
|
|
65
|
+
error: hookError.message
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
throw error;
|
|
69
|
+
}
|
|
70
|
+
} catch (error) {
|
|
71
|
+
logSqsFailure({
|
|
72
|
+
msg: "SQS job failed",
|
|
73
|
+
messageId: record.messageId,
|
|
74
|
+
job: job?.name,
|
|
75
|
+
queue: job?.queue,
|
|
76
|
+
attempt: job?.attempts,
|
|
77
|
+
maxAttempts: job?.maxAttempts,
|
|
78
|
+
error: error.message
|
|
79
|
+
});
|
|
80
|
+
throw error;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
35
83
|
/** Create an AWS Lambda handler for running scheduled tasks via EventBridge. */
|
|
36
84
|
function createScheduleHandler(scheduler) {
|
|
37
85
|
return async () => {
|
|
@@ -68,15 +116,5 @@ function getLambdaContext() {
|
|
|
68
116
|
tmpDir: "/tmp"
|
|
69
117
|
};
|
|
70
118
|
}
|
|
71
|
-
/** Deserialize a JSON SQS message body into a QueuedJob-like object. */
|
|
72
|
-
function deserializeSqsJob(body) {
|
|
73
|
-
const raw = JSON.parse(body);
|
|
74
|
-
return {
|
|
75
|
-
...raw,
|
|
76
|
-
availableAt: new Date(raw.availableAt),
|
|
77
|
-
createdAt: new Date(raw.createdAt),
|
|
78
|
-
reservedAt: raw.reservedAt ? new Date(raw.reservedAt) : null
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
119
|
//#endregion
|
|
82
120
|
export { createConsoleHandler, createLambdaHandler, createScheduleHandler, createSqsHandler, getLambdaContext, isLambda };
|
package/dist/logging/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { n as filterSensitiveData, t as Logger } from "../Logger-DWXdtLSJ.js";
|
|
2
2
|
import { a as LOG_LEVEL_PRIORITY, i as matchDailyFileDate, n as dailyFileDateStamp, r as dailyFilePath, t as DailyFileChannel } from "../DailyFileChannel-CTTPA0EF.js";
|
|
3
|
-
import { a as FileChannel, i as setLogManager, n as createLogManager, o as ConsoleChannel, r as getLogManager, t as LogManager } from "../logging-
|
|
3
|
+
import { a as FileChannel, i as setLogManager, n as createLogManager, o as ConsoleChannel, r as getLogManager, t as LogManager } from "../logging-Ci0mBk5k.js";
|
|
4
4
|
export { ConsoleChannel, DailyFileChannel, FileChannel, LOG_LEVEL_PRIORITY, LogManager, Logger, createLogManager, dailyFileDateStamp, dailyFilePath, filterSensitiveData, getLogManager, matchDailyFileDate, setLogManager };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-
|
|
1
|
+
import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-DWwscxfW.js";
|
|
2
2
|
import { r as isPromiseLike, t as Logger } from "./Logger-DWXdtLSJ.js";
|
|
3
3
|
import { a as LOG_LEVEL_PRIORITY, t as DailyFileChannel } from "./DailyFileChannel-CTTPA0EF.js";
|
|
4
4
|
import * as path$1 from "node:path";
|
package/dist/mail/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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-CI2Kfe8P.js";
|
|
2
2
|
export { LogTransport, Mail, MailManager, MemoryTransport, ResendTransport, SmtpTransport, createMailManager, getMailManager, mail, setMailManager };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as resolveOptional } from "./resolve-optional-ax6gPWTp.js";
|
|
2
|
-
import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-
|
|
3
|
-
import { c as pinnedQueueDriver, d as resolveQueueDriver, i as enqueueJob, l as registerJob, t as Job } from "./Job-
|
|
2
|
+
import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-DWwscxfW.js";
|
|
3
|
+
import { c as pinnedQueueDriver, d as resolveQueueDriver, i as enqueueJob, l as registerJob, t as Job } from "./Job-DsFMcXVk.js";
|
|
4
4
|
import { t as parseMailAddress } from "./address-D0Iq-XIH.js";
|
|
5
5
|
import nodemailer from "nodemailer";
|
|
6
6
|
//#region src/mail/transports/SmtpTransport.ts
|
package/dist/mvc/Controller.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { Context } from 'hono';
|
|
|
2
2
|
import type { FC } from 'hono/jsx';
|
|
3
3
|
import { type ViewOptions } from './view.js';
|
|
4
4
|
import { type InertiaOptions } from './inertia/InertiaEngine.js';
|
|
5
|
+
import type { InertiaPropsInput, ResolvedInertiaProps } from './inertia/props.js';
|
|
5
6
|
import { type ResolvedSharedInertiaProps } from './inertia/shared.js';
|
|
6
7
|
import { type RegisteredTranslationKey, type ReplacementValues } from '../i18n/index.js';
|
|
7
8
|
import type { AuthContext } from '../auth/types.js';
|
|
@@ -147,8 +148,8 @@ export declare class Controller {
|
|
|
147
148
|
* data is emitted verbatim, so sanitize user-supplied URLs upstream.
|
|
148
149
|
*/
|
|
149
150
|
protected view<P>(component: FC<P>, props: P, options?: ViewOptions): Promise<Response>;
|
|
150
|
-
protected inertia<Component extends string, Props extends DefaultInertiaProps>(component: Component, props: Props, options?: InertiaResponseOptions): Promise<InertiaResponse<Component, Props & ResolvedSharedInertiaProps>>;
|
|
151
|
-
protected inertia<TPage extends InertiaPageContractLike>(page: TPage, props: InertiaPageProps<TPage
|
|
151
|
+
protected inertia<Component extends string, Props extends DefaultInertiaProps>(component: Component, props: Props, options?: InertiaResponseOptions): Promise<InertiaResponse<Component, ResolvedInertiaProps<Props> & ResolvedSharedInertiaProps>>;
|
|
152
|
+
protected inertia<TPage extends InertiaPageContractLike>(page: TPage, props: InertiaPropsInput<InertiaPageProps<TPage>>, options?: InertiaResponseOptions): Promise<InertiaResponse<InertiaPageComponent<TPage>, InertiaPageProps<TPage> & ResolvedSharedInertiaProps>>;
|
|
152
153
|
/**
|
|
153
154
|
* Locale for the current request: the request-scoped `locale` context
|
|
154
155
|
* variable wins over the app-wide i18n locale. Falls back to `'en'`.
|
|
@@ -32,6 +32,8 @@ export interface InertiaPagePayload {
|
|
|
32
32
|
props: Record<string, unknown>;
|
|
33
33
|
url: string;
|
|
34
34
|
version?: string;
|
|
35
|
+
/** Deferred prop keys by group, announced on a full visit and fetched by the client per group. */
|
|
36
|
+
deferredProps?: Record<string, string[]>;
|
|
35
37
|
}
|
|
36
38
|
export interface InertiaSsrContext {
|
|
37
39
|
page: InertiaPagePayload;
|
|
@@ -102,6 +104,35 @@ export declare function setInertiaDocument(options: InertiaDocumentOptions | und
|
|
|
102
104
|
*/
|
|
103
105
|
export declare function setInertiaSsrRenderer(renderer: InertiaSsrRenderer | undefined): void;
|
|
104
106
|
export declare function inertia(component: string, props: Record<string, unknown>, options?: InertiaOptions): Promise<Response>;
|
|
107
|
+
export interface InertiaRenderResult {
|
|
108
|
+
readonly response: Response;
|
|
109
|
+
/** The page the response carries; absent on a 409 version-mismatch, which renders none. */
|
|
110
|
+
readonly page?: InertiaPagePayload;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* The page body varies on the partial-reload headers as well as on
|
|
114
|
+
* `X-Inertia`: a shared cache keyed on the URL alone would hand a narrowed
|
|
115
|
+
* partial response to the next full visit.
|
|
116
|
+
*/
|
|
117
|
+
export declare const INERTIA_VARY = "Accept, X-Inertia, X-Inertia-Partial-Component, X-Inertia-Partial-Data, X-Inertia-Partial-Except";
|
|
118
|
+
/**
|
|
119
|
+
* {@link inertia} plus the page it sent, for a caller that records the props
|
|
120
|
+
* actually resolved (`Controller.inertia()`'s response marker). The version
|
|
121
|
+
* check runs before any prop resolves: a 409 must not run a lazy prop's query.
|
|
122
|
+
*/
|
|
123
|
+
export declare function renderInertia(component: string, props: Record<string, unknown>, options?: InertiaOptions): Promise<InertiaRenderResult>;
|
|
124
|
+
export interface InertiaPageOptions {
|
|
125
|
+
readonly url?: string;
|
|
126
|
+
readonly version?: string;
|
|
127
|
+
readonly request?: Request;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* The page object for one request: props resolved under the request's
|
|
131
|
+
* partial-reload headers, the deferred announcement, and the page url derived
|
|
132
|
+
* from the request when `url` is absent. `@guren/testing`'s mock builds its
|
|
133
|
+
* page here too, so the two cannot disagree on the payload's shape.
|
|
134
|
+
*/
|
|
135
|
+
export declare function buildInertiaPage(component: string, props: Record<string, unknown>, options: InertiaPageOptions): Promise<InertiaPagePayload>;
|
|
105
136
|
export declare function serializePage(page: InertiaPagePayload): string;
|
|
106
137
|
export declare function acceptsJson(request: Request): boolean;
|
|
107
138
|
export {};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prop evaluation for the Inertia protocol's partial reloads and deferred
|
|
3
|
+
* props (https://inertiajs.com/the-protocol, "Prop Evaluation Model").
|
|
4
|
+
* `@guren/testing`'s controller mock resolves through the same function, so a
|
|
5
|
+
* test cannot pass on a prop set production would not send.
|
|
6
|
+
*/
|
|
7
|
+
declare const DEFERRED_BRAND: unique symbol;
|
|
8
|
+
declare const ALWAYS_BRAND: unique symbol;
|
|
9
|
+
export interface AlwaysProp<T> {
|
|
10
|
+
readonly [ALWAYS_BRAND]: true;
|
|
11
|
+
readonly value: T;
|
|
12
|
+
/** The plain value, so a consumer that serializes shared props before the engine sees them sends the value itself. */
|
|
13
|
+
toJSON(): T;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* A prop sent on every response, partial reloads included, whatever the
|
|
17
|
+
* `only`/`except` lists say (Laravel's `Inertia::always()`). The protocol's
|
|
18
|
+
* `errors` is one; a flash-backed shared prop is the usual other, since a
|
|
19
|
+
* flash the partial filter drops is gone with the request.
|
|
20
|
+
*/
|
|
21
|
+
export declare function always<T>(value: T): AlwaysProp<T>;
|
|
22
|
+
export declare function isAlwaysProp(value: unknown): value is AlwaysProp<unknown>;
|
|
23
|
+
export interface DeferredProp<T> {
|
|
24
|
+
readonly [DEFERRED_BRAND]: true;
|
|
25
|
+
readonly resolve: () => T | Promise<T>;
|
|
26
|
+
readonly group: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A prop resolved in a follow-up request rather than the initial visit
|
|
30
|
+
* (Laravel's `Inertia::defer()`). The initial response announces the key under
|
|
31
|
+
* `deferredProps[group]` and the client fetches each group with one partial
|
|
32
|
+
* reload; `resolve` runs only on the request that asks for the key.
|
|
33
|
+
*/
|
|
34
|
+
export declare function defer<T>(resolve: () => T, group?: string): DeferredProp<Awaited<T>>;
|
|
35
|
+
export declare function isDeferredProp(value: unknown): value is DeferredProp<unknown>;
|
|
36
|
+
/** What a controller may pass for a prop the page declares as `T`. */
|
|
37
|
+
export type InertiaPropInput<T> = T | DeferredProp<T> | AlwaysProp<T> | (() => T | Promise<T>);
|
|
38
|
+
export type InertiaPropsInput<Props> = {
|
|
39
|
+
[K in keyof Props]: InertiaPropInput<Props[K]>;
|
|
40
|
+
};
|
|
41
|
+
/** The value the page receives for one prop input: a deferred, always or lazy prop as its resolved type. */
|
|
42
|
+
export type ResolvedInertiaProp<V> = V extends DeferredProp<unknown> ? Awaited<ReturnType<V['resolve']>> : V extends AlwaysProp<unknown> ? V['value'] : V extends () => infer R ? Awaited<R> : V;
|
|
43
|
+
export type ResolvedInertiaProps<Props> = {
|
|
44
|
+
[K in keyof Props]: ResolvedInertiaProp<Props[K]>;
|
|
45
|
+
};
|
|
46
|
+
export interface PartialReload {
|
|
47
|
+
/** Top-level prop names listed in `X-Inertia-Partial-Data`; empty means every prop. */
|
|
48
|
+
readonly only: ReadonlySet<string>;
|
|
49
|
+
readonly except: ReadonlySet<string>;
|
|
50
|
+
}
|
|
51
|
+
export interface ResolvedInertiaPage {
|
|
52
|
+
readonly props: Record<string, unknown>;
|
|
53
|
+
/** Present on a full visit that carried at least one deferred prop. */
|
|
54
|
+
readonly deferredProps?: Record<string, string[]>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The partial reload a request asks for, or undefined for a full visit. A
|
|
58
|
+
* partial reload is an Inertia request whose `X-Inertia-Partial-Component`
|
|
59
|
+
* names the component being rendered; a different component (the visit was
|
|
60
|
+
* redirected elsewhere) is a full visit again.
|
|
61
|
+
*/
|
|
62
|
+
export declare function readPartialReload(request: Request | undefined, component: string): PartialReload | undefined;
|
|
63
|
+
/**
|
|
64
|
+
* The props a response carries under the protocol's evaluation rules: a full
|
|
65
|
+
* visit resolves every prop but the deferred ones, which it announces; a
|
|
66
|
+
* partial reload resolves only the selected props, deferred ones included, and
|
|
67
|
+
* announces nothing; an always prop is sent either way; a lazy prop (a function
|
|
68
|
+
* value) runs only when sent. Resolvers run concurrently, unlike Laravel's.
|
|
69
|
+
*/
|
|
70
|
+
export declare function resolveInertiaProps(input: Record<string, unknown>, partial: PartialReload | undefined): Promise<ResolvedInertiaPage>;
|
|
71
|
+
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
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-
|
|
1
|
+
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-Bp2uamzD.js";
|
|
2
2
|
export { DatabaseChannel, MailChannel, MemoryChannel, Notification, NotificationManager, SlackChannel, clearNotificationRegistry, createNotificationManager, getNotification, getNotificationManager, registerNotification, resolveNotifiableType, setNotificationManager };
|