@spacelr/sdk 0.10.3 → 0.10.4
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/index.d.mts +24 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.js +8 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -581,6 +581,18 @@ interface StreamSubscriptionOptions {
|
|
|
581
581
|
projectId: string;
|
|
582
582
|
collectionName: string;
|
|
583
583
|
sinceId?: string;
|
|
584
|
+
/**
|
|
585
|
+
* #685 — "replay from earliest retained". When true, a brand-new subscription
|
|
586
|
+
* (no prior cursor) replays every retained stream entry from the earliest
|
|
587
|
+
* still-retained id before going live, each entry gated by the same
|
|
588
|
+
* per-event rule check as live delivery. Lets a first-time subscriber
|
|
589
|
+
* bootstrap history for a recipient-scoped collection. Ignored on reconnect
|
|
590
|
+
* (a stored cursor resumes from the last delivered event instead) and
|
|
591
|
+
* overrides `sinceId` on the first subscription. Coverage is bounded by the
|
|
592
|
+
* stream's retention window; a truncated replay still fires `onGap` with
|
|
593
|
+
* `replay-truncated`.
|
|
594
|
+
*/
|
|
595
|
+
fromStart?: boolean;
|
|
584
596
|
where?: WhereFilter;
|
|
585
597
|
/**
|
|
586
598
|
* Called for each delivered event. Awaited — the cursor does NOT advance
|
|
@@ -1246,6 +1258,18 @@ interface SubscribeWithSnapshotOptions<T> {
|
|
|
1246
1258
|
interface SubscribeEventsHandlers<T = Record<string, unknown>> {
|
|
1247
1259
|
/** Cursor to resume from. Undefined = fresh subscription, deliver only new events. */
|
|
1248
1260
|
sinceId?: string;
|
|
1261
|
+
/**
|
|
1262
|
+
* #685 — "replay from earliest retained". When true, a fresh subscription
|
|
1263
|
+
* (no `sinceId` and no stored cursor) first replays every retained stream
|
|
1264
|
+
* entry from the earliest still-retained id, each gated by the same rule
|
|
1265
|
+
* check as live delivery, before going live. Lets a first-time subscriber
|
|
1266
|
+
* bootstrap history for a recipient-scoped collection (e.g. a chat invite /
|
|
1267
|
+
* MLS Welcome written before they subscribed). Ignored once a cursor exists
|
|
1268
|
+
* (reconnect resumes from the last delivered event). Coverage is bounded by
|
|
1269
|
+
* the stream's retention window; a truncated replay fires `onGap` with
|
|
1270
|
+
* `replay-truncated`.
|
|
1271
|
+
*/
|
|
1272
|
+
fromStart?: boolean;
|
|
1249
1273
|
where?: WhereFilter;
|
|
1250
1274
|
/**
|
|
1251
1275
|
* Optional resume-cursor store. When set, the SDK loads the previous cursor
|
package/dist/index.d.ts
CHANGED
|
@@ -581,6 +581,18 @@ interface StreamSubscriptionOptions {
|
|
|
581
581
|
projectId: string;
|
|
582
582
|
collectionName: string;
|
|
583
583
|
sinceId?: string;
|
|
584
|
+
/**
|
|
585
|
+
* #685 — "replay from earliest retained". When true, a brand-new subscription
|
|
586
|
+
* (no prior cursor) replays every retained stream entry from the earliest
|
|
587
|
+
* still-retained id before going live, each entry gated by the same
|
|
588
|
+
* per-event rule check as live delivery. Lets a first-time subscriber
|
|
589
|
+
* bootstrap history for a recipient-scoped collection. Ignored on reconnect
|
|
590
|
+
* (a stored cursor resumes from the last delivered event instead) and
|
|
591
|
+
* overrides `sinceId` on the first subscription. Coverage is bounded by the
|
|
592
|
+
* stream's retention window; a truncated replay still fires `onGap` with
|
|
593
|
+
* `replay-truncated`.
|
|
594
|
+
*/
|
|
595
|
+
fromStart?: boolean;
|
|
584
596
|
where?: WhereFilter;
|
|
585
597
|
/**
|
|
586
598
|
* Called for each delivered event. Awaited — the cursor does NOT advance
|
|
@@ -1246,6 +1258,18 @@ interface SubscribeWithSnapshotOptions<T> {
|
|
|
1246
1258
|
interface SubscribeEventsHandlers<T = Record<string, unknown>> {
|
|
1247
1259
|
/** Cursor to resume from. Undefined = fresh subscription, deliver only new events. */
|
|
1248
1260
|
sinceId?: string;
|
|
1261
|
+
/**
|
|
1262
|
+
* #685 — "replay from earliest retained". When true, a fresh subscription
|
|
1263
|
+
* (no `sinceId` and no stored cursor) first replays every retained stream
|
|
1264
|
+
* entry from the earliest still-retained id, each gated by the same rule
|
|
1265
|
+
* check as live delivery, before going live. Lets a first-time subscriber
|
|
1266
|
+
* bootstrap history for a recipient-scoped collection (e.g. a chat invite /
|
|
1267
|
+
* MLS Welcome written before they subscribed). Ignored once a cursor exists
|
|
1268
|
+
* (reconnect resumes from the last delivered event). Coverage is bounded by
|
|
1269
|
+
* the stream's retention window; a truncated replay fires `onGap` with
|
|
1270
|
+
* `replay-truncated`.
|
|
1271
|
+
*/
|
|
1272
|
+
fromStart?: boolean;
|
|
1249
1273
|
where?: WhereFilter;
|
|
1250
1274
|
/**
|
|
1251
1275
|
* Optional resume-cursor store. When set, the SDK loads the previous cursor
|
package/dist/index.js
CHANGED
|
@@ -1368,7 +1368,11 @@ var RealtimeClient = class {
|
|
|
1368
1368
|
buildStreamPayload(state) {
|
|
1369
1369
|
const { projectId, collectionName, where } = state.options;
|
|
1370
1370
|
const payload = { projectId, collectionName };
|
|
1371
|
-
if (state.lastDeliveredId)
|
|
1371
|
+
if (state.lastDeliveredId) {
|
|
1372
|
+
payload["sinceId"] = state.lastDeliveredId;
|
|
1373
|
+
} else if (state.options.fromStart) {
|
|
1374
|
+
payload["fromStart"] = true;
|
|
1375
|
+
}
|
|
1372
1376
|
if (where && Object.keys(where).length > 0) payload["where"] = where;
|
|
1373
1377
|
return payload;
|
|
1374
1378
|
}
|
|
@@ -2682,6 +2686,9 @@ var CollectionRef = class {
|
|
|
2682
2686
|
projectId: this.projectId,
|
|
2683
2687
|
collectionName: this.collectionName,
|
|
2684
2688
|
sinceId,
|
|
2689
|
+
// #685 — only meaningful on a fresh subscription (no sinceId/cursor);
|
|
2690
|
+
// buildStreamPayload ignores it once a cursor exists.
|
|
2691
|
+
fromStart: handlers.fromStart,
|
|
2685
2692
|
where: handlers.where,
|
|
2686
2693
|
onEvent,
|
|
2687
2694
|
onGap: handlers.onGap,
|