@guren/server 2.23.3 → 2.24.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 (71) hide show
  1. package/dist/DailyFileChannel-CTTPA0EF.js +114 -0
  2. package/dist/{DocsViewerServiceProvider-DWnlXx_y.js → DocsViewerServiceProvider-CIRNHQ2I.js} +2 -2
  3. package/dist/{authorization-0mCGUFoI.js → Gate-Cn1E6JnO.js} +3 -217
  4. package/dist/{Job-BVvaY-7p.js → Job-BVRCYuVY.js} +4 -10
  5. package/dist/McpServiceProvider-B-LioPSz.js +43 -0
  6. package/dist/Resource-BJhY4aF8.js +1035 -0
  7. package/dist/{loopback-guard-DT9gHF0F.js → ServiceProvider-DDW3MqQJ.js} +10 -68
  8. package/dist/agent/audit-file.d.ts +3 -0
  9. package/dist/agent/audit-sink.d.ts +16 -0
  10. package/dist/agent/call-budget.d.ts +22 -0
  11. package/dist/agent/events.d.ts +6 -6
  12. package/dist/api-token-BbgDEd6j.js +298 -0
  13. package/dist/audit-file-DocumbCr.js +29 -0
  14. package/dist/auth/index.js +2 -1
  15. package/dist/auth/oauth/index.d.ts +7 -0
  16. package/dist/{auth-Jp_MB8Il.js → auth-vFeem6uM.js} +8 -298
  17. package/dist/authorization/index.js +2 -1
  18. package/dist/authorization-BsMTG8P1.js +217 -0
  19. package/dist/broadcasting/index.js +1 -1
  20. package/dist/{broadcasting-DVfG2vgN.js → broadcasting-6o_CCfF0.js} +2 -1
  21. package/dist/config/define.d.ts +50 -0
  22. package/dist/config/env-reads.d.ts +12 -0
  23. package/dist/config/env.d.ts +122 -0
  24. package/dist/container/Container.d.ts +13 -2
  25. package/dist/container/ServiceProvider.d.ts +7 -0
  26. package/dist/container/bindings.d.ts +8 -0
  27. package/dist/{default-application-Chbrul_m.js → default-application-CMuAAsdf.js} +20 -31
  28. package/dist/deprecate-rL8jNpKX.js +31 -0
  29. package/dist/encryption/index.js +1 -1
  30. package/dist/{encryption-BRjZnshr.js → encryption-_GiNb0Ol.js} +2 -1
  31. package/dist/{endpoint-BXipU2Jj.js → endpoint-CTIzcagh.js} +1 -1
  32. package/dist/{endpoint-Dsw3Acvq.js → endpoint-Coq0K_6I.js} +1 -1
  33. package/dist/events/index.js +1 -1
  34. package/dist/{events-CaJKZ2qk.js → events-swsyfCzt.js} +1 -1
  35. package/dist/http/Application.d.ts +22 -0
  36. package/dist/http/vite-manifest.d.ts +5 -1
  37. package/dist/i18n/index.js +1 -1
  38. package/dist/i18n/injected-translations.d.ts +8 -0
  39. package/dist/i18n/loaders/JsonLoader.d.ts +3 -2
  40. package/dist/{i18n-DRo1g0AN.js → i18n-0bOJqFpX.js} +5 -3
  41. package/dist/index.d.ts +11 -0
  42. package/dist/index.js +526 -1075
  43. package/dist/inertia-defaults-BjrcT7za.js +30 -0
  44. package/dist/internal/request.d.ts +4 -3
  45. package/dist/internal/request.js +2 -1
  46. package/dist/internal/testing.d.ts +17 -0
  47. package/dist/internal/testing.js +6 -0
  48. package/dist/lambda/index.js +1 -1
  49. package/dist/logging/index.js +2 -1
  50. package/dist/{logging-CXotojgW.js → logging-DshkpIkj.js} +4 -113
  51. package/dist/loopback-guard-CG8xB4v0.js +68 -0
  52. package/dist/mail/index.js +1 -1
  53. package/dist/{mail-zMjQimaJ.js → mail-CQlxrjYp.js} +4 -2
  54. package/dist/mcp/McpServiceProvider.d.ts +21 -4
  55. package/dist/mcp/create-mcp-server.d.ts +6 -0
  56. package/dist/mcp/index.js +434 -1
  57. package/dist/mvc/Controller.d.ts +11 -1
  58. package/dist/mvc/Router.d.ts +6 -0
  59. package/dist/mvc/inertia/InertiaEngine.d.ts +2 -0
  60. package/dist/mvc/validated-input.d.ts +55 -0
  61. package/dist/notifications/index.js +1 -1
  62. package/dist/{notifications-BLid0Y6M.js → notifications-DmyJZGM2.js} +3 -2
  63. package/dist/providers/ConfigServiceProvider.d.ts +19 -0
  64. package/dist/queue/index.js +2 -2
  65. package/dist/{queue-IdJjqbyJ.js → queue-CdwHlFXE.js} +1 -1
  66. package/dist/resolve-optional-ax6gPWTp.js +9 -0
  67. package/dist/runtime/index.js +2 -1
  68. package/dist/validated-input-D84J8wcC.js +25 -0
  69. package/dist/{vite-manifest-DeWRFXTm.js → vite-manifest-DAqhhZZ9.js} +7 -32
  70. package/package.json +6 -2
  71. package/dist/McpServiceProvider-BvJRcDOm.js +0 -458
@@ -0,0 +1,122 @@
1
+ /**
2
+ * The application's validated environment. Empty here; an app's `config/env.ts`
3
+ * fills it: `declare module '@guren/core' { interface AppEnv extends InferEnv<typeof env> {} }`.
4
+ */
5
+ export interface AppEnv {
6
+ }
7
+ /** The subset of Standard Schema v1 that `Env.custom()` calls; zod 4 implements it. */
8
+ export interface StandardSchemaV1<Output = unknown> {
9
+ readonly '~standard': {
10
+ readonly version: 1;
11
+ readonly vendor: string;
12
+ readonly validate: (value: unknown) => StandardSchemaResult<Output> | Promise<StandardSchemaResult<Output>>;
13
+ };
14
+ }
15
+ export type StandardSchemaResult<Output> = {
16
+ readonly value: Output;
17
+ readonly issues?: undefined;
18
+ } | {
19
+ readonly issues: ReadonlyArray<{
20
+ readonly message: string;
21
+ }>;
22
+ };
23
+ /** Values read ahead of `process.env`: the Workers env, a test's overrides. Non-string values are ignored. */
24
+ export type EnvSource = Readonly<Record<string, unknown>>;
25
+ export interface EnvProblem {
26
+ readonly key: string;
27
+ readonly message: string;
28
+ }
29
+ export interface EnvParseOptions {
30
+ /** `report` collects problems instead of throwing, for introspection and the CLI. */
31
+ readonly mode?: 'throw' | 'report';
32
+ }
33
+ export interface ParsedEnv<Values> {
34
+ readonly values: Values;
35
+ readonly problems: readonly EnvProblem[];
36
+ /** Keys whose value is the redacted placeholder: unset and required, or invalid. */
37
+ readonly unset: ReadonlySet<string>;
38
+ }
39
+ type Presence = 'required' | 'optional' | 'defaulted' | 'production';
40
+ type Coerced<T> = {
41
+ readonly value: T;
42
+ } | {
43
+ readonly problem: string;
44
+ };
45
+ interface EnvVarState<T> {
46
+ readonly coerce: (raw: string) => Coerced<T>;
47
+ readonly choices?: readonly string[];
48
+ readonly presence: Presence;
49
+ readonly fallback?: T;
50
+ readonly emptyAllowed: boolean;
51
+ readonly isSecret: boolean;
52
+ readonly description?: string;
53
+ }
54
+ /** One declared variable. Immutable: every modifier returns a new instance. */
55
+ export declare class EnvVar<T, P extends Presence = 'required'> {
56
+ private readonly state;
57
+ /** Carries `P` into the type; never set at runtime. */
58
+ readonly presenceType: P;
59
+ constructor(state: EnvVarState<T>);
60
+ /** Unset resolves to `undefined`. */
61
+ optional(): EnvVar<T, 'optional'>;
62
+ /** Unset, blank included, resolves to `value`. */
63
+ default(value: T): EnvVar<T, 'defaulted'>;
64
+ /** Required only when `NODE_ENV` is `production`; `undefined` when unset elsewhere. */
65
+ requiredInProduction(): EnvVar<T, 'production'>;
66
+ /** Treat `FOO=` as the value `''` rather than as unset. */
67
+ allowEmpty(): EnvVar<T, P>;
68
+ /** Never echo the value, in a problem message or anywhere a schema is printed. */
69
+ secret(): EnvVar<T, P>;
70
+ describe(text: string): EnvVar<T, P>;
71
+ get isSecret(): boolean;
72
+ get description(): string | undefined;
73
+ /** The `.default()` value; `undefined` unless `presence` is `defaulted`. */
74
+ get defaultValue(): T | undefined;
75
+ /** The values an `Env.enum()` admits; `undefined` for every other builder. */
76
+ get choices(): readonly string[] | undefined;
77
+ /** @internal */
78
+ resolve(raw: string | undefined, production: boolean): Coerced<T | undefined> | {
79
+ readonly unset: true;
80
+ };
81
+ }
82
+ export declare const Env: {
83
+ string: () => EnvVar<string>;
84
+ url: () => EnvVar<string>;
85
+ number: () => EnvVar<number>;
86
+ port: () => EnvVar<number>;
87
+ boolean: () => EnvVar<boolean>;
88
+ enum: <const Values extends readonly [string, ...string[]]>(values: Values) => EnvVar<Values[number]>;
89
+ /**
90
+ * Synchronous validators only: `parse()` also runs where nothing can await it
91
+ * (the CLI, a connection thunk), so a Promise result is reported as a problem.
92
+ */
93
+ custom: <Output>(schema: StandardSchemaV1<Output>) => EnvVar<Output>;
94
+ };
95
+ export type EnvVars = Readonly<Record<string, EnvVar<any, Presence>>>;
96
+ type ValueOf<V> = V extends EnvVar<infer T, infer P> ? P extends 'optional' | 'production' ? T | undefined : T : never;
97
+ export type InferEnvVars<Vars extends EnvVars> = {
98
+ readonly [K in keyof Vars]: ValueOf<Vars[K]>;
99
+ };
100
+ /** The values a schema validates to, for `interface AppEnv extends InferEnv<typeof env> {}`. */
101
+ export type InferEnv<Schema> = Schema extends EnvSchema<infer Vars> ? InferEnvVars<Vars> : never;
102
+ export declare class EnvValidationError extends Error {
103
+ readonly problems: readonly EnvProblem[];
104
+ constructor(problems: readonly EnvProblem[]);
105
+ }
106
+ export declare class EnvSchema<Vars extends EnvVars = EnvVars> {
107
+ readonly vars: Vars;
108
+ constructor(vars: Vars);
109
+ /**
110
+ * Looks up each declared key in `source`, then `process.env`, and does not
111
+ * cache: `process.env` keeps its identity while tests and platforms mutate it.
112
+ */
113
+ parse(source?: EnvSource, options?: EnvParseOptions): ParsedEnv<InferEnvVars<Vars>>;
114
+ }
115
+ /**
116
+ * Keys an app schema may not declare. `NODE_ENV` gates fold at bundle time only
117
+ * as the exact `process.env.NODE_ENV` expression, and `GUREN_*` are framework
118
+ * security gates and tooling flags (RFC 0027 §1). The oxlint rule keeps a copy.
119
+ */
120
+ export declare function isRawEnvKey(key: string): boolean;
121
+ export declare function defineEnv<const Vars extends EnvVars>(vars: Vars): EnvSchema<Vars>;
122
+ export {};
@@ -23,6 +23,12 @@ export declare class Container {
23
23
  bind<T>(key: string, factory: ServiceFactory<T>): this;
24
24
  /** Bind a factory whose single instance is reused. */
25
25
  singleton<T>(key: string, factory: ServiceFactory<T>): this;
26
+ /**
27
+ * `singleton()` only when `key` is unbound, so a framework default never
28
+ * replaces what the app or its config bound, whatever the provider order
29
+ * (RFC 0027 §3). Uses `has()`: a fake or a deferred provider does not count.
30
+ */
31
+ singletonIf<T>(key: string, factory: ServiceFactory<T>): this;
26
32
  instance<T>(key: string, value: T): this;
27
33
  make<K extends keyof ServiceBindings>(key: K): ServiceBindings[K];
28
34
  make<T>(key: string): T;
@@ -45,8 +51,8 @@ export declare class Container {
45
51
  scoped<T>(callback: () => T): T;
46
52
  scopedAsync<T>(callback: () => Promise<T>): Promise<T>;
47
53
  /**
48
- * Replace a binding with a fake for tests; the returned disposable restores the
49
- * original (`using _ = container.fake(key, fake)`).
54
+ * Replace a binding with a fake for tests; the returned disposable restores what
55
+ * was there before, a fake it shadowed included (`using _ = container.fake(key, fake)`).
50
56
  */
51
57
  fake<K extends keyof ServiceBindings>(key: K, instance: ServiceBindings[K]): Disposable;
52
58
  fake(key: string, instance: unknown): Disposable;
@@ -55,6 +61,11 @@ export declare class Container {
55
61
  flush(): void;
56
62
  forget(key: string): this;
57
63
  getBindings(): string[];
64
+ /**
65
+ * An opaque token for the binding behind `key`, compared by identity: every
66
+ * bind replaces it, so two reads tell a rebind apart, which a key list cannot (RFC 0027 §3).
67
+ */
68
+ bindingOf(key: string): unknown;
58
69
  getAliases(): Record<string, string>;
59
70
  getTags(): Record<string, string[]>;
60
71
  protected resolveAlias(key: string): string;
@@ -23,6 +23,11 @@ export declare abstract class ServiceProvider implements Provider {
23
23
  provides(): string[];
24
24
  isDeferred(): boolean;
25
25
  }
26
+ /** A binding a provider made and no later provider may replace, with where it was declared. */
27
+ export interface OwnedBinding {
28
+ readonly binding: unknown;
29
+ readonly source: string;
30
+ }
26
31
  /**
27
32
  * Provider manager for registering and booting providers.
28
33
  */
@@ -34,11 +39,13 @@ export declare class ProviderManager {
34
39
  protected deferredProviders: Map<string, ServiceProvider>;
35
40
  /** Per service, the boot of an already-activated deferred provider, so a later loadDeferredProvider() awaits that boot */
36
41
  private deferredActivations;
42
+ private bindingOwners;
37
43
  private allBooted;
38
44
  constructor(container: Container);
39
45
  register(providerOrClass: ServiceProvider | ServiceProviderConstructor): this;
40
46
  registerMany(providers: Array<ServiceProvider | ServiceProviderConstructor>): this;
41
47
  registerAll(): Promise<void>;
48
+ private assertOwnedBindingsKept;
42
49
  bootAll(): Promise<void>;
43
50
  /**
44
51
  * Register, boot, and unclaim a deferred provider's services. Resolves once
@@ -21,6 +21,8 @@ import type { SharedInertiaPropsRegistry } from '../mvc/inertia/shared.js';
21
21
  import type { InertiaDocumentOptions, InertiaSsrRenderer } from '../mvc/inertia/InertiaEngine.js';
22
22
  import type { AgentAuditEmitter } from '../agent/audit-emitter.js';
23
23
  import type { SessionManager } from '../http/middleware/session-manager.js';
24
+ import type { AppEnv, EnvSource } from '../config/env.js';
25
+ import type { HostAuthorizationOptions } from '../http/middleware/host-authorization.js';
24
26
  /** Maps service keys to their concrete types, for `container.make('key')`. */
25
27
  export interface ServiceBindings {
26
28
  app: Application;
@@ -58,4 +60,10 @@ export interface ServiceBindings {
58
60
  */
59
61
  'agent.audit': AgentAuditEmitter;
60
62
  'exception.handler': ExceptionHandler;
63
+ /** The validated `createApp({ env })` schema, bound by ConfigServiceProvider (RFC 0027 §1). */
64
+ env: AppEnv;
65
+ /** Read ahead of `process.env` when the schema is parsed: the Workers env, a test's `envSource`. */
66
+ 'env.source': EnvSource;
67
+ /** Bound by `defineHttpConfig()`; read by the host-authorization placeholder mounted ahead of app middleware (RFC 0027 §5). */
68
+ 'http.hostAuthorization': HostAuthorizationOptions | false;
61
69
  }
@@ -1,33 +1,5 @@
1
1
  import { t as warnOnce } from "./warn-once-p-IlMjra.js";
2
- //#region src/support/deprecate.ts
3
- /** The release these shims were deprecated in, and the one that removes them (RFC 0023 Part 3). */
4
- const SINCE = "2.23.0";
5
- const REMOVED_IN = "3.0.0";
6
- /** RFC 0023 §5: the module-level service slots, split by direction. */
7
- const GLOBAL_SERVICE_SETTERS = "global-service-setters";
8
- const GLOBAL_SERVICE_GETTERS = "global-service-getters";
9
- const SETTER_REPLACEMENT = "Bind the service on the owning app's container instead — container.instance(key, value) from a service provider. createApp({ inertia }) covers the two Inertia options, and shareInertiaProps(fn, container) the shared props.";
10
- const GETTER_REPLACEMENT = "Resolve from the container that owns the call — this.make(key) in a controller, job or command, getRequestContainer(ctx).make(key) in middleware, defaultContainer().make(key) elsewhere.";
11
- /**
12
- * @internal The deprecation policy's warning format
13
- * (`contributing/deprecation-policy.md`), keyed per symbol so one deprecated
14
- * call does not silence its siblings.
15
- */
16
- function warnDeprecated(id, symbol, replacement, versions = {
17
- since: SINCE,
18
- removedIn: REMOVED_IN
19
- }) {
20
- warnOnce(`${id}:${symbol}`, `[guren] Deprecation (${id}): ${symbol}() is deprecated\n since ${versions.since}, will be removed in ${versions.removedIn}.\n ${replacement}`);
21
- }
22
- /** @internal */
23
- function warnDeprecatedSetter(symbol) {
24
- warnDeprecated(GLOBAL_SERVICE_SETTERS, symbol, SETTER_REPLACEMENT);
25
- }
26
- /** @internal */
27
- function warnDeprecatedGetter(symbol) {
28
- warnDeprecated(GLOBAL_SERVICE_GETTERS, symbol, GETTER_REPLACEMENT);
29
- }
30
- //#endregion
2
+ import { n as warnDeprecatedGetter, r as warnDeprecatedSetter } from "./deprecate-rL8jNpKX.js";
31
3
  //#region src/container/Container.ts
32
4
  /**
33
5
  * Dependency injection container. Keys from `ServiceBindings` type `make()`
@@ -64,6 +36,14 @@ var Container = class Container {
64
36
  });
65
37
  return this;
66
38
  }
39
+ /**
40
+ * `singleton()` only when `key` is unbound, so a framework default never
41
+ * replaces what the app or its config bound, whatever the provider order
42
+ * (RFC 0027 §3). Uses `has()`: a fake or a deferred provider does not count.
43
+ */
44
+ singletonIf(key, factory) {
45
+ return this.has(key) ? this : this.singleton(key, factory);
46
+ }
67
47
  instance(key, value) {
68
48
  this.bindings.set(key, {
69
49
  factory: () => value,
@@ -169,9 +149,11 @@ var Container = class Container {
169
149
  }
170
150
  }
171
151
  fake(key, instance) {
152
+ const shadowed = this.fakes.has(key) ? { instance: this.fakes.get(key) } : void 0;
172
153
  this.fakes.set(key, instance);
173
154
  return { [Symbol.dispose]: () => {
174
- this.fakes.delete(key);
155
+ if (shadowed) this.fakes.set(key, shadowed.instance);
156
+ else this.fakes.delete(key);
175
157
  } };
176
158
  }
177
159
  isFaked(key) {
@@ -191,6 +173,13 @@ var Container = class Container {
191
173
  getBindings() {
192
174
  return Array.from(this.bindings.keys());
193
175
  }
176
+ /**
177
+ * An opaque token for the binding behind `key`, compared by identity: every
178
+ * bind replaces it, so two reads tell a rebind apart, which a key list cannot (RFC 0027 §3).
179
+ */
180
+ bindingOf(key) {
181
+ return this.bindings.get(this.resolveAlias(key));
182
+ }
194
183
  getAliases() {
195
184
  const result = {};
196
185
  for (const [alias, key] of this.aliases) result[alias] = key;
@@ -335,4 +324,4 @@ function warnIfAmbiguous() {
335
324
  if (ambiguous) warnOnce("ambient-application-ambiguous", AMBIGUOUS_WARNING);
336
325
  }
337
326
  //#endregion
338
- export { defaultApplication as a, resolve as c, createContainer as d, getContainer as f, warnDeprecatedSetter as h, bindAmbient as i, useAsDefaultApplication as l, warnDeprecatedGetter as m, ambientBinding as n, defaultContainer as o, setContainer as p, ambientContainer as r, resetDefaultApplication as s, adoptDefaultApplication as t, Container as u };
327
+ export { defaultApplication as a, resolve as c, createContainer as d, getContainer as f, bindAmbient as i, useAsDefaultApplication as l, ambientBinding as n, defaultContainer as o, setContainer as p, ambientContainer as r, resetDefaultApplication as s, adoptDefaultApplication as t, Container as u };
@@ -0,0 +1,31 @@
1
+ import { t as warnOnce } from "./warn-once-p-IlMjra.js";
2
+ //#region src/support/deprecate.ts
3
+ /** The release these shims were deprecated in, and the one that removes them (RFC 0023 Part 3). */
4
+ const SINCE = "2.23.0";
5
+ const REMOVED_IN = "3.0.0";
6
+ /** RFC 0023 §5: the module-level service slots, split by direction. */
7
+ const GLOBAL_SERVICE_SETTERS = "global-service-setters";
8
+ const GLOBAL_SERVICE_GETTERS = "global-service-getters";
9
+ const SETTER_REPLACEMENT = "Bind the service on the owning app's container instead — container.instance(key, value) from a service provider. createApp({ inertia }) covers the two Inertia options, and shareInertiaProps(fn, container) the shared props.";
10
+ const GETTER_REPLACEMENT = "Resolve from the container that owns the call — this.make(key) in a controller, job or command, getRequestContainer(ctx).make(key) in middleware, defaultContainer().make(key) elsewhere.";
11
+ /**
12
+ * @internal The deprecation policy's warning format
13
+ * (`contributing/deprecation-policy.md`), keyed per symbol so one deprecated
14
+ * call does not silence its siblings.
15
+ */
16
+ function warnDeprecated(id, symbol, replacement, versions = {
17
+ since: SINCE,
18
+ removedIn: REMOVED_IN
19
+ }) {
20
+ warnOnce(`${id}:${symbol}`, `[guren] Deprecation (${id}): ${symbol}() is deprecated\n since ${versions.since}, will be removed in ${versions.removedIn}.\n ${replacement}`);
21
+ }
22
+ /** @internal */
23
+ function warnDeprecatedSetter(symbol) {
24
+ warnDeprecated(GLOBAL_SERVICE_SETTERS, symbol, SETTER_REPLACEMENT);
25
+ }
26
+ /** @internal */
27
+ function warnDeprecatedGetter(symbol) {
28
+ warnDeprecated(GLOBAL_SERVICE_GETTERS, symbol, GETTER_REPLACEMENT);
29
+ }
30
+ //#endregion
31
+ export { warnDeprecatedGetter as n, warnDeprecatedSetter as r, warnDeprecated as t };
@@ -1,5 +1,5 @@
1
1
  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";
2
2
  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";
3
3
  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";
4
- import { a as decrypt, c as getEncrypter, i as createEncrypter, l as setEncrypter, n as verifySignedUrl, o as encrypt, r as Encrypter, s as generateKey, t as signUrl } from "../encryption-BRjZnshr.js";
4
+ 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-_GiNb0Ol.js";
5
5
  export { Encrypter, MessageSigner, check, createEncrypter, decrypt, deriveAppKey, deriveAppKeyring, encodeDerivedKey, encrypt, generateAppKey, generateKey, generateOtp, generatePassword, generateSlug, getAppKeyringFromEnv, getEncrypter, hash, hashPassword, hmac, md5, needsRehash, normalizeAppKey, parseAppKey, parsePreviousAppKeys, pick, random, randomBase64, randomBase64Url, randomHex, randomInt, randomString, sample, secureCompare, setEncrypter, sha256, sha512, shuffle, signUrl, urlSafeToken, uuid, verifyHmac, verifyPassword, verifySignedUrl };
@@ -1,5 +1,6 @@
1
1
  import { a as generateAppKey, s as normalizeAppKey, t as MessageSigner } from "./MessageSigner-Bd25ZJAV.js";
2
- import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-Chbrul_m.js";
2
+ import { n as warnDeprecatedGetter, r as warnDeprecatedSetter } from "./deprecate-rL8jNpKX.js";
3
+ import { i as bindAmbient, n as ambientBinding } from "./default-application-CMuAAsdf.js";
3
4
  import { createCipheriv, createDecipheriv, createHmac, randomBytes } from "crypto";
4
5
  //#region src/encryption/Encrypter.ts
5
6
  /**
@@ -1,4 +1,4 @@
1
- import { t as createLoopbackGuard } from "./loopback-guard-DT9gHF0F.js";
1
+ import { t as createLoopbackGuard } from "./loopback-guard-CG8xB4v0.js";
2
2
  //#region src/docs-viewer/endpoint.ts
3
3
  const DOCS_VIEWER_PATH = "/_guren/docs";
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { t as createLoopbackGuard } from "./loopback-guard-DT9gHF0F.js";
1
+ import { t as createLoopbackGuard } from "./loopback-guard-CG8xB4v0.js";
2
2
  //#region src/mcp/endpoint.ts
3
3
  const MCP_ENDPOINT_PATH = "/_guren/mcp";
4
4
  /**
@@ -1,2 +1,2 @@
1
- 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-CaJKZ2qk.js";
1
+ 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-swsyfCzt.js";
2
2
  export { ApplicationShutdown, ApplicationStarted, Event, EventManager, JobFailed, JobProcessed, Listener, RequestFinished, RequestReceived, UserAuthenticated, UserLoggedOut, createEventManager, createQueueEventDispatcher };
@@ -1,5 +1,5 @@
1
- import { d as resolveQueueDriver, l as registerJob, t as Job } from "./Job-BVvaY-7p.js";
2
1
  import { t as warnOnce } from "./warn-once-p-IlMjra.js";
2
+ import { d as resolveQueueDriver, l as registerJob, t as Job } from "./Job-BVRCYuVY.js";
3
3
  //#region src/events/Event.ts
4
4
  /** Base class for all application events. */
5
5
  var Event = class {
@@ -14,6 +14,9 @@ import { type HostAuthorizationOptions } from './middleware/host-authorization.j
14
14
  import { type DevBannerOptions } from './dev-banner.js';
15
15
  import { startViteDevServer, type StartViteDevServerOptions } from './vite-dev-server.js';
16
16
  import type { InertiaDocumentOptions, InertiaSsrRenderer } from '../mvc/inertia/InertiaEngine.js';
17
+ import { type SharedInertiaPropsResolver } from '../mvc/inertia/shared.js';
18
+ import type { EnvSchema } from '../config/env.js';
19
+ import type { ConfigDefinition } from '../config/define.js';
17
20
  type BunServer = {
18
21
  stop?: (closeConnections?: boolean) => void | Promise<void>;
19
22
  requestIP?: (request: Request) => {
@@ -82,12 +85,21 @@ export interface ApplicationOptions {
82
85
  * `Controller.inertia()` ahead of the process-wide setters.
83
86
  */
84
87
  readonly inertia?: InertiaApplicationOptions;
88
+ /** The schema `config/env.ts` exports, validated at boot and bound as `env` (RFC 0027 §1). */
89
+ readonly env?: EnvSchema;
90
+ /**
91
+ * The definitions `config/*.ts` export, resolved against `env` and bound before
92
+ * any provider registers (RFC 0027 §2). One definition per key.
93
+ */
94
+ readonly config?: ReadonlyArray<ConfigDefinition>;
85
95
  }
86
96
  export interface InertiaApplicationOptions {
87
97
  /** Document defaults for server-rendered responses; each per-response {@link InertiaOptions} field overrides its own. */
88
98
  readonly document?: InertiaDocumentOptions;
89
99
  /** Default SSR renderer, for a bundle that cannot resolve a runtime path; per-call `ssr.render` still wins. */
90
100
  readonly ssrRenderer?: InertiaSsrRenderer;
101
+ /** Props merged into every Inertia response, scoped to this app's container: `shareInertiaProps(share, container)`. */
102
+ readonly share?: SharedInertiaPropsResolver;
91
103
  }
92
104
  export interface I18nPluginOptions {
93
105
  /** Detection only resolves to one of these; all are preloaded during `boot()`. */
@@ -177,6 +189,8 @@ export declare class Application {
177
189
  get auth(): AuthManager;
178
190
  get authOptions(): AuthPluginOptions | undefined;
179
191
  get i18nOptions(): I18nPluginOptions | undefined;
192
+ get envSchema(): EnvSchema | undefined;
193
+ get configDefinitions(): ReadonlyArray<ConfigDefinition>;
180
194
  markAutoSessionAttached(): void;
181
195
  /** Whether `key` is supplied by a deferred provider, which only activates on a `make()` after boot. */
182
196
  isDeferredService(key: string): boolean;
@@ -227,6 +241,14 @@ export declare class Application {
227
241
  /** Called once, from the constructor — see the note there for why. */
228
242
  private mountSecurityDefaults;
229
243
  private mountHostAuthorization;
244
+ /**
245
+ * Holds host authorization's place ahead of every app middleware while its
246
+ * options wait for `defineHttpConfig()` to resolve at boot (RFC 0027 §5), the
247
+ * placeholder shape AuthServiceProvider uses for sessions. Unbound means not
248
+ * booted, and an unchecked request is refused rather than passed.
249
+ */
250
+ private mountConfiguredHostAuthorization;
251
+ private hasHttpConfig;
230
252
  /**
231
253
  * Mounts an opt-in, dev-only framework endpoint. Only the dynamic import may
232
254
  * fail silently — these providers reach optional dependencies an app need not
@@ -5,7 +5,11 @@
5
5
  * live, which URL prefix serves the hashed files, and what "the dev server is
6
6
  * on" means.
7
7
  */
8
- /** Where `configureInertiaAssets` serves hashed build output from. */
8
+ /**
9
+ * Where `configureInertiaAssets` serves hashed build output from. The deploy
10
+ * builds restate it as `CLIENT_ASSETS_URL_PREFIX` in @guren/core's
11
+ * internal/deploy-build.ts; tests/http/vite-manifest.test.ts pins the two equal.
12
+ */
9
13
  export declare const PUBLIC_ASSETS_URL_PREFIX = "/public/assets/";
10
14
  /** The Vite default the framework assumes when no dev-server URL is set. */
11
15
  export declare const DEFAULT_DEV_SERVER_URL = "http://localhost:5173";
@@ -1,2 +1,2 @@
1
- import { a as resolveI18n, c as tc, d as Translator, f as getPluralizationRule, i as getI18n, l as tryGetI18n, m as selectPluralForm, n as I18nManager, o as setI18n, p as pluralizationRules, r as createI18n, s as t, t as MemoryLoader, u as JsonLoader } from "../i18n-DRo1g0AN.js";
1
+ import { a as resolveI18n, c as tc, d as Translator, f as getPluralizationRule, i as getI18n, l as tryGetI18n, m as selectPluralForm, n as I18nManager, o as setI18n, p as pluralizationRules, r as createI18n, s as t, t as MemoryLoader, u as JsonLoader } from "../i18n-0bOJqFpX.js";
2
2
  export { I18nManager, JsonLoader, MemoryLoader, Translator, createI18n, getI18n, getPluralizationRule, pluralizationRules, resolveI18n, selectPluralForm, setI18n, t, tc, tryGetI18n };
@@ -0,0 +1,8 @@
1
+ import type { TranslationMessages } from './types.js';
2
+ /**
3
+ * The `lang/` catalogs a deploy build injected for runtimes that ship no `lang/`
4
+ * directory (Workers, Lambda, Vercel). Fails loudly on a value that is set but
5
+ * not a catalog: falling through to the filesystem would warn about a missing
6
+ * `lang/` rather than about the variable that is actually broken.
7
+ */
8
+ export declare function injectedTranslations(): Record<string, TranslationMessages> | undefined;
@@ -2,8 +2,9 @@ import type { TranslationLoader, TranslationMessages } from '../types.js';
2
2
  /**
3
3
  * JSON file-based translation loader: `<path>/<locale>/<namespace>.json`.
4
4
  * That layout is a contract shared with the CLI — `guren codegen` and
5
- * `guren check --i18n` re-implement the same walk statically, so a change to
6
- * the layout or the parse tolerance has to be made in all three.
5
+ * `guren check --i18n` re-implement the same walk statically, and so does
6
+ * `translationCatalogJson` in @guren/core's deploy-build, which bundles `lang/`
7
+ * for deploy targets. A change to the layout or the parse tolerance goes in all.
7
8
  */
8
9
  export declare class JsonLoader implements TranslationLoader {
9
10
  private basePath;
@@ -1,4 +1,5 @@
1
- import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-Chbrul_m.js";
1
+ import { n as warnDeprecatedGetter, r as warnDeprecatedSetter } from "./deprecate-rL8jNpKX.js";
2
+ import { i as bindAmbient, n as ambientBinding } from "./default-application-CMuAAsdf.js";
2
3
  import { basename, extname, join } from "node:path";
3
4
  import { readFile, readdir } from "node:fs/promises";
4
5
  //#region src/i18n/pluralization.ts
@@ -189,8 +190,9 @@ var Translator = class {
189
190
  /**
190
191
  * JSON file-based translation loader: `<path>/<locale>/<namespace>.json`.
191
192
  * That layout is a contract shared with the CLI — `guren codegen` and
192
- * `guren check --i18n` re-implement the same walk statically, so a change to
193
- * the layout or the parse tolerance has to be made in all three.
193
+ * `guren check --i18n` re-implement the same walk statically, and so does
194
+ * `translationCatalogJson` in @guren/core's deploy-build, which bundles `lang/`
195
+ * for deploy targets. A change to the layout or the parse tolerance goes in all.
194
196
  */
195
197
  var JsonLoader = class {
196
198
  basePath;
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ export type { Context, ApplicationListenOptions, ListenAddress, ServiceProviderC
6
6
  export { parseRequestPayload, formatValidationErrors } from './http/request.js';
7
7
  export { Controller } from './mvc/Controller.js';
8
8
  export type { InertiaResponse, InferInertiaProps, ControllerInertiaProps, AuthPayload } from './mvc/Controller.js';
9
+ export type { GurenRouteContracts, ValidatedInput } from './mvc/validated-input.js';
9
10
  export { renderDocument } from './mvc/view.js';
10
11
  export type { ViewOptions } from './mvc/view.js';
11
12
  export type { FC, PropsWithChildren } from 'hono/jsx';
@@ -30,6 +31,8 @@ export { DEFAULT_AGENT_AUDIT_PATH, parseAuditRecord, toAuditRecord } from './age
30
31
  export type { AgentAuditDeniedRecord, AgentAuditInvokedRecord, AgentAuditRecord, } from './agent/audit.js';
31
32
  export { AGENT_AUDIT_BINDING, createAuditEmitter } from './agent/audit-emitter.js';
32
33
  export type { AgentAuditEmitter, AgentAuditSink, AuditEmitterOptions } from './agent/audit-emitter.js';
34
+ export { resolveAgentAuditSink } from './agent/audit-sink.js';
35
+ export type { AgentAuditConfig } from './agent/audit-sink.js';
33
36
  export { AGENT_APPROVAL_CONFIG_KEY, agentApprovalExpiredAt, agentApprovalFingerprint, agentApprovalPrincipalKey, agentApprovalStatusAt, agentApprovalUsableAt, agentApprovalVisibleTo, buildAgentApprovalRequest, canonicalizeAgentApprovalInput, DEFAULT_AGENT_APPROVAL_TTL_MS, } from './agent/approval.js';
34
37
  export type { AgentApprovalMatch, AgentApprovalRequest, AgentApprovalRequestInput, AgentApprovalStatus, AgentApprovalStore, } from './agent/approval.js';
35
38
  export { AgentApprovalRequested } from './agent/AgentApprovalRequested.js';
@@ -37,6 +40,8 @@ export { DEFAULT_APPROVAL_CONFIGURE_HINT, DEFAULT_SCOPE_SUBJECT, gateApproval, g
37
40
  export type { ApprovalGateContext, GateVerdict, ScopeGateOptions } from './agent/gate.js';
38
41
  export { createAgentApprovalContext, createAgentAuditRecorder, createAgentInvocationPipeline, } from './agent/pipeline.js';
39
42
  export type { AgentAuditRecorder, AgentAuditRecorderOptions, AgentDispatchTarget, AgentInterposition, AgentInvocation, AgentInvocationDenial, AgentInvocationOptions, AgentInvocationPipeline, AgentInvocationResult, AuditedTool, InterposedAgentCall, } from './agent/pipeline.js';
43
+ export { createAgentCallBudget } from './agent/call-budget.js';
44
+ export type { AgentCallBudget, AgentCallBudgetOptions } from './agent/call-budget.js';
40
45
  export { approvalStatusNotFoundMessage, toApprovalStatusReport } from './agent/approval-status.js';
41
46
  export type { ApprovalStatusOutcome, ApprovalStatusReport } from './agent/approval-status.js';
42
47
  export { ViewEngine } from './mvc/ViewEngine.js';
@@ -99,6 +104,12 @@ export { DefaultHasher, DefaultHasher as Hash } from './auth/password/DefaultHas
99
104
  export type { PasswordHashAlgorithm, DefaultHasherOptions } from './auth/password/DefaultHasher.js';
100
105
  export type { PasswordHasherOption } from './auth/password/configured-hasher.js';
101
106
  export type { ApplicationOptions, AuthPluginOptions, I18nPluginOptions, InertiaApplicationOptions } from './http/Application.js';
107
+ export { defineEnv, Env, EnvSchema, EnvValidationError, EnvVar, isRawEnvKey } from './config/env.js';
108
+ export type { AppEnv, EnvProblem, EnvSource, InferEnv, ParsedEnv } from './config/env.js';
109
+ export { recordEnvReads } from './config/env-reads.js';
110
+ export type { RecordedEnv } from './config/env-reads.js';
111
+ export { defineCacheConfig, defineConfig, defineHttpConfig, defineMailConfig, defineOAuthConfig, defineQueueConfig, defineStorageConfig, } from './config/define.js';
112
+ export type { ConfigDefinition, ConfigDefinitions, HttpConfig, OAuthConfig } from './config/define.js';
102
113
  export type { InertiaI18nProps } from './providers/I18nServiceProvider.js';
103
114
  export { SqsDriver, createSqsAdapter } from './queue/drivers/SqsDriver.js';
104
115
  export { createTypedBroadcaster } from './broadcasting/typed.js';