@natsail/rxjs 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,28 @@ pnpm add rxjs @natsail/core @natsail/session @natsail/jetstream @natsail/rxjs
8
8
 
9
9
  The adapter uses the framework-neutral session registry. React and RxJS consumers can share one source without a bridge package.
10
10
 
11
- `observeNatsJetStreamSubscription()` emits full deliveries from the same keyed session that React hooks use.
11
+ `observeNatsJetStreamSubscription()` emits full deliveries from the same keyed session that React hooks use. `observeNatsJetStreamReducer()` consumes the same validated atomic state definition as `useNatsJetStreamReducer()` and exposes exact session lifecycle snapshots.
12
+
13
+ For rendering cumulative application state, prefer `observeNatsJetStreamState()`. It removes duplicate session-lifecycle notifications, emits replay and the first hydrated live state immediately, and coalesces subsequent cumulative live states to the latest value once per 16ms window:
14
+
15
+ ```ts
16
+ import { distinctUntilChanged, map } from 'rxjs'
17
+
18
+ import { observeNatsJetStreamState } from '@natsail/rxjs'
19
+
20
+ const conversation$ = observeNatsJetStreamState(sessions, conversationDefinition, {
21
+ liveBatchMs: 16,
22
+ })
23
+
24
+ const messageCount$ = conversation$.pipe(
25
+ map((snapshot) => snapshot.data.messages.length),
26
+ distinctUntilChanged()
27
+ )
28
+ ```
29
+
30
+ Every JetStream delivery is still applied serially by the validated reducer. Only cumulative state presentation is coalesced, so a slow or busy browser does not lose events. The initial history rebuild remains one atomic hydrated state instead of hundreds of partial conversation states. Set `liveBatchMs: 0` when every reduced live state must be observed. A custom RxJS scheduler may be supplied for host integration or deterministic tests.
31
+
32
+ `observeNatsSession()` and `observeNatsSessionValues()` accept validated definitions as well as the legacy key/source pair. `observeNatsSessionEvents()` adapts registry lifecycle and reference-count diagnostics into a cancellable Observable.
12
33
 
13
34
  See the [NATSail README](https://github.com/thedonmon/natsail#shared-session-adapters) for RxJS examples.
14
35
 
package/dist/index.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { Observable } from 'rxjs';
2
+ import type { SchedulerLike } from 'rxjs';
2
3
  import type { CoreSubscriptionOptions, NatsRuntime, NatsRuntimeEvent, NatsRuntimeStatusEvent } from '@natsail/core';
3
- import { type JetStreamDelivery, type JetStreamSubscriptionOptions } from '@natsail/jetstream';
4
- import type { SessionRegistry, SessionSnapshot, SessionSource } from '@natsail/session';
4
+ import { type JetStreamDelivery, type JetStreamSessionSourceOptions, type JetStreamStateSnapshot } from '@natsail/jetstream';
5
+ import type { SessionDefinition, SessionRegistryEvent, SessionRegistry, SessionSnapshot, SessionSource } from '@natsail/session';
6
+ /** Converts registry lifecycle and reference-count diagnostics into a cancellable Observable. */
7
+ export declare function observeNatsSessionEvents(registry: SessionRegistry): Observable<SessionRegistryEvent>;
5
8
  /** Converts the runtime event iterable into a cancellable Observable. */
6
9
  export declare function observeNatsRuntimeEvents(runtime: NatsRuntime): Observable<NatsRuntimeEvent>;
7
10
  /** Emits distinct runtime connection states and omits diagnostic events. */
@@ -9,13 +12,32 @@ export declare function observeNatsRuntimeStatus(runtime: NatsRuntime): Observab
9
12
  /** Emits values from one keyed, registry-shared Core NATS subscription. */
10
13
  export declare function observeNatsCoreSubscription<T>(registry: SessionRegistry, runtime: NatsRuntime, key: string, options: CoreSubscriptionOptions<T>): Observable<T>;
11
14
  /** Emits deliveries from one registry-shared checkpointed JetStream session. */
12
- export declare function observeNatsJetStreamSubscription<T>(registry: SessionRegistry, runtime: NatsRuntime, key: string, options: JetStreamSubscriptionOptions<T>): Observable<JetStreamDelivery<T>>;
15
+ export declare function observeNatsJetStreamSubscription<T>(registry: SessionRegistry, runtime: NatsRuntime, key: string, options: JetStreamSessionSourceOptions<T>): Observable<JetStreamDelivery<T>>;
16
+ /** Emits one atomic replay/live reduced state from a validated shared definition. */
17
+ export declare function observeNatsJetStreamReducer<State>(registry: SessionRegistry, definition: SessionDefinition<JetStreamStateSnapshot<State>>): Observable<SessionSnapshot<JetStreamStateSnapshot<State>>>;
18
+ export interface NatsailJetStreamStateOptions {
19
+ /**
20
+ * Maximum time that subsequent cumulative live states are coalesced. The
21
+ * initial replaying and hydrated live states remain immediate. Defaults to
22
+ * 16ms; use 0 to observe every reduced live state.
23
+ */
24
+ readonly liveBatchMs?: number;
25
+ /** Overrides the RxJS async scheduler, primarily for tests or custom hosts. */
26
+ readonly scheduler?: SchedulerLike;
27
+ }
28
+ /**
29
+ * Emits cumulative reduced JetStream state without duplicate session-lifecycle
30
+ * notifications. Replay and recovery phase changes are immediate; subsequent
31
+ * live states are coalesced to one latest value per bounded render window.
32
+ */
33
+ export declare function observeNatsJetStreamState<State>(registry: SessionRegistry, definition: SessionDefinition<JetStreamStateSnapshot<State>>, options?: NatsailJetStreamStateOptions): Observable<JetStreamStateSnapshot<State>>;
13
34
  /**
14
35
  * Creates a cold Observable over one keyed logical session.
15
36
  *
16
37
  * Every Observable subscriber acquires a registry handle. Subscribers with the
17
38
  * same registry and key share the underlying NATS source.
18
39
  */
40
+ export declare function observeNatsSession<T>(registry: SessionRegistry, definition: SessionDefinition<T>): Observable<SessionSnapshot<T>>;
19
41
  export declare function observeNatsSession<T>(registry: SessionRegistry, key: string, source: SessionSource<T>): Observable<SessionSnapshot<T>>;
20
42
  /**
21
43
  * Emits delivered values, errors on a failed session, and completes on close.
@@ -23,5 +45,6 @@ export declare function observeNatsSession<T>(registry: SessionRegistry, key: st
23
45
  * A new subscriber receives the latest value once when one exists. Equal
24
46
  * consecutive values remain distinct deliveries.
25
47
  */
48
+ export declare function observeNatsSessionValues<T>(registry: SessionRegistry, definition: SessionDefinition<T>): Observable<T>;
26
49
  export declare function observeNatsSessionValues<T>(registry: SessionRegistry, key: string, source: SessionSource<T>): Observable<T>;
27
50
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgC,UAAU,EAAE,MAAM,MAAM,CAAA;AAE/D,OAAO,KAAK,E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,UAAU,CAAC,CAAC,CAAC,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,37 @@
1
- import { distinctUntilChanged, filter, Observable } from 'rxjs';
1
+ import { asyncScheduler, distinctUntilChanged, filter, Observable } from 'rxjs';
2
2
  import { createJetStreamSessionSource, } from '@natsail/jetstream';
3
3
  import { createCoreSessionSource } from '@natsail/session';
4
+ /** Converts registry lifecycle and reference-count diagnostics into a cancellable Observable. */
5
+ export function observeNatsSessionEvents(registry) {
6
+ return new Observable((subscriber) => {
7
+ const iterator = registry.events[Symbol.asyncIterator]();
8
+ let cancelled = false;
9
+ void (async () => {
10
+ try {
11
+ while (!cancelled) {
12
+ const next = await iterator.next();
13
+ if (next.done) {
14
+ if (!cancelled)
15
+ subscriber.complete();
16
+ return;
17
+ }
18
+ subscriber.next(next.value);
19
+ }
20
+ }
21
+ catch (error) {
22
+ if (!cancelled)
23
+ subscriber.error(error);
24
+ }
25
+ finally {
26
+ await iterator.return?.();
27
+ }
28
+ })();
29
+ return () => {
30
+ cancelled = true;
31
+ void iterator.return?.();
32
+ };
33
+ });
34
+ }
4
35
  /** Converts the runtime event iterable into a cancellable Observable. */
5
36
  export function observeNatsRuntimeEvents(runtime) {
6
37
  return new Observable((subscriber) => {
@@ -44,15 +75,91 @@ export function observeNatsCoreSubscription(registry, runtime, key, options) {
44
75
  export function observeNatsJetStreamSubscription(registry, runtime, key, options) {
45
76
  return observeNatsSessionValues(registry, key, createJetStreamSessionSource(runtime, options));
46
77
  }
78
+ /** Emits one atomic replay/live reduced state from a validated shared definition. */
79
+ export function observeNatsJetStreamReducer(registry, definition) {
80
+ return observeNatsSession(registry, definition);
81
+ }
47
82
  /**
48
- * Creates a cold Observable over one keyed logical session.
49
- *
50
- * Every Observable subscriber acquires a registry handle. Subscribers with the
51
- * same registry and key share the underlying NATS source.
83
+ * Emits cumulative reduced JetStream state without duplicate session-lifecycle
84
+ * notifications. Replay and recovery phase changes are immediate; subsequent
85
+ * live states are coalesced to one latest value per bounded render window.
52
86
  */
53
- export function observeNatsSession(registry, key, source) {
87
+ export function observeNatsJetStreamState(registry, definition, options = {}) {
88
+ const liveBatchMs = options.liveBatchMs ?? 16;
89
+ if (!Number.isFinite(liveBatchMs) || liveBatchMs < 0) {
90
+ throw new TypeError('NATSail RxJS liveBatchMs must be a finite non-negative number');
91
+ }
92
+ const values = observeNatsSessionValues(registry, definition);
93
+ if (liveBatchMs === 0)
94
+ return values;
95
+ const scheduler = options.scheduler ?? asyncScheduler;
54
96
  return new Observable((subscriber) => {
55
- const handle = registry.acquire(key, source);
97
+ let seenLive = false;
98
+ let pendingLive;
99
+ let scheduledFlush;
100
+ const flush = () => {
101
+ scheduledFlush = undefined;
102
+ if (pendingLive === undefined)
103
+ return;
104
+ const value = pendingLive;
105
+ pendingLive = undefined;
106
+ subscriber.next(value);
107
+ };
108
+ const cancelFlush = () => {
109
+ scheduledFlush?.unsubscribe();
110
+ scheduledFlush = undefined;
111
+ };
112
+ const scheduleFlush = () => {
113
+ if (scheduledFlush !== undefined)
114
+ return;
115
+ let ranSynchronously = false;
116
+ const scheduled = scheduler.schedule(() => {
117
+ ranSynchronously = true;
118
+ flush();
119
+ }, liveBatchMs);
120
+ if (!ranSynchronously)
121
+ scheduledFlush = scheduled;
122
+ };
123
+ const source = values.subscribe({
124
+ next: (value) => {
125
+ if (value.phase !== 'live') {
126
+ cancelFlush();
127
+ flush();
128
+ seenLive = false;
129
+ subscriber.next(value);
130
+ return;
131
+ }
132
+ if (!seenLive) {
133
+ seenLive = true;
134
+ subscriber.next(value);
135
+ return;
136
+ }
137
+ pendingLive = value;
138
+ scheduleFlush();
139
+ },
140
+ error: (error) => {
141
+ cancelFlush();
142
+ flush();
143
+ subscriber.error(error);
144
+ },
145
+ complete: () => {
146
+ cancelFlush();
147
+ flush();
148
+ subscriber.complete();
149
+ },
150
+ });
151
+ return () => {
152
+ cancelFlush();
153
+ pendingLive = undefined;
154
+ source.unsubscribe();
155
+ };
156
+ });
157
+ }
158
+ export function observeNatsSession(registry, definitionOrKey, source) {
159
+ return new Observable((subscriber) => {
160
+ const handle = typeof definitionOrKey === 'string'
161
+ ? registry.acquire(definitionOrKey, source)
162
+ : registry.acquire(definitionOrKey);
56
163
  const emit = () => {
57
164
  const snapshot = handle.getSnapshot();
58
165
  subscriber.next(snapshot);
@@ -68,16 +175,13 @@ export function observeNatsSession(registry, key, source) {
68
175
  };
69
176
  });
70
177
  }
71
- /**
72
- * Emits delivered values, errors on a failed session, and completes on close.
73
- *
74
- * A new subscriber receives the latest value once when one exists. Equal
75
- * consecutive values remain distinct deliveries.
76
- */
77
- export function observeNatsSessionValues(registry, key, source) {
178
+ export function observeNatsSessionValues(registry, definitionOrKey, source) {
78
179
  return new Observable((subscriber) => {
79
180
  let valueRevision = -1;
80
- const subscription = observeNatsSession(registry, key, source).subscribe({
181
+ const snapshots = typeof definitionOrKey === 'string'
182
+ ? observeNatsSession(registry, definitionOrKey, source)
183
+ : observeNatsSession(registry, definitionOrKey);
184
+ const subscription = snapshots.subscribe({
81
185
  next: (snapshot) => {
82
186
  if (snapshot.valueRevision !== valueRevision &&
83
187
  Object.prototype.hasOwnProperty.call(snapshot, 'value')) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAQ/D,OAAO,EACL,4BAA4B,GAG7B,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAG1D,yEAAyE;AACzE,MAAM,UAAU,wBAAwB,CAAC,OAAoB;IAC3D,OAAO,IAAI,UAAU,CAAC,CAAC,UAAU,EAAE,EAAE;QACnC,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,EAAE,CAAA;QACvD,IAAI,SAAS,GAAG,K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"RxJS Observables for NATSail runtimes and shared sessions.",
5
5
  "keywords": [
6
6
  "nats",
@@ -38,9 +38,9 @@
38
38
  "registry": "https://registry.npmjs.org/"
39
39
  },
40
40
  "dependencies": {
41
- "@natsail/session": "^0.2.0",
42
- "@natsail/jetstream": "^0.2.0",
43
- "@natsail/core": "^0.2.0"
41
+ "@natsail/core": "^0.2.1",
42
+ "@natsail/jetstream": "^0.3.0",
43
+ "@natsail/session": "^0.3.0"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "rxjs": "^7.8.0"