@guren/server 2.22.0 → 2.23.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 (104) hide show
  1. package/dist/Job-BxioDEcS.js +165 -0
  2. package/dist/auth/AuthManager.d.ts +29 -0
  3. package/dist/auth/AuthenticatableModel.d.ts +15 -0
  4. package/dist/auth/RequestAuthContext.d.ts +10 -1
  5. package/dist/auth/SessionGuard.d.ts +2 -0
  6. package/dist/auth/api-token.d.ts +6 -0
  7. package/dist/auth/context.d.ts +32 -0
  8. package/dist/auth/index.d.ts +7 -0
  9. package/dist/auth/index.js +2 -2
  10. package/dist/auth/model-capability.d.ts +8 -0
  11. package/dist/auth/oauth/index.d.ts +5 -0
  12. package/dist/auth/password/DefaultHasher.d.ts +17 -6
  13. package/dist/auth/password/configured-hasher.d.ts +23 -0
  14. package/dist/auth/providers/ModelUserProvider.d.ts +3 -0
  15. package/dist/auth/providers/unconfigured-user-provider.d.ts +12 -0
  16. package/dist/auth/types.d.ts +9 -0
  17. package/dist/{auth-CjE2oO50.js → auth-D_W1cJp3.js} +279 -84
  18. package/dist/authorization/Gate.d.ts +12 -0
  19. package/dist/authorization/index.js +1 -1
  20. package/dist/{authorization-CdEWZZw3.js → authorization-0mCGUFoI.js} +58 -12
  21. package/dist/broadcasting/BroadcastManager.d.ts +10 -0
  22. package/dist/broadcasting/index.js +1 -1
  23. package/dist/{broadcasting-B5RzB0A2.js → broadcasting-BdJnaq1O.js} +17 -3
  24. package/dist/container/Container.d.ts +18 -1
  25. package/dist/container/bindings.d.ts +5 -0
  26. package/dist/container/index.d.ts +4 -2
  27. package/dist/container/resolve-optional.d.ts +10 -0
  28. package/dist/context-af2n5abO.js +91 -0
  29. package/dist/{Job-CvDwk2Gj.js → default-application-Chbrul_m.js} +126 -82
  30. package/dist/encryption/Encrypter.d.ts +10 -0
  31. package/dist/encryption/index.js +1 -1
  32. package/dist/{encryption-uwP3Di4D.js → encryption-BRjZnshr.js} +23 -5
  33. package/dist/errors/ExceptionHandler.d.ts +10 -0
  34. package/dist/events/Event.d.ts +18 -0
  35. package/dist/events/EventManager.d.ts +56 -4
  36. package/dist/events/index.d.ts +2 -1
  37. package/dist/events/index.js +2 -2
  38. package/dist/events/queued.d.ts +8 -0
  39. package/dist/events/serialize.d.ts +8 -0
  40. package/dist/events/types.d.ts +19 -2
  41. package/dist/events-C86rS63h.js +428 -0
  42. package/dist/health/checks/CacheCheck.d.ts +3 -5
  43. package/dist/health/checks/StorageCheck.d.ts +3 -5
  44. package/dist/health/index.js +1 -1
  45. package/dist/{health-DQSvUplL.js → health-CB0oS_UE.js} +2 -2
  46. package/dist/http/Application.d.ts +28 -0
  47. package/dist/http/default-application.d.ts +33 -0
  48. package/dist/http/middleware/detect-locale.d.ts +2 -1
  49. package/dist/http/request-container.d.ts +25 -0
  50. package/dist/i18n/I18nManager.d.ts +16 -3
  51. package/dist/i18n/index.d.ts +1 -1
  52. package/dist/i18n/index.js +2 -2
  53. package/dist/{i18n-BZ2VrSud.js → i18n-DRo1g0AN.js} +34 -10
  54. package/dist/index.d.ts +14 -9
  55. package/dist/index.js +179 -84
  56. package/dist/lambda/index.js +1 -1
  57. package/dist/logging/LogManager.d.ts +9 -0
  58. package/dist/logging/index.js +1 -1
  59. package/dist/{logging-Dmzdb6mL.js → logging-CXotojgW.js} +16 -3
  60. package/dist/mail/Mail.d.ts +14 -1
  61. package/dist/mail/MailManager.d.ts +10 -2
  62. package/dist/mail/index.js +1 -1
  63. package/dist/{mail-9CrvJyBZ.js → mail-CmxO2Ttx.js} +42 -11
  64. package/dist/mvc/Controller.d.ts +1 -1
  65. package/dist/mvc/Router.d.ts +16 -5
  66. package/dist/mvc/inertia/InertiaEngine.d.ts +18 -3
  67. package/dist/mvc/inertia/shared.d.ts +7 -0
  68. package/dist/notifications/NotificationManager.d.ts +15 -0
  69. package/dist/notifications/index.js +1 -1
  70. package/dist/{notifications-D0VXkFLF.js → notifications-CE3U7uyg.js} +24 -5
  71. package/dist/providers/AuthServiceProvider.d.ts +5 -4
  72. package/dist/providers/AuthorizationServiceProvider.d.ts +2 -2
  73. package/dist/providers/BroadcastServiceProvider.d.ts +4 -1
  74. package/dist/providers/EncryptionServiceProvider.d.ts +7 -1
  75. package/dist/providers/EventServiceProvider.d.ts +1 -0
  76. package/dist/providers/LogServiceProvider.d.ts +6 -1
  77. package/dist/providers/MailServiceProvider.d.ts +7 -1
  78. package/dist/providers/NotificationServiceProvider.d.ts +4 -1
  79. package/dist/queue/Job.d.ts +39 -0
  80. package/dist/queue/QueueManager.d.ts +14 -5
  81. package/dist/queue/Worker.d.ts +2 -1
  82. package/dist/queue/index.d.ts +1 -1
  83. package/dist/queue/index.js +3 -3
  84. package/dist/queue/types.d.ts +7 -0
  85. package/dist/{queue-zPPYZdif.js → queue-B3x_RKnB.js} +24 -10
  86. package/dist/redis/RedisSchedulerLock.d.ts +17 -0
  87. package/dist/redis/index.d.ts +2 -0
  88. package/dist/redis/index.js +21 -1
  89. package/dist/runtime/index.js +1 -1
  90. package/dist/scheduling/MemorySchedulerLock.d.ts +16 -0
  91. package/dist/scheduling/ScheduledTask.d.ts +19 -2
  92. package/dist/scheduling/Scheduler.d.ts +25 -0
  93. package/dist/scheduling/index.d.ts +2 -1
  94. package/dist/scheduling/index.js +2 -2
  95. package/dist/scheduling/types.d.ts +26 -2
  96. package/dist/{scheduling-C6tcOtUl.js → scheduling-DudNXGnh.js} +178 -20
  97. package/dist/storage/index.js +1 -1
  98. package/dist/{storage-D_yNe54O.js → storage-6HLaUf9j.js} +2 -13
  99. package/dist/support/deprecate.d.ts +16 -0
  100. package/dist/{vite-manifest-D295_7-_.js → vite-manifest-B8720V7w.js} +1 -1
  101. package/dist/warn-once-p-IlMjra.js +13 -0
  102. package/package.json +2 -2
  103. package/dist/context-CXk_umpT.js +0 -21
  104. package/dist/events-DOmAHDeP.js +0 -230
@@ -1,10 +1,8 @@
1
1
  import type { CheckResult } from '../types.js';
2
+ import type { CacheStore } from '../../cache/types.js';
2
3
  import { HealthCheck } from '../HealthCheck.js';
3
- export interface CacheStoreInterface {
4
- get<T>(key: string): Promise<T | null>;
5
- put<T>(key: string, value: T, ttl?: number): Promise<void>;
6
- forget(key: string): Promise<boolean>;
7
- }
4
+ /** The slice of `CacheStore` the check exercises; `cache.store()` satisfies it. */
5
+ export type CacheStoreInterface = Pick<CacheStore, 'get' | 'set' | 'delete'>;
8
6
  export interface CacheCheckOptions {
9
7
  /** @default 'cache' */
10
8
  name?: string;
@@ -1,10 +1,8 @@
1
1
  import type { CheckResult } from '../types.js';
2
+ import type { StorageDriver } from '../../storage/types.js';
2
3
  import { HealthCheck } from '../HealthCheck.js';
3
- export interface StorageDriverInterface {
4
- put(path: string, contents: string | Buffer): Promise<void>;
5
- get(path: string): Promise<Buffer | null>;
6
- delete(path: string): Promise<boolean>;
7
- }
4
+ /** The slice of `StorageDriver` the check exercises; `storage.disk()` satisfies it. */
5
+ export type StorageDriverInterface = Pick<StorageDriver, 'put' | 'get' | 'delete'>;
8
6
  export interface StorageCheckOptions {
9
7
  /** @default 'storage' */
10
8
  name?: string;
@@ -1,2 +1,2 @@
1
- import { a as CacheCheck, c as HealthManager, i as StorageCheck, l as createHealthManager, n as customCheck, o as RedisCheck, r as MemoryCheck, s as DatabaseCheck, t as CustomCheck, u as HealthCheck } from "../health-DQSvUplL.js";
1
+ import { a as CacheCheck, c as HealthManager, i as StorageCheck, l as createHealthManager, n as customCheck, o as RedisCheck, r as MemoryCheck, s as DatabaseCheck, t as CustomCheck, u as HealthCheck } from "../health-CB0oS_UE.js";
2
2
  export { CacheCheck, CustomCheck, DatabaseCheck, HealthCheck, HealthManager, MemoryCheck, RedisCheck, StorageCheck, createHealthManager, customCheck };
@@ -177,9 +177,9 @@ var CacheCheck = class extends HealthCheck {
177
177
  async check() {
178
178
  const testValue = `health_check_${Date.now()}`;
179
179
  try {
180
- await this.cache.put(this.testKey, testValue, 60);
180
+ await this.cache.set(this.testKey, testValue, 60);
181
181
  const retrieved = await this.cache.get(this.testKey);
182
- await this.cache.forget(this.testKey);
182
+ await this.cache.delete(this.testKey);
183
183
  if (retrieved === testValue) return this.healthy("Cache is functioning correctly");
184
184
  return this.degraded(`Cache read/write mismatch: expected "${testValue}", got "${retrieved}"`);
185
185
  } catch (error) {
@@ -5,6 +5,7 @@ import { type PrototypeFixtureLoader } from '../mvc/prototype.js';
5
5
  import { Container, type GurenModule } from '../container/index.js';
6
6
  import { type ServiceProviderConstructor } from '../container/ServiceProvider.js';
7
7
  import { AuthManager } from '../auth/AuthManager.js';
8
+ import type { PasswordHasherOption } from '../auth/password/configured-hasher.js';
8
9
  import type { CreateSessionMiddlewareOptions } from './middleware/session.js';
9
10
  import type { DetectLocaleOptions } from './middleware/detect-locale.js';
10
11
  import type { TranslationLoader } from '../i18n/index.js';
@@ -12,6 +13,7 @@ import { type SecurityHeadersOptions } from './middleware/security-headers.js';
12
13
  import { type HostAuthorizationOptions } from './middleware/host-authorization.js';
13
14
  import { type DevBannerOptions } from './dev-banner.js';
14
15
  import { startViteDevServer, type StartViteDevServerOptions } from './vite-dev-server.js';
16
+ import type { InertiaDocumentOptions, InertiaSsrRenderer } from '../mvc/inertia/InertiaEngine.js';
15
17
  type BunServer = {
16
18
  stop?: (closeConnections?: boolean) => void | Promise<void>;
17
19
  requestIP?: (request: Request) => {
@@ -74,6 +76,18 @@ export interface ApplicationOptions {
74
76
  * Loaded at boot only when such a route exists.
75
77
  */
76
78
  readonly prototype?: PrototypeFixtureLoader;
79
+ /**
80
+ * App-wide Inertia rendering defaults, bound as `inertia.document` and
81
+ * `inertia.ssrRenderer` on this app's container (RFC 0023 §1) and read by
82
+ * `Controller.inertia()` ahead of the process-wide setters.
83
+ */
84
+ readonly inertia?: InertiaApplicationOptions;
85
+ }
86
+ export interface InertiaApplicationOptions {
87
+ /** Document defaults for server-rendered responses; each per-response {@link InertiaOptions} field overrides its own. */
88
+ readonly document?: InertiaDocumentOptions;
89
+ /** Default SSR renderer, for a bundle that cannot resolve a runtime path; per-call `ssr.render` still wins. */
90
+ readonly ssrRenderer?: InertiaSsrRenderer;
77
91
  }
78
92
  export interface I18nPluginOptions {
79
93
  /** Detection only resolves to one of these; all are preloaded during `boot()`. */
@@ -94,6 +108,13 @@ export interface I18nPluginOptions {
94
108
  readonly share?: boolean;
95
109
  }
96
110
  export interface AuthPluginOptions {
111
+ /**
112
+ * The format new password hashes are written in. `'scrypt'` (the default)
113
+ * verifies on every runtime; `'argon2'` uses `Bun.password` and is for
114
+ * Bun-only deployments. Rows in the other format still verify and are
115
+ * rehashed on their next login. A `PasswordHasher` replaces both.
116
+ */
117
+ hasher?: PasswordHasherOption;
97
118
  autoSession?: boolean;
98
119
  sessionOptions?: CreateSessionMiddlewareOptions;
99
120
  /** Defaults to `true` when session is enabled. */
@@ -196,6 +217,13 @@ export declare class Application {
196
217
  */
197
218
  booted(): Promise<void>;
198
219
  private bootOnce;
220
+ /**
221
+ * After every provider has booted: `auth` was asked for, yet the default
222
+ * guard still runs against the placeholder provider, so a session login
223
+ * attempt would throw. Silent for an app that authenticates through tokens,
224
+ * or that mounts its own sessions, since neither reaches that guard.
225
+ */
226
+ private warnOnUnconfiguredAuth;
199
227
  /** Called once, from the constructor — see the note there for why. */
200
228
  private mountSecurityDefaults;
201
229
  private mountHostAuthorization;
@@ -0,0 +1,33 @@
1
+ import type { Application } from './Application.js';
2
+ import type { ServiceBindings } from '../container/bindings.js';
3
+ import { type Container } from '../container/Container.js';
4
+ /** @internal Application constructor only. Displacing a still-ambient app is what makes the choice ambiguous. */
5
+ export declare function adoptDefaultApplication(app: Application): void;
6
+ /** Opt-in override for a process that constructs several and wants the ambient one chosen, not last. */
7
+ export declare function useAsDefaultApplication(app: Application): void;
8
+ /** @internal Test seam: empties the ambient slot and the ambiguity flag. */
9
+ export declare function resetDefaultApplication(): void;
10
+ /**
11
+ * The most recently constructed Application; `null` before any exists, and
12
+ * `null` again once `setContainer()` handed the ambient slot a container that
13
+ * belongs to no Application.
14
+ */
15
+ export declare function defaultApplication(): Application | null;
16
+ /** The default application's container; throws the same "not initialized" error the getters throw. */
17
+ export declare function defaultContainer(): Container;
18
+ /** `defaultContainer()` for a caller with a fallback of its own: null instead of the throw. */
19
+ export declare function ambientContainer(): Container | null;
20
+ /**
21
+ * The binding the default application holds under `key`, or undefined when
22
+ * there is no default application or it binds nothing there. Every functional
23
+ * helper reads through this before its module slot (RFC 0023 §3).
24
+ */
25
+ export declare function ambientBinding<K extends keyof ServiceBindings>(key: K): ServiceBindings[K] | undefined;
26
+ /**
27
+ * @internal A deprecated setter's write (RFC 0023 §5): the ambient container
28
+ * when one exists, else nothing. Answers whether it landed, so the caller can
29
+ * drop its module slot rather than leave a copy that outlives the app.
30
+ */
31
+ export declare function bindAmbient<K extends keyof ServiceBindings>(key: K, value: ServiceBindings[K]): boolean;
32
+ /** Resolve `key` from the default application's container. */
33
+ export declare function resolve<T = unknown>(key: string): T;
@@ -31,7 +31,8 @@ export interface DetectLocaleOptions {
31
31
  cookieName?: string;
32
32
  /**
33
33
  * Manager backing the request-scoped `t`/`tc` helpers. Defaults to the
34
- * global one registered via `setI18n()`; `false` skips the binding.
34
+ * serving app's `i18n` binding, then the one `setI18n()` registered;
35
+ * `false` skips the binding.
35
36
  */
36
37
  i18n?: I18nManager | false;
37
38
  }
@@ -0,0 +1,25 @@
1
+ import type { Container } from '../container/Container.js';
2
+ /**
3
+ * Context variable the serving Application's container is stamped under
4
+ * (RFC 0023 §2). The stamp is the first middleware `Application` mounts, so
5
+ * nothing an app registers runs ahead of it. The one place a middleware
6
+ * reaches its app's container without holding the app.
7
+ */
8
+ export declare const CONTAINER_CONTEXT_KEY = "guren.container";
9
+ declare module 'hono' {
10
+ interface ContextVariableMap {
11
+ [CONTAINER_CONTEXT_KEY]: Container;
12
+ }
13
+ }
14
+ /** The narrowest surface every Hono `Context` and `ContextVariableMap`-typed context satisfies. */
15
+ export interface RequestContextLike {
16
+ get: (key: string) => unknown;
17
+ }
18
+ /**
19
+ * The container of the Application serving `ctx`, or undefined off an
20
+ * Application (bare Hono). Judged by shape rather than `instanceof`: a test
21
+ * double answering every key must not pass as a container.
22
+ */
23
+ export declare function tryGetRequestContainer(ctx: RequestContextLike): Container | undefined;
24
+ /** The container of the Application serving `ctx`; throws off an Application (bare Hono). */
25
+ export declare function getRequestContainer(ctx: RequestContextLike): Container;
@@ -36,12 +36,25 @@ export declare class I18nManager {
36
36
  }
37
37
  /** Create a new I18n manager. */
38
38
  export declare function createI18n(config: I18nConfig): I18nManager;
39
- /** Set the global I18n manager. */
39
+ /**
40
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Pass
41
+ * `createApp({ i18n })`, or bind it from a provider as
42
+ * `this.container.instance('i18n', manager)`.
43
+ */
40
44
  export declare function setI18n(i18n: I18nManager): void;
41
- /** Get the global I18n manager. */
45
+ /**
46
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use `this.t(key)` in a
47
+ * controller, `getRequestTranslator(ctx)` in middleware, or
48
+ * `defaultContainer().make('i18n')`. `t()` / `tc()` are unaffected.
49
+ */
42
50
  export declare function getI18n(): I18nManager;
43
- /** Get the global I18n manager, or `undefined` when none was registered. */
51
+ /**
52
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
53
+ * `container.makeOptional('i18n')` on the container that owns the call.
54
+ */
44
55
  export declare function tryGetI18n(): I18nManager | undefined;
56
+ /** @internal The default application's `i18n`, else the one `setI18n()` installed. */
57
+ export declare function resolveI18n(): I18nManager | undefined;
45
58
  /** Translate a key using the global I18n manager. */
46
59
  export declare function t(key: string, replacements?: ReplacementValues): string;
47
60
  /** Translate a key with count using the global I18n manager. */
@@ -1,6 +1,6 @@
1
1
  export type { TranslationMessages, ReplacementValues, GurenTranslationKeys, RegisteredTranslationKey, PluralizationRule, TranslationLoader, TranslatorOptions, I18nConfig, TranslationLoaderFactory, } from './types.js';
2
2
  export { pluralizationRules, getPluralizationRule, selectPluralForm, } from './pluralization.js';
3
3
  export { Translator } from './Translator.js';
4
- export { I18nManager, createI18n, setI18n, getI18n, tryGetI18n, t, tc, } from './I18nManager.js';
4
+ export { I18nManager, createI18n, setI18n, getI18n, tryGetI18n, resolveI18n, t, tc, } from './I18nManager.js';
5
5
  export { JsonLoader } from './loaders/JsonLoader.js';
6
6
  export { MemoryLoader } from './loaders/MemoryLoader.js';
@@ -1,2 +1,2 @@
1
- import { a as setI18n, c as tryGetI18n, d as getPluralizationRule, f as pluralizationRules, i as getI18n, l as JsonLoader, n as I18nManager, o as t, p as selectPluralForm, r as createI18n, s as tc, t as MemoryLoader, u as Translator } from "../i18n-BZ2VrSud.js";
2
- export { I18nManager, JsonLoader, MemoryLoader, Translator, createI18n, getI18n, getPluralizationRule, pluralizationRules, selectPluralForm, setI18n, t, tc, tryGetI18n };
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";
2
+ export { I18nManager, JsonLoader, MemoryLoader, Translator, createI18n, getI18n, getPluralizationRule, pluralizationRules, resolveI18n, selectPluralForm, setI18n, t, tc, tryGetI18n };
@@ -1,3 +1,4 @@
1
+ import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-Chbrul_m.js";
1
2
  import { basename, extname, join } from "node:path";
2
3
  import { readFile, readdir } from "node:fs/promises";
3
4
  //#region src/i18n/pluralization.ts
@@ -357,26 +358,49 @@ let globalI18n = null;
357
358
  function createI18n(config) {
358
359
  return new I18nManager(config);
359
360
  }
360
- /** Set the global I18n manager. */
361
+ /**
362
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Pass
363
+ * `createApp({ i18n })`, or bind it from a provider as
364
+ * `this.container.instance('i18n', manager)`.
365
+ */
361
366
  function setI18n(i18n) {
362
- globalI18n = i18n;
367
+ warnDeprecatedSetter("setI18n");
368
+ globalI18n = bindAmbient("i18n", i18n) ? null : i18n;
363
369
  }
364
- /** Get the global I18n manager. */
370
+ /**
371
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use `this.t(key)` in a
372
+ * controller, `getRequestTranslator(ctx)` in middleware, or
373
+ * `defaultContainer().make('i18n')`. `t()` / `tc()` are unaffected.
374
+ */
365
375
  function getI18n() {
366
- if (!globalI18n) throw new Error("I18n manager not initialized. Call setI18n() first.");
367
- return globalI18n;
376
+ warnDeprecatedGetter("getI18n");
377
+ return resolveI18nOrFail();
368
378
  }
369
- /** Get the global I18n manager, or `undefined` when none was registered. */
379
+ /**
380
+ * @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
381
+ * `container.makeOptional('i18n')` on the container that owns the call.
382
+ */
370
383
  function tryGetI18n() {
371
- return globalI18n ?? void 0;
384
+ warnDeprecatedGetter("tryGetI18n");
385
+ return resolveI18n();
386
+ }
387
+ /** @internal The default application's `i18n`, else the one `setI18n()` installed. */
388
+ function resolveI18n() {
389
+ return ambientBinding("i18n") ?? globalI18n ?? void 0;
390
+ }
391
+ /** @internal `resolveI18n()` with the message every unconfigured caller should read. */
392
+ function resolveI18nOrFail() {
393
+ const i18n = resolveI18n();
394
+ if (!i18n) throw new Error("I18n manager not initialized. Pass createApp({ i18n }), or call setI18n() first.");
395
+ return i18n;
372
396
  }
373
397
  /** Translate a key using the global I18n manager. */
374
398
  function t(key, replacements) {
375
- return getI18n().t(key, replacements);
399
+ return resolveI18nOrFail().t(key, replacements);
376
400
  }
377
401
  /** Translate a key with count using the global I18n manager. */
378
402
  function tc(key, count, replacements) {
379
- return getI18n().tc(key, count, replacements);
403
+ return resolveI18nOrFail().tc(key, count, replacements);
380
404
  }
381
405
  //#endregion
382
406
  //#region src/i18n/loaders/MemoryLoader.ts
@@ -420,4 +444,4 @@ var MemoryLoader = class {
420
444
  }
421
445
  };
422
446
  //#endregion
423
- export { setI18n as a, tryGetI18n as c, getPluralizationRule as d, pluralizationRules as f, getI18n as i, JsonLoader as l, I18nManager as n, t as o, selectPluralForm as p, createI18n as r, tc as s, MemoryLoader as t, Translator as u };
447
+ export { resolveI18n as a, tc as c, Translator as d, getPluralizationRule as f, getI18n as i, tryGetI18n as l, selectPluralForm as m, I18nManager as n, setI18n as o, pluralizationRules as p, createI18n as r, t as s, MemoryLoader as t, JsonLoader as u };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  export { Application, createApp } from './http/Application.js';
2
+ export { ambientBinding, ambientContainer, defaultApplication, defaultContainer, resetDefaultApplication, useAsDefaultApplication, } from './http/default-application.js';
3
+ export { CONTAINER_CONTEXT_KEY, getRequestContainer, tryGetRequestContainer } from './http/request-container.js';
4
+ export type { RequestContextLike } from './http/request-container.js';
2
5
  export type { Context, ApplicationListenOptions, ListenAddress, ServiceProviderConstructor, } from './http/Application.js';
3
6
  export { parseRequestPayload, formatValidationErrors } from './http/request.js';
4
7
  export { Controller } from './mvc/Controller.js';
@@ -43,16 +46,16 @@ export type { InertiaDocumentContext, InertiaDocumentOptions, InertiaOptions, In
43
46
  export type { SharedInertiaPropsResolver, InertiaSharedProps, ResolvedSharedInertiaProps, SharedPropsContainer, } from './mvc/inertia/shared.js';
44
47
  export { InertiaServiceProvider, AuthServiceProvider, OAuthServiceProvider, EventServiceProvider, CacheServiceProvider, QueueServiceProvider, MailServiceProvider, LogServiceProvider, I18nServiceProvider, NotificationServiceProvider, BroadcastServiceProvider, EncryptionServiceProvider, StorageServiceProvider, HealthServiceProvider, SchedulingServiceProvider, AuthorizationServiceProvider, ErrorServiceProvider, } from './providers/index.js';
45
48
  export { FormRequest } from './http/FormRequest.js';
46
- export { AuthManager, SessionGuard, TokenGuard, ModelUserProvider, BaseUserProvider, AuthenticatableModel, ScryptHasher, createPasswordResetToken, verifyPasswordResetToken, completePasswordReset, buildPasswordResetUrl, parsePasswordResetUrl, MemoryPasswordResetStore, createEmailVerificationToken, verifyEmailToken, completeEmailVerification, buildVerificationUrl, parseVerificationUrl, isEmailVerified, requireVerifiedEmail, MemoryEmailVerificationStore, createApiToken, parseApiToken, readBearerToken, verifyApiToken, tokenCan, tokenCanAll, tokenCanAny, revokeApiToken, revokeAllApiTokens, getUserApiTokens, createBearerTokenMiddleware, getApiToken, getApiTokenOrFail, MemoryApiTokenStore, API_TOKEN_KEY, OAuthManager, MemoryOAuthStateStore, createOAuthManager, createOAuthState, verifyOAuthState, sanitizeOAuthRedirect, OAUTH_SESSION_BINDING_KEY, buildOAuthAuthorizeUrl, exchangeOAuthCode, fetchOAuthUserProfile, createGitHubOAuthProviderConfig, createGoogleOAuthProviderConfig, createDiscordOAuthProviderConfig, buildOAuthRedirectUrl, parseOAuthRedirectUrl, } from './auth/index.js';
49
+ export { AuthManager, SessionGuard, TokenGuard, ModelUserProvider, BaseUserProvider, AuthenticatableModel, Argon2Hasher, ScryptHasher, createPasswordResetToken, verifyPasswordResetToken, completePasswordReset, buildPasswordResetUrl, parsePasswordResetUrl, MemoryPasswordResetStore, createEmailVerificationToken, verifyEmailToken, completeEmailVerification, buildVerificationUrl, parseVerificationUrl, isEmailVerified, requireVerifiedEmail, MemoryEmailVerificationStore, createApiToken, parseApiToken, readBearerToken, verifyApiToken, tokenCan, tokenCanAll, tokenCanAny, revokeApiToken, revokeAllApiTokens, getUserApiTokens, createBearerTokenMiddleware, getApiToken, getApiTokenOrFail, MemoryApiTokenStore, API_TOKEN_KEY, OAuthManager, MemoryOAuthStateStore, createOAuthManager, createOAuthState, verifyOAuthState, sanitizeOAuthRedirect, OAUTH_SESSION_BINDING_KEY, buildOAuthAuthorizeUrl, exchangeOAuthCode, fetchOAuthUserProfile, createGitHubOAuthProviderConfig, createGoogleOAuthProviderConfig, createDiscordOAuthProviderConfig, buildOAuthRedirectUrl, parseOAuthRedirectUrl, } from './auth/index.js';
47
50
  export type { AuthContext as AuthRuntimeContext, AuthCredentials, AuthManagerOptions, Authenticatable, Guard, GuardContext, GuardFactory, UserProvider, ProviderFactory, DefaultSanitizedKeys, Sanitized, PasswordResetConfig, PasswordResetTokenStore, PasswordResetTokenResult, EmailVerificationConfig, EmailVerificationTokenStore, EmailVerificationToken, EmailVerificationTokenResult, ApiToken, ApiTokenGuardOptions, ApiTokenStore, CreateApiTokenOptions, CreateApiTokenResult, BearerTokenMiddlewareOptions, VerifiedApiToken, TokenGuardOptions, OAuthProviderConfig, OAuthTokenResult, OAuthUserProfile, OAuthFallbackEmail, OAuthStatePayload, OAuthStateStore, OAuthStateConfig, OAuthAuthorizeOptions, OAuthCallbackPayload, OAuthManagerOptions, OAuthProviderFactoryInput, OAuthBindingSession, } from './auth/index.js';
48
51
  export { defineMiddleware, jsonResponse, createSessionMiddleware, MemorySessionStore, SessionManager, CookieSessionStore, DEFAULT_SESSION_STORE_NAME, BUILT_IN_SESSION_DRIVERS, PER_PROCESS_SESSION_DRIVERS, getSessionFromContext, requireAuthenticated, requireGuest, attachAuthContext, createCsrfMiddleware, getCsrfToken, csrfField, verifyCsrfToken, CSRF_TOKEN_KEY, CSRF_HEADER_NAME, CSRF_FORM_FIELD, validateRequest, validateRequestWith, getValidatedData, validate, validateSafe, VALIDATED_DATA_KEY, createRateLimitMiddleware, getRateLimitInfo, resetRateLimit, MemoryRateLimitStore, SlidingWindowRateLimitStore, createSecurityHeaders, createCspMiddleware, getCspNonce, CSP_NONCE_KEY, createHostAuthorizationMiddleware, createCorsMiddleware, createRedirectSafetyMiddleware, isSafeRedirectUrl, createForceHttpsMiddleware, requestIdMiddleware, requestLoggingMiddleware, detectLocaleMiddleware, LOCALE_CONTEXT_KEY, getRequestLocale, getRequestTranslator, } from './http/middleware/index.js';
49
52
  export { AUTH_CONTEXT_KEY } from './http/middleware/auth.js';
50
53
  export type { Middleware, Session, SessionData, SessionStore, SessionConfig, SessionDrivers, SessionStoreConfig, SessionDriverFactory, SessionCookieOptions, SessionInlineCodec, CookieSessionStoreOptions, CookieSessionDriverOptions, MemorySessionDriverOptions, RedisSessionDriverOptions, AuthContext, RequireAuthOptions, CsrfOptions, CookielessAuthEndpoints, ValidationSchema, ValidateRequestOptions, RateLimitOptions, RateLimitStore, RateLimitEntry, RateLimitInfo, SecurityHeadersOptions, HstsOptions, CspOptions, CspDirectives, HostAuthorizationOptions, CorsOptions, RedirectSafetyOptions, ForceHttpsOptions, DetectLocaleOptions, DetectLocaleVariables, TranslatorBinding, LocaleSource, } from './http/middleware/index.js';
51
54
  export { Validator, FieldValidator, createValidator, quickValidate, quickValidateOrThrow, required, nullable, requiredIf, requiredUnless, requiredWith, requiredWithout, string as stringRule, numeric, integer, boolean as booleanRule, array as arrayRule, object as objectRule, email as emailRule, url as urlRule, uuid as uuidRule, ip, ipv4, ipv6, json as jsonRule, alpha, alphaNum, alphaDash, regex, min, max, between, size, inValues, notIn, confirmed, same, different, date as dateRule, dateFormat, after, afterOrEqual, before, beforeOrEqual, startsWith, endsWith, file as fileRule, image as imageRule, mimes, maxFileSize, minFileSize, custom, unique, exists, } from './http/validation/index.js';
52
55
  export type { ValidationRule, RuleDefinition, ValidationResult, FileValidationOptions, ImageValidationOptions, ValidatorOptions, FileLike, } from './http/validation/index.js';
53
- export { Event, EventManager, createEventManager, Listener, RequestReceived, RequestFinished, UserAuthenticated, UserLoggedOut, JobProcessed, JobFailed, ApplicationStarted, ApplicationShutdown, } from './events/index.js';
54
- export type { EventClass, EventListener, ListenerOptions, RegisteredListener, EventSubscription, ListenerClass, } from './events/index.js';
55
- export { Job, Worker, QueueManager, MemoryDriver, SyncDriver, RedisDriver, MemoryDriver as MemoryQueueDriver, SyncDriver as SyncQueueDriver, RedisDriver as RedisQueueDriver, setQueueDriver, getQueueDriver, registerJob, getJob, getRegisteredJobs, clearJobRegistry, resolveJobName, createQueueManager, processJob, FailedJobReporter, } from './queue/index.js';
56
+ export { Event, EventManager, createEventManager, createQueueEventDispatcher, Listener, RequestReceived, RequestFinished, UserAuthenticated, UserLoggedOut, JobProcessed, JobFailed, ApplicationStarted, ApplicationShutdown, } from './events/index.js';
57
+ export type { EventClass, EventListener, ListenerOptions, QueueEventDispatcher, RegisteredListener, EventSubscription, ListenerClass, } from './events/index.js';
58
+ export { Job, Worker, QueueManager, MemoryDriver, SyncDriver, RedisDriver, MemoryDriver as MemoryQueueDriver, SyncDriver as SyncQueueDriver, RedisDriver as RedisQueueDriver, setQueueDriver, clearQueueDriver, getQueueDriver, resolveQueueDriver, registerJob, getJob, getRegisteredJobs, clearJobRegistry, resolveJobName, createQueueManager, processJob, FailedJobReporter, } from './queue/index.js';
56
59
  export type { QueuedJob, FailedJob, QueueDriver, JobOptions, WorkerOptions, JobHandler, JobFailureHandler, JobClass, WorkerEvents, QueueConfig, QueueDriverFactory, RedisDriverOptions, FailedJobInfo, FailedJobHandler, } from './queue/index.js';
57
60
  export { Mail, mail, MailManager, createMailManager, setMailManager, getMailManager, SmtpTransport, ResendTransport, MemoryTransport, LogTransport, } from './mail/index.js';
58
61
  export type { MailAddress, MailAttachment, MailMessage, SendResult, MailTransport, MailTransportFactory, MailTransportConfig, MailConfig, SmtpTransportOptions, ResendTransportOptions, MemoryTransportOptions, } from './mail/index.js';
@@ -60,8 +63,8 @@ export { CacheManager, MemoryStore as MemoryCacheStore, RedisStore as RedisCache
60
63
  export type { CacheStore, CacheConfig, CacheStoreFactory, } from './cache/index.js';
61
64
  export { StorageManager, LocalDriver as LocalStorageDriver, MemoryDriver as MemoryStorageDriver, S3Driver, createStorageManager, } from './storage/index.js';
62
65
  export type { StorageDriver, StorageConfig, DiskConfig, StorageDriverFactory, PutOptions, FileMetadata, TemporaryUrlOptions, GetStreamOptions, StorageDriverCapabilities, } from './storage/index.js';
63
- export { Scheduler, Schedule, PendingSchedule, ScheduledTask, parseCron, matchesCron, getNextOccurrence, getNextOccurrences, isDue, isDueInTimezone, toTimezone, createScheduler, } from './scheduling/index.js';
64
- export type { TaskCallback, TaskDefinition, SchedulerOptions, ParsedCron, JobClass as ScheduledJobClass, } from './scheduling/index.js';
66
+ export { Scheduler, Schedule, PendingSchedule, ScheduledTask, parseCron, matchesCron, getNextOccurrence, getNextOccurrences, isDue, isDueInTimezone, toTimezone, createScheduler, MemorySchedulerLock, } from './scheduling/index.js';
67
+ export type { TaskCallback, TaskDefinition, SchedulerOptions, SchedulerLock, ParsedCron, JobClass as ScheduledJobClass, } from './scheduling/index.js';
65
68
  export { Logger, filterSensitiveData, LogManager, ConsoleChannel, FileChannel, DailyFileChannel, dailyFileDateStamp, dailyFilePath, matchDailyFileDate, LOG_LEVEL_PRIORITY, createLogManager, setLogManager, getLogManager, } from './logging/index.js';
66
69
  export type { LogLevel, LogContext, LogEntry, LogChannel, LogChannelFactory, LogChannelConfig, ConsoleChannelConfig, FileChannelConfig, DailyFileChannelConfig, StackChannelConfig, LogConfig, LogFormatter, LoggerOptions, } from './logging/index.js';
67
70
  export { Translator, I18nManager, JsonLoader, MemoryLoader, pluralizationRules, getPluralizationRule, selectPluralForm, createI18n, setI18n, getI18n, tryGetI18n, t, tc, } from './i18n/index.js';
@@ -76,8 +79,8 @@ export { Notification, NotificationManager, createNotificationManager, setNotifi
76
79
  export type { NotificationConstructor, NotificationChannel, Notifiable, DatabaseNotification, NotificationMailMessage, NotificationAttachment, SlackMessage, SlackBlock, SlackAttachment, NotificationChannelFactory, NotificationManagerOptions, DatabaseChannelOptions, SentNotification, NotificationClass, MailChannelOptions, SlackChannelOptions, } from './notifications/index.js';
77
80
  export { BroadcastManager, createBroadcastManager, setBroadcastManager, getBroadcastManager, Channel, PrivateChannel, PresenceChannel, MemoryDriver as MemoryBroadcastDriver, RedisDriver as RedisBroadcastDriver, } from './broadcasting/index.js';
78
81
  export type { BroadcastEvent, BroadcastDriver, PresenceBroadcastDriver, ChannelAuthorizer, PresenceChannelAuthorizer, PresenceMember, SSEClient, WebSocketClient, BroadcastManagerOptions, BroadcastDriverFactory, ChannelRegistration, SSEMiddlewareOptions, AuthMiddlewareOptions, BroadcastableEvent, MemoryDriverOptions as BroadcastMemoryDriverOptions, RedisClient as BroadcastRedisClient, RedisDriverOptions as BroadcastRedisDriverOptions, } from './broadcasting/index.js';
79
- export { Container, createContainer, setContainer, getContainer, resolve, ServiceProvider, ProviderManager, definePlugin, defineModule, mountModuleRoutes, } from './container/index.js';
80
- export type { PluginDefinition, PluginFactory, ModuleDefinition, GurenModule, ServiceFactory, ServiceClass, ServiceBinding, ServiceBindings, ContextualBindingBuilder, ContextualNeedsBuilder, ContextualBinding, ServiceProviderOptions, Provider as ContainerProvider, ServiceProviderClass, } from './container/index.js';
82
+ export { Container, createContainer, resolveOptional, setContainer, getContainer, resolve, ServiceProvider, ProviderManager, definePlugin, defineModule, mountModuleRoutes, } from './container/index.js';
83
+ export type { ContainerLike, PluginDefinition, PluginFactory, ModuleDefinition, GurenModule, ServiceFactory, ServiceClass, ServiceBinding, ServiceBindings, ContextualBindingBuilder, ContextualNeedsBuilder, ContextualBinding, ServiceProviderOptions, Provider as ContainerProvider, ServiceProviderClass, } from './container/index.js';
81
84
  export { HttpException, ExceptionHandler, createExceptionHandler, setExceptionHandler, getExceptionHandler, abort, abortIf, abortUnless, ValidationException, AuthenticationException, AuthorizationException, NotFoundHttpException, MethodNotAllowedException, } from './errors/index.js';
82
85
  export type { ErrorResponse, ExceptionHandlerOptions, ExceptionReporter, ExceptionRenderer, ExceptionClass, RendererRegistration, } from './errors/index.js';
83
86
  export { Command, Input, Output, BufferedOutput, ConsoleKernel, createConsoleKernel, parseSignature, } from './console/index.js';
@@ -93,7 +96,9 @@ export { renderDebugPage, debugErrorMiddleware } from './errors/debug-page.js';
93
96
  export { renderErrorPage } from './errors/error-page.js';
94
97
  export { NodeHasher } from './auth/password/NodeHasher.js';
95
98
  export { DefaultHasher, DefaultHasher as Hash } from './auth/password/DefaultHasher.js';
96
- export type { ApplicationOptions, AuthPluginOptions, I18nPluginOptions } from './http/Application.js';
99
+ export type { PasswordHashAlgorithm, DefaultHasherOptions } from './auth/password/DefaultHasher.js';
100
+ export type { PasswordHasherOption } from './auth/password/configured-hasher.js';
101
+ export type { ApplicationOptions, AuthPluginOptions, I18nPluginOptions, InertiaApplicationOptions } from './http/Application.js';
97
102
  export type { InertiaI18nProps } from './providers/I18nServiceProvider.js';
98
103
  export { SqsDriver, createSqsAdapter } from './queue/drivers/SqsDriver.js';
99
104
  export { createTypedBroadcaster } from './broadcasting/typed.js';