@sparkvault/sdk-mobile 8.0.6 → 9.0.1
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 +84 -115
- package/dist/app-sdk/ids.d.ts +14 -0
- package/dist/app-sdk/ids.js +24 -4
- package/dist/app-sdk/ids.js.map +1 -1
- package/dist/app-sdk/platform-domains.d.ts +22 -5
- package/dist/app-sdk/platform-domains.js +28 -9
- package/dist/app-sdk/platform-domains.js.map +1 -1
- package/dist/app-sdk/upload-publication.d.ts +20 -6
- package/dist/app-sdk/upload-publication.js +20 -6
- package/dist/app-sdk/upload-publication.js.map +1 -1
- package/dist/config.d.ts +6 -4
- package/dist/config.js.map +1 -1
- package/dist/http.d.ts +8 -4
- package/dist/http.js +19 -9
- package/dist/http.js.map +1 -1
- package/dist/notify.d.ts +15 -11
- package/dist/notify.js +6 -4
- package/dist/notify.js.map +1 -1
- package/dist/notify.test-d.d.ts +12 -7
- package/dist/notify.test-d.js +12 -7
- package/dist/notify.test-d.js.map +1 -1
- package/dist/tus.d.ts +19 -16
- package/dist/tus.js +26 -22
- package/dist/tus.js.map +1 -1
- package/dist/types.d.ts +70 -37
- package/dist/users.d.ts +12 -7
- package/dist/users.js +12 -7
- package/dist/users.js.map +1 -1
- package/package.json +1 -1
- package/src/app-sdk/ids.js +28 -4
- package/src/app-sdk/platform-domains.js +30 -9
- package/src/app-sdk/upload-publication.js +21 -6
- package/src/config.ts +6 -4
- package/src/http.ts +18 -9
- package/src/notify.test-d.ts +16 -10
- package/src/notify.ts +15 -11
- package/src/tus.ts +38 -32
- package/src/types.ts +71 -37
- package/src/users.ts +12 -7
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* The upload publication contract between Forge and Core's activation, and
|
|
7
|
-
* the facts of a transfer
|
|
8
|
-
* publication
|
|
9
|
-
* names),
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* too: the upload id its delete is
|
|
7
|
+
* the facts of a transfer both services spell: its token's shape and the
|
|
8
|
+
* publication the token is bound to (a content version, and the one an ingot
|
|
9
|
+
* row names), its charge's ledger reference and category, Core's revocation
|
|
10
|
+
* of an upload's token, and the refusals of Core's a transfer's answer names
|
|
11
|
+
* (the header, and the lock of a vault scheduled for deletion). Every client
|
|
12
|
+
* ends an upload it gives up by one rule here too: the upload id its delete is
|
|
13
|
+
* conditioned on (givenUpUploadId).
|
|
13
14
|
*
|
|
14
15
|
* Forge stamps UPLOAD_PUBLICATION_PROTOCOL on every upload session it creates
|
|
15
16
|
* and on the final state it hands Core's activation (POST
|
|
@@ -130,6 +131,20 @@ export function uploadTransferReference(istk) {
|
|
|
130
131
|
return `forge_ingot_transfer_upload_${istk.slice(0, TRANSFER_REFERENCE_ISTK_CHARS)}`;
|
|
131
132
|
}
|
|
132
133
|
|
|
134
|
+
/**
|
|
135
|
+
* The usage-ledger category, and type, of a Forge transfer's charge, by
|
|
136
|
+
* direction. Every charge of one upload (Core's activation, Core's charge of
|
|
137
|
+
* an upload that never publishes, Forge's cancel) lands under the one
|
|
138
|
+
* reference uploadTransferReference names, so each spells its category from
|
|
139
|
+
* here, and the console counts both directions as the bandwidth the ledger
|
|
140
|
+
* measures. Each day's usage summary is keyed by category, so a category's
|
|
141
|
+
* spelling is the key its rows sum under.
|
|
142
|
+
*/
|
|
143
|
+
export const TRANSFER_CHARGE_CATEGORIES = Object.freeze({
|
|
144
|
+
UPLOAD: 'Ingot Transfer - Forge Encryption',
|
|
145
|
+
DOWNLOAD: 'Ingot Transfer - Forge Decryption'
|
|
146
|
+
});
|
|
147
|
+
|
|
133
148
|
/**
|
|
134
149
|
* The codes Core's activation refuses an upload with, which Forge's refusal
|
|
135
150
|
* map reads (the status is Core's):
|
package/src/config.ts
CHANGED
|
@@ -52,10 +52,12 @@ export interface SparkVaultMobileConfig {
|
|
|
52
52
|
*/
|
|
53
53
|
backgroundTransfer?: MobileBackgroundTransfer;
|
|
54
54
|
/**
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
55
|
+
* Whole-file PATCH adapter (one request, no progress, no abort; see
|
|
56
|
+
* MobileBackgroundUploader on backing it with a background session), the
|
|
57
|
+
* fallback when no `backgroundTransfer` engine is configured. Used only by
|
|
58
|
+
* uploads that ask for it (`transport: 'background'`) and fit one chunk;
|
|
59
|
+
* every other upload, and every upload when this is unset, streams over
|
|
60
|
+
* XHR.
|
|
59
61
|
*/
|
|
60
62
|
backgroundUploader?: MobileBackgroundUploader;
|
|
61
63
|
/**
|
package/src/http.ts
CHANGED
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
SparkVaultMobileError,
|
|
6
6
|
SparkVaultNetworkError,
|
|
7
7
|
SparkVaultTimeoutError,
|
|
8
|
-
vatRefusalReason,
|
|
9
8
|
} from './errors.js';
|
|
10
9
|
import { isTransientHttpStatus } from './app-sdk/transient.js';
|
|
10
|
+
import { isRefusedLogin } from './app-sdk/vat-refusal.js';
|
|
11
11
|
import { createDedupMutex } from './mutex.js';
|
|
12
12
|
import { queryString, type ApiPath, type QueryParams } from './request-path.js';
|
|
13
13
|
import type { ApiErrorBody, ApiMeta, ApiResponse } from './types.js';
|
|
@@ -152,14 +152,23 @@ export class MobileHttpClient {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
/**
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
155
|
+
* Throw a 401 that is not Core refusing the login itself. Only Core's
|
|
156
|
+
* session code (AUTHENTICATION_ERROR) naming no refused vault access token
|
|
157
|
+
* is a dead login a refresh can renew (`isRefusedLogin`,
|
|
158
|
+
* @sparkvault/app-sdk/vat-refusal). A refused VAT (VAT_INVALID), or a key
|
|
159
|
+
* the request presents refused (an unseal's DVAK: UNAUTHORIZED), leaves
|
|
160
|
+
* the session standing: no refresh revives either, so it is thrown as it
|
|
161
|
+
* is, with the one-time refresh token unspent.
|
|
158
162
|
*/
|
|
159
|
-
private async
|
|
160
|
-
const
|
|
161
|
-
|
|
162
|
-
|
|
163
|
+
private async throwUnlessRefusedLogin(response: Response): Promise<void> {
|
|
164
|
+
const body = await this.readErrorBody(response);
|
|
165
|
+
const refusal = {
|
|
166
|
+
statusCode: response.status,
|
|
167
|
+
upstreamCode: typeof body.error?.code === 'string' ? body.error.code : null,
|
|
168
|
+
details: body.error?.details,
|
|
169
|
+
};
|
|
170
|
+
if (!isRefusedLogin(refusal)) {
|
|
171
|
+
throw this.httpError(response.status, body);
|
|
163
172
|
}
|
|
164
173
|
}
|
|
165
174
|
|
|
@@ -330,7 +339,7 @@ export class MobileHttpClient {
|
|
|
330
339
|
}
|
|
331
340
|
|
|
332
341
|
if (response.status === 401 && !options.skipAuth) {
|
|
333
|
-
await this.
|
|
342
|
+
await this.throwUnlessRefusedLogin(response);
|
|
334
343
|
await this.renewSession();
|
|
335
344
|
headers = await this.getHeaders({ ...options, body: options.body });
|
|
336
345
|
try {
|
package/src/notify.test-d.ts
CHANGED
|
@@ -1,18 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Notify wire-contract assertions — COMPILE-TIME ONLY.
|
|
3
3
|
*
|
|
4
|
-
* `NotificationRow` has no runtime, so a unit test can never
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* push and again on every SDK publish)
|
|
8
|
-
*
|
|
4
|
+
* `NotificationRow` has no runtime, so a unit test can never see how a field is
|
|
5
|
+
* typed: the transpiler strips it and every assertion passes. This file is the
|
|
6
|
+
* gate for that instead — `tsc --noEmit` (`pnpm typecheck`, which CI runs on
|
|
7
|
+
* every push and again on every SDK publish) refuses to compile the moment a
|
|
8
|
+
* member below stops being typed as stated there; the statements mirror
|
|
9
|
+
* `apps/api/src/notify/inbox.js` (`projectRow`) by hand.
|
|
10
|
+
*
|
|
11
|
+
* WHICH fields the row carries is gated across packages rather than here:
|
|
12
|
+
* tests/notify-contract.test.ts holds `NotificationRow` to
|
|
13
|
+
* `NOTIFY_RESPONSE_FIELDS.inboxRow` (`@sparkvault/app-sdk/notify-contract`),
|
|
14
|
+
* the list the Core API's suite holds its projection to.
|
|
9
15
|
*
|
|
10
16
|
* It is deliberately NOT a `*.test.ts`: that suffix is excluded from `tsconfig`,
|
|
11
17
|
* which would put these assertions exactly where the compiler cannot see them.
|
|
12
18
|
*
|
|
13
19
|
* The row shape is shared verbatim with `@sparkvault/sdk-js`, whose own contract
|
|
14
|
-
* file asserts the same four members
|
|
15
|
-
* server source is `apps/api/src/notify/inbox.js` (`projectRow`).
|
|
20
|
+
* file asserts the same four members, so both move together.
|
|
16
21
|
*/
|
|
17
22
|
|
|
18
23
|
import type { NotificationRow } from './notify.js';
|
|
@@ -34,10 +39,11 @@ export type NotifyWireContract = [
|
|
|
34
39
|
// it optional would let the app skip the "no longer available" branch and fall
|
|
35
40
|
// through to a reveal that opens nothing.
|
|
36
41
|
Assert<Equals<NotificationRow['recalled'], boolean>>,
|
|
37
|
-
// `locked` is
|
|
42
|
+
// `locked` is whether the row carries its pointer — always present.
|
|
38
43
|
Assert<Equals<NotificationRow['locked'], boolean>>,
|
|
39
|
-
// The pointer is
|
|
40
|
-
// it is optional in both directions and must be guarded
|
|
44
|
+
// The pointer is carried only while its grant still opens and is absent on a
|
|
45
|
+
// cleartext row, so it is optional in both directions and must be guarded
|
|
46
|
+
// before use.
|
|
41
47
|
Assert<Equals<NotificationRow['sparklink_code'], string | undefined>>,
|
|
42
48
|
// The URL the pointer opens travels with it: absent exactly when the pointer is.
|
|
43
49
|
Assert<Equals<NotificationRow['pointer_url'], string | undefined>>,
|
package/src/notify.ts
CHANGED
|
@@ -34,9 +34,11 @@ export interface NotificationRow {
|
|
|
34
34
|
archived_at: number | null;
|
|
35
35
|
/**
|
|
36
36
|
* The grant to open. Present only while a live reveal stands behind it — a
|
|
37
|
-
* SEALED (secure) send
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* SEALED (secure) send whose grant still opens: not yet opened (on a send that
|
|
38
|
+
* asks for an answer, not yet answered), not expired, not gone and not
|
|
39
|
+
* recalled. A cleartext send delivers its content inline in the channel and
|
|
40
|
+
* mints no grant; once the reveal no longer opens, the pointer is withheld
|
|
41
|
+
* rather than echoed.
|
|
40
42
|
*/
|
|
41
43
|
sparklink_code?: string;
|
|
42
44
|
/**
|
|
@@ -47,9 +49,10 @@ export interface NotificationRow {
|
|
|
47
49
|
pointer_url?: string;
|
|
48
50
|
/**
|
|
49
51
|
* True only when there is a secure part left to reveal — exactly when
|
|
50
|
-
* `sparklink_code` is present. `false` does NOT mean "cleartext row": a
|
|
51
|
-
* row
|
|
52
|
-
*
|
|
52
|
+
* `sparklink_code` is present. `false` does NOT mean "cleartext row": a sealed
|
|
53
|
+
* row whose reveal no longer opens (opened, answered, expired or gone) is
|
|
54
|
+
* unlocked too, and so is a recalled one, with nothing behind it. Branch on
|
|
55
|
+
* `recalled` before treating an unlocked row as plain text.
|
|
53
56
|
*/
|
|
54
57
|
locked: boolean;
|
|
55
58
|
/**
|
|
@@ -58,7 +61,6 @@ export interface NotificationRow {
|
|
|
58
61
|
* tap-to-reveal that opens nothing.
|
|
59
62
|
*/
|
|
60
63
|
recalled: boolean;
|
|
61
|
-
thread_id?: string;
|
|
62
64
|
}
|
|
63
65
|
|
|
64
66
|
export interface ListNotificationsOptions {
|
|
@@ -143,10 +145,12 @@ export interface RegisterDeviceResponse {
|
|
|
143
145
|
const MARK_ALL_MAX_PAGES = 100;
|
|
144
146
|
|
|
145
147
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
148
|
+
* SparkVault's first-party Notify surface: the metadata-only inbox of a user
|
|
149
|
+
* signed in to SparkVault itself, holding the notifications SparkVault delivered
|
|
150
|
+
* to them `in_app`, plus this device's push registration. The recipient is
|
|
151
|
+
* ALWAYS derived from the session on the server — no method takes a
|
|
152
|
+
* `recipient_id`, and any account/recipient a caller might try to supply is
|
|
153
|
+
* ignored.
|
|
150
154
|
*/
|
|
151
155
|
export class MobileNotifyClient {
|
|
152
156
|
private readonly http: MobileHttpClient;
|
package/src/tus.ts
CHANGED
|
@@ -104,19 +104,21 @@ export interface TusUploadFromUriOptions {
|
|
|
104
104
|
* Invoked whenever the session's expiry, as its latest answer named it,
|
|
105
105
|
* changes: Forge slides it forward with every committed chunk and names it
|
|
106
106
|
* on its answers (`Upload-Expires`). It is null (unknown) after an answer
|
|
107
|
-
* that named none, and from the hand-off of a request
|
|
108
|
-
*
|
|
109
|
-
* PATCH): either may have moved it unread. A caller
|
|
110
|
-
* session keeps its `expiresAt` current with this, so a
|
|
111
|
-
* expired (`isSessionExpired`) really is. A throw here
|
|
107
|
+
* that named none, and from the hand-off of a request JS cannot follow
|
|
108
|
+
* while it runs (the transfer engine's range, the single-chunk
|
|
109
|
+
* `backgroundUploader` PATCH): either may have moved it unread. A caller
|
|
110
|
+
* that persists the session keeps its `expiresAt` current with this, so a
|
|
111
|
+
* session it judges expired (`isSessionExpired`) really is. A throw here
|
|
112
|
+
* fails the upload.
|
|
112
113
|
*/
|
|
113
114
|
onSessionExpiry?: (expiresAt: number | null) => void;
|
|
114
115
|
/**
|
|
115
|
-
* `background`
|
|
116
|
-
*
|
|
117
|
-
* range of any file, else
|
|
118
|
-
* progress, no abort
|
|
119
|
-
*
|
|
116
|
+
* `background` asks for a transfer that survives suspension and rides the
|
|
117
|
+
* best engine the app provides: the OS transfer engine
|
|
118
|
+
* (`backgroundTransfer`) for the whole remaining range of any file, else
|
|
119
|
+
* the single-chunk `backgroundUploader` (no progress, no abort; whether it
|
|
120
|
+
* outlives a suspension is the uploader's) for a file that fits one chunk,
|
|
121
|
+
* else XHR. Default `foreground`: every chunk goes over XHR.
|
|
120
122
|
*/
|
|
121
123
|
transport?: UploadTransport;
|
|
122
124
|
/**
|
|
@@ -537,9 +539,11 @@ class SessionExpiry {
|
|
|
537
539
|
}
|
|
538
540
|
|
|
539
541
|
/**
|
|
540
|
-
* A request
|
|
541
|
-
*
|
|
542
|
-
* possibly while the app is not
|
|
542
|
+
* A request JS cannot follow while it runs is about to leave: the OS
|
|
543
|
+
* transfer engine's range, whose chunks commit (each sliding the expiry)
|
|
544
|
+
* with answers this upload never reads, possibly while the app is not
|
|
545
|
+
* running; or the single-chunk `backgroundUploader` PATCH, which reports
|
|
546
|
+
* nothing until it answers.
|
|
543
547
|
*/
|
|
544
548
|
forget(): void {
|
|
545
549
|
this.become(null);
|
|
@@ -958,11 +962,12 @@ function sendChunkOverXhr(
|
|
|
958
962
|
}
|
|
959
963
|
|
|
960
964
|
/**
|
|
961
|
-
* PATCH a whole file as the session's only chunk
|
|
962
|
-
*
|
|
963
|
-
*
|
|
964
|
-
*
|
|
965
|
-
* is read exactly like the
|
|
965
|
+
* PATCH a whole file as the session's only chunk through the app's
|
|
966
|
+
* single-request uploader (`backgroundUploader`) and resolve with Forge's
|
|
967
|
+
* answer, or with no answer when the adapter got none. The request reports
|
|
968
|
+
* no progress and takes no abort; whether it outlives a suspension is the
|
|
969
|
+
* uploader's (MobileBackgroundUploader). Its answer is read exactly like the
|
|
970
|
+
* XHR path's, so callers see one error taxonomy.
|
|
966
971
|
*/
|
|
967
972
|
async function sendWholeFileInBackground(
|
|
968
973
|
uploader: MobileBackgroundUploader,
|
|
@@ -1471,14 +1476,14 @@ export class MobileTusUploader {
|
|
|
1471
1476
|
private async sendChunk(transfer: TusTransfer, offset: number, chunks: ChunkSource): Promise<TransferAnswer> {
|
|
1472
1477
|
const backgroundUploader = chunks.transport === 'background' ? this.config.backgroundUploader : undefined;
|
|
1473
1478
|
if (backgroundUploader && this.fitsOneBackgroundRequest(offset, transfer.fileSize, transfer.chunkSize)) {
|
|
1474
|
-
// The
|
|
1475
|
-
// flight cannot stop it
|
|
1476
|
-
//
|
|
1477
|
-
//
|
|
1478
|
-
//
|
|
1479
|
-
//
|
|
1480
|
-
//
|
|
1481
|
-
//
|
|
1479
|
+
// The uploader takes no abort, so an abort that fires while this
|
|
1480
|
+
// request is in flight cannot stop it. It only ever carries a whole
|
|
1481
|
+
// single-chunk file, so a 2xx here means the transfer is complete: the
|
|
1482
|
+
// loop ends and the upload finishes normally (the caller verifies the
|
|
1483
|
+
// ingot), because a finished upload must never be reported as
|
|
1484
|
+
// cancelled, and a DELETE now would drop bytes Forge has already
|
|
1485
|
+
// finalized. Only an answer that leaves bytes missing reaches the abort
|
|
1486
|
+
// check before the next request.
|
|
1482
1487
|
transfer.expiry.forget();
|
|
1483
1488
|
return sendWholeFileInBackground(backgroundUploader, transfer, chunks.uri, offset);
|
|
1484
1489
|
}
|
|
@@ -1669,12 +1674,13 @@ export class MobileTusUploader {
|
|
|
1669
1674
|
}
|
|
1670
1675
|
|
|
1671
1676
|
/**
|
|
1672
|
-
* Whether the remaining transfer is ONE PATCH the
|
|
1673
|
-
* send: nothing uploaded yet and the whole file
|
|
1674
|
-
*
|
|
1675
|
-
* not exactly `X-Chunk-Size`, so a multi-chunk
|
|
1676
|
-
* request, and a partially uploaded session would
|
|
1677
|
-
* A zero-byte file stays on the XHR path (it
|
|
1677
|
+
* Whether the remaining transfer is ONE PATCH the single-request uploader
|
|
1678
|
+
* (`backgroundUploader`) can send: nothing uploaded yet and the whole file
|
|
1679
|
+
* inside a single chunk. The uploader sends whole files and Forge rejects
|
|
1680
|
+
* any non-final chunk that is not exactly `X-Chunk-Size`, so a multi-chunk
|
|
1681
|
+
* file has no legal single request, and a partially uploaded session would
|
|
1682
|
+
* resend bytes Forge holds. A zero-byte file stays on the XHR path (it
|
|
1683
|
+
* sends no PATCH at all there).
|
|
1678
1684
|
*/
|
|
1679
1685
|
private fitsOneBackgroundRequest(offset: number, fileSize: number, chunkSize: number): boolean {
|
|
1680
1686
|
return offset === 0 && fileSize > 0 && fileSize <= chunkSize;
|
package/src/types.ts
CHANGED
|
@@ -143,7 +143,14 @@ export interface InviteMemberResponse {
|
|
|
143
143
|
invited_at: number;
|
|
144
144
|
/** False when the invite row was created but the email failed to send. */
|
|
145
145
|
email_sent: boolean;
|
|
146
|
+
/** Why the email was not sent, when it was not. */
|
|
146
147
|
email_error?: string | null;
|
|
148
|
+
/**
|
|
149
|
+
* Set when the mail transport declined the email, because the address
|
|
150
|
+
* bounced, was reported as spam or opted out (`deliverability` or
|
|
151
|
+
* `consent`): resending is declined too.
|
|
152
|
+
*/
|
|
153
|
+
email_declined?: string | null;
|
|
147
154
|
}
|
|
148
155
|
|
|
149
156
|
export interface RemoveMemberResponse {
|
|
@@ -165,10 +172,25 @@ export interface ResendInviteResponse {
|
|
|
165
172
|
message: string;
|
|
166
173
|
}
|
|
167
174
|
|
|
175
|
+
/**
|
|
176
|
+
* The Identity free trial of an account on its trial lifecycle. `active` is
|
|
177
|
+
* whether it still runs: false once it is exhausted or `expired`, which the
|
|
178
|
+
* account stays on until it buys a tier.
|
|
179
|
+
*/
|
|
180
|
+
export interface SubscriptionIdentityTrial {
|
|
181
|
+
active: boolean;
|
|
182
|
+
started_at: number | null;
|
|
183
|
+
expires_at: number | null;
|
|
184
|
+
expired: boolean;
|
|
185
|
+
}
|
|
186
|
+
|
|
168
187
|
/**
|
|
169
188
|
* Identity attempts usage. `attempts_cap` is the EFFECTIVE monthly allowance:
|
|
170
|
-
* the
|
|
171
|
-
* `attempts_cap_base` is
|
|
189
|
+
* the tier the period paid for, or the trial allowance while a trial is live.
|
|
190
|
+
* `attempts_cap_base` is the tier bought, as the subscription renews it: 0 on
|
|
191
|
+
* a trial, and the lower tier (0 for a cancel) while a decrease waits for the
|
|
192
|
+
* renewal, the period keeping the tier it paid for until then. `trial` is
|
|
193
|
+
* null off the trial lifecycle.
|
|
172
194
|
*/
|
|
173
195
|
export interface SubscriptionIdentityStatus {
|
|
174
196
|
attempts_cap: number | null;
|
|
@@ -176,6 +198,7 @@ export interface SubscriptionIdentityStatus {
|
|
|
176
198
|
attempts_used: number;
|
|
177
199
|
soft_cap: number | null;
|
|
178
200
|
state: PoolState;
|
|
201
|
+
trial?: SubscriptionIdentityTrial | null;
|
|
179
202
|
}
|
|
180
203
|
|
|
181
204
|
/**
|
|
@@ -226,13 +249,22 @@ export interface SparkVaultSubscription {
|
|
|
226
249
|
prepaid: boolean;
|
|
227
250
|
};
|
|
228
251
|
blocks: {
|
|
229
|
-
/** Effective capacity blocks
|
|
252
|
+
/** Effective capacity blocks: those this subscription holds for the
|
|
253
|
+
* period plus the add-on subscriptions' while a base Full License exists. */
|
|
230
254
|
storage: number;
|
|
231
255
|
bandwidth: number;
|
|
232
|
-
/** Blocks THIS subscription
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
256
|
+
/** Blocks THIS subscription renews with, as the subscription renews them. */
|
|
257
|
+
storage_base: number;
|
|
258
|
+
bandwidth_base: number;
|
|
259
|
+
/** Bandwidth blocks this subscription's current period paid for: above
|
|
260
|
+
* `bandwidth_base` while a dropped block waits for the renewal, the pool
|
|
261
|
+
* holding them until then. */
|
|
262
|
+
bandwidth_paid: number;
|
|
263
|
+
/** Blocks the account's capacity add-on subscriptions hold (bought on any
|
|
264
|
+
* rail, the App Store and Google Play among them): the tier a store's
|
|
265
|
+
* add-on sheet owns. */
|
|
266
|
+
storage_addon: number;
|
|
267
|
+
bandwidth_addon: number;
|
|
236
268
|
};
|
|
237
269
|
pools: SubscriptionPools;
|
|
238
270
|
identity: SubscriptionIdentityStatus;
|
|
@@ -533,7 +565,6 @@ export interface Vault {
|
|
|
533
565
|
ingot_count: number;
|
|
534
566
|
storage_bytes: number;
|
|
535
567
|
created_at: number;
|
|
536
|
-
created_by_user_id?: string;
|
|
537
568
|
last_unsealed_at?: number;
|
|
538
569
|
unseal_count?: number;
|
|
539
570
|
}
|
|
@@ -599,7 +630,11 @@ export interface ListVaultsResponse {
|
|
|
599
630
|
next_cursor?: string;
|
|
600
631
|
}
|
|
601
632
|
|
|
602
|
-
/**
|
|
633
|
+
/**
|
|
634
|
+
* A vault's public sharing policy (GET /v1/vaults/{id}/sharing). Every sharing
|
|
635
|
+
* write answers it too, as the write left it; `enabled_at` is the current
|
|
636
|
+
* enablement's, null while sharing is off.
|
|
637
|
+
*/
|
|
603
638
|
export interface VaultSharingConfig {
|
|
604
639
|
vault_id: string;
|
|
605
640
|
public_sharing_enabled: boolean;
|
|
@@ -614,25 +649,21 @@ export interface VaultSharingOptions {
|
|
|
614
649
|
session_length_seconds?: number;
|
|
615
650
|
}
|
|
616
651
|
|
|
617
|
-
export interface EnableVaultSharingResponse {
|
|
618
|
-
|
|
619
|
-
public_sharing_enabled: boolean;
|
|
620
|
-
all_ingots_public: boolean;
|
|
652
|
+
export interface EnableVaultSharingResponse extends VaultSharingConfig {
|
|
653
|
+
public_sharing_enabled: true;
|
|
621
654
|
session_length_seconds: number;
|
|
622
655
|
enabled_at: number;
|
|
656
|
+
security_notice: string;
|
|
623
657
|
}
|
|
624
658
|
|
|
625
|
-
export interface DisableVaultSharingResponse {
|
|
626
|
-
vault_id: string;
|
|
659
|
+
export interface DisableVaultSharingResponse extends VaultSharingConfig {
|
|
627
660
|
public_sharing_enabled: false;
|
|
628
661
|
disabled_at: number;
|
|
629
662
|
shares_revoked: number;
|
|
630
663
|
}
|
|
631
664
|
|
|
632
|
-
export interface UpdateVaultSharingResponse {
|
|
633
|
-
|
|
634
|
-
public_sharing_enabled: boolean;
|
|
635
|
-
all_ingots_public: boolean;
|
|
665
|
+
export interface UpdateVaultSharingResponse extends VaultSharingConfig {
|
|
666
|
+
public_sharing_enabled: true;
|
|
636
667
|
session_length_seconds: number;
|
|
637
668
|
updated_at: number;
|
|
638
669
|
}
|
|
@@ -647,7 +678,11 @@ export interface UpdateAccessLogRetentionResponse extends AccessLogRetention {
|
|
|
647
678
|
updated_at: number;
|
|
648
679
|
}
|
|
649
680
|
|
|
650
|
-
/**
|
|
681
|
+
/**
|
|
682
|
+
* A vault's upload portal and widget settings (GET /v1/vaults/{id}/upload).
|
|
683
|
+
* Every upload write answers them too, as the write left them; a channel's
|
|
684
|
+
* enabled-at is its current enablement's, null while the channel is off.
|
|
685
|
+
*/
|
|
651
686
|
export interface UploadConfig {
|
|
652
687
|
vault_id: string;
|
|
653
688
|
upload_portal_enabled: boolean;
|
|
@@ -659,35 +694,32 @@ export interface UploadConfig {
|
|
|
659
694
|
portal_url?: string;
|
|
660
695
|
}
|
|
661
696
|
|
|
662
|
-
export interface UploadPortalEnabled {
|
|
663
|
-
vault_id: string;
|
|
697
|
+
export interface UploadPortalEnabled extends UploadConfig {
|
|
664
698
|
upload_portal_enabled: true;
|
|
699
|
+
upload_portal_enabled_at: number;
|
|
665
700
|
enabled_at: number;
|
|
666
701
|
portal_url: string;
|
|
667
702
|
}
|
|
668
703
|
|
|
669
|
-
export interface UploadWidgetEnabled {
|
|
670
|
-
vault_id: string;
|
|
704
|
+
export interface UploadWidgetEnabled extends UploadConfig {
|
|
671
705
|
upload_widget_enabled: true;
|
|
706
|
+
upload_widget_enabled_at: number;
|
|
672
707
|
enabled_at: number;
|
|
673
708
|
}
|
|
674
709
|
|
|
675
|
-
export interface UploadPortalDisabled {
|
|
676
|
-
vault_id: string;
|
|
710
|
+
export interface UploadPortalDisabled extends UploadConfig {
|
|
677
711
|
upload_portal_enabled: false;
|
|
712
|
+
upload_portal_enabled_at: null;
|
|
678
713
|
disabled_at: number;
|
|
679
714
|
}
|
|
680
715
|
|
|
681
|
-
export interface UploadWidgetDisabled {
|
|
682
|
-
vault_id: string;
|
|
716
|
+
export interface UploadWidgetDisabled extends UploadConfig {
|
|
683
717
|
upload_widget_enabled: false;
|
|
718
|
+
upload_widget_enabled_at: null;
|
|
684
719
|
disabled_at: number;
|
|
685
720
|
}
|
|
686
721
|
|
|
687
|
-
export interface UploadConfigUpdate {
|
|
688
|
-
vault_id: string;
|
|
689
|
-
max_size_bytes: number;
|
|
690
|
-
notification_email: string | null;
|
|
722
|
+
export interface UploadConfigUpdate extends UploadConfig {
|
|
691
723
|
updated_at: number;
|
|
692
724
|
}
|
|
693
725
|
|
|
@@ -999,10 +1031,12 @@ export interface IngotUploadSession extends TusSessionInfo {
|
|
|
999
1031
|
* `background` asks for the transfer to survive the app being suspended, and
|
|
1000
1032
|
* resolves to the best engine the app provides, in order: the OS transfer
|
|
1001
1033
|
* engine (`backgroundTransfer`: any file size, any offset, progress and
|
|
1002
|
-
* abort, chunks chained natively), else the
|
|
1003
|
-
* (`backgroundUploader`: only a file that fits one
|
|
1004
|
-
*
|
|
1005
|
-
*
|
|
1034
|
+
* abort, chunks chained natively while the app is suspended), else the
|
|
1035
|
+
* single-request uploader (`backgroundUploader`: only a file that fits one
|
|
1036
|
+
* chunk, sent as one PATCH with no progress and no abort; whether it
|
|
1037
|
+
* outlives a suspension is the uploader's, see MobileBackgroundUploader),
|
|
1038
|
+
* else plain XHR. The upload semantics are the same on every engine; only
|
|
1039
|
+
* what survives a suspension differs.
|
|
1006
1040
|
*/
|
|
1007
1041
|
export type UploadTransport = 'foreground' | 'background';
|
|
1008
1042
|
|
|
@@ -1057,7 +1091,7 @@ export interface MobileBackgroundTransfer {
|
|
|
1057
1091
|
cancel(uploadUrl: string): Promise<void>;
|
|
1058
1092
|
}
|
|
1059
1093
|
|
|
1060
|
-
/** Network policy an upload carries into the OS transfer; ignored by the XHR paths (JS gates those). Defaults: both true. */
|
|
1094
|
+
/** Network policy an upload carries into the OS transfer engine; ignored by the XHR and single-request paths (JS gates those). Defaults: both true. */
|
|
1061
1095
|
export interface UploadTransferPolicy {
|
|
1062
1096
|
allowsCellularAccess?: boolean;
|
|
1063
1097
|
allowsConstrainedNetworkAccess?: boolean;
|
package/src/users.ts
CHANGED
|
@@ -48,12 +48,13 @@ export class MobileUsersClient {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
|
-
* Remove a member
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
51
|
+
* Remove a member: their DVAKs, API keys and sign-in sessions are revoked
|
|
52
|
+
* now, and an access token already issued stays valid until it expires,
|
|
53
|
+
* within the hour. A license they held stays paid until the end of the
|
|
54
|
+
* billing period — nothing is refunded — and is not renewed; until then it
|
|
55
|
+
* can be given to someone else at no charge. `wind_down` is true when this
|
|
56
|
+
* removal ends the subscription — theirs was the last license it renews, and
|
|
57
|
+
* it was not already set to end: it ends at the period end.
|
|
57
58
|
*/
|
|
58
59
|
async remove(userId: string): Promise<RemoveMemberResponse> {
|
|
59
60
|
validateResourceId(userId, 'user ID', 'userId');
|
|
@@ -61,7 +62,11 @@ export class MobileUsersClient {
|
|
|
61
62
|
return response.data;
|
|
62
63
|
}
|
|
63
64
|
|
|
64
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Resend a pending invitation email (resets the 7-day expiry). Refused 409
|
|
67
|
+
* INVITATION_EMAIL_DECLINED, saying why, when the mail transport declines
|
|
68
|
+
* the address.
|
|
69
|
+
*/
|
|
65
70
|
async resendInvite(userId: string): Promise<ResendInviteResponse> {
|
|
66
71
|
validateResourceId(userId, 'user ID', 'userId');
|
|
67
72
|
const response = await this.http.post<ResendInviteResponse>(apiPath`/users/${userId}/resend-invite`);
|