/** * @aquienpz/sdk/expo — native multipart uploads for React Native / Expo. * * Wraps `@aquienpz/asset-uploader-expo`'s `UploadTask`, which delegates * the actual byte transfer to a native background session (URLSession * on iOS, WorkManager on Android). The upload survives: * - JS thread freezing * - App backgrounding * - OS-initiated kill (low-memory, user swiping away) * - Network blips (retries with backoff) * * Usage: * * import { createExpoUploader, listResumableSessions } from "@aquienpz/sdk/expo"; * * const aq = new AquienpzClient({ ... }); * * // Resume any uploads from a prior app launch on boot. * const resumable = await listResumableSessions(); * // ...show a banner offering to resume them * * const upload = createExpoUploader(aq, { * file: { uri: assetUri, mime: "video/mp4", name: "tour.mp4" }, * }); * upload.on("progress", ({ ratio }) => setProgress(ratio)); * const { assetId } = await upload.start(); * await aq.slots.bind("storefront.tour.video", { assetId, preset: "video" }); * * Peer dep: `@aquienpz/asset-uploader-expo` (lazy — apps that don't * use the mobile SDK skip the install). */ import type { AquienpzClient } from ".."; import { UploadTask, type UploadTaskOptions } from "@aquienpz/asset-uploader-expo"; export type ExpoUploadOptions = Omit; /** * Spawn a native-backed `UploadTask` bound to a configured client. * Inherits the client's endpoint / api key / tenant scope; caller only * has to supply the file input + any per-upload tuning (partSize, * concurrency). */ export function createExpoUploader( client: AquienpzClient, options: ExpoUploadOptions, ): UploadTask { const access = client as unknown as { opts: { endpoint: string; apiKey: string; tenantCode: string }; }; return new UploadTask({ ...options, endpoint: access.opts.endpoint, authToken: access.opts.apiKey, tenantCode: access.opts.tenantCode, }); } export { UploadTask, listResumableSessions, cancelResumableSession, } from "@aquienpz/asset-uploader-expo"; export type { UploadEvents, UploadFileInput, UploadSessionState, UploadTaskOptions, } from "@aquienpz/asset-uploader-expo";