@sparkvault/sdk-js 9.1.1 → 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 +1 -1
- package/dist/index.d.ts +38 -10
- package/dist/index.mjs +1 -1
- package/dist/notify/types.d.ts +17 -4
- package/dist/products/notify/types.d.ts +21 -6
- package/dist/products/notify/types.test-d.d.ts +34 -0
- package/dist/sparkvault.js +1 -1
- package/package.json +1 -1
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.
|
|
14768
|
+
return '9.1.2';
|
|
14769
14769
|
}
|
|
14770
14770
|
}
|
|
14771
14771
|
if (typeof window !== 'undefined') {
|
package/dist/index.d.ts
CHANGED
|
@@ -658,13 +658,26 @@ interface NotificationRow {
|
|
|
658
658
|
read_at: number | null;
|
|
659
659
|
archived_at: number | null;
|
|
660
660
|
/**
|
|
661
|
-
* The grant to open. Present only
|
|
662
|
-
*
|
|
663
|
-
*
|
|
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.
|
|
664
666
|
*/
|
|
665
667
|
sparklink_code?: string;
|
|
666
|
-
/**
|
|
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
|
+
*/
|
|
667
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;
|
|
668
681
|
thread_id?: string;
|
|
669
682
|
}
|
|
670
683
|
interface ListNotificationsOptions {
|
|
@@ -999,8 +1012,14 @@ interface MarkNotifyInboxAllResponse {
|
|
|
999
1012
|
* - `suppressed` — the PERSON chose silence (site off, category muted, every
|
|
1000
1013
|
* offered channel opted out). Not a fault, and not something to route around.
|
|
1001
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.
|
|
1002
1021
|
*/
|
|
1003
|
-
type NotifyRecipientState = 'pending' | 'delivered' | 'undeliverable' | 'failed' | 'suppressed' | 'rate_limited';
|
|
1022
|
+
type NotifyRecipientState = 'pending' | 'delivered' | 'undeliverable' | 'failed' | 'suppressed' | 'rate_limited' | 'recalled';
|
|
1004
1023
|
interface NotifySendStatusRecipient {
|
|
1005
1024
|
recipient_id: string;
|
|
1006
1025
|
/** The derived per-recipient state — the field to branch on. */
|
|
@@ -1062,8 +1081,9 @@ interface NotifySendStatusCounts {
|
|
|
1062
1081
|
read: number;
|
|
1063
1082
|
archived: number;
|
|
1064
1083
|
/**
|
|
1065
|
-
* The
|
|
1066
|
-
* `
|
|
1084
|
+
* The seven state counters below PARTITION the audience — one per
|
|
1085
|
+
* `NotifyRecipientState`:
|
|
1086
|
+
* `pending + delivered + undeliverable + failed + suppressed + rate_limited + recalled === total`.
|
|
1067
1087
|
* (`enqueued` / `seen` / `read` / `archived` are independent progress markers
|
|
1068
1088
|
* and do not partition anything.)
|
|
1069
1089
|
*/
|
|
@@ -1078,6 +1098,11 @@ interface NotifySendStatusCounts {
|
|
|
1078
1098
|
suppressed: number;
|
|
1079
1099
|
/** Recipients skipped by the per-recipient ceiling. */
|
|
1080
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;
|
|
1081
1106
|
}
|
|
1082
1107
|
/**
|
|
1083
1108
|
* The sender's per-recipient delivery rollup. Metadata only by construction: it
|
|
@@ -1099,9 +1124,12 @@ interface NotifySendStatus {
|
|
|
1099
1124
|
* - `failed` — every recipient resolved and none delivered.
|
|
1100
1125
|
*
|
|
1101
1126
|
* The list feeds it the send row's best-effort counters; this view recomputes
|
|
1102
|
-
* them from the authoritative per-recipient rows, so the list
|
|
1103
|
-
*
|
|
1104
|
-
* that
|
|
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`.
|
|
1105
1133
|
*/
|
|
1106
1134
|
status: 'unknown' | 'pending' | 'sending' | 'delivered' | 'partial' | 'failed';
|
|
1107
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.
|
|
14764
|
+
return '9.1.2';
|
|
14765
14765
|
}
|
|
14766
14766
|
}
|
|
14767
14767
|
if (typeof window !== 'undefined') {
|
package/dist/notify/types.d.ts
CHANGED
|
@@ -39,13 +39,26 @@ export interface NotificationRow {
|
|
|
39
39
|
read_at: number | null;
|
|
40
40
|
archived_at: number | null;
|
|
41
41
|
/**
|
|
42
|
-
* The grant to open. Present only
|
|
43
|
-
*
|
|
44
|
-
*
|
|
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.
|
|
45
47
|
*/
|
|
46
48
|
sparklink_code?: string;
|
|
47
|
-
/**
|
|
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
|
+
*/
|
|
48
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;
|
|
49
62
|
thread_id?: string;
|
|
50
63
|
}
|
|
51
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
|
|
298
|
-
* `
|
|
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
|
|
335
|
-
*
|
|
336
|
-
* that
|
|
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 {};
|