@dimah-s3/react 1.7.1 → 2.0.0-beta.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 +53 -13
- package/dist/api.d.ts +24 -15
- package/dist/api.d.ts.map +1 -1
- package/dist/chunk-SPUUNLXI.js +824 -0
- package/dist/chunk-SPUUNLXI.js.map +1 -0
- package/dist/create-s3-client.d.ts +1 -1
- package/dist/create-s3-client.d.ts.map +1 -1
- package/dist/engine.d.ts +15 -1
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +204 -512
- package/dist/engine.js.map +1 -1
- package/dist/helpers/format-accept-labels.d.ts +15 -2
- package/dist/helpers/format-accept-labels.d.ts.map +1 -1
- package/dist/helpers/format-date.d.ts +7 -0
- package/dist/helpers/format-date.d.ts.map +1 -0
- package/dist/helpers/format-dimah-error.d.ts +12 -2
- package/dist/helpers/format-dimah-error.d.ts.map +1 -1
- package/dist/helpers/format-file-size.d.ts +20 -0
- package/dist/helpers/format-file-size.d.ts.map +1 -0
- package/dist/helpers/format-speed.d.ts +1 -1
- package/dist/helpers/format-speed.d.ts.map +1 -1
- package/dist/helpers/format-upload-progress.d.ts +1 -1
- package/dist/helpers/format-upload-progress.d.ts.map +1 -1
- package/dist/helpers/index.d.ts +5 -8
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/load-route-catalog.d.ts +32 -8
- package/dist/helpers/load-route-catalog.d.ts.map +1 -1
- package/dist/helpers/throttled-speed.d.ts +2 -2
- package/dist/helpers/throttled-speed.d.ts.map +1 -1
- package/dist/helpers/to-timestamp.d.ts +5 -0
- package/dist/helpers/to-timestamp.d.ts.map +1 -0
- package/dist/helpers/truncate-file-name.d.ts +8 -0
- package/dist/helpers/truncate-file-name.d.ts.map +1 -0
- package/dist/helpers/use-format-accept-labels.d.ts +12 -0
- package/dist/helpers/use-format-accept-labels.d.ts.map +1 -0
- package/dist/helpers/use-format-eta.d.ts +14 -0
- package/dist/helpers/use-format-eta.d.ts.map +1 -0
- package/dist/helpers/use-format-speed.d.ts +12 -0
- package/dist/helpers/use-format-speed.d.ts.map +1 -0
- package/dist/hooks/use-delete.d.ts +6 -44
- package/dist/hooks/use-delete.d.ts.map +1 -1
- package/dist/hooks/use-download.d.ts +7 -117
- package/dist/hooks/use-download.d.ts.map +1 -1
- package/dist/hooks/use-fetch-download.d.ts +8 -0
- package/dist/hooks/use-fetch-download.d.ts.map +1 -0
- package/dist/hooks/use-file-intake.d.ts +43 -29
- package/dist/hooks/use-file-intake.d.ts.map +1 -1
- package/dist/hooks/use-file-upload.d.ts +38 -34
- package/dist/hooks/use-file-upload.d.ts.map +1 -1
- package/dist/hooks/use-object-list-selection.d.ts +78 -0
- package/dist/hooks/use-object-list-selection.d.ts.map +1 -0
- package/dist/hooks/use-object-list.d.ts +66 -16
- package/dist/hooks/use-object-list.d.ts.map +1 -1
- package/dist/hooks/use-object-url.d.ts +27 -10
- package/dist/hooks/use-object-url.d.ts.map +1 -1
- package/dist/hooks/use-route-upload-policy.d.ts +22 -14
- package/dist/hooks/use-route-upload-policy.d.ts.map +1 -1
- package/dist/hooks/use-upload.d.ts +72 -65
- package/dist/hooks/use-upload.d.ts.map +1 -1
- package/dist/index.d.ts +15 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2420 -2164
- package/dist/index.js.map +1 -1
- package/dist/internal/abortable.d.ts +9 -0
- package/dist/internal/abortable.d.ts.map +1 -0
- package/dist/internal/browser-download.d.ts +15 -0
- package/dist/internal/browser-download.d.ts.map +1 -0
- package/dist/internal/callbacks.d.ts +54 -0
- package/dist/internal/callbacks.d.ts.map +1 -0
- package/dist/internal/client-error.d.ts +15 -0
- package/dist/internal/client-error.d.ts.map +1 -0
- package/dist/internal/hooks.d.ts +27 -0
- package/dist/internal/hooks.d.ts.map +1 -0
- package/dist/internal/lru.d.ts +13 -0
- package/dist/internal/lru.d.ts.map +1 -0
- package/dist/internal/operations.d.ts +74 -0
- package/dist/internal/operations.d.ts.map +1 -0
- package/dist/internal/pool.d.ts +8 -0
- package/dist/internal/pool.d.ts.map +1 -0
- package/dist/list/entries.d.ts +14 -0
- package/dist/list/entries.d.ts.map +1 -0
- package/dist/list/memory-object-source.d.ts +60 -0
- package/dist/list/memory-object-source.d.ts.map +1 -0
- package/dist/list/types.d.ts +123 -11
- package/dist/list/types.d.ts.map +1 -1
- package/dist/s3-provider.d.ts +3 -2
- package/dist/s3-provider.d.ts.map +1 -1
- package/dist/store/local-storage-store.d.ts +5 -4
- package/dist/store/local-storage-store.d.ts.map +1 -1
- package/dist/store/memory-store.d.ts +3 -4
- package/dist/store/memory-store.d.ts.map +1 -1
- package/dist/translations/types.d.ts +105 -23
- package/dist/translations/types.d.ts.map +1 -1
- package/dist/types/delete.d.ts +98 -9
- package/dist/types/delete.d.ts.map +1 -1
- package/dist/types/download.d.ts +152 -23
- package/dist/types/download.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/operation.d.ts +38 -0
- package/dist/types/operation.d.ts.map +1 -0
- package/dist/types/upload-store.d.ts +30 -40
- package/dist/types/upload-store.d.ts.map +1 -1
- package/dist/types/upload.d.ts +177 -130
- package/dist/types/upload.d.ts.map +1 -1
- package/dist/upload/abort.d.ts +10 -0
- package/dist/upload/abort.d.ts.map +1 -0
- package/dist/upload/constants.d.ts +8 -3
- package/dist/upload/constants.d.ts.map +1 -1
- package/dist/upload/index.d.ts +3 -2
- package/dist/upload/index.d.ts.map +1 -1
- package/dist/upload/multipart.d.ts +14 -4
- package/dist/upload/multipart.d.ts.map +1 -1
- package/dist/upload/part-pool.d.ts +16 -0
- package/dist/upload/part-pool.d.ts.map +1 -0
- package/dist/upload/presigned-http.d.ts +5 -14
- package/dist/upload/presigned-http.d.ts.map +1 -1
- package/dist/upload/progress.d.ts +7 -0
- package/dist/upload/progress.d.ts.map +1 -0
- package/dist/upload/request.d.ts +9 -0
- package/dist/upload/request.d.ts.map +1 -0
- package/dist/upload/resume-key.d.ts +7 -3
- package/dist/upload/resume-key.d.ts.map +1 -1
- package/dist/upload/retry.d.ts +27 -2
- package/dist/upload/retry.d.ts.map +1 -1
- package/dist/upload/stored-upload.d.ts +7 -0
- package/dist/upload/stored-upload.d.ts.map +1 -0
- package/dist/upload/upload-file.d.ts +10 -11
- package/dist/upload/upload-file.d.ts.map +1 -1
- package/dist/upload/upload-part.d.ts +6 -3
- package/dist/upload/upload-part.d.ts.map +1 -1
- package/dist/upload/xhr-upload.d.ts +10 -2
- package/dist/upload/xhr-upload.d.ts.map +1 -1
- package/package.json +7 -8
- package/dist/helpers/format-eta.d.ts +0 -13
- package/dist/helpers/format-eta.d.ts.map +0 -1
- package/dist/helpers/format-validate-file-error.d.ts +0 -9
- package/dist/helpers/format-validate-file-error.d.ts.map +0 -1
- package/dist/hooks/index.d.ts +0 -7
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/internal-helpers.d.ts +0 -10
- package/dist/internal-helpers.d.ts.map +0 -1
- package/dist/store/use-immer-state.d.ts +0 -8
- package/dist/store/use-immer-state.d.ts.map +0 -1
- package/dist/types/error.d.ts +0 -27
- package/dist/types/error.d.ts.map +0 -1
- package/dist/upload/upload-files.d.ts +0 -26
- package/dist/upload/upload-files.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/upload/constants.ts","../src/internal/client-error.ts","../src/helpers/load-route-catalog.ts","../src/upload/abort.ts","../src/upload/request.ts","../src/upload/resume-key.ts","../src/internal/callbacks.ts","../src/internal/pool.ts","../src/upload/progress.ts","../src/internal/abortable.ts","../src/upload/retry.ts","../src/upload/xhr-upload.ts","../src/upload/upload-part.ts","../src/upload/part-pool.ts","../src/upload/stored-upload.ts","../src/upload/multipart.ts","../src/upload/presigned-http.ts","../src/upload/upload-file.ts","../src/list/entries.ts","../src/helpers/format-accept-labels.ts","../src/helpers/format-file-size.ts","../src/helpers/to-timestamp.ts"],"names":["s3Error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,MAAM,MAAA,GAAS,EAAA,IAAM,QAAA,CAASA,KAAI,CAAA;AAClC,IAAA,OAAO,KAAK,KAAA,CAAO,IAAA,GAAO,IAAA,IAAQA,KAAAA,GAAQ,MAAM,CAAA,GAAI,MAAA;AAAA,EACtD,CAAA;AACA,EAAA,IAAI,IAAI,IAAA,IAAQ,OAAA,CAAQ,CAAC,CAAA,IAAK,MAAM,CAAA,IAAK,CAAA;AACzC,EAAA,MAAM,IAAA,GAAO,KAAA,CAAM,CAAC,CAAA,IAAK,GAAA;AACzB,EAAA,MAAM,KAAA,GAAQ,aAAa,OAAA,CAAQ,MAAA,IAAU,SAAS,QAAA,CAAS,CAAC,CAAC,CAAA,CAAE,MAAA;AAAA,IACjE,QAAQ,CAAC;AAAA,GACX;AACA,EAAA,OAAO,GAAG,KAAK,CAAA,CAAA,EAAI,QAAQ,KAAA,GAAQ,IAAI,KAAK,IAAI,CAAA,CAAA;AAClD;;;ACtEO,SAAS,YACd,KAAA,EACe;AACf,EAAA,IAAI,KAAA,IAAS,IAAA,IAAQ,KAAA,KAAU,EAAA,EAAI,OAAO,IAAA;AAC1C,EAAA,MAAM,IAAA,GACJ,KAAA,YAAiB,IAAA,GACb,KAAA,CAAM,OAAA,EAAQ,GACd,OAAO,KAAA,KAAU,QAAA,GACf,KAAA,GACA,IAAA,CAAK,KAAA,CAAM,KAAK,CAAA;AACxB,EAAA,OAAO,MAAA,CAAO,QAAA,CAAS,IAAI,CAAA,GAAI,IAAA,GAAO,IAAA;AACxC","file":"chunk-SPUUNLXI.js","sourcesContent":["/** Files at least this large use multipart when the route allows it. */\nexport const DEFAULT_MULTIPART_THRESHOLD = 50 * 1024 * 1024; // 50 MiB\nexport const MAX_RETRIES = 3;\nexport const RETRY_BASE_DELAY = 1_000; // ms\nexport const DEFAULT_CONCURRENT_PARTS = 4;\nexport const DEFAULT_CONCURRENT_FILES = 2;\n/** Default max files per selection: one file. */\nexport const DEFAULT_MAX_FILES = 1;\n/**\n * A presigned URL counts as expired this long before its `expiresIn` ends,\n * to allow for clock skew between the app server and S3.\n */\nexport const URL_EXPIRY_MARGIN_MS = 30_000;\n","import { APIError, isAPIError, s3Error, type S3Api } from \"@dimah-s3/core\";\n\n/** A better-call error, such as one a custom backend rethrows: its code is in `body`. */\nexport function isRawAPIError(\n error: unknown,\n): error is Error & { statusCode?: unknown; body?: unknown } {\n return error instanceof Error && error.name === \"APIError\";\n}\n\n/**\n * Normalizes a thrown value to an {@link APIError} with a stable `code`.\n * A raw better-call error is rebuilt from its body, because it keeps its code\n * only in `body.code`. Anything else becomes `UNKNOWN_ERROR`.\n */\nexport function toClientError(error: unknown): APIError {\n if (isAPIError(error)) return error;\n if (isRawAPIError(error)) {\n const status: unknown = error.statusCode;\n const statusCode = typeof status === \"number\" ? status : undefined;\n const body: unknown = error.body;\n if (!isErrorBody(body)) {\n return s3Error(\"UNKNOWN_ERROR\", undefined, {\n status: statusCode,\n cause: error,\n });\n }\n const rebuilt = APIError.fromShape(\n {\n code: body.code,\n message: body.message ?? body.code,\n ...(isErrorParams(body.params) ? { params: body.params } : {}),\n },\n statusCode,\n );\n rebuilt.cause = error;\n return rebuilt;\n }\n return s3Error(\"UNKNOWN_ERROR\", undefined, { cause: error });\n}\n\n/** The hook's `api` option or the provider's, else a setup error naming the hook. */\nexport function requireApi(api: S3Api | null | undefined, hook: string): S3Api {\n if (api) return api;\n throw new Error(\n `[dimah-s3] No S3Api found. Pass \\`api\\` to ${hook} or wrap with <S3Provider>.`,\n );\n}\n\nfunction isErrorBody(\n body: unknown,\n): body is { code: string; message?: string; params?: unknown } {\n if (typeof body !== \"object\" || body === null) return false;\n const { code, message } = body as { code?: unknown; message?: unknown };\n return (\n typeof code === \"string\" &&\n (message === undefined || typeof message === \"string\")\n );\n}\n\nfunction isErrorParams(\n params: unknown,\n): params is Record<string, string | number> {\n return (\n typeof params === \"object\" &&\n params !== null &&\n Object.values(params).every(\n (value) => typeof value === \"string\" || typeof value === \"number\",\n )\n );\n}\n","import type { RouteCatalogResponse, S3Api, S3RouteName } from \"@dimah-s3/core\";\nimport { toClientError } from \"@/internal/client-error\";\n\nconst catalogByApi = new WeakMap<S3Api, Promise<RouteCatalogResponse>>();\n\n/** What a named route allows for uploads, from `GET /routes`. */\nexport type RouteUploadPolicy = {\n /** Accepted file types (`image/*`, `.pdf`). Omitted when any type is allowed. */\n accept?: string[];\n /** Max file size in bytes. */\n maxFileSize?: number;\n /** Whether large files go through multipart upload. */\n multipart: boolean;\n /** Whether single-shot uploads must send a SHA-256 checksum. */\n checksum: boolean;\n};\n\n/** Client options that narrow a {@link RouteUploadPolicy}. */\nexport type RouteUploadPolicyOptions = {\n accept?: readonly string[];\n maxFileSize?: number;\n /** `false` turns multipart off even when the route allows it. */\n multipart?: boolean;\n};\n\n/**\n * Loads the route catalog for an `S3Api` and caches it per `S3Api`.\n * A failure is not cached, so a later call retries, and it rejects with an\n * `APIError`.\n */\nexport function loadRouteCatalog(api: S3Api): Promise<RouteCatalogResponse> {\n const cached = catalogByApi.get(api);\n if (cached) return cached;\n const pending = api.catalog().catch((error: unknown) => {\n catalogByApi.delete(api);\n throw toClientError(error);\n });\n catalogByApi.set(api, pending);\n return pending;\n}\n\n/**\n * The upload policy of `route` in `catalog`. A route that is missing, has\n * uploads disabled, or a catalog that is not loaded yet (`null`) allows\n * neither multipart nor checksums and sets no constraints.\n */\nexport function resolveRouteUploadPolicy(\n catalog: RouteCatalogResponse | null | undefined,\n route: S3RouteName,\n): RouteUploadPolicy {\n const upload = catalog?.routes[route]?.upload;\n if (upload?.enabled !== true) return { multipart: false, checksum: false };\n return {\n ...(upload.fileTypes?.length ? { accept: [...upload.fileTypes] } : {}),\n ...(upload.maxFileSize === undefined\n ? {}\n : { maxFileSize: upload.maxFileSize }),\n multipart: upload.multipart,\n checksum: upload.checksum,\n };\n}\n\n/**\n * Narrows a route policy with client options. The stricter constraint wins:\n * the smaller `maxFileSize`, and the `accept` tokens both lists allow\n * (`image/png` within `image/*`). An option extension is kept against a\n * route MIME type (`.png` within `image/*`); the server still enforces the\n * route. When the lists share nothing, the route's list is kept.\n * `multipart` needs the route and an option that is not `false`; `checksum`\n * always follows the route.\n */\nexport function mergeRouteUploadPolicy(\n policy: RouteUploadPolicy,\n options: RouteUploadPolicyOptions,\n): RouteUploadPolicy {\n const accept = narrowAccept(options.accept, policy.accept);\n const maxFileSize = smaller(options.maxFileSize, policy.maxFileSize);\n return {\n ...(accept ? { accept } : {}),\n ...(maxFileSize === undefined ? {} : { maxFileSize }),\n multipart: policy.multipart && options.multipart !== false,\n checksum: policy.checksum,\n };\n}\n\nfunction smaller(a: number | undefined, b: number | undefined) {\n if (a === undefined) return b;\n if (b === undefined) return a;\n return Math.min(a, b);\n}\n\nfunction narrowAccept(\n options: readonly string[] | undefined,\n route: readonly string[] | undefined,\n): string[] | undefined {\n if (!options?.length) return route?.length ? [...route] : undefined;\n if (!route?.length) return [...options];\n const tokens = new Set<string>();\n for (const option of options) {\n for (const allowed of route) {\n const token = narrowToken(option, allowed);\n if (token !== undefined) tokens.add(token);\n }\n }\n return tokens.size > 0 ? [...tokens] : [...route];\n}\n\n/** The narrower of two accept tokens, or `undefined` when they share nothing. */\nfunction narrowToken(option: string, allowed: string): string | undefined {\n const a = option.toLowerCase();\n const b = allowed.toLowerCase();\n if (a === b) return option;\n const aIsExtension = a.startsWith(\".\");\n const bIsExtension = b.startsWith(\".\");\n // An option extension is taken to name a type inside the route's MIME\n // type (`.png` within `image/*`). A MIME option cannot be checked against\n // a route extension, so it is dropped.\n if (aIsExtension || bIsExtension) {\n return aIsExtension && !bIsExtension ? option : undefined;\n }\n if (b.endsWith(\"/*\") && a.startsWith(b.slice(0, -1))) return option;\n if (a.endsWith(\"/*\") && b.startsWith(a.slice(0, -1))) return allowed;\n return undefined;\n}\n","import type { UploadAbortKind } from \"@/types/upload\";\n\n/**\n * The abort reason for an upload: an `AbortError` `DOMException` whose\n * message is `kind`. Abort an upload's signal with it to pick what happens\n * to a stored multipart upload.\n */\nexport function uploadAbortReason(kind: UploadAbortKind): DOMException {\n return new DOMException(kind, \"AbortError\");\n}\n\n/** The kind of an abort reason made by {@link uploadAbortReason}, else `null`. */\nexport function getUploadAbortKind(reason: unknown): UploadAbortKind | null {\n if (!(reason instanceof DOMException) || reason.name !== \"AbortError\") {\n return null;\n }\n const kind = reason.message;\n return kind === \"cancel\" || kind === \"detach\" ? kind : null;\n}\n","import type { UploadRequestInput, UploadRequestOptions } from \"@/types/upload\";\n\n/**\n * `override` over `base`, the way `useUpload` puts a call's `uploadOptions`\n * over the hook's: `override` fields win, and `metadata` merges key by key.\n */\nexport function mergeUploadRequest(\n base: UploadRequestOptions | undefined,\n override: UploadRequestOptions | undefined,\n): UploadRequestOptions {\n if (!base || !override) return override ?? base ?? {};\n const merged = { ...base, ...override };\n if (base.metadata && override.metadata) {\n merged.metadata = { ...base.metadata, ...override.metadata };\n }\n return merged;\n}\n\n/** The request options `input` gives for `file`. */\nexport function resolveUploadRequest(\n input: UploadRequestInput | undefined,\n file: File,\n): UploadRequestOptions | undefined {\n return typeof input === \"function\" ? input(file) : input;\n}\n","import type { UploadRequestOptions } from \"@/types/upload\";\n\n/**\n * Stable client-side identity for multipart resume: the route, the file, and\n * the `request` options passed to `uploadFile`. A stored upload resumes only\n * for the same file sent with the same name, type and metadata, so it never\n * completes into another folder. The S3 object key is server-generated and\n * unknown until init.\n */\nexport function multipartResumeKey(\n route: string,\n file: File,\n request: UploadRequestOptions = {},\n): string {\n const key = `${route}:${file.name}:${file.size}:${file.lastModified}`;\n const { fileName = \"\", contentType = \"\", metadata = {} } = request;\n // Sorted, so the key does not depend on the order metadata was built in.\n const entries = Object.entries(metadata).toSorted(([a], [b]) =>\n a < b ? -1 : a > b ? 1 : 0,\n );\n if (!fileName && !contentType && entries.length === 0) return key;\n return `${key}:${JSON.stringify([fileName, contentType, entries])}`;\n}\n","import { s3Error, type APIError } from \"@dimah-s3/core\";\nimport type { OperationOutcome } from \"@/types/operation\";\n\n/** What a `before*` callback decided. */\nexport type BeforeCallbackResult =\n | { status: \"allowed\" }\n | { status: \"blocked\" }\n | { status: \"error\"; error: APIError };\n\n/**\n * Runs a `before*` callback once for a call. Returning `false` blocks the\n * call. A throw or rejection becomes `HOOK_FAILED` with the error as `cause`.\n * A missing callback allows the call.\n */\nexport async function runBeforeCallback<TArgs extends unknown[]>(\n name: string,\n callback: ((...args: TArgs) => boolean | Promise<boolean>) | undefined,\n ...args: TArgs\n): Promise<BeforeCallbackResult> {\n if (!callback) return { status: \"allowed\" };\n try {\n const allowed = await callback(...args);\n return allowed ? { status: \"allowed\" } : { status: \"blocked\" };\n } catch (error) {\n return { status: \"error\", error: hookFailed(name, error) };\n }\n}\n\n/**\n * Runs an `on*Start` callback. Returns `HOOK_FAILED` when it throws, so the\n * caller can fail the call, and `null` otherwise.\n */\nexport function runStartCallback<TArgs extends unknown[]>(\n name: string,\n callback: ((...args: TArgs) => void) | undefined,\n ...args: TArgs\n): APIError | null {\n try {\n callback?.(...args);\n return null;\n } catch (error) {\n return hookFailed(name, error);\n }\n}\n\n/**\n * Runs and awaits an after-callback (`onSuccess`, `onError`, `onSettled`).\n * A throw or rejection goes to {@link reportCallbackError} and never changes\n * the outcome.\n */\nexport async function runAfterCallback<TArgs extends unknown[]>(\n callback: ((...args: TArgs) => void | Promise<void>) | undefined,\n ...args: TArgs\n): Promise<void> {\n if (!callback) return;\n try {\n await callback(...args);\n } catch (error) {\n reportCallbackError(error);\n }\n}\n\n/** The after-callbacks of a hook whose calls settle one key each. */\nexport type OperationCallbacks<TData> = {\n onError?: (error: APIError, key: string) => void | Promise<void>;\n onSuccess?: (data: TData, key: string) => void | Promise<void>;\n onSettled?: (outcome: OperationOutcome<TData>) => void | Promise<void>;\n};\n\n/**\n * Runs the after-callbacks for one settled single-key call: `onError` or\n * `onSuccess`, then `onSettled`. Call it once the key is free, so a callback\n * can start the same key again.\n */\nexport async function reportOperationOutcome<TData>(\n { onError, onSuccess, onSettled }: OperationCallbacks<TData>,\n outcome: OperationOutcome<TData>,\n): Promise<void> {\n if (outcome.status === \"error\") {\n await runAfterCallback(onError, outcome.error, outcome.key);\n } else if (outcome.status === \"success\") {\n await runAfterCallback(onSuccess, outcome.data, outcome.key);\n }\n await runAfterCallback(onSettled, outcome);\n}\n\n/**\n * Runs a progress-style callback (`onProgress`, `onFileReject`, ...)\n * synchronously. A throw goes to {@link reportCallbackError}, never rethrown.\n */\nexport function notify<TArgs extends unknown[]>(\n callback: ((...args: TArgs) => void) | undefined,\n ...args: TArgs\n): void {\n try {\n callback?.(...args);\n } catch (error) {\n reportCallbackError(error);\n }\n}\n\n/**\n * Reports an error thrown by a consumer callback without rethrowing it:\n * through the global `reportError` when the runtime has one (browsers), and\n * `console.error` otherwise.\n */\nexport function reportCallbackError(error: unknown): void {\n if (typeof globalThis.reportError === \"function\") {\n globalThis.reportError(error);\n } else {\n console.error(error);\n }\n}\n\n/** `HOOK_FAILED` for a consumer callback named `hook` that threw `cause`. */\nexport function hookFailed(hook: string, cause: unknown): APIError {\n return s3Error(\"HOOK_FAILED\", { hook }, { cause });\n}\n","/**\n * Runs `task` for every item with at most `concurrency` tasks at once.\n * Results keep the order of `items`. The first rejection rejects the whole\n * run, and no new task starts after it; tasks already running are not\n * stopped, so pass them a signal to cancel them.\n */\nexport async function mapWithConcurrency<T, R>(\n items: readonly T[],\n concurrency: number,\n task: (item: T, index: number) => Promise<R>,\n): Promise<R[]> {\n const results = new Array<R>(items.length);\n let next = 0;\n let failed = false;\n\n async function worker() {\n while (!failed && next < items.length) {\n const index = next++;\n try {\n results[index] = await task(items[index], index);\n } catch (error) {\n failed = true;\n throw error;\n }\n }\n }\n\n const workers = Math.max(1, Math.min(concurrency, items.length));\n await Promise.all(Array.from({ length: workers }, worker));\n return results;\n}\n","import type { TransferProgress } from \"@/types/operation\";\n\n/**\n * Progress for `loaded` of `total` bytes, with a whole-number percent capped\n * at 100. A `total` of `0` is unknown, and its percent is `0`.\n */\nexport function transferProgress(\n loaded: number,\n total: number,\n): TransferProgress {\n return {\n loaded,\n total,\n percent: total > 0 ? Math.min(100, Math.round((loaded / total) * 100)) : 0,\n };\n}\n","/**\n * Settles like `promise`, or rejects with `signal.reason` when the signal\n * aborts first. Use it for work that does not take a signal itself, such as\n * a consumer callback. Once aborted, a later rejection of `promise` is ignored.\n */\nexport async function abortable<T>(\n promise: PromiseLike<T>,\n signal: AbortSignal | undefined,\n): Promise<T> {\n const work = Promise.resolve(promise);\n if (!signal) return work;\n\n if (!signal.aborted) {\n const { promise: aborted, resolve } = Promise.withResolvers<void>();\n const onAbort = () => resolve();\n signal.addEventListener(\"abort\", onAbort, { once: true });\n try {\n await Promise.race([work, aborted]);\n } finally {\n signal.removeEventListener(\"abort\", onAbort);\n }\n }\n\n if (signal.aborted) work.catch(ignore);\n signal.throwIfAborted();\n return work;\n}\n\n/** Resolves after `ms`, or rejects with `signal.reason` when the signal aborts first. */\nexport async function delay(ms: number, signal?: AbortSignal): Promise<void> {\n signal?.throwIfAborted();\n\n const { promise, resolve } = Promise.withResolvers<void>();\n const timer = setTimeout(resolve, ms);\n const onAbort = () => {\n clearTimeout(timer);\n resolve();\n };\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n try {\n await promise;\n } finally {\n signal?.removeEventListener(\"abort\", onAbort);\n }\n signal?.throwIfAborted();\n}\n\nfunction ignore() {}\n","import { isS3ErrorCode, type APIError } from \"@dimah-s3/core\";\nimport { delay } from \"@/internal/abortable\";\nimport type { RetryConfig } from \"@/types/upload\";\nimport {\n MAX_RETRIES,\n RETRY_BASE_DELAY,\n URL_EXPIRY_MARGIN_MS,\n} from \"./constants\";\n\nexport type RetryOptions = { retry?: RetryConfig; signal?: AbortSignal };\n\n/**\n * Whether a failed request may succeed if sent again: `NETWORK_ERROR`,\n * `S3_NETWORK_ERROR`, and `UPLOAD_FAILED` with a 5xx or 429 status.\n */\nexport function isRetryableError(error: unknown): boolean {\n if (\n isS3ErrorCode(error, \"NETWORK_ERROR\") ||\n isS3ErrorCode(error, \"S3_NETWORK_ERROR\")\n ) {\n return true;\n }\n if (!isS3ErrorCode(error, \"UPLOAD_FAILED\")) return false;\n const status = s3Status(error);\n return status >= 500 || status === 429;\n}\n\n/**\n * The S3 status of an `UPLOAD_FAILED` error: its `status` param, which\n * holds what S3 answered, else its HTTP status. A transport may build the\n * error without the `status` option, which leaves the catalog status 502.\n */\nfunction s3Status(error: APIError): number {\n return Number(error.params?.status ?? error.statusCode);\n}\n\n/**\n * Runs `task`, and retries a failure that `canRetry` accepts (by default\n * {@link isRetryableError}) with exponential backoff. Rejects with\n * `signal.reason` once the signal aborts.\n */\nexport async function withRetry<T>(\n task: () => Promise<T>,\n options: RetryOptions & { canRetry?: (error: unknown) => boolean },\n): Promise<T> {\n const { retry, signal, canRetry = isRetryableError } = options;\n const maxRetries = retry?.maxRetries ?? MAX_RETRIES;\n const baseDelay = retry?.baseDelay ?? RETRY_BASE_DELAY;\n\n for (let attempt = 0; ; attempt++) {\n signal?.throwIfAborted();\n try {\n return await task();\n } catch (error) {\n signal?.throwIfAborted();\n if (attempt >= maxRetries || !canRetry(error)) throw error;\n }\n await delay(baseDelay * 2 ** attempt, signal);\n }\n}\n\n/**\n * Signs a presigned request with `sign` and sends it with `send`, with\n * retries. A dead URL is never reused: the request is signed again before a\n * retry once its URL has expired, and a 403 from an expired URL is retried\n * with a new one. Resolves with the signing response that was sent.\n */\nexport async function withPresignedRetry<TSigned extends { expiresIn: number }>(\n sign: () => Promise<TSigned>,\n send: (signed: TSigned) => Promise<void>,\n options: RetryOptions,\n): Promise<TSigned> {\n let current: { signed: TSigned; expiresAt: number } | null = null;\n let expired = false;\n\n return withRetry(\n async () => {\n if (current === null || expired || isPastExpiry(current.expiresAt)) {\n expired = false;\n const signedAt = Date.now();\n const signed = await sign();\n current = { signed, expiresAt: signedAt + signed.expiresIn * 1000 };\n }\n const { signed, expiresAt } = current;\n try {\n await send(signed);\n return signed;\n } catch (error) {\n expired =\n isS3ErrorCode(error, \"UPLOAD_FAILED\") &&\n s3Status(error) === 403 &&\n isPastExpiry(expiresAt);\n throw error;\n }\n },\n { ...options, canRetry: (error) => expired || isRetryableError(error) },\n );\n}\n\nfunction isPastExpiry(expiresAt: number): boolean {\n return Date.now() >= expiresAt - URL_EXPIRY_MARGIN_MS;\n}\n","import { s3Error, type APIError } from \"@dimah-s3/core\";\n\nexport type SendXhrUploadOptions = {\n method: \"POST\" | \"PUT\";\n url: string;\n body: FormData | Blob;\n /** Sent exactly as given. */\n headers?: Record<string, string>;\n signal?: AbortSignal;\n /** The share of the request body sent so far, from 0 to 1. */\n onProgress?: (fraction: number) => void;\n};\n\n/** S3 error codes for bytes that do not match their signed checksum. */\nconst CHECKSUM_ERROR_CODES: ReadonlySet<string> = new Set([\n \"BadDigest\",\n \"XAmzContentChecksumMismatch\",\n]);\n\n/**\n * Sends `body` with `XMLHttpRequest`, which reports upload progress.\n * Rejects with `CHECKSUM_MISMATCH` when S3 answers 400 because the bytes do\n * not match their signed checksum, `UPLOAD_FAILED` carrying S3's status on\n * any other non-2xx response, `NETWORK_ERROR` when the request fails, and\n * `signal.reason` on abort.\n */\nexport async function sendXhrUpload(\n options: SendXhrUploadOptions,\n): Promise<void> {\n const { method, url, body, headers = {}, signal, onProgress } = options;\n signal?.throwIfAborted();\n\n const xhr = new XMLHttpRequest();\n const settled = new Promise<APIError | null>((resolve) => {\n xhr.upload.addEventListener(\"progress\", (event) => {\n if (event.lengthComputable && event.total > 0) {\n onProgress?.(event.loaded / event.total);\n }\n });\n xhr.addEventListener(\"load\", () => {\n const { status } = xhr;\n if (status >= 200 && status < 300) {\n resolve(null);\n } else if (status === 400 && CHECKSUM_ERROR_CODES.has(s3ErrorCode(xhr))) {\n resolve(s3Error(\"CHECKSUM_MISMATCH\"));\n } else {\n resolve(s3Error(\"UPLOAD_FAILED\", { status }, { status }));\n }\n });\n xhr.addEventListener(\"error\", () => resolve(s3Error(\"NETWORK_ERROR\")));\n xhr.addEventListener(\"abort\", () => resolve(s3Error(\"NETWORK_ERROR\")));\n });\n\n const onAbort = () => xhr.abort();\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n try {\n xhr.open(method, url);\n for (const [name, value] of Object.entries(headers)) {\n xhr.setRequestHeader(name, value);\n }\n xhr.send(body);\n const error = await settled;\n signal?.throwIfAborted();\n if (error) throw error;\n } finally {\n signal?.removeEventListener(\"abort\", onAbort);\n }\n}\n\n/**\n * The `<Code>` of S3's XML error body, or `\"\"` when the body is missing or\n * cannot be read (reading `responseText` can throw).\n */\nfunction s3ErrorCode(xhr: XMLHttpRequest): string {\n try {\n return /<Code>([^<]+)<\\/Code>/.exec(xhr.responseText)?.[1] ?? \"\";\n } catch {\n return \"\";\n }\n}\n","import type { MultipartPartResponse } from \"@dimah-s3/core\";\nimport { sendXhrUpload } from \"./xhr-upload\";\n\n/** PUTs one multipart part to its presigned URL with exactly the signed headers. */\nexport function uploadPart(\n part: Blob,\n signed: MultipartPartResponse,\n options: { signal?: AbortSignal; onProgress?: (loaded: number) => void },\n): Promise<void> {\n const { signal, onProgress } = options;\n return sendXhrUpload({\n method: \"PUT\",\n url: signed.url,\n body: part,\n headers: signed.headers,\n signal,\n onProgress: (fraction) => onProgress?.(Math.round(fraction * part.size)),\n });\n}\n","import { sha256Blob, type S3Api } from \"@dimah-s3/core\";\nimport { mapWithConcurrency } from \"@/internal/pool\";\nimport type { UploadFileOptions } from \"@/types/upload\";\nimport type { StoredUpload } from \"@/types/upload-store\";\nimport { DEFAULT_CONCURRENT_PARTS } from \"./constants\";\nimport { transferProgress } from \"./progress\";\nimport { withPresignedRetry } from \"./retry\";\nimport { uploadPart } from \"./upload-part\";\n\n/** The server's part layout for one multipart upload. */\nexport type PartLayout = Pick<\n StoredUpload,\n \"fileSize\" | \"partSize\" | \"partCount\"\n>;\n\n/** Byte size of part `partNumber`. Only the last part may be smaller. */\nexport function layoutPartSize(layout: PartLayout, partNumber: number): number {\n const { fileSize, partSize, partCount } = layout;\n return partNumber < partCount\n ? partSize\n : fileSize - partSize * (partCount - 1);\n}\n\n/**\n * Uploads every part of `upload` that is not in `done` through a pool of\n * `concurrentParts` workers, following the server's layout. Each worker\n * hashes its part as a stream when the upload requires checksums, signs it,\n * and sends it with retries. The first failure aborts the parts still\n * running and rejects with that failure.\n */\nexport async function uploadParts(\n api: S3Api,\n file: File,\n upload: StoredUpload,\n done: ReadonlySet<number>,\n options: UploadFileOptions,\n): Promise<void> {\n const { ticket, partSize, partCount, checksum } = upload;\n const { retry, onProgress, onPartUpload } = options;\n const loaded = Array.from({ length: partCount }, (_, index) =>\n done.has(index + 1) ? layoutPartSize(upload, index + 1) : 0,\n );\n const report = () => {\n const sent = loaded.reduce((sum, bytes) => sum + bytes, 0);\n onProgress?.(transferProgress(sent, file.size));\n };\n if (done.size > 0) report();\n\n const pending = Array.from(\n { length: partCount },\n (_, index) => index + 1,\n ).filter((partNumber) => !done.has(partNumber));\n\n const failure = new AbortController();\n const signal = options.signal\n ? AbortSignal.any([options.signal, failure.signal])\n : failure.signal;\n\n const sendOne = async (partNumber: number) => {\n const index = partNumber - 1;\n const start = index * partSize;\n const part = file.slice(start, start + layoutPartSize(upload, partNumber));\n const partChecksum = checksum\n ? await sha256Blob(part, { signal })\n : undefined;\n\n await withPresignedRetry(\n () =>\n api.multipart.signPart(\n {\n ticket,\n partNumber,\n ...(partChecksum ? { checksum: partChecksum } : {}),\n },\n { signal },\n ),\n (signed) => {\n loaded[index] = 0;\n report();\n return uploadPart(part, signed, {\n signal,\n onProgress: (bytes) => {\n loaded[index] = bytes;\n report();\n },\n });\n },\n { retry, signal },\n );\n\n loaded[index] = part.size;\n report();\n onPartUpload?.({ partNumber, totalParts: partCount });\n };\n\n try {\n await mapWithConcurrency(\n pending,\n options.concurrentParts ?? DEFAULT_CONCURRENT_PARTS,\n sendOne,\n );\n } catch (error) {\n failure.abort(error);\n throw error;\n }\n}\n","import type { StoredUpload } from \"@/types/upload-store\";\n\n/**\n * Whether `value` has the {@link StoredUpload} shape. Records from 1.x (no\n * ticket or part layout) fail this check.\n */\nexport function isStoredUpload(value: unknown): value is StoredUpload {\n if (typeof value !== \"object\" || value === null) return false;\n const record = value as Record<keyof StoredUpload, unknown>;\n return (\n isText(record.resumeKey) &&\n isText(record.ticket) &&\n isText(record.key) &&\n isText(record.uploadId) &&\n isCount(record.fileSize) &&\n isCount(record.partSize) &&\n isCount(record.partCount) &&\n typeof record.checksum === \"boolean\"\n );\n}\n\nfunction isText(value: unknown): value is string {\n return typeof value === \"string\" && value !== \"\";\n}\n\nfunction isCount(value: unknown): value is number {\n return typeof value === \"number\" && Number.isSafeInteger(value) && value > 0;\n}\n","import {\n isS3ErrorCode,\n type MultipartInitPayload,\n type MultipartPartInfo,\n type S3Api,\n} from \"@dimah-s3/core\";\nimport { reportCallbackError } from \"@/internal/callbacks\";\nimport type {\n UploadEnginePhase,\n UploadFileOptions,\n UploadResult,\n} from \"@/types/upload\";\nimport type { StoredUpload, UploadStore } from \"@/types/upload-store\";\nimport { getUploadAbortKind } from \"./abort\";\nimport { layoutPartSize, uploadParts } from \"./part-pool\";\nimport { multipartResumeKey } from \"./resume-key\";\nimport { isRetryableError, withRetry } from \"./retry\";\nimport { isStoredUpload } from \"./stored-upload\";\n\ntype MultipartSession = {\n upload: StoredUpload;\n /** Part numbers already uploaded with the expected size. */\n done: ReadonlySet<number>;\n};\n\n/**\n * Resume keys of the multipart uploads running with a store in this page.\n * Module-wide, because two stores can share one backing storage.\n */\nconst activeResumeKeys = new Set<string>();\n\n/**\n * Uploads `file` as a multipart upload in the layout the server picks at\n * init, resuming a stored upload when `options.uploadStore` has one.\n *\n * With a store, a request error that may pass later (see\n * {@link isRetryableError}) or an abort with `uploadAbortReason(\"detach\")`\n * keeps the server upload and its record for resuming. A cancel, any other\n * abort, a failure that retrying cannot fix, or any failure without a store\n * aborts the server upload and deletes the record. While one upload of a resume key runs, another upload of the\n * same key runs without the store, so the two never share a session.\n */\nexport async function uploadMultipart(\n api: S3Api,\n file: File,\n payload: MultipartInitPayload,\n options: UploadFileOptions,\n setPhase: (phase: UploadEnginePhase) => void,\n): Promise<UploadResult> {\n const resumeKey = multipartResumeKey(options.route, file, options.request);\n const store = activeResumeKeys.has(resumeKey)\n ? undefined\n : options.uploadStore;\n if (store) activeResumeKeys.add(resumeKey);\n try {\n return await runMultipart(api, file, payload, options, setPhase, {\n store,\n resumeKey,\n });\n } finally {\n if (store) activeResumeKeys.delete(resumeKey);\n }\n}\n\n/** The upload itself, with `store` unset when the resume key is taken. */\nasync function runMultipart(\n api: S3Api,\n file: File,\n payload: MultipartInitPayload,\n options: UploadFileOptions,\n setPhase: (phase: UploadEnginePhase) => void,\n { store, resumeKey }: { store: UploadStore | undefined; resumeKey: string },\n): Promise<UploadResult> {\n const { signal } = options;\n\n setPhase(\"preparing\");\n const resumed = store\n ? await resumeSession(api, file, store, resumeKey, options, setPhase)\n : null;\n\n let upload: StoredUpload;\n let done: ReadonlySet<number>;\n if (resumed) {\n ({ upload, done } = resumed);\n } else {\n setPhase(\"presigning\");\n const init = await withRetry(\n () => api.multipart.init(payload, { signal }),\n options,\n );\n upload = {\n resumeKey,\n ticket: init.ticket,\n key: init.key,\n uploadId: init.uploadId,\n fileSize: file.size,\n partSize: init.partSize,\n partCount: init.partCount,\n checksum: init.checksum,\n };\n done = new Set();\n }\n\n try {\n if (store && !resumed) await quietly(() => store.set(upload));\n options.onMultipartInit?.({ uploadId: upload.uploadId, key: upload.key });\n\n setPhase(\"uploading\");\n await uploadParts(api, file, upload, done, options);\n\n setPhase(\"finalizing\");\n // The result is the confirmed object, without the multipart `uploadId`.\n const { uploadId: _uploadId, ...result } = await withRetry(\n () => api.multipart.complete({ ticket: upload.ticket }, { signal }),\n options,\n );\n if (store) await quietly(() => store.delete(resumeKey));\n return result;\n } catch (error) {\n // The same rule as resumeSession: a failure that retrying cannot fix\n // would fail every resume the same way.\n const keep =\n store !== undefined &&\n (signal?.aborted ? isDetached(signal) : isRetryableError(error));\n if (!keep) {\n abortQuietly(api, upload.ticket);\n if (store) await quietly(() => store.delete(resumeKey));\n }\n throw error;\n }\n}\n\n/**\n * Loads a stored upload and the parts S3 already has. A record with an\n * unknown shape is deleted. A record whose upload is gone or whose ticket no\n * longer verifies is aborted and deleted, so the caller starts over.\n *\n * Once a valid record is read, a cancel or a failure that retrying cannot fix\n * also aborts the server upload and deletes the record before rejecting, so\n * the next upload of the file starts fresh. A detach or a request error that\n * might pass later keeps both.\n */\nasync function resumeSession(\n api: S3Api,\n file: File,\n store: UploadStore,\n resumeKey: string,\n options: UploadFileOptions,\n setPhase: (phase: UploadEnginePhase) => void,\n): Promise<MultipartSession | null> {\n const record = await readRecord(store, resumeKey, file.size);\n if (record === null) return null;\n if (\n !isStoredUpload(record) ||\n record.resumeKey !== resumeKey ||\n record.fileSize !== file.size\n ) {\n await quietly(() => store.delete(resumeKey));\n return null;\n }\n\n try {\n options.signal?.throwIfAborted();\n setPhase(\"presigning\");\n const { parts } = await withRetry(\n () =>\n api.multipart.listParts(\n { ticket: record.ticket },\n { signal: options.signal },\n ),\n options,\n );\n return { upload: record, done: completedParts(record, parts) };\n } catch (error) {\n const { signal } = options;\n const keep = signal?.aborted ? isDetached(signal) : isRetryableError(error);\n if (keep) throw error;\n abortQuietly(api, record.ticket);\n await quietly(() => store.delete(resumeKey));\n if (signal?.aborted || !isSessionGone(error)) throw error;\n return null;\n }\n}\n\nfunction isDetached(signal: AbortSignal): boolean {\n return getUploadAbortKind(signal.reason) === \"detach\";\n}\n\n/** The stored record, or `null` when the store has none or fails. */\nasync function readRecord(\n store: UploadStore,\n resumeKey: string,\n fileSize: number,\n): Promise<unknown> {\n try {\n return await store.get(resumeKey, fileSize);\n } catch (error) {\n reportCallbackError(error);\n return null;\n }\n}\n\n/** Parts that match the layout, and carry a checksum when one is required. */\nfunction completedParts(\n upload: StoredUpload,\n parts: readonly MultipartPartInfo[],\n): Set<number> {\n const done = new Set<number>();\n for (const { partNumber, size, checksum } of parts) {\n if (\n partNumber >= 1 &&\n partNumber <= upload.partCount &&\n size === layoutPartSize(upload, partNumber) &&\n (!upload.checksum || checksum !== undefined)\n ) {\n done.add(partNumber);\n }\n }\n return done;\n}\n\nfunction isSessionGone(error: unknown): boolean {\n return (\n isS3ErrorCode(error, \"UPLOAD_TICKET_EXPIRED\") ||\n isS3ErrorCode(error, \"UPLOAD_TICKET_INVALID\") ||\n isS3ErrorCode(error, \"OBJECT_NOT_FOUND\")\n );\n}\n\n/** Aborts the server upload in the background. Its error is ignored. */\nfunction abortQuietly(api: S3Api, ticket: string): void {\n api.multipart.abort({ ticket }).catch(() => {});\n}\n\n/** Runs a store call. A failure is reported and never fails the upload. */\nasync function quietly(run: () => void | Promise<void>): Promise<void> {\n try {\n await run();\n } catch (error) {\n reportCallbackError(error);\n }\n}\n","import type { UploadTransport } from \"@/types/upload\";\nimport { transferProgress } from \"./progress\";\nimport { sendXhrUpload } from \"./xhr-upload\";\n\n/**\n * The default {@link UploadTransport}. Sends `file` to the presigned URL with\n * exactly the presign's PUT `headers`, or as a form with its POST `fields`\n * first (S3 requires the fields before the file).\n */\nexport const sendPresignedUpload: UploadTransport = (\n file,\n presign,\n { onProgress, signal },\n) => {\n const reportFraction = (fraction: number) =>\n onProgress?.(transferProgress(Math.round(fraction * file.size), file.size));\n\n if (presign.method === \"PUT\") {\n return sendXhrUpload({\n method: \"PUT\",\n url: presign.url,\n body: file,\n headers: presign.headers,\n signal,\n onProgress: reportFraction,\n });\n }\n\n const form = new FormData();\n for (const [name, value] of Object.entries(presign.fields)) {\n form.append(name, value);\n }\n form.append(\"file\", file);\n return sendXhrUpload({\n method: \"POST\",\n url: presign.url,\n body: form,\n signal,\n onProgress: reportFraction,\n });\n};\n","import {\n fitFileName,\n sha256Blob,\n type MultipartInitPayload,\n type S3Api,\n} from \"@dimah-s3/core\";\nimport { toClientError } from \"@/internal/client-error\";\nimport type {\n S3ApiUploadTransport,\n UploadEnginePhase,\n UploadFileOptions,\n UploadResult,\n UploadTransport,\n} from \"@/types/upload\";\nimport { DEFAULT_MULTIPART_THRESHOLD } from \"./constants\";\nimport { uploadMultipart } from \"./multipart\";\nimport { sendPresignedUpload } from \"./presigned-http\";\nimport { transferProgress } from \"./progress\";\nimport { withPresignedRetry, withRetry } from \"./retry\";\n\n/**\n * Uploads one file and returns the verified object. Files of at least\n * `DEFAULT_MULTIPART_THRESHOLD` bytes use multipart when `policy.multipart`\n * is true; other files are presigned, sent and confirmed in one shot.\n *\n * Rejects with an `APIError`, or with `signal.reason` once `signal` aborts.\n * Phases run `preparing`, `presigning`, `uploading`, then `finalizing`.\n */\nexport async function uploadFile(\n api: S3Api,\n file: File,\n options: UploadFileOptions,\n): Promise<UploadResult> {\n const { signal, policy } = options;\n const setPhase = phaseReporter(options.onPhaseChange);\n try {\n signal?.throwIfAborted();\n const payload = initPayload(file, options);\n if (policy.multipart && file.size >= DEFAULT_MULTIPART_THRESHOLD) {\n return await uploadMultipart(api, file, payload, options, setPhase);\n }\n return await uploadSingle(api, file, payload, options, setPhase);\n } catch (error) {\n signal?.throwIfAborted();\n throw toClientError(error);\n }\n}\n\nasync function uploadSingle(\n api: S3Api,\n file: File,\n payload: MultipartInitPayload,\n options: UploadFileOptions,\n setPhase: (phase: UploadEnginePhase) => void,\n): Promise<UploadResult> {\n const { signal, onProgress } = options;\n const transport = getUploadTransport(api) ?? sendPresignedUpload;\n\n setPhase(\"preparing\");\n const checksum = options.policy.checksum\n ? await sha256Blob(file, { signal })\n : undefined;\n\n const presign = await withPresignedRetry(\n () => {\n setPhase(\"presigning\");\n return api.upload(\n { ...payload, ...(checksum ? { checksum } : {}) },\n { signal },\n );\n },\n (signed) => {\n setPhase(\"uploading\");\n return transport(file, signed, { onProgress, signal });\n },\n options,\n );\n onProgress?.(transferProgress(file.size, file.size));\n\n setPhase(\"finalizing\");\n return withRetry(\n () => api.confirm({ ticket: presign.ticket }, { signal }),\n options,\n );\n}\n\n/** The presign body shared by single-shot and multipart uploads. */\nfunction initPayload(\n file: File,\n options: UploadFileOptions,\n): MultipartInitPayload {\n const { route, request = {} } = options;\n const type = (request.contentType ?? file.type).trim();\n return {\n route,\n name: fitFileName(request.fileName || file.name),\n size: file.size,\n ...(type ? { type } : {}),\n ...(request.metadata ? { metadata: request.metadata } : {}),\n };\n}\n\nfunction getUploadTransport(api: S3Api): UploadTransport | undefined {\n const transport = (api as S3Api & S3ApiUploadTransport).uploadTransport;\n return typeof transport === \"function\" ? transport : undefined;\n}\n\n/** Calls `onPhaseChange` only when the phase changes. */\nfunction phaseReporter(\n onPhaseChange: UploadFileOptions[\"onPhaseChange\"],\n): (phase: UploadEnginePhase) => void {\n let current: UploadEnginePhase | null = null;\n return (phase) => {\n if (phase === current) return;\n current = phase;\n onPhaseChange?.(phase);\n };\n}\n","import type {\n ObjectListEntry,\n ObjectListFile,\n ObjectListFolder,\n} from \"./types\";\n\n/**\n * Entry key for a file or folder id. Matches `entry.key`, so a selection can\n * be built from ids you already have.\n */\nexport function objectListEntryKey(\n kind: ObjectListEntry<unknown>[\"kind\"],\n id: string,\n): string {\n return `${kind}:${id}`;\n}\n\n/** Folders first, then files. */\nexport function createObjectListEntries<TItem>(\n folders: readonly ObjectListFolder[],\n items: readonly TItem[],\n getKey: (item: TItem) => string,\n getFile: (item: TItem) => ObjectListFile,\n): ObjectListEntry<TItem>[] {\n const entries: ObjectListEntry<TItem>[] = [];\n for (const folder of folders) {\n entries.push({\n kind: \"folder\",\n key: objectListEntryKey(\"folder\", folder.id),\n id: folder.id,\n name: folder.name,\n folder,\n });\n }\n for (const item of items) {\n const id = getKey(item);\n const file = getFile(item);\n entries.push({\n kind: \"file\",\n key: objectListEntryKey(\"file\", id),\n id,\n name: file.name,\n item,\n file,\n });\n }\n return entries;\n}\n\n/** Stored key for a file entry: `file.objectKey`, else the item key. */\nexport function objectKeyOf(entry: {\n id: string;\n file: Pick<ObjectListFile, \"objectKey\">;\n}): string {\n return entry.file.objectKey || entry.id;\n}\n","/** Options for {@link formatAcceptLabels}. */\nexport type FormatAcceptLabelsOptions = {\n /**\n * Labels for `type/*` wildcards by top-level type, such as\n * `{ image: \"Bilder\" }`. Missing types use the English defaults.\n */\n groups?: Readonly<Partial<Record<string, string>>>;\n};\n\nconst GROUPS: Readonly<Record<string, string>> = {\n image: \"Images\",\n video: \"Videos\",\n audio: \"Audio\",\n text: \"Text files\",\n font: \"Fonts\",\n};\n\n/** MIME types whose subtype does not read as a file type. */\nconst MIME_LABELS: Readonly<Record<string, string>> = {\n \"application/msword\": \"DOC\",\n \"application/vnd.openxmlformats-officedocument.wordprocessingml.document\":\n \"DOCX\",\n \"application/vnd.ms-excel\": \"XLS\",\n \"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet\": \"XLSX\",\n \"application/vnd.ms-powerpoint\": \"PPT\",\n \"application/vnd.openxmlformats-officedocument.presentationml.presentation\":\n \"PPTX\",\n \"application/vnd.oasis.opendocument.text\": \"ODT\",\n \"application/vnd.oasis.opendocument.spreadsheet\": \"ODS\",\n \"application/vnd.oasis.opendocument.presentation\": \"ODP\",\n \"application/x-zip-compressed\": \"ZIP\",\n \"application/x-7z-compressed\": \"7Z\",\n \"application/x-rar-compressed\": \"RAR\",\n \"audio/mpeg\": \"MP3\",\n \"text/plain\": \"TXT\",\n \"text/markdown\": \"MD\",\n \"video/quicktime\": \"MOV\",\n \"video/x-matroska\": \"MKV\",\n};\n\nfunction formatAcceptLabel(\n token: string,\n groups: FormatAcceptLabelsOptions[\"groups\"],\n): string | null {\n const type = token.trim().toLowerCase();\n if (!type || type === \"*\" || type === \"*/*\") return null;\n if (type.startsWith(\".\")) {\n const ext = type.slice(1);\n return ext === \"jpg\" || ext === \"jpeg\" ? \"JPEG\" : ext.toUpperCase();\n }\n const [base = \"\", sub = \"\"] = type.split(\"/\");\n if (sub === \"*\") {\n return (\n groups?.[base] ??\n GROUPS[base] ??\n `${base.charAt(0).toUpperCase()}${base.slice(1)} files`\n );\n }\n const known = MIME_LABELS[type];\n if (known) return known;\n // `x-tar` → TAR, `vnd.rar` → RAR, `svg+xml` → SVG.\n const name = sub.replace(/^(?:x-|vnd\\.)/, \"\").replace(/\\+.*$/, \"\");\n return name ? name.toUpperCase() : token.trim();\n}\n\n/**\n * Short display labels for HTML `accept` tokens, in order and without\n * duplicates: `.jpeg` → `JPEG`, `image/*` → `Images`, a DOCX MIME type →\n * `DOCX`. A wildcard for any type has no label. In components,\n * `useFormatAcceptLabels()` translates the group labels for you.\n */\nexport function formatAcceptLabels(\n accept?: readonly string[],\n options: FormatAcceptLabelsOptions = {},\n): string[] {\n if (!accept?.length) return [];\n const labels = new Set<string>();\n for (const token of accept) {\n const label = formatAcceptLabel(token, options.groups);\n if (label) labels.add(label);\n }\n return [...labels];\n}\n","/** Binary size units used by {@link formatFileSize}. */\nexport type FileSizeUnit = \"B\" | \"KB\" | \"MB\" | \"GB\" | \"TB\" | \"PB\" | \"EB\";\n\nconst UNITS: readonly FileSizeUnit[] = [\n \"B\",\n \"KB\",\n \"MB\",\n \"GB\",\n \"TB\",\n \"PB\",\n \"EB\",\n];\n\n/** Options for {@link formatFileSize}. */\nexport type FormatFileSizeOptions = {\n /**\n * Locale for digits and the decimal mark, such as `\"fa\"` for `۱۲٫۴`.\n * @default \"en-US\"\n */\n locale?: string | readonly string[];\n /** Unit labels, such as translated ones. Missing units stay `B`, `KB`, … */\n units?: Partial<Record<FileSizeUnit, string>>;\n};\n\nconst numberFormats = new Map<string, Intl.NumberFormat>();\n\nfunction numberFormat(\n locale: string | readonly string[],\n fractionDigits: number,\n): Intl.NumberFormat {\n const id = `${String(locale)}|${fractionDigits}`;\n let format = numberFormats.get(id);\n if (!format) {\n format = new Intl.NumberFormat(\n typeof locale === \"string\" ? locale : [...locale],\n {\n minimumFractionDigits: fractionDigits,\n maximumFractionDigits: fractionDigits,\n useGrouping: false,\n },\n );\n numberFormats.set(id, format);\n }\n return format;\n}\n\n/**\n * Formats a byte count with 1024-based units: `1.2 MB`, `512 B`.\n * Pass `locale` for native digits and `units` for translated labels. In\n * components, `useFormatFileSize()` passes the `S3Provider` locale and\n * translations for you.\n */\nexport function formatFileSize(\n bytes: number,\n options: FormatFileSizeOptions = {},\n): string {\n const size = Number.isFinite(bytes) && bytes > 0 ? bytes : 0;\n const last = UNITS.length - 1;\n let i =\n size === 0\n ? 0\n : Math.min(Math.floor(Math.log(size) / Math.log(1024)), last);\n // Pick the unit after rounding, so 1,048,575 bytes is \"1.0 MB\", not \"1024.0 KB\".\n const decimals = (unit: number) => (unit === 0 ? 0 : 1);\n const rounded = (unit: number) => {\n const factor = 10 ** decimals(unit);\n return Math.round((size / 1024 ** unit) * factor) / factor;\n };\n if (i < last && rounded(i) >= 1024) i += 1;\n const unit = UNITS[i] ?? \"B\";\n const value = numberFormat(options.locale ?? \"en-US\", decimals(i)).format(\n rounded(i),\n );\n return `${value} ${options.units?.[unit] ?? unit}`;\n}\n","/** A `Date`, an ISO string, or epoch milliseconds. */\nexport type DateInput = Date | string | number;\n\n/** Epoch milliseconds, or `null` when the value is missing or invalid. */\nexport function toTimestamp(\n value: DateInput | null | undefined,\n): number | null {\n if (value == null || value === \"\") return null;\n const time =\n value instanceof Date\n ? value.getTime()\n : typeof value === \"number\"\n ? value\n : Date.parse(value);\n return Number.isFinite(time) ? time : null;\n}\n"]}
|
|
@@ -31,5 +31,5 @@ export type ReactS3Client<P extends readonly S3ClientPlugin[] = []> = CreateS3Cl
|
|
|
31
31
|
* ```
|
|
32
32
|
*/
|
|
33
33
|
export declare function createS3Client<const P extends readonly S3ClientPlugin[] = []>(options?: CreateS3ClientOptions<P>): ReactS3Client<P>;
|
|
34
|
-
export
|
|
34
|
+
export {};
|
|
35
35
|
//# sourceMappingURL=create-s3-client.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-s3-client.d.ts","sourceRoot":"","sources":["../src/create-s3-client.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACpB,MAAM,gBAAgB,C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AC,kBAAkB,CAAC,CAAC;IAC5C,MAAM,EAAE,MAAM,oBAAoB,CAAC,CAAC,CAAC,CAAC;CACvC,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,cAAc,CAAC,KAAK,CAAC,CAAC,SAAS,SAAS,cAAc,EAAE,GAAG,EAAE,EAC3E,OAAO,CAAC,EAAE,qBAAqB,CAAC,CAAC,CAAC,GACjC,aAAa,CAAC,CAAC,CAAC,CAclB"}
|
package/dist/engine.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
export { uploadFile,
|
|
1
|
+
export { uploadFile, uploadAbortReason, getUploadAbortKind, multipartResumeKey, mergeUploadRequest, DEFAULT_MULTIPART_THRESHOLD, } from "./upload";
|
|
2
|
+
export type { UploadFileOptions, UploadTransport, S3ApiUploadTransport, RetryConfig, UploadAbortKind, } from "./types/upload";
|
|
3
|
+
export { createLocalStorageStore, createMemoryStore } from "./store";
|
|
4
|
+
export type { StoredUpload, UploadStore } from "./types/upload-store";
|
|
5
|
+
export { loadRouteCatalog, resolveRouteUploadPolicy, mergeRouteUploadPolicy, type RouteUploadPolicy, type RouteUploadPolicyOptions, } from "./helpers/load-route-catalog";
|
|
6
|
+
export { defineApi } from "./api";
|
|
7
|
+
export { memoryObjectSource, type MemoryObjectSourceOptions, } from "./list/memory-object-source";
|
|
8
|
+
export { readObjectListLevel, type ObjectListLevel, } from "./list/read-object-list-level";
|
|
9
|
+
export { objectListEntryKey, objectKeyOf } from "./list/entries";
|
|
10
|
+
export { formatAcceptLabels, type FormatAcceptLabelsOptions, } from "./helpers/format-accept-labels";
|
|
11
|
+
export { formatFileSize, type FileSizeUnit, type FormatFileSizeOptions, } from "./helpers/format-file-size";
|
|
12
|
+
export { formatSpeed } from "./helpers/format-speed";
|
|
13
|
+
export { formatUploadProgress } from "./helpers/format-upload-progress";
|
|
14
|
+
export { truncateFileName } from "./helpers/truncate-file-name";
|
|
15
|
+
export { toTimestamp, type DateInput } from "./helpers/to-timestamp";
|
|
2
16
|
//# sourceMappingURL=engine.d.ts.map
|
package/dist/engine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"engine.d.ts","sourceRoot":"","sources":["../src/engine.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,UAAU,CAAC;AAClB,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,uBAAuB,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACrE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAGtE,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,sBAAsB,EACtB,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,GAC9B,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlC,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,GAC/B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,mBAAmB,EACnB,KAAK,eAAe,GACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGjE,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,GAC/B,MAAM,gCAAgC,CAAC;AACxC,OAAO,EACL,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,qBAAqB,GAC3B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,KAAK,SAAS,EAAE,MAAM,wBAAwB,CAAC"}
|