@dimah-s3/react 1.7.0 → 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
|
@@ -1,46 +1,67 @@
|
|
|
1
1
|
export type Translations = {
|
|
2
|
-
"\"{name}\" deleted(status)": string;
|
|
3
2
|
"1 file(object list usage)": string;
|
|
3
|
+
"A file checksum is required(API error)": string;
|
|
4
|
+
"A file with this name already exists(API error)": string;
|
|
5
|
+
"A folder with this name already exists(API error)": string;
|
|
6
|
+
"A folder with this name already exists(object list new folder)": string;
|
|
7
|
+
"Accepted {types}.(dropzone hint)": string;
|
|
4
8
|
"Access denied(API error)": string;
|
|
5
|
-
"All {count}
|
|
9
|
+
"All {count} files uploaded(status)": string;
|
|
10
|
+
"An uploaded part was not found(API error)": string;
|
|
11
|
+
"Another change happened at the same time. Try again.(API error)": string;
|
|
6
12
|
"Are you sure you want to delete \"{name}\"? This action cannot be undone.(dialog description)": string;
|
|
13
|
+
"Ascending(object list sort)": string;
|
|
14
|
+
"Audio(file type group)": string;
|
|
7
15
|
"B(file size unit)": string;
|
|
8
|
-
"Cancel
|
|
16
|
+
"Cancel all uploads(upload control)": string;
|
|
17
|
+
"Cancel download of {name}(download control)": string;
|
|
18
|
+
"Cancel {name}(attachment action)": string;
|
|
9
19
|
"Cancel(dialog button)": string;
|
|
20
|
+
"Cancel(download control)": string;
|
|
21
|
+
"Cancel(object list new folder)": string;
|
|
10
22
|
"Cancel(toast action)": string;
|
|
11
|
-
"
|
|
23
|
+
"Clear search(object list)": string;
|
|
12
24
|
"Clear(object list selection)": string;
|
|
13
|
-
"
|
|
25
|
+
"Close search(object list)": string;
|
|
14
26
|
"Copy link(object list menu)": string;
|
|
15
27
|
"Could not copy link(object list menu)": string;
|
|
16
28
|
"Could not create link(object list menu)": string;
|
|
17
29
|
"Could not delete the selection(object list selection)": string;
|
|
18
|
-
"Could not delete {count} files(
|
|
30
|
+
"Could not delete {count} files(toast)": string;
|
|
19
31
|
"Could not load files(object list)": string;
|
|
20
32
|
"Could not reach storage ({code})(API error)": string;
|
|
21
|
-
"
|
|
33
|
+
"Could not reach storage(API error)": string;
|
|
34
|
+
"Create folder(object list new folder)": string;
|
|
22
35
|
"Delete failed(toast)": string;
|
|
23
|
-
"Delete file(tooltip)": string;
|
|
24
36
|
"Delete file?(dialog title)": string;
|
|
25
|
-
"Delete {count} files?(
|
|
37
|
+
"Delete {count} files?(dialog title)": string;
|
|
38
|
+
"Delete {name}(attachment action)": string;
|
|
26
39
|
"Delete(button)": string;
|
|
27
40
|
"Delete(dialog confirm)": string;
|
|
28
|
-
"Deleted {count} files(
|
|
41
|
+
"Deleted {count} files(toast)": string;
|
|
42
|
+
"Deleting is disabled(API error)": string;
|
|
43
|
+
"Deleting…(delete status)": string;
|
|
44
|
+
"Descending(object list sort)": string;
|
|
45
|
+
"Dismiss {name}(attachment action)": string;
|
|
29
46
|
"Dismiss(attachment action)": string;
|
|
30
47
|
"Download cancelled(toast)": string;
|
|
31
|
-
"Download complete(status)": string;
|
|
32
48
|
"Download complete(toast)": string;
|
|
33
|
-
"Download failed(
|
|
49
|
+
"Download failed(API error)": string;
|
|
34
50
|
"Download failed(toast)": string;
|
|
35
|
-
"Download file(tooltip)": string;
|
|
36
51
|
"Download started(toast)": string;
|
|
52
|
+
"Download {name}(attachment action)": string;
|
|
37
53
|
"Download(button)": string;
|
|
38
54
|
"Downloading(toast)": string;
|
|
55
|
+
"Downloads are disabled(API error)": string;
|
|
56
|
+
"Drag and drop a file here(dropzone)": string;
|
|
39
57
|
"Drag and drop files here(dropzone)": string;
|
|
40
58
|
"Drop files here to add them to this folder.(object list)": string;
|
|
41
59
|
"Drop to upload into this folder(object list)": string;
|
|
60
|
+
"Drop to upload into {name}(object list)": string;
|
|
61
|
+
"Drop to upload(dropzone)": string;
|
|
42
62
|
"EB(file size unit)": string;
|
|
43
|
-
"
|
|
63
|
+
"Each up to {size}(dropzone hint)": string;
|
|
64
|
+
"Enter a folder name(object list new folder)": string;
|
|
44
65
|
"Expires in 1 day(object list menu)": string;
|
|
45
66
|
"Expires in 1 hour(object list menu)": string;
|
|
46
67
|
"Expires in 1 minute(object list menu)": string;
|
|
@@ -50,61 +71,122 @@ export type Translations = {
|
|
|
50
71
|
"Expires in {count} minutes(object list menu)": string;
|
|
51
72
|
"Expires in {count} seconds(object list menu)": string;
|
|
52
73
|
"File actions(object list menu)": string;
|
|
74
|
+
"File changed during upload(API error)": string;
|
|
75
|
+
"File content does not match its type(API error)": string;
|
|
53
76
|
"File deleted(toast)": string;
|
|
54
|
-
"File is empty(
|
|
77
|
+
"File is empty(API error)": string;
|
|
55
78
|
"File is too large(API error)": string;
|
|
79
|
+
"File limit reached(API error)": string;
|
|
56
80
|
"File not accepted(toast)": string;
|
|
57
81
|
"File not found(API error)": string;
|
|
58
|
-
"File size exceeds {size} limit(
|
|
59
|
-
"File type \"{type}\" is not allowed(
|
|
82
|
+
"File size exceeds {size} limit(API error)": string;
|
|
83
|
+
"File type \"{type}\" is not allowed(API error)": string;
|
|
60
84
|
"File type is not allowed(API error)": string;
|
|
61
85
|
"Files and folders you add here will show up in this list.(object list)": string;
|
|
62
86
|
"Files(object list)": string;
|
|
63
87
|
"Finishing…(upload status)": string;
|
|
88
|
+
"Folder actions(object list menu)": string;
|
|
89
|
+
"Folder is not empty(API error)": string;
|
|
90
|
+
"Folder name is invalid(API error)": string;
|
|
91
|
+
"Folder name(object list new folder)": string;
|
|
92
|
+
"Folders above(object list)": string;
|
|
93
|
+
"Fonts(file type group)": string;
|
|
64
94
|
"GB(file size unit)": string;
|
|
95
|
+
"Grid view(object list)": string;
|
|
96
|
+
"Images(file type group)": string;
|
|
65
97
|
"Invalid request(API error)": string;
|
|
66
98
|
"KB(file size unit)": string;
|
|
99
|
+
"Large uploads are disabled(API error)": string;
|
|
67
100
|
"Link copied(object list menu)": string;
|
|
101
|
+
"List view(object list)": string;
|
|
102
|
+
"Load more(object list)": string;
|
|
68
103
|
"Loading files(object list)": string;
|
|
69
104
|
"MB(file size unit)": string;
|
|
105
|
+
"Maximum files reached.(dropzone hint)": string;
|
|
106
|
+
"Modified(object list sort)": string;
|
|
107
|
+
"Name(object list sort)": string;
|
|
108
|
+
"Network error(API error)": string;
|
|
109
|
+
"New folder(object list)": string;
|
|
110
|
+
"No results(object list)": string;
|
|
70
111
|
"Not found(API error)": string;
|
|
112
|
+
"Nothing in this folder matches “{search}”.(object list)": string;
|
|
71
113
|
"Nothing to delete(object list selection)": string;
|
|
72
114
|
"Object key is invalid(API error)": string;
|
|
73
115
|
"PB(file size unit)": string;
|
|
74
116
|
"Pause(upload control)": string;
|
|
75
117
|
"Preparing…(upload status)": string;
|
|
118
|
+
"Progress for {name}(progress)": string;
|
|
119
|
+
"Remove {name}(attachment action)": string;
|
|
120
|
+
"Request format is not supported(API error)": string;
|
|
121
|
+
"Request is too large(API error)": string;
|
|
122
|
+
"Requested range is not available(API error)": string;
|
|
123
|
+
"Retry failed uploads(upload control)": string;
|
|
124
|
+
"Retry {name}(attachment action)": string;
|
|
76
125
|
"Retry(object list)": string;
|
|
126
|
+
"Retry(toast action)": string;
|
|
127
|
+
"Search files(object list)": string;
|
|
77
128
|
"Select all(object list selection)": string;
|
|
78
129
|
"Select this page(object list selection)": string;
|
|
79
130
|
"Select {name}(object list selection)": string;
|
|
80
131
|
"Selected folders stay in the list.(object list selection)": string;
|
|
132
|
+
"Size(object list sort)": string;
|
|
133
|
+
"Some operations failed(API error)": string;
|
|
81
134
|
"Something went wrong(API error)": string;
|
|
135
|
+
"Sort(object list sort)": string;
|
|
136
|
+
"Starting…(download progress)": string;
|
|
137
|
+
"Storage quota exceeded(API error)": string;
|
|
138
|
+
"Streaming downloads are disabled(API error)": string;
|
|
82
139
|
"TB(file size unit)": string;
|
|
140
|
+
"Text files(file type group)": string;
|
|
141
|
+
"The file has changed(API error)": string;
|
|
142
|
+
"These files cannot be uploaded(dropzone)": string;
|
|
83
143
|
"These files cannot be uploaded(object list)": string;
|
|
84
|
-
"This action cannot be undone.(
|
|
144
|
+
"This action cannot be undone.(dialog description)": string;
|
|
145
|
+
"This feature is disabled(API error)": string;
|
|
85
146
|
"This folder is empty(object list)": string;
|
|
86
147
|
"This link works while you can access this file.(object list menu)": string;
|
|
148
|
+
"Too many files (max {maxFiles})(API error)": string;
|
|
149
|
+
"Too many files(API error)": string;
|
|
87
150
|
"Unauthorized(API error)": string;
|
|
88
|
-
"Unknown error(fallback)": string;
|
|
89
151
|
"Unknown file route(API error)": string;
|
|
152
|
+
"Up to {size}(dropzone hint)": string;
|
|
90
153
|
"Upload complete(toast)": string;
|
|
154
|
+
"Upload complete(upload status)": string;
|
|
155
|
+
"Upload failed(API error)": string;
|
|
91
156
|
"Upload failed(status)": string;
|
|
92
157
|
"Upload failed(toast)": string;
|
|
93
158
|
"Upload file(button)": string;
|
|
94
159
|
"Upload files(button)": string;
|
|
95
160
|
"Upload finished with errors(toast)": string;
|
|
161
|
+
"Upload part is out of range(API error)": string;
|
|
162
|
+
"Upload progress(progress)": string;
|
|
163
|
+
"Upload session has expired(API error)": string;
|
|
164
|
+
"Upload session is invalid(API error)": string;
|
|
165
|
+
"Upload to this folder(object list menu)": string;
|
|
96
166
|
"Uploaded part {partNumber} was not found(API error)": string;
|
|
167
|
+
"Uploaded size does not match the file(API error)": string;
|
|
97
168
|
"Uploading {done}/{total}(toast)": string;
|
|
98
169
|
"Uploading(toast)": string;
|
|
99
|
-
"
|
|
100
|
-
"
|
|
170
|
+
"Uploading…(upload status)": string;
|
|
171
|
+
"Uploads are disabled(API error)": string;
|
|
172
|
+
"Videos(file type group)": string;
|
|
173
|
+
"View(object list)": string;
|
|
174
|
+
"You can upload {count} files(dropzone hint)": string;
|
|
175
|
+
"{count} files uploaded(toast)": string;
|
|
176
|
+
"{count} files were rejected(toast)": string;
|
|
101
177
|
"{count} files(object list usage)": string;
|
|
102
178
|
"{count} of {max} files(object list usage)": string;
|
|
103
179
|
"{count} selected on this page(object list selection)": string;
|
|
104
180
|
"{count} selected(object list selection)": string;
|
|
105
|
-
"{done}
|
|
106
|
-
"{
|
|
181
|
+
"{done} of {total} files uploaded(upload progress)": string;
|
|
182
|
+
"{failed} of {total} failed(API error)": string;
|
|
183
|
+
"{hours}h left(time remaining)": string;
|
|
184
|
+
"{hours}h {minutes}m left(time remaining)": string;
|
|
185
|
+
"{loaded} of {total}(download progress)": string;
|
|
186
|
+
"{minutes}m left(time remaining)": string;
|
|
107
187
|
"{percent}%(progress)": string;
|
|
188
|
+
"{seconds}s left(time remaining)": string;
|
|
189
|
+
"{size}/s(transfer speed)": string;
|
|
108
190
|
"{succeeded} succeeded, {failed} failed(toast)": string;
|
|
109
191
|
"{used} of {max}(object list usage)": string;
|
|
110
192
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/translations/types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;IACxC,0CAA0C,EAAE,MAAM,CAAC;IACnD,wCAAwC,EAAE,MAAM,CAAC;IACjD,iCAAiC,EAAE,MAAM,CAAC;IAC1C,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iCAAiC,EAAE,MAAM,CAAC;IAC1C,0BAA0B,EAAE,MAAM,CAAC;IACnC,+CAA+C,EAAE,MAAM,CAAC;IACxD,oCAAoC,EAAE,MAAM,CAAC;CAC9C,CAAC"}
|
package/dist/types/delete.d.ts
CHANGED
|
@@ -1,11 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import type { APIError, S3Api, S3RouteName } from "@dimah-s3/core";
|
|
2
|
+
import type { KeyError, OperationOutcome } from "./operation";
|
|
3
|
+
/** One delete of one key, as shown by {@link UseDeleteReturn.operations}. */
|
|
4
|
+
export type DeleteOperation = {
|
|
5
|
+
/** Unique within the hook instance. Ascends with creation order. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** S3 object key. */
|
|
8
|
+
key: string;
|
|
9
|
+
/** Shared by every key of one `removeMany` call. `null` for `remove`. */
|
|
10
|
+
batchId: string | null;
|
|
11
|
+
/** Display name passed with the key, or `null`. */
|
|
12
|
+
fileName: string | null;
|
|
13
|
+
phase: "deleting" | "success" | "error";
|
|
14
|
+
/** Set when `phase` is `"error"`. */
|
|
15
|
+
error: APIError | null;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* What a successful delete returns. `bucket` is set by `remove` only,
|
|
19
|
+
* because `deleteMany` responses do not carry it.
|
|
20
|
+
*/
|
|
21
|
+
export type DeleteData = {
|
|
22
|
+
/** S3 object key. */
|
|
23
|
+
key: string;
|
|
24
|
+
/** Target bucket. */
|
|
25
|
+
bucket?: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* How a delete of one key ended. `useDelete` has no cancel, so a delete is
|
|
29
|
+
* never `aborted`.
|
|
30
|
+
*/
|
|
31
|
+
export type DeleteOutcome = Exclude<OperationOutcome<DeleteData>, {
|
|
32
|
+
status: "aborted";
|
|
33
|
+
}>;
|
|
34
|
+
/** How a `remove` or `removeMany` call ended, by key, in call order. */
|
|
35
|
+
export type DeleteResult = {
|
|
36
|
+
/** Keys that were deleted. */
|
|
37
|
+
deleted: string[];
|
|
38
|
+
/** Keys that failed, each with its error. */
|
|
39
|
+
failed: KeyError[];
|
|
40
|
+
/** Keys that `beforeDelete` blocked. */
|
|
41
|
+
blocked: string[];
|
|
42
|
+
};
|
|
43
|
+
/** A key to delete, optionally with a display name for its operation. */
|
|
44
|
+
export type DeleteItem = string | {
|
|
45
|
+
key: string;
|
|
46
|
+
fileName?: string;
|
|
47
|
+
};
|
|
48
|
+
/** Options for `useDelete`. */
|
|
49
|
+
export type UseDeleteOptions = {
|
|
50
|
+
/** S3Api. Optional when an `<S3Provider>` is present in the tree. */
|
|
51
|
+
api?: S3Api;
|
|
52
|
+
/** Named server route (`dimahS3({ routes })`). */
|
|
53
|
+
route: S3RouteName;
|
|
54
|
+
/**
|
|
55
|
+
* Runs once per call with the keys it will send. Return `false` to block
|
|
56
|
+
* them. A throw fails them with `HOOK_FAILED`.
|
|
57
|
+
*/
|
|
58
|
+
beforeDelete?: (keys: readonly string[]) => boolean | Promise<boolean>;
|
|
59
|
+
/** Runs once per call before the request. A throw fails it with `HOOK_FAILED`. */
|
|
60
|
+
onDeleteStart?: (keys: readonly string[]) => void;
|
|
61
|
+
/** Runs once per deleted key, after every `onError` of the call. */
|
|
62
|
+
onSuccess?: (data: DeleteData, key: string) => void | Promise<void>;
|
|
63
|
+
/** Runs once per failed key. */
|
|
64
|
+
onError?: (error: APIError, key: string) => void;
|
|
65
|
+
/** Runs once per call, after every other callback. */
|
|
66
|
+
onSettled?: (result: DeleteResult) => void | Promise<void>;
|
|
67
|
+
};
|
|
68
|
+
/** Return value of `useDelete`. */
|
|
69
|
+
export type UseDeleteReturn = {
|
|
70
|
+
/** Stable per hook instance (`useId`). Toast owners register under it. */
|
|
71
|
+
instanceId: string;
|
|
72
|
+
/** Every operation still kept, in creation order. */
|
|
73
|
+
operations: readonly DeleteOperation[];
|
|
74
|
+
/** The newest operation for `key`. */
|
|
75
|
+
get: (key: string) => DeleteOperation | undefined;
|
|
76
|
+
/** Keys with a running call, in start order. */
|
|
77
|
+
pendingKeys: readonly string[];
|
|
78
|
+
/** `true` while any key has a running call. */
|
|
79
|
+
isPending: boolean;
|
|
80
|
+
/**
|
|
81
|
+
* Deletes `key`. A call for a key that is already running joins that call
|
|
82
|
+
* and resolves with its outcome without running callbacks again.
|
|
83
|
+
*/
|
|
84
|
+
remove: (key: string, options?: {
|
|
85
|
+
fileName?: string;
|
|
86
|
+
}) => Promise<DeleteOutcome>;
|
|
87
|
+
/**
|
|
88
|
+
* Deletes any number of keys, sending at most `DELETE_MANY_MAX_KEYS` per
|
|
89
|
+
* `deleteMany` request. Keys that are already running are joined rather
|
|
90
|
+
* than sent again, and their outcomes are folded into the result. Every
|
|
91
|
+
* operation of the call shares one `batchId`.
|
|
92
|
+
*/
|
|
93
|
+
removeMany: (items: readonly DeleteItem[]) => Promise<DeleteResult>;
|
|
94
|
+
/**
|
|
95
|
+
* Removes settled operations for `key`, or every settled operation.
|
|
96
|
+
* Running deletes are not cancelled. Stable identity.
|
|
97
|
+
*/
|
|
98
|
+
reset: (key?: string) => void;
|
|
10
99
|
};
|
|
11
100
|
//# sourceMappingURL=delete.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/types/delete.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"delete.d.ts","sourceRoot":"","sources":["../../src/types/delete.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AACnE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AK,IAAI,CAAC;CAC/B,CAAC"}
|
package/dist/types/download.d.ts
CHANGED
|
@@ -1,26 +1,155 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
export type
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
import type { APIError, ContentDispositionType, DownloadPresignResponse, S3Api, S3RouteName } from "@dimah-s3/core";
|
|
2
|
+
import type { KeyError, OperationOutcome, TransferProgress } from "./operation";
|
|
3
|
+
/** Options for one `download(key)` call. */
|
|
4
|
+
export type DownloadOptions = {
|
|
5
|
+
/** File name the browser saves, fitted to 255 UTF-8 bytes like an upload name. */
|
|
6
|
+
fileName?: string;
|
|
7
|
+
};
|
|
8
|
+
/** Options for one presign request. */
|
|
9
|
+
export type PresignOptions = {
|
|
10
|
+
/** File name the browser saves, fitted to 255 UTF-8 bytes like an upload name. */
|
|
11
|
+
fileName?: string;
|
|
12
|
+
/** Requested URL lifetime in seconds. The server caps it at the route's limit. */
|
|
13
|
+
expiresIn?: number;
|
|
14
|
+
};
|
|
15
|
+
/** How every key of one `presignMany` call ended. */
|
|
16
|
+
export type PresignManyResult = {
|
|
17
|
+
/** Signed URLs, in the order of the request. */
|
|
18
|
+
signed: DownloadPresignResponse[];
|
|
19
|
+
failed: KeyError[];
|
|
20
|
+
/** Keys a `beforeDownload` callback blocked. */
|
|
21
|
+
blocked: string[];
|
|
22
|
+
};
|
|
23
|
+
/** One `useDownload` call for one key. */
|
|
24
|
+
export type DownloadOperation = {
|
|
25
|
+
/** Unique within the hook instance. Ascends with creation order. */
|
|
26
|
+
id: string;
|
|
27
|
+
key: string;
|
|
28
|
+
/** The requested file name, or `null` when the server picks it. */
|
|
29
|
+
fileName: string | null;
|
|
30
|
+
phase: "presigning" | "success" | "error" | "aborted";
|
|
31
|
+
error: APIError | null;
|
|
32
|
+
/** The signed URL the browser was handed. Set on success. */
|
|
33
|
+
result: DownloadPresignResponse | null;
|
|
34
|
+
};
|
|
35
|
+
/** How one `useDownload` call ended. */
|
|
36
|
+
export type DownloadOutcome = OperationOutcome<DownloadPresignResponse>;
|
|
37
|
+
type DownloadBase = {
|
|
38
|
+
/** Optional when an `<S3Provider>` is in the tree. */
|
|
39
|
+
api?: S3Api;
|
|
40
|
+
/** Named server route. */
|
|
41
|
+
route: S3RouteName;
|
|
42
|
+
/** Content-Disposition for the GET. The server can override it. */
|
|
43
|
+
disposition?: ContentDispositionType;
|
|
44
|
+
/** Runs once per call, before presigning. Return `false` to block it. */
|
|
45
|
+
beforeDownload?: (key: string) => boolean | Promise<boolean>;
|
|
46
|
+
/** Runs once when a call fails. */
|
|
47
|
+
onError?: (error: APIError, key: string) => void;
|
|
48
|
+
};
|
|
49
|
+
/** Options for `useDownload`. */
|
|
50
|
+
export type UseDownloadOptions = DownloadBase & {
|
|
51
|
+
/** Runs once the browser has the URL, not when the download completes. */
|
|
52
|
+
onSuccess?: (data: DownloadPresignResponse, key: string) => void | Promise<void>;
|
|
53
|
+
/** Runs once per `download` call, however it ended. */
|
|
54
|
+
onSettled?: (outcome: DownloadOutcome) => void | Promise<void>;
|
|
55
|
+
};
|
|
56
|
+
/** Return of `useDownload`. */
|
|
57
|
+
export type UseDownloadReturn = {
|
|
58
|
+
/** Tells this hook apart from `useFetchDownload`. */
|
|
59
|
+
mode: "navigate";
|
|
60
|
+
/** Stable per hook instance. Toast owners use it. */
|
|
61
|
+
instanceId: string;
|
|
62
|
+
/** Every `download` call, ordered by `id`. */
|
|
63
|
+
operations: readonly DownloadOperation[];
|
|
64
|
+
/** The newest operation for `key`. */
|
|
65
|
+
get: (key: string) => DownloadOperation | undefined;
|
|
66
|
+
/** Keys with a running call. */
|
|
67
|
+
pendingKeys: readonly string[];
|
|
68
|
+
isPending: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Presigns `key` and hands the URL to the browser. A call for a key that
|
|
71
|
+
* is already running joins it.
|
|
72
|
+
*/
|
|
73
|
+
download: (key: string, options?: DownloadOptions) => Promise<DownloadOutcome>;
|
|
74
|
+
/**
|
|
75
|
+
* Presigns `key` without handing the URL to the browser. Runs
|
|
76
|
+
* `beforeDownload` only, and records no operation.
|
|
77
|
+
*/
|
|
78
|
+
presign: (key: string, options?: PresignOptions) => Promise<DownloadOutcome>;
|
|
79
|
+
/** Like `presign` for many keys, four at a time. */
|
|
80
|
+
presignMany: (files: readonly ({
|
|
81
|
+
key: string;
|
|
82
|
+
} & PresignOptions)[]) => Promise<PresignManyResult>;
|
|
83
|
+
/** Aborts the running call for `key`, or every running call. */
|
|
84
|
+
cancel: (key?: string) => void;
|
|
85
|
+
/** Removes settled operations for `key`, or every settled operation. */
|
|
86
|
+
reset: (key?: string) => void;
|
|
87
|
+
};
|
|
88
|
+
/** What a fetch download saved. */
|
|
89
|
+
export type FetchDownloadResult = {
|
|
90
|
+
fileName: string;
|
|
91
|
+
/** Saved size in bytes. */
|
|
92
|
+
size: number;
|
|
93
|
+
};
|
|
94
|
+
/** One `useFetchDownload` call for one key. */
|
|
95
|
+
export type FetchDownloadOperation = {
|
|
96
|
+
/** Unique within the hook instance. Ascends with creation order. */
|
|
97
|
+
id: string;
|
|
98
|
+
key: string;
|
|
99
|
+
/**
|
|
100
|
+
* The requested file name until the response arrives, then the name the
|
|
101
|
+
* file is saved as.
|
|
102
|
+
*/
|
|
103
|
+
fileName: string | null;
|
|
104
|
+
/** Size in bytes, once known. */
|
|
105
|
+
fileSize: number | null;
|
|
106
|
+
phase: "presigning" | "downloading" | "success" | "error" | "aborted";
|
|
107
|
+
error: APIError | null;
|
|
108
|
+
progress: TransferProgress;
|
|
109
|
+
};
|
|
110
|
+
/** How one `useFetchDownload` call ended. */
|
|
111
|
+
export type FetchDownloadOutcome = OperationOutcome<FetchDownloadResult>;
|
|
112
|
+
/** Options for `useFetchDownload`. */
|
|
113
|
+
export type UseFetchDownloadOptions = DownloadBase & {
|
|
114
|
+
/**
|
|
115
|
+
* Runs once when the byte transfer begins. A throw fails the call with
|
|
116
|
+
* `HOOK_FAILED`.
|
|
117
|
+
*/
|
|
19
118
|
onDownloadStart?: (key: string) => void;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
119
|
+
/** Runs after each chunk of bytes arrives. */
|
|
120
|
+
onProgress?: (progress: TransferProgress, key: string) => void;
|
|
121
|
+
/** Runs once the file is saved. */
|
|
122
|
+
onSuccess?: (data: FetchDownloadResult, key: string) => void | Promise<void>;
|
|
123
|
+
/** Runs once per `download` call, however it ended. */
|
|
124
|
+
onSettled?: (outcome: FetchDownloadOutcome) => void | Promise<void>;
|
|
125
|
+
};
|
|
126
|
+
/** Return of `useFetchDownload`. */
|
|
127
|
+
export type UseFetchDownloadReturn = {
|
|
128
|
+
/** Tells this hook apart from `useDownload`. */
|
|
129
|
+
mode: "fetch";
|
|
130
|
+
/** Stable per hook instance. Toast owners use it. */
|
|
131
|
+
instanceId: string;
|
|
132
|
+
/** Every `download` call, ordered by `id`. */
|
|
133
|
+
operations: readonly FetchDownloadOperation[];
|
|
134
|
+
/** The newest operation for `key`. */
|
|
135
|
+
get: (key: string) => FetchDownloadOperation | undefined;
|
|
136
|
+
/** Keys with a running call. */
|
|
137
|
+
pendingKeys: readonly string[];
|
|
138
|
+
isPending: boolean;
|
|
139
|
+
/**
|
|
140
|
+
* Presigns `key`, fetches its bytes with progress and saves them. A call
|
|
141
|
+
* for a key that is already running joins it. `fileSize` sets the
|
|
142
|
+
* progress total until the response gives one.
|
|
143
|
+
*/
|
|
144
|
+
download: (key: string, options?: DownloadOptions & {
|
|
145
|
+
fileSize?: number | null;
|
|
146
|
+
}) => Promise<FetchDownloadOutcome>;
|
|
147
|
+
/** Aborts the running call for `key`, or every running call. */
|
|
148
|
+
cancel: (key?: string) => void;
|
|
149
|
+
/** Removes settled operations for `key`, or every settled operation. */
|
|
150
|
+
reset: (key?: string) => void;
|
|
25
151
|
};
|
|
152
|
+
/** Either download hook's return. Narrow it on `mode`. */
|
|
153
|
+
export type AnyDownloadReturn = UseDownloadReturn | UseFetchDownloadReturn;
|
|
154
|
+
export {};
|
|
26
155
|
//# sourceMappingURL=download.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/types/download.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/types/download.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,EACL,WAAW,EACZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEhF,4CAA4C;AAC5C,MAAM,MAAM,eAAe,GAAG;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,uCAAuC;AACvC,MAAM,MAAM,cAAc,GAAG;IAC3B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kFAAkF;IAClF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,qDAAqD;AACrD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gDAAgD;IAChD,MAAM,EAAE,uBAAuB,EAAE,CAAC;IAClC,MAAM,EAAE,QAAQ,EAAE,CAAC;IACnB,gDAAgD;IAChD,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,0CAA0C;AAC1C,MAAM,MAAM,iBAAiB,GAAG;IAC9B,oEAAoE;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,mEAAmE;IACnE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AM,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/B,wEAAwE;IACxE,KAAK,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAEF,0DAA0D;AAC1D,MAAM,MAAM,iBAAiB,GAAG,iBAAiB,GAAG,sBAAsB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,aAAa,CAAC;AACjC,mBAAmB,UAAU,CAAC;AAC9B,mBAAmB,gBAAgB,CAAC;AACpC,mBAAmB,YAAY,CAAC;AAChC,mBAAmB,UAAU,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { APIError } from "@dimah-s3/core";
|
|
2
|
+
/**
|
|
3
|
+
* How one call for one key ended. Actions return it instead of throwing.
|
|
4
|
+
* `blocked` means a `before*` callback returned `false`; `aborted` means the
|
|
5
|
+
* call was cancelled.
|
|
6
|
+
*/
|
|
7
|
+
export type OperationOutcome<TData> = {
|
|
8
|
+
status: "success";
|
|
9
|
+
key: string;
|
|
10
|
+
data: TData;
|
|
11
|
+
} | {
|
|
12
|
+
status: "error";
|
|
13
|
+
key: string;
|
|
14
|
+
error: APIError;
|
|
15
|
+
} | {
|
|
16
|
+
status: "blocked";
|
|
17
|
+
key: string;
|
|
18
|
+
} | {
|
|
19
|
+
status: "aborted";
|
|
20
|
+
key: string;
|
|
21
|
+
};
|
|
22
|
+
/** A key that failed, with its error. */
|
|
23
|
+
export type KeyError = {
|
|
24
|
+
key: string;
|
|
25
|
+
error: APIError;
|
|
26
|
+
};
|
|
27
|
+
/** Byte transfer progress for uploads and fetch downloads. */
|
|
28
|
+
export type TransferProgress = {
|
|
29
|
+
/** Bytes transferred so far. */
|
|
30
|
+
loaded: number;
|
|
31
|
+
/** Total bytes to transfer. */
|
|
32
|
+
total: number;
|
|
33
|
+
/** Progress percentage (0–100). */
|
|
34
|
+
percent: number;
|
|
35
|
+
/** Transfer speed in bytes per second. `undefined` until measurable. */
|
|
36
|
+
speed?: number;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/types/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,MAAM,gBAAgB,CAAC,KAAK,IAC9B;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAE,GAC/C;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,GACjD;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAC;AAEvC,yCAAyC;AACzC,MAAM,MAAM,QAAQ,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,QAAQ,CAAA;CAAE,CAAC;AAExD,8DAA8D;AAC9D,MAAM,MAAM,gBAAgB,GAAG;IAC7B,gCAAgC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,+BAA+B;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,wEAAwE;IACxE,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
|