@nhost/nhost-js 3.3.0 → 4.0.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.
Files changed (147) hide show
  1. package/README.md +68 -32
  2. package/dist/fetch-2PHmQBIJ.mjs +61 -0
  3. package/dist/fetch-2PHmQBIJ.mjs.map +1 -0
  4. package/dist/fetch-DWXwEnoe.js +2 -0
  5. package/dist/fetch-DWXwEnoe.js.map +1 -0
  6. package/dist/nhost-js/auth.cjs.js +2 -0
  7. package/dist/nhost-js/auth.cjs.js.map +1 -0
  8. package/dist/nhost-js/auth.es.js +917 -0
  9. package/dist/nhost-js/auth.es.js.map +1 -0
  10. package/dist/nhost-js/fetch.cjs.js +2 -0
  11. package/dist/nhost-js/fetch.cjs.js.map +1 -0
  12. package/dist/nhost-js/fetch.es.js +90 -0
  13. package/dist/nhost-js/fetch.es.js.map +1 -0
  14. package/dist/nhost-js/functions.cjs.js +2 -0
  15. package/dist/nhost-js/functions.cjs.js.map +1 -0
  16. package/dist/nhost-js/functions.es.js +45 -0
  17. package/dist/nhost-js/functions.es.js.map +1 -0
  18. package/dist/nhost-js/graphql.cjs.js +2 -0
  19. package/dist/nhost-js/graphql.cjs.js.map +1 -0
  20. package/dist/nhost-js/graphql.es.js +48 -0
  21. package/dist/nhost-js/graphql.es.js.map +1 -0
  22. package/dist/nhost-js/session.cjs.js +2 -0
  23. package/dist/nhost-js/session.cjs.js.map +1 -0
  24. package/dist/nhost-js/session.es.js +234 -0
  25. package/dist/nhost-js/session.es.js.map +1 -0
  26. package/dist/nhost-js/storage.cjs.js +2 -0
  27. package/dist/nhost-js/storage.cjs.js.map +1 -0
  28. package/dist/nhost-js/storage.es.js +324 -0
  29. package/dist/nhost-js/storage.es.js.map +1 -0
  30. package/dist/nhost-js.cjs.js +2 -0
  31. package/dist/nhost-js.cjs.js.map +1 -0
  32. package/dist/nhost-js.es.js +228 -0
  33. package/dist/nhost-js.es.js.map +1 -0
  34. package/dist/nhost-js.umd.js +2 -0
  35. package/dist/nhost-js.umd.js.map +1 -0
  36. package/dist/refreshSession-Bw715ZmX.js +2 -0
  37. package/dist/refreshSession-Bw715ZmX.js.map +1 -0
  38. package/dist/refreshSession-WwGlzgtM.mjs +95 -0
  39. package/dist/refreshSession-WwGlzgtM.mjs.map +1 -0
  40. package/dist/src/auth/client.d.ts +1763 -0
  41. package/dist/src/auth/client.d.ts.map +1 -0
  42. package/dist/src/auth/client.js +1043 -0
  43. package/dist/src/auth/client.js.map +1 -0
  44. package/dist/src/auth/index.d.ts +35 -0
  45. package/dist/src/auth/index.d.ts.map +1 -0
  46. package/dist/src/auth/index.js +35 -0
  47. package/dist/src/auth/index.js.map +1 -0
  48. package/dist/src/fetch/fetch.d.ts +88 -0
  49. package/dist/src/fetch/fetch.d.ts.map +1 -0
  50. package/dist/src/fetch/fetch.js +98 -0
  51. package/dist/src/fetch/fetch.js.map +1 -0
  52. package/dist/src/fetch/index.d.ts +38 -0
  53. package/dist/src/fetch/index.d.ts.map +1 -0
  54. package/dist/src/fetch/index.js +38 -0
  55. package/dist/src/fetch/index.js.map +1 -0
  56. package/dist/src/fetch/middlewareAttachAccessToken.d.ts +24 -0
  57. package/dist/src/fetch/middlewareAttachAccessToken.d.ts.map +1 -0
  58. package/dist/src/fetch/middlewareAttachAccessToken.js +54 -0
  59. package/dist/src/fetch/middlewareAttachAccessToken.js.map +1 -0
  60. package/dist/src/fetch/middlewareSessionRefresh.d.ts +30 -0
  61. package/dist/src/fetch/middlewareSessionRefresh.d.ts.map +1 -0
  62. package/dist/src/fetch/middlewareSessionRefresh.js +61 -0
  63. package/dist/src/fetch/middlewareSessionRefresh.js.map +1 -0
  64. package/dist/src/fetch/middlewareUpdateSessionFromResponse.d.ts +26 -0
  65. package/dist/src/fetch/middlewareUpdateSessionFromResponse.d.ts.map +1 -0
  66. package/dist/src/fetch/middlewareUpdateSessionFromResponse.js +79 -0
  67. package/dist/src/fetch/middlewareUpdateSessionFromResponse.js.map +1 -0
  68. package/dist/src/functions/client.d.ts +52 -0
  69. package/dist/src/functions/client.d.ts.map +1 -0
  70. package/dist/src/functions/client.js +89 -0
  71. package/dist/src/functions/client.js.map +1 -0
  72. package/dist/src/functions/index.d.ts +43 -0
  73. package/dist/src/functions/index.d.ts.map +1 -0
  74. package/dist/src/functions/index.js +43 -0
  75. package/dist/src/functions/index.js.map +1 -0
  76. package/dist/src/graphql/client.d.ts +93 -0
  77. package/dist/src/graphql/client.d.ts.map +1 -0
  78. package/dist/src/graphql/client.js +66 -0
  79. package/dist/src/graphql/client.js.map +1 -0
  80. package/dist/src/graphql/index.d.ts +65 -0
  81. package/dist/src/graphql/index.d.ts.map +1 -0
  82. package/dist/src/graphql/index.js +65 -0
  83. package/dist/src/graphql/index.js.map +1 -0
  84. package/dist/src/index.d.ts +35 -0
  85. package/dist/src/index.d.ts.map +1 -0
  86. package/dist/src/index.js +45 -0
  87. package/dist/src/index.js.map +1 -0
  88. package/dist/src/nhost.d.ts +301 -0
  89. package/dist/src/nhost.d.ts.map +1 -0
  90. package/dist/src/nhost.js +323 -0
  91. package/dist/src/nhost.js.map +1 -0
  92. package/dist/src/session/index.d.ts +20 -0
  93. package/dist/src/session/index.d.ts.map +1 -0
  94. package/dist/src/session/index.js +19 -0
  95. package/dist/src/session/index.js.map +1 -0
  96. package/dist/src/session/refreshSession.d.ts +17 -0
  97. package/dist/src/session/refreshSession.d.ts.map +1 -0
  98. package/dist/src/session/refreshSession.js +120 -0
  99. package/dist/src/session/refreshSession.js.map +1 -0
  100. package/dist/src/session/session.d.ts +24 -0
  101. package/dist/src/session/session.d.ts.map +1 -0
  102. package/dist/src/session/session.js +48 -0
  103. package/dist/src/session/session.js.map +1 -0
  104. package/dist/src/session/storage.d.ts +62 -0
  105. package/dist/src/session/storage.d.ts.map +1 -0
  106. package/dist/src/session/storage.js +91 -0
  107. package/dist/src/session/storage.js.map +1 -0
  108. package/dist/src/session/storageBackend.d.ts +122 -0
  109. package/dist/src/session/storageBackend.d.ts.map +1 -0
  110. package/dist/src/session/storageBackend.js +145 -0
  111. package/dist/src/session/storageBackend.js.map +1 -0
  112. package/dist/src/storage/client.d.ts +546 -0
  113. package/dist/src/storage/client.d.ts.map +1 -0
  114. package/dist/src/storage/client.js +368 -0
  115. package/dist/src/storage/client.js.map +1 -0
  116. package/dist/src/storage/index.d.ts +37 -0
  117. package/dist/src/storage/index.d.ts.map +1 -0
  118. package/dist/src/storage/index.js +37 -0
  119. package/dist/src/storage/index.js.map +1 -0
  120. package/dist/tsconfig.tsbuildinfo +1 -0
  121. package/package.json +103 -59
  122. package/dist/clients/auth.d.ts +0 -8
  123. package/dist/clients/auth.d.ts.map +0 -1
  124. package/dist/clients/functions/index.d.ts +0 -107
  125. package/dist/clients/functions/index.d.ts.map +0 -1
  126. package/dist/clients/functions/types.d.ts +0 -28
  127. package/dist/clients/functions/types.d.ts.map +0 -1
  128. package/dist/clients/graphql.d.ts +0 -8
  129. package/dist/clients/graphql.d.ts.map +0 -1
  130. package/dist/clients/index.d.ts +0 -6
  131. package/dist/clients/index.d.ts.map +0 -1
  132. package/dist/clients/nhost.d.ts +0 -83
  133. package/dist/clients/nhost.d.ts.map +0 -1
  134. package/dist/clients/storage.d.ts +0 -8
  135. package/dist/clients/storage.d.ts.map +0 -1
  136. package/dist/index.cjs.js +0 -2
  137. package/dist/index.cjs.js.map +0 -1
  138. package/dist/index.d.ts +0 -6
  139. package/dist/index.d.ts.map +0 -1
  140. package/dist/index.esm.js +0 -356
  141. package/dist/index.esm.js.map +0 -1
  142. package/dist/utils/helpers.d.ts +0 -20
  143. package/dist/utils/helpers.d.ts.map +0 -1
  144. package/dist/utils/types.d.ts +0 -57
  145. package/dist/utils/types.d.ts.map +0 -1
  146. package/umd/nhost-js.umd.js +0 -22
  147. package/umd/nhost-js.umd.js.map +0 -1
@@ -0,0 +1,546 @@
1
+ /**
2
+ * This file is auto-generated. Do not edit manually.
3
+ */
4
+ import type { ChainFunction, FetchResponse } from "../fetch";
5
+ /**
6
+ * Date in RFC 2822 format
7
+ */
8
+ export type RFC2822Date = string;
9
+ /**
10
+ * Error details.
11
+ @property message (`string`) - Human-readable error message.
12
+ * Example - `"File not found"`
13
+ @property data? (`Record<string, unknown>`) - Additional data related to the error, if any.*/
14
+ export interface ErrorResponseError {
15
+ /**
16
+ * Human-readable error message.
17
+ * Example - `"File not found"`
18
+ */
19
+ message: string;
20
+ /**
21
+ * Additional data related to the error, if any.
22
+ */
23
+ data?: Record<string, unknown>;
24
+ }
25
+ /**
26
+ * Error information returned by the API.
27
+ @property error? (`ErrorResponseError`) - Error details.*/
28
+ export interface ErrorResponse {
29
+ /**
30
+ * Error details.
31
+ */
32
+ error?: ErrorResponseError;
33
+ }
34
+ /**
35
+ * Error details.
36
+ @property message (`string`) - Human-readable error message.
37
+ * Example - `"File not found"`
38
+ @property data? (`Record<string, unknown>`) - Additional data related to the error, if any.*/
39
+ export interface ErrorResponseWithProcessedFilesError {
40
+ /**
41
+ * Human-readable error message.
42
+ * Example - `"File not found"`
43
+ */
44
+ message: string;
45
+ /**
46
+ * Additional data related to the error, if any.
47
+ */
48
+ data?: Record<string, unknown>;
49
+ }
50
+ /**
51
+ * Error information returned by the API.
52
+ @property processedFiles? (`FileMetadata[]`) - List of files that were successfully processed before the error occurred.
53
+ @property error? (`ErrorResponseWithProcessedFilesError`) - Error details.*/
54
+ export interface ErrorResponseWithProcessedFiles {
55
+ /**
56
+ * List of files that were successfully processed before the error occurred.
57
+ */
58
+ processedFiles?: FileMetadata[];
59
+ /**
60
+ * Error details.
61
+ */
62
+ error?: ErrorResponseWithProcessedFilesError;
63
+ }
64
+ /**
65
+ * Comprehensive metadata information about a file in storage.
66
+ @property id (`string`) - Unique identifier for the file.
67
+ * Example - `"d5e76ceb-77a2-4153-b7da-1f7c115b2ff2"`
68
+ @property name (`string`) - Name of the file including extension.
69
+ * Example - `"profile-picture.jpg"`
70
+ @property size (`number`) - Size of the file in bytes.
71
+ * Example - `245678`
72
+ * Format - int64
73
+ @property bucketId (`string`) - ID of the bucket containing the file.
74
+ * Example - `"users-bucket"`
75
+ @property etag (`string`) - Entity tag for cache validation.
76
+ * Example - `"\"a1b2c3d4e5f6\""`
77
+ @property createdAt (`string`) - Timestamp when the file was created.
78
+ * Example - `"2023-01-15T12:34:56Z"`
79
+ * Format - date-time
80
+ @property updatedAt (`string`) - Timestamp when the file was last updated.
81
+ * Example - `"2023-01-16T09:45:32Z"`
82
+ * Format - date-time
83
+ @property isUploaded (`boolean`) - Whether the file has been successfully uploaded.
84
+ * Example - `true`
85
+ @property mimeType (`string`) - MIME type of the file.
86
+ * Example - `"image/jpeg"`
87
+ @property uploadedByUserId? (`string`) - ID of the user who uploaded the file.
88
+ * Example - `"abc123def456"`
89
+ @property metadata? (`Record<string, unknown>`) - Custom metadata associated with the file.
90
+ * Example - `{"alt":"Profile picture","category":"avatar"}`*/
91
+ export interface FileMetadata {
92
+ /**
93
+ * Unique identifier for the file.
94
+ * Example - `"d5e76ceb-77a2-4153-b7da-1f7c115b2ff2"`
95
+ */
96
+ id: string;
97
+ /**
98
+ * Name of the file including extension.
99
+ * Example - `"profile-picture.jpg"`
100
+ */
101
+ name: string;
102
+ /**
103
+ * Size of the file in bytes.
104
+ * Example - `245678`
105
+ * Format - int64
106
+ */
107
+ size: number;
108
+ /**
109
+ * ID of the bucket containing the file.
110
+ * Example - `"users-bucket"`
111
+ */
112
+ bucketId: string;
113
+ /**
114
+ * Entity tag for cache validation.
115
+ * Example - `"\"a1b2c3d4e5f6\""`
116
+ */
117
+ etag: string;
118
+ /**
119
+ * Timestamp when the file was created.
120
+ * Example - `"2023-01-15T12:34:56Z"`
121
+ * Format - date-time
122
+ */
123
+ createdAt: string;
124
+ /**
125
+ * Timestamp when the file was last updated.
126
+ * Example - `"2023-01-16T09:45:32Z"`
127
+ * Format - date-time
128
+ */
129
+ updatedAt: string;
130
+ /**
131
+ * Whether the file has been successfully uploaded.
132
+ * Example - `true`
133
+ */
134
+ isUploaded: boolean;
135
+ /**
136
+ * MIME type of the file.
137
+ * Example - `"image/jpeg"`
138
+ */
139
+ mimeType: string;
140
+ /**
141
+ * ID of the user who uploaded the file.
142
+ * Example - `"abc123def456"`
143
+ */
144
+ uploadedByUserId?: string;
145
+ /**
146
+ * Custom metadata associated with the file.
147
+ * Example - `{"alt":"Profile picture","category":"avatar"}`
148
+ */
149
+ metadata?: Record<string, unknown>;
150
+ }
151
+ /**
152
+ * Basic information about a file in storage.
153
+ @property id (`string`) - Unique identifier for the file.
154
+ * Example - `"d5e76ceb-77a2-4153-b7da-1f7c115b2ff2"`
155
+ @property name (`string`) - Name of the file including extension.
156
+ * Example - `"profile-picture.jpg"`
157
+ @property bucketId (`string`) - ID of the bucket containing the file.
158
+ * Example - `"users-bucket"`
159
+ @property isUploaded (`boolean`) - Whether the file has been successfully uploaded.
160
+ * Example - `true`*/
161
+ export interface FileSummary {
162
+ /**
163
+ * Unique identifier for the file.
164
+ * Example - `"d5e76ceb-77a2-4153-b7da-1f7c115b2ff2"`
165
+ */
166
+ id: string;
167
+ /**
168
+ * Name of the file including extension.
169
+ * Example - `"profile-picture.jpg"`
170
+ */
171
+ name: string;
172
+ /**
173
+ * ID of the bucket containing the file.
174
+ * Example - `"users-bucket"`
175
+ */
176
+ bucketId: string;
177
+ /**
178
+ * Whether the file has been successfully uploaded.
179
+ * Example - `true`
180
+ */
181
+ isUploaded: boolean;
182
+ }
183
+ /**
184
+ * Contains a presigned URL for direct file operations.
185
+ @property url (`string`) - The presigned URL for file operations.
186
+ * Example - `"https://storage.example.com/files/abc123?signature=xyz"`
187
+ @property expiration (`number`) - The time in seconds until the URL expires.
188
+ * Example - `3600`*/
189
+ export interface PresignedURLResponse {
190
+ /**
191
+ * The presigned URL for file operations.
192
+ * Example - `"https://storage.example.com/files/abc123?signature=xyz"`
193
+ */
194
+ url: string;
195
+ /**
196
+ * The time in seconds until the URL expires.
197
+ * Example - `3600`
198
+ */
199
+ expiration: number;
200
+ }
201
+ /**
202
+ * Metadata that can be updated for an existing file.
203
+ @property name? (`string`) - New name to assign to the file.
204
+ * Example - `"renamed-file.jpg"`
205
+ @property metadata? (`Record<string, unknown>`) - Updated custom metadata to associate with the file.
206
+ * Example - `{"alt":"Updated image description","category":"profile"}`*/
207
+ export interface UpdateFileMetadata {
208
+ /**
209
+ * New name to assign to the file.
210
+ * Example - `"renamed-file.jpg"`
211
+ */
212
+ name?: string;
213
+ /**
214
+ * Updated custom metadata to associate with the file.
215
+ * Example - `{"alt":"Updated image description","category":"profile"}`
216
+ */
217
+ metadata?: Record<string, unknown>;
218
+ }
219
+ /**
220
+ * Metadata provided when uploading a new file.
221
+ @property id? (`string`) - Optional custom ID for the file. If not provided, a UUID will be generated.
222
+ * Example - `"custom-id-123"`
223
+ @property name? (`string`) - Name to assign to the file. If not provided, the original filename will be used.
224
+ * Example - `"custom-filename.png"`
225
+ @property metadata? (`Record<string, unknown>`) - Custom metadata to associate with the file.
226
+ * Example - `{"alt":"Custom image","category":"document"}`*/
227
+ export interface UploadFileMetadata {
228
+ /**
229
+ * Optional custom ID for the file. If not provided, a UUID will be generated.
230
+ * Example - `"custom-id-123"`
231
+ */
232
+ id?: string;
233
+ /**
234
+ * Name to assign to the file. If not provided, the original filename will be used.
235
+ * Example - `"custom-filename.png"`
236
+ */
237
+ name?: string;
238
+ /**
239
+ * Custom metadata to associate with the file.
240
+ * Example - `{"alt":"Custom image","category":"document"}`
241
+ */
242
+ metadata?: Record<string, unknown>;
243
+ }
244
+ /**
245
+ * Contains version information about the storage service.
246
+ @property buildVersion (`string`) - The version number of the storage service build.
247
+ * Example - `"1.2.3"`*/
248
+ export interface VersionInformation {
249
+ /**
250
+ * The version number of the storage service build.
251
+ * Example - `"1.2.3"`
252
+ */
253
+ buildVersion: string;
254
+ }
255
+ /**
256
+ * Output format for image files. Use 'auto' for content negotiation based on Accept header
257
+ */
258
+ export type OutputImageFormat = "auto" | "same" | "jpeg" | "webp" | "png" | "avif";
259
+ /**
260
+ *
261
+ @property bucket-id? (`string`) - Target bucket identifier where files will be stored.
262
+ * Example - `"user-uploads"`
263
+ @property metadata[]? (`UploadFileMetadata[]`) - Optional custom metadata for each uploaded file. Must match the order of the file[] array.
264
+ @property file[] (`Blob[]`) - Array of files to upload.*/
265
+ export interface UploadFilesBody {
266
+ /**
267
+ * Target bucket identifier where files will be stored.
268
+ * Example - `"user-uploads"`
269
+ */
270
+ "bucket-id"?: string;
271
+ /**
272
+ * Optional custom metadata for each uploaded file. Must match the order of the file[] array.
273
+ */
274
+ "metadata[]"?: UploadFileMetadata[];
275
+ /**
276
+ * Array of files to upload.
277
+ */
278
+ "file[]": Blob[];
279
+ }
280
+ /**
281
+ *
282
+ @property processedFiles (`FileMetadata[]`) - List of successfully processed files with their metadata.*/
283
+ export interface UploadFilesResponse201 {
284
+ /**
285
+ * List of successfully processed files with their metadata.
286
+ */
287
+ processedFiles: FileMetadata[];
288
+ }
289
+ /**
290
+ *
291
+ @property metadata? (`UpdateFileMetadata`) - Metadata that can be updated for an existing file.
292
+ @property file? (`Blob`) - New file content to replace the existing file
293
+ * Format - binary*/
294
+ export interface ReplaceFileBody {
295
+ /**
296
+ * Metadata that can be updated for an existing file.
297
+ */
298
+ metadata?: UpdateFileMetadata;
299
+ /**
300
+ * New file content to replace the existing file
301
+ * Format - binary
302
+ */
303
+ file?: Blob;
304
+ }
305
+ /**
306
+ *
307
+ @property metadata? (`FileSummary[]`) - */
308
+ export interface DeleteBrokenMetadataResponse200 {
309
+ /**
310
+ *
311
+ */
312
+ metadata?: FileSummary[];
313
+ }
314
+ /**
315
+ *
316
+ @property files? (`string[]`) - */
317
+ export interface DeleteOrphanedFilesResponse200 {
318
+ /**
319
+ *
320
+ */
321
+ files?: string[];
322
+ }
323
+ /**
324
+ *
325
+ @property metadata? (`FileSummary[]`) - */
326
+ export interface ListBrokenMetadataResponse200 {
327
+ /**
328
+ *
329
+ */
330
+ metadata?: FileSummary[];
331
+ }
332
+ /**
333
+ *
334
+ @property metadata? (`FileSummary[]`) - */
335
+ export interface ListFilesNotUploadedResponse200 {
336
+ /**
337
+ *
338
+ */
339
+ metadata?: FileSummary[];
340
+ }
341
+ /**
342
+ *
343
+ @property files? (`string[]`) - */
344
+ export interface ListOrphanedFilesResponse200 {
345
+ /**
346
+ *
347
+ */
348
+ files?: string[];
349
+ }
350
+ /**
351
+ * Parameters for the getFile method.
352
+ @property q? (number) - Image quality (1-100). Only applies to JPEG, WebP and PNG files
353
+
354
+ @property h? (number) - Maximum height to resize image to while maintaining aspect ratio. Only applies to image files
355
+
356
+ @property w? (number) - Maximum width to resize image to while maintaining aspect ratio. Only applies to image files
357
+
358
+ @property b? (number) - Blur the image using this sigma value. Only applies to image files
359
+
360
+ @property f? (OutputImageFormat) - Output format for image files. Use 'auto' for content negotiation based on Accept header
361
+
362
+ * Output format for image files. Use 'auto' for content negotiation based on Accept header*/
363
+ export interface GetFileParams {
364
+ /**
365
+ * Image quality (1-100). Only applies to JPEG, WebP and PNG files
366
+
367
+ */
368
+ q?: number;
369
+ /**
370
+ * Maximum height to resize image to while maintaining aspect ratio. Only applies to image files
371
+
372
+ */
373
+ h?: number;
374
+ /**
375
+ * Maximum width to resize image to while maintaining aspect ratio. Only applies to image files
376
+
377
+ */
378
+ w?: number;
379
+ /**
380
+ * Blur the image using this sigma value. Only applies to image files
381
+
382
+ */
383
+ b?: number;
384
+ /**
385
+ * Output format for image files. Use 'auto' for content negotiation based on Accept header
386
+
387
+ * Output format for image files. Use 'auto' for content negotiation based on Accept header
388
+ */
389
+ f?: OutputImageFormat;
390
+ }
391
+ /**
392
+ * Parameters for the getFileMetadataHeaders method.
393
+ @property q? (number) - Image quality (1-100). Only applies to JPEG, WebP and PNG files
394
+
395
+ @property h? (number) - Maximum height to resize image to while maintaining aspect ratio. Only applies to image files
396
+
397
+ @property w? (number) - Maximum width to resize image to while maintaining aspect ratio. Only applies to image files
398
+
399
+ @property b? (number) - Blur the image using this sigma value. Only applies to image files
400
+
401
+ @property f? (OutputImageFormat) - Output format for image files. Use 'auto' for content negotiation based on Accept header
402
+
403
+ * Output format for image files. Use 'auto' for content negotiation based on Accept header*/
404
+ export interface GetFileMetadataHeadersParams {
405
+ /**
406
+ * Image quality (1-100). Only applies to JPEG, WebP and PNG files
407
+
408
+ */
409
+ q?: number;
410
+ /**
411
+ * Maximum height to resize image to while maintaining aspect ratio. Only applies to image files
412
+
413
+ */
414
+ h?: number;
415
+ /**
416
+ * Maximum width to resize image to while maintaining aspect ratio. Only applies to image files
417
+
418
+ */
419
+ w?: number;
420
+ /**
421
+ * Blur the image using this sigma value. Only applies to image files
422
+
423
+ */
424
+ b?: number;
425
+ /**
426
+ * Output format for image files. Use 'auto' for content negotiation based on Accept header
427
+
428
+ * Output format for image files. Use 'auto' for content negotiation based on Accept header
429
+ */
430
+ f?: OutputImageFormat;
431
+ }
432
+ export interface Client {
433
+ baseURL: string;
434
+ pushChainFunction(chainFunction: ChainFunction): void;
435
+ /**
436
+ Summary: Upload files
437
+ Upload one or more files to a specified bucket. Supports batch uploading with optional custom metadata for each file. If uploading multiple files, either provide metadata for all files or none.
438
+
439
+ This method may return different T based on the response code:
440
+ - 201: UploadFilesResponse201
441
+ */
442
+ uploadFiles(body: UploadFilesBody, options?: RequestInit): Promise<FetchResponse<UploadFilesResponse201>>;
443
+ /**
444
+ Summary: Delete file
445
+ Permanently delete a file from storage. This removes both the file content and its associated metadata.
446
+
447
+ This method may return different T based on the response code:
448
+ - 204: void
449
+ */
450
+ deleteFile(id: string, options?: RequestInit): Promise<FetchResponse<void>>;
451
+ /**
452
+ Summary: Download file
453
+ Retrieve and download the complete file content. Supports conditional requests, image transformations, and range requests for partial downloads.
454
+
455
+ This method may return different T based on the response code:
456
+ - 200: void
457
+ - 206: void
458
+ - 304: void
459
+ - 412: void
460
+ */
461
+ getFile(id: string, params?: GetFileParams, options?: RequestInit): Promise<FetchResponse<Blob>>;
462
+ /**
463
+ Summary: Check file information
464
+ Retrieve file metadata headers without downloading the file content. Supports conditional requests and provides caching information.
465
+
466
+ This method may return different T based on the response code:
467
+ - 200: void
468
+ - 304: void
469
+ - 412: void
470
+ */
471
+ getFileMetadataHeaders(id: string, params?: GetFileMetadataHeadersParams, options?: RequestInit): Promise<FetchResponse<void>>;
472
+ /**
473
+ Summary: Replace file
474
+ Replace an existing file with new content while preserving the file ID. The operation follows these steps:
475
+ 1. The isUploaded flag is set to false to mark the file as being updated
476
+ 2. The file content is replaced in the storage backend
477
+ 3. File metadata is updated (size, mime-type, isUploaded, etc.)
478
+
479
+ Each step is atomic, but if a step fails, previous steps will not be automatically rolled back.
480
+
481
+
482
+ This method may return different T based on the response code:
483
+ - 200: FileMetadata
484
+ */
485
+ replaceFile(id: string, body: ReplaceFileBody, options?: RequestInit): Promise<FetchResponse<FileMetadata>>;
486
+ /**
487
+ Summary: Retrieve presigned URL to retrieve the file
488
+ Retrieve presigned URL to retrieve the file. Expiration of the URL is
489
+ determined by bucket configuration
490
+
491
+
492
+ This method may return different T based on the response code:
493
+ - 200: PresignedURLResponse
494
+ */
495
+ getFilePresignedURL(id: string, options?: RequestInit): Promise<FetchResponse<PresignedURLResponse>>;
496
+ /**
497
+ Summary: Delete broken metadata
498
+ Broken metadata is defined as metadata that has isUploaded = true but there is no file in the storage matching it. This is an admin operation that requires the Hasura admin secret.
499
+
500
+ This method may return different T based on the response code:
501
+ - 200: DeleteBrokenMetadataResponse200
502
+ */
503
+ deleteBrokenMetadata(options?: RequestInit): Promise<FetchResponse<DeleteBrokenMetadataResponse200>>;
504
+ /**
505
+ Summary: Deletes orphaned files
506
+ Orphaned files are files that are present in the storage but have no associated metadata. This is an admin operation that requires the Hasura admin secret.
507
+
508
+ This method may return different T based on the response code:
509
+ - 200: DeleteOrphanedFilesResponse200
510
+ */
511
+ deleteOrphanedFiles(options?: RequestInit): Promise<FetchResponse<DeleteOrphanedFilesResponse200>>;
512
+ /**
513
+ Summary: Lists broken metadata
514
+ Broken metadata is defined as metadata that has isUploaded = true but there is no file in the storage matching it. This is an admin operation that requires the Hasura admin secret.
515
+
516
+ This method may return different T based on the response code:
517
+ - 200: ListBrokenMetadataResponse200
518
+ */
519
+ listBrokenMetadata(options?: RequestInit): Promise<FetchResponse<ListBrokenMetadataResponse200>>;
520
+ /**
521
+ Summary: Lists files that haven't been uploaded
522
+ That is, metadata that has isUploaded = false. This is an admin operation that requires the Hasura admin secret.
523
+
524
+ This method may return different T based on the response code:
525
+ - 200: ListFilesNotUploadedResponse200
526
+ */
527
+ listFilesNotUploaded(options?: RequestInit): Promise<FetchResponse<ListFilesNotUploadedResponse200>>;
528
+ /**
529
+ Summary: Lists orphaned files
530
+ Orphaned files are files that are present in the storage but have no associated metadata. This is an admin operation that requires the Hasura admin secret.
531
+
532
+ This method may return different T based on the response code:
533
+ - 200: ListOrphanedFilesResponse200
534
+ */
535
+ listOrphanedFiles(options?: RequestInit): Promise<FetchResponse<ListOrphanedFilesResponse200>>;
536
+ /**
537
+ Summary: Get service version information
538
+ Retrieves build and version information about the storage service. Useful for monitoring and debugging.
539
+
540
+ This method may return different T based on the response code:
541
+ - 200: VersionInformation
542
+ */
543
+ getVersion(options?: RequestInit): Promise<FetchResponse<VersionInformation>>;
544
+ }
545
+ export declare const createAPIClient: (baseURL: string, chainFunctions?: ChainFunction[]) => Client;
546
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/storage/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG7D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC;;;;8FAI8F;AAC9F,MAAM,WAAW,kBAAkB;IACjC;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED;;2DAE2D;AAC3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