@sparkvault/sdk-js 9.1.0 → 9.1.2

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.cjs CHANGED
@@ -14765,7 +14765,7 @@ class SparkVault {
14765
14765
  }
14766
14766
  /** Get the SDK version */
14767
14767
  static get version() {
14768
- return '9.1.0';
14768
+ return '9.1.2';
14769
14769
  }
14770
14770
  }
14771
14771
  if (typeof window !== 'undefined') {
package/dist/index.d.ts CHANGED
@@ -646,8 +646,10 @@ interface NotificationRow {
646
646
  created_at: number;
647
647
  title: string;
648
648
  /**
649
- * The short cleartext body of a plaintext send, shown natively. Absent on a
650
- * sealed row (its content lives behind the pointer).
649
+ * The row's visible cleartext line, shown natively: a plaintext send's inline
650
+ * body, or a SEALED send's non-secret `instructions`. A sealed row can and
651
+ * normally should carry one — it is the readable line above the reveal. Never
652
+ * the sealed content itself. Absent when the sender set neither.
651
653
  */
652
654
  body?: string;
653
655
  category: string;
@@ -656,13 +658,26 @@ interface NotificationRow {
656
658
  read_at: number | null;
657
659
  archived_at: number | null;
658
660
  /**
659
- * The grant to open. Present only for a SEALED (secure) send — a cleartext send
660
- * delivers its content inline in the channel and mints no grant, so its row has
661
- * no pointer. Guard before building a URL from it.
661
+ * The grant to open. Present only while a live reveal stands behind it — a
662
+ * SEALED (secure) send that has not been recalled. A cleartext send delivers its
663
+ * content inline in the channel and mints no grant; a recalled row's grant is
664
+ * revoked and the pointer is withheld rather than echoed. Guard before building
665
+ * a URL from it.
662
666
  */
663
667
  sparklink_code?: string;
664
- /** True only when there is a secure part to reveal (i.e. `sparklink_code` is set). */
668
+ /**
669
+ * True only when there is a secure part left to reveal — exactly when
670
+ * `sparklink_code` is present. `false` does NOT mean "cleartext row": a recalled
671
+ * row is unlocked too, with nothing behind it. Branch on `recalled` before
672
+ * treating an unlocked row as plain text.
673
+ */
665
674
  locked: boolean;
675
+ /**
676
+ * The sender took this notification back. The grant is revoked and
677
+ * `sparklink_code` is withheld, so render "no longer available" rather than a
678
+ * tap-to-reveal that opens nothing.
679
+ */
680
+ recalled: boolean;
666
681
  thread_id?: string;
667
682
  }
668
683
  interface ListNotificationsOptions {
@@ -997,8 +1012,14 @@ interface MarkNotifyInboxAllResponse {
997
1012
  * - `suppressed` — the PERSON chose silence (site off, category muted, every
998
1013
  * offered channel opted out). Not a fault, and not something to route around.
999
1014
  * - `rate_limited` — skipped by the per-recipient abuse ceiling for that minute.
1015
+ * - `recalled` — the sender took it back before a channel reached this recipient.
1016
+ * The reveal is revoked and no further delivery will be attempted. It ranks
1017
+ * BELOW `delivered`: a channel that already reached someone reached them, so a
1018
+ * recall afterwards leaves them `delivered`. It covers recipients the recall
1019
+ * itself marked AND, on a whole-audience recall, everyone the fan-out was
1020
+ * stopped before ever writing a row for.
1000
1021
  */
1001
- type NotifyRecipientState = 'pending' | 'delivered' | 'undeliverable' | 'failed' | 'suppressed' | 'rate_limited';
1022
+ type NotifyRecipientState = 'pending' | 'delivered' | 'undeliverable' | 'failed' | 'suppressed' | 'rate_limited' | 'recalled';
1002
1023
  interface NotifySendStatusRecipient {
1003
1024
  recipient_id: string;
1004
1025
  /** The derived per-recipient state — the field to branch on. */
@@ -1060,8 +1081,9 @@ interface NotifySendStatusCounts {
1060
1081
  read: number;
1061
1082
  archived: number;
1062
1083
  /**
1063
- * The six state counters below PARTITION the audience:
1064
- * `pending + delivered + undeliverable + failed + suppressed + rate_limited === total`.
1084
+ * The seven state counters below PARTITION the audience — one per
1085
+ * `NotifyRecipientState`:
1086
+ * `pending + delivered + undeliverable + failed + suppressed + rate_limited + recalled === total`.
1065
1087
  * (`enqueued` / `seen` / `read` / `archived` are independent progress markers
1066
1088
  * and do not partition anything.)
1067
1089
  */
@@ -1076,6 +1098,11 @@ interface NotifySendStatusCounts {
1076
1098
  suppressed: number;
1077
1099
  /** Recipients skipped by the per-recipient ceiling. */
1078
1100
  rate_limited: number;
1101
+ /**
1102
+ * Recipients the sender took back before a channel reached them. A recalled
1103
+ * send therefore settles instead of sitting on `pending` until it expires.
1104
+ */
1105
+ recalled: number;
1079
1106
  }
1080
1107
  /**
1081
1108
  * The sender's per-recipient delivery rollup. Metadata only by construction: it
@@ -1097,9 +1124,12 @@ interface NotifySendStatus {
1097
1124
  * - `failed` — every recipient resolved and none delivered.
1098
1125
  *
1099
1126
  * The list feeds it the send row's best-effort counters; this view recomputes
1100
- * them from the authoritative per-recipient rows, so the list can lag but the
1101
- * two can never contradict. For WHY a given recipient did not get it, read
1102
- * that recipient's `state`.
1127
+ * them from the authoritative per-recipient rows, so the list normally lags
1128
+ * rather than disagrees. A whole-audience RECALL is the exception: it stops the
1129
+ * fan-out where it stands, so the audience past that point never produces a row
1130
+ * or a counter — this view settles them `recalled`, while the list is left on
1131
+ * `sending` with counters nothing further will advance. This view is the one to
1132
+ * trust; for WHY a given recipient did not get it, read that recipient's `state`.
1103
1133
  */
1104
1134
  status: 'unknown' | 'pending' | 'sending' | 'delivered' | 'partial' | 'failed';
1105
1135
  channels: NotifyChannel[];
package/dist/index.mjs CHANGED
@@ -14761,7 +14761,7 @@ class SparkVault {
14761
14761
  }
14762
14762
  /** Get the SDK version */
14763
14763
  static get version() {
14764
- return '9.1.0';
14764
+ return '9.1.2';
14765
14765
  }
14766
14766
  }
14767
14767
  if (typeof window !== 'undefined') {
@@ -27,8 +27,10 @@ export interface NotificationRow {
27
27
  created_at: number;
28
28
  title: string;
29
29
  /**
30
- * The short cleartext body of a plaintext send, shown natively. Absent on a
31
- * sealed row (its content lives behind the pointer).
30
+ * The row's visible cleartext line, shown natively: a plaintext send's inline
31
+ * body, or a SEALED send's non-secret `instructions`. A sealed row can and
32
+ * normally should carry one — it is the readable line above the reveal. Never
33
+ * the sealed content itself. Absent when the sender set neither.
32
34
  */
33
35
  body?: string;
34
36
  category: string;
@@ -37,13 +39,26 @@ export interface NotificationRow {
37
39
  read_at: number | null;
38
40
  archived_at: number | null;
39
41
  /**
40
- * The grant to open. Present only for a SEALED (secure) send — a cleartext send
41
- * delivers its content inline in the channel and mints no grant, so its row has
42
- * no pointer. Guard before building a URL from it.
42
+ * The grant to open. Present only while a live reveal stands behind it — a
43
+ * SEALED (secure) send that has not been recalled. A cleartext send delivers its
44
+ * content inline in the channel and mints no grant; a recalled row's grant is
45
+ * revoked and the pointer is withheld rather than echoed. Guard before building
46
+ * a URL from it.
43
47
  */
44
48
  sparklink_code?: string;
45
- /** True only when there is a secure part to reveal (i.e. `sparklink_code` is set). */
49
+ /**
50
+ * True only when there is a secure part left to reveal — exactly when
51
+ * `sparklink_code` is present. `false` does NOT mean "cleartext row": a recalled
52
+ * row is unlocked too, with nothing behind it. Branch on `recalled` before
53
+ * treating an unlocked row as plain text.
54
+ */
46
55
  locked: boolean;
56
+ /**
57
+ * The sender took this notification back. The grant is revoked and
58
+ * `sparklink_code` is withheld, so render "no longer available" rather than a
59
+ * tap-to-reveal that opens nothing.
60
+ */
61
+ recalled: boolean;
47
62
  thread_id?: string;
48
63
  }
49
64
  export interface ListNotificationsOptions {
@@ -231,8 +231,14 @@ export interface MarkNotifyInboxAllResponse {
231
231
  * - `suppressed` — the PERSON chose silence (site off, category muted, every
232
232
  * offered channel opted out). Not a fault, and not something to route around.
233
233
  * - `rate_limited` — skipped by the per-recipient abuse ceiling for that minute.
234
+ * - `recalled` — the sender took it back before a channel reached this recipient.
235
+ * The reveal is revoked and no further delivery will be attempted. It ranks
236
+ * BELOW `delivered`: a channel that already reached someone reached them, so a
237
+ * recall afterwards leaves them `delivered`. It covers recipients the recall
238
+ * itself marked AND, on a whole-audience recall, everyone the fan-out was
239
+ * stopped before ever writing a row for.
234
240
  */
235
- export type NotifyRecipientState = 'pending' | 'delivered' | 'undeliverable' | 'failed' | 'suppressed' | 'rate_limited';
241
+ export type NotifyRecipientState = 'pending' | 'delivered' | 'undeliverable' | 'failed' | 'suppressed' | 'rate_limited' | 'recalled';
236
242
  export interface NotifySendStatusRecipient {
237
243
  recipient_id: string;
238
244
  /** The derived per-recipient state — the field to branch on. */
@@ -294,8 +300,9 @@ export interface NotifySendStatusCounts {
294
300
  read: number;
295
301
  archived: number;
296
302
  /**
297
- * The six state counters below PARTITION the audience:
298
- * `pending + delivered + undeliverable + failed + suppressed + rate_limited === total`.
303
+ * The seven state counters below PARTITION the audience — one per
304
+ * `NotifyRecipientState`:
305
+ * `pending + delivered + undeliverable + failed + suppressed + rate_limited + recalled === total`.
299
306
  * (`enqueued` / `seen` / `read` / `archived` are independent progress markers
300
307
  * and do not partition anything.)
301
308
  */
@@ -310,6 +317,11 @@ export interface NotifySendStatusCounts {
310
317
  suppressed: number;
311
318
  /** Recipients skipped by the per-recipient ceiling. */
312
319
  rate_limited: number;
320
+ /**
321
+ * Recipients the sender took back before a channel reached them. A recalled
322
+ * send therefore settles instead of sitting on `pending` until it expires.
323
+ */
324
+ recalled: number;
313
325
  }
314
326
  /**
315
327
  * The sender's per-recipient delivery rollup. Metadata only by construction: it
@@ -331,9 +343,12 @@ export interface NotifySendStatus {
331
343
  * - `failed` — every recipient resolved and none delivered.
332
344
  *
333
345
  * The list feeds it the send row's best-effort counters; this view recomputes
334
- * them from the authoritative per-recipient rows, so the list can lag but the
335
- * two can never contradict. For WHY a given recipient did not get it, read
336
- * that recipient's `state`.
346
+ * them from the authoritative per-recipient rows, so the list normally lags
347
+ * rather than disagrees. A whole-audience RECALL is the exception: it stops the
348
+ * fan-out where it stands, so the audience past that point never produces a row
349
+ * or a counter — this view settles them `recalled`, while the list is left on
350
+ * `sending` with counters nothing further will advance. This view is the one to
351
+ * trust; for WHY a given recipient did not get it, read that recipient's `state`.
337
352
  */
338
353
  status: 'unknown' | 'pending' | 'sending' | 'delivered' | 'partial' | 'failed';
339
354
  channels: NotifyChannel[];
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Notify wire-contract assertions — COMPILE-TIME ONLY.
3
+ *
4
+ * These types have no runtime, so a unit test can never catch them drifting from
5
+ * the server: the transpiler strips them and every assertion passes. This file is
6
+ * the gate instead — `tsc --noEmit` (`pnpm typecheck`, which CI runs on every push
7
+ * and again on every SDK publish) fails the moment the published shapes stop
8
+ * matching what `apps/api` actually emits.
9
+ *
10
+ * It is deliberately NOT a `*.test.ts`: that suffix is excluded from `tsconfig`,
11
+ * which would put these assertions exactly where the compiler cannot see them.
12
+ * Nothing imports this module, so it never reaches the bundle.
13
+ *
14
+ * The mirrored server sources are named per block. When one of them changes, this
15
+ * file is what refuses to compile until the published type is changed with it.
16
+ */
17
+ import type { NotificationRow } from '../../notify/types';
18
+ import type { NotifyRecipientState, NotifySendStatusCounts } from './types';
19
+ /** Fails to compile unless `T` resolves to exactly `true`. */
20
+ type Assert<T extends true> = T;
21
+ /**
22
+ * Invariant type equality — `A` and `B` must be the SAME type, not merely mutually
23
+ * assignable. Assignability would accept a union that lost a member, which is the
24
+ * precise drift these assertions exist to catch.
25
+ */
26
+ type Equals<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false;
27
+ export type NotifyWireContract = [
28
+ Assert<Equals<NotificationRow['recalled'], boolean>>,
29
+ Assert<Equals<NotificationRow['locked'], boolean>>,
30
+ Assert<Equals<NotificationRow['sparklink_code'], string | undefined>>,
31
+ Assert<Equals<NotifyRecipientState, 'pending' | 'delivered' | 'undeliverable' | 'failed' | 'suppressed' | 'rate_limited' | 'recalled'>>,
32
+ Assert<Equals<Pick<NotifySendStatusCounts, NotifyRecipientState>, Record<NotifyRecipientState, number>>>
33
+ ];
34
+ export {};