@dimah-s3/react 1.7.1 → 2.0.0-beta.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.
Files changed (148) hide show
  1. package/README.md +53 -13
  2. package/dist/api.d.ts +24 -15
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/chunk-SPUUNLXI.js +824 -0
  5. package/dist/chunk-SPUUNLXI.js.map +1 -0
  6. package/dist/create-s3-client.d.ts +1 -1
  7. package/dist/create-s3-client.d.ts.map +1 -1
  8. package/dist/engine.d.ts +15 -1
  9. package/dist/engine.d.ts.map +1 -1
  10. package/dist/engine.js +204 -512
  11. package/dist/engine.js.map +1 -1
  12. package/dist/helpers/format-accept-labels.d.ts +15 -2
  13. package/dist/helpers/format-accept-labels.d.ts.map +1 -1
  14. package/dist/helpers/format-date.d.ts +7 -0
  15. package/dist/helpers/format-date.d.ts.map +1 -0
  16. package/dist/helpers/format-dimah-error.d.ts +12 -2
  17. package/dist/helpers/format-dimah-error.d.ts.map +1 -1
  18. package/dist/helpers/format-file-size.d.ts +20 -0
  19. package/dist/helpers/format-file-size.d.ts.map +1 -0
  20. package/dist/helpers/format-speed.d.ts +1 -1
  21. package/dist/helpers/format-speed.d.ts.map +1 -1
  22. package/dist/helpers/format-upload-progress.d.ts +1 -1
  23. package/dist/helpers/format-upload-progress.d.ts.map +1 -1
  24. package/dist/helpers/index.d.ts +5 -8
  25. package/dist/helpers/index.d.ts.map +1 -1
  26. package/dist/helpers/load-route-catalog.d.ts +32 -8
  27. package/dist/helpers/load-route-catalog.d.ts.map +1 -1
  28. package/dist/helpers/throttled-speed.d.ts +2 -2
  29. package/dist/helpers/throttled-speed.d.ts.map +1 -1
  30. package/dist/helpers/to-timestamp.d.ts +5 -0
  31. package/dist/helpers/to-timestamp.d.ts.map +1 -0
  32. package/dist/helpers/truncate-file-name.d.ts +8 -0
  33. package/dist/helpers/truncate-file-name.d.ts.map +1 -0
  34. package/dist/helpers/use-format-accept-labels.d.ts +12 -0
  35. package/dist/helpers/use-format-accept-labels.d.ts.map +1 -0
  36. package/dist/helpers/use-format-eta.d.ts +14 -0
  37. package/dist/helpers/use-format-eta.d.ts.map +1 -0
  38. package/dist/helpers/use-format-speed.d.ts +12 -0
  39. package/dist/helpers/use-format-speed.d.ts.map +1 -0
  40. package/dist/hooks/use-delete.d.ts +6 -44
  41. package/dist/hooks/use-delete.d.ts.map +1 -1
  42. package/dist/hooks/use-download.d.ts +7 -117
  43. package/dist/hooks/use-download.d.ts.map +1 -1
  44. package/dist/hooks/use-fetch-download.d.ts +8 -0
  45. package/dist/hooks/use-fetch-download.d.ts.map +1 -0
  46. package/dist/hooks/use-file-intake.d.ts +43 -29
  47. package/dist/hooks/use-file-intake.d.ts.map +1 -1
  48. package/dist/hooks/use-file-upload.d.ts +38 -34
  49. package/dist/hooks/use-file-upload.d.ts.map +1 -1
  50. package/dist/hooks/use-object-list-selection.d.ts +78 -0
  51. package/dist/hooks/use-object-list-selection.d.ts.map +1 -0
  52. package/dist/hooks/use-object-list.d.ts +66 -16
  53. package/dist/hooks/use-object-list.d.ts.map +1 -1
  54. package/dist/hooks/use-object-url.d.ts +27 -10
  55. package/dist/hooks/use-object-url.d.ts.map +1 -1
  56. package/dist/hooks/use-route-upload-policy.d.ts +22 -14
  57. package/dist/hooks/use-route-upload-policy.d.ts.map +1 -1
  58. package/dist/hooks/use-upload.d.ts +72 -65
  59. package/dist/hooks/use-upload.d.ts.map +1 -1
  60. package/dist/index.d.ts +15 -19
  61. package/dist/index.d.ts.map +1 -1
  62. package/dist/index.js +2420 -2164
  63. package/dist/index.js.map +1 -1
  64. package/dist/internal/abortable.d.ts +9 -0
  65. package/dist/internal/abortable.d.ts.map +1 -0
  66. package/dist/internal/browser-download.d.ts +15 -0
  67. package/dist/internal/browser-download.d.ts.map +1 -0
  68. package/dist/internal/callbacks.d.ts +54 -0
  69. package/dist/internal/callbacks.d.ts.map +1 -0
  70. package/dist/internal/client-error.d.ts +15 -0
  71. package/dist/internal/client-error.d.ts.map +1 -0
  72. package/dist/internal/hooks.d.ts +27 -0
  73. package/dist/internal/hooks.d.ts.map +1 -0
  74. package/dist/internal/lru.d.ts +13 -0
  75. package/dist/internal/lru.d.ts.map +1 -0
  76. package/dist/internal/operations.d.ts +74 -0
  77. package/dist/internal/operations.d.ts.map +1 -0
  78. package/dist/internal/pool.d.ts +8 -0
  79. package/dist/internal/pool.d.ts.map +1 -0
  80. package/dist/list/entries.d.ts +14 -0
  81. package/dist/list/entries.d.ts.map +1 -0
  82. package/dist/list/memory-object-source.d.ts +60 -0
  83. package/dist/list/memory-object-source.d.ts.map +1 -0
  84. package/dist/list/types.d.ts +123 -11
  85. package/dist/list/types.d.ts.map +1 -1
  86. package/dist/s3-provider.d.ts +3 -2
  87. package/dist/s3-provider.d.ts.map +1 -1
  88. package/dist/store/local-storage-store.d.ts +5 -4
  89. package/dist/store/local-storage-store.d.ts.map +1 -1
  90. package/dist/store/memory-store.d.ts +3 -4
  91. package/dist/store/memory-store.d.ts.map +1 -1
  92. package/dist/translations/types.d.ts +105 -23
  93. package/dist/translations/types.d.ts.map +1 -1
  94. package/dist/types/delete.d.ts +98 -9
  95. package/dist/types/delete.d.ts.map +1 -1
  96. package/dist/types/download.d.ts +152 -23
  97. package/dist/types/download.d.ts.map +1 -1
  98. package/dist/types/index.d.ts +1 -1
  99. package/dist/types/index.d.ts.map +1 -1
  100. package/dist/types/operation.d.ts +38 -0
  101. package/dist/types/operation.d.ts.map +1 -0
  102. package/dist/types/upload-store.d.ts +30 -40
  103. package/dist/types/upload-store.d.ts.map +1 -1
  104. package/dist/types/upload.d.ts +177 -130
  105. package/dist/types/upload.d.ts.map +1 -1
  106. package/dist/upload/abort.d.ts +10 -0
  107. package/dist/upload/abort.d.ts.map +1 -0
  108. package/dist/upload/constants.d.ts +8 -3
  109. package/dist/upload/constants.d.ts.map +1 -1
  110. package/dist/upload/index.d.ts +3 -2
  111. package/dist/upload/index.d.ts.map +1 -1
  112. package/dist/upload/multipart.d.ts +14 -4
  113. package/dist/upload/multipart.d.ts.map +1 -1
  114. package/dist/upload/part-pool.d.ts +16 -0
  115. package/dist/upload/part-pool.d.ts.map +1 -0
  116. package/dist/upload/presigned-http.d.ts +5 -14
  117. package/dist/upload/presigned-http.d.ts.map +1 -1
  118. package/dist/upload/progress.d.ts +7 -0
  119. package/dist/upload/progress.d.ts.map +1 -0
  120. package/dist/upload/request.d.ts +9 -0
  121. package/dist/upload/request.d.ts.map +1 -0
  122. package/dist/upload/resume-key.d.ts +7 -3
  123. package/dist/upload/resume-key.d.ts.map +1 -1
  124. package/dist/upload/retry.d.ts +27 -2
  125. package/dist/upload/retry.d.ts.map +1 -1
  126. package/dist/upload/stored-upload.d.ts +7 -0
  127. package/dist/upload/stored-upload.d.ts.map +1 -0
  128. package/dist/upload/upload-file.d.ts +10 -11
  129. package/dist/upload/upload-file.d.ts.map +1 -1
  130. package/dist/upload/upload-part.d.ts +6 -3
  131. package/dist/upload/upload-part.d.ts.map +1 -1
  132. package/dist/upload/xhr-upload.d.ts +10 -2
  133. package/dist/upload/xhr-upload.d.ts.map +1 -1
  134. package/package.json +7 -8
  135. package/dist/helpers/format-eta.d.ts +0 -13
  136. package/dist/helpers/format-eta.d.ts.map +0 -1
  137. package/dist/helpers/format-validate-file-error.d.ts +0 -9
  138. package/dist/helpers/format-validate-file-error.d.ts.map +0 -1
  139. package/dist/hooks/index.d.ts +0 -7
  140. package/dist/hooks/index.d.ts.map +0 -1
  141. package/dist/internal-helpers.d.ts +0 -10
  142. package/dist/internal-helpers.d.ts.map +0 -1
  143. package/dist/store/use-immer-state.d.ts +0 -8
  144. package/dist/store/use-immer-state.d.ts.map +0 -1
  145. package/dist/types/error.d.ts +0 -27
  146. package/dist/types/error.d.ts.map +0 -1
  147. package/dist/upload/upload-files.d.ts +0 -26
  148. package/dist/upload/upload-files.d.ts.map +0 -1
@@ -1,24 +1,32 @@
1
- import type { S3Api, S3RouteName } from "@dimah-s3/core";
2
- import { type RouteUploadPolicy } from "../helpers/load-route-catalog.js";
3
- export type CatalogLoadStatus = "idle" | "loading" | "ready" | "error";
4
- export type UseRouteUploadPolicyOptions = RouteUploadPolicy & {
1
+ import type { APIError, S3Api, S3RouteName } from "@dimah-s3/core";
2
+ import { type RouteUploadPolicy, type RouteUploadPolicyOptions } from "../helpers/load-route-catalog.js";
3
+ /** Where the route catalog (`GET /routes`) is in loading. */
4
+ export type CatalogLoadStatus = "loading" | "ready" | "error";
5
+ /** Options for {@link useRouteUploadPolicy}. */
6
+ export type UseRouteUploadPolicyOptions = RouteUploadPolicyOptions & {
7
+ /** Optional when an `<S3Provider>` is in the tree. */
5
8
  api?: S3Api;
6
9
  route: S3RouteName;
7
10
  };
11
+ /** The route's upload policy narrowed by the options, plus the catalog state. */
8
12
  export type UseRouteUploadPolicyReturn = RouteUploadPolicy & {
9
- /** `GET /routes` fetch used to fill omitted `accept` / `maxFileSize`. */
10
- catalogStatus: CatalogLoadStatus;
11
- /** Set when {@link catalogStatus} is `"error"`. */
12
- catalogError: Error | null;
13
+ status: CatalogLoadStatus;
14
+ /** Why the catalog failed to load, when `status` is `"error"`. */
15
+ error: APIError | null;
13
16
  };
14
17
  /**
15
- * Client UX constraints for a named upload route.
16
- * Catalog values fill in omitted `accept` / `maxFileSize` / `multipart` /
17
- * `checksum`. Explicit options always win.
18
+ * The upload policy of a named route: the route catalog narrowed by the
19
+ * options. The stricter `accept` and `maxFileSize` win, `multipart` needs the
20
+ * route and an option that is not `false`, and `checksum` follows the route.
18
21
  *
19
- * A failed catalog does not block uploads — the server still enforces
20
- * constraints. {@link UseRouteUploadPolicyReturn.catalogStatus} is `"error"`
21
- * so the UI can show that client-side accept/size did not sync.
22
+ * Until the catalog loads, and when it fails, only the options apply and
23
+ * neither multipart nor checksums are on. The catalog is cached per `S3Api`,
24
+ * so every hook for the same API shares one request.
22
25
  */
23
26
  export declare function useRouteUploadPolicy(options: UseRouteUploadPolicyOptions): UseRouteUploadPolicyReturn;
27
+ /**
28
+ * @internal {@link useRouteUploadPolicy} plus a function that loads the
29
+ * catalog again, such as after it failed.
30
+ */
31
+ export declare function useRouteUploadPolicyState(options: UseRouteUploadPolicyOptions): [policy: UseRouteUploadPolicyReturn, reload: () => void];
24
32
  //# sourceMappingURL=use-route-upload-policy.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-route-upload-policy.d.ts","sourceRoot":"","sources":["../../src/hooks/use-route-upload-policy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGzD,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,8BAA8B,CAAC;AAEtC,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAEvE,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,GAAG;IAC5D,GAAG,CAAC,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,GAAG;IAC3D,yEAAyE;IACzE,aAAa,EAAE,iBAAiB,CAAC;IACjC,mDAAmD;IACnD,YAAY,EAAE,KAAK,GAAG,IAAI,CAAC;CAC5B,CAAC;AA0CF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,2BAA2B,GACnC,0BAA0B,CA8D5B"}
1
+ {"version":3,"file":"use-route-upload-policy.d.ts","sourceRoot":"","sources":["../../src/hooks/use-route-upload-policy.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,QAAQ,EAER,KAAK,EACL,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,wBAAwB,EAC9B,MAAM,8BAA8B,CAAC;AAEtC,6DAA6D;AAC7D,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,GAAG,OAAO,CAAC;AAE9D,gDAAgD;AAChD,MAAM,MAAM,2BAA2B,GAAG,wBAAwB,GAAG;IACnE,sDAAsD;IACtD,GAAG,CAAC,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,WAAW,CAAC;CACpB,CAAC;AAEF,iFAAiF;AACjF,MAAM,MAAM,0BAA0B,GAAG,iBAAiB,GAAG;IAC3D,MAAM,EAAE,iBAAiB,CAAC;IAC1B,kEAAkE;IAClE,KAAK,EAAE,QAAQ,GAAG,IAAI,CAAC;CACxB,CAAC;AAUF;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,2BAA2B,GACnC,0BAA0B,CAE5B;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,2BAA2B,GACnC,CAAC,MAAM,EAAE,0BAA0B,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,CAgD1D"}
@@ -1,91 +1,98 @@
1
- import type { APIError, S3Api } from "@dimah-s3/core";
2
- import type { UploadFileState, UploadPhase, UploadProgress, FileUploadConfig, UploadHooks, UploadRequestOptions } from "../types/index.js";
3
- import { type DropzoneInputProps, type DropzoneRootProps, type FileRejection } from "./use-file-intake";
1
+ import type { APIError } from "@dimah-s3/core";
2
+ import type { TransferProgress } from "../types/operation.js";
3
+ import type { FileRejection, UploadBatchResult, UploadCallOptions, UploadFileState, UploadPhase, UseUploadOptions } from "../types/upload.js";
4
+ import { type DropTargetProps, type DropzoneInputProps, type DropzoneRootProps, type UploadCallInput } from "./use-file-intake";
4
5
  import { type UseRouteUploadPolicyReturn } from "./use-route-upload-policy";
5
- export type { DropzoneInputProps, DropzoneRootProps, FileRejection };
6
- /** Catalog constraints plus the client `maxFiles` cap. */
6
+ export type { DropTargetProps, DropzoneInputProps, DropzoneRootProps };
7
+ export type { FileRejection, UseUploadOptions } from "../types/upload.js";
8
+ /**
9
+ * The route's upload policy narrowed by the hook options: the stricter
10
+ * `accept` and `maxFileSize` win, `multipart` needs the route and an option
11
+ * that is not `false`, and `checksum` follows the route.
12
+ */
7
13
  export type UploadPolicy = UseRouteUploadPolicyReturn & {
8
- /** Max files per selection. @default 1 */
14
+ /** Max files per call. @default 1 */
9
15
  maxFiles: number;
10
16
  };
11
- /** Options for {@link useUpload}. */
12
- export type UseUploadOptions = FileUploadConfig & UploadHooks & {
13
- /** S3Api. Optional when an `<S3Provider>` is present in the tree. */
14
- api?: S3Api;
15
- /** Static request options applied to every file. */
16
- uploadOptions?: UploadRequestOptions;
17
- /** Per-file request options (overrides `uploadOptions`). */
18
- getUploadOptions?: (file: File) => UploadRequestOptions;
19
- /** Disable all intake interactions. */
20
- disabled?: boolean;
21
- /**
22
- * Disable drag interactions on the root (button-style custom UIs).
23
- * `UploadButton` does not bind `getRootProps` — it only uses `open()`.
24
- * @default false
25
- */
26
- noDrag?: boolean;
27
- /**
28
- * Disable click-to-open on the root (when opening via `open()` on a button).
29
- * @default false
30
- */
31
- noClick?: boolean;
32
- /**
33
- * Disable keyboard activation on the root.
34
- * @default false
35
- */
36
- noKeyboard?: boolean;
37
- /** Called when dropzone soft-rejects files (type/size/count). */
38
- onFileReject?: (rejections: readonly FileRejection[]) => void;
39
- };
17
+ /** What {@link useUpload} returns. */
40
18
  export type UseUploadReturn = {
41
- /** Per-file states in the current batch. */
42
- files: UploadFileState[];
43
- /** First file; handy when `maxFiles` is 1. Same as `files[0] ?? null`. */
19
+ /** Stable for the life of the component. Toast owners use it. */
20
+ instanceId: string;
21
+ /** Every file in the queue, in the order it was added. */
22
+ files: readonly UploadFileState[];
23
+ /** The first file, or `null`. Handy when `maxFiles` is 1. */
44
24
  file: UploadFileState | null;
45
- /** Batch phase. Single-file batches also surface `presigning` / `finalizing`. */
25
+ /** `uploading` while a call is preparing or a file is in flight. */
46
26
  phase: UploadPhase;
47
- /** Aggregate byte transfer progress. */
48
- progress: UploadProgress;
49
- /** Batch-level error, or `null`. */
27
+ /** Bytes sent across every file in the queue. */
28
+ progress: TransferProgress;
29
+ /** The one failed file's error, or `PARTIAL_FAILURE` when several failed. */
50
30
  error: APIError | null;
51
- /** `true` while bytes are transferring (`phase === "uploading"`). */
52
- isUploading: boolean;
53
- /**
54
- * `true` while the upload is in-flight (`validating`, `presigning`,
55
- * `uploading`, or `finalizing`).
56
- */
31
+ /** `true` while `phase` is `uploading`. */
57
32
  isPending: boolean;
58
- /**
59
- * Resolved client constraints: catalog values plus hook overrides,
60
- * and `maxFiles` (default 1).
61
- */
62
33
  policy: UploadPolicy;
63
- /** `true` when an `uploadStore` is configured (pause/resume). */
34
+ /** `true` when an `uploadStore` is set, so multipart uploads can resume. */
64
35
  resumable: boolean;
65
36
  /**
66
- * Start an upload from a picker, drop, paste, or a `File` you already have.
37
+ * The `disabled` option: the root, drop targets, paste and `open()` do
38
+ * nothing. Render pickers and paste handlers disabled while it is set;
39
+ * `handleFiles` still uploads what it is given.
40
+ */
41
+ disabled: boolean;
42
+ /**
43
+ * Validates and uploads files from a picker, a drop, a paste or your own
44
+ * code. Invalid files are rejected without stopping the others. Resolves
45
+ * once every file has ended.
67
46
  */
68
- handleFiles: (files: FileList | File[] | File | null) => Promise<void>;
69
- /** Open the native file picker. */
70
- open: () => void;
71
- /** Abort and reset to idle. */
72
- cancel: () => void;
47
+ handleFiles: (files: FileList | readonly File[] | File | null, call?: UploadCallOptions) => Promise<UploadBatchResult>;
48
+ /** Opens the native file picker. `call` applies to the picked files. */
49
+ open: (call?: UploadCallOptions) => void;
73
50
  /**
74
- * Soft-stop: preserves S3 parts and store entry so a future upload can
75
- * resume. For non-resumable uploads, identical to `cancel()`.
51
+ * Uploads the failed file `id` again, or every failed file. Each file goes
52
+ * with the options of the call it came from: it is validated again, and
53
+ * `beforeUpload` and `onUploadStart` run again. It keeps its place and
54
+ * `id` in the queue, and a retry never replaces the queue. Resolves like
55
+ * `handleFiles`; with nothing to retry, at once and without callbacks.
76
56
  */
57
+ retry: (id?: string) => Promise<UploadBatchResult>;
58
+ /** Cancels one file by `id`, or every file. */
59
+ cancel: (id?: string) => void;
60
+ /** Stops every file but keeps stored multipart uploads for resuming. */
77
61
  detach: () => void;
62
+ /** Removes settled files and rejections. Stable identity. */
78
63
  reset: () => void;
79
- /** Spread on the dropzone / clickable root element. */
80
- getRootProps: <T extends DropzoneRootProps>(props?: T) => T;
64
+ /**
65
+ * Spread on a dropzone: drag and drop, paste, click and keyboard to open
66
+ * the picker. `call` applies to the files it takes in.
67
+ */
68
+ getRootProps: <T extends DropzoneRootProps>(props?: T, call?: UploadCallInput) => T;
69
+ /**
70
+ * Drag and drop handlers only: no `tabIndex`, no click or keyboard, no
71
+ * `role`. For drop targets that keep their own interactions, such as
72
+ * folder rows. A drop on a target inside a dropzone uses the target's
73
+ * `call`.
74
+ */
75
+ getDropTargetProps: <T extends object = DropTargetProps>(props?: T & DropTargetProps, call?: UploadCallInput) => T & DropTargetProps;
81
76
  /** Spread on a hidden `<input type="file">`. */
82
77
  getInputProps: <T extends DropzoneInputProps>(props?: T) => T;
83
- /** `true` while a drag is over the root. */
78
+ /** `true` while files are dragged over a dropzone or drop target. */
84
79
  isDragActive: boolean;
80
+ /** `true` while the dragged files match `accept` and `maxFiles`. */
85
81
  isDragAccept: boolean;
82
+ /** `true` while the dragged files break `accept` or `maxFiles`. */
86
83
  isDragReject: boolean;
87
- /** Soft rejections from the last drop / selection. */
84
+ /** Files the newest call rejected for their type, size or count. */
88
85
  fileRejections: readonly FileRejection[];
89
86
  };
87
+ /**
88
+ * Uploads files to a named route through a queue.
89
+ *
90
+ * Every call validates its files against the route policy from the catalog
91
+ * and rejects the invalid ones with catalog error codes, so
92
+ * `useFormatDimahError` can show them. Valid files upload `concurrentFiles`
93
+ * at a time, and each one can be cancelled with `cancel(id)`. A call's
94
+ * `uploadOptions` merge over the hook's: call fields win, and `metadata`
95
+ * merges key by key.
96
+ */
90
97
  export declare function useUpload(options: UseUploadOptions): UseUploadReturn;
91
98
  //# sourceMappingURL=use-upload.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"use-upload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E"}
package/dist/index.d.ts CHANGED
@@ -1,23 +1,19 @@
1
- export type { UploadResult, UploadProgress, UploadPhase, UploadFileInfo, UploadFileState, UploadRequestOptions, UploadHooks, UploadTransport, S3ApiUploadTransport, RetryConfig, FileUploadConfig, } from "./types/upload";
2
- export type { StoredUpload, UploadStore } from "./types/upload-store";
3
- export type { DownloadPhase, DownloadHooks, FetchDownloadPhase, FetchDownloadProgress, FetchDownloadHooks, } from "./types/download";
4
- export type { DeletePhase, DeleteHooks } from "./types/delete";
5
- export { S3UploadError } from "./types/error";
6
- export { APIError, S3_ERROR_CODES, buildObjectKey, fileNameFromKey, formatFileSize, resolveInlineDisposition, isAPIError, isS3ErrorCode, sanitizeFileName, validateFile, sha256Base64, sha256File, matchesMagicBytes, sniffContentType, buildPublicObjectUrl, buildContentDisposition, type FormatFileSizeOptions, type S3Api, type S3ErrorCode, type ValidateFileError, type InferS3Routes, type DimahS3Routes, type S3RouteName, type RouteCatalogResponse, } from "@dimah-s3/core";
7
- export { defineApi } from "./api";
8
- export { createS3Client, type CreateS3ClientOptions, type CreateS3ClientResult, type ReactS3Client, } from "./create-s3-client";
9
1
  export { S3Provider, useApi, type S3ProviderProps } from "./s3-provider";
10
- /** Generated key map — use with `satisfies Partial<Translations>`. */
2
+ export { createS3Client, type ReactS3Client } from "./create-s3-client";
3
+ /** Generated key map. Use it with `satisfies Partial<Translations>`. */
11
4
  export type { Translations } from "./translations";
12
- export { createLocalStorageStore, createMemoryStore } from "./store";
13
- export { uploadFile, uploadFiles, multipartResumeKey, DEFAULT_MULTIPART_THRESHOLD, type UploadEngineCallbacks, type FileItem, type FileItemStatus, type MultiUploadCallbacks, } from "./upload";
14
- export { formatAcceptLabels, formatUploadProgress, formatSpeed, formatEta, useFormatDimahError, useFormatFileSize, useFormatNumber, useFormatValidateFileError, loadRouteCatalog, mergeRouteUploadPolicy, resolveRouteUploadPolicy, } from "./helpers";
15
- export type { RouteUploadPolicy } from "./helpers";
16
- export { useUpload, type UseUploadOptions, type UseUploadReturn, type UploadPolicy, type FileRejection, type DropzoneRootProps, type DropzoneInputProps, } from "./hooks/use-upload";
17
- export { useDownload, isFetchDownload, type UseDownloadOptions, type UseDownloadReturn, type UseNavigateDownloadOptions, type UseNavigateDownloadReturn, type UseFetchDownloadOptions, type UseFetchDownloadState, type UseFetchDownloadReturn, } from "./hooks/use-download";
18
- export { useDelete, type UseDeleteOptions, type UseDeleteState, type UseDeleteReturn, } from "./hooks/use-delete";
19
- export { useRouteUploadPolicy, type CatalogLoadStatus, type UseRouteUploadPolicyOptions, type UseRouteUploadPolicyReturn, } from "./hooks/use-route-upload-policy";
5
+ export { useUpload, type DropTargetProps, type DropzoneInputProps, type DropzoneRootProps, type UploadPolicy, type UseUploadReturn, } from "./hooks/use-upload";
6
+ export { useDownload } from "./hooks/use-download";
7
+ export { useFetchDownload } from "./hooks/use-fetch-download";
8
+ export { useDelete } from "./hooks/use-delete";
20
9
  export { useObjectUrl, type UseObjectUrlOptions, type UseObjectUrlReturn, } from "./hooks/use-object-url";
21
- export { useObjectList, type UseObjectListOptions, type UseObjectListReturn, type ObjectListFolder, type ObjectListPage, type ObjectListQuery, type ObjectListQueryInput, type ObjectListUsage, } from "./hooks/use-object-list";
22
- export { readObjectListLevel, type ObjectListLevel, } from "./list/read-object-list-level";
10
+ export { useRouteUploadPolicy, type CatalogLoadStatus, type UseRouteUploadPolicyOptions, type UseRouteUploadPolicyReturn, } from "./hooks/use-route-upload-policy";
11
+ export { useObjectList, type UseObjectListReturn, } from "./hooks/use-object-list";
12
+ export { useObjectListSelection, type ObjectListSelectionMode, type UseObjectListSelectionOptions, type UseObjectListSelectionReturn, } from "./hooks/use-object-list-selection";
13
+ export { useFormatAcceptLabels, useFormatDate, useFormatDimahError, useFormatEta, useFormatFileSize, useFormatNumber, useFormatSpeed, type DateInput, } from "./helpers";
14
+ export type * from "./types";
15
+ export type * from "./list/types";
16
+ export type { RouteUploadPolicy, RouteUploadPolicyOptions, } from "./helpers/load-route-catalog";
17
+ export type { MemoryObjectSourceOptions } from "./list/memory-object-source";
18
+ export type { ObjectListLevel } from "./list/read-object-list-level";
23
19
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,WAAW,EACX,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AACxB,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACtE,YAAY,EACV,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAG9C,OAAO,EACL,QAAQ,EACR,cAAc,EACd,cAAc,EACd,eAAe,EACf,cAAc,EACd,wBAAwB,EACxB,UAAU,EACV,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,UAAU,EACV,iBAAiB,EACjB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,KAAK,EACV,KAAK,WAAW,EAChB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EACL,cAAc,EACd,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EACzB,KAAK,aAAa,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,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