@sparkvault/sdk-mobile 8.0.4 → 8.0.6
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/README.md +11 -0
- package/dist/app-sdk/content-conflict.d.ts +54 -0
- package/dist/app-sdk/content-conflict.js +57 -0
- package/dist/app-sdk/content-conflict.js.map +1 -0
- package/dist/app-sdk/email-address.d.ts +28 -0
- package/dist/app-sdk/email-address.js +8 -1
- package/dist/app-sdk/email-address.js.map +1 -1
- package/dist/app-sdk/upload-publication.d.ts +25 -1
- package/dist/app-sdk/upload-publication.js +24 -1
- package/dist/app-sdk/upload-publication.js.map +1 -1
- package/dist/errors.d.ts +8 -6
- package/dist/errors.js +8 -6
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ingots.d.ts +66 -12
- package/dist/ingots.js +100 -29
- package/dist/ingots.js.map +1 -1
- package/dist/tus.d.ts +6 -0
- package/dist/tus.js +9 -3
- package/dist/tus.js.map +1 -1
- package/dist/types.d.ts +12 -10
- package/package.json +1 -1
- package/src/app-sdk/content-conflict.js +61 -0
- package/src/app-sdk/email-address.js +9 -1
- package/src/app-sdk/upload-publication.js +25 -1
- package/src/errors.ts +8 -6
- package/src/index.ts +2 -0
- package/src/ingots.ts +146 -43
- package/src/tus.ts +10 -4
- package/src/types.ts +12 -10
package/README.md
CHANGED
|
@@ -159,6 +159,17 @@ An upload that fails with its last answer lost (the final PATCH's, or the read
|
|
|
159
159
|
after it) may still have published; the ingot's `content_version` reading the
|
|
160
160
|
`uploadId` says it did.
|
|
161
161
|
|
|
162
|
+
A cancel (`abortSignal`, with the default `abortBehavior` `terminate`) gives
|
|
163
|
+
the upload up: Forge drops its chunks, and `uploadFromUri` ends the upload
|
|
164
|
+
with the file its create made. An upload given up any other way ends the same
|
|
165
|
+
way through `endUpload({ vaultId, vat, upload })`, given the placement
|
|
166
|
+
`onIngotCreated` hands over (or `createUpload`'s result), which names the
|
|
167
|
+
upload the create staged (`uploadId`): Core deletes the ingot only while it is
|
|
168
|
+
still that upload's unfinished file, and the call resolves `deleted` (the file
|
|
169
|
+
is gone) or `kept` (this end deleted nothing: the upload published it, a later
|
|
170
|
+
upload took it over, or the create did not make it), and a read by id shows it
|
|
171
|
+
as it is.
|
|
172
|
+
|
|
162
173
|
Uploads use Forge with tus v1.0.0 and read file chunks through the configured
|
|
163
174
|
`fileReader` adapter. Generated content should be staged to a file URI first so
|
|
164
175
|
all uploads use the same streaming path.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The content conflict a Core error answer names, or null when it is not one.
|
|
3
|
+
*
|
|
4
|
+
* @param {{ statusCode?: number, details?: { reason?: unknown } }} error - An
|
|
5
|
+
* error as parsed from a Core response (status plus the body's `details`)
|
|
6
|
+
* @returns {string|null} One of CONTENT_CONFLICT_REASONS, or null
|
|
7
|
+
*/
|
|
8
|
+
export function contentConflictReason(error: {
|
|
9
|
+
statusCode?: number;
|
|
10
|
+
details?: {
|
|
11
|
+
reason?: unknown;
|
|
12
|
+
};
|
|
13
|
+
}): string | null;
|
|
14
|
+
/**
|
|
15
|
+
* Why Core refused a change to a file or a folder with 409 CONFLICT: the
|
|
16
|
+
* `details.reason` each such refusal carries, and the one reading of it
|
|
17
|
+
* clients share. One status and one code answer all of them, so the reason is
|
|
18
|
+
* what tells them apart. A refusal's message is prose for a person, and Core
|
|
19
|
+
* logs it, so it names no file or folder: no client reads one.
|
|
20
|
+
*
|
|
21
|
+
* NAME_HELD the destination already holds the name: a file's
|
|
22
|
+
* folder, or a folder's parent. A create its policy
|
|
23
|
+
* refused over the file holding the name describes
|
|
24
|
+
* that file beside it (`ingot_id`, `status`,
|
|
25
|
+
* `size_bytes`)
|
|
26
|
+
* CHANGED_CONCURRENTLY another request changed the file or folder first (a
|
|
27
|
+
* rename, a move, an upload landing, a race for the
|
|
28
|
+
* same name): read it again and retry
|
|
29
|
+
* DESTINATION_CHANGED another request moved the folder a move targets
|
|
30
|
+
* FOLDER_DELETING a folder the change places content into, moves
|
|
31
|
+
* content out of, or changes is being deleted:
|
|
32
|
+
* `folder_id` names it and `role` the part it plays
|
|
33
|
+
* (FOLDER_DELETING_ROLES)
|
|
34
|
+
*
|
|
35
|
+
* Core imports these constants to stamp them, and every client that branches
|
|
36
|
+
* on them imports the same ones. Browser-safe: no imports.
|
|
37
|
+
*/
|
|
38
|
+
export const CONTENT_CONFLICT_REASONS: Readonly<{
|
|
39
|
+
NAME_HELD: "NAME_HELD";
|
|
40
|
+
CHANGED_CONCURRENTLY: "CHANGED_CONCURRENTLY";
|
|
41
|
+
DESTINATION_CHANGED: "DESTINATION_CHANGED";
|
|
42
|
+
FOLDER_DELETING: "FOLDER_DELETING";
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* The part a folder being deleted plays in the change it refuses
|
|
46
|
+
* (`details.role` of FOLDER_DELETING): `target`, the folder the change places
|
|
47
|
+
* content into, or one that folder lies inside; `source`, the folder a move
|
|
48
|
+
* takes content out of; `folder`, the folder the change is to.
|
|
49
|
+
*/
|
|
50
|
+
export const FOLDER_DELETING_ROLES: Readonly<{
|
|
51
|
+
TARGET: "target";
|
|
52
|
+
SOURCE: "source";
|
|
53
|
+
FOLDER: "folder";
|
|
54
|
+
}>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// GENERATED FILE — do not edit by hand.
|
|
2
|
+
// Source of truth: packages/app-sdk/src/content-conflict.js
|
|
3
|
+
// Regenerate with: pnpm --filter @sparkvault/sdk-mobile build
|
|
4
|
+
/**
|
|
5
|
+
* Why Core refused a change to a file or a folder with 409 CONFLICT: the
|
|
6
|
+
* `details.reason` each such refusal carries, and the one reading of it
|
|
7
|
+
* clients share. One status and one code answer all of them, so the reason is
|
|
8
|
+
* what tells them apart. A refusal's message is prose for a person, and Core
|
|
9
|
+
* logs it, so it names no file or folder: no client reads one.
|
|
10
|
+
*
|
|
11
|
+
* NAME_HELD the destination already holds the name: a file's
|
|
12
|
+
* folder, or a folder's parent. A create its policy
|
|
13
|
+
* refused over the file holding the name describes
|
|
14
|
+
* that file beside it (`ingot_id`, `status`,
|
|
15
|
+
* `size_bytes`)
|
|
16
|
+
* CHANGED_CONCURRENTLY another request changed the file or folder first (a
|
|
17
|
+
* rename, a move, an upload landing, a race for the
|
|
18
|
+
* same name): read it again and retry
|
|
19
|
+
* DESTINATION_CHANGED another request moved the folder a move targets
|
|
20
|
+
* FOLDER_DELETING a folder the change places content into, moves
|
|
21
|
+
* content out of, or changes is being deleted:
|
|
22
|
+
* `folder_id` names it and `role` the part it plays
|
|
23
|
+
* (FOLDER_DELETING_ROLES)
|
|
24
|
+
*
|
|
25
|
+
* Core imports these constants to stamp them, and every client that branches
|
|
26
|
+
* on them imports the same ones. Browser-safe: no imports.
|
|
27
|
+
*/
|
|
28
|
+
export const CONTENT_CONFLICT_REASONS = Object.freeze({
|
|
29
|
+
NAME_HELD: 'NAME_HELD',
|
|
30
|
+
CHANGED_CONCURRENTLY: 'CHANGED_CONCURRENTLY',
|
|
31
|
+
DESTINATION_CHANGED: 'DESTINATION_CHANGED',
|
|
32
|
+
FOLDER_DELETING: 'FOLDER_DELETING'
|
|
33
|
+
});
|
|
34
|
+
/**
|
|
35
|
+
* The part a folder being deleted plays in the change it refuses
|
|
36
|
+
* (`details.role` of FOLDER_DELETING): `target`, the folder the change places
|
|
37
|
+
* content into, or one that folder lies inside; `source`, the folder a move
|
|
38
|
+
* takes content out of; `folder`, the folder the change is to.
|
|
39
|
+
*/
|
|
40
|
+
export const FOLDER_DELETING_ROLES = Object.freeze({
|
|
41
|
+
TARGET: 'target',
|
|
42
|
+
SOURCE: 'source',
|
|
43
|
+
FOLDER: 'folder'
|
|
44
|
+
});
|
|
45
|
+
const REASONS = new Set(Object.values(CONTENT_CONFLICT_REASONS));
|
|
46
|
+
/**
|
|
47
|
+
* The content conflict a Core error answer names, or null when it is not one.
|
|
48
|
+
*
|
|
49
|
+
* @param {{ statusCode?: number, details?: { reason?: unknown } }} error - An
|
|
50
|
+
* error as parsed from a Core response (status plus the body's `details`)
|
|
51
|
+
* @returns {string|null} One of CONTENT_CONFLICT_REASONS, or null
|
|
52
|
+
*/
|
|
53
|
+
export function contentConflictReason(error) {
|
|
54
|
+
const reason = error?.details?.reason;
|
|
55
|
+
return error?.statusCode === 409 && typeof reason === 'string' && REASONS.has(reason) ? reason : null;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=content-conflict.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-conflict.js","sourceRoot":"","sources":["../../src/app-sdk/content-conflict.js"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,4DAA4D;AAC5D,8DAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,CAAC,MAAM,wBAAwB,GAAG,MAAM,CAAC,MAAM,CAAC;IACpD,SAAS,EAAE,WAAW;IACtB,oBAAoB,EAAE,sBAAsB;IAC5C,mBAAmB,EAAE,qBAAqB;IAC1C,eAAe,EAAE,iBAAiB;CACnC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,MAAM,CAAC;IACjD,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACjB,CAAC,CAAC;AAEH,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,wBAAwB,CAAC,CAAC,CAAC;AAEjE;;;;;;GAMG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAK;IACzC,MAAM,MAAM,GAAG,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC;IACtC,OAAO,KAAK,EAAE,UAAU,KAAK,GAAG,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACxG,CAAC"}
|
|
@@ -22,6 +22,34 @@ export function emailAddressProblem(value: any): string | null;
|
|
|
22
22
|
* @returns {boolean}
|
|
23
23
|
*/
|
|
24
24
|
export function isValidEmailAddress(value: any): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* The one email-address grammar: the addresses SparkVault can deliver to, so
|
|
27
|
+
* the only ones a front door may accept. A door that took an address the
|
|
28
|
+
* email transport then refuses answers its caller with a success while the
|
|
29
|
+
* recipient gets nothing (a Notify send, a SparkLink invite, a share), so the
|
|
30
|
+
* accepting doors and the transport ask this one question.
|
|
31
|
+
*
|
|
32
|
+
* An address is read in its canonical form (trimmed, lowercased) and is valid
|
|
33
|
+
* when it has an RFC 5322 dot-atom-text local part in ASCII, exactly one `@`,
|
|
34
|
+
* a domain of at least two labels of letters, digits and inner hyphens, and
|
|
35
|
+
* fits the RFC 5321 lengths (address 320, local part 64, domain 255).
|
|
36
|
+
*
|
|
37
|
+
* The canonical form is also the one every stored email key is spelled in:
|
|
38
|
+
* Identity's directory normalizes an email identifier through
|
|
39
|
+
* canonicalEmailAddress, and Core keys its account and login-claim rows and
|
|
40
|
+
* compares a signed-in address through it, so one spelling of an address
|
|
41
|
+
* finds every row another spelling wrote.
|
|
42
|
+
*
|
|
43
|
+
* Pure and import-free, so every runtime that decides deliverability loads it
|
|
44
|
+
* alike.
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* The characters an RFC 5322 dot-atom local part holds, in its canonical
|
|
48
|
+
* (lowercase) form, as the body of a character class: the one set the
|
|
49
|
+
* grammar below accepts and the log mask (./pii-mask.js) reads an address in
|
|
50
|
+
* text by.
|
|
51
|
+
*/
|
|
52
|
+
export const EMAIL_LOCAL_PART_CHARACTERS: "a-z0-9.!#$%&'*+/=?^_`{|}~-";
|
|
25
53
|
/** RFC 5321 length limits, in characters. */
|
|
26
54
|
export const EMAIL_ADDRESS_LIMITS: Readonly<{
|
|
27
55
|
ADDRESS: 320;
|
|
@@ -22,7 +22,14 @@
|
|
|
22
22
|
* Pure and import-free, so every runtime that decides deliverability loads it
|
|
23
23
|
* alike.
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
/**
|
|
26
|
+
* The characters an RFC 5322 dot-atom local part holds, in its canonical
|
|
27
|
+
* (lowercase) form, as the body of a character class: the one set the
|
|
28
|
+
* grammar below accepts and the log mask (./pii-mask.js) reads an address in
|
|
29
|
+
* text by.
|
|
30
|
+
*/
|
|
31
|
+
export const EMAIL_LOCAL_PART_CHARACTERS = "a-z0-9.!#$%&'*+/=?^_`{|}~-";
|
|
32
|
+
const LOCAL_PART = new RegExp(`^[${EMAIL_LOCAL_PART_CHARACTERS}]+$`);
|
|
26
33
|
const DOMAIN_LABEL = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
27
34
|
/** RFC 5321 length limits, in characters. */
|
|
28
35
|
export const EMAIL_ADDRESS_LIMITS = Object.freeze({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"email-address.js","sourceRoot":"","sources":["../../src/app-sdk/email-address.js"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,yDAAyD;AACzD,8DAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,MAAM,UAAU,GAAG,
|
|
1
|
+
{"version":3,"file":"email-address.js","sourceRoot":"","sources":["../../src/app-sdk/email-address.js"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,yDAAyD;AACzD,8DAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,4BAA4B,CAAC;AAExE,MAAM,UAAU,GAAG,IAAI,MAAM,CAAC,KAAK,2BAA2B,KAAK,CAAC,CAAC;AACrE,MAAM,YAAY,GAAG,wCAAwC,CAAC;AAE9D,6CAA6C;AAC7C,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC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C,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;QAC3G,OAAO,sBAAsB,CAAC,MAAM,CAAC;IACvC,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,oBAAoB,CAAC,OAAO;QAAE,OAAO,sBAAsB,CAAC,QAAQ,CAAC;IAC1F,IAAI,SAAS,CAAC,MAAM,GAAG,oBAAoB,CAAC,UAAU;QAAE,OAAO,sBAAsB,CAAC,mBAAmB,CAAC;IAC1G,IAAI,MAAM,CAAC,MAAM,GAAG,oBAAoB,CAAC,MAAM;QAAE,OAAO,sBAAsB,CAAC,eAAe,CAAC;IAC/F,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAK;IACvC,OAAO,mBAAmB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC;AAC7C,CAAC"}
|
|
@@ -1,3 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The upload id under which a client that gives an upload up (its person
|
|
3
|
+
* cancelled it, or it failed for good) ends it with the file its create
|
|
4
|
+
* made: the `upload_id` that create answered, which Core's delete takes as
|
|
5
|
+
* its condition (`DELETE …/ingots/:ingot_id?upload_id=`), deleting the ingot
|
|
6
|
+
* only while it is still that upload's unfinished file and keeping (412) one
|
|
7
|
+
* the upload published, or a later upload took over. Null when the file is
|
|
8
|
+
* not the upload's to end: its create staged onto a row that already stood
|
|
9
|
+
* (`created` not true: another upload's unfinished file, or a published file
|
|
10
|
+
* the upload was replacing), or answered no upload id, without which the
|
|
11
|
+
* delete would take whatever file stands, one the upload published
|
|
12
|
+
* included. Every client sends a given-up upload's delete under this id
|
|
13
|
+
* alone, and sends none when it is null.
|
|
14
|
+
*
|
|
15
|
+
* @param {{ created?: boolean|null, uploadId?: string|null }} placement -
|
|
16
|
+
* What the upload's create answered: whether it made the file, and the
|
|
17
|
+
* upload it staged
|
|
18
|
+
* @returns {string|null}
|
|
19
|
+
*/
|
|
20
|
+
export function givenUpUploadId({ created, uploadId }: {
|
|
21
|
+
created?: boolean | null;
|
|
22
|
+
uploadId?: string | null;
|
|
23
|
+
}): string | null;
|
|
1
24
|
/**
|
|
2
25
|
* Whether a value is a content version: the identity of one publication of an
|
|
3
26
|
* ingot (a non-empty string, the upload id its activation stamped), or null
|
|
@@ -52,7 +75,8 @@ export function uploadTokenRevocationReason(record: Object | null | undefined):
|
|
|
52
75
|
* publication it is bound to (a content version, and the one an ingot row
|
|
53
76
|
* names), Core's revocation of an upload's token, and the refusals of Core's
|
|
54
77
|
* a transfer's answer names (the header, and the lock of a vault scheduled
|
|
55
|
-
* for deletion).
|
|
78
|
+
* for deletion). Every client ends an upload it gives up by one rule here
|
|
79
|
+
* too: the upload id its delete is conditioned on (givenUpUploadId).
|
|
56
80
|
*
|
|
57
81
|
* Forge stamps UPLOAD_PUBLICATION_PROTOCOL on every upload session it creates
|
|
58
82
|
* and on the final state it hands Core's activation (POST
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
* publication it is bound to (a content version, and the one an ingot row
|
|
8
8
|
* names), Core's revocation of an upload's token, and the refusals of Core's
|
|
9
9
|
* a transfer's answer names (the header, and the lock of a vault scheduled
|
|
10
|
-
* for deletion).
|
|
10
|
+
* for deletion). Every client ends an upload it gives up by one rule here
|
|
11
|
+
* too: the upload id its delete is conditioned on (givenUpUploadId).
|
|
11
12
|
*
|
|
12
13
|
* Forge stamps UPLOAD_PUBLICATION_PROTOCOL on every upload session it creates
|
|
13
14
|
* and on the final state it hands Core's activation (POST
|
|
@@ -33,6 +34,28 @@ export const UPLOAD_PUBLICATION_PROTOCOL = 2;
|
|
|
33
34
|
* the session's id.
|
|
34
35
|
*/
|
|
35
36
|
export const UPLOAD_ID_PATTERN = /^tus_[0-9a-f]{32}$/;
|
|
37
|
+
/**
|
|
38
|
+
* The upload id under which a client that gives an upload up (its person
|
|
39
|
+
* cancelled it, or it failed for good) ends it with the file its create
|
|
40
|
+
* made: the `upload_id` that create answered, which Core's delete takes as
|
|
41
|
+
* its condition (`DELETE …/ingots/:ingot_id?upload_id=`), deleting the ingot
|
|
42
|
+
* only while it is still that upload's unfinished file and keeping (412) one
|
|
43
|
+
* the upload published, or a later upload took over. Null when the file is
|
|
44
|
+
* not the upload's to end: its create staged onto a row that already stood
|
|
45
|
+
* (`created` not true: another upload's unfinished file, or a published file
|
|
46
|
+
* the upload was replacing), or answered no upload id, without which the
|
|
47
|
+
* delete would take whatever file stands, one the upload published
|
|
48
|
+
* included. Every client sends a given-up upload's delete under this id
|
|
49
|
+
* alone, and sends none when it is null.
|
|
50
|
+
*
|
|
51
|
+
* @param {{ created?: boolean|null, uploadId?: string|null }} placement -
|
|
52
|
+
* What the upload's create answered: whether it made the file, and the
|
|
53
|
+
* upload it staged
|
|
54
|
+
* @returns {string|null}
|
|
55
|
+
*/
|
|
56
|
+
export function givenUpUploadId({ created, uploadId }) {
|
|
57
|
+
return created === true && typeof uploadId === 'string' && UPLOAD_ID_PATTERN.test(uploadId) ? uploadId : null;
|
|
58
|
+
}
|
|
36
59
|
/**
|
|
37
60
|
* Whether a value is a content version: the identity of one publication of an
|
|
38
61
|
* ingot (a non-empty string, the upload id its activation stamped), or null
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-publication.js","sourceRoot":"","sources":["../../src/app-sdk/upload-publication.js"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,8DAA8D;AAC9D,8DAA8D;AAE9D
|
|
1
|
+
{"version":3,"file":"upload-publication.js","sourceRoot":"","sources":["../../src/app-sdk/upload-publication.js"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,8DAA8D;AAC9D,8DAA8D;AAE9D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE7C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAA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,wBAAwB,GAAG,0BAA0B,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAC3C,4GAA4G,CAAC;AAE/G;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,kBAAkB,CAAC"}
|
package/dist/errors.d.ts
CHANGED
|
@@ -74,12 +74,14 @@ export interface IngotNameHolder {
|
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
76
76
|
* Thrown when a create is refused because an ingot already holds the name in
|
|
77
|
-
* the target folder (409 `details.reason === 'NAME_HELD'`)
|
|
78
|
-
* `onNameConflict: 'complete_pending'` a published
|
|
79
|
-
* holder. The server decided before writing
|
|
80
|
-
* untouched; `holder` is the row it read, which
|
|
81
|
-
* (send its bytes into its own row by id, adopt it,
|
|
82
|
-
* without a second read.
|
|
77
|
+
* the target folder (409 `details.reason === 'NAME_HELD'`) and the refusal
|
|
78
|
+
* describes that ingot: with `onNameConflict: 'complete_pending'` a published
|
|
79
|
+
* holder, with `'refuse'` any holder. The server decided before writing
|
|
80
|
+
* anything, so the holder is untouched; `holder` is the row it read, which
|
|
81
|
+
* lets the caller act on it (send its bytes into its own row by id, adopt it,
|
|
82
|
+
* or try another name) without a second read. A NAME_HELD that describes no
|
|
83
|
+
* holder (one another app manages, or a name another request claimed first)
|
|
84
|
+
* is a plain `SparkVaultMobileError`.
|
|
83
85
|
*/
|
|
84
86
|
export declare class IngotNameHeldError extends SparkVaultMobileError {
|
|
85
87
|
readonly holder: IngotNameHolder;
|
package/dist/errors.js
CHANGED
|
@@ -93,12 +93,14 @@ export class IngotNotReadyError extends SparkVaultMobileError {
|
|
|
93
93
|
}
|
|
94
94
|
/**
|
|
95
95
|
* Thrown when a create is refused because an ingot already holds the name in
|
|
96
|
-
* the target folder (409 `details.reason === 'NAME_HELD'`)
|
|
97
|
-
* `onNameConflict: 'complete_pending'` a published
|
|
98
|
-
* holder. The server decided before writing
|
|
99
|
-
* untouched; `holder` is the row it read, which
|
|
100
|
-
* (send its bytes into its own row by id, adopt it,
|
|
101
|
-
* without a second read.
|
|
96
|
+
* the target folder (409 `details.reason === 'NAME_HELD'`) and the refusal
|
|
97
|
+
* describes that ingot: with `onNameConflict: 'complete_pending'` a published
|
|
98
|
+
* holder, with `'refuse'` any holder. The server decided before writing
|
|
99
|
+
* anything, so the holder is untouched; `holder` is the row it read, which
|
|
100
|
+
* lets the caller act on it (send its bytes into its own row by id, adopt it,
|
|
101
|
+
* or try another name) without a second read. A NAME_HELD that describes no
|
|
102
|
+
* holder (one another app manages, or a name another request claimed first)
|
|
103
|
+
* is a plain `SparkVaultMobileError`.
|
|
102
104
|
*/
|
|
103
105
|
export class IngotNameHeldError extends SparkVaultMobileError {
|
|
104
106
|
constructor(message, options) {
|
package/dist/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,IAAI,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAMzG,SAAS,eAAe,CAAC,KAAc;IACrC,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,WAAW,CAAC;AACtD,CAAC;AAED,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAM9C,YACE,OAAe,EACf,UAKI,EAAE;QAEN,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,uBAAuB,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,kBAAkB,CAAC;QAC/C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,MAAM,CAAC,cAA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AAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;QAC9B,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,CAAC;QACnC,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC9B,OAAO,IAAI,kBAAkB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export type { AccountDeletionStarted, StoreSubscription } from './account.js';
|
|
|
7
7
|
export { MobileVaultsClient, } from './vaults.js';
|
|
8
8
|
export { MobileFoldersClient, } from './folders.js';
|
|
9
9
|
export { MobileIngotsClient, NAME_CONFLICT_POLICIES, } from './ingots.js';
|
|
10
|
-
export type { NameConflictPolicy, DownloadToFileOptions, DownloadToFileResult, SearchIngotsOptions, PlacedIngot, UploadOptions, UploadFromUriOptions, ReplaceFromUriOptions, ResumeUploadOptions, CreateUploadOptions, CreateUploadResult, CreateDownloadLinkOptions, CreateDownloadLinkResult, } from './ingots.js';
|
|
10
|
+
export type { NameConflictPolicy, DownloadToFileOptions, DownloadToFileResult, SearchIngotsOptions, PlacedIngot, UploadOptions, UploadFromUriOptions, ReplaceFromUriOptions, ResumeUploadOptions, CreateUploadOptions, CreateUploadResult, EndUploadOptions, UploadEnd, CreateDownloadLinkOptions, CreateDownloadLinkResult, } from './ingots.js';
|
|
11
11
|
export { MobileHealthClient, } from './health.js';
|
|
12
12
|
export type { HealthCheckOptions, HealthCheckResult, } from './health.js';
|
|
13
13
|
export { MobileSparksClient, } from './sparks.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAUrB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,4BAA4B,GAC7B,MAAM,aAAa,CAAC;AAUrB,OAAO,EACL,oBAAoB,EACpB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,sBAAsB,GACvB,MAAM,aAAa,CAAC;AAkBrB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAKrB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAUrB,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AAMtB,OAAO,EACL,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAgBrB,OAAO,EACL,mBAAmB,GACpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,GAClB,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,iBAAiB,EACjB,aAAa,GACd,MAAM,UAAU,CAAC;AAOlB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,aAAa,EACb,aAAa,EACb,gBAAgB,EAChB,WAAW,GACZ,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,WAAW,EACX,oBAAoB,EACpB,oBAAoB,EACpB,cAAc,EACd,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,6BAA6B,EAC7B,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,yBAAyB,EACzB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/E,OAAO,EACL,QAAQ,EACR,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,eAAe,GAChB,MAAM,iBAAiB,CAAC"}
|
package/dist/ingots.d.ts
CHANGED
|
@@ -56,6 +56,8 @@ export interface PlacedIngot {
|
|
|
56
56
|
name: string;
|
|
57
57
|
/** Absent only when the server did not say and the upload sent none. */
|
|
58
58
|
contentType?: string;
|
|
59
|
+
/** The upload the create staged (see `CreateUploadResult.uploadId`); absent when the server did not say. */
|
|
60
|
+
uploadId?: string;
|
|
59
61
|
}
|
|
60
62
|
export interface UploadFromUriOptions extends UploadOptions {
|
|
61
63
|
fileUri: string;
|
|
@@ -67,11 +69,14 @@ export interface UploadFromUriOptions extends UploadOptions {
|
|
|
67
69
|
* session exists: `created` is true when it minted the ingot and false when
|
|
68
70
|
* it staged the upload onto the row holding the name (as `onNameConflict`
|
|
69
71
|
* allowed), `name` is the name the ingot is stored under (the server's
|
|
70
|
-
* numbered name under `new_name`),
|
|
71
|
-
* stored under (see `CreateUploadResult.contentType`)
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
72
|
+
* numbered name under `new_name`), `contentType` the MIME type it is
|
|
73
|
+
* stored under (see `CreateUploadResult.contentType`), and `uploadId` the
|
|
74
|
+
* upload the create staged, through which a caller that gives the upload
|
|
75
|
+
* up ends it with its file (`endUpload`). The placement has already been
|
|
76
|
+
* written by then, so this hook observes; a caller that must not replace
|
|
77
|
+
* content says so through `onNameConflict`. A throw here still stops the
|
|
78
|
+
* upload before a byte moves and propagates as-is, the placement left the
|
|
79
|
+
* caller's to end.
|
|
75
80
|
*/
|
|
76
81
|
onIngotCreated?: (ingot: PlacedIngot) => void;
|
|
77
82
|
/**
|
|
@@ -97,13 +102,15 @@ export interface UploadFromUriOptions extends UploadOptions {
|
|
|
97
102
|
*/
|
|
98
103
|
sourceAssetId?: string;
|
|
99
104
|
/**
|
|
100
|
-
* What an abort does to the
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
104
|
-
* the
|
|
105
|
-
*
|
|
106
|
-
*
|
|
105
|
+
* What an abort does to the upload; see `UploadAbortBehavior`. Default
|
|
106
|
+
* `terminate` (a user cancel): the upload is given up, Forge drops the
|
|
107
|
+
* chunks, and the file the create made is deleted with it (`endUpload`).
|
|
108
|
+
* `keep` (a pause) leaves the session on Forge so the caller can
|
|
109
|
+
* `resumeUpload` the one it was handed via `onSessionCreated` from the
|
|
110
|
+
* server offset; the caller then owns that session and is expected to
|
|
111
|
+
* resume or terminate it. The error is the same either way: the
|
|
112
|
+
* pre-flight `upload_cancelled` or the tus `cancelled`-phase
|
|
113
|
+
* `TusUploadError`.
|
|
107
114
|
*/
|
|
108
115
|
abortBehavior?: UploadAbortBehavior;
|
|
109
116
|
debug?: DebugLogger;
|
|
@@ -257,6 +264,30 @@ export interface CreateUploadResult {
|
|
|
257
264
|
* the row already holding the name (false). Absent when the server did not say.
|
|
258
265
|
*/
|
|
259
266
|
created?: boolean;
|
|
267
|
+
/**
|
|
268
|
+
* The upload the create staged onto the ingot (Core's `upload_id`): the id
|
|
269
|
+
* Forge keys the upload's session by, and the `content_version` the ingot
|
|
270
|
+
* reads once the upload publishes. Giving the upload up ends it with the
|
|
271
|
+
* file the create made through this id (`endUpload`). Absent when the
|
|
272
|
+
* server did not say.
|
|
273
|
+
*/
|
|
274
|
+
uploadId?: string;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* What became of a given-up upload's file (`endUpload`): `deleted`, the
|
|
278
|
+
* vault holds it no longer (this end deleted it, or it was already gone);
|
|
279
|
+
* `kept`, this end deleted nothing, and a read of it by id shows the file as
|
|
280
|
+
* it is now.
|
|
281
|
+
*/
|
|
282
|
+
export type UploadEnd = 'deleted' | 'kept';
|
|
283
|
+
export interface EndUploadOptions {
|
|
284
|
+
vaultId: string;
|
|
285
|
+
vat: string;
|
|
286
|
+
/**
|
|
287
|
+
* The upload as its create answered it: `onIngotCreated`'s placement, or
|
|
288
|
+
* `createUpload`'s result.
|
|
289
|
+
*/
|
|
290
|
+
upload: Pick<CreateUploadResult, 'ingotId' | 'created' | 'uploadId'>;
|
|
260
291
|
}
|
|
261
292
|
export interface CreateDownloadLinkOptions {
|
|
262
293
|
vaultId: string;
|
|
@@ -318,6 +349,29 @@ export declare class MobileIngotsClient {
|
|
|
318
349
|
uploadUrl: string;
|
|
319
350
|
istk: string;
|
|
320
351
|
}): Promise<void>;
|
|
352
|
+
/**
|
|
353
|
+
* End an upload the caller gives up (cancelled, or failed for good) with
|
|
354
|
+
* the file its create made: Core deletes the ingot only while it is still
|
|
355
|
+
* that upload's unfinished file, ending the upload first, so a publication
|
|
356
|
+
* racing the end is decided before anything goes (`DELETE` naming the
|
|
357
|
+
* upload, `?upload_id=`). Resolves `deleted` once the vault holds the file
|
|
358
|
+
* no longer, deleted now or already gone. Resolves `kept` when this end
|
|
359
|
+
* deleted nothing, the file a read by id shows as it is now: the
|
|
360
|
+
* upload published the file, or a later upload took it over, before the
|
|
361
|
+
* end reached Core (Core's 412), or, sending nothing, the create did not
|
|
362
|
+
* make it (it staged onto a row that already stood, or did not say it made
|
|
363
|
+
* one) or names no upload, since a delete without its upload would take
|
|
364
|
+
* whatever file stands. Any other failure rejects, the file left as it
|
|
365
|
+
* was. `uploadFromUri` ends an upload its caller cancels this way by
|
|
366
|
+
* itself.
|
|
367
|
+
*/
|
|
368
|
+
endUpload(options: EndUploadOptions): Promise<UploadEnd>;
|
|
369
|
+
/**
|
|
370
|
+
* End an upload this client gave up (endUpload) without holding up the
|
|
371
|
+
* error the caller is answered with: an end that fails leaves the file to
|
|
372
|
+
* Core's expiry of abandoned uploads, and says so to the client's logger.
|
|
373
|
+
*/
|
|
374
|
+
private endGivenUp;
|
|
321
375
|
/**
|
|
322
376
|
* Initialize an ingot record and obtain the Forge resumable-upload endpoint
|
|
323
377
|
* (with its upload-session token). The canonical first step of every upload;
|