@sparkvault/sdk-mobile 9.0.11 → 10.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 +15 -5
- package/dist/app-sdk/ids.d.ts +1 -0
- package/dist/app-sdk/ids.js +1 -0
- package/dist/app-sdk/ids.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 +14 -11
- package/dist/errors.js +21 -12
- package/dist/errors.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 +9 -16
- package/dist/ingots.js +0 -3
- package/dist/ingots.js.map +1 -1
- package/dist/tus.d.ts +9 -64
- package/dist/tus.js +26 -185
- package/dist/tus.js.map +1 -1
- package/dist/types.d.ts +14 -54
- package/package.json +6 -6
- package/src/app-sdk/ids.js +1 -0
- package/src/config.ts +1 -13
- package/src/errors.ts +27 -17
- package/src/identity-dialog.tsx +2 -2
- package/src/index.ts +0 -1
- package/src/ingots.ts +10 -19
- package/src/tus.ts +49 -254
- package/src/types.ts +14 -52
package/src/types.ts
CHANGED
|
@@ -1026,7 +1026,10 @@ export interface MobileFileReader {
|
|
|
1026
1026
|
* line wrapping, no whitespace, correctly padded. The string is handed
|
|
1027
1027
|
* verbatim to React Native's native networking (`{ base64 }` request body),
|
|
1028
1028
|
* whose iOS decoder is strict — non-canonical output is rejected before
|
|
1029
|
-
* send. expo-file-system's readAsStringAsync
|
|
1029
|
+
* send. expo-file-system's readAsStringAsync writes this form, but its
|
|
1030
|
+
* `position` is a 32-bit Int on Android, where a read past 2 GiB returns
|
|
1031
|
+
* other bytes; a FileHandle read (`File.open`, `offset`, `readBytes`)
|
|
1032
|
+
* encoded with this SDK's `bytesToBase64` reads any range on both
|
|
1030
1033
|
* platforms.
|
|
1031
1034
|
*/
|
|
1032
1035
|
readAsBase64(fileUri: string, options: { position: number; length: number }): Promise<string>;
|
|
@@ -1034,23 +1037,15 @@ export interface MobileFileReader {
|
|
|
1034
1037
|
|
|
1035
1038
|
/**
|
|
1036
1039
|
* A tus upload session as Forge created it: the session URL, the per-upload
|
|
1037
|
-
* token every request on it must carry, the chunk geometry Forge fixed
|
|
1038
|
-
*
|
|
1039
|
-
*
|
|
1040
|
-
* Forge holds.
|
|
1040
|
+
* token every request on it must carry, and the chunk geometry Forge fixed
|
|
1041
|
+
* for it. Persist it to resume the upload after a failed attempt or a
|
|
1042
|
+
* relaunch (`ingots.resumeUpload`) instead of re-sending bytes Forge holds;
|
|
1043
|
+
* the resume asks Forge (HEAD) whether it still holds the session.
|
|
1041
1044
|
*/
|
|
1042
1045
|
export interface TusSessionInfo {
|
|
1043
1046
|
uploadUrl: string;
|
|
1044
1047
|
istk: string;
|
|
1045
1048
|
chunkSize: number;
|
|
1046
|
-
/**
|
|
1047
|
-
* When the session lapses (epoch ms, Forge's `Upload-Expires`), or null
|
|
1048
|
-
* when Forge named no expiry. Forge slides it forward on every committed
|
|
1049
|
-
* chunk, so a caller that persists the session keeps this current through
|
|
1050
|
-
* the upload's `onSessionExpiry`; past it, Forge refuses every request to
|
|
1051
|
-
* the session (`isSessionExpired`).
|
|
1052
|
-
*/
|
|
1053
|
-
expiresAt: number | null;
|
|
1054
1049
|
}
|
|
1055
1050
|
|
|
1056
1051
|
/**
|
|
@@ -1076,15 +1071,11 @@ export interface IngotUploadSession extends TusSessionInfo {
|
|
|
1076
1071
|
/**
|
|
1077
1072
|
* Which transport a tus upload rides. `foreground` (the default) streams
|
|
1078
1073
|
* chunks over XHR with progress events, abort, and the stall watchdog.
|
|
1079
|
-
* `background` asks for the transfer to survive the app being suspended
|
|
1080
|
-
*
|
|
1081
|
-
*
|
|
1082
|
-
*
|
|
1083
|
-
*
|
|
1084
|
-
* chunk, sent as one PATCH with no progress and no abort; whether it
|
|
1085
|
-
* outlives a suspension is the uploader's, see MobileBackgroundUploader),
|
|
1086
|
-
* else plain XHR. The upload semantics are the same on every engine; only
|
|
1087
|
-
* what survives a suspension differs.
|
|
1074
|
+
* `background` asks for the transfer to survive the app being suspended: the
|
|
1075
|
+
* OS transfer engine (`backgroundTransfer`: any file size, any offset,
|
|
1076
|
+
* progress and abort, chunks chained natively while the app is suspended)
|
|
1077
|
+
* takes it when the app provides one, and plain XHR otherwise. The upload
|
|
1078
|
+
* semantics are the same on both; only what survives a suspension differs.
|
|
1088
1079
|
*/
|
|
1089
1080
|
export type UploadTransport = 'foreground' | 'background';
|
|
1090
1081
|
|
|
@@ -1139,7 +1130,7 @@ export interface MobileBackgroundTransfer {
|
|
|
1139
1130
|
cancel(uploadUrl: string): Promise<void>;
|
|
1140
1131
|
}
|
|
1141
1132
|
|
|
1142
|
-
/** Network policy an upload carries into the OS transfer engine; ignored by the XHR
|
|
1133
|
+
/** Network policy an upload carries into the OS transfer engine; ignored by the XHR path (JS gates it). Defaults: both true. */
|
|
1143
1134
|
export interface UploadTransferPolicy {
|
|
1144
1135
|
allowsCellularAccess?: boolean;
|
|
1145
1136
|
allowsConstrainedNetworkAccess?: boolean;
|
|
@@ -1160,35 +1151,6 @@ export interface UploadTransferPolicy {
|
|
|
1160
1151
|
*/
|
|
1161
1152
|
export type UploadAbortBehavior = 'terminate' | 'keep';
|
|
1162
1153
|
|
|
1163
|
-
/**
|
|
1164
|
-
* App-provided adapter that PATCHes a whole local file as the request body.
|
|
1165
|
-
* The fallback behind `backgroundTransfer`: the tus uploader reaches for it
|
|
1166
|
-
* only when no OS transfer engine is configured and the file fits one chunk;
|
|
1167
|
-
* everything else keeps the streaming XHR path.
|
|
1168
|
-
*
|
|
1169
|
-
* The SDK does not ask for an OS background session here, and a host should
|
|
1170
|
-
* think twice before backing this with one. A background session hands the
|
|
1171
|
-
* body's path to a system daemon that opens the file in its own process,
|
|
1172
|
-
* outside whatever sandbox extensions the app holds; a file the app can read
|
|
1173
|
-
* is not necessarily one the daemon can. Where `fileUri` may point outside
|
|
1174
|
-
* the app's container - a photo library original, a document-picker result -
|
|
1175
|
-
* a background session fails at open() before a byte moves, and reports it
|
|
1176
|
-
* as a transport error indistinguishable from a dead connection. A host that
|
|
1177
|
-
* wants suspension-survival should stage the body into its own container
|
|
1178
|
-
* first, the way the OS transfer engine does, or supply
|
|
1179
|
-
* `backgroundTransfer` instead. Note that opting out can take an explicit
|
|
1180
|
-
* flag: expo-file-system's `uploadAsync` writes `sessionType: BACKGROUND`
|
|
1181
|
-
* into its options before spreading the caller's, so omitting the key selects
|
|
1182
|
-
* a background session rather than declining one.
|
|
1183
|
-
*/
|
|
1184
|
-
export interface MobileBackgroundUploader {
|
|
1185
|
-
uploadFile(
|
|
1186
|
-
url: string,
|
|
1187
|
-
fileUri: string,
|
|
1188
|
-
options: { method: 'PATCH'; headers: Record<string, string> }
|
|
1189
|
-
): Promise<{ status: number; headers: Record<string, string>; body: string }>;
|
|
1190
|
-
}
|
|
1191
|
-
|
|
1192
1154
|
export interface MobileDownloadProgress {
|
|
1193
1155
|
bytesWritten: number;
|
|
1194
1156
|
bytesTotal?: number;
|