@sparkvault/sdk-mobile 5.2.0 → 5.2.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/notify.d.ts CHANGED
@@ -16,8 +16,10 @@ export interface NotificationRow {
16
16
  created_at: number;
17
17
  title: string;
18
18
  /**
19
- * The short cleartext body of a plaintext send, shown natively. Absent on a
20
- * sealed row (its content lives behind the pointer).
19
+ * The row's visible cleartext line, shown natively: a plaintext send's inline
20
+ * body, or a SEALED send's non-secret `instructions`. A sealed row can and
21
+ * normally should carry one — it is the readable line above the reveal. Never
22
+ * the sealed content itself. Absent when the sender set neither.
21
23
  */
22
24
  body?: string;
23
25
  category: string;
@@ -26,13 +28,26 @@ export interface NotificationRow {
26
28
  read_at: number | null;
27
29
  archived_at: number | null;
28
30
  /**
29
- * The grant to open. Present only for a SEALED (secure) send — a cleartext send
30
- * delivers its content inline in the channel and mints no grant, so its row has
31
- * no pointer. Guard before building a URL from it.
31
+ * The grant to open. Present only while a live reveal stands behind it — a
32
+ * SEALED (secure) send that has not been recalled. A cleartext send delivers its
33
+ * content inline in the channel and mints no grant; a recalled row's grant is
34
+ * revoked and the pointer is withheld rather than echoed. Guard before building
35
+ * a URL from it.
32
36
  */
33
37
  sparklink_code?: string;
34
- /** True only when there is a secure part to reveal (i.e. `sparklink_code` is set). */
38
+ /**
39
+ * True only when there is a secure part left to reveal — exactly when
40
+ * `sparklink_code` is present. `false` does NOT mean "cleartext row": a recalled
41
+ * row is unlocked too, with nothing behind it. Branch on `recalled` before
42
+ * treating an unlocked row as plain text.
43
+ */
35
44
  locked: boolean;
45
+ /**
46
+ * The sender took this notification back. The grant is revoked and
47
+ * `sparklink_code` is withheld, so render "no longer available" rather than a
48
+ * tap-to-reveal that opens nothing.
49
+ */
50
+ recalled: boolean;
36
51
  thread_id?: string;
37
52
  }
38
53
  export interface ListNotificationsOptions {
@@ -1 +1 @@
1
- {"version":3,"file":"notify.js","sourceRoot":"","s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
5
+ * from the server: the transpiler strips it and every assertion passes. This file
6
+ * is the gate instead — `tsc --noEmit` (`pnpm typecheck`, which CI runs on every
7
+ * push and again on every SDK publish) fails the moment the published row stops
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
+ *
13
+ * The row shape is shared verbatim with `@sparkvault/sdk-js`, whose own contract
14
+ * file asserts the same three members — both must move together, and the mirrored
15
+ * server source is `apps/api/src/notify/inbox.js` (`projectRow`).
16
+ */
17
+ import type { NotificationRow } from './notify.js';
18
+ /** Fails to compile unless `T` resolves to exactly `true`. */
19
+ type Assert<T extends true> = T;
20
+ /**
21
+ * Invariant type equality — `A` and `B` must be the SAME type, not merely mutually
22
+ * assignable. Assignability would accept an optional member where the wire always
23
+ * carries one, which is the precise drift these assertions exist to catch.
24
+ */
25
+ type Equals<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2 ? true : false;
26
+ export type NotifyWireContract = [
27
+ Assert<Equals<NotificationRow['recalled'], boolean>>,
28
+ Assert<Equals<NotificationRow['locked'], boolean>>,
29
+ Assert<Equals<NotificationRow['sparklink_code'], string | undefined>>
30
+ ];
31
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Notify wire-contract assertions — COMPILE-TIME ONLY.
3
+ *
4
+ * `NotificationRow` has no runtime, so a unit test can never catch it drifting
5
+ * from the server: the transpiler strips it and every assertion passes. This file
6
+ * is the gate instead — `tsc --noEmit` (`pnpm typecheck`, which CI runs on every
7
+ * push and again on every SDK publish) fails the moment the published row stops
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
+ *
13
+ * The row shape is shared verbatim with `@sparkvault/sdk-js`, whose own contract
14
+ * file asserts the same three members — both must move together, and the mirrored
15
+ * server source is `apps/api/src/notify/inbox.js` (`projectRow`).
16
+ */
17
+ export {};
18
+ //# sourceMappingURL=notify.test-d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notify.test-d.js","sourceRoot":"","sources":["../src/notify.test-d.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkvault/sdk-mobile",
3
- "version": "5.2.0",
3
+ "version": "5.2.2",
4
4
  "description": "Mobile SDK for SparkVault Identity, vault, folder, and ingot workflows",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Notify wire-contract assertions — COMPILE-TIME ONLY.
3
+ *
4
+ * `NotificationRow` has no runtime, so a unit test can never catch it drifting
5
+ * from the server: the transpiler strips it and every assertion passes. This file
6
+ * is the gate instead — `tsc --noEmit` (`pnpm typecheck`, which CI runs on every
7
+ * push and again on every SDK publish) fails the moment the published row stops
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
+ *
13
+ * The row shape is shared verbatim with `@sparkvault/sdk-js`, whose own contract
14
+ * file asserts the same three members — both must move together, and the mirrored
15
+ * server source is `apps/api/src/notify/inbox.js` (`projectRow`).
16
+ */
17
+
18
+ import type { NotificationRow } from './notify.js';
19
+
20
+ /** Fails to compile unless `T` resolves to exactly `true`. */
21
+ type Assert<T extends true> = T;
22
+
23
+ /**
24
+ * Invariant type equality — `A` and `B` must be the SAME type, not merely mutually
25
+ * assignable. Assignability would accept an optional member where the wire always
26
+ * carries one, which is the precise drift these assertions exist to catch.
27
+ */
28
+ type Equals<A, B> = (<T>() => T extends A ? 1 : 2) extends <T>() => T extends B ? 1 : 2
29
+ ? true
30
+ : false;
31
+
32
+ export type NotifyWireContract = [
33
+ // `recalled` is `Boolean(row.recalled_at)`, so it is always on the wire: typing
34
+ // it optional would let the app skip the "no longer available" branch and fall
35
+ // through to a reveal that opens nothing.
36
+ Assert<Equals<NotificationRow['recalled'], boolean>>,
37
+ // `locked` is `!recalled && Boolean(row.sparklink_code)` — always present.
38
+ Assert<Equals<NotificationRow['locked'], boolean>>,
39
+ // The pointer is withheld on a recalled row and absent on a cleartext one, so
40
+ // it is optional in both directions and must be guarded before use.
41
+ Assert<Equals<NotificationRow['sparklink_code'], string | undefined>>,
42
+ ];
package/src/notify.ts CHANGED
@@ -19,8 +19,10 @@ export interface NotificationRow {
19
19
  created_at: number;
20
20
  title: string;
21
21
  /**
22
- * The short cleartext body of a plaintext send, shown natively. Absent on a
23
- * sealed row (its content lives behind the pointer).
22
+ * The row's visible cleartext line, shown natively: a plaintext send's inline
23
+ * body, or a SEALED send's non-secret `instructions`. A sealed row can and
24
+ * normally should carry one — it is the readable line above the reveal. Never
25
+ * the sealed content itself. Absent when the sender set neither.
24
26
  */
25
27
  body?: string;
26
28
  category: string;
@@ -29,13 +31,26 @@ export interface NotificationRow {
29
31
  read_at: number | null;
30
32
  archived_at: number | null;
31
33
  /**
32
- * The grant to open. Present only for a SEALED (secure) send — a cleartext send
33
- * delivers its content inline in the channel and mints no grant, so its row has
34
- * no pointer. Guard before building a URL from it.
34
+ * The grant to open. Present only while a live reveal stands behind it — a
35
+ * SEALED (secure) send that has not been recalled. A cleartext send delivers its
36
+ * content inline in the channel and mints no grant; a recalled row's grant is
37
+ * revoked and the pointer is withheld rather than echoed. Guard before building
38
+ * a URL from it.
35
39
  */
36
40
  sparklink_code?: string;
37
- /** True only when there is a secure part to reveal (i.e. `sparklink_code` is set). */
41
+ /**
42
+ * True only when there is a secure part left to reveal — exactly when
43
+ * `sparklink_code` is present. `false` does NOT mean "cleartext row": a recalled
44
+ * row is unlocked too, with nothing behind it. Branch on `recalled` before
45
+ * treating an unlocked row as plain text.
46
+ */
38
47
  locked: boolean;
48
+ /**
49
+ * The sender took this notification back. The grant is revoked and
50
+ * `sparklink_code` is withheld, so render "no longer available" rather than a
51
+ * tap-to-reveal that opens nothing.
52
+ */
53
+ recalled: boolean;
39
54
  thread_id?: string;
40
55
  }
41
56