@nextage/era-lib 1.0.184 → 1.0.186
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/build/events/base-listener.d.ts +61 -31
- package/build/events/base-listener.d.ts.map +1 -1
- package/build/events/base-listener.interfaces.d.ts +23 -0
- package/build/events/base-listener.interfaces.d.ts.map +1 -0
- package/build/events/base-listener.interfaces.js +10 -0
- package/build/events/base-listener.interfaces.js.map +1 -0
- package/build/events/base-listener.js +101 -73
- package/build/events/base-listener.js.map +1 -1
- package/build/events/base-msg-listener.d.ts +46 -0
- package/build/events/base-msg-listener.d.ts.map +1 -0
- package/build/events/base-msg-listener.js +100 -0
- package/build/events/base-msg-listener.js.map +1 -0
- package/build/events/base-nats-listener.d.ts +8 -14
- package/build/events/base-nats-listener.d.ts.map +1 -1
- package/build/events/base-nats-listener.js +13 -11
- package/build/events/base-nats-listener.js.map +1 -1
- package/build/events/index.d.ts +2 -0
- package/build/events/index.d.ts.map +1 -1
- package/build/events/index.js +2 -0
- package/build/events/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,49 +1,79 @@
|
|
|
1
1
|
import { NxContext } from '@nextage/nx-frame-be';
|
|
2
|
-
import {
|
|
3
|
-
import { ClientProvider, Event, EventSubOptions } from './interfaces';
|
|
2
|
+
import { Event } from './interfaces';
|
|
4
3
|
import { EventContext, IncomingEventRef } from './types/event-envelope.interfaces';
|
|
4
|
+
import { SyncRefArrayCtrl, SyncRefArrayParams } from './base-listener.interfaces';
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base shared by every listener, regardless of transport.
|
|
7
|
+
*
|
|
8
|
+
* It owns the transport-agnostic concerns:
|
|
9
|
+
* - identity (`subject` / `queueGroupName`) and the in-flight event reference,
|
|
10
|
+
* - cascade-context propagation (`nextContext`),
|
|
11
|
+
* - standardized structured logging (`logReceived` / `logUpdateResult`),
|
|
12
|
+
* - the shared "mirror" denormalization helper (`syncRefArray`).
|
|
13
|
+
*
|
|
14
|
+
* Transport-specific concerns (subscription lifecycle, ack/nak/DLQ, the
|
|
15
|
+
* `onMessage` signature) live in the concrete subclasses:
|
|
16
|
+
* - `MsgListener` — in-memory, best-effort intra-service delivery,
|
|
17
|
+
* - `NatsListener` — durable inter-service delivery (JetStream) with retry/DLQ.
|
|
18
|
+
*/
|
|
5
19
|
export declare abstract class Listener<T extends Event> {
|
|
6
20
|
abstract subject: T['subject'];
|
|
7
21
|
abstract queueGroupName: string;
|
|
8
|
-
abstract onMessage(data: T['data'], msg: Message): Promise<void>;
|
|
9
|
-
private readonly provider;
|
|
10
|
-
private subscription;
|
|
11
|
-
private messageStack;
|
|
12
|
-
private wait;
|
|
13
22
|
protected _incoming: IncomingEventRef | undefined;
|
|
14
|
-
protected ackWait: number;
|
|
15
|
-
constructor(provider: ClientProvider);
|
|
16
|
-
private get client();
|
|
17
|
-
subscriptionOptions(): EventSubOptions;
|
|
18
|
-
listen(): Promise<void>;
|
|
19
23
|
/**
|
|
20
|
-
*
|
|
21
|
-
*
|
|
24
|
+
* Short transport tag used as the log line prefix (`MEM` / `NATS`). Overridden
|
|
25
|
+
* by the concrete subclass so a log line tells at a glance which bus it came from.
|
|
22
26
|
*/
|
|
23
|
-
|
|
27
|
+
protected transportNameForLog(): string;
|
|
24
28
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* subject) is skipped — the in-memory bus has no ack/redelivery to fight — and
|
|
28
|
-
* the in-flight reference is always cleared so `nextContext` never leaks the
|
|
29
|
-
* previous event.
|
|
29
|
+
* Durable-stream name for the log line/context, when the transport has one
|
|
30
|
+
* (JetStream). In-memory listeners have no stream, so this is `undefined`.
|
|
30
31
|
*/
|
|
31
|
-
protected
|
|
32
|
+
protected streamNameForLog(): string | undefined;
|
|
32
33
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* depth / visited lineage. Returns a fresh object (never mutates `base`).
|
|
34
|
+
* Base structured logging context (class + method + arbitrary extra fields),
|
|
35
|
+
* so log aggregators can filter by `eventSubject`, `eventId`, `modelName`, etc.
|
|
36
36
|
*/
|
|
37
|
-
protected
|
|
37
|
+
protected loggerCtx(method?: string, data?: Record<string, unknown>): Record<string, unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* Standardized "event received" log, shared by every listener. Emits both a
|
|
40
|
+
* human-readable line and a structured context payload.
|
|
41
|
+
*/
|
|
42
|
+
protected logReceived(data: {
|
|
43
|
+
id?: string;
|
|
44
|
+
code?: string;
|
|
45
|
+
}, method?: string): void;
|
|
46
|
+
/**
|
|
47
|
+
* Standardized "mutation result" log, shared by every listener. Reports how many
|
|
48
|
+
* items a denormalization touched, split by action (created / updated / deleted),
|
|
49
|
+
* plus any extra structured fields (tenantId, assetId, ...) so aggregators can
|
|
50
|
+
* query them instead of parsing the message. Only the actions actually provided
|
|
51
|
+
* in `counts` appear in the human-readable line; a run that touched nothing logs
|
|
52
|
+
* a single "no <model> changed" line.
|
|
53
|
+
*/
|
|
54
|
+
protected logMutationResult(modelName: string, dataId: string | undefined, counts: {
|
|
55
|
+
created?: number;
|
|
56
|
+
updated?: number;
|
|
57
|
+
deleted?: number;
|
|
58
|
+
}, method?: string, extra?: Record<string, unknown>): void;
|
|
59
|
+
/**
|
|
60
|
+
* Update-only sugar over `logMutationResult`, kept because the guarded "mirror"
|
|
61
|
+
* denormalization (`syncRefArray`) and most listeners only ever update copies.
|
|
62
|
+
*/
|
|
63
|
+
protected logUpdateResult(modelName: string, dataId: string | undefined, updateCount: number, method?: string): void;
|
|
38
64
|
/**
|
|
39
|
-
*
|
|
65
|
+
* Shared "mirror" denormalization strategy: update the copies of an entity that
|
|
66
|
+
* live embedded in the `arrayPath` array of many documents, guarded by the
|
|
67
|
+
* nested item version so a stale event never overwrites a newer copy.
|
|
68
|
+
* Returns the number of documents actually modified.
|
|
40
69
|
*/
|
|
41
|
-
|
|
70
|
+
protected syncRefArray(ctrl: SyncRefArrayCtrl, params: SyncRefArrayParams): Promise<number>;
|
|
42
71
|
/**
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
72
|
+
* Build a child context carrying the in-flight event reference, so any event
|
|
73
|
+
* this listener republishes inherits the correlation and advances the cascade
|
|
74
|
+
* depth / visited lineage. Returns a fresh object (never mutates `base`). At the
|
|
75
|
+
* root — or when no event is in flight — it is just a copy of `base`.
|
|
46
76
|
*/
|
|
47
|
-
|
|
77
|
+
protected nextContext(base?: NxContext): EventContext;
|
|
48
78
|
}
|
|
49
79
|
//# sourceMappingURL=base-listener.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-listener.d.ts","sourceRoot":"","sources":["../../src/events/base-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"base-listener.d.ts","sourceRoot":"","sources":["../../src/events/base-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoB,SAAS,EAAE,MAAmB,sBAAsB,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAA0C,cAAc,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAiB,mCAAmC,CAAC;AAC9F,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAW,4BAA4B,CAAC;AAEvF;;;;;;;;;;;;;GAaG;AACH,8BAAsB,QAAQ,CAAC,CAAC,SAAS,KAAK;IAE5C,QAAQ,CAAC,OAAO,EAAS,CAAC,CAAC,SAAS,CAAC,CAAC;IACtC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAKhC,SAAS,CAAC,SAAS,EAAM,gBAAgB,GAAG,SAAS,CAAC;IAEtD;;;OAGG;IACH,SAAS,CAAC,mBAAmB,IAAI,MAAM;IAKvC;;;OAGG;IACH,SAAS,CAAC,gBAAgB,IAAI,MAAM,GAAG,SAAS;IAKhD;;;OAGG;IACH,SAAS,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAKjG;;;OAGG;IACH,SAAS,CAAC,WAAW,CAAC,IAAI,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAiBlF;;;;;;;OAOG;IACH,SAAS,CAAC,iBAAiB,CACzB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAK,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAK;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EACnE,MAAM,CAAC,EAAI,MAAM,EACjB,KAAK,GAAM,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACtC,IAAI;IA8BP;;;OAGG;IACH,SAAS,CAAC,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI;IAKpH;;;;;OAKG;cACa,YAAY,CAAC,IAAI,EAAE,gBAAgB,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAmBjG;;;;;OAKG;IACH,SAAS,CAAC,WAAW,CAAC,IAAI,GAAE,SAAc,GAAG,YAAY;CAI1D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface SyncRefArrayResult {
|
|
2
|
+
modifiedCount?: number;
|
|
3
|
+
}
|
|
4
|
+
export interface SyncRefArrayModel {
|
|
5
|
+
name: string;
|
|
6
|
+
updateArrayItemManyNative(filter: Record<string, unknown>, update: {
|
|
7
|
+
arrayPath: string;
|
|
8
|
+
arrayFilter: Record<string, unknown>;
|
|
9
|
+
item: Record<string, unknown>;
|
|
10
|
+
}, options: Record<string, unknown>): Promise<SyncRefArrayResult>;
|
|
11
|
+
}
|
|
12
|
+
export interface SyncRefArrayCtrl {
|
|
13
|
+
model: SyncRefArrayModel;
|
|
14
|
+
}
|
|
15
|
+
export interface SyncRefArrayParams {
|
|
16
|
+
arrayPath: string;
|
|
17
|
+
itemId: string;
|
|
18
|
+
version: number;
|
|
19
|
+
item: Record<string, unknown>;
|
|
20
|
+
filter?: Record<string, unknown>;
|
|
21
|
+
method?: string;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=base-listener.interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-listener.interfaces.d.ts","sourceRoot":"","sources":["../../src/events/base-listener.interfaces.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,kBAAkB;IAEjC,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,iBAAiB;IAEhC,IAAI,EAAE,MAAM,CAAC;IAEb,yBAAyB,CACvB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/B,MAAM,EAAE;QACN,SAAS,EAAI,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACrC,IAAI,EAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;KACtC,EACD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC/B,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,gBAAgB;IAE/B,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAED,MAAM,WAAW,kBAAkB;IAEjC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAK,MAAM,CAAC;IAClB,OAAO,EAAI,MAAM,CAAC;IAClB,IAAI,EAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,MAAM,CAAC,EAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,MAAM,CAAC,EAAI,MAAM,CAAC;CACnB"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
3
|
+
// Shared typings for the listener base class (`Listener`).
|
|
4
|
+
//
|
|
5
|
+
// These describe the minimal surface the denormalization helpers rely on, so the
|
|
6
|
+
// base can stay transport-agnostic and free of `any`. They intentionally model
|
|
7
|
+
// only what `syncRefArray` needs from a controller/model, not the full BaseModel.
|
|
8
|
+
// ────────────────────────────────────────────────────────────────────────────
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
//# sourceMappingURL=base-listener.interfaces.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-listener.interfaces.js","sourceRoot":"","sources":["../../src/events/base-listener.interfaces.ts"],"names":[],"mappings":";AAAA,+EAA+E;AAC/E,2DAA2D;AAC3D,EAAE;AACF,iFAAiF;AACjF,+EAA+E;AAC/E,kFAAkF;AAClF,+EAA+E"}
|
|
@@ -2,97 +2,125 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Listener = void 0;
|
|
4
4
|
const nx_frame_be_1 = require("@nextage/nx-frame-be");
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Abstract base shared by every listener, regardless of transport.
|
|
7
|
+
*
|
|
8
|
+
* It owns the transport-agnostic concerns:
|
|
9
|
+
* - identity (`subject` / `queueGroupName`) and the in-flight event reference,
|
|
10
|
+
* - cascade-context propagation (`nextContext`),
|
|
11
|
+
* - standardized structured logging (`logReceived` / `logUpdateResult`),
|
|
12
|
+
* - the shared "mirror" denormalization helper (`syncRefArray`).
|
|
13
|
+
*
|
|
14
|
+
* Transport-specific concerns (subscription lifecycle, ack/nak/DLQ, the
|
|
15
|
+
* `onMessage` signature) live in the concrete subclasses:
|
|
16
|
+
* - `MsgListener` — in-memory, best-effort intra-service delivery,
|
|
17
|
+
* - `NatsListener` — durable inter-service delivery (JetStream) with retry/DLQ.
|
|
18
|
+
*/
|
|
6
19
|
class Listener {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
// Resolve the client only at listen/stop time, so the transport may be
|
|
14
|
-
// connected AFTER this listener is constructed (finding B8).
|
|
15
|
-
get client() {
|
|
16
|
-
return this.provider.client;
|
|
20
|
+
/**
|
|
21
|
+
* Short transport tag used as the log line prefix (`MEM` / `NATS`). Overridden
|
|
22
|
+
* by the concrete subclass so a log line tells at a glance which bus it came from.
|
|
23
|
+
*/
|
|
24
|
+
transportNameForLog() {
|
|
25
|
+
return 'MSG';
|
|
17
26
|
}
|
|
18
|
-
|
|
19
|
-
|
|
27
|
+
/**
|
|
28
|
+
* Durable-stream name for the log line/context, when the transport has one
|
|
29
|
+
* (JetStream). In-memory listeners have no stream, so this is `undefined`.
|
|
30
|
+
*/
|
|
31
|
+
streamNameForLog() {
|
|
32
|
+
return undefined;
|
|
20
33
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// const parsedData = this.parseMessage(msg);
|
|
28
|
-
// this.onMessage(parsedData, msg);
|
|
29
|
-
});
|
|
34
|
+
/**
|
|
35
|
+
* Base structured logging context (class + method + arbitrary extra fields),
|
|
36
|
+
* so log aggregators can filter by `eventSubject`, `eventId`, `modelName`, etc.
|
|
37
|
+
*/
|
|
38
|
+
loggerCtx(method, data = {}) {
|
|
39
|
+
return { ...((0, nx_frame_be_1.logClassCtx)(this, method) ?? {}), ...data };
|
|
30
40
|
}
|
|
31
41
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
42
|
+
* Standardized "event received" log, shared by every listener. Emits both a
|
|
43
|
+
* human-readable line and a structured context payload.
|
|
34
44
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
finally {
|
|
46
|
-
this.wait = false;
|
|
47
|
-
}
|
|
48
|
-
await this.checkMessages();
|
|
45
|
+
logReceived(data, method) {
|
|
46
|
+
const stream = this.streamNameForLog();
|
|
47
|
+
nx_frame_be_1.APP.logger.info(`${this.transportNameForLog()} ${this.subject} ${this.queueGroupName}${stream ? ` ${stream}` : ''} - received event ${data?.id ?? '?'} ${data?.code ?? ''}`.trimEnd(), this.loggerCtx(method, {
|
|
48
|
+
event: 'received',
|
|
49
|
+
eventId: data?.id,
|
|
50
|
+
eventCode: data?.code,
|
|
51
|
+
eventSubject: this.subject,
|
|
52
|
+
queueGroupName: this.queueGroupName,
|
|
53
|
+
streamName: stream,
|
|
54
|
+
}));
|
|
49
55
|
}
|
|
50
56
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
57
|
+
* Standardized "mutation result" log, shared by every listener. Reports how many
|
|
58
|
+
* items a denormalization touched, split by action (created / updated / deleted),
|
|
59
|
+
* plus any extra structured fields (tenantId, assetId, ...) so aggregators can
|
|
60
|
+
* query them instead of parsing the message. Only the actions actually provided
|
|
61
|
+
* in `counts` appear in the human-readable line; a run that touched nothing logs
|
|
62
|
+
* a single "no <model> changed" line.
|
|
56
63
|
*/
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
this.
|
|
71
|
-
|
|
64
|
+
logMutationResult(modelName, dataId, counts, method, extra = {}) {
|
|
65
|
+
const created = counts.created ?? 0;
|
|
66
|
+
const updated = counts.updated ?? 0;
|
|
67
|
+
const deleted = counts.deleted ?? 0;
|
|
68
|
+
const total = created + updated + deleted;
|
|
69
|
+
const parts = [];
|
|
70
|
+
if (counts.created !== undefined)
|
|
71
|
+
parts.push(`created ${created}`);
|
|
72
|
+
if (counts.updated !== undefined)
|
|
73
|
+
parts.push(`updated ${updated}`);
|
|
74
|
+
if (counts.deleted !== undefined)
|
|
75
|
+
parts.push(`deleted ${deleted}`);
|
|
76
|
+
const line = total === 0
|
|
77
|
+
? `${this.subject} - no ${modelName} changed (item ${dataId ?? '?'} not found or already up to date)`
|
|
78
|
+
: `${this.subject} - ${parts.join(', ')} ${modelName} item(s)`;
|
|
79
|
+
nx_frame_be_1.APP.logger.info(line, this.loggerCtx(method, {
|
|
80
|
+
event: 'mutation-result',
|
|
81
|
+
eventId: dataId,
|
|
82
|
+
eventSubject: this.subject,
|
|
83
|
+
queueGroupName: this.queueGroupName,
|
|
84
|
+
streamName: this.streamNameForLog(),
|
|
85
|
+
modelName,
|
|
86
|
+
created,
|
|
87
|
+
updated,
|
|
88
|
+
deleted,
|
|
89
|
+
...extra,
|
|
90
|
+
}));
|
|
72
91
|
}
|
|
73
92
|
/**
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
* depth / visited lineage. Returns a fresh object (never mutates `base`).
|
|
93
|
+
* Update-only sugar over `logMutationResult`, kept because the guarded "mirror"
|
|
94
|
+
* denormalization (`syncRefArray`) and most listeners only ever update copies.
|
|
77
95
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
96
|
+
logUpdateResult(modelName, dataId, updateCount, method) {
|
|
97
|
+
this.logMutationResult(modelName, dataId, { updated: updateCount }, method);
|
|
80
98
|
}
|
|
81
99
|
/**
|
|
82
|
-
*
|
|
100
|
+
* Shared "mirror" denormalization strategy: update the copies of an entity that
|
|
101
|
+
* live embedded in the `arrayPath` array of many documents, guarded by the
|
|
102
|
+
* nested item version so a stale event never overwrites a newer copy.
|
|
103
|
+
* Returns the number of documents actually modified.
|
|
83
104
|
*/
|
|
84
|
-
async
|
|
85
|
-
|
|
86
|
-
|
|
105
|
+
async syncRefArray(ctrl, params) {
|
|
106
|
+
const model = ctrl.model;
|
|
107
|
+
const res = await model.updateArrayItemManyNative(params.filter ?? {}, {
|
|
108
|
+
arrayPath: params.arrayPath,
|
|
109
|
+
arrayFilter: { id: params.itemId, version: { $lt: params.version } },
|
|
110
|
+
item: params.item
|
|
111
|
+
}, {});
|
|
112
|
+
const updateCount = res.modifiedCount ?? 0;
|
|
113
|
+
this.logUpdateResult(model.name, params.itemId, updateCount, params.method);
|
|
114
|
+
return updateCount;
|
|
87
115
|
}
|
|
88
116
|
/**
|
|
89
|
-
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
117
|
+
* Build a child context carrying the in-flight event reference, so any event
|
|
118
|
+
* this listener republishes inherits the correlation and advances the cascade
|
|
119
|
+
* depth / visited lineage. Returns a fresh object (never mutates `base`). At the
|
|
120
|
+
* root — or when no event is in flight — it is just a copy of `base`.
|
|
92
121
|
*/
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
return typeof data === 'string' ? JSON.parse(data) : JSON.parse(data.toString('utf8'));
|
|
122
|
+
nextContext(base = {}) {
|
|
123
|
+
return this._incoming ? { ...base, _event: this._incoming } : { ...base };
|
|
96
124
|
}
|
|
97
125
|
}
|
|
98
126
|
exports.Listener = Listener;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-listener.js","sourceRoot":"","sources":["../../src/events/base-listener.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"base-listener.js","sourceRoot":"","sources":["../../src/events/base-listener.ts"],"names":[],"mappings":";;;AAAA,sDAAgF;AAKhF;;;;;;;;;;;;;GAaG;AACH,MAAsB,QAAQ;IAU5B;;;OAGG;IACO,mBAAmB;QAE3B,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;OAGG;IACO,gBAAgB;QAExB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;;OAGG;IACO,SAAS,CAAC,MAAe,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,KAAK,CAAC,yBAAyB,CAC/C,MAAM,CAAC,MAAM,IAAI,EAAE,EACnB;YACE,SAAS,EAAI,MAAM,CAAC,SAAS;YAC7B,WAAW,EAAE,EAAE,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,OAAO,EAAE,EAAE;YACpE,IAAI,EAAS,MAAM,CAAC,IAAI;SACzB,EACD,EAAE,CACH,CAAC;QAEF,MAAM,WAAW,GAAG,GAAG,CAAC,aAAa,IAAI,CAAC,CAAC;QAC3C,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;QAC5E,OAAO,WAAW,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACO,WAAW,CAAC,OAAkB,EAAE;QAExC,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,CAAC;IAC5E,CAAC;CACF;AAlJD,4BAkJC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { Message } from './event-message';
|
|
2
|
+
import { ClientProvider, Event, EventSubOptions } from './interfaces';
|
|
3
|
+
import { Listener } from './base-listener';
|
|
4
|
+
/**
|
|
5
|
+
* In-memory listener: best-effort intra-service dispatch over the in-process
|
|
6
|
+
* message bus. No broker ack/nak/DLQ — a cascade-guard violation is simply
|
|
7
|
+
* skipped (there is no redelivery to fight). Use `NatsListener` for durable,
|
|
8
|
+
* inter-service delivery with retry/DLQ semantics.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class MsgListener<T extends Event> extends Listener<T> {
|
|
11
|
+
abstract onMessage(data: T['data'], msg: Message): Promise<void>;
|
|
12
|
+
private readonly provider;
|
|
13
|
+
private subscription;
|
|
14
|
+
private messageStack;
|
|
15
|
+
private wait;
|
|
16
|
+
protected ackWait: number;
|
|
17
|
+
constructor(provider: ClientProvider);
|
|
18
|
+
protected transportNameForLog(): string;
|
|
19
|
+
private get client();
|
|
20
|
+
subscriptionOptions(): EventSubOptions;
|
|
21
|
+
listen(): Promise<void>;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
checkMessages(): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Process a single message: unwrap the envelope, apply the cascade loop-guard,
|
|
29
|
+
* then dispatch to `onMessage`. A guard violation (runaway depth or revisited
|
|
30
|
+
* subject) is skipped — the in-memory bus has no ack/redelivery to fight — and
|
|
31
|
+
* the in-flight reference is always cleared so `nextContext` never leaks the
|
|
32
|
+
* previous event.
|
|
33
|
+
*/
|
|
34
|
+
protected handleMessage(msg: Message): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
stop(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
*
|
|
41
|
+
* @param msg
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
private parseMessage;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=base-msg-listener.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-msg-listener.d.ts","sourceRoot":"","sources":["../../src/events/base-msg-listener.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAyD,iBAAiB,CAAC;AAE7F,OAAO,EAAE,cAAc,EAAE,KAAK,EAAsB,eAAe,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAwD,iBAAiB,CAAC;AAG7F;;;;;GAKG;AACH,8BAAsB,WAAW,CAAC,CAAC,SAAS,KAAK,CAAE,SAAQ,QAAQ,CAAC,CAAC,CAAC;IAEpE,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAEhE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAiB;IAC1C,OAAO,CAAC,YAAY,CAAqC;IAEzD,OAAO,CAAC,YAAY,CAAsB;IAC1C,OAAO,CAAC,IAAI,CAAiC;IAE7C,SAAS,CAAC,OAAO,EAAU,MAAM,CAAe;gBAEnC,QAAQ,EAAE,cAAc;cAMlB,mBAAmB,IAAI,MAAM;IAOhD,OAAO,KAAK,MAAM,GAGjB;IAED,mBAAmB,IAAI,eAAe;IAKhC,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAiB7B;;;OAGG;IACG,aAAa;IAsBnB;;;;;;OAMG;cACa,aAAa,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAwB1D;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B;;;;OAIG;IACH,OAAO,CAAC,YAAY;CAKrB"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MsgListener = void 0;
|
|
4
|
+
const nx_frame_be_1 = require("@nextage/nx-frame-be");
|
|
5
|
+
const base_listener_1 = require("./base-listener");
|
|
6
|
+
const cascade_1 = require("./cascade");
|
|
7
|
+
/**
|
|
8
|
+
* In-memory listener: best-effort intra-service dispatch over the in-process
|
|
9
|
+
* message bus. No broker ack/nak/DLQ — a cascade-guard violation is simply
|
|
10
|
+
* skipped (there is no redelivery to fight). Use `NatsListener` for durable,
|
|
11
|
+
* inter-service delivery with retry/DLQ semantics.
|
|
12
|
+
*/
|
|
13
|
+
class MsgListener extends base_listener_1.Listener {
|
|
14
|
+
constructor(provider) {
|
|
15
|
+
super();
|
|
16
|
+
this.messageStack = [];
|
|
17
|
+
this.wait = false;
|
|
18
|
+
this.ackWait = 5 * 1000;
|
|
19
|
+
this.provider = provider;
|
|
20
|
+
}
|
|
21
|
+
transportNameForLog() {
|
|
22
|
+
return 'MEM';
|
|
23
|
+
}
|
|
24
|
+
// Resolve the client only at listen/stop time, so the transport may be
|
|
25
|
+
// connected AFTER this listener is constructed (finding B8).
|
|
26
|
+
get client() {
|
|
27
|
+
return this.provider.client;
|
|
28
|
+
}
|
|
29
|
+
subscriptionOptions() {
|
|
30
|
+
return {};
|
|
31
|
+
}
|
|
32
|
+
async listen() {
|
|
33
|
+
this.subscription = await this.client.subscribe(this.subject, this.queueGroupName, this.subscriptionOptions());
|
|
34
|
+
this.subscription?.on('message', (msg) => {
|
|
35
|
+
nx_frame_be_1.APP.logger.info(`📥 Received message on: ${this.subject} / ${this.queueGroupName}`, (0, nx_frame_be_1.logClassCtx)(this));
|
|
36
|
+
this.messageStack.push(msg);
|
|
37
|
+
this.checkMessages();
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
* @returns
|
|
43
|
+
*/
|
|
44
|
+
async checkMessages() {
|
|
45
|
+
if (this.wait || !this.messageStack.length)
|
|
46
|
+
return;
|
|
47
|
+
const msg = this.messageStack.shift();
|
|
48
|
+
if (!msg)
|
|
49
|
+
return;
|
|
50
|
+
this.wait = true;
|
|
51
|
+
try {
|
|
52
|
+
await this.handleMessage(msg);
|
|
53
|
+
}
|
|
54
|
+
finally {
|
|
55
|
+
this.wait = false;
|
|
56
|
+
}
|
|
57
|
+
await this.checkMessages();
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Process a single message: unwrap the envelope, apply the cascade loop-guard,
|
|
61
|
+
* then dispatch to `onMessage`. A guard violation (runaway depth or revisited
|
|
62
|
+
* subject) is skipped — the in-memory bus has no ack/redelivery to fight — and
|
|
63
|
+
* the in-flight reference is always cleared so `nextContext` never leaks the
|
|
64
|
+
* previous event.
|
|
65
|
+
*/
|
|
66
|
+
async handleMessage(msg) {
|
|
67
|
+
try {
|
|
68
|
+
const { id, data, meta } = (0, cascade_1.unwrapEnvelope)(this.parseMessage(msg));
|
|
69
|
+
const violation = (0, cascade_1.cascadeViolation)(meta, this.subject);
|
|
70
|
+
if (violation) {
|
|
71
|
+
nx_frame_be_1.APP.logger.warn(`🔁 Cascade guard tripped on '${this.subject}': ${violation}`, (0, nx_frame_be_1.logClassCtx)(this));
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
this._incoming = { id, subject: this.subject, meta };
|
|
75
|
+
await this.onMessage(data, msg);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
finally {
|
|
79
|
+
this._incoming = undefined;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
*
|
|
84
|
+
*/
|
|
85
|
+
async stop() {
|
|
86
|
+
if (this.subscription)
|
|
87
|
+
this.client.unsubscribe(this.subscription);
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* @param msg
|
|
92
|
+
* @returns
|
|
93
|
+
*/
|
|
94
|
+
parseMessage(msg) {
|
|
95
|
+
const data = msg.getData();
|
|
96
|
+
return typeof data === 'string' ? JSON.parse(data) : JSON.parse(data.toString('utf8'));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.MsgListener = MsgListener;
|
|
100
|
+
//# sourceMappingURL=base-msg-listener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base-msg-listener.js","sourceRoot":"","sources":["../../src/events/base-msg-listener.ts"],"names":[],"mappings":";;;AAAA,sDAAkG;AAIlG,mDAA6F;AAC7F,uCAAuF;AAEvF;;;;;GAKG;AACH,MAAsB,WAA6B,SAAQ,wBAAW;IAYpE,YAAa,QAAwB;QAEnC,KAAK,EAAE,CAAC;QAPF,iBAAY,GAAmB,EAAE,CAAC;QAClC,SAAI,GAA2B,KAAK,CAAC;QAEnC,YAAO,GAAsB,CAAC,GAAG,IAAI,CAAC;QAK9C,IAAI,CAA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hID,kCAgIC"}
|
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import { NxContext } from '@nextage/nx-frame-be';
|
|
2
1
|
import { ClientProvider, Event, EventSubOptions } from './interfaces';
|
|
3
|
-
import {
|
|
2
|
+
import { Listener } from './base-listener';
|
|
4
3
|
import { JsMsg } from 'nats';
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Durable inter-service listener (JetStream): owns the per-message ack/nak/term
|
|
6
|
+
* and DLQ policy. Keep `onMessage` idempotent so redelivery is always safe.
|
|
7
|
+
*/
|
|
8
|
+
export declare abstract class NatsListener<T extends Event> extends Listener<T> {
|
|
6
9
|
private readonly provider;
|
|
7
|
-
abstract subject: T['subject'];
|
|
8
|
-
abstract queueGroupName: string;
|
|
9
10
|
abstract streamName: string;
|
|
10
11
|
private consumer?;
|
|
11
12
|
private isListening;
|
|
12
|
-
protected _incoming?: IncomingEventRef;
|
|
13
13
|
protected ackWait: number;
|
|
14
14
|
protected maxDeliver: number;
|
|
15
15
|
protected nakBackoffMs: number[];
|
|
16
16
|
abstract onMessage(data: T['data'], msg: JsMsg): Promise<void>;
|
|
17
17
|
constructor(provider: ClientProvider);
|
|
18
|
+
protected transportNameForLog(): string;
|
|
19
|
+
protected streamNameForLog(): string | undefined;
|
|
18
20
|
private get client();
|
|
19
21
|
/**
|
|
20
22
|
*
|
|
@@ -47,14 +49,6 @@ export declare abstract class NatsListener<T extends Event> {
|
|
|
47
49
|
* unreachable, so a loop is never silently lost.
|
|
48
50
|
*/
|
|
49
51
|
protected dropCascadeViolation(msg: JsMsg, reason: string): Promise<void>;
|
|
50
|
-
/**
|
|
51
|
-
* Build a child context carrying the in-flight event reference, so any event
|
|
52
|
-
* this listener republishes inherits the correlation, is marked as caused by
|
|
53
|
-
* the current event, and advances the cascade depth / visited lineage. Returns
|
|
54
|
-
* a fresh object (never mutates the shared base context). At the root — or when
|
|
55
|
-
* no event is in flight — it is just a copy of `base`.
|
|
56
|
-
*/
|
|
57
|
-
protected nextContext(base?: NxContext): EventContext;
|
|
58
52
|
/**
|
|
59
53
|
* Parks a failed message on the DLQ stream. Returns `true` on success so the
|
|
60
54
|
* caller can safely `term()` the original; returns `false` if the DLQ could
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-nats-listener.d.ts","sourceRoot":"","sources":["../../src/events/base-nats-listener.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"base-nats-listener.d.ts","sourceRoot":"","sources":["../../src/events/base-nats-listener.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,KAAK,EAAsB,eAAe,EAAE,MAAM,cAAc,CAAC;AAG1F,OAAO,EAAE,QAAQ,EAAE,MAAwD,iBAAiB,CAAC;AAE7F,OAAO,EAAY,KAAK,EAAE,MAAiD,MAAM,CAAC;AAElF;;;GAGG;AACH,8BAAsB,YAAY,CAAC,CAAC,SAAS,KAAK,CAAE,SAAQ,QAAQ,CAAC,CAAC,CAAC;IAkBxD,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAhBtC,QAAQ,CAAC,UAAU,EAAM,MAAM,CAAC;IAEhC,OAAO,CAAC,QAAQ,CAAC,CAAiB;IAClC,OAAO,CAAC,WAAW,CAAsB;IAEzC,SAAS,CAAC,OAAO,EAAQ,MAAM,CAAuB;IACtD,SAAS,CAAC,UAAU,EAAK,MAAM,CAAK;IAMpC,SAAS,CAAC,YAAY,EAAG,MAAM,EAAE,CAAuB;IAExD,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;gBAEhC,QAAQ,EAAE,cAAc;cAKnC,mBAAmB,IAAI,MAAM;cAK7B,gBAAgB,IAAI,MAAM,GAAG,SAAS;IAOzD,OAAO,KAAK,MAAM,GAGjB;IAED;;;OAGG;IACH,mBAAmB,IAAI,eAAe;IAKtC;;OAEG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAsB7B;;;;OAIG;YACW,eAAe;IAqB7B;;;;;;;;OAQG;cACa,aAAa,CAAC,GAAG,EAAE,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC;IAmDxD;;;;OAIG;cACa,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAU/E;;;;OAIG;cACa,gBAAgB,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IAyB9E;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAe3B;;;OAGG;IACH,OAAO,CAAC,eAAe;IAKvB;;OAEG;IACH,OAAO,CAAC,UAAU;IAMlB;;;;OAIG;IACH,OAAO,CAAC,MAAM;IAKd;;;;OAIG;IACH,OAAO,CAAC,YAAY;CAYrB"}
|
|
@@ -3,9 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NatsListener = void 0;
|
|
4
4
|
const nx_frame_be_1 = require("@nextage/nx-frame-be");
|
|
5
5
|
const dlq_constants_1 = require("./types/dlq.constants");
|
|
6
|
+
const base_listener_1 = require("./base-listener");
|
|
6
7
|
const cascade_1 = require("./cascade");
|
|
7
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Durable inter-service listener (JetStream): owns the per-message ack/nak/term
|
|
10
|
+
* and DLQ policy. Keep `onMessage` idempotent so redelivery is always safe.
|
|
11
|
+
*/
|
|
12
|
+
class NatsListener extends base_listener_1.Listener {
|
|
8
13
|
constructor(provider) {
|
|
14
|
+
super();
|
|
9
15
|
this.provider = provider;
|
|
10
16
|
this.isListening = false;
|
|
11
17
|
this.ackWait = 30 * 1000 * 1000000; // 30 secondi in nanosecondi;
|
|
@@ -16,6 +22,12 @@ class NatsListener {
|
|
|
16
22
|
// maxDeliver = 3).
|
|
17
23
|
this.nakBackoffMs = [1000, 5000, 15000];
|
|
18
24
|
}
|
|
25
|
+
transportNameForLog() {
|
|
26
|
+
return 'NATS';
|
|
27
|
+
}
|
|
28
|
+
streamNameForLog() {
|
|
29
|
+
return this.streamName;
|
|
30
|
+
}
|
|
19
31
|
// Resolve the client only at listen/DLQ/stop time, so the transport may be
|
|
20
32
|
// connected AFTER this listener is constructed (finding B8).
|
|
21
33
|
get client() {
|
|
@@ -128,16 +140,6 @@ class NatsListener {
|
|
|
128
140
|
else
|
|
129
141
|
msg.nak(this.backoffFor(this.deliveryAttempt(msg)));
|
|
130
142
|
}
|
|
131
|
-
/**
|
|
132
|
-
* Build a child context carrying the in-flight event reference, so any event
|
|
133
|
-
* this listener republishes inherits the correlation, is marked as caused by
|
|
134
|
-
* the current event, and advances the cascade depth / visited lineage. Returns
|
|
135
|
-
* a fresh object (never mutates the shared base context). At the root — or when
|
|
136
|
-
* no event is in flight — it is just a copy of `base`.
|
|
137
|
-
*/
|
|
138
|
-
nextContext(base = {}) {
|
|
139
|
-
return this._incoming ? { ...base, _event: this._incoming } : { ...base };
|
|
140
|
-
}
|
|
141
143
|
/**
|
|
142
144
|
* Parks a failed message on the DLQ stream. Returns `true` on success so the
|
|
143
145
|
* caller can safely `term()` the original; returns `false` if the DLQ could
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-nats-listener.js","sourceRoot":"","sources":["../../src/events/base-nats-listener.ts"],"names":[],"mappings":";;;AAAA,sDAAkG;AAElG,yDAAmG;
|
|
1
|
+
{"version":3,"file":"base-nats-listener.js","sourceRoot":"","sources":["../../src/events/base-nats-listener.ts"],"names":[],"mappings":";;;AAAA,sDAAkG;AAElG,yDAAmG;AAEnG,mDAA6F;AAC7F,uCAAuF;AAGvF;;;GAGG;AACH,MAAsB,YAA8B,SAAQ,wBAAW;IAkBrE,YAA8B,QAAwB;QAEpD,KAAK,EAAE,CAAC;QAFoB,aAAQ,GAAR,QAAQ,CAAgB;QAb9C,gBAAW,GAAgB,KAAK,CAAC;QAE/B,YA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K,CAAC,iCAAiC,IAAI,CAAC,OAAO,OAAO,EAAE,KAAK,CAAC,CAAC;YAC9E,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;QAC5C,CAAC;IACH,CAAC;CACF;AA7QD,oCA6QC"}
|
package/build/events/index.d.ts
CHANGED
|
@@ -13,6 +13,8 @@ export * from './access-revoked-publisher';
|
|
|
13
13
|
export * from './msg-client-manager';
|
|
14
14
|
export * from './msg-wrapper';
|
|
15
15
|
export * from './base-listener';
|
|
16
|
+
export * from './base-listener.interfaces';
|
|
17
|
+
export * from './base-msg-listener';
|
|
16
18
|
export * from './base-publisher';
|
|
17
19
|
export * from './nats-client-manager';
|
|
18
20
|
export * from './nats-wrapper';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AAExB,cAAc,yBAAyB,CAAC;AACxC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,4BAA4B,CAAC;AAG3C,cAAc,sBAAsB,CAAC;AACrC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AAGjC,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAG9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,QAAQ,CAAC;AAGvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cA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c,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,iBAAiB,CAAC;AAGhC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AAGjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC"}
|
package/build/events/index.js
CHANGED
|
@@ -30,6 +30,8 @@ __exportStar(require("./access-revoked-publisher"), exports);
|
|
|
30
30
|
__exportStar(require("./msg-client-manager"), exports);
|
|
31
31
|
__exportStar(require("./msg-wrapper"), exports);
|
|
32
32
|
__exportStar(require("./base-listener"), exports);
|
|
33
|
+
__exportStar(require("./base-listener.interfaces"), exports);
|
|
34
|
+
__exportStar(require("./base-msg-listener"), exports);
|
|
33
35
|
__exportStar(require("./base-publisher"), exports);
|
|
34
36
|
// messages on nats
|
|
35
37
|
__exportStar(require("./nats-client-manager"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,+CAA6B;AAC7B,0CAAwB;AAExB,0DAAwC;AACxC,4CAA0B;AAC1B,gDAA8B;AAC9B,8CAA4B;AAC5B,2CAAyB;AACzB,uDAAqC;AACrC,wDAAsC;AACtC,wDAAsC;AACtC,6DAA2C;AAE3C,qBAAqB;AACrB,uDAAqC;AACrC,gDAA8B;AAC9B,kDAAgC;AAChC,mDAAiC;AAEjC,mBAAmB;AACnB,wDAAsC;AACtC,iDAA+B;AAC/B,uDAAqC;AACrC,wDAAsC;AACtC,gDAA8B;AA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6B;AAE7B,kBAAkB;AAClB,mCAAmC;AAEnC,cAAc"}
|