@guren/server 2.30.0 → 2.31.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.
@@ -4,6 +4,7 @@ import { n as ValidationException } from "./errors-JpkcCjjn.js";
4
4
  import { n as parseImportMap, t as DEFAULT_DEV_STYLES_ENTRY } from "./inertia-defaults-BjrcT7za.js";
5
5
  import { t as resolveOptional } from "./resolve-optional-ax6gPWTp.js";
6
6
  import { g as warnDeprecatedSetter, h as warnDeprecatedGetter } from "./default-application-s9SE-Er7.js";
7
+ import { n as initialPageElement, t as INITIAL_PAGE_SELECTOR } from "./initial-page-U637q3gO.js";
7
8
  import { n as ServiceProvider } from "./ServiceProvider-G0YclITd.js";
8
9
  import { r as getAuthContext } from "./context-af2n5abO.js";
9
10
  import { o as getApiTokenOrFail } from "./api-token-BbgDEd6j.js";
@@ -343,7 +344,7 @@ async function renderDocument$1(page, options) {
343
344
  </html>`;
344
345
  }
345
346
  function pagePayloadElement(page) {
346
- return `<script data-page="app" type="application/json">${serializePage(page)}<\/script>`;
347
+ return initialPageElement(serializePage(page));
347
348
  }
348
349
  /**
349
350
  * `window.__INERTIA_PAGE__` for readers other than the client. Same selector
@@ -351,7 +352,7 @@ function pagePayloadElement(page) {
351
352
  * container carrying a non-payload `data-page` is ignored rather than mounted.
352
353
  * A classic inline script, so it has run before the module entry does.
353
354
  */
354
- const PAGE_GLOBAL_FROM_ELEMENT = "<script>try{var e=document.querySelector('script[data-page=\"app\"][type=\"application/json\"]')||document.getElementById(\"app\"),p=JSON.parse(e.tagName===\"SCRIPT\"?e.textContent:e.getAttribute(\"data-page\"));if(p&&p.component)window.__INERTIA_PAGE__=p}catch(_){}<\/script>";
355
+ const PAGE_GLOBAL_FROM_ELEMENT = `<script>try{var e=document.querySelector('${INITIAL_PAGE_SELECTOR}')||document.getElementById("app"),p=JSON.parse(e.tagName==="SCRIPT"?e.textContent:e.getAttribute("data-page"));if(p&&p.component)window.__INERTIA_PAGE__=p}catch(_){}<\/script>`;
355
356
  async function tryRenderSsr(page, options) {
356
357
  const ssrOptions = options.ssr;
357
358
  if (ssrOptions?.enabled === false) return;
@@ -1,2 +1,2 @@
1
- import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemoryStore, r as TaggedCache, t as CacheManager } from "../cache-C2Im3l7t.js";
1
+ import { a as RedisStore, i as FileStore, n as createCacheManager, o as MemoryStore, r as TaggedCache, t as CacheManager } from "../cache-Bi5U8N5P.js";
2
2
  export { CacheManager, FileStore, MemoryStore, RedisStore, TaggedCache, createCacheManager };
@@ -1,6 +1,6 @@
1
1
  import { r as isPromiseLike } from "./Logger-DWXdtLSJ.js";
2
2
  import { n as isHotReloadRuntime, t as claimHotDisposable } from "./hot-disposables-W2fH-GID.js";
3
- import { t as describeDriverMap } from "./driver-map-CkQc52j-.js";
3
+ import { t as describeDriverMap } from "./driver-map-BhITaLcy.js";
4
4
  import { createHash, randomUUID } from "node:crypto";
5
5
  import { dirname, join } from "node:path";
6
6
  import { copyFile, link, mkdir, readFile, readdir, rename, rm, rmdir, unlink, writeFile } from "node:fs/promises";
@@ -4,7 +4,7 @@ import chalk from "chalk";
4
4
  import figlet from "figlet";
5
5
  import standard from "figlet/importable-fonts/Standard.js";
6
6
  //#region package.json
7
- var version = "2.30.0";
7
+ var version = "2.31.0";
8
8
  //#endregion
9
9
  //#region src/http/dev-banner.ts
10
10
  var dev_banner_exports = /* @__PURE__ */ __exportAll({
@@ -1,8 +1,14 @@
1
1
  //#region src/introspection/driver-map.ts
2
2
  /** `DriverMapEntry` from a manager's entries, each with the driver it was configured with or null. */
3
- function describeDriverMap(defaultName, drivers) {
3
+ function describeDriverMap(defaultName, drivers, bindings = /* @__PURE__ */ new Map()) {
4
4
  const entries = {};
5
- for (const [name, driver] of drivers) entries[name] = { driver };
5
+ for (const [name, driver] of drivers) {
6
+ const binding = bindings.get(name);
7
+ entries[name] = binding === void 0 ? { driver } : {
8
+ driver,
9
+ binding
10
+ };
11
+ }
6
12
  return {
7
13
  default: defaultName,
8
14
  entries
package/dist/index.d.ts CHANGED
@@ -4,7 +4,7 @@ export { CONTAINER_CONTEXT_KEY, getRequestContainer, tryGetRequestContainer } fr
4
4
  export type { RequestContextLike } from './http/request-container.js';
5
5
  export type { Context, ApplicationListenOptions, ListenAddress, ServiceProviderConstructor, } from './http/Application.js';
6
6
  export { isIntrospecting } from './introspection/flag.js';
7
- export type { AppManifest, AttachmentsDescription, AttachmentsEntry, AuthEntry, AuthProviderEntry, ControllerRef, DriverMapEntry, JsonSchema, ManifestWarning, MiddlewareEntry, ModuleEntry, ProviderEntry, ProviderRegisterOutcome, ProviderSource, RouteEntry, RouteSchemaEntry, SessionEntry, SessionStoreEntry, } from './introspection/types.js';
7
+ export type { AppManifest, AttachmentsDescription, AttachmentsEntry, AuthEntry, AuthProviderEntry, ControllerRef, DatabaseEntry, DriverMapEntry, JsonSchema, ManifestWarning, MiddlewareEntry, ModuleEntry, ProviderEntry, ProviderRegisterOutcome, ProviderSource, RouteEntry, RouteSchemaEntry, SessionEntry, SessionStoreEntry, } from './introspection/types.js';
8
8
  export { parseRequestPayload, formatValidationErrors } from './http/request.js';
9
9
  export { Controller } from './mvc/Controller.js';
10
10
  export type { InertiaResponse, InferInertiaProps, ControllerInertiaProps, AuthPayload } from './mvc/Controller.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
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-D1tF6Qwp.js";
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-CGGEbZfX.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";
@@ -18,7 +18,7 @@ import { o as AuthenticationException, r as getAuthContext, t as AUTH_CONTEXT_KE
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-C2Im3l7t.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-Bi5U8N5P.js";
22
22
  import { n as createRedisClient, r as RedisSessionStore } from "./client-C5Wj9P9o.js";
23
23
  import { i as loadRuntimeErrorsModule, r as captureRuntimeError, s as isMcpEndpointEnabled, t as RUNTIME_ERRORS_BINDING } from "./runtime-error-capture-BclelWhA.js";
24
24
  import { n as isHotReloadRuntime, r as matchingOpenParen, t as claimHotDisposable } from "./hot-disposables-W2fH-GID.js";
@@ -34,13 +34,13 @@ import { readObjectSchema, toJsonSchema } from "./internal/zod-json-schema.js";
34
34
  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-B6gfJkCH.js";
35
35
  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-R7Uj-aT7.js";
36
36
  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-0Prk8k0z.js";
37
- 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-jvxB1MFh.js";
37
+ 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-CO07wib_.js";
38
38
  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-BQ2y2U5c.js";
39
39
  import { a as LOG_LEVEL_PRIORITY, i as matchDailyFileDate, n as dailyFileDateStamp, r as dailyFilePath, t as DailyFileChannel } from "./DailyFileChannel-CTTPA0EF.js";
40
40
  import { a as FileChannel, i as setLogManager, n as createLogManager, o as ConsoleChannel, r as getLogManager, t as LogManager } from "./logging-Br9bZlaG.js";
41
41
  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";
42
42
  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-BS-FGkqS.js";
43
- import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver$2, t as StorageManager } from "./storage-IlUesK2t.js";
43
+ import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver$2, t as StorageManager } from "./storage-YPbsV9ju.js";
44
44
  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";
45
45
  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";
46
46
  import { Hono } from "hono";
@@ -3363,8 +3363,8 @@ function buildAppManifest(sources) {
3363
3363
  agentTools: derived.tools,
3364
3364
  warnings
3365
3365
  };
3366
- const section = (key) => {
3367
- const read = readSection(sources, key, warnings);
3366
+ const section = (key, argument) => {
3367
+ const read = readSection(sources, key, warnings, argument);
3368
3368
  return read.status === "described" ? read.value : void 0;
3369
3369
  };
3370
3370
  const session = describeSession(sources, warnings);
@@ -3379,6 +3379,8 @@ function buildAppManifest(sources) {
3379
3379
  const entry = section(key);
3380
3380
  if (entry) manifest[key] = entry;
3381
3381
  }
3382
+ const database = section("database", sources.container.has("env") ? { env: sources.container.make("env") } : void 0);
3383
+ if (database) manifest.database = database;
3382
3384
  const attachments = section("attachments");
3383
3385
  if (attachments) {
3384
3386
  const { delivery, ...rest } = attachments;
@@ -3478,7 +3480,7 @@ function perProcessOfStoreClass(storeClass) {
3478
3480
  * One a deferred provider supplies, or whose manager throws on construction,
3479
3481
  * is warned about and told apart from a plain absence.
3480
3482
  */
3481
- function readSection(sources, key, warnings) {
3483
+ function readSection(sources, key, warnings, argument) {
3482
3484
  const { container } = sources;
3483
3485
  if (!container.has(key)) {
3484
3486
  const deferred = sources.providers.find((provider) => provider.register === "skipped" && provider.provides.includes(key));
@@ -3502,7 +3504,7 @@ function readSection(sources, key, warnings) {
3502
3504
  const service = container.make(key);
3503
3505
  if (typeof service?.describe === "function") return {
3504
3506
  status: "described",
3505
- value: service.describe()
3507
+ value: service.describe(argument)
3506
3508
  };
3507
3509
  warnings.push({
3508
3510
  code: "section-unverified",
@@ -3563,7 +3565,7 @@ let devBanner;
3563
3565
  */
3564
3566
  async function loadDevBanner() {
3565
3567
  if (typeof process === "undefined") return devBanner;
3566
- if (process.env.NODE_ENV !== "production") devBanner ??= await import("./dev-banner-Cw8VnH6J.js").then((n) => n.n);
3568
+ if (process.env.NODE_ENV !== "production") devBanner ??= await import("./dev-banner-DPSpJwVz.js").then((n) => n.n);
3567
3569
  return devBanner;
3568
3570
  }
3569
3571
  /**
@@ -0,0 +1,46 @@
1
+ //#region src/mvc/inertia/initial-page.ts
2
+ /**
3
+ * The element a server-rendered Inertia document carries its initial page in, written and read
4
+ * here: `InertiaEngine.ts` writes it with `initialPageElement()` and names it in the page-global
5
+ * shim with `INITIAL_PAGE_SELECTOR`, and `readInitialPage()` reads it back from HTML, else a legacy
6
+ * `data-page` attribute, for code that holds the HTML rather than a DOM (`@guren/testing`,
7
+ * `guren browser:doctor`). It imports nothing, so a Node process can load it alone.
8
+ */
9
+ const ATTRIBUTES = ["data-page=\"app\"", "type=\"application/json\""];
10
+ /** The selector the client and the page-global shim find the element by. */
11
+ const INITIAL_PAGE_SELECTOR = `script[${ATTRIBUTES.join("][")}]`;
12
+ /** `json` is the page serialized by `serializePage()`, which escapes `<` so no `<\/script>` can end the element early. */
13
+ function initialPageElement(json) {
14
+ return `<script ${ATTRIBUTES.join(" ")}>${json}<\/script>`;
15
+ }
16
+ const ENTITIES = {
17
+ quot: "\"",
18
+ amp: "&",
19
+ lt: "<",
20
+ gt: ">",
21
+ "#39": "'"
22
+ };
23
+ /** The element's JSON text; the attribute form is entity-decoded. Undefined when the document carries neither. */
24
+ function payloadText(html) {
25
+ const openTag = /<script\b[^>]*>/giu;
26
+ let tag;
27
+ while ((tag = openTag.exec(html)) !== null) {
28
+ const text = tag[0].toLowerCase();
29
+ if (!ATTRIBUTES.every((attribute) => text.includes(attribute))) continue;
30
+ const close = /<\/script\s*>/giu;
31
+ close.lastIndex = openTag.lastIndex;
32
+ const end = close.exec(html);
33
+ return end ? html.slice(openTag.lastIndex, end.index) : void 0;
34
+ }
35
+ return /data-page="([^"]+)"/u.exec(html)?.[1]?.replace(/&(quot|amp|lt|gt|#39);/gu, (_, entity) => ENTITIES[entity]);
36
+ }
37
+ /**
38
+ * The parsed initial page, or `undefined` when the document carries none. Throws the JSON parser's
39
+ * error when the element holds text that is not JSON, since that is a broken document, not an absent page.
40
+ */
41
+ function readInitialPage(html) {
42
+ const text = payloadText(html);
43
+ return text === void 0 ? void 0 : JSON.parse(text);
44
+ }
45
+ //#endregion
46
+ export { initialPageElement as n, readInitialPage as r, INITIAL_PAGE_SELECTOR as t };
@@ -0,0 +1 @@
1
+ export { INITIAL_PAGE_SELECTOR, initialPageElement, readInitialPage } from '../mvc/inertia/initial-page.js';
@@ -0,0 +1,2 @@
1
+ import { n as initialPageElement, r as readInitialPage, t as INITIAL_PAGE_SELECTOR } from "../initial-page-U637q3gO.js";
2
+ export { INITIAL_PAGE_SELECTOR, initialPageElement, readInitialPage };
@@ -1,4 +1,4 @@
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-D1tF6Qwp.js";
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-CGGEbZfX.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-G0YclITd.js";
@@ -1,3 +1,3 @@
1
1
  import type { DriverMapEntry } from './types.js';
2
2
  /** `DriverMapEntry` from a manager's entries, each with the driver it was configured with or null. */
3
- export declare function describeDriverMap(defaultName: string, drivers: Iterable<[string, string | null]>): DriverMapEntry;
3
+ export declare function describeDriverMap(defaultName: string, drivers: Iterable<[string, string | null]>, bindings?: ReadonlyMap<string, string>): DriverMapEntry;
@@ -1,3 +1,4 @@
1
+ import type { DatabaseDescription } from '@guren/orm';
1
2
  import type { DerivedAgentTool } from '../agent/derive.js';
2
3
  import type { MiddlewareCapabilities } from '../http/middleware/capabilities.js';
3
4
  import type { JsonSchemaObject } from '../internal/zod-json-schema.js';
@@ -33,6 +34,7 @@ export interface AppManifest {
33
34
  storage?: DriverMapEntry;
34
35
  queue?: DriverMapEntry;
35
36
  attachments?: AttachmentsEntry;
37
+ database?: DatabaseEntry;
36
38
  agentTools: DerivedAgentTool[];
37
39
  warnings: ManifestWarning[];
38
40
  }
@@ -136,11 +138,20 @@ export interface AuthEntry {
136
138
  requiresBun: boolean | null;
137
139
  providers: Record<string, AuthProviderEntry>;
138
140
  }
141
+ /**
142
+ * Where the bound database lives (RFC 0033 §3), from `describe()` on the factory
143
+ * `defineDatabaseConfig()` binds, read without connecting. Never the connection string.
144
+ */
145
+ export type DatabaseEntry = DatabaseDescription;
139
146
  export interface DriverMapEntry {
140
147
  default: string;
141
- /** `driver` is null for an entry registered as a bare factory, whose driver is unknowable without calling it. */
148
+ /**
149
+ * `driver` is null for an entry registered as a bare factory, whose driver is unknowable without calling it.
150
+ * `binding` names the Workers binding a disk reads, when its registration says (RFC 0035 §2.1).
151
+ */
142
152
  entries: Record<string, {
143
153
  driver: string | null;
154
+ binding?: string;
144
155
  }>;
145
156
  }
146
157
  export interface AttachmentsEntry {
@@ -0,0 +1,16 @@
1
+ /**
2
+ * The element a server-rendered Inertia document carries its initial page in, written and read
3
+ * here: `InertiaEngine.ts` writes it with `initialPageElement()` and names it in the page-global
4
+ * shim with `INITIAL_PAGE_SELECTOR`, and `readInitialPage()` reads it back from HTML, else a legacy
5
+ * `data-page` attribute, for code that holds the HTML rather than a DOM (`@guren/testing`,
6
+ * `guren browser:doctor`). It imports nothing, so a Node process can load it alone.
7
+ */
8
+ /** The selector the client and the page-global shim find the element by. */
9
+ export declare const INITIAL_PAGE_SELECTOR: string;
10
+ /** `json` is the page serialized by `serializePage()`, which escapes `<` so no `</script>` can end the element early. */
11
+ export declare function initialPageElement(json: string): string;
12
+ /**
13
+ * The parsed initial page, or `undefined` when the document carries none. Throws the JSON parser's
14
+ * error when the element holds text that is not JSON, since that is a broken document, not an absent page.
15
+ */
16
+ export declare function readInitialPage(html: string): unknown;
@@ -1,3 +1,3 @@
1
1
  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-0Prk8k0z.js";
2
- import { a as processJob, c as RedisDriver, i as Worker, l as SyncDriver, n as createQueueManager, o as SqsDriver, r as FailedJobReporter, s as createSqsAdapter, t as QueueManager, u as MemoryDriver } from "../queue-jvxB1MFh.js";
2
+ import { a as processJob, c as RedisDriver, i as Worker, l as SyncDriver, n as createQueueManager, o as SqsDriver, r as FailedJobReporter, s as createSqsAdapter, t as QueueManager, u as MemoryDriver } from "../queue-CO07wib_.js";
3
3
  export { FailedJobReporter, Job, MemoryDriver, QueueManager, RedisDriver, SqsDriver, SyncDriver, Worker, clearJobRegistry, clearQueueDriver, createQueueManager, createSqsAdapter, getJob, getQueueDriver, getRegisteredJobs, processJob, registerJob, resolveJobName, resolveQueueDriver, setQueueDriver };
@@ -1,6 +1,6 @@
1
1
  import { t as warnOnce } from "./warn-once-p-IlMjra.js";
2
2
  import { a as getJob, i as enqueueJob } from "./Job-0Prk8k0z.js";
3
- import { t as describeDriverMap } from "./driver-map-CkQc52j-.js";
3
+ import { t as describeDriverMap } from "./driver-map-BhITaLcy.js";
4
4
  import { t as deserializeQueuedJob } from "./serialize-CKXek0Tr.js";
5
5
  import { randomUUID } from "node:crypto";
6
6
  //#region src/queue/drivers/MemoryDriver.ts
@@ -2,7 +2,7 @@ import { a as trimTrailingSlashes, n as isRealPathWithin, t as isPathWithin } fr
2
2
  import { n as parseImportMap } from "../inertia-defaults-BjrcT7za.js";
3
3
  import { n as hash } from "../Hash-D2DFd8xX.js";
4
4
  import { a as getManifestCss, c as isViteProduction, d as startViteDevServer, i as clientManifestCandidates, l as loadViteManifest, o as getManifestFile, r as PUBLIC_ASSETS_URL_PREFIX, u as normalizeDevServerUrl } from "../vite-manifest-DO0pU1vm.js";
5
- import { r as logDevServerBanner, t as GUREN_ASCII_ART } from "../dev-banner-Cw8VnH6J.js";
5
+ import { r as logDevServerBanner, t as GUREN_ASCII_ART } from "../dev-banner-DPSpJwVz.js";
6
6
  import { createRequire } from "node:module";
7
7
  import { dirname, extname, join, resolve } from "node:path";
8
8
  import { fileURLToPath } from "node:url";
@@ -2,7 +2,8 @@
2
2
  * The one place server decides "which serverless runtime is this". Kept
3
3
  * import-free so the session middleware and the Lambda adapter can both read
4
4
  * it without either dragging the other in. plugin-cloudflare's
5
- * `isWorkersRuntime()` reads the same user agent.
5
+ * `isWorkersRuntime()` reads the same user agent, and is also true in the Cloudflare
6
+ * build's introspection (RFC 0035 §2.1); this is not, since it describes the real process.
6
7
  */
7
8
  export type ServerlessRuntimeId = 'cloudflare' | 'lambda' | 'vercel';
8
9
  /** The deploy targets' names as the CLI checks report them; the CLI reads these. */
@@ -6,12 +6,21 @@ export declare class StorageManager {
6
6
  private readonly resolvedDisks;
7
7
  /** The configured driver per disk, keyed like `diskFactories`; null for a bare `registerDisk()` factory. */
8
8
  private readonly diskDrivers;
9
+ /** The Workers binding a disk reads, when its `registerDisk()` description names one. */
10
+ private readonly diskBindings;
9
11
  private driverFactories;
10
12
  constructor(config?: StorageConfig);
11
13
  private registerBuiltinDrivers;
12
14
  private registerDiskFromConfig;
13
15
  disk(name?: string): StorageDriver;
14
- registerDisk(name: string, factory: StorageDriverFactory): void;
16
+ /**
17
+ * `description` says what the factory builds, which `describe()` cannot learn without calling it:
18
+ * `{ driver: 'r2', binding: 'MEDIA' }` lets the Cloudflare deploy see the bucket binding (RFC 0035 §2.1).
19
+ */
20
+ registerDisk(name: string, factory: StorageDriverFactory, description?: {
21
+ driver: string;
22
+ binding?: string;
23
+ }): void;
15
24
  registerDriver(name: string, factory: (options: unknown) => StorageDriver): void;
16
25
  hasDisk(name: string): boolean;
17
26
  getDefaultDiskName(): string;
@@ -1,2 +1,2 @@
1
- import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver, t as StorageManager } from "../storage-IlUesK2t.js";
1
+ import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver, t as StorageManager } from "../storage-YPbsV9ju.js";
2
2
  export { LocalDriver, MemoryDriver, S3Driver, StorageManager, createStorageManager };
@@ -1,6 +1,6 @@
1
1
  import { i as trimSlashes, r as realPathOfNearestExisting, t as isPathWithin } from "./contained-path-BkNSBljW.js";
2
2
  import { t as warnOnce } from "./warn-once-p-IlMjra.js";
3
- import { t as describeDriverMap } from "./driver-map-CkQc52j-.js";
3
+ import { t as describeDriverMap } from "./driver-map-BhITaLcy.js";
4
4
  import { dirname, join, relative, resolve, sep } from "node:path";
5
5
  import { copyFile, lstat, mkdir, open, readFile, readdir, readlink, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
6
6
  import { existsSync } from "node:fs";
@@ -762,6 +762,8 @@ var StorageManager = class {
762
762
  resolvedDisks = /* @__PURE__ */ new Map();
763
763
  /** The configured driver per disk, keyed like `diskFactories`; null for a bare `registerDisk()` factory. */
764
764
  diskDrivers = /* @__PURE__ */ new Map();
765
+ /** The Workers binding a disk reads, when its `registerDisk()` description names one. */
766
+ diskBindings = /* @__PURE__ */ new Map();
765
767
  driverFactories = /* @__PURE__ */ new Map();
766
768
  constructor(config = {}) {
767
769
  this.defaultDiskName = config.default ?? "local";
@@ -800,9 +802,15 @@ var StorageManager = class {
800
802
  this.resolvedDisks.set(diskName, disk);
801
803
  return disk;
802
804
  }
803
- registerDisk(name, factory) {
805
+ /**
806
+ * `description` says what the factory builds, which `describe()` cannot learn without calling it:
807
+ * `{ driver: 'r2', binding: 'MEDIA' }` lets the Cloudflare deploy see the bucket binding (RFC 0035 §2.1).
808
+ */
809
+ registerDisk(name, factory, description) {
804
810
  this.diskFactories.set(name, factory);
805
- this.diskDrivers.set(name, null);
811
+ this.diskDrivers.set(name, description?.driver ?? null);
812
+ if (description?.binding) this.diskBindings.set(name, description.binding);
813
+ else this.diskBindings.delete(name);
806
814
  this.resolvedDisks.delete(name);
807
815
  }
808
816
  registerDriver(name, factory) {
@@ -819,7 +827,7 @@ var StorageManager = class {
819
827
  }
820
828
  /** The declared disks and the default, building none of them (RFC 0026 §1). */
821
829
  describe() {
822
- return describeDriverMap(this.defaultDiskName, this.diskDrivers);
830
+ return describeDriverMap(this.defaultDiskName, this.diskDrivers, this.diskBindings);
823
831
  }
824
832
  };
825
833
  function createStorageManager(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guren/server",
3
- "version": "2.30.0",
3
+ "version": "2.31.0",
4
4
  "description": "HTTP layer of the Guren framework, on Hono: routing, controllers, middleware, auth, sessions, queues and the AWS Lambda adapter. Applications import it through @guren/core.",
5
5
  "keywords": [
6
6
  "guren",
@@ -144,6 +144,10 @@
144
144
  "types": "./dist/internal/zod-json-schema.d.ts",
145
145
  "default": "./dist/internal/zod-json-schema.js"
146
146
  },
147
+ "./internal/inertia-page": {
148
+ "types": "./dist/internal/inertia-page.d.ts",
149
+ "default": "./dist/internal/inertia-page.js"
150
+ },
147
151
  "./jsx-runtime": {
148
152
  "types": "./dist/jsx-runtime.d.ts",
149
153
  "default": "./dist/jsx-runtime.js"
@@ -164,7 +168,7 @@
164
168
  "test": "bun test"
165
169
  },
166
170
  "dependencies": {
167
- "@guren/orm": "^2.14.0",
171
+ "@guren/orm": "^2.15.0",
168
172
  "chalk": "^5.3.0",
169
173
  "consola": "^3.4.2",
170
174
  "figlet": "^1.7.0",