@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.
- package/dist/Job-BxioDEcS.js +165 -0
- package/dist/auth/AuthManager.d.ts +29 -0
- package/dist/auth/AuthenticatableModel.d.ts +15 -0
- package/dist/auth/RequestAuthContext.d.ts +10 -1
- package/dist/auth/SessionGuard.d.ts +2 -0
- package/dist/auth/api-token.d.ts +6 -0
- package/dist/auth/context.d.ts +32 -0
- package/dist/auth/index.d.ts +7 -0
- package/dist/auth/index.js +2 -2
- package/dist/auth/model-capability.d.ts +8 -0
- package/dist/auth/oauth/index.d.ts +5 -0
- package/dist/auth/password/DefaultHasher.d.ts +17 -6
- package/dist/auth/password/configured-hasher.d.ts +23 -0
- package/dist/auth/providers/ModelUserProvider.d.ts +3 -0
- package/dist/auth/providers/unconfigured-user-provider.d.ts +12 -0
- package/dist/auth/types.d.ts +9 -0
- package/dist/{auth-CjE2oO50.js → auth-D_W1cJp3.js} +279 -84
- package/dist/authorization/Gate.d.ts +12 -0
- package/dist/authorization/index.js +1 -1
- package/dist/{authorization-CdEWZZw3.js → authorization-0mCGUFoI.js} +58 -12
- package/dist/broadcasting/BroadcastManager.d.ts +10 -0
- package/dist/broadcasting/index.js +1 -1
- package/dist/{broadcasting-B5RzB0A2.js → broadcasting-BdJnaq1O.js} +17 -3
- package/dist/container/Container.d.ts +18 -1
- package/dist/container/bindings.d.ts +5 -0
- package/dist/container/index.d.ts +4 -2
- package/dist/container/resolve-optional.d.ts +10 -0
- package/dist/context-af2n5abO.js +91 -0
- package/dist/{Job-CvDwk2Gj.js → default-application-Chbrul_m.js} +126 -82
- package/dist/encryption/Encrypter.d.ts +10 -0
- package/dist/encryption/index.js +1 -1
- package/dist/{encryption-uwP3Di4D.js → encryption-BRjZnshr.js} +23 -5
- package/dist/errors/ExceptionHandler.d.ts +10 -0
- package/dist/events/Event.d.ts +18 -0
- package/dist/events/EventManager.d.ts +56 -4
- package/dist/events/index.d.ts +2 -1
- package/dist/events/index.js +2 -2
- package/dist/events/queued.d.ts +8 -0
- package/dist/events/serialize.d.ts +8 -0
- package/dist/events/types.d.ts +19 -2
- package/dist/events-C86rS63h.js +428 -0
- package/dist/health/checks/CacheCheck.d.ts +3 -5
- package/dist/health/checks/StorageCheck.d.ts +3 -5
- package/dist/health/index.js +1 -1
- package/dist/{health-DQSvUplL.js → health-CB0oS_UE.js} +2 -2
- package/dist/http/Application.d.ts +28 -0
- package/dist/http/default-application.d.ts +33 -0
- package/dist/http/middleware/detect-locale.d.ts +2 -1
- package/dist/http/request-container.d.ts +25 -0
- package/dist/i18n/I18nManager.d.ts +16 -3
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js +2 -2
- package/dist/{i18n-BZ2VrSud.js → i18n-DRo1g0AN.js} +34 -10
- package/dist/index.d.ts +14 -9
- package/dist/index.js +179 -84
- package/dist/lambda/index.js +1 -1
- package/dist/logging/LogManager.d.ts +9 -0
- package/dist/logging/index.js +1 -1
- package/dist/{logging-Dmzdb6mL.js → logging-CXotojgW.js} +16 -3
- package/dist/mail/Mail.d.ts +14 -1
- package/dist/mail/MailManager.d.ts +10 -2
- package/dist/mail/index.js +1 -1
- package/dist/{mail-9CrvJyBZ.js → mail-CmxO2Ttx.js} +42 -11
- package/dist/mvc/Controller.d.ts +1 -1
- package/dist/mvc/Router.d.ts +16 -5
- package/dist/mvc/inertia/InertiaEngine.d.ts +18 -3
- package/dist/mvc/inertia/shared.d.ts +7 -0
- package/dist/notifications/NotificationManager.d.ts +15 -0
- package/dist/notifications/index.js +1 -1
- package/dist/{notifications-D0VXkFLF.js → notifications-CE3U7uyg.js} +24 -5
- package/dist/providers/AuthServiceProvider.d.ts +5 -4
- package/dist/providers/AuthorizationServiceProvider.d.ts +2 -2
- package/dist/providers/BroadcastServiceProvider.d.ts +4 -1
- package/dist/providers/EncryptionServiceProvider.d.ts +7 -1
- package/dist/providers/EventServiceProvider.d.ts +1 -0
- package/dist/providers/LogServiceProvider.d.ts +6 -1
- package/dist/providers/MailServiceProvider.d.ts +7 -1
- package/dist/providers/NotificationServiceProvider.d.ts +4 -1
- package/dist/queue/Job.d.ts +39 -0
- package/dist/queue/QueueManager.d.ts +14 -5
- package/dist/queue/Worker.d.ts +2 -1
- package/dist/queue/index.d.ts +1 -1
- package/dist/queue/index.js +3 -3
- package/dist/queue/types.d.ts +7 -0
- package/dist/{queue-zPPYZdif.js → queue-B3x_RKnB.js} +24 -10
- package/dist/redis/RedisSchedulerLock.d.ts +17 -0
- package/dist/redis/index.d.ts +2 -0
- package/dist/redis/index.js +21 -1
- package/dist/runtime/index.js +1 -1
- package/dist/scheduling/MemorySchedulerLock.d.ts +16 -0
- package/dist/scheduling/ScheduledTask.d.ts +19 -2
- package/dist/scheduling/Scheduler.d.ts +25 -0
- package/dist/scheduling/index.d.ts +2 -1
- package/dist/scheduling/index.js +2 -2
- package/dist/scheduling/types.d.ts +26 -2
- package/dist/{scheduling-C6tcOtUl.js → scheduling-DudNXGnh.js} +178 -20
- package/dist/storage/index.js +1 -1
- package/dist/{storage-D_yNe54O.js → storage-6HLaUf9j.js} +2 -13
- package/dist/support/deprecate.d.ts +16 -0
- package/dist/{vite-manifest-D295_7-_.js → vite-manifest-B8720V7w.js} +1 -1
- package/dist/warn-once-p-IlMjra.js +13 -0
- package/package.json +2 -2
- package/dist/context-CXk_umpT.js +0 -21
- package/dist/events-DOmAHDeP.js +0 -230
package/dist/mail/Mail.d.ts
CHANGED
|
@@ -34,9 +34,22 @@ export declare class Mail {
|
|
|
34
34
|
send(): Promise<SendResult>;
|
|
35
35
|
/** Queue the email for async sending. */
|
|
36
36
|
queue(queueName?: string): Promise<string>;
|
|
37
|
+
/**
|
|
38
|
+
* The `setQueueDriver()` pin, else the default driver of the `queue` manager
|
|
39
|
+
* bound beside this mail manager, else the default application's (RFC 0023 §4).
|
|
40
|
+
*/
|
|
41
|
+
private queueDriver;
|
|
37
42
|
}
|
|
38
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the manager on the
|
|
45
|
+
* app's container instead — `MailServiceProvider` already does, and a provider of
|
|
46
|
+
* your own reaches it as `this.container.instance('mail', manager)`.
|
|
47
|
+
*/
|
|
39
48
|
export declare function setMailManager(manager: MailManager): void;
|
|
49
|
+
/**
|
|
50
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use `this.make('mail')`
|
|
51
|
+
* in a controller, job or command, or `defaultContainer().makeOptional('mail')`.
|
|
52
|
+
*/
|
|
40
53
|
export declare function getMailManager(): MailManager | null;
|
|
41
54
|
/** Create a new mail builder. */
|
|
42
55
|
export declare function mail(manager: MailManager): Mail;
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import type { MailTransport, MailTransportFactory, MailConfig, MailAddress } from './types.js';
|
|
2
|
+
import type { ContainerLike } from '../container/types.js';
|
|
2
3
|
/** Mail manager for handling multiple transports. */
|
|
3
4
|
export declare class MailManager {
|
|
4
5
|
private readonly defaultTransportName;
|
|
5
6
|
private readonly defaultFrom?;
|
|
6
7
|
private readonly transportFactories;
|
|
7
8
|
private readonly resolvedTransports;
|
|
8
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The container this manager is bound in, when its provider passed one:
|
|
11
|
+
* `mail(manager).queue()` dispatches through that container's `queue`
|
|
12
|
+
* (RFC 0023 §4) rather than the default application's.
|
|
13
|
+
*/
|
|
14
|
+
readonly container?: ContainerLike;
|
|
15
|
+
constructor(config?: MailConfig, container?: ContainerLike);
|
|
9
16
|
private registerBuiltinDrivers;
|
|
10
17
|
private driverFactories;
|
|
11
18
|
private registerDriverFactory;
|
|
@@ -18,4 +25,5 @@ export declare class MailManager {
|
|
|
18
25
|
getDefaultFrom(): MailAddress | undefined;
|
|
19
26
|
getTransportNames(): string[];
|
|
20
27
|
}
|
|
21
|
-
|
|
28
|
+
/** `container` is the one the manager is bound in, so queued mail stays with that app. */
|
|
29
|
+
export declare function createMailManager(config?: MailConfig, container?: ContainerLike): MailManager;
|
package/dist/mail/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as MailManager, c as MemoryTransport, i as setMailManager, l as ResendTransport, n as getMailManager, o as createMailManager, r as mail, s as LogTransport, t as Mail, u as SmtpTransport } from "../mail-
|
|
1
|
+
import { a as MailManager, c as MemoryTransport, i as setMailManager, l as ResendTransport, n as getMailManager, o as createMailManager, r as mail, s as LogTransport, t as Mail, u as SmtpTransport } from "../mail-CmxO2Ttx.js";
|
|
2
2
|
export { LogTransport, Mail, MailManager, MemoryTransport, ResendTransport, SmtpTransport, createMailManager, getMailManager, mail, setMailManager };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { i as
|
|
1
|
+
import { c as pinnedQueueDriver, d as resolveQueueDriver, i as enqueueJob, l as registerJob, p as resolveOptional, t as Job } from "./Job-BxioDEcS.js";
|
|
2
|
+
import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-Chbrul_m.js";
|
|
2
3
|
import { t as parseMailAddress } from "./address-D0Iq-XIH.js";
|
|
3
4
|
import nodemailer from "nodemailer";
|
|
4
5
|
//#region src/mail/transports/SmtpTransport.ts
|
|
@@ -227,7 +228,14 @@ var MailManager = class {
|
|
|
227
228
|
defaultFrom;
|
|
228
229
|
transportFactories = /* @__PURE__ */ new Map();
|
|
229
230
|
resolvedTransports = /* @__PURE__ */ new Map();
|
|
230
|
-
|
|
231
|
+
/**
|
|
232
|
+
* The container this manager is bound in, when its provider passed one:
|
|
233
|
+
* `mail(manager).queue()` dispatches through that container's `queue`
|
|
234
|
+
* (RFC 0023 §4) rather than the default application's.
|
|
235
|
+
*/
|
|
236
|
+
container;
|
|
237
|
+
constructor(config = {}, container) {
|
|
238
|
+
this.container = container;
|
|
231
239
|
this.defaultTransportName = config.default ?? "smtp";
|
|
232
240
|
this.defaultFrom = config.from;
|
|
233
241
|
this.registerBuiltinDrivers();
|
|
@@ -285,8 +293,9 @@ var MailManager = class {
|
|
|
285
293
|
return Array.from(this.transportFactories.keys());
|
|
286
294
|
}
|
|
287
295
|
};
|
|
288
|
-
|
|
289
|
-
|
|
296
|
+
/** `container` is the one the manager is bound in, so queued mail stays with that app. */
|
|
297
|
+
function createMailManager(config, container) {
|
|
298
|
+
return new MailManager(config, container);
|
|
290
299
|
}
|
|
291
300
|
//#endregion
|
|
292
301
|
//#region src/mail/Mail.ts
|
|
@@ -404,22 +413,44 @@ var Mail = class {
|
|
|
404
413
|
}
|
|
405
414
|
/** Queue the email for async sending. */
|
|
406
415
|
async queue(queueName = "default") {
|
|
407
|
-
|
|
416
|
+
const driver = this.queueDriver();
|
|
417
|
+
if (!driver) throw new Error("Queue driver not configured. Use send() instead or configure a queue driver.");
|
|
408
418
|
const message = this.buildMessage();
|
|
409
419
|
registerJob(SendMailJob);
|
|
410
|
-
return SendMailJob
|
|
420
|
+
return enqueueJob(driver, SendMailJob, {
|
|
411
421
|
message,
|
|
412
422
|
transport: this.transportName ?? this.manager.getDefaultTransportName()
|
|
413
423
|
}, { queue: queueName });
|
|
414
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* The `setQueueDriver()` pin, else the default driver of the `queue` manager
|
|
427
|
+
* bound beside this mail manager, else the default application's (RFC 0023 §4).
|
|
428
|
+
*/
|
|
429
|
+
queueDriver() {
|
|
430
|
+
const pinned = pinnedQueueDriver();
|
|
431
|
+
if (pinned) return pinned;
|
|
432
|
+
const bound = resolveOptional(this.manager.container, "queue");
|
|
433
|
+
if (bound?.hasDriver(bound.getDefaultDriverName())) return bound.driver();
|
|
434
|
+
return resolveQueueDriver();
|
|
435
|
+
}
|
|
415
436
|
};
|
|
416
437
|
let globalMailManager = null;
|
|
417
|
-
/**
|
|
438
|
+
/**
|
|
439
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the manager on the
|
|
440
|
+
* app's container instead — `MailServiceProvider` already does, and a provider of
|
|
441
|
+
* your own reaches it as `this.container.instance('mail', manager)`.
|
|
442
|
+
*/
|
|
418
443
|
function setMailManager(manager) {
|
|
419
|
-
|
|
444
|
+
warnDeprecatedSetter("setMailManager");
|
|
445
|
+
globalMailManager = bindAmbient("mail", manager) ? null : manager;
|
|
420
446
|
}
|
|
447
|
+
/**
|
|
448
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use `this.make('mail')`
|
|
449
|
+
* in a controller, job or command, or `defaultContainer().makeOptional('mail')`.
|
|
450
|
+
*/
|
|
421
451
|
function getMailManager() {
|
|
422
|
-
|
|
452
|
+
warnDeprecatedGetter("getMailManager");
|
|
453
|
+
return ambientBinding("mail") ?? globalMailManager;
|
|
423
454
|
}
|
|
424
455
|
var SendMailJob = class extends Job {
|
|
425
456
|
static jobName = "SendMailJob";
|
|
@@ -427,8 +458,8 @@ var SendMailJob = class extends Job {
|
|
|
427
458
|
static maxAttempts = 3;
|
|
428
459
|
static backoff = "exponential";
|
|
429
460
|
async handle(payload) {
|
|
430
|
-
const manager = globalMailManager;
|
|
431
|
-
if (!manager) throw new Error("Mail manager not configured for queue jobs.
|
|
461
|
+
const manager = this.makeOptional("mail") ?? globalMailManager;
|
|
462
|
+
if (!manager) throw new Error("Mail manager not configured for queue jobs. Bind a MailManager as \"mail\", or call setMailManager() first.");
|
|
432
463
|
const result = await manager.transport(payload.transport).send(payload.message);
|
|
433
464
|
if (!result.success) throw new Error(result.error ?? "Failed to send email");
|
|
434
465
|
}
|
package/dist/mvc/Controller.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export interface RedirectOptions {
|
|
|
69
69
|
status?: number;
|
|
70
70
|
headers?: HeadersInit;
|
|
71
71
|
}
|
|
72
|
-
type InertiaResponseOptions = Omit<InertiaOptions, 'url' | 'request'> & {
|
|
72
|
+
type InertiaResponseOptions = Omit<InertiaOptions, 'url' | 'request' | 'container'> & {
|
|
73
73
|
url?: string;
|
|
74
74
|
};
|
|
75
75
|
type InertiaPageComponent<TPage extends InertiaPageContractLike> = TPage['id'];
|
package/dist/mvc/Router.d.ts
CHANGED
|
@@ -167,8 +167,14 @@ export interface RouteDefinition {
|
|
|
167
167
|
operationId?: string;
|
|
168
168
|
deprecated?: boolean;
|
|
169
169
|
}
|
|
170
|
-
/**
|
|
171
|
-
|
|
170
|
+
/**
|
|
171
|
+
* Chainable builder for configuring a registered route.
|
|
172
|
+
*
|
|
173
|
+
* `in M`: `M`'s only independent occurrence is a method parameter (the
|
|
174
|
+
* `RouteBuilder<M>` returns restate it), compared bivariantly. Without the
|
|
175
|
+
* annotation a `Router<never>` passes as a `Router<'auth'>`, failing at `mount()`.
|
|
176
|
+
*/
|
|
177
|
+
export interface RouteBuilder<in M extends string = never> {
|
|
172
178
|
name(routeName: string): RouteBuilder<M>;
|
|
173
179
|
/** Attach middleware to this specific route. See {@link RouteMiddlewareInput}. */
|
|
174
180
|
middleware(...items: RouteMiddlewareInput<M>[]): RouteBuilder<M>;
|
|
@@ -203,8 +209,13 @@ export interface ResourceRouteOptions {
|
|
|
203
209
|
*/
|
|
204
210
|
agent?: Partial<Record<ResourceAction, AgentRouteMetadata>>;
|
|
205
211
|
}
|
|
206
|
-
/**
|
|
207
|
-
|
|
212
|
+
/**
|
|
213
|
+
* Instance-based router for app-local route registration and mounting.
|
|
214
|
+
*
|
|
215
|
+
* `in M` is an explicit pin, not the source of the contravariance: the
|
|
216
|
+
* `RouteBuilder<M>` return positions already force it (measured).
|
|
217
|
+
*/
|
|
218
|
+
export declare class Router<in M extends string = never> {
|
|
208
219
|
private readonly registry;
|
|
209
220
|
private readonly prefixStack;
|
|
210
221
|
private readonly namedRoutes;
|
|
@@ -269,7 +280,7 @@ export declare class Router<M extends string = never> {
|
|
|
269
280
|
private aggregateCapabilities;
|
|
270
281
|
private resolveMiddlewareNames;
|
|
271
282
|
}
|
|
272
|
-
declare class RouterMiddlewareGroupBuilder<M extends string = never> {
|
|
283
|
+
declare class RouterMiddlewareGroupBuilder<in M extends string = never> {
|
|
273
284
|
private readonly router;
|
|
274
285
|
private readonly items;
|
|
275
286
|
constructor(router: Router<M>, items: readonly MiddlewareScopeEntry[]);
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
import type { ContainerLike } from "../../container/types.js";
|
|
1
2
|
/**
|
|
2
3
|
* Per-response form of {@link InertiaDocumentOptions}, already resolved to
|
|
3
|
-
* strings. Each field overrides the app-wide
|
|
4
|
+
* strings. Each field overrides the app-wide
|
|
5
|
+
* `createApp({ inertia: { document } })` default.
|
|
4
6
|
*/
|
|
5
7
|
type InertiaDocumentOverrides = {
|
|
6
8
|
readonly [K in keyof InertiaDocumentOptions]?: string;
|
|
7
9
|
};
|
|
8
10
|
export interface InertiaOptions extends InertiaDocumentOverrides {
|
|
11
|
+
/**
|
|
12
|
+
* Where `inertia.document` and `inertia.ssrRenderer` are read from
|
|
13
|
+
* (`createApp({ inertia })`, RFC 0023 §1); `Controller.inertia()` passes its
|
|
14
|
+
* app's. The process-wide setters are the fallback.
|
|
15
|
+
*/
|
|
16
|
+
container?: ContainerLike;
|
|
9
17
|
readonly url?: string;
|
|
10
18
|
readonly version?: string;
|
|
11
19
|
readonly status?: number;
|
|
@@ -72,11 +80,14 @@ export interface InertiaDocumentOptions {
|
|
|
72
80
|
readonly head?: InertiaDocumentValue;
|
|
73
81
|
}
|
|
74
82
|
/**
|
|
75
|
-
* Register app-wide document defaults for server-rendered Inertia responses
|
|
76
|
-
* call it at module scope in the app entry so every runtime picks it up.
|
|
83
|
+
* Register app-wide document defaults for server-rendered Inertia responses.
|
|
77
84
|
* Process-wide, not request-scoped: calling it mid-flight leaks the policy into
|
|
78
85
|
* in-flight requests — use the {@link InertiaOptions} fields per response.
|
|
79
86
|
* Values are emitted verbatim, so never pass user input. `undefined` clears.
|
|
87
|
+
*
|
|
88
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Pass
|
|
89
|
+
* `createApp({ inertia: { document } })`, which binds it on the app rather than
|
|
90
|
+
* the process. The slot stays the engine's second read.
|
|
80
91
|
*/
|
|
81
92
|
export declare function setInertiaDocument(options: InertiaDocumentOptions | undefined): void;
|
|
82
93
|
/**
|
|
@@ -84,6 +95,10 @@ export declare function setInertiaDocument(options: InertiaDocumentOptions | und
|
|
|
84
95
|
* cannot resolve a runtime path (Workers has no filesystem for
|
|
85
96
|
* `GUREN_INERTIA_SSR_ENTRY`'s dynamic import). Per-call `ssr.render` still
|
|
86
97
|
* wins; `undefined` clears (test isolation).
|
|
98
|
+
*
|
|
99
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Pass
|
|
100
|
+
* `createApp({ inertia: { ssrRenderer } })`, or bind `inertia.ssrRenderer` on
|
|
101
|
+
* the app when the renderer only exists after `createApp()` has run.
|
|
87
102
|
*/
|
|
88
103
|
export declare function setInertiaSsrRenderer(renderer: InertiaSsrRenderer | undefined): void;
|
|
89
104
|
export declare function inertia(component: string, props: Record<string, unknown>, options?: InertiaOptions): Promise<Response>;
|
|
@@ -54,12 +54,19 @@ export declare function ensureSharedInertiaPropsRegistry(container: SharedPropsC
|
|
|
54
54
|
/**
|
|
55
55
|
* Replace the module-global shared props resolver. Props registered on an
|
|
56
56
|
* application's container (see {@link shareInertiaProps}) are unaffected.
|
|
57
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
|
|
58
|
+
* `shareInertiaProps(fn, container)`, which scopes the registration to one app.
|
|
59
|
+
* It composes rather than replaces, so a wholesale reset becomes one
|
|
60
|
+
* registration on a fresh container.
|
|
57
61
|
*/
|
|
58
62
|
export declare function setInertiaSharedProps<Props extends Record<string, unknown> = ResolvedSharedInertiaProps>(resolverFn: SharedInertiaPropsResolver<Props> | null): void;
|
|
59
63
|
/**
|
|
60
64
|
* The module-global registrations composed into one resolver, for manual
|
|
61
65
|
* composition. Container-scoped props are not included — get those from
|
|
62
66
|
* `ensureSharedInertiaPropsRegistry(container).get()`.
|
|
67
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
|
|
68
|
+
* `ensureSharedInertiaPropsRegistry(container).get()` on the container that owns
|
|
69
|
+
* the call.
|
|
63
70
|
*/
|
|
64
71
|
export declare function getInertiaSharedPropsResolver(): SharedInertiaPropsResolver<ResolvedSharedInertiaProps> | null;
|
|
65
72
|
/**
|
|
@@ -61,6 +61,11 @@ declare class SendNotificationJob extends Job<SendNotificationPayload> {
|
|
|
61
61
|
static jobName: string;
|
|
62
62
|
static queue: string;
|
|
63
63
|
static maxAttempts: number;
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). The job resolves
|
|
66
|
+
* `notifications` from the worker's container; `registerQueueJob()` writes
|
|
67
|
+
* this only so a worker booted without one keeps working.
|
|
68
|
+
*/
|
|
64
69
|
static notificationManager: NotificationManager | null;
|
|
65
70
|
handle(payload: SendNotificationPayload): Promise<void>;
|
|
66
71
|
protected rebuildNotifiable(serialized: SerializedNotifiable): Notifiable;
|
|
@@ -71,7 +76,17 @@ declare class SendNotificationJob extends Job<SendNotificationPayload> {
|
|
|
71
76
|
*/
|
|
72
77
|
protected rebuildNotification(type: string, serialized: SerializedNotification): Notification;
|
|
73
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the manager on the
|
|
81
|
+
* app's container instead — `NotificationServiceProvider` already does, and a
|
|
82
|
+
* provider of your own reaches it as `this.container.instance('notifications', m)`.
|
|
83
|
+
*/
|
|
74
84
|
export declare function setNotificationManager(manager: NotificationManager): void;
|
|
85
|
+
/**
|
|
86
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
|
|
87
|
+
* `this.make('notifications')` in a controller, job or command, or
|
|
88
|
+
* `defaultContainer().make('notifications')`.
|
|
89
|
+
*/
|
|
75
90
|
export declare function getNotificationManager(): NotificationManager;
|
|
76
91
|
export declare function createNotificationManager(options?: NotificationManagerOptions): NotificationManager;
|
|
77
92
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as NotificationManager, c as setNotificationManager, d as getNotification, f as registerNotification, i as MailChannel, l as resolveNotifiableType, n as SlackChannel, o as createNotificationManager, p as Notification, r as DatabaseChannel, s as getNotificationManager, t as MemoryChannel, u as clearNotificationRegistry } from "../notifications-
|
|
1
|
+
import { a as NotificationManager, c as setNotificationManager, d as getNotification, f as registerNotification, i as MailChannel, l as resolveNotifiableType, n as SlackChannel, o as createNotificationManager, p as Notification, r as DatabaseChannel, s as getNotificationManager, t as MemoryChannel, u as clearNotificationRegistry } from "../notifications-CE3U7uyg.js";
|
|
2
2
|
export { DatabaseChannel, MailChannel, MemoryChannel, Notification, NotificationManager, SlackChannel, clearNotificationRegistry, createNotificationManager, getNotification, getNotificationManager, registerNotification, resolveNotifiableType, setNotificationManager };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { l as registerJob, t as Job } from "./Job-BxioDEcS.js";
|
|
2
|
+
import { h as warnDeprecatedSetter, i as bindAmbient, m as warnDeprecatedGetter, n as ambientBinding } from "./default-application-Chbrul_m.js";
|
|
2
3
|
import { t as parseMailAddress } from "./address-D0Iq-XIH.js";
|
|
3
4
|
//#region src/notifications/Notification.ts
|
|
4
5
|
/**
|
|
@@ -196,9 +197,14 @@ var SendNotificationJob = class extends Job {
|
|
|
196
197
|
static jobName = "SendNotificationJob";
|
|
197
198
|
static queue = "notifications";
|
|
198
199
|
static maxAttempts = 3;
|
|
200
|
+
/**
|
|
201
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). The job resolves
|
|
202
|
+
* `notifications` from the worker's container; `registerQueueJob()` writes
|
|
203
|
+
* this only so a worker booted without one keeps working.
|
|
204
|
+
*/
|
|
199
205
|
static notificationManager = null;
|
|
200
206
|
async handle(payload) {
|
|
201
|
-
const manager = this.constructor.notificationManager;
|
|
207
|
+
const manager = this.makeOptional("notifications") ?? this.constructor.notificationManager;
|
|
202
208
|
if (!manager) throw new Error("NotificationManager not set on SendNotificationJob");
|
|
203
209
|
const notifiable = this.rebuildNotifiable(payload.notifiableData);
|
|
204
210
|
const notification = this.rebuildNotification(payload.notificationType, payload.notificationData);
|
|
@@ -236,12 +242,25 @@ var SendNotificationJob = class extends Job {
|
|
|
236
242
|
}
|
|
237
243
|
};
|
|
238
244
|
let globalNotificationManager = null;
|
|
245
|
+
/**
|
|
246
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the manager on the
|
|
247
|
+
* app's container instead — `NotificationServiceProvider` already does, and a
|
|
248
|
+
* provider of your own reaches it as `this.container.instance('notifications', m)`.
|
|
249
|
+
*/
|
|
239
250
|
function setNotificationManager(manager) {
|
|
240
|
-
|
|
251
|
+
warnDeprecatedSetter("setNotificationManager");
|
|
252
|
+
globalNotificationManager = bindAmbient("notifications", manager) ? null : manager;
|
|
241
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
|
|
256
|
+
* `this.make('notifications')` in a controller, job or command, or
|
|
257
|
+
* `defaultContainer().make('notifications')`.
|
|
258
|
+
*/
|
|
242
259
|
function getNotificationManager() {
|
|
243
|
-
|
|
244
|
-
|
|
260
|
+
warnDeprecatedGetter("getNotificationManager");
|
|
261
|
+
const manager = ambientBinding("notifications") ?? globalNotificationManager;
|
|
262
|
+
if (!manager) throw new Error("NotificationManager not initialized. Register NotificationServiceProvider, or call setNotificationManager() first.");
|
|
263
|
+
return manager;
|
|
245
264
|
}
|
|
246
265
|
function createNotificationManager(options) {
|
|
247
266
|
return new NotificationManager(options);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ServiceProvider } from '../container/ServiceProvider.js';
|
|
2
2
|
/**
|
|
3
|
-
* Sets up
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
3
|
+
* Sets up session middleware, CSRF, and the auth context. The default guard is
|
|
4
|
+
* the `Application` constructor's, registered before this provider. The session
|
|
5
|
+
* store may come from a `session` container binding (RFC 0020 §1), which an
|
|
6
|
+
* app's SessionProvider must make in `register()`: the middleware is built in
|
|
7
|
+
* `boot()`, before any user provider's own boot runs.
|
|
7
8
|
*/
|
|
8
9
|
export declare class AuthServiceProvider extends ServiceProvider {
|
|
9
10
|
private app;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ServiceProvider } from '../container/ServiceProvider.js';
|
|
2
2
|
/**
|
|
3
|
-
* Binds the Gate as a singleton
|
|
4
|
-
* `
|
|
3
|
+
* Binds the Gate as a singleton. Controllers, the authorization middleware and
|
|
4
|
+
* `getGate()` resolve it from there (RFC 0023 §4), so no global is written.
|
|
5
5
|
*/
|
|
6
6
|
export declare class AuthorizationServiceProvider extends ServiceProvider {
|
|
7
7
|
register(): void;
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ServiceProvider } from '../container/ServiceProvider.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Binds the BroadcastManager as a singleton in the container;
|
|
4
|
+
* `getBroadcastManager()` resolves it from the default application (RFC 0023 §4).
|
|
5
|
+
*/
|
|
3
6
|
export declare class BroadcastServiceProvider extends ServiceProvider {
|
|
4
7
|
register(): void;
|
|
5
8
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ServiceProvider } from '../container/ServiceProvider.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Binds the Encrypter as a singleton. `encrypt()` / `decrypt()` /
|
|
4
|
+
* `getEncrypter()` resolve it from the default application's container
|
|
5
|
+
* (RFC 0023 §4), so no global is written. The keyring is read lazily, so a
|
|
6
|
+
* provider registering later can still replace `app.keyring` before the
|
|
7
|
+
* encrypter is built.
|
|
8
|
+
*/
|
|
3
9
|
export declare class EncryptionServiceProvider extends ServiceProvider {
|
|
4
10
|
register(): void;
|
|
5
11
|
}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ServiceProvider } from '../container/ServiceProvider.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Binds the LogManager as a singleton in the container. The default channel is
|
|
4
|
+
* declared, not merely named: `LogManager` resolves channels from `channels`
|
|
5
|
+
* alone, so a `default` with no matching entry throws on the first write.
|
|
6
|
+
* `getLogManager()` resolves it from the default application (RFC 0023 §4).
|
|
7
|
+
*/
|
|
3
8
|
export declare class LogServiceProvider extends ServiceProvider {
|
|
4
9
|
register(): void;
|
|
5
10
|
}
|
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
import { ServiceProvider } from '../container/ServiceProvider.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Binds the MailManager as a singleton in the container, on the `log`
|
|
4
|
+
* transport: an app that never configured mail gets every message in the
|
|
5
|
+
* server output rather than "Mail transport not found: smtp" on the first
|
|
6
|
+
* send. The scaffolded `MailProvider` rebinds `mail` with the app's own
|
|
7
|
+
* config, so this default only reaches apps that never ran `guren add mail`.
|
|
8
|
+
*/
|
|
3
9
|
export declare class MailServiceProvider extends ServiceProvider {
|
|
4
10
|
register(): void;
|
|
5
11
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ServiceProvider } from '../container/ServiceProvider.js';
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Binds the NotificationManager as a singleton in the container;
|
|
4
|
+
* `getNotificationManager()` resolves it from the default application (RFC 0023 §4).
|
|
5
|
+
*/
|
|
3
6
|
export declare class NotificationServiceProvider extends ServiceProvider {
|
|
4
7
|
register(): void;
|
|
5
8
|
boot(): void;
|
package/dist/queue/Job.d.ts
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
1
|
import type { QueueDriver, JobOptions } from './types.js';
|
|
2
2
|
import type { ServiceBindings } from '../container/bindings.js';
|
|
3
|
+
import type { ContainerLike } from '../container/types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Pins the driver `Job.dispatch()` sends through, ahead of the container's
|
|
6
|
+
* `queue` manager. An explicit override rather than a fallback: `@guren/testing`'s
|
|
7
|
+
* `fakeQueue()` and the tutorial's queue test inject through it (RFC 0023 §3).
|
|
8
|
+
* The pin survives its deprecation window because nothing else expresses it; it
|
|
9
|
+
* goes with this setter in Part 3.
|
|
10
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the manager on the
|
|
11
|
+
* app's container — `QueueServiceProvider` already does — and inject a fake with
|
|
12
|
+
* `app.container.fake('queue', manager)`.
|
|
13
|
+
*/
|
|
3
14
|
export declare function setQueueDriver(driver: QueueDriver): void;
|
|
15
|
+
/** Drops the pin, so `getQueueDriver()` falls back to the container again. */
|
|
16
|
+
export declare function clearQueueDriver(): void;
|
|
17
|
+
/** @internal The driver `setQueueDriver()` pinned, for a dispatcher with a container of its own to honour first. */
|
|
18
|
+
export declare function pinnedQueueDriver(): QueueDriver | null;
|
|
19
|
+
/**
|
|
20
|
+
* The driver `Job.dispatch()` sends through: the pin when set, else the default
|
|
21
|
+
* driver of the `queue` manager the default application binds, else null.
|
|
22
|
+
* Total by contract — every caller treats it as `QueueDriver | null`, so a
|
|
23
|
+
* manager bound with no factory for its default must read as absent rather
|
|
24
|
+
* than throw.
|
|
25
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Resolve the manager
|
|
26
|
+
* from the container that owns the call — `this.make('queue')` in a controller,
|
|
27
|
+
* job or command — and take `manager.driver()`.
|
|
28
|
+
*/
|
|
4
29
|
export declare function getQueueDriver(): QueueDriver | null;
|
|
30
|
+
/** @internal `getQueueDriver()` without the warning, for the framework's own dispatch paths. */
|
|
31
|
+
export declare function resolveQueueDriver(): QueueDriver | null;
|
|
32
|
+
/**
|
|
33
|
+
* The one enqueue behind `Job.dispatch()` and `QueueManager.dispatch()`, so the
|
|
34
|
+
* two forms cannot write different messages.
|
|
35
|
+
*/
|
|
36
|
+
export declare function enqueueJob<T>(driver: QueueDriver, JobClass: JobClass<T>, payload: T, options?: JobOptions): Promise<string>;
|
|
5
37
|
export declare abstract class Job<T = unknown> {
|
|
6
38
|
/**
|
|
7
39
|
* Stable wire name: queued messages record it and the worker resolves the
|
|
@@ -20,8 +52,15 @@ export declare abstract class Job<T = unknown> {
|
|
|
20
52
|
* @default 'exponential'
|
|
21
53
|
*/
|
|
22
54
|
static backoff: 'exponential' | 'linear' | number;
|
|
55
|
+
private container?;
|
|
56
|
+
/** @internal Called by the Worker with the container of the app it drains, before `handle()`. */
|
|
57
|
+
setContainer(container: ContainerLike): void;
|
|
58
|
+
/** Resolves from the worker's container, else from the default application. */
|
|
23
59
|
protected make<K extends keyof ServiceBindings>(key: K): ServiceBindings[K];
|
|
24
60
|
protected make<TService>(key: string): TService;
|
|
61
|
+
/** `make()` for a binding that may be absent: undefined when neither container holds it. */
|
|
62
|
+
protected makeOptional<K extends keyof ServiceBindings>(key: K): ServiceBindings[K] | undefined;
|
|
63
|
+
protected makeOptional<TService>(key: string): TService | undefined;
|
|
25
64
|
abstract handle(payload: T): void | Promise<void>;
|
|
26
65
|
/** Called once retries are exhausted. */
|
|
27
66
|
failed?(payload: T, error: Error): void | Promise<void>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { QueueDriver } from './types.js';
|
|
1
|
+
import type { JobOptions, QueueDriver } from './types.js';
|
|
2
|
+
import { type JobClass } from './Job.js';
|
|
2
3
|
export type QueueDriverFactory = () => QueueDriver;
|
|
3
4
|
export interface QueueConfig {
|
|
4
5
|
/** @default 'memory' */
|
|
@@ -6,8 +7,10 @@ export interface QueueConfig {
|
|
|
6
7
|
drivers?: Record<string, QueueDriverFactory>;
|
|
7
8
|
}
|
|
8
9
|
/**
|
|
9
|
-
* Resolves queue drivers by name from the configured factories
|
|
10
|
-
*
|
|
10
|
+
* Resolves queue drivers by name from the configured factories, memoized per
|
|
11
|
+
* name. Nothing here writes the `Job.dispatch()` pin: `getQueueDriver()` reads
|
|
12
|
+
* the manager the container holds, so a second app's manager is not shadowed by
|
|
13
|
+
* the first one's driver.
|
|
11
14
|
*/
|
|
12
15
|
export declare class QueueManager {
|
|
13
16
|
private defaultDriver;
|
|
@@ -15,13 +18,19 @@ export declare class QueueManager {
|
|
|
15
18
|
private readonly resolvedDrivers;
|
|
16
19
|
constructor(config?: QueueConfig);
|
|
17
20
|
driver(name?: string): QueueDriver;
|
|
21
|
+
/**
|
|
22
|
+
* Explicit form of `JobClass.dispatch(payload, options)`: the same message,
|
|
23
|
+
* pushed through this manager's default driver rather than the ambient one
|
|
24
|
+
* (RFC 0023 §3).
|
|
25
|
+
*/
|
|
26
|
+
dispatch<T>(JobClass: JobClass<T>, payload: T, options?: JobOptions): Promise<string>;
|
|
18
27
|
registerDriver(name: string, factory: QueueDriverFactory): void;
|
|
19
28
|
hasDriver(name: string): boolean;
|
|
20
29
|
getDefaultDriverName(): string;
|
|
21
30
|
getDriverNames(): string[];
|
|
22
31
|
/**
|
|
23
|
-
* After this, `driver()` with no name, `getDefaultDriverName()`, and
|
|
24
|
-
* `Job.dispatch()` all use the new driver.
|
|
32
|
+
* After this, `driver()` with no name, `getDefaultDriverName()`, and — for a
|
|
33
|
+
* manager bound as `queue` — `Job.dispatch()` all use the new driver.
|
|
25
34
|
*/
|
|
26
35
|
setDefaultDriver(name: string): void;
|
|
27
36
|
}
|
package/dist/queue/Worker.d.ts
CHANGED
|
@@ -31,8 +31,9 @@ export declare class Worker {
|
|
|
31
31
|
private getNextJob;
|
|
32
32
|
private processJob;
|
|
33
33
|
private handleFailedJob;
|
|
34
|
+
private instantiate;
|
|
34
35
|
private executeWithTimeout;
|
|
35
36
|
private sleepMs;
|
|
36
37
|
}
|
|
37
38
|
/** Process one job without a running worker, for tests and one-off execution. */
|
|
38
|
-
export declare function processJob(driver: QueueDriver, queue?: string): Promise<boolean>;
|
|
39
|
+
export declare function processJob(driver: QueueDriver, queue?: string, options?: Pick<WorkerOptions, 'container'>): Promise<boolean>;
|
package/dist/queue/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { QueuedJob, FailedJob, QueueDriver, JobOptions, WorkerOptions, JobHandler, JobFailureHandler, } from './types.js';
|
|
2
|
-
export { Job, setQueueDriver, getQueueDriver, registerJob, getJob, getRegisteredJobs, clearJobRegistry, resolveJobName, type JobClass, } from './Job.js';
|
|
2
|
+
export { Job, setQueueDriver, clearQueueDriver, getQueueDriver, resolveQueueDriver, registerJob, getJob, getRegisteredJobs, clearJobRegistry, resolveJobName, type JobClass, } from './Job.js';
|
|
3
3
|
export { MemoryDriver } from './drivers/MemoryDriver.js';
|
|
4
4
|
export { SyncDriver } from './drivers/SyncDriver.js';
|
|
5
5
|
export { RedisDriver, type RedisDriverOptions } from './drivers/RedisDriver.js';
|
package/dist/queue/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
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-
|
|
3
|
-
export { FailedJobReporter, Job, MemoryDriver, QueueManager, RedisDriver, SqsDriver, SyncDriver, Worker, clearJobRegistry, createQueueManager, createSqsAdapter, getJob, getQueueDriver, getRegisteredJobs, processJob, registerJob, resolveJobName, setQueueDriver };
|
|
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-BxioDEcS.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-B3x_RKnB.js";
|
|
3
|
+
export { FailedJobReporter, Job, MemoryDriver, QueueManager, RedisDriver, SqsDriver, SyncDriver, Worker, clearJobRegistry, clearQueueDriver, createQueueManager, createSqsAdapter, getJob, getQueueDriver, getRegisteredJobs, processJob, registerJob, resolveJobName, resolveQueueDriver, setQueueDriver };
|
package/dist/queue/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ContainerLike } from '../container/types.js';
|
|
1
2
|
/** Serialized job data stored in the queue. */
|
|
2
3
|
export interface QueuedJob<T = unknown> {
|
|
3
4
|
id: string;
|
|
@@ -55,6 +56,12 @@ export interface JobOptions {
|
|
|
55
56
|
}
|
|
56
57
|
/** Worker options. */
|
|
57
58
|
export interface WorkerOptions {
|
|
59
|
+
/**
|
|
60
|
+
* The container of the app whose jobs this worker runs; each job receives it
|
|
61
|
+
* through `setContainer()` before `handle()` (RFC 0023 §2). Without it a job
|
|
62
|
+
* resolves from the default application.
|
|
63
|
+
*/
|
|
64
|
+
container?: ContainerLike;
|
|
58
65
|
/**
|
|
59
66
|
* Queues to process (in priority order).
|
|
60
67
|
* @default ['default']
|