@sparkvault/sdk-js 9.1.1 → 9.2.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.
@@ -125,6 +125,11 @@ export declare class IngotsModule {
125
125
  * short-lived) and retries transient transport failures with exponential
126
126
  * backoff. Validation failures (bad host, non-HTTPS) are never retried.
127
127
  *
128
+ * Each attempt is bounded by liveness, never by total duration: a deadline
129
+ * on the response headers, then an idle deadline rearmed on every body
130
+ * chunk. A stalled transfer restarts from byte zero: this path requests no
131
+ * byte range, so a full retry is the only recovery.
132
+ *
128
133
  * @example
129
134
  * const blob = await sv.ingots.download(unsealed, 'ing_abc');
130
135
  * const url = URL.createObjectURL(blob);
@@ -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 for a SEALED (secure) send — a cleartext send
43
- * delivers its content inline in the channel and mints no grant, so its row has
44
- * 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.
45
47
  */
46
48
  sparklink_code?: string;
47
- /** 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
+ */
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 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 {};