@guren/server 2.26.0 → 2.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/{DocsViewerServiceProvider-CIRNHQ2I.js → DocsViewerServiceProvider-BMbcTYVw.js} +1 -1
  2. package/dist/{McpServiceProvider-B-LioPSz.js → McpServiceProvider-PGFPlYTy.js} +1 -1
  3. package/dist/{Resource-gki0_2B6.js → Resource-q3tJpJ0K.js} +22 -17
  4. package/dist/{ServiceProvider-DDW3MqQJ.js → ServiceProvider-G0YclITd.js} +60 -8
  5. package/dist/agent/dispatch.d.ts +4 -4
  6. package/dist/agent/public.js +1 -1
  7. package/dist/agent-request-Caj6bnbj.js +18 -0
  8. package/dist/auth/AuthManager.d.ts +4 -0
  9. package/dist/auth/email-verification.d.ts +2 -1
  10. package/dist/auth/index.js +1 -1
  11. package/dist/auth/password/describe-hasher.d.ts +11 -0
  12. package/dist/{auth-DiyWALZT.js → auth-DIugW0O-.js} +70 -4
  13. package/dist/authorization/index.js +1 -1
  14. package/dist/authorization/middleware.d.ts +8 -0
  15. package/dist/{authorization-E6X6Y-B6.js → authorization-Daa6CxCg.js} +16 -1
  16. package/dist/broadcasting/BroadcastManager.d.ts +23 -6
  17. package/dist/broadcasting/index.d.ts +1 -1
  18. package/dist/broadcasting/index.js +1 -1
  19. package/dist/broadcasting/types.d.ts +13 -1
  20. package/dist/{broadcasting-D0vMkKcq.js → broadcasting-N4cRV42s.js} +204 -33
  21. package/dist/cache/CacheManager.d.ts +5 -0
  22. package/dist/cache/TaggedCache.d.ts +2 -0
  23. package/dist/cache/index.js +1 -1
  24. package/dist/cache/pending-computations.d.ts +22 -0
  25. package/dist/cache/stores/FileStore.d.ts +1 -1
  26. package/dist/cache/stores/file-lock.d.ts +1 -0
  27. package/dist/{cache-DcnRufMe.js → cache-BlXopnH1.js} +179 -39
  28. package/dist/container/ServiceProvider.d.ts +27 -2
  29. package/dist/container/defineModule.d.ts +4 -5
  30. package/dist/container/definePlugin.d.ts +2 -0
  31. package/dist/dev-banner-CfQDnkfQ.js +51 -0
  32. package/dist/{dispatch-BAwzftws.js → dispatch-ENWpBxbE.js} +26 -4
  33. package/dist/driver-map-CkQc52j-.js +12 -0
  34. package/dist/host-port-t6wQFaRu.js +15 -0
  35. package/dist/hot-reload/testing.d.ts +2 -1
  36. package/dist/http/Application.d.ts +19 -1
  37. package/dist/http/dev-banner.d.ts +0 -8
  38. package/dist/http/host-port.d.ts +8 -0
  39. package/dist/http/middleware/force-https.d.ts +2 -1
  40. package/dist/http/middleware/index.d.ts +1 -0
  41. package/dist/http/middleware/session-manager.d.ts +5 -0
  42. package/dist/http/middleware/websocket-origin.d.ts +22 -0
  43. package/dist/http/public-assets.d.ts +6 -1
  44. package/dist/index.d.ts +5 -3
  45. package/dist/index.js +694 -234
  46. package/dist/internal/agent-request.d.ts +18 -0
  47. package/dist/internal/dispatched-request.d.ts +4 -0
  48. package/dist/internal/testing.js +2 -2
  49. package/dist/internal/zod-json-schema.js +1 -1
  50. package/dist/introspection/driver-map.d.ts +3 -0
  51. package/dist/introspection/flag.d.ts +12 -0
  52. package/dist/introspection/manifest.d.ts +17 -0
  53. package/dist/introspection/plain-json.d.ts +7 -0
  54. package/dist/introspection/types.d.ts +167 -0
  55. package/dist/mcp/index.js +1 -1
  56. package/dist/mvc/Router.d.ts +33 -0
  57. package/dist/providers/ConfigServiceProvider.d.ts +7 -0
  58. package/dist/queue/QueueManager.d.ts +3 -0
  59. package/dist/queue/index.js +1 -1
  60. package/dist/{queue-Bo4Q857L.js → queue-C8s3buYz.js} +5 -0
  61. package/dist/runtime/index.js +15 -2
  62. package/dist/storage/StorageManager.d.ts +5 -0
  63. package/dist/storage/index.js +1 -1
  64. package/dist/{storage-wFsUJHZW.js → storage-IlUesK2t.js} +13 -1
  65. package/dist/{vite-manifest-DlU94f3Z.js → vite-manifest-wPxfAzjW.js} +1 -57
  66. package/package.json +2 -2
@@ -0,0 +1,18 @@
1
+ /**
2
+ * How a request says it is an agent tool call (RFC 0016 §3), in a leaf module
3
+ * so the dispatcher that writes the header and the auth middlewares that read
4
+ * it share one spelling. Not exported from the package index.
5
+ *
6
+ * Read only to choose the *shape* of a refusal: a tool caller cannot follow a
7
+ * redirect, so a guard answers it with JSON instead. Nothing may authorize on
8
+ * it, since any client can send it and gets no more than a JSON refusal.
9
+ */
10
+ /** Request header naming the protocol surface a tool call arrived on. */
11
+ export declare const AGENT_SURFACE_HEADER = "X-Guren-Agent-Surface";
12
+ export interface HeaderReader {
13
+ req?: {
14
+ header(name: string): string | undefined;
15
+ };
16
+ }
17
+ /** Whether the request was built by the agent dispatcher (`buildToolRequest`). */
18
+ export declare function isAgentToolRequest(ctx: HeaderReader): boolean;
@@ -0,0 +1,4 @@
1
+ /** Mark `request` as built by `buildToolRequest`, returning that same object. */
2
+ export declare function markDispatchedToolRequest(request: Request): Request;
3
+ /** Whether this exact object was built by the dispatcher in this process. */
4
+ export declare function isDispatchedToolRequest(request: Request): boolean;
@@ -1,6 +1,6 @@
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";
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-q3tJpJ0K.js";
2
2
  import { r as formatValidationErrors } from "../request-CLOYytGP.js";
3
3
  import { n as ValidationException } from "../errors-JpkcCjjn.js";
4
- import { n as ServiceProvider } from "../ServiceProvider-DDW3MqQJ.js";
4
+ import { n as ServiceProvider } from "../ServiceProvider-G0YclITd.js";
5
5
  import { o as AuthenticationException } from "../context-af2n5abO.js";
6
6
  export { AuthenticationException, Controller, INERTIA_VARY, JsonResource, Resource, ServiceProvider, ValidationException, acceptsJson, buildInertiaPage, collect, defineModule, definePlugin, formatValidationErrors, serializePage };
@@ -101,7 +101,7 @@ function toJsonSchema(schema, warnings, label, io) {
101
101
  return {
102
102
  type: "object",
103
103
  properties: details.properties,
104
- required: details.required.size > 0 ? Array.from(details.required) : void 0
104
+ ...details.required.size > 0 ? { required: Array.from(details.required) } : {}
105
105
  };
106
106
  }
107
107
  case "nullable": {
@@ -0,0 +1,3 @@
1
+ import type { DriverMapEntry } from './types.js';
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;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Whether this code runs for an introspection: the CLI child's `GUREN_INTROSPECT=1`,
3
+ * or inside an `Application.introspect()` in this process. The one reader of both.
4
+ */
5
+ export declare function isIntrospecting(): boolean;
6
+ /** Runs `fn` with {@link isIntrospecting} true for it and everything it schedules, timers that outlive it included. */
7
+ export declare function runIntrospecting<T>(fn: () => T): T;
8
+ /** `listen()` under the flag: an introspection run must never open a socket. */
9
+ export declare class IntrospectionListenError extends Error {
10
+ readonly code = "GUREN_INTROSPECT_LISTEN";
11
+ constructor();
12
+ }
@@ -0,0 +1,17 @@
1
+ import type { Container } from '../container/Container.js';
2
+ import type { GurenModule } from '../container/defineModule.js';
3
+ import type { AuthPluginOptions } from '../http/Application.js';
4
+ import type { Router } from '../mvc/Router.js';
5
+ import type { AppManifest, ManifestWarning, ProviderEntry } from './types.js';
6
+ interface ManifestSources {
7
+ readonly router: Router;
8
+ readonly container: Container;
9
+ readonly providers: ProviderEntry[];
10
+ readonly providerWarnings: ManifestWarning[];
11
+ readonly modules: ReadonlyArray<GurenModule>;
12
+ readonly authOptions?: AuthPluginOptions;
13
+ readonly hasBootCallback: boolean;
14
+ }
15
+ /** Builds the manifest from a registered, unmounted, unbooted app (RFC 0026 §1). */
16
+ export declare function buildAppManifest(sources: ManifestSources): AppManifest;
17
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * A deep copy holding only JSON values, with `undefined` object keys dropped and
3
+ * `undefined` array items turned into `null`, as `JSON.stringify` does. Anything
4
+ * else (a function, a Map, a class instance, a bigint, a cycle) throws, so a
5
+ * manifest field that would not survive `--json` fails here instead of vanishing.
6
+ */
7
+ export declare function toPlainJson<T>(value: T): T;
@@ -0,0 +1,167 @@
1
+ import type { DerivedAgentTool } from '../agent/derive.js';
2
+ import type { MiddlewareCapabilities } from '../http/middleware/capabilities.js';
3
+ import type { JsonSchemaObject } from '../internal/zod-json-schema.js';
4
+ import type { RouteDefinition } from '../mvc/Router.js';
5
+ /**
6
+ * What `Application.introspect()` reports (RFC 0026 §1): the app after every
7
+ * provider and every route registered, before anything mounted or booted. Plain
8
+ * JSON throughout, so `guren introspect --json` prints it as it is.
9
+ */
10
+ export interface AppManifest {
11
+ schemaVersion: 1;
12
+ generatedAt: string;
13
+ /** `file` is null when `introspect()` ran in process rather than under the CLI, which names the entry it imported. */
14
+ entry: {
15
+ file: string | null;
16
+ root: string;
17
+ stage: 'register';
18
+ };
19
+ runtime: {
20
+ bun: string | null;
21
+ node: string | null;
22
+ platform: string;
23
+ };
24
+ providers: ProviderEntry[];
25
+ modules: ModuleEntry[];
26
+ routes: RouteEntry[];
27
+ middlewareAliases: Record<string, MiddlewareEntry>;
28
+ /** Container keys present after `register()`, sorted. */
29
+ bindings: string[];
30
+ session?: SessionEntry;
31
+ auth?: AuthEntry;
32
+ cache?: DriverMapEntry;
33
+ storage?: DriverMapEntry;
34
+ queue?: DriverMapEntry;
35
+ attachments?: AttachmentsEntry;
36
+ agentTools: DerivedAgentTool[];
37
+ warnings: ManifestWarning[];
38
+ }
39
+ /** How a provider was registered. `app.register` is a provider added through `Application.register()` after construction. */
40
+ export type ProviderSource = 'framework' | 'options.providers' | 'module' | 'app.register';
41
+ /** `skipped` is a deferred provider: it registers on the first `make()` after boot, which introspection never reaches. */
42
+ export type ProviderRegisterOutcome = 'ran' | 'introspect-hook' | 'threw' | 'skipped';
43
+ export interface ProviderEntry {
44
+ /** `constructor.name`, durable because Guren forbids identifier mangling. */
45
+ name: string;
46
+ source: ProviderSource;
47
+ module?: string;
48
+ deferred: boolean;
49
+ provides: string[];
50
+ register: ProviderRegisterOutcome;
51
+ error?: string;
52
+ }
53
+ export interface ModuleEntry {
54
+ name: string;
55
+ prefix?: string;
56
+ /** Class names, like `ProviderEntry.name`. */
57
+ providers: string[];
58
+ /** Class names; the console keys a command by the name in its `signature`. */
59
+ commands: string[];
60
+ routeCount: number;
61
+ }
62
+ export interface ControllerRef {
63
+ name: string;
64
+ action: string;
65
+ /** Project-relative; null when identity matching found no file. */
66
+ file: string | null;
67
+ /** `'default'` or the named export; null with `file`. */
68
+ exportName: string | null;
69
+ resolved: 'identity' | 'name-only';
70
+ }
71
+ export interface MiddlewareEntry {
72
+ kind: 'alias' | 'group' | 'inline';
73
+ /** The alias or group name; an inline handler's function name, or null. */
74
+ name: string | null;
75
+ /** A group's aliases, expanded through nested groups. */
76
+ members?: string[];
77
+ capabilities: MiddlewareCapabilities;
78
+ /** The one ability this middleware checks: a single-ability check, or on a route the verb-map ability of a resource check. */
79
+ ability?: string;
80
+ /** A name no alias or group registers; `mount()` refuses it. */
81
+ unresolved?: true;
82
+ /** A group's members no alias registers, which `mount()` refuses the same way. */
83
+ unresolvedMembers?: string[];
84
+ }
85
+ export type JsonSchema = JsonSchemaObject;
86
+ export type RouteSchemaEntry = JsonSchema | {
87
+ unreadable: string;
88
+ };
89
+ export type RouteEntry = Omit<RouteDefinition, 'schemas' | 'controller' | 'middlewareNames' | 'module'> & {
90
+ module: string | null;
91
+ controller?: ControllerRef;
92
+ /** In the order `mount()` runs them: named, then group-scoped inline, then route-local inline. */
93
+ middleware: MiddlewareEntry[];
94
+ schemas: Partial<Record<'params' | 'query' | 'body' | 'output', RouteSchemaEntry>>;
95
+ };
96
+ /** `driver` and `perProcess` are null for an `auth.sessionOptions.store` thunk, which only calling it would answer. */
97
+ export interface SessionStoreEntry {
98
+ /** The configured driver name, or the store's constructor name for `auth.sessionOptions.store`. */
99
+ driver: string | null;
100
+ /** The `database` driver's table, by its SQL name. */
101
+ table?: string;
102
+ perProcess: boolean | null;
103
+ }
104
+ export interface SessionEntry {
105
+ source: 'manager' | 'auth.sessionOptions.store' | 'none';
106
+ default: string;
107
+ stores: Record<string, SessionStoreEntry>;
108
+ }
109
+ export interface AuthProviderEntry {
110
+ /** `model` for `useModel()`; `custom` for a factory passed to `registerProvider()`. */
111
+ kind: 'model' | 'custom';
112
+ model?: string;
113
+ /** The hasher's constructor name; null for a custom provider, whose hasher only its factory knows. */
114
+ hasher: string | null;
115
+ /**
116
+ * The format a framework hasher writes, matched by exact class: `DefaultHasher`
117
+ * reports one class name for scrypt and Argon2id. Null for a subclass or an app's own hasher.
118
+ */
119
+ algorithm: 'scrypt' | 'argon2' | 'bcrypt' | null;
120
+ /** Whether writing needs `Bun.password` (`ScryptHasher`, `DefaultHasher` on argon2); null where `algorithm` is. */
121
+ requiresBun: boolean | null;
122
+ }
123
+ export interface AuthEntry {
124
+ guards: string[];
125
+ defaultGuard: string | null;
126
+ /** The hasher new passwords are written with (`createApp({ auth: { hasher } })`), by constructor name. */
127
+ hasher: string;
128
+ /** As on {@link AuthProviderEntry}. */
129
+ algorithm: 'scrypt' | 'argon2' | 'bcrypt' | null;
130
+ requiresBun: boolean | null;
131
+ providers: Record<string, AuthProviderEntry>;
132
+ }
133
+ export interface DriverMapEntry {
134
+ default: string;
135
+ /** `driver` is null for an entry registered as a bare factory, whose driver is unknowable without calling it. */
136
+ entries: Record<string, {
137
+ driver: string | null;
138
+ }>;
139
+ }
140
+ export interface AttachmentsEntry {
141
+ configured: boolean;
142
+ table?: string;
143
+ disk?: string;
144
+ /** `route: false` is a disk configured `serve: 'direct'`, whose URLs bypass the delivery route. */
145
+ disks?: Record<string, {
146
+ visibility: 'public' | 'private';
147
+ route: boolean;
148
+ serve: 'auto' | 'redirect' | 'proxy';
149
+ }>;
150
+ delivery?: {
151
+ prefix: string;
152
+ routeName: string;
153
+ mounted: boolean;
154
+ };
155
+ }
156
+ /** What an attachments engine reports of itself; the manifest adds `delivery.mounted` from the route registry. */
157
+ export type AttachmentsDescription = Omit<AttachmentsEntry, 'delivery'> & {
158
+ delivery?: Omit<NonNullable<AttachmentsEntry['delivery']>, 'mounted'>;
159
+ };
160
+ export interface ManifestWarning {
161
+ code: string;
162
+ message: string;
163
+ provider?: string;
164
+ route?: string;
165
+ /** The container key a `config-unverified` warning left unbound, so a reader can tell that section from an absent one. */
166
+ key?: string;
167
+ }
package/dist/mcp/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as McpServiceProvider } from "../McpServiceProvider-B-LioPSz.js";
1
+ import { t as McpServiceProvider } from "../McpServiceProvider-PGFPlYTy.js";
2
2
  export { McpServiceProvider };
@@ -4,6 +4,7 @@ import type { Container } from '../container/Container.js';
4
4
  import type { ValidationSchema } from '../http/middleware/validation.js';
5
5
  import { type MiddlewareCapabilities } from '../http/middleware/capabilities.js';
6
6
  import { type PrototypeRouteHandler } from './prototype.js';
7
+ import type { MiddlewareEntry } from '../introspection/types.js';
7
8
  /** Constructor type for Controller classes. */
8
9
  export type ControllerConstructor<T extends Controller = Controller> = (new (...args: any[]) => T) & {
9
10
  inject?: readonly string[];
@@ -167,6 +168,8 @@ export interface RouteDefinition {
167
168
  agent?: AgentRouteMetadata;
168
169
  /** Still on its fixture (RFC 0021): registered with the `prototype` handler rather than a controller. */
169
170
  prototype?: true;
171
+ /** The `defineModule()` name of the module whose registrar added the route (the outer one, when modules nest). Absent: the app's own route. */
172
+ module?: string;
170
173
  summary?: string;
171
174
  description?: string;
172
175
  tags?: string[];
@@ -274,6 +277,33 @@ export declare class Router<in M extends string = never> {
274
277
  clear(): void;
275
278
  resetMiddleware(): void;
276
279
  definitions(): RouteDefinition[];
280
+ /** How many routes are registered, without building {@link definitions}. */
281
+ get routeCount(): number;
282
+ /**
283
+ * Records `module` on every route registered from index `start` on. `mountModuleRoutes()` calls
284
+ * it once the registrar settled, so a route an async registrar adds after an `await` counts, and a
285
+ * module a registrar mounts itself is named after the outer one, which `manifest.modules` lists.
286
+ * @internal
287
+ */
288
+ assignModule(start: number, module: string): void;
289
+ /**
290
+ * The handler behind each {@link definitions} entry, index-aligned with it
291
+ * (RFC 0026 §3): the controller class there is reduced to its name.
292
+ */
293
+ registeredHandlers(): ReadonlyArray<{
294
+ index: number;
295
+ controller?: ControllerConstructor;
296
+ action?: string;
297
+ }>;
298
+ /**
299
+ * Every alias and group resolved, and each route's chain in `mount()` order,
300
+ * index-aligned with {@link definitions} (RFC 0026 §3). Like `definitions()`,
301
+ * an unregistered name is reported rather than thrown.
302
+ */
303
+ describeMiddleware(): {
304
+ aliases: Record<string, MiddlewareEntry>;
305
+ routes: MiddlewareEntry[][];
306
+ };
277
307
  applyMiddlewareScope<T>(items: readonly MiddlewareScopeEntry[], callback: () => T): T;
278
308
  private register;
279
309
  private add;
@@ -284,6 +314,9 @@ export declare class Router<in M extends string = never> {
284
314
  * stay side-effect-free for routers that never mount (audit, codegen).
285
315
  */
286
316
  private aggregateCapabilities;
317
+ private describeNamedMiddleware;
318
+ /** A group's alias names through nested groups, each group expanded once whatever path reaches it. */
319
+ private expandGroup;
287
320
  private resolveMiddlewareNames;
288
321
  }
289
322
  declare class RouterMiddlewareGroupBuilder<in M extends string = never> {
@@ -1,4 +1,5 @@
1
1
  import { ServiceProvider, type OwnedBinding } from '../container/ServiceProvider.js';
2
+ import type { ManifestWarning } from '../introspection/types.js';
2
3
  /**
3
4
  * Validates `createApp({ env })` and binds it as `env`, then resolves and binds each
4
5
  * `createApp({ config })` definition, then each module's (RFC 0027 §1-§3, RFC 0002).
@@ -11,8 +12,14 @@ export declare class ConfigServiceProvider extends ServiceProvider {
11
12
  private unset;
12
13
  private resolved;
13
14
  private owned;
15
+ private warnings;
14
16
  register(): void;
17
+ /** Under introspection (RFC 0026) the environment has no secrets: problems are reported, not thrown. */
18
+ introspect(): void;
19
+ private bindAll;
15
20
  boot(): Promise<void>;
21
+ /** @internal Env problems reported under introspection, and configs left unbound, for the manifest (RFC 0027 §1). */
22
+ manifestWarnings(): ReadonlyArray<ManifestWarning>;
16
23
  /** @internal The bindings the definitions made, for ProviderManager's twice-configured check. */
17
24
  ownedBindings(): ReadonlyMap<string, OwnedBinding>;
18
25
  private parseEnv;
@@ -1,5 +1,6 @@
1
1
  import type { JobOptions, QueueDriver } from './types.js';
2
2
  import { type JobClass } from './Job.js';
3
+ import type { DriverMapEntry } from '../introspection/types.js';
3
4
  export type QueueDriverFactory = () => QueueDriver;
4
5
  export interface QueueConfig {
5
6
  /** @default 'memory' */
@@ -28,6 +29,8 @@ export declare class QueueManager {
28
29
  hasDriver(name: string): boolean;
29
30
  getDefaultDriverName(): string;
30
31
  getDriverNames(): string[];
32
+ /** The declared drivers and the default, resolving none. Every driver is a bare factory, so `driver` is null. */
33
+ describe(): DriverMapEntry;
31
34
  /**
32
35
  * After this, `driver()` with no name, `getDefaultDriverName()`, and — for a
33
36
  * manager bound as `queue` — `Job.dispatch()` all use the new driver.
@@ -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-DsFMcXVk.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-Bo4Q857L.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-C8s3buYz.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,5 +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-DsFMcXVk.js";
3
+ import { t as describeDriverMap } from "./driver-map-CkQc52j-.js";
3
4
  import { t as deserializeQueuedJob } from "./serialize-CKXek0Tr.js";
4
5
  import { randomUUID } from "node:crypto";
5
6
  //#region src/queue/drivers/MemoryDriver.ts
@@ -887,6 +888,10 @@ var QueueManager = class {
887
888
  getDriverNames() {
888
889
  return Array.from(this.driverFactories.keys());
889
890
  }
891
+ /** The declared drivers and the default, resolving none. Every driver is a bare factory, so `driver` is null. */
892
+ describe() {
893
+ return describeDriverMap(this.defaultDriver, Array.from(this.driverFactories.keys(), (name) => [name, null]));
894
+ }
890
895
  /**
891
896
  * After this, `driver()` with no name, `getDefaultDriverName()`, and — for a
892
897
  * manager bound as `queue` — `Job.dispatch()` all use the new driver.
@@ -1,7 +1,8 @@
1
1
  import { a as trimTrailingSlashes, n as isRealPathWithin, t as isPathWithin } from "../contained-path-BkNSBljW.js";
2
2
  import { n as parseImportMap } from "../inertia-defaults-BjrcT7za.js";
3
3
  import { n as hash } from "../Hash-D2DFd8xX.js";
4
- import { a as getManifestCss, c as isViteProduction, d as startViteDevServer, f as GUREN_ASCII_ART, h as logDevServerBanner, i as clientManifestCandidates, l as loadViteManifest, o as getManifestFile, r as PUBLIC_ASSETS_URL_PREFIX, u as normalizeDevServerUrl } from "../vite-manifest-DlU94f3Z.js";
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-wPxfAzjW.js";
5
+ import { r as logDevServerBanner, t as GUREN_ASCII_ART } from "../dev-banner-CfQDnkfQ.js";
5
6
  import { createRequire } from "node:module";
6
7
  import { dirname, extname, join, resolve } from "node:path";
7
8
  import { fileURLToPath } from "node:url";
@@ -72,8 +73,16 @@ const DEFAULT_ROOT_PUBLIC_ASSET_EXTENSIONS = [
72
73
  ".webp",
73
74
  ".avif",
74
75
  ".webmanifest",
75
- ".txt"
76
+ ".txt",
77
+ ".woff2",
78
+ ".woff",
79
+ ".ttf",
80
+ ".otf"
76
81
  ];
82
+ /**
83
+ * Must give each extension the media type Hono's `getMimeType` does
84
+ * (`public-assets.test.ts`): `serveStatic` types the same file under `/public/*`.
85
+ */
77
86
  const DEFAULT_CONTENT_TYPES = {
78
87
  ".svg": "image/svg+xml",
79
88
  ".png": "image/png",
@@ -85,6 +94,10 @@ const DEFAULT_CONTENT_TYPES = {
85
94
  ".avif": "image/avif",
86
95
  ".webmanifest": "application/manifest+json",
87
96
  ".txt": "text/plain; charset=utf-8",
97
+ ".woff2": "font/woff2",
98
+ ".woff": "font/woff",
99
+ ".ttf": "font/ttf",
100
+ ".otf": "font/otf",
88
101
  ".js": "text/javascript; charset=utf-8",
89
102
  ".mjs": "text/javascript; charset=utf-8",
90
103
  ".css": "text/css; charset=utf-8"
@@ -1,8 +1,11 @@
1
1
  import type { StorageDriver, StorageDriverFactory, StorageConfig } from './types.js';
2
+ import type { DriverMapEntry } from '../introspection/types.js';
2
3
  export declare class StorageManager {
3
4
  private readonly defaultDiskName;
4
5
  private readonly diskFactories;
5
6
  private readonly resolvedDisks;
7
+ /** The configured driver per disk, keyed like `diskFactories`; null for a bare `registerDisk()` factory. */
8
+ private readonly diskDrivers;
6
9
  private driverFactories;
7
10
  constructor(config?: StorageConfig);
8
11
  private registerBuiltinDrivers;
@@ -13,5 +16,7 @@ export declare class StorageManager {
13
16
  hasDisk(name: string): boolean;
14
17
  getDefaultDiskName(): string;
15
18
  getDiskNames(): string[];
19
+ /** The declared disks and the default, building none of them (RFC 0026 §1). */
20
+ describe(): DriverMapEntry;
16
21
  }
17
22
  export declare function createStorageManager(config?: StorageConfig): StorageManager;
@@ -1,2 +1,2 @@
1
- import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver, t as StorageManager } from "../storage-wFsUJHZW.js";
1
+ import { a as LocalDriver, i as S3Driver, n as createStorageManager, r as MemoryDriver, t as StorageManager } from "../storage-IlUesK2t.js";
2
2
  export { LocalDriver, MemoryDriver, S3Driver, StorageManager, createStorageManager };
@@ -1,5 +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
4
  import { dirname, join, relative, resolve, sep } from "node:path";
4
5
  import { copyFile, lstat, mkdir, open, readFile, readdir, readlink, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
5
6
  import { existsSync } from "node:fs";
@@ -759,12 +760,17 @@ var StorageManager = class {
759
760
  defaultDiskName;
760
761
  diskFactories = /* @__PURE__ */ new Map();
761
762
  resolvedDisks = /* @__PURE__ */ new Map();
763
+ /** The configured driver per disk, keyed like `diskFactories`; null for a bare `registerDisk()` factory. */
764
+ diskDrivers = /* @__PURE__ */ new Map();
762
765
  driverFactories = /* @__PURE__ */ new Map();
763
766
  constructor(config = {}) {
764
767
  this.defaultDiskName = config.default ?? "local";
765
768
  this.registerBuiltinDrivers();
766
769
  if (config.disks) for (const [name, diskConfig] of Object.entries(config.disks)) this.registerDiskFromConfig(name, diskConfig);
767
- if (!this.diskFactories.has(this.defaultDiskName) && this.defaultDiskName === "local") this.diskFactories.set("local", () => new LocalDriver({ root: "./storage" }));
770
+ if (!this.diskFactories.has(this.defaultDiskName) && this.defaultDiskName === "local") {
771
+ this.diskFactories.set("local", () => new LocalDriver({ root: "./storage" }));
772
+ this.diskDrivers.set("local", "local");
773
+ }
768
774
  }
769
775
  registerBuiltinDrivers() {
770
776
  this.driverFactories.set("local", (options) => {
@@ -782,6 +788,7 @@ var StorageManager = class {
782
788
  const factory = this.driverFactories.get(driver);
783
789
  if (!factory) throw new Error(`Unknown storage driver: ${driver}`);
784
790
  this.diskFactories.set(name, () => factory(options));
791
+ this.diskDrivers.set(name, driver);
785
792
  }
786
793
  disk(name) {
787
794
  const diskName = name ?? this.defaultDiskName;
@@ -795,6 +802,7 @@ var StorageManager = class {
795
802
  }
796
803
  registerDisk(name, factory) {
797
804
  this.diskFactories.set(name, factory);
805
+ this.diskDrivers.set(name, null);
798
806
  this.resolvedDisks.delete(name);
799
807
  }
800
808
  registerDriver(name, factory) {
@@ -809,6 +817,10 @@ var StorageManager = class {
809
817
  getDiskNames() {
810
818
  return Array.from(this.diskFactories.keys());
811
819
  }
820
+ /** The declared disks and the default, building none of them (RFC 0026 §1). */
821
+ describe() {
822
+ return describeDriverMap(this.defaultDiskName, this.diskDrivers);
823
+ }
812
824
  };
813
825
  function createStorageManager(config) {
814
826
  return new StorageManager(config);
@@ -1,62 +1,6 @@
1
1
  import { a as trimTrailingSlashes } from "./contained-path-BkNSBljW.js";
2
2
  import { resolve } from "node:path";
3
- import chalk from "chalk";
4
- import figlet from "figlet";
5
- import standard from "figlet/importable-fonts/Standard.js";
6
3
  import { readFileSync } from "node:fs";
7
- //#region package.json
8
- var version = "2.26.0";
9
- //#endregion
10
- //#region src/http/dev-banner.ts
11
- figlet.parseFont("Standard", standard);
12
- function generateAsciiArt(text) {
13
- try {
14
- return figlet.textSync(text, {
15
- font: "Standard",
16
- horizontalLayout: "default",
17
- verticalLayout: "default"
18
- });
19
- } catch (error) {
20
- console.error("Failed to generate FIGlet banner, falling back to plain text:", error);
21
- return text.toUpperCase();
22
- }
23
- }
24
- const GUREN_ASCII_ART = chalk.redBright.bold(generateAsciiArt("GUREN"));
25
- const GUREN_VERSION = version;
26
- /**
27
- * A wildcard bind answers on every interface but is not itself dialable on
28
- * every platform. Shared with `Application.listen()`'s returned address, which
29
- * is the same fact rendered twice.
30
- */
31
- function isWildcardHost(hostname) {
32
- return hostname === "0.0.0.0" || hostname === "::";
33
- }
34
- /** `host:port`, bracketing an IPv6 literal so the result is dialable. */
35
- function formatHostPort(hostname, port) {
36
- return `${hostname.includes(":") ? `[${hostname}]` : hostname}:${port}`;
37
- }
38
- function logDevServerBanner({ hostname, port, assetsUrl = "http://localhost:5173" }) {
39
- const localUrl = `http://localhost:${port}`;
40
- const boundUrl = `http://${formatHostPort(hostname, port)}`;
41
- const boundLabel = isWildcardHost(hostname) ? " (all interfaces)" : "";
42
- const header = [
43
- GUREN_ASCII_ART,
44
- chalk.magentaBright.bold(`Guren v${GUREN_VERSION} ignites — burning bright like a crimson lotus.`),
45
- ""
46
- ];
47
- const detail = (label, value) => `${chalk.magentaBright(" •")} ${chalk.bold(label.padEnd(14))}: ${chalk.cyanBright(value)}`;
48
- const banner = [
49
- ...header,
50
- detail("App URL", localUrl),
51
- detail("Bound address", `${boundUrl}${boundLabel}`),
52
- detail("Asset server", `${assetsUrl} (Vite)`),
53
- "",
54
- chalk.yellowBright("Press Ctrl+C to douse the flames."),
55
- ""
56
- ].join("\n");
57
- console.log(banner);
58
- }
59
- //#endregion
60
4
  //#region src/http/vite-dev-server.ts
61
5
  /**
62
6
  * Build the inline config the managed dev server starts with. `server.host` is
@@ -199,4 +143,4 @@ function getManifestCss(entry) {
199
143
  return entry.css;
200
144
  }
201
145
  //#endregion
202
- export { getManifestCss as a, isViteProduction as c, startViteDevServer as d, GUREN_ASCII_ART as f, logDevServerBanner as h, clientManifestCandidates as i, loadViteManifest as l, isWildcardHost as m, INJECTED_CLIENT_MANIFEST_SOURCE as n, getManifestFile as o, formatHostPort as p, PUBLIC_ASSETS_URL_PREFIX as r, injectedClientManifest as s, DEFAULT_DEV_SERVER_URL as t, normalizeDevServerUrl as u };
146
+ export { getManifestCss as a, isViteProduction as c, startViteDevServer as d, clientManifestCandidates as i, loadViteManifest as l, INJECTED_CLIENT_MANIFEST_SOURCE as n, getManifestFile as o, PUBLIC_ASSETS_URL_PREFIX as r, injectedClientManifest as s, DEFAULT_DEV_SERVER_URL as t, normalizeDevServerUrl as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@guren/server",
3
- "version": "2.26.0",
3
+ "version": "2.27.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",
@@ -164,7 +164,7 @@
164
164
  "test": "bun test"
165
165
  },
166
166
  "dependencies": {
167
- "@guren/orm": "^2.12.0",
167
+ "@guren/orm": "^2.13.0",
168
168
  "chalk": "^5.3.0",
169
169
  "consola": "^3.4.2",
170
170
  "figlet": "^1.7.0",