@guren/server 2.29.1 → 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.
- package/dist/{Gate-DFiuutZm.js → Gate-COWQbA96.js} +1 -1
- package/dist/{Job-DsFMcXVk.js → Job-0Prk8k0z.js} +1 -1
- package/dist/{Resource-ZMJH4lyD.js → Resource-CGGEbZfX.js} +6 -5
- package/dist/authorization/index.js +2 -2
- package/dist/{authorization-DUjeyGWh.js → authorization-DEHuBps5.js} +1 -1
- package/dist/broadcasting/index.js +1 -1
- package/dist/{broadcasting-N4cRV42s.js → broadcasting-CcevVE5Y.js} +1 -1
- package/dist/cache/index.js +1 -1
- package/dist/{cache-C2Im3l7t.js → cache-Bi5U8N5P.js} +1 -1
- package/dist/{default-application-DWwscxfW.js → default-application-s9SE-Er7.js} +1 -1
- package/dist/{dev-banner-wz0V_g0R.js → dev-banner-DPSpJwVz.js} +1 -1
- package/dist/{driver-map-CkQc52j-.js → driver-map-BhITaLcy.js} +8 -2
- package/dist/encryption/index.js +1 -1
- package/dist/{encryption-DF8lZkpj.js → encryption-BS-FGkqS.js} +1 -1
- package/dist/errors/debug-page.d.ts +4 -2
- package/dist/events/index.js +1 -1
- package/dist/{events-DQavGm8W.js → events-B6gfJkCH.js} +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/{i18n-DmMKcbqj.js → i18n-BShPpJZa.js} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +559 -540
- package/dist/initial-page-U637q3gO.js +46 -0
- package/dist/internal/inertia-page.d.ts +1 -0
- package/dist/internal/inertia-page.js +2 -0
- package/dist/internal/testing.js +1 -1
- package/dist/introspection/driver-map.d.ts +1 -1
- package/dist/introspection/types.d.ts +12 -1
- package/dist/lambda/index.js +1 -1
- package/dist/logging/index.js +1 -1
- package/dist/{logging-Ci0mBk5k.js → logging-Br9bZlaG.js} +1 -1
- package/dist/mail/index.js +1 -1
- package/dist/{mail-CI2Kfe8P.js → mail-BQ2y2U5c.js} +2 -2
- package/dist/mvc/inertia/initial-page.d.ts +16 -0
- package/dist/notifications/index.js +1 -1
- package/dist/{notifications-Bp2uamzD.js → notifications-R7Uj-aT7.js} +2 -2
- package/dist/queue/index.js +2 -2
- package/dist/{queue-C8s3buYz.js → queue-CO07wib_.js} +2 -2
- package/dist/runtime/index.js +1 -1
- package/dist/runtime/serverless.d.ts +2 -1
- package/dist/storage/StorageManager.d.ts +10 -1
- package/dist/storage/index.js +1 -1
- package/dist/{storage-IlUesK2t.js → storage-YPbsV9ju.js} +12 -4
- package/package.json +6 -2
|
@@ -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';
|
package/dist/internal/testing.js
CHANGED
|
@@ -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-
|
|
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
|
-
/**
|
|
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 {
|
package/dist/lambda/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as detectServerlessRuntime } from "../serverless-D96rJb6x.js";
|
|
2
|
-
import { a as getJob } from "../Job-
|
|
2
|
+
import { a as getJob } from "../Job-0Prk8k0z.js";
|
|
3
3
|
import { t as deserializeQueuedJob } from "../serialize-CKXek0Tr.js";
|
|
4
4
|
import { handle } from "hono/aws-lambda";
|
|
5
5
|
//#region src/lambda/index.ts
|
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-Br9bZlaG.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 {
|
|
1
|
+
import { g as warnDeprecatedSetter, h as warnDeprecatedGetter, i as bindAmbient, n as ambientBinding } from "./default-application-s9SE-Er7.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-BQ2y2U5c.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 {
|
|
3
|
-
import { c as pinnedQueueDriver, d as resolveQueueDriver, i as enqueueJob, l as registerJob, t as Job } from "./Job-
|
|
2
|
+
import { g as warnDeprecatedSetter, h as warnDeprecatedGetter, i as bindAmbient, n as ambientBinding } from "./default-application-s9SE-Er7.js";
|
|
3
|
+
import { c as pinnedQueueDriver, d as resolveQueueDriver, i as enqueueJob, l as registerJob, t as Job } from "./Job-0Prk8k0z.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
|
|
@@ -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,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-R7Uj-aT7.js";
|
|
2
2
|
export { DatabaseChannel, MailChannel, MemoryChannel, Notification, NotificationManager, SlackChannel, clearNotificationRegistry, createNotificationManager, getNotification, getNotificationManager, registerNotification, resolveNotifiableType, setNotificationManager };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { l as registerJob, p as reportRegistryCollision, t as Job } from "./Job-
|
|
1
|
+
import { g as warnDeprecatedSetter, h as warnDeprecatedGetter, i as bindAmbient, n as ambientBinding } from "./default-application-s9SE-Er7.js";
|
|
2
|
+
import { l as registerJob, p as reportRegistryCollision, t as Job } from "./Job-0Prk8k0z.js";
|
|
3
3
|
import { t as parseMailAddress } from "./address-D0Iq-XIH.js";
|
|
4
4
|
//#region src/notifications/Notification.ts
|
|
5
5
|
/**
|
package/dist/queue/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
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-
|
|
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-
|
|
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-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
|
-
import { a as getJob, i as enqueueJob } from "./Job-
|
|
3
|
-
import { t as describeDriverMap } from "./driver-map-
|
|
2
|
+
import { a as getJob, i as enqueueJob } from "./Job-0Prk8k0z.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
|
package/dist/runtime/index.js
CHANGED
|
@@ -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-
|
|
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
|
-
|
|
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;
|
package/dist/storage/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver, t as StorageManager } from "../storage-
|
|
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-
|
|
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
|
-
|
|
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.
|
|
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.
|
|
171
|
+
"@guren/orm": "^2.15.0",
|
|
168
172
|
"chalk": "^5.3.0",
|
|
169
173
|
"consola": "^3.4.2",
|
|
170
174
|
"figlet": "^1.7.0",
|