@sparkvault/sdk-mobile 7.2.2 → 7.2.3

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.
@@ -1,3 +1,29 @@
1
+ /**
2
+ * Whether a value is a content version: the identity of one publication of an
3
+ * ingot (a non-empty string, the upload id its activation stamped), or null
4
+ * for content published without one. A transfer token that records one — a
5
+ * read-modify-write replacement's base, the publication a reusable decrypt
6
+ * token serves — records exactly this, and a record holding anything else is
7
+ * malformed.
8
+ *
9
+ * @param {*} value
10
+ * @returns {boolean}
11
+ */
12
+ export function isContentVersion(value: any): boolean;
13
+ /**
14
+ * The content version an ingot row names: the upload id its activation
15
+ * stamped as `stats_activation_reference_id`, or null for a row published
16
+ * without one. It is the `content_version` Core reports and records on a
17
+ * reusable decrypt token, the strong ETag Forge serves the row's bytes under,
18
+ * and the publication a replacement conditioned on content is decided against,
19
+ * so Core and Forge read a row's publication by this one rule.
20
+ *
21
+ * @param {{ stats_activation_reference_id?: * }|null|undefined} row - An ingot row
22
+ * @returns {string|null}
23
+ */
24
+ export function ingotContentVersion(row: {
25
+ stats_activation_reference_id?: any;
26
+ } | null | undefined): string | null;
1
27
  /**
2
28
  * The ledger reference of an upload's transfer charge,
3
29
  * `forge_ingot_transfer_upload_<first 24 ISTK chars>`: every charge of one
@@ -22,8 +48,9 @@ export function uploadTransferReference(istk: string): string;
22
48
  export function uploadTokenRevocationReason(record: Object | null | undefined): string | null;
23
49
  /**
24
50
  * The upload publication contract between Forge and Core's activation, and
25
- * the facts of a transfer token both services spell: its shape, and Core's
26
- * revocation of an upload's token.
51
+ * the facts of a transfer token both services spell: its shape, the
52
+ * publication it is bound to (a content version, and the one an ingot row
53
+ * names), and Core's revocation of an upload's token.
27
54
  *
28
55
  * Forge stamps UPLOAD_PUBLICATION_PROTOCOL on every upload session it creates
29
56
  * and on the final state it hands Core's activation (POST
@@ -3,8 +3,9 @@
3
3
  // Regenerate with: pnpm --filter @sparkvault/sdk-mobile build
4
4
  /**
5
5
  * The upload publication contract between Forge and Core's activation, and
6
- * the facts of a transfer token both services spell: its shape, and Core's
7
- * revocation of an upload's token.
6
+ * the facts of a transfer token both services spell: its shape, the
7
+ * publication it is bound to (a content version, and the one an ingot row
8
+ * names), and Core's revocation of an upload's token.
8
9
  *
9
10
  * Forge stamps UPLOAD_PUBLICATION_PROTOCOL on every upload session it creates
10
11
  * and on the final state it hands Core's activation (POST
@@ -30,6 +31,35 @@ export const UPLOAD_PUBLICATION_PROTOCOL = 2;
30
31
  * the session's id.
31
32
  */
32
33
  export const UPLOAD_ID_PATTERN = /^tus_[0-9a-f]{32}$/;
34
+ /**
35
+ * Whether a value is a content version: the identity of one publication of an
36
+ * ingot (a non-empty string, the upload id its activation stamped), or null
37
+ * for content published without one. A transfer token that records one — a
38
+ * read-modify-write replacement's base, the publication a reusable decrypt
39
+ * token serves — records exactly this, and a record holding anything else is
40
+ * malformed.
41
+ *
42
+ * @param {*} value
43
+ * @returns {boolean}
44
+ */
45
+ export function isContentVersion(value) {
46
+ return value === null || (typeof value === 'string' && value.length > 0);
47
+ }
48
+ /**
49
+ * The content version an ingot row names: the upload id its activation
50
+ * stamped as `stats_activation_reference_id`, or null for a row published
51
+ * without one. It is the `content_version` Core reports and records on a
52
+ * reusable decrypt token, the strong ETag Forge serves the row's bytes under,
53
+ * and the publication a replacement conditioned on content is decided against,
54
+ * so Core and Forge read a row's publication by this one rule.
55
+ *
56
+ * @param {{ stats_activation_reference_id?: * }|null|undefined} row - An ingot row
57
+ * @returns {string|null}
58
+ */
59
+ export function ingotContentVersion(row) {
60
+ const reference = row?.stats_activation_reference_id;
61
+ return typeof reference === 'string' && reference.length > 0 ? reference : null;
62
+ }
33
63
  /** The random bytes an ISTK, the bearer token of one Forge transfer, is spelled from. */
34
64
  export const ISTK_BYTES = 32;
35
65
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"upload-publication.js","sourceRoot":"","sources":["../../src/app-sdk/upload-publication.js"],"names":[],"m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GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GACpC,mHAAmH,CAAC;AAEtH;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC;IACnD,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;QACrB,iBAAiB,EAAE,oBAAoB,CAAC,iBAAiB;QACzD,aAAa,EAAE,eAAe;KAC/B,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAM;IAChD,IAAI,MAAM,EAAE,MAAM,KAAK,uBAAuB,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC;IACnE,OAAO,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,IAAI,CAAC;AAC3F,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sparkvault/sdk-mobile",
3
- "version": "7.2.2",
3
+ "version": "7.2.3",
4
4
  "description": "Mobile SDK for SparkVault Identity, vault, folder, and ingot workflows",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -4,8 +4,9 @@
4
4
 
5
5
  /**
6
6
  * The upload publication contract between Forge and Core's activation, and
7
- * the facts of a transfer token both services spell: its shape, and Core's
8
- * revocation of an upload's token.
7
+ * the facts of a transfer token both services spell: its shape, the
8
+ * publication it is bound to (a content version, and the one an ingot row
9
+ * names), and Core's revocation of an upload's token.
9
10
  *
10
11
  * Forge stamps UPLOAD_PUBLICATION_PROTOCOL on every upload session it creates
11
12
  * and on the final state it hands Core's activation (POST
@@ -34,6 +35,37 @@ export const UPLOAD_PUBLICATION_PROTOCOL = 2;
34
35
  */
35
36
  export const UPLOAD_ID_PATTERN = /^tus_[0-9a-f]{32}$/;
36
37
 
38
+ /**
39
+ * Whether a value is a content version: the identity of one publication of an
40
+ * ingot (a non-empty string, the upload id its activation stamped), or null
41
+ * for content published without one. A transfer token that records one — a
42
+ * read-modify-write replacement's base, the publication a reusable decrypt
43
+ * token serves — records exactly this, and a record holding anything else is
44
+ * malformed.
45
+ *
46
+ * @param {*} value
47
+ * @returns {boolean}
48
+ */
49
+ export function isContentVersion(value) {
50
+ return value === null || (typeof value === 'string' && value.length > 0);
51
+ }
52
+
53
+ /**
54
+ * The content version an ingot row names: the upload id its activation
55
+ * stamped as `stats_activation_reference_id`, or null for a row published
56
+ * without one. It is the `content_version` Core reports and records on a
57
+ * reusable decrypt token, the strong ETag Forge serves the row's bytes under,
58
+ * and the publication a replacement conditioned on content is decided against,
59
+ * so Core and Forge read a row's publication by this one rule.
60
+ *
61
+ * @param {{ stats_activation_reference_id?: * }|null|undefined} row - An ingot row
62
+ * @returns {string|null}
63
+ */
64
+ export function ingotContentVersion(row) {
65
+ const reference = row?.stats_activation_reference_id;
66
+ return typeof reference === 'string' && reference.length > 0 ? reference : null;
67
+ }
68
+
37
69
  /** The random bytes an ISTK, the bearer token of one Forge transfer, is spelled from. */
38
70
  export const ISTK_BYTES = 32;
39
71