@xemahq/realtime-stream 0.1.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.
Files changed (63) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +67 -0
  3. package/dist/index.d.ts +15 -0
  4. package/dist/index.d.ts.map +1 -0
  5. package/dist/index.js +31 -0
  6. package/dist/index.js.map +1 -0
  7. package/dist/lib/cached-membership-resolver.d.ts +25 -0
  8. package/dist/lib/cached-membership-resolver.d.ts.map +1 -0
  9. package/dist/lib/cached-membership-resolver.js +69 -0
  10. package/dist/lib/cached-membership-resolver.js.map +1 -0
  11. package/dist/lib/connection-lifecycle.d.ts +14 -0
  12. package/dist/lib/connection-lifecycle.d.ts.map +1 -0
  13. package/dist/lib/connection-lifecycle.js +3 -0
  14. package/dist/lib/connection-lifecycle.js.map +1 -0
  15. package/dist/lib/control-frame.d.ts +54 -0
  16. package/dist/lib/control-frame.d.ts.map +1 -0
  17. package/dist/lib/control-frame.js +14 -0
  18. package/dist/lib/control-frame.js.map +1 -0
  19. package/dist/lib/cursor.d.ts +11 -0
  20. package/dist/lib/cursor.d.ts.map +1 -0
  21. package/dist/lib/cursor.js +101 -0
  22. package/dist/lib/cursor.js.map +1 -0
  23. package/dist/lib/default-hub-stream-source.d.ts +9 -0
  24. package/dist/lib/default-hub-stream-source.d.ts.map +1 -0
  25. package/dist/lib/default-hub-stream-source.js +43 -0
  26. package/dist/lib/default-hub-stream-source.js.map +1 -0
  27. package/dist/lib/frame-authz.d.ts +17 -0
  28. package/dist/lib/frame-authz.d.ts.map +1 -0
  29. package/dist/lib/frame-authz.js +49 -0
  30. package/dist/lib/frame-authz.js.map +1 -0
  31. package/dist/lib/hub-stream-source.d.ts +4 -0
  32. package/dist/lib/hub-stream-source.d.ts.map +1 -0
  33. package/dist/lib/hub-stream-source.js +3 -0
  34. package/dist/lib/hub-stream-source.js.map +1 -0
  35. package/dist/lib/membership-resolver.d.ts +15 -0
  36. package/dist/lib/membership-resolver.d.ts.map +1 -0
  37. package/dist/lib/membership-resolver.js +13 -0
  38. package/dist/lib/membership-resolver.js.map +1 -0
  39. package/dist/lib/module-options.d.ts +17 -0
  40. package/dist/lib/module-options.d.ts.map +1 -0
  41. package/dist/lib/module-options.js +3 -0
  42. package/dist/lib/module-options.js.map +1 -0
  43. package/dist/lib/realtime-fanout.service.d.ts +57 -0
  44. package/dist/lib/realtime-fanout.service.d.ts.map +1 -0
  45. package/dist/lib/realtime-fanout.service.js +384 -0
  46. package/dist/lib/realtime-fanout.service.js.map +1 -0
  47. package/dist/lib/realtime-stream.controller.d.ts +19 -0
  48. package/dist/lib/realtime-stream.controller.d.ts.map +1 -0
  49. package/dist/lib/realtime-stream.controller.js +185 -0
  50. package/dist/lib/realtime-stream.controller.js.map +1 -0
  51. package/dist/lib/realtime-stream.module.d.ts +14 -0
  52. package/dist/lib/realtime-stream.module.d.ts.map +1 -0
  53. package/dist/lib/realtime-stream.module.js +80 -0
  54. package/dist/lib/realtime-stream.module.js.map +1 -0
  55. package/dist/lib/role-based-fetcher.d.ts +14 -0
  56. package/dist/lib/role-based-fetcher.d.ts.map +1 -0
  57. package/dist/lib/role-based-fetcher.js +23 -0
  58. package/dist/lib/role-based-fetcher.js.map +1 -0
  59. package/dist/lib/tokens.d.ts +5 -0
  60. package/dist/lib/tokens.d.ts.map +1 -0
  61. package/dist/lib/tokens.js +8 -0
  62. package/dist/lib/tokens.js.map +1 -0
  63. package/package.json +59 -0
@@ -0,0 +1,384 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ var RealtimeFanoutService_1;
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.RealtimeFanoutService = void 0;
17
+ const node_crypto_1 = require("node:crypto");
18
+ const node_os_1 = require("node:os");
19
+ const common_1 = require("@nestjs/common");
20
+ const rxjs_1 = require("rxjs");
21
+ const control_frame_1 = require("./control-frame");
22
+ const frame_authz_1 = require("./frame-authz");
23
+ const tokens_1 = require("./tokens");
24
+ let RealtimeFanoutService = RealtimeFanoutService_1 = class RealtimeFanoutService {
25
+ options;
26
+ membership;
27
+ hubSource;
28
+ logger = new common_1.Logger(RealtimeFanoutService_1.name);
29
+ connections = new Map();
30
+ heartbeatIntervalMs;
31
+ maxConnections;
32
+ podId;
33
+ lifecycleListener;
34
+ heartbeatTimer = null;
35
+ stopHubSource = null;
36
+ constructor(options, membership, hubSource) {
37
+ this.options = options;
38
+ this.membership = membership;
39
+ this.hubSource = hubSource;
40
+ this.heartbeatIntervalMs = options.heartbeatIntervalMs ?? 15_000;
41
+ this.maxConnections = options.maxConnectionsPerPod ?? 5_000;
42
+ this.podId = options.podId ?? `${(0, node_os_1.hostname)?.() ?? 'pod'}-${process.pid}`;
43
+ this.lifecycleListener = options.connectionLifecycleListener;
44
+ }
45
+ async onModuleInit() {
46
+ this.heartbeatTimer = setInterval(() => this.broadcastHeartbeat(), this.heartbeatIntervalMs);
47
+ const initial = this.options.initialFromGlobalSeq ?? '0';
48
+ this.stopHubSource = await this.hubSource.open(initial, (env) => this.onUpstreamEnvelope(env), () => this.onUpstreamResync(), (err) => this.onUpstreamError(err));
49
+ this.logger.log({
50
+ message: 'RealtimeFanoutService started',
51
+ podId: this.podId,
52
+ heartbeatIntervalMs: this.heartbeatIntervalMs,
53
+ maxConnections: this.maxConnections,
54
+ initialCursor: initial,
55
+ });
56
+ }
57
+ onModuleDestroy() {
58
+ if (this.heartbeatTimer) {
59
+ clearInterval(this.heartbeatTimer);
60
+ this.heartbeatTimer = null;
61
+ }
62
+ if (this.stopHubSource) {
63
+ try {
64
+ this.stopHubSource();
65
+ }
66
+ catch (err) {
67
+ this.logger.warn({
68
+ message: 'hub-source stop hook threw',
69
+ error: err instanceof Error ? err.message : String(err),
70
+ });
71
+ }
72
+ this.stopHubSource = null;
73
+ }
74
+ for (const conn of this.connections.values()) {
75
+ this.emitControl(conn, {
76
+ type: control_frame_1.ControlFrameType.GOODBYE,
77
+ reason: 'shutdown',
78
+ });
79
+ conn.subject.complete();
80
+ }
81
+ this.connections.clear();
82
+ }
83
+ openConnection(input) {
84
+ if (this.connections.size >= this.maxConnections) {
85
+ throw new common_1.ServiceUnavailableException(`Pod ${this.podId} at max realtime connections (${this.maxConnections}).`);
86
+ }
87
+ const id = (0, node_crypto_1.randomUUID)();
88
+ const subject = new rxjs_1.Subject();
89
+ const record = {
90
+ id,
91
+ caller: input.caller,
92
+ subject,
93
+ projectSubs: new Map(),
94
+ sessionSubs: new Map(),
95
+ mode: input.mode,
96
+ ...(input.dedicatedSessionId !== undefined
97
+ ? { dedicatedSessionId: input.dedicatedSessionId }
98
+ : {}),
99
+ cursors: { ...input.initialCursors },
100
+ };
101
+ this.connections.set(id, record);
102
+ const stream = new rxjs_1.Observable((sub) => {
103
+ this.emitConnected(record, sub);
104
+ const inner = subject.subscribe({
105
+ next: (frame) => sub.next(frame),
106
+ complete: () => sub.complete(),
107
+ error: (err) => sub.error(err),
108
+ });
109
+ return () => {
110
+ inner.unsubscribe();
111
+ this.closeConnection(id);
112
+ };
113
+ });
114
+ this.logger.debug({
115
+ message: 'connection opened',
116
+ connectionId: id,
117
+ orgId: input.caller.orgId,
118
+ userId: input.caller.userId,
119
+ mode: input.mode,
120
+ ...(input.dedicatedSessionId !== undefined
121
+ ? { dedicatedSessionId: input.dedicatedSessionId }
122
+ : {}),
123
+ });
124
+ this.fireLifecycle('onOpen', record);
125
+ return { connectionId: id, stream };
126
+ }
127
+ closeConnection(connectionId) {
128
+ const record = this.connections.get(connectionId);
129
+ if (!record)
130
+ return;
131
+ this.connections.delete(connectionId);
132
+ record.subject.complete();
133
+ this.fireLifecycle('onClose', record);
134
+ }
135
+ async addSubscription(connectionId, scope) {
136
+ const conn = this.connections.get(connectionId);
137
+ if (!conn) {
138
+ throw new Error(`No connection ${connectionId}.`);
139
+ }
140
+ if (conn.mode !== 'unified') {
141
+ throw new Error('Scope subscriptions are only valid on the unified stream.');
142
+ }
143
+ if (scope.kind === 'project') {
144
+ const ok = await this.membership.hasProjectAccess(conn.caller, scope.id);
145
+ if (!ok) {
146
+ this.emitControl(conn, {
147
+ type: control_frame_1.ControlFrameType.SCOPE_DENIED,
148
+ scope,
149
+ reason: 'no-project-access',
150
+ });
151
+ throw new Error(`Caller lacks project access for ${scope.id}.`);
152
+ }
153
+ conn.projectSubs.set(scope.id, true);
154
+ }
155
+ else {
156
+ const ok = await this.membership.hasSessionAccess(conn.caller, scope.id);
157
+ if (!ok) {
158
+ this.emitControl(conn, {
159
+ type: control_frame_1.ControlFrameType.SCOPE_DENIED,
160
+ scope,
161
+ reason: 'no-session-access',
162
+ });
163
+ throw new Error(`Caller lacks session access for ${scope.id}.`);
164
+ }
165
+ conn.sessionSubs.set(scope.id, true);
166
+ }
167
+ const cursor = this.cursorForScope(conn.cursors, scope) ?? '0';
168
+ this.emitControl(conn, {
169
+ type: control_frame_1.ControlFrameType.SUBSCRIBED,
170
+ scope,
171
+ cursor,
172
+ });
173
+ }
174
+ removeSubscription(connectionId, scope) {
175
+ const conn = this.connections.get(connectionId);
176
+ if (!conn)
177
+ return;
178
+ if (scope.kind === 'project') {
179
+ conn.projectSubs.delete(scope.id);
180
+ }
181
+ else {
182
+ conn.sessionSubs.delete(scope.id);
183
+ }
184
+ this.emitControl(conn, {
185
+ type: control_frame_1.ControlFrameType.UNSUBSCRIBED,
186
+ scope,
187
+ });
188
+ }
189
+ onUpstreamEnvelope(envelope) {
190
+ const env = envelope;
191
+ if (!env.ehorgid || !env.ehvisibility || !env.type)
192
+ return;
193
+ for (const conn of this.connections.values()) {
194
+ if (env.ehorgid !== conn.caller.orgId)
195
+ continue;
196
+ const sessionId = (0, frame_authz_1.sessionIdFromSubject)(env.subject);
197
+ if (conn.mode === 'session') {
198
+ if (!conn.dedicatedSessionId || sessionId !== conn.dedicatedSessionId) {
199
+ continue;
200
+ }
201
+ if (env.ehvisibility !== 'user' && env.ehvisibility !== 'project') {
202
+ continue;
203
+ }
204
+ if (env.ehvisibility === 'user' &&
205
+ env.ehuserid !== conn.caller.userId) {
206
+ continue;
207
+ }
208
+ this.deliverEnvelope(conn, env);
209
+ continue;
210
+ }
211
+ const hasProject = env.ehprojectid !== undefined &&
212
+ conn.projectSubs.has(env.ehprojectid);
213
+ const hasSession = sessionId !== null && conn.sessionSubs.has(sessionId);
214
+ const activeSessions = Array.from(conn.sessionSubs.keys());
215
+ const allowed = (0, frame_authz_1.envelopeAuthorizedForCaller)(env, conn.caller, { hasProject, hasSession }, activeSessions);
216
+ if (!allowed)
217
+ continue;
218
+ this.deliverEnvelope(conn, env);
219
+ }
220
+ }
221
+ onUpstreamResync() {
222
+ for (const conn of this.connections.values()) {
223
+ this.emitControl(conn, {
224
+ type: control_frame_1.ControlFrameType.RESYNC,
225
+ reason: 'hub-window-exceeded',
226
+ });
227
+ conn.subject.complete();
228
+ }
229
+ this.connections.clear();
230
+ }
231
+ onUpstreamError(err) {
232
+ this.logger.error({
233
+ message: 'Upstream event-hub SSE terminated mid-flight — fan-out cannot continue; shutting down for k8s restart',
234
+ error: err.message,
235
+ activeConnections: this.connections.size,
236
+ });
237
+ for (const conn of this.connections.values()) {
238
+ this.emitControl(conn, {
239
+ type: control_frame_1.ControlFrameType.GOODBYE,
240
+ reason: 'upstream-failure',
241
+ });
242
+ conn.subject.complete();
243
+ }
244
+ this.connections.clear();
245
+ setImmediate(() => {
246
+ process.exit(1);
247
+ });
248
+ }
249
+ deliverEnvelope(conn, env) {
250
+ advanceCursors(conn, env);
251
+ const seq = env.ehglobalseq;
252
+ const id = typeof seq === 'string' ? seq : undefined;
253
+ conn.subject.next({
254
+ type: 'message',
255
+ ...(id !== undefined ? { id } : {}),
256
+ data: env,
257
+ });
258
+ }
259
+ emitConnected(conn, sub) {
260
+ sub.next({
261
+ type: control_frame_1.ControlFrameType.CONNECTED,
262
+ data: {
263
+ type: control_frame_1.ControlFrameType.CONNECTED,
264
+ connectionId: conn.id,
265
+ serverTime: new Date().toISOString(),
266
+ cursors: conn.cursors,
267
+ },
268
+ });
269
+ }
270
+ emitControl(conn, frame) {
271
+ conn.subject.next({ type: frame.type, data: frame });
272
+ }
273
+ broadcastHeartbeat() {
274
+ if (this.connections.size === 0)
275
+ return;
276
+ const data = {
277
+ type: control_frame_1.ControlFrameType.HEARTBEAT,
278
+ serverTime: new Date().toISOString(),
279
+ };
280
+ for (const conn of this.connections.values()) {
281
+ conn.subject.next({ type: control_frame_1.ControlFrameType.HEARTBEAT, data });
282
+ this.fireLifecycle('onHeartbeat', conn);
283
+ }
284
+ }
285
+ fireLifecycle(hook, record) {
286
+ const listener = this.lifecycleListener;
287
+ if (!listener)
288
+ return;
289
+ const fn = listener[hook];
290
+ if (!fn)
291
+ return;
292
+ const event = {
293
+ connectionId: record.id,
294
+ caller: record.caller,
295
+ podId: this.podId,
296
+ mode: record.mode,
297
+ ...(record.dedicatedSessionId !== undefined
298
+ ? { dedicatedSessionId: record.dedicatedSessionId }
299
+ : {}),
300
+ };
301
+ try {
302
+ const ret = fn.call(listener, event);
303
+ if (ret && typeof ret.then === 'function') {
304
+ ret.catch((err) => {
305
+ this.logger.warn({
306
+ message: `connection-lifecycle ${hook} listener rejected`,
307
+ connectionId: record.id,
308
+ error: err instanceof Error ? err.message : String(err),
309
+ });
310
+ });
311
+ }
312
+ }
313
+ catch (err) {
314
+ this.logger.warn({
315
+ message: `connection-lifecycle ${hook} listener threw`,
316
+ connectionId: record.id,
317
+ error: err instanceof Error ? err.message : String(err),
318
+ });
319
+ }
320
+ }
321
+ cursorForScope(cursors, scope) {
322
+ if (scope.kind === 'project') {
323
+ return cursors.project?.[scope.id];
324
+ }
325
+ return cursors.session?.[scope.id];
326
+ }
327
+ stats() {
328
+ return {
329
+ podId: this.podId,
330
+ totalConnections: this.connections.size,
331
+ maxConnections: this.maxConnections,
332
+ };
333
+ }
334
+ };
335
+ exports.RealtimeFanoutService = RealtimeFanoutService;
336
+ exports.RealtimeFanoutService = RealtimeFanoutService = RealtimeFanoutService_1 = __decorate([
337
+ (0, common_1.Injectable)(),
338
+ __param(0, (0, common_1.Inject)(tokens_1.REALTIME_STREAM_OPTIONS)),
339
+ __param(1, (0, common_1.Inject)(tokens_1.MEMBERSHIP_RESOLVER)),
340
+ __param(2, (0, common_1.Inject)(tokens_1.HUB_STREAM_SOURCE)),
341
+ __metadata("design:paramtypes", [Object, Object, Object])
342
+ ], RealtimeFanoutService);
343
+ function advanceCursors(conn, env) {
344
+ const e = env;
345
+ const g = e['ehglobalseq'];
346
+ if (typeof g === 'string') {
347
+ if (compareNumeric(g, conn.cursors.global) > 0) {
348
+ conn.cursors = { ...conn.cursors, global: g };
349
+ }
350
+ }
351
+ const o = e['ehorgseq'];
352
+ if (typeof o === 'string') {
353
+ if (conn.cursors.org === undefined ||
354
+ compareNumeric(o, conn.cursors.org) > 0) {
355
+ conn.cursors = { ...conn.cursors, org: o };
356
+ }
357
+ }
358
+ if (env.ehprojectid && typeof e['ehprojectseq'] === 'string') {
359
+ const pid = env.ehprojectid;
360
+ const seq = e['ehprojectseq'];
361
+ const map = { ...(conn.cursors.project ?? {}) };
362
+ if (!map[pid] || compareNumeric(seq, map[pid]) > 0) {
363
+ map[pid] = seq;
364
+ conn.cursors = { ...conn.cursors, project: map };
365
+ }
366
+ }
367
+ const sessionId = (0, frame_authz_1.sessionIdFromSubject)(env.subject);
368
+ if (sessionId !== null && typeof e['ehsessionseq'] === 'string') {
369
+ const seq = e['ehsessionseq'];
370
+ const map = { ...(conn.cursors.session ?? {}) };
371
+ if (!map[sessionId] || compareNumeric(seq, map[sessionId]) > 0) {
372
+ map[sessionId] = seq;
373
+ conn.cursors = { ...conn.cursors, session: map };
374
+ }
375
+ }
376
+ }
377
+ function compareNumeric(a, b) {
378
+ if (a.length !== b.length)
379
+ return a.length - b.length;
380
+ if (a === b)
381
+ return 0;
382
+ return a < b ? -1 : 1;
383
+ }
384
+ //# sourceMappingURL=realtime-fanout.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime-fanout.service.js","sourceRoot":"","sources":["../../src/lib/realtime-fanout.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAAyC;AACzC,qCAAmC;AACnC,2CAAwH;AACxH,+BAA4D;AAK5D,mDAAgG;AAChG,+CAIuB;AAIvB,qCAIkB;AAwCX,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IAWoB;IACJ;IACF;IAZ7B,MAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAChD,WAAW,GAAG,IAAI,GAAG,EAA4B,CAAC;IAClD,mBAAmB,CAAS;IAC5B,cAAc,CAAS;IACvB,KAAK,CAAS;IACd,iBAAiB,CAA0C;IACpE,cAAc,GAA0C,IAAI,CAAC;IAC7D,aAAa,GAAwB,IAAI,CAAC;IAElD,YACoD,OAAoC,EACxC,UAA8B,EAChC,SAA0B;QAFpB,YAAO,GAAP,OAAO,CAA6B;QACxC,eAAU,GAAV,UAAU,CAAoB;QAChC,cAAS,GAAT,SAAS,CAAiB;QAEtE,IAAI,CAAC,mBAAmB,GAAG,OAAO,CAAC,mBAAmB,IAAI,MAAM,CAAC;QACjE,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,oBAAoB,IAAI,KA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GAAG,IAAA,kCAAoB,EAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACpD,IAAI,SAAS,KAAK,IAAI,IAAI,OAAO,CAAC,CAAC,cAAc,CAAC,KAAK,QAAQ,EAAE,CAAC;QAChE,MAAM,GAAG,GAAG,CAAC,CAAC,cAAc,CAAW,CAAC;QACxC,MAAM,GAAG,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;QAChD,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,cAAc,CAAC,GAAG,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/D,GAAG,CAAC,SAAS,CAAC,GAAG,GAAG,CAAC;YACrB,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;QACnD,CAAC;IACH,CAAC;AACH,CAAC;AAMD,SAAS,cAAc,CAAC,CAAS,EAAE,CAAS;IAC1C,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,MAAM;QAAE,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACtD,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACtB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxB,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type MessageEvent } from '@nestjs/common';
2
+ import { type Observable } from 'rxjs';
3
+ import type { CallerIdentityExtractor, RealtimeStreamModuleOptions } from './module-options';
4
+ import { RealtimeFanoutService } from './realtime-fanout.service';
5
+ declare class SubscriptionRequestDto {
6
+ scope: 'project' | 'session';
7
+ id: string;
8
+ }
9
+ export declare class RealtimeStreamController {
10
+ private readonly identityExtractor;
11
+ private readonly fanout;
12
+ constructor(_options: RealtimeStreamModuleOptions, identityExtractor: CallerIdentityExtractor, fanout: RealtimeFanoutService);
13
+ stream(req: unknown, lastEventId: string | undefined): Observable<MessageEvent>;
14
+ subscribe(connectionId: string, body: SubscriptionRequestDto): Promise<void>;
15
+ unsubscribe(connectionId: string, scopeKind: string, scopeId: string): void;
16
+ sessionStream(sessionId: string, req: unknown, lastEventId: string | undefined): Observable<MessageEvent>;
17
+ }
18
+ export {};
19
+ //# sourceMappingURL=realtime-stream.controller.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime-stream.controller.d.ts","sourceRoot":"","sources":["../../src/lib/realtime-stream.controller.ts"],"names":[],"mappings":"AAAA,OAAO,EAcL,KAAK,YAAY,EAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAY,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAKjD,OAAO,KAAK,EACV,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,kBAAkB,CAAC;AAK1B,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAOlE,cAAM,sBAAsB;IAG1B,KAAK,EAAG,SAAS,GAAG,SAAS,CAAC;IAI9B,EAAE,EAAG,MAAM,CAAC;CACb;AAMD,qBAGa,wBAAwB;IASjC,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAHU,QAAQ,EAAE,2BAA2B,EAErD,iBAAiB,EAAE,uBAAuB,EAC1C,MAAM,EAAE,qBAAqB;IAahD,MAAM,CACG,GAAG,EAAE,OAAO,EACO,WAAW,EAAE,MAAM,GAAG,SAAS,GACxD,UAAU,CAAC,YAAY,CAAC;IAkBrB,SAAS,CACU,YAAY,EAAE,MAAM,EACnC,IAAI,EAAE,sBAAsB,GACnC,OAAO,CAAC,IAAI,CAAC;IAiBhB,WAAW,CACc,YAAY,EAAE,MAAM,EACvB,SAAS,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,GAChC,IAAI;IAmBP,aAAa,CACS,SAAS,EAAE,MAAM,EAC9B,GAAG,EAAE,OAAO,EACO,WAAW,EAAE,MAAM,GAAG,SAAS,GACxD,UAAU,CAAC,YAAY,CAAC;CA2B5B"}
@@ -0,0 +1,185 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ var __metadata = (this && this.__metadata) || function (k, v) {
9
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
10
+ };
11
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
12
+ return function (target, key) { decorator(target, key, paramIndex); }
13
+ };
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.RealtimeStreamController = void 0;
16
+ const common_1 = require("@nestjs/common");
17
+ const swagger_1 = require("@nestjs/swagger");
18
+ const class_validator_1 = require("class-validator");
19
+ const rxjs_1 = require("rxjs");
20
+ const operators_1 = require("rxjs/operators");
21
+ const cursor_1 = require("./cursor");
22
+ const frame_authz_1 = require("./frame-authz");
23
+ const tokens_1 = require("./tokens");
24
+ const realtime_fanout_service_1 = require("./realtime-fanout.service");
25
+ var ScopeKind;
26
+ (function (ScopeKind) {
27
+ ScopeKind["project"] = "project";
28
+ ScopeKind["session"] = "session";
29
+ })(ScopeKind || (ScopeKind = {}));
30
+ class SubscriptionRequestDto {
31
+ scope;
32
+ id;
33
+ }
34
+ __decorate([
35
+ (0, swagger_1.ApiProperty)({ enum: ScopeKind, description: 'Scope kind to subscribe to' }),
36
+ (0, class_validator_1.IsEnum)(ScopeKind),
37
+ __metadata("design:type", String)
38
+ ], SubscriptionRequestDto.prototype, "scope", void 0);
39
+ __decorate([
40
+ (0, swagger_1.ApiProperty)({ description: 'Scope resource id' }),
41
+ (0, class_validator_1.IsString)(),
42
+ __metadata("design:type", String)
43
+ ], SubscriptionRequestDto.prototype, "id", void 0);
44
+ let RealtimeStreamController = class RealtimeStreamController {
45
+ identityExtractor;
46
+ fanout;
47
+ constructor(_options, identityExtractor, fanout) {
48
+ this.identityExtractor = identityExtractor;
49
+ this.fanout = fanout;
50
+ }
51
+ stream(req, lastEventId) {
52
+ const caller = this.identityExtractor.fromRequest(req);
53
+ const cursors = (0, cursor_1.parseCursorMap)(lastEventId);
54
+ const { stream } = this.fanout.openConnection({
55
+ caller,
56
+ initialCursors: cursors,
57
+ mode: 'unified',
58
+ });
59
+ return stream.pipe((0, operators_1.map)(toMessageEvent));
60
+ }
61
+ async subscribe(connectionId, body) {
62
+ const scope = validateScope(body);
63
+ try {
64
+ await this.fanout.addSubscription(connectionId, scope);
65
+ }
66
+ catch (err) {
67
+ throw new common_1.ForbiddenException(err instanceof Error ? err.message : 'Subscription denied');
68
+ }
69
+ }
70
+ unsubscribe(connectionId, scopeKind, scopeId) {
71
+ if (scopeKind !== 'project' && scopeKind !== 'session') {
72
+ throw new common_1.BadRequestException(`Unknown scope kind '${scopeKind}'.`);
73
+ }
74
+ this.fanout.removeSubscription(connectionId, {
75
+ kind: scopeKind,
76
+ id: scopeId,
77
+ });
78
+ }
79
+ sessionStream(sessionId, req, lastEventId) {
80
+ const caller = this.identityExtractor.fromRequest(req);
81
+ const cursors = (0, cursor_1.parseCursorMap)(lastEventId);
82
+ return (0, rxjs_1.from)(this.fanout['membership'].hasSessionAccess(caller, sessionId)).pipe((0, operators_1.switchMap)((ok) => {
83
+ if (!ok) {
84
+ throw new common_1.ForbiddenException(`Caller lacks session access for ${sessionId}.`);
85
+ }
86
+ const { stream } = this.fanout.openConnection({
87
+ caller,
88
+ initialCursors: cursors,
89
+ mode: 'session',
90
+ dedicatedSessionId: sessionId,
91
+ });
92
+ return stream;
93
+ }), (0, operators_1.map)(toMessageEvent), (0, operators_1.catchError)((err) => {
94
+ const message = err instanceof Error ? err.message : String(err);
95
+ return (0, rxjs_1.of)({ type: 'error', data: { message } });
96
+ }));
97
+ }
98
+ };
99
+ exports.RealtimeStreamController = RealtimeStreamController;
100
+ __decorate([
101
+ (0, common_1.Sse)('stream'),
102
+ (0, swagger_1.ApiOperation)({
103
+ operationId: 'realtime_stream',
104
+ summary: 'Open the unified realtime SSE channel',
105
+ description: 'Server-Sent Events channel delivering CloudEvents envelopes for ' +
106
+ 'org-broadcast and project events the caller is a member of. ' +
107
+ 'Honors `Last-Event-ID` (JSON multi-scope cursor). Open scope ' +
108
+ 'subscriptions via POST /realtime/streams/:cid/subscriptions.',
109
+ }),
110
+ __param(0, (0, common_1.Req)()),
111
+ __param(1, (0, common_1.Headers)('last-event-id')),
112
+ __metadata("design:type", Function),
113
+ __metadata("design:paramtypes", [Object, Object]),
114
+ __metadata("design:returntype", Function)
115
+ ], RealtimeStreamController.prototype, "stream", null);
116
+ __decorate([
117
+ (0, common_1.Post)('streams/:connectionId/subscriptions'),
118
+ (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
119
+ (0, swagger_1.ApiOperation)({
120
+ operationId: 'realtime_subscribe_scope',
121
+ summary: 'Subscribe a unified-stream connection to a scope',
122
+ }),
123
+ (0, swagger_1.ApiBody)({ type: SubscriptionRequestDto }),
124
+ __param(0, (0, common_1.Param)('connectionId')),
125
+ __param(1, (0, common_1.Body)()),
126
+ __metadata("design:type", Function),
127
+ __metadata("design:paramtypes", [String, SubscriptionRequestDto]),
128
+ __metadata("design:returntype", Promise)
129
+ ], RealtimeStreamController.prototype, "subscribe", null);
130
+ __decorate([
131
+ (0, common_1.Delete)('streams/:connectionId/subscriptions/:scopeKind/:scopeId'),
132
+ (0, common_1.HttpCode)(common_1.HttpStatus.NO_CONTENT),
133
+ (0, swagger_1.ApiOperation)({
134
+ operationId: 'realtime_unsubscribe_scope',
135
+ summary: 'Unsubscribe a unified-stream connection from a scope',
136
+ }),
137
+ __param(0, (0, common_1.Param)('connectionId')),
138
+ __param(1, (0, common_1.Param)('scopeKind')),
139
+ __param(2, (0, common_1.Param)('scopeId')),
140
+ __metadata("design:type", Function),
141
+ __metadata("design:paramtypes", [String, String, String]),
142
+ __metadata("design:returntype", void 0)
143
+ ], RealtimeStreamController.prototype, "unsubscribe", null);
144
+ __decorate([
145
+ (0, common_1.Sse)('sessions/:sessionId/stream'),
146
+ (0, swagger_1.ApiOperation)({
147
+ operationId: 'realtime_session_stream',
148
+ summary: 'Dedicated SSE for ultra-high-frequency session streams',
149
+ description: 'Escape-hatch route for token-by-token agent output and other ' +
150
+ 'extreme-bandwidth surfaces. Carries ONLY events tagged ' +
151
+ 'session/<sessionId>. Caller must have session membership.',
152
+ }),
153
+ __param(0, (0, common_1.Param)('sessionId')),
154
+ __param(1, (0, common_1.Req)()),
155
+ __param(2, (0, common_1.Headers)('last-event-id')),
156
+ __metadata("design:type", Function),
157
+ __metadata("design:paramtypes", [String, Object, Object]),
158
+ __metadata("design:returntype", Function)
159
+ ], RealtimeStreamController.prototype, "sessionStream", null);
160
+ exports.RealtimeStreamController = RealtimeStreamController = __decorate([
161
+ (0, swagger_1.ApiTags)('Realtime'),
162
+ (0, swagger_1.ApiBearerAuth)(),
163
+ (0, common_1.Controller)('realtime'),
164
+ __param(0, (0, common_1.Inject)(tokens_1.REALTIME_STREAM_OPTIONS)),
165
+ __param(1, (0, common_1.Inject)(tokens_1.CALLER_IDENTITY_EXTRACTOR)),
166
+ __metadata("design:paramtypes", [Object, Object, realtime_fanout_service_1.RealtimeFanoutService])
167
+ ], RealtimeStreamController);
168
+ function toMessageEvent(frame) {
169
+ const data = (frame.data ?? {});
170
+ if (frame.id !== undefined) {
171
+ return { type: frame.type, id: frame.id, data };
172
+ }
173
+ return { type: frame.type, data };
174
+ }
175
+ function validateScope(body) {
176
+ if (!body || (body.scope !== 'project' && body.scope !== 'session')) {
177
+ throw new common_1.BadRequestException('Subscription body must be { scope: "project"|"session", id: string }.');
178
+ }
179
+ const scope = { kind: body.scope, id: body.id };
180
+ if (!(0, frame_authz_1.isValidScopeRef)(scope)) {
181
+ throw new common_1.BadRequestException('Subscription scope id is missing or invalid.');
182
+ }
183
+ return scope;
184
+ }
185
+ //# sourceMappingURL=realtime-stream.controller.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime-stream.controller.js","sourceRoot":"","sources":["../../src/lib/realtime-stream.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAewB;AACxB,6CAA6F;AAC7F,qDAAmD;AACnD,+BAAiD;AACjD,8CAA4D;AAE5D,qCAA0C;AAC1C,+CAAgD;AAKhD,qCAGkB;AAClB,uEAAkE;AAElE,IAAK,SAGJ;AAHD,WAAK,SAAS;IACZ,gCAAmB,CAAA;IACnB,gCAAmB,CAAA;AACrB,CAAC,EAHI,SAAS,KAAT,SAAS,QAGb;AAED,MAAM,sBAAsB;IAG1B,KAAK,CAAyB;IAI9B,EAAE,CAAU;CACb;AALC;IAFC,IAAA,qBAAW,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;IAC3E,IAAA,wBAAM,EAAC,SAAS,CAAC;;qDACY;AAI9B;IAFC,IAAA,qBAAW,EAAC,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;IACjD,IAAA,0BAAQ,GAAE;;kDACC;AAUP,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAShB;IACA;IATnB,YAMmC,QAAqC,EAErD,iBAA0C,EAC1C,MAA6B;QAD7B,sBAAiB,GAAjB,iBAAiB,CAAyB;QAC1C,WAAM,GAAN,MAAM,CAAuB;IAC7C,CAAC;IAYJ,MAAM,CACG,GAAY,EACO,WAA+B;QAEzD,MAAM,MAAM,GAAG,IAAI,CAAC,iBAAiB,CAAC,WAAW,CAAC,G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A;qDAET,+CAAqB;GAVrC,wBAAwB,CAsHpC;AAED,SAAS,cAAc,CAAC,KAAmD;IACzE,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,CAAoB,CAAC;IACnD,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC;IAClD,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;AACpC,CAAC;AAED,SAAS,aAAa,CAAC,IAA4B;IACjD,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,EAAE,CAAC;QACpE,MAAM,IAAI,4BAAmB,CAC3B,uEAAuE,CACxE,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAa,EAAE,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC;IAC1D,IAAI,CAAC,IAAA,6BAAe,EAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,4BAAmB,CAAC,8CAA8C,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { DynamicModule, type ModuleMetadata, type Type } from '@nestjs/common';
2
+ import { DefaultHubStreamSource } from './default-hub-stream-source';
3
+ import type { RealtimeStreamModuleOptions } from './module-options';
4
+ export interface RealtimeStreamModuleAsyncOptions extends Pick<ModuleMetadata, 'imports'> {
5
+ inject?: any[];
6
+ useFactory: (...deps: any[]) => Promise<RealtimeStreamModuleOptions> | RealtimeStreamModuleOptions;
7
+ extraProviders?: ReadonlyArray<Type<any> | any>;
8
+ }
9
+ export declare class RealtimeStreamModule {
10
+ static forRoot(options: RealtimeStreamModuleOptions): DynamicModule;
11
+ static defaultSourceProvider(): typeof DefaultHubStreamSource;
12
+ static forRootAsync(options: RealtimeStreamModuleAsyncOptions): DynamicModule;
13
+ }
14
+ //# sourceMappingURL=realtime-stream.module.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"realtime-stream.module.d.ts","sourceRoot":"","sources":["../../src/lib/realtime-stream.module.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EAEb,KAAK,cAAc,EAEnB,KAAK,IAAI,EACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AASrE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,kBAAkB,CAAC;AAEpE,MAAM,WAAW,gCACf,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC;IAEvC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC;IAEf,UAAU,EAAE,CACV,GAAG,IAAI,EAAE,GAAG,EAAE,KACX,OAAO,CAAC,2BAA2B,CAAC,GAAG,2BAA2B,CAAC;IAExE,cAAc,CAAC,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;CACjD;AAgBD,qBACa,oBAAoB;IAC/B,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,2BAA2B,GAAG,aAAa;IAoBnE,MAAM,CAAC,qBAAqB,IAAI,OAAO,sBAAsB;IAI7D,MAAM,CAAC,YAAY,CAAC,OAAO,EAAE,gCAAgC,GAAG,aAAa;CAwC9E"}