@guren/server 2.22.0 → 2.23.1
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-BVvaY-7p.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/console/Command.d.ts +3 -3
- package/dist/console/ConsoleKernel.d.ts +2 -2
- package/dist/console/index.d.ts +1 -1
- package/dist/console/types.d.ts +9 -1
- 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-CaJKZ2qk.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 +196 -87
- 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-zMjQimaJ.js} +42 -11
- package/dist/mvc/Controller.d.ts +2 -2
- 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-BLid0Y6M.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-IdJjqbyJ.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-QooqG8FE.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
|
@@ -22,7 +22,17 @@ export declare class Encrypter {
|
|
|
22
22
|
}
|
|
23
23
|
export declare function generateKey(): string;
|
|
24
24
|
export declare function createEncrypter(config: EncrypterConfig): Encrypter;
|
|
25
|
+
/**
|
|
26
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the encrypter on
|
|
27
|
+
* the app's container instead — `EncryptionServiceProvider` already does, and a
|
|
28
|
+
* provider of your own reaches it as `this.container.instance('encrypter', e)`.
|
|
29
|
+
*/
|
|
25
30
|
export declare function setEncrypter(encrypter: Encrypter): void;
|
|
31
|
+
/**
|
|
32
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
|
|
33
|
+
* `this.make('encrypter')` in a controller, job or command, or
|
|
34
|
+
* `defaultContainer().make('encrypter')`. `encrypt()` / `decrypt()` are unaffected.
|
|
35
|
+
*/
|
|
26
36
|
export declare function getEncrypter(): Encrypter;
|
|
27
37
|
/** Encrypt with the global encrypter. */
|
|
28
38
|
export declare function encrypt(value: unknown, options?: EncryptOptions): string;
|
package/dist/encryption/index.js
CHANGED
|
@@ -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-
|
|
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";
|
|
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,4 +1,5 @@
|
|
|
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
3
|
import { createCipheriv, createDecipheriv, createHmac, randomBytes } from "crypto";
|
|
3
4
|
//#region src/encryption/Encrypter.ts
|
|
4
5
|
/**
|
|
@@ -128,20 +129,37 @@ let globalEncrypter = null;
|
|
|
128
129
|
function createEncrypter(config) {
|
|
129
130
|
return new Encrypter(config);
|
|
130
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the encrypter on
|
|
134
|
+
* the app's container instead — `EncryptionServiceProvider` already does, and a
|
|
135
|
+
* provider of your own reaches it as `this.container.instance('encrypter', e)`.
|
|
136
|
+
*/
|
|
131
137
|
function setEncrypter(encrypter) {
|
|
132
|
-
|
|
138
|
+
warnDeprecatedSetter("setEncrypter");
|
|
139
|
+
globalEncrypter = bindAmbient("encrypter", encrypter) ? null : encrypter;
|
|
133
140
|
}
|
|
141
|
+
/**
|
|
142
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
|
|
143
|
+
* `this.make('encrypter')` in a controller, job or command, or
|
|
144
|
+
* `defaultContainer().make('encrypter')`. `encrypt()` / `decrypt()` are unaffected.
|
|
145
|
+
*/
|
|
134
146
|
function getEncrypter() {
|
|
135
|
-
|
|
136
|
-
return
|
|
147
|
+
warnDeprecatedGetter("getEncrypter");
|
|
148
|
+
return resolveEncrypter();
|
|
149
|
+
}
|
|
150
|
+
/** @internal The default application's `encrypter`, else the one `setEncrypter()` installed. */
|
|
151
|
+
function resolveEncrypter() {
|
|
152
|
+
const encrypter = ambientBinding("encrypter") ?? globalEncrypter;
|
|
153
|
+
if (!encrypter) throw new Error("Encrypter not initialized. Register EncryptionServiceProvider, or call setEncrypter() first.");
|
|
154
|
+
return encrypter;
|
|
137
155
|
}
|
|
138
156
|
/** Encrypt with the global encrypter. */
|
|
139
157
|
function encrypt(value, options) {
|
|
140
|
-
return
|
|
158
|
+
return resolveEncrypter().encrypt(value, options);
|
|
141
159
|
}
|
|
142
160
|
/** Decrypt with the global encrypter. */
|
|
143
161
|
function decrypt(payload, options) {
|
|
144
|
-
return
|
|
162
|
+
return resolveEncrypter().decrypt(payload, options);
|
|
145
163
|
}
|
|
146
164
|
//#endregion
|
|
147
165
|
//#region src/encryption/signed-url.ts
|
|
@@ -24,7 +24,17 @@ export declare class ExceptionHandler {
|
|
|
24
24
|
middleware(): Middleware;
|
|
25
25
|
}
|
|
26
26
|
export declare function createExceptionHandler(options?: ExceptionHandlerOptions): ExceptionHandler;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Bind the handler on the
|
|
29
|
+
* app's container instead — `ErrorServiceProvider` already does, and a provider
|
|
30
|
+
* of your own reaches it as `this.container.instance('exception.handler', h)`.
|
|
31
|
+
*/
|
|
27
32
|
export declare function setExceptionHandler(handler: ExceptionHandler): void;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated since 2.23.0, removed in 3.0.0 (RFC 0023). Use
|
|
35
|
+
* `this.make('exception.handler')` in a controller, job or command, or
|
|
36
|
+
* `defaultContainer().make('exception.handler')`.
|
|
37
|
+
*/
|
|
28
38
|
export declare function getExceptionHandler(): ExceptionHandler;
|
|
29
39
|
export declare function abort(statusCode: number, message?: string, errors?: Record<string, string[]>): never;
|
|
30
40
|
export declare function abortIf(condition: boolean, statusCode: number, message?: string): void;
|
package/dist/events/Event.d.ts
CHANGED
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
/** Base class for all application events. */
|
|
2
2
|
export declare abstract class Event {
|
|
3
3
|
readonly timestamp: Date;
|
|
4
|
+
/**
|
|
5
|
+
* Stable wire name: queued emits record it and the worker resolves the class
|
|
6
|
+
* back from it. Declare it as a static field to pin the name against a
|
|
7
|
+
* rename or identifier mangling.
|
|
8
|
+
* @default the class name
|
|
9
|
+
*/
|
|
4
10
|
static get eventName(): string;
|
|
5
11
|
get eventName(): string;
|
|
6
12
|
}
|
|
13
|
+
interface EventNameCarrier {
|
|
14
|
+
name: string;
|
|
15
|
+
eventName?: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Only an *own* `eventName` counts: statics are inherited, so reading the
|
|
19
|
+
* prototype chain would make every subclass of a pinned event claim its
|
|
20
|
+
* parent's name and take over its listeners. The base class's own entry is the
|
|
21
|
+
* accessor, which answers with the class name.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveEventName(eventClass: EventNameCarrier): string;
|
|
24
|
+
export {};
|
|
@@ -1,23 +1,75 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
1
|
+
import { type Event } from './Event.js';
|
|
2
|
+
import type { ListenerClass } from './Listener.js';
|
|
3
|
+
import type { EventClass, EventListener, ListenerOptions, QueueEventDispatcher, EventSubscription } from './types.js';
|
|
3
4
|
/** Registers listeners and emits events. */
|
|
4
5
|
export declare class EventManager {
|
|
5
6
|
private readonly listeners;
|
|
7
|
+
/** Classes seen by `on()` or `registerEvent()`, so a queued event can be rebuilt as an instance on the worker. */
|
|
8
|
+
private readonly eventClasses;
|
|
9
|
+
/** Next `listenerSeq` per "<event>\u0000<queue>", never reset; see {@link RegisteredListener.listenerSeq}. */
|
|
10
|
+
private readonly listenerSeqCounters;
|
|
6
11
|
private queueDispatcher?;
|
|
7
12
|
on<T extends Event>(event: EventClass<T> | string, listener: EventListener<T>, options?: ListenerOptions): EventSubscription;
|
|
13
|
+
private register;
|
|
8
14
|
once<T extends Event>(event: EventClass<T> | string, listener: EventListener<T>, options?: Omit<ListenerOptions, 'once'>): EventSubscription;
|
|
15
|
+
/**
|
|
16
|
+
* Makes the class resolvable by name when a queued emit reaches a worker.
|
|
17
|
+
* `on()` registers it too; a worker that only drains the queue registers the
|
|
18
|
+
* listeners anyway, so this is for a process that emits and never listens.
|
|
19
|
+
*/
|
|
20
|
+
registerEvent(eventClass: EventClass): void;
|
|
21
|
+
/**
|
|
22
|
+
* Registers a `Listener` subclass under its own statics: `event`, `priority`,
|
|
23
|
+
* and `queue` when `shouldQueue`. The instance is built per invocation, so
|
|
24
|
+
* two events cannot share one listener's state. `failed()` is terminal either
|
|
25
|
+
* way: inline on the throw that then propagates, queued once the carrier
|
|
26
|
+
* job's retries are exhausted, where `Job.failed` runs.
|
|
27
|
+
*/
|
|
28
|
+
listen<T extends Event>(listenerClass: ListenerClass<T>): EventSubscription;
|
|
9
29
|
/** Omitting `listener` removes every listener for the event. */
|
|
10
30
|
off<T extends Event>(event: EventClass<T> | string, listener?: EventListener<T>): void;
|
|
11
31
|
/** Highest priority first, awaited one at a time. */
|
|
12
32
|
emit<T extends Event>(event: T): Promise<void>;
|
|
13
33
|
/** {@link emit} without the ordering guarantee. */
|
|
14
34
|
emitParallel<T extends Event>(event: T): Promise<void>;
|
|
35
|
+
private dispatch;
|
|
36
|
+
/** Resolves whether the listener was sent to a queue rather than run here. */
|
|
37
|
+
private invoke;
|
|
38
|
+
/**
|
|
39
|
+
* Counted per event and queue, so an inline listener registered beside them
|
|
40
|
+
* does not move the numbers. The worker counts its own the same way, which is
|
|
41
|
+
* why both processes must register the queued listeners in the same order.
|
|
42
|
+
*/
|
|
43
|
+
private nextListenerSeq;
|
|
44
|
+
private onQueue;
|
|
45
|
+
private forget;
|
|
46
|
+
/**
|
|
47
|
+
* The worker side of a queued emit: runs the listener the message names,
|
|
48
|
+
* with the event rebuilt as an instance of the registered class. An absent
|
|
49
|
+
* `listenerSeq` — a dispatcher of your own that does not send one — runs
|
|
50
|
+
* every listener for that event on that queue.
|
|
51
|
+
*/
|
|
52
|
+
handleQueued(queueName: string, eventName: string, data: Record<string, unknown>, listenerSeq?: number): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* The worker side of a queued listener's failure, once the carrier job has
|
|
55
|
+
* run out of retries. Total by contract: an unknown listener, a class with no
|
|
56
|
+
* `failed()`, and an event it cannot rebuild are no-ops, since a throw here
|
|
57
|
+
* only buries the error that caused it.
|
|
58
|
+
*/
|
|
59
|
+
failedQueued(queueName: string, eventName: string, data: Record<string, unknown>, listenerSeq: number | undefined, error: Error): Promise<void>;
|
|
60
|
+
private rehydrate;
|
|
15
61
|
hasListeners(event: EventClass | string): boolean;
|
|
16
62
|
getListeners<T extends Event>(event: EventClass<T> | string): EventListener<T>[];
|
|
17
63
|
listenerCount(event: EventClass | string): number;
|
|
18
64
|
eventNames(): string[];
|
|
19
65
|
removeAllListeners(): void;
|
|
20
|
-
/**
|
|
21
|
-
|
|
66
|
+
/**
|
|
67
|
+
* `EventServiceProvider` installs `createQueueEventDispatcher()` at boot,
|
|
68
|
+
* before the app's queue driver necessarily exists. A dispatcher that finds
|
|
69
|
+
* no queue at emit time resolves false, and the listener runs inline rather
|
|
70
|
+
* than failing the emit.
|
|
71
|
+
*/
|
|
72
|
+
setQueueDispatcher(dispatcher: QueueEventDispatcher): void;
|
|
73
|
+
private nameOf;
|
|
22
74
|
}
|
|
23
75
|
export declare function createEventManager(): EventManager;
|
package/dist/events/index.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ export { Event } from './Event.js';
|
|
|
2
2
|
export { EventManager, createEventManager } from './EventManager.js';
|
|
3
3
|
export { Listener } from './Listener.js';
|
|
4
4
|
export type { ListenerClass } from './Listener.js';
|
|
5
|
-
export
|
|
5
|
+
export { createQueueEventDispatcher } from './queued.js';
|
|
6
|
+
export type { EventClass, EventListener, ListenerOptions, QueueEventDispatcher, RegisteredListener, EventSubscription, } from './types.js';
|
|
6
7
|
export { RequestReceived, RequestFinished, UserAuthenticated, UserLoggedOut, JobProcessed, JobFailed, ApplicationStarted, ApplicationShutdown, } from './builtin.js';
|
package/dist/events/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as RequestFinished, c as UserLoggedOut, d as
|
|
2
|
-
export { ApplicationShutdown, ApplicationStarted, Event, EventManager, JobFailed, JobProcessed, Listener, RequestFinished, RequestReceived, UserAuthenticated, UserLoggedOut, createEventManager };
|
|
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";
|
|
2
|
+
export { ApplicationShutdown, ApplicationStarted, Event, EventManager, JobFailed, JobProcessed, Listener, RequestFinished, RequestReceived, UserAuthenticated, UserLoggedOut, createEventManager, createQueueEventDispatcher };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { QueueEventDispatcher } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* The dispatcher `EventServiceProvider` installs at boot. Registers the carrier
|
|
4
|
+
* job too, which is what lets a worker booting the same app resolve the message.
|
|
5
|
+
* Resolves false rather than letting `Job.dispatch()` throw: it is installed
|
|
6
|
+
* before the app's queue is bound, and an emit it cannot queue runs inline.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createQueueEventDispatcher(): QueueEventDispatcher;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Event } from './Event.js';
|
|
2
|
+
/**
|
|
3
|
+
* An event's own enumerable fields, one level deep: a Date nested inside an
|
|
4
|
+
* object or array field survives as whatever the driver's encoding makes of it.
|
|
5
|
+
*/
|
|
6
|
+
export declare function encodeEventData(event: Event): Record<string, unknown>;
|
|
7
|
+
/** The inverse of {@link encodeEventData}; a value that carries no tag is passed through. */
|
|
8
|
+
export declare function decodeEventData(data: Record<string, unknown>): Record<string, unknown>;
|
package/dist/events/types.d.ts
CHANGED
|
@@ -16,14 +16,31 @@ export interface ListenerOptions {
|
|
|
16
16
|
*/
|
|
17
17
|
priority?: number;
|
|
18
18
|
/**
|
|
19
|
-
* Dispatch to this queue instead of running inline.
|
|
20
|
-
*
|
|
19
|
+
* Dispatch to this queue instead of running inline. A manager that cannot
|
|
20
|
+
* reach a queue warns once and runs the listener inline.
|
|
21
21
|
*/
|
|
22
22
|
queue?: string;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Sends one queued listener's emit; `event` is the live instance, serialized by
|
|
26
|
+
* the dispatcher. `listenerSeq` identifies the listener among those on that
|
|
27
|
+
* queue — a dispatcher that drops it makes the worker run all of them.
|
|
28
|
+
* Only an explicit `false` means no queue was reachable, which runs the
|
|
29
|
+
* listener inline; a dispatcher resolving nothing reads as having queued.
|
|
30
|
+
*/
|
|
31
|
+
export type QueueEventDispatcher = (queueName: string, eventName: string, event: Event, listenerSeq?: number) => Promise<boolean>;
|
|
24
32
|
export interface RegisteredListener<T extends Event = Event> {
|
|
25
33
|
listener: EventListener<T>;
|
|
26
34
|
options: ListenerOptions;
|
|
35
|
+
/**
|
|
36
|
+
* Registration order among the listeners for this event on this queue, which
|
|
37
|
+
* a queued message addresses instead of an array position: a `once` listener
|
|
38
|
+
* removed after its own message renumbers every position behind it, and the
|
|
39
|
+
* message still in flight would then name the wrong listener or none.
|
|
40
|
+
*/
|
|
41
|
+
listenerSeq?: number;
|
|
42
|
+
/** A queued listener class's `failed()`, run by the carrier job once its retries are exhausted. */
|
|
43
|
+
failed?: (event: T, error: Error) => void | Promise<void>;
|
|
27
44
|
}
|
|
28
45
|
export interface EventSubscription {
|
|
29
46
|
unsubscribe(): void;
|