@sparkvault/sdk-mobile 9.0.10 → 10.0.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.
- package/README.md +2 -2
- package/dist/client.d.ts +2 -1
- package/dist/client.js +2 -1
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +2 -12
- package/dist/config.js +0 -1
- package/dist/config.js.map +1 -1
- package/dist/errors.d.ts +15 -13
- package/dist/errors.js +21 -12
- package/dist/errors.js.map +1 -1
- package/dist/http.d.ts +44 -18
- package/dist/http.js +64 -33
- package/dist/http.js.map +1 -1
- package/dist/identity-dialog.d.ts +1 -1
- package/dist/identity-dialog.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/ingots.d.ts +20 -36
- package/dist/ingots.js +18 -45
- package/dist/ingots.js.map +1 -1
- package/dist/tus.d.ts +21 -76
- package/dist/tus.js +61 -222
- package/dist/tus.js.map +1 -1
- package/dist/types.d.ts +12 -56
- package/package.json +6 -6
- package/src/client.ts +2 -1
- package/src/config.ts +1 -13
- package/src/errors.ts +28 -19
- package/src/http.ts +74 -38
- package/src/identity-dialog.tsx +2 -2
- package/src/index.ts +0 -1
- package/src/ingots.ts +31 -73
- package/src/tus.ts +77 -286
- package/src/types.ts +12 -54
package/src/types.ts
CHANGED
|
@@ -874,9 +874,8 @@ export interface UploadResult {
|
|
|
874
874
|
created?: boolean;
|
|
875
875
|
/**
|
|
876
876
|
* The ingot status the upload confirmed: `active`, the server's read of
|
|
877
|
-
* the published ingot. An upload whose
|
|
878
|
-
*
|
|
879
|
-
* `retryLater` is set.
|
|
877
|
+
* the published ingot. An upload whose read finds any other status never
|
|
878
|
+
* resolves: it rejects with a `TusUploadError` in phase `finalize`.
|
|
880
879
|
*/
|
|
881
880
|
status?: Ingot['status'];
|
|
882
881
|
/**
|
|
@@ -1035,23 +1034,15 @@ export interface MobileFileReader {
|
|
|
1035
1034
|
|
|
1036
1035
|
/**
|
|
1037
1036
|
* A tus upload session as Forge created it: the session URL, the per-upload
|
|
1038
|
-
* token every request on it must carry, the chunk geometry Forge fixed
|
|
1039
|
-
*
|
|
1040
|
-
*
|
|
1041
|
-
* Forge holds.
|
|
1037
|
+
* token every request on it must carry, and the chunk geometry Forge fixed
|
|
1038
|
+
* for it. Persist it to resume the upload after a failed attempt or a
|
|
1039
|
+
* relaunch (`ingots.resumeUpload`) instead of re-sending bytes Forge holds;
|
|
1040
|
+
* the resume asks Forge (HEAD) whether it still holds the session.
|
|
1042
1041
|
*/
|
|
1043
1042
|
export interface TusSessionInfo {
|
|
1044
1043
|
uploadUrl: string;
|
|
1045
1044
|
istk: string;
|
|
1046
1045
|
chunkSize: number;
|
|
1047
|
-
/**
|
|
1048
|
-
* When the session lapses (epoch ms, Forge's `Upload-Expires`), or null
|
|
1049
|
-
* when Forge named no expiry. Forge slides it forward on every committed
|
|
1050
|
-
* chunk, so a caller that persists the session keeps this current through
|
|
1051
|
-
* the upload's `onSessionExpiry`; past it, Forge refuses every request to
|
|
1052
|
-
* the session (`isSessionExpired`).
|
|
1053
|
-
*/
|
|
1054
|
-
expiresAt: number | null;
|
|
1055
1046
|
}
|
|
1056
1047
|
|
|
1057
1048
|
/**
|
|
@@ -1077,15 +1068,11 @@ export interface IngotUploadSession extends TusSessionInfo {
|
|
|
1077
1068
|
/**
|
|
1078
1069
|
* Which transport a tus upload rides. `foreground` (the default) streams
|
|
1079
1070
|
* chunks over XHR with progress events, abort, and the stall watchdog.
|
|
1080
|
-
* `background` asks for the transfer to survive the app being suspended
|
|
1081
|
-
*
|
|
1082
|
-
*
|
|
1083
|
-
*
|
|
1084
|
-
*
|
|
1085
|
-
* chunk, sent as one PATCH with no progress and no abort; whether it
|
|
1086
|
-
* outlives a suspension is the uploader's, see MobileBackgroundUploader),
|
|
1087
|
-
* else plain XHR. The upload semantics are the same on every engine; only
|
|
1088
|
-
* what survives a suspension differs.
|
|
1071
|
+
* `background` asks for the transfer to survive the app being suspended: the
|
|
1072
|
+
* OS transfer engine (`backgroundTransfer`: any file size, any offset,
|
|
1073
|
+
* progress and abort, chunks chained natively while the app is suspended)
|
|
1074
|
+
* takes it when the app provides one, and plain XHR otherwise. The upload
|
|
1075
|
+
* semantics are the same on both; only what survives a suspension differs.
|
|
1089
1076
|
*/
|
|
1090
1077
|
export type UploadTransport = 'foreground' | 'background';
|
|
1091
1078
|
|
|
@@ -1140,7 +1127,7 @@ export interface MobileBackgroundTransfer {
|
|
|
1140
1127
|
cancel(uploadUrl: string): Promise<void>;
|
|
1141
1128
|
}
|
|
1142
1129
|
|
|
1143
|
-
/** Network policy an upload carries into the OS transfer engine; ignored by the XHR
|
|
1130
|
+
/** Network policy an upload carries into the OS transfer engine; ignored by the XHR path (JS gates it). Defaults: both true. */
|
|
1144
1131
|
export interface UploadTransferPolicy {
|
|
1145
1132
|
allowsCellularAccess?: boolean;
|
|
1146
1133
|
allowsConstrainedNetworkAccess?: boolean;
|
|
@@ -1161,35 +1148,6 @@ export interface UploadTransferPolicy {
|
|
|
1161
1148
|
*/
|
|
1162
1149
|
export type UploadAbortBehavior = 'terminate' | 'keep';
|
|
1163
1150
|
|
|
1164
|
-
/**
|
|
1165
|
-
* App-provided adapter that PATCHes a whole local file as the request body.
|
|
1166
|
-
* The fallback behind `backgroundTransfer`: the tus uploader reaches for it
|
|
1167
|
-
* only when no OS transfer engine is configured and the file fits one chunk;
|
|
1168
|
-
* everything else keeps the streaming XHR path.
|
|
1169
|
-
*
|
|
1170
|
-
* The SDK does not ask for an OS background session here, and a host should
|
|
1171
|
-
* think twice before backing this with one. A background session hands the
|
|
1172
|
-
* body's path to a system daemon that opens the file in its own process,
|
|
1173
|
-
* outside whatever sandbox extensions the app holds; a file the app can read
|
|
1174
|
-
* is not necessarily one the daemon can. Where `fileUri` may point outside
|
|
1175
|
-
* the app's container - a photo library original, a document-picker result -
|
|
1176
|
-
* a background session fails at open() before a byte moves, and reports it
|
|
1177
|
-
* as a transport error indistinguishable from a dead connection. A host that
|
|
1178
|
-
* wants suspension-survival should stage the body into its own container
|
|
1179
|
-
* first, the way the OS transfer engine does, or supply
|
|
1180
|
-
* `backgroundTransfer` instead. Note that opting out can take an explicit
|
|
1181
|
-
* flag: expo-file-system's `uploadAsync` writes `sessionType: BACKGROUND`
|
|
1182
|
-
* into its options before spreading the caller's, so omitting the key selects
|
|
1183
|
-
* a background session rather than declining one.
|
|
1184
|
-
*/
|
|
1185
|
-
export interface MobileBackgroundUploader {
|
|
1186
|
-
uploadFile(
|
|
1187
|
-
url: string,
|
|
1188
|
-
fileUri: string,
|
|
1189
|
-
options: { method: 'PATCH'; headers: Record<string, string> }
|
|
1190
|
-
): Promise<{ status: number; headers: Record<string, string>; body: string }>;
|
|
1191
|
-
}
|
|
1192
|
-
|
|
1193
1151
|
export interface MobileDownloadProgress {
|
|
1194
1152
|
bytesWritten: number;
|
|
1195
1153
|
bytesTotal?: number;
|