@supabase/storage-js 2.87.4-canary.2 → 2.87.4-canary.4

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 (206) hide show
  1. package/README.md +2 -106
  2. package/dist/index.cjs +3019 -0
  3. package/dist/index.cjs.map +1 -0
  4. package/dist/index.d.cts +2601 -0
  5. package/dist/index.d.cts.map +1 -0
  6. package/dist/index.d.mts +2601 -0
  7. package/dist/index.d.mts.map +1 -0
  8. package/dist/index.mjs +2998 -0
  9. package/dist/index.mjs.map +1 -0
  10. package/dist/umd/supabase.js +1 -1
  11. package/package.json +21 -12
  12. package/src/lib/version.ts +1 -1
  13. package/dist/main/StorageClient.d.ts +0 -64
  14. package/dist/main/StorageClient.d.ts.map +0 -1
  15. package/dist/main/StorageClient.js +0 -74
  16. package/dist/main/StorageClient.js.map +0 -1
  17. package/dist/main/index.d.ts +0 -7
  18. package/dist/main/index.d.ts.map +0 -1
  19. package/dist/main/index.js +0 -12
  20. package/dist/main/index.js.map +0 -1
  21. package/dist/main/lib/constants.d.ts +0 -4
  22. package/dist/main/lib/constants.d.ts.map +0 -1
  23. package/dist/main/lib/constants.js +0 -8
  24. package/dist/main/lib/constants.js.map +0 -1
  25. package/dist/main/lib/errors.d.ts +0 -21
  26. package/dist/main/lib/errors.d.ts.map +0 -1
  27. package/dist/main/lib/errors.js +0 -41
  28. package/dist/main/lib/errors.js.map +0 -1
  29. package/dist/main/lib/fetch.d.ts +0 -16
  30. package/dist/main/lib/fetch.d.ts.map +0 -1
  31. package/dist/main/lib/fetch.js +0 -95
  32. package/dist/main/lib/fetch.js.map +0 -1
  33. package/dist/main/lib/helpers.d.ts +0 -28
  34. package/dist/main/lib/helpers.d.ts.map +0 -1
  35. package/dist/main/lib/helpers.js +0 -87
  36. package/dist/main/lib/helpers.js.map +0 -1
  37. package/dist/main/lib/index.d.ts +0 -6
  38. package/dist/main/lib/index.d.ts.map +0 -1
  39. package/dist/main/lib/index.js +0 -9
  40. package/dist/main/lib/index.js.map +0 -1
  41. package/dist/main/lib/types.d.ts +0 -226
  42. package/dist/main/lib/types.d.ts.map +0 -1
  43. package/dist/main/lib/types.js +0 -3
  44. package/dist/main/lib/types.js.map +0 -1
  45. package/dist/main/lib/vectors/StorageVectorsClient.d.ts +0 -505
  46. package/dist/main/lib/vectors/StorageVectorsClient.d.ts.map +0 -1
  47. package/dist/main/lib/vectors/StorageVectorsClient.js +0 -582
  48. package/dist/main/lib/vectors/StorageVectorsClient.js.map +0 -1
  49. package/dist/main/lib/vectors/VectorBucketApi.d.ts +0 -32
  50. package/dist/main/lib/vectors/VectorBucketApi.d.ts.map +0 -1
  51. package/dist/main/lib/vectors/VectorBucketApi.js +0 -102
  52. package/dist/main/lib/vectors/VectorBucketApi.js.map +0 -1
  53. package/dist/main/lib/vectors/VectorDataApi.d.ts +0 -32
  54. package/dist/main/lib/vectors/VectorDataApi.d.ts.map +0 -1
  55. package/dist/main/lib/vectors/VectorDataApi.js +0 -147
  56. package/dist/main/lib/vectors/VectorDataApi.js.map +0 -1
  57. package/dist/main/lib/vectors/VectorIndexApi.d.ts +0 -47
  58. package/dist/main/lib/vectors/VectorIndexApi.d.ts.map +0 -1
  59. package/dist/main/lib/vectors/VectorIndexApi.js +0 -104
  60. package/dist/main/lib/vectors/VectorIndexApi.js.map +0 -1
  61. package/dist/main/lib/vectors/constants.d.ts +0 -5
  62. package/dist/main/lib/vectors/constants.d.ts.map +0 -1
  63. package/dist/main/lib/vectors/constants.js +0 -9
  64. package/dist/main/lib/vectors/constants.js.map +0 -1
  65. package/dist/main/lib/vectors/errors.d.ts +0 -55
  66. package/dist/main/lib/vectors/errors.d.ts.map +0 -1
  67. package/dist/main/lib/vectors/errors.js +0 -76
  68. package/dist/main/lib/vectors/errors.js.map +0 -1
  69. package/dist/main/lib/vectors/fetch.d.ts +0 -57
  70. package/dist/main/lib/vectors/fetch.d.ts.map +0 -1
  71. package/dist/main/lib/vectors/fetch.js +0 -167
  72. package/dist/main/lib/vectors/fetch.js.map +0 -1
  73. package/dist/main/lib/vectors/helpers.d.ts +0 -46
  74. package/dist/main/lib/vectors/helpers.d.ts.map +0 -1
  75. package/dist/main/lib/vectors/helpers.js +0 -74
  76. package/dist/main/lib/vectors/helpers.js.map +0 -1
  77. package/dist/main/lib/vectors/index.d.ts +0 -11
  78. package/dist/main/lib/vectors/index.d.ts.map +0 -1
  79. package/dist/main/lib/vectors/index.js +0 -31
  80. package/dist/main/lib/vectors/index.js.map +0 -1
  81. package/dist/main/lib/vectors/types.d.ts +0 -279
  82. package/dist/main/lib/vectors/types.d.ts.map +0 -1
  83. package/dist/main/lib/vectors/types.js +0 -3
  84. package/dist/main/lib/vectors/types.js.map +0 -1
  85. package/dist/main/lib/version.d.ts +0 -2
  86. package/dist/main/lib/version.d.ts.map +0 -1
  87. package/dist/main/lib/version.js +0 -11
  88. package/dist/main/lib/version.js.map +0 -1
  89. package/dist/main/packages/BlobDownloadBuilder.d.ts +0 -16
  90. package/dist/main/packages/BlobDownloadBuilder.d.ts.map +0 -1
  91. package/dist/main/packages/BlobDownloadBuilder.js +0 -55
  92. package/dist/main/packages/BlobDownloadBuilder.js.map +0 -1
  93. package/dist/main/packages/StorageAnalyticsClient.d.ts +0 -324
  94. package/dist/main/packages/StorageAnalyticsClient.d.ts.map +0 -1
  95. package/dist/main/packages/StorageAnalyticsClient.js +0 -395
  96. package/dist/main/packages/StorageAnalyticsClient.js.map +0 -1
  97. package/dist/main/packages/StorageBucketApi.d.ts +0 -266
  98. package/dist/main/packages/StorageBucketApi.d.ts.map +0 -1
  99. package/dist/main/packages/StorageBucketApi.js +0 -362
  100. package/dist/main/packages/StorageBucketApi.js.map +0 -1
  101. package/dist/main/packages/StorageFileApi.d.ts +0 -680
  102. package/dist/main/packages/StorageFileApi.d.ts.map +0 -1
  103. package/dist/main/packages/StorageFileApi.js +0 -1002
  104. package/dist/main/packages/StorageFileApi.js.map +0 -1
  105. package/dist/main/packages/StreamDownloadBuilder.d.ts +0 -9
  106. package/dist/main/packages/StreamDownloadBuilder.d.ts.map +0 -1
  107. package/dist/main/packages/StreamDownloadBuilder.js +0 -35
  108. package/dist/main/packages/StreamDownloadBuilder.js.map +0 -1
  109. package/dist/module/StorageClient.d.ts +0 -64
  110. package/dist/module/StorageClient.d.ts.map +0 -1
  111. package/dist/module/StorageClient.js +0 -69
  112. package/dist/module/StorageClient.js.map +0 -1
  113. package/dist/module/index.d.ts +0 -7
  114. package/dist/module/index.d.ts.map +0 -1
  115. package/dist/module/index.js +0 -6
  116. package/dist/module/index.js.map +0 -1
  117. package/dist/module/lib/constants.d.ts +0 -4
  118. package/dist/module/lib/constants.d.ts.map +0 -1
  119. package/dist/module/lib/constants.js +0 -5
  120. package/dist/module/lib/constants.js.map +0 -1
  121. package/dist/module/lib/errors.d.ts +0 -21
  122. package/dist/module/lib/errors.d.ts.map +0 -1
  123. package/dist/module/lib/errors.js +0 -34
  124. package/dist/module/lib/errors.js.map +0 -1
  125. package/dist/module/lib/fetch.d.ts +0 -16
  126. package/dist/module/lib/fetch.d.ts.map +0 -1
  127. package/dist/module/lib/fetch.js +0 -88
  128. package/dist/module/lib/fetch.js.map +0 -1
  129. package/dist/module/lib/helpers.d.ts +0 -28
  130. package/dist/module/lib/helpers.d.ts.map +0 -1
  131. package/dist/module/lib/helpers.js +0 -79
  132. package/dist/module/lib/helpers.js.map +0 -1
  133. package/dist/module/lib/index.d.ts +0 -6
  134. package/dist/module/lib/index.d.ts.map +0 -1
  135. package/dist/module/lib/index.js +0 -6
  136. package/dist/module/lib/index.js.map +0 -1
  137. package/dist/module/lib/types.d.ts +0 -226
  138. package/dist/module/lib/types.d.ts.map +0 -1
  139. package/dist/module/lib/types.js +0 -2
  140. package/dist/module/lib/types.js.map +0 -1
  141. package/dist/module/lib/vectors/StorageVectorsClient.d.ts +0 -505
  142. package/dist/module/lib/vectors/StorageVectorsClient.d.ts.map +0 -1
  143. package/dist/module/lib/vectors/StorageVectorsClient.js +0 -576
  144. package/dist/module/lib/vectors/StorageVectorsClient.js.map +0 -1
  145. package/dist/module/lib/vectors/VectorBucketApi.d.ts +0 -32
  146. package/dist/module/lib/vectors/VectorBucketApi.d.ts.map +0 -1
  147. package/dist/module/lib/vectors/VectorBucketApi.js +0 -99
  148. package/dist/module/lib/vectors/VectorBucketApi.js.map +0 -1
  149. package/dist/module/lib/vectors/VectorDataApi.d.ts +0 -32
  150. package/dist/module/lib/vectors/VectorDataApi.d.ts.map +0 -1
  151. package/dist/module/lib/vectors/VectorDataApi.js +0 -144
  152. package/dist/module/lib/vectors/VectorDataApi.js.map +0 -1
  153. package/dist/module/lib/vectors/VectorIndexApi.d.ts +0 -47
  154. package/dist/module/lib/vectors/VectorIndexApi.d.ts.map +0 -1
  155. package/dist/module/lib/vectors/VectorIndexApi.js +0 -101
  156. package/dist/module/lib/vectors/VectorIndexApi.js.map +0 -1
  157. package/dist/module/lib/vectors/constants.d.ts +0 -5
  158. package/dist/module/lib/vectors/constants.d.ts.map +0 -1
  159. package/dist/module/lib/vectors/constants.js +0 -6
  160. package/dist/module/lib/vectors/constants.js.map +0 -1
  161. package/dist/module/lib/vectors/errors.d.ts +0 -55
  162. package/dist/module/lib/vectors/errors.d.ts.map +0 -1
  163. package/dist/module/lib/vectors/errors.js +0 -69
  164. package/dist/module/lib/vectors/errors.js.map +0 -1
  165. package/dist/module/lib/vectors/fetch.d.ts +0 -57
  166. package/dist/module/lib/vectors/fetch.d.ts.map +0 -1
  167. package/dist/module/lib/vectors/fetch.js +0 -161
  168. package/dist/module/lib/vectors/fetch.js.map +0 -1
  169. package/dist/module/lib/vectors/helpers.d.ts +0 -46
  170. package/dist/module/lib/vectors/helpers.d.ts.map +0 -1
  171. package/dist/module/lib/vectors/helpers.js +0 -66
  172. package/dist/module/lib/vectors/helpers.js.map +0 -1
  173. package/dist/module/lib/vectors/index.d.ts +0 -11
  174. package/dist/module/lib/vectors/index.d.ts.map +0 -1
  175. package/dist/module/lib/vectors/index.js +0 -11
  176. package/dist/module/lib/vectors/index.js.map +0 -1
  177. package/dist/module/lib/vectors/types.d.ts +0 -279
  178. package/dist/module/lib/vectors/types.d.ts.map +0 -1
  179. package/dist/module/lib/vectors/types.js +0 -2
  180. package/dist/module/lib/vectors/types.js.map +0 -1
  181. package/dist/module/lib/version.d.ts +0 -2
  182. package/dist/module/lib/version.d.ts.map +0 -1
  183. package/dist/module/lib/version.js +0 -8
  184. package/dist/module/lib/version.js.map +0 -1
  185. package/dist/module/packages/BlobDownloadBuilder.d.ts +0 -16
  186. package/dist/module/packages/BlobDownloadBuilder.d.ts.map +0 -1
  187. package/dist/module/packages/BlobDownloadBuilder.js +0 -53
  188. package/dist/module/packages/BlobDownloadBuilder.js.map +0 -1
  189. package/dist/module/packages/StorageAnalyticsClient.d.ts +0 -324
  190. package/dist/module/packages/StorageAnalyticsClient.d.ts.map +0 -1
  191. package/dist/module/packages/StorageAnalyticsClient.js +0 -392
  192. package/dist/module/packages/StorageAnalyticsClient.js.map +0 -1
  193. package/dist/module/packages/StorageBucketApi.d.ts +0 -266
  194. package/dist/module/packages/StorageBucketApi.d.ts.map +0 -1
  195. package/dist/module/packages/StorageBucketApi.js +0 -359
  196. package/dist/module/packages/StorageBucketApi.js.map +0 -1
  197. package/dist/module/packages/StorageFileApi.d.ts +0 -680
  198. package/dist/module/packages/StorageFileApi.d.ts.map +0 -1
  199. package/dist/module/packages/StorageFileApi.js +0 -999
  200. package/dist/module/packages/StorageFileApi.js.map +0 -1
  201. package/dist/module/packages/StreamDownloadBuilder.d.ts +0 -9
  202. package/dist/module/packages/StreamDownloadBuilder.d.ts.map +0 -1
  203. package/dist/module/packages/StreamDownloadBuilder.js +0 -32
  204. package/dist/module/packages/StreamDownloadBuilder.js.map +0 -1
  205. package/dist/tsconfig.module.tsbuildinfo +0 -1
  206. package/dist/tsconfig.tsbuildinfo +0 -1
@@ -0,0 +1,2601 @@
1
+ import { IcebergError, IcebergRestCatalog } from "iceberg-js";
2
+
3
+ //#region src/lib/errors.d.ts
4
+ declare class StorageError extends Error {
5
+ protected __isStorageError: boolean;
6
+ constructor(message: string);
7
+ }
8
+ declare function isStorageError(error: unknown): error is StorageError;
9
+ declare class StorageApiError extends StorageError {
10
+ status: number;
11
+ statusCode: string;
12
+ constructor(message: string, status: number, statusCode: string);
13
+ toJSON(): {
14
+ name: string;
15
+ message: string;
16
+ status: number;
17
+ statusCode: string;
18
+ };
19
+ }
20
+ declare class StorageUnknownError extends StorageError {
21
+ originalError: unknown;
22
+ constructor(message: string, originalError: unknown);
23
+ }
24
+ //#endregion
25
+ //#region src/lib/types.d.ts
26
+ /**
27
+ * Type of storage bucket
28
+ * - STANDARD: Regular file storage buckets
29
+ * - ANALYTICS: Iceberg table-based buckets for analytical workloads
30
+ */
31
+ type BucketType = 'STANDARD' | 'ANALYTICS';
32
+ interface Bucket {
33
+ id: string;
34
+ type?: BucketType;
35
+ name: string;
36
+ owner: string;
37
+ file_size_limit?: number;
38
+ allowed_mime_types?: string[];
39
+ created_at: string;
40
+ updated_at: string;
41
+ public: boolean;
42
+ }
43
+ interface ListBucketOptions {
44
+ limit?: number;
45
+ offset?: number;
46
+ sortColumn?: 'id' | 'name' | 'created_at' | 'updated_at';
47
+ sortOrder?: 'asc' | 'desc';
48
+ search?: string;
49
+ }
50
+ /**
51
+ * Represents an Analytics Bucket using Apache Iceberg table format.
52
+ * Analytics buckets are optimized for analytical queries and data processing.
53
+ */
54
+ interface AnalyticBucket {
55
+ /** Unique identifier for the bucket */
56
+ name: string;
57
+ /** Bucket type - always 'ANALYTICS' for analytics buckets */
58
+ type: 'ANALYTICS';
59
+ /** Storage format used (e.g., 'iceberg') */
60
+ format: string;
61
+ /** ISO 8601 timestamp of bucket creation */
62
+ created_at: string;
63
+ /** ISO 8601 timestamp of last update */
64
+ updated_at: string;
65
+ }
66
+ interface FileObject {
67
+ name: string;
68
+ bucket_id: string;
69
+ owner: string;
70
+ id: string;
71
+ updated_at: string;
72
+ created_at: string;
73
+ /** @deprecated */
74
+ last_accessed_at: string;
75
+ metadata: Record<string, any>;
76
+ buckets: Bucket;
77
+ }
78
+ interface FileObjectV2 {
79
+ id: string;
80
+ version: string;
81
+ name: string;
82
+ bucket_id: string;
83
+ updated_at: string;
84
+ created_at: string;
85
+ /** @deprecated */
86
+ last_accessed_at: string;
87
+ size?: number;
88
+ cache_control?: string;
89
+ content_type?: string;
90
+ etag?: string;
91
+ last_modified?: string;
92
+ metadata?: Record<string, any>;
93
+ }
94
+ interface SortBy {
95
+ column?: string;
96
+ order?: string;
97
+ }
98
+ interface FileOptions {
99
+ /**
100
+ * The number of seconds the asset is cached in the browser and in the Supabase CDN. This is set in the `Cache-Control: max-age=<seconds>` header. Defaults to 3600 seconds.
101
+ */
102
+ cacheControl?: string;
103
+ /**
104
+ * the `Content-Type` header value. Should be specified if using a `fileBody` that is neither `Blob` nor `File` nor `FormData`, otherwise will default to `text/plain;charset=UTF-8`.
105
+ */
106
+ contentType?: string;
107
+ /**
108
+ * When upsert is set to true, the file is overwritten if it exists. When set to false, an error is thrown if the object already exists. Defaults to false.
109
+ */
110
+ upsert?: boolean;
111
+ /**
112
+ * The duplex option is a string parameter that enables or disables duplex streaming, allowing for both reading and writing data in the same stream. It can be passed as an option to the fetch() method.
113
+ */
114
+ duplex?: string;
115
+ /**
116
+ * The metadata option is an object that allows you to store additional information about the file. This information can be used to filter and search for files. The metadata object can contain any key-value pairs you want to store.
117
+ */
118
+ metadata?: Record<string, any>;
119
+ /**
120
+ * Optionally add extra headers
121
+ */
122
+ headers?: Record<string, string>;
123
+ }
124
+ interface DestinationOptions {
125
+ destinationBucket?: string;
126
+ }
127
+ interface SearchOptions {
128
+ /**
129
+ * The number of files you want to be returned.
130
+ * @default 100
131
+ */
132
+ limit?: number;
133
+ /**
134
+ * The starting position.
135
+ */
136
+ offset?: number;
137
+ /**
138
+ * The column to sort by. Can be any column inside a FileObject.
139
+ */
140
+ sortBy?: SortBy;
141
+ /**
142
+ * The search string to filter files by.
143
+ */
144
+ search?: string;
145
+ }
146
+ interface SortByV2 {
147
+ column: 'name' | 'updated_at' | 'created_at';
148
+ order?: 'asc' | 'desc';
149
+ }
150
+ interface SearchV2Options {
151
+ /**
152
+ * The number of files you want to be returned.
153
+ * @default 1000
154
+ */
155
+ limit?: number;
156
+ /**
157
+ * The prefix search string to filter files by.
158
+ */
159
+ prefix?: string;
160
+ /**
161
+ * The cursor used for pagination. Pass the value received from nextCursor of the previous request.
162
+ */
163
+ cursor?: string;
164
+ /**
165
+ * Whether to emulate a hierarchical listing of objects using delimiters.
166
+ *
167
+ * - When `false` (default), all objects are listed as flat key/value pairs.
168
+ * - When `true`, the response groups objects by delimiter, making it appear
169
+ * like a file/folder hierarchy.
170
+ *
171
+ * @default false
172
+ */
173
+ with_delimiter?: boolean;
174
+ /**
175
+ * The column and order to sort by
176
+ * @default 'name asc'
177
+ */
178
+ sortBy?: SortByV2;
179
+ }
180
+ interface SearchV2Object {
181
+ id: string;
182
+ key: string;
183
+ name: string;
184
+ updated_at: string;
185
+ created_at: string;
186
+ metadata: Record<string, any>;
187
+ /**
188
+ * @deprecated
189
+ */
190
+ last_accessed_at: string;
191
+ }
192
+ type SearchV2Folder = Omit<SearchV2Object, 'id' | 'metadata' | 'last_accessed_at'>;
193
+ interface SearchV2Result {
194
+ hasNext: boolean;
195
+ folders: SearchV2Folder[];
196
+ objects: SearchV2Object[];
197
+ nextCursor?: string;
198
+ }
199
+ interface FetchParameters {
200
+ /**
201
+ * Pass in an AbortController's signal to cancel the request.
202
+ */
203
+ signal?: AbortSignal;
204
+ }
205
+ interface Metadata {
206
+ name: string;
207
+ }
208
+ interface TransformOptions {
209
+ /**
210
+ * The width of the image in pixels.
211
+ */
212
+ width?: number;
213
+ /**
214
+ * The height of the image in pixels.
215
+ */
216
+ height?: number;
217
+ /**
218
+ * The resize mode can be cover, contain or fill. Defaults to cover.
219
+ * Cover resizes the image to maintain it's aspect ratio while filling the entire width and height.
220
+ * Contain resizes the image to maintain it's aspect ratio while fitting the entire image within the width and height.
221
+ * Fill resizes the image to fill the entire width and height. If the object's aspect ratio does not match the width and height, the image will be stretched to fit.
222
+ */
223
+ resize?: 'cover' | 'contain' | 'fill';
224
+ /**
225
+ * Set the quality of the returned image.
226
+ * A number from 20 to 100, with 100 being the highest quality.
227
+ * Defaults to 80
228
+ */
229
+ quality?: number;
230
+ /**
231
+ * Specify the format of the image requested.
232
+ *
233
+ * When using 'origin' we force the format to be the same as the original image.
234
+ * When this option is not passed in, images are optimized to modern image formats like Webp.
235
+ */
236
+ format?: 'origin';
237
+ }
238
+ type CamelCase<S extends string> = S extends `${infer P1}_${infer P2}${infer P3}` ? `${Lowercase<P1>}${Uppercase<P2>}${CamelCase<P3>}` : S;
239
+ type Camelize<T> = { [K in keyof T as CamelCase<Extract<K, string>>]: T[K] };
240
+ type DownloadResult<T> = {
241
+ data: T;
242
+ error: null;
243
+ } | {
244
+ data: null;
245
+ error: StorageError;
246
+ };
247
+ //#endregion
248
+ //#region src/lib/fetch.d.ts
249
+ type Fetch$1 = typeof fetch;
250
+ //#endregion
251
+ //#region src/packages/StreamDownloadBuilder.d.ts
252
+ declare class StreamDownloadBuilder implements PromiseLike<DownloadResult<ReadableStream>> {
253
+ private downloadFn;
254
+ private shouldThrowOnError;
255
+ constructor(downloadFn: () => Promise<Response>, shouldThrowOnError: boolean);
256
+ then<TResult1 = DownloadResult<ReadableStream>, TResult2 = never>(onfulfilled?: ((value: DownloadResult<ReadableStream>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
257
+ private execute;
258
+ }
259
+ //#endregion
260
+ //#region src/packages/BlobDownloadBuilder.d.ts
261
+ declare class BlobDownloadBuilder implements Promise<DownloadResult<Blob>> {
262
+ private downloadFn;
263
+ private shouldThrowOnError;
264
+ readonly [Symbol.toStringTag]: string;
265
+ private promise;
266
+ constructor(downloadFn: () => Promise<Response>, shouldThrowOnError: boolean);
267
+ asStream(): StreamDownloadBuilder;
268
+ then<TResult1 = DownloadResult<Blob>, TResult2 = never>(onfulfilled?: ((value: DownloadResult<Blob>) => TResult1 | PromiseLike<TResult1>) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
269
+ catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<DownloadResult<Blob> | TResult>;
270
+ finally(onfinally?: (() => void) | null): Promise<DownloadResult<Blob>>;
271
+ private getPromise;
272
+ private execute;
273
+ }
274
+ //#endregion
275
+ //#region src/packages/StorageFileApi.d.ts
276
+ type FileBody = ArrayBuffer | ArrayBufferView | Blob | Buffer | File | FormData | NodeJS.ReadableStream | ReadableStream<Uint8Array> | URLSearchParams | string;
277
+ declare class StorageFileApi {
278
+ protected url: string;
279
+ protected headers: {
280
+ [key: string]: string;
281
+ };
282
+ protected bucketId?: string;
283
+ protected fetch: Fetch$1;
284
+ protected shouldThrowOnError: boolean;
285
+ constructor(url: string, headers?: {
286
+ [key: string]: string;
287
+ }, bucketId?: string, fetch?: Fetch$1);
288
+ /**
289
+ * Enable throwing errors instead of returning them.
290
+ *
291
+ * @category File Buckets
292
+ */
293
+ throwOnError(): this;
294
+ /**
295
+ * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one.
296
+ *
297
+ * @param method HTTP method.
298
+ * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
299
+ * @param fileBody The body of the file to be stored in the bucket.
300
+ */
301
+ private uploadOrUpdate;
302
+ /**
303
+ * Uploads a file to an existing bucket.
304
+ *
305
+ * @category File Buckets
306
+ * @param path The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
307
+ * @param fileBody The body of the file to be stored in the bucket.
308
+ * @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata.
309
+ * @returns Promise with response containing file path, id, and fullPath or error
310
+ *
311
+ * @example Upload file
312
+ * ```js
313
+ * const avatarFile = event.target.files[0]
314
+ * const { data, error } = await supabase
315
+ * .storage
316
+ * .from('avatars')
317
+ * .upload('public/avatar1.png', avatarFile, {
318
+ * cacheControl: '3600',
319
+ * upsert: false
320
+ * })
321
+ * ```
322
+ *
323
+ * Response:
324
+ * ```json
325
+ * {
326
+ * "data": {
327
+ * "path": "public/avatar1.png",
328
+ * "fullPath": "avatars/public/avatar1.png"
329
+ * },
330
+ * "error": null
331
+ * }
332
+ * ```
333
+ *
334
+ * @example Upload file using `ArrayBuffer` from base64 file data
335
+ * ```js
336
+ * import { decode } from 'base64-arraybuffer'
337
+ *
338
+ * const { data, error } = await supabase
339
+ * .storage
340
+ * .from('avatars')
341
+ * .upload('public/avatar1.png', decode('base64FileData'), {
342
+ * contentType: 'image/png'
343
+ * })
344
+ * ```
345
+ */
346
+ upload(path: string, fileBody: FileBody, fileOptions?: FileOptions): Promise<{
347
+ data: {
348
+ id: string;
349
+ path: string;
350
+ fullPath: string;
351
+ };
352
+ error: null;
353
+ } | {
354
+ data: null;
355
+ error: StorageError;
356
+ }>;
357
+ /**
358
+ * Upload a file with a token generated from `createSignedUploadUrl`.
359
+ *
360
+ * @category File Buckets
361
+ * @param path The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
362
+ * @param token The token generated from `createSignedUploadUrl`
363
+ * @param fileBody The body of the file to be stored in the bucket.
364
+ * @param fileOptions HTTP headers (cacheControl, contentType, etc.).
365
+ * **Note:** The `upsert` option has no effect here. To enable upsert behavior,
366
+ * pass `{ upsert: true }` when calling `createSignedUploadUrl()` instead.
367
+ * @returns Promise with response containing file path and fullPath or error
368
+ *
369
+ * @example Upload to a signed URL
370
+ * ```js
371
+ * const { data, error } = await supabase
372
+ * .storage
373
+ * .from('avatars')
374
+ * .uploadToSignedUrl('folder/cat.jpg', 'token-from-createSignedUploadUrl', file)
375
+ * ```
376
+ *
377
+ * Response:
378
+ * ```json
379
+ * {
380
+ * "data": {
381
+ * "path": "folder/cat.jpg",
382
+ * "fullPath": "avatars/folder/cat.jpg"
383
+ * },
384
+ * "error": null
385
+ * }
386
+ * ```
387
+ */
388
+ uploadToSignedUrl(path: string, token: string, fileBody: FileBody, fileOptions?: FileOptions): Promise<{
389
+ data: {
390
+ path: string;
391
+ fullPath: any;
392
+ };
393
+ error: null;
394
+ } | {
395
+ data: null;
396
+ error: StorageError;
397
+ }>;
398
+ /**
399
+ * Creates a signed upload URL.
400
+ * Signed upload URLs can be used to upload files to the bucket without further authentication.
401
+ * They are valid for 2 hours.
402
+ *
403
+ * @category File Buckets
404
+ * @param path The file path, including the current file name. For example `folder/image.png`.
405
+ * @param options.upsert If set to true, allows the file to be overwritten if it already exists.
406
+ * @returns Promise with response containing signed upload URL, token, and path or error
407
+ *
408
+ * @example Create Signed Upload URL
409
+ * ```js
410
+ * const { data, error } = await supabase
411
+ * .storage
412
+ * .from('avatars')
413
+ * .createSignedUploadUrl('folder/cat.jpg')
414
+ * ```
415
+ *
416
+ * Response:
417
+ * ```json
418
+ * {
419
+ * "data": {
420
+ * "signedUrl": "https://example.supabase.co/storage/v1/object/upload/sign/avatars/folder/cat.jpg?token=<TOKEN>",
421
+ * "path": "folder/cat.jpg",
422
+ * "token": "<TOKEN>"
423
+ * },
424
+ * "error": null
425
+ * }
426
+ * ```
427
+ */
428
+ createSignedUploadUrl(path: string, options?: {
429
+ upsert: boolean;
430
+ }): Promise<{
431
+ data: {
432
+ signedUrl: string;
433
+ token: string;
434
+ path: string;
435
+ };
436
+ error: null;
437
+ } | {
438
+ data: null;
439
+ error: StorageError;
440
+ }>;
441
+ /**
442
+ * Replaces an existing file at the specified path with a new one.
443
+ *
444
+ * @category File Buckets
445
+ * @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update.
446
+ * @param fileBody The body of the file to be stored in the bucket.
447
+ * @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata.
448
+ * @returns Promise with response containing file path, id, and fullPath or error
449
+ *
450
+ * @example Update file
451
+ * ```js
452
+ * const avatarFile = event.target.files[0]
453
+ * const { data, error } = await supabase
454
+ * .storage
455
+ * .from('avatars')
456
+ * .update('public/avatar1.png', avatarFile, {
457
+ * cacheControl: '3600',
458
+ * upsert: true
459
+ * })
460
+ * ```
461
+ *
462
+ * Response:
463
+ * ```json
464
+ * {
465
+ * "data": {
466
+ * "path": "public/avatar1.png",
467
+ * "fullPath": "avatars/public/avatar1.png"
468
+ * },
469
+ * "error": null
470
+ * }
471
+ * ```
472
+ *
473
+ * @example Update file using `ArrayBuffer` from base64 file data
474
+ * ```js
475
+ * import {decode} from 'base64-arraybuffer'
476
+ *
477
+ * const { data, error } = await supabase
478
+ * .storage
479
+ * .from('avatars')
480
+ * .update('public/avatar1.png', decode('base64FileData'), {
481
+ * contentType: 'image/png'
482
+ * })
483
+ * ```
484
+ */
485
+ update(path: string, fileBody: ArrayBuffer | ArrayBufferView | Blob | Buffer | File | FormData | NodeJS.ReadableStream | ReadableStream<Uint8Array> | URLSearchParams | string, fileOptions?: FileOptions): Promise<{
486
+ data: {
487
+ id: string;
488
+ path: string;
489
+ fullPath: string;
490
+ };
491
+ error: null;
492
+ } | {
493
+ data: null;
494
+ error: StorageError;
495
+ }>;
496
+ /**
497
+ * Moves an existing file to a new path in the same bucket.
498
+ *
499
+ * @category File Buckets
500
+ * @param fromPath The original file path, including the current file name. For example `folder/image.png`.
501
+ * @param toPath The new file path, including the new file name. For example `folder/image-new.png`.
502
+ * @param options The destination options.
503
+ * @returns Promise with response containing success message or error
504
+ *
505
+ * @example Move file
506
+ * ```js
507
+ * const { data, error } = await supabase
508
+ * .storage
509
+ * .from('avatars')
510
+ * .move('public/avatar1.png', 'private/avatar2.png')
511
+ * ```
512
+ *
513
+ * Response:
514
+ * ```json
515
+ * {
516
+ * "data": {
517
+ * "message": "Successfully moved"
518
+ * },
519
+ * "error": null
520
+ * }
521
+ * ```
522
+ */
523
+ move(fromPath: string, toPath: string, options?: DestinationOptions): Promise<{
524
+ data: {
525
+ message: string;
526
+ };
527
+ error: null;
528
+ } | {
529
+ data: null;
530
+ error: StorageError;
531
+ }>;
532
+ /**
533
+ * Copies an existing file to a new path in the same bucket.
534
+ *
535
+ * @category File Buckets
536
+ * @param fromPath The original file path, including the current file name. For example `folder/image.png`.
537
+ * @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.
538
+ * @param options The destination options.
539
+ * @returns Promise with response containing copied file path or error
540
+ *
541
+ * @example Copy file
542
+ * ```js
543
+ * const { data, error } = await supabase
544
+ * .storage
545
+ * .from('avatars')
546
+ * .copy('public/avatar1.png', 'private/avatar2.png')
547
+ * ```
548
+ *
549
+ * Response:
550
+ * ```json
551
+ * {
552
+ * "data": {
553
+ * "path": "avatars/private/avatar2.png"
554
+ * },
555
+ * "error": null
556
+ * }
557
+ * ```
558
+ */
559
+ copy(fromPath: string, toPath: string, options?: DestinationOptions): Promise<{
560
+ data: {
561
+ path: string;
562
+ };
563
+ error: null;
564
+ } | {
565
+ data: null;
566
+ error: StorageError;
567
+ }>;
568
+ /**
569
+ * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
570
+ *
571
+ * @category File Buckets
572
+ * @param path The file path, including the current file name. For example `folder/image.png`.
573
+ * @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.
574
+ * @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
575
+ * @param options.transform Transform the asset before serving it to the client.
576
+ * @returns Promise with response containing signed URL or error
577
+ *
578
+ * @example Create Signed URL
579
+ * ```js
580
+ * const { data, error } = await supabase
581
+ * .storage
582
+ * .from('avatars')
583
+ * .createSignedUrl('folder/avatar1.png', 60)
584
+ * ```
585
+ *
586
+ * Response:
587
+ * ```json
588
+ * {
589
+ * "data": {
590
+ * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=<TOKEN>"
591
+ * },
592
+ * "error": null
593
+ * }
594
+ * ```
595
+ *
596
+ * @example Create a signed URL for an asset with transformations
597
+ * ```js
598
+ * const { data } = await supabase
599
+ * .storage
600
+ * .from('avatars')
601
+ * .createSignedUrl('folder/avatar1.png', 60, {
602
+ * transform: {
603
+ * width: 100,
604
+ * height: 100,
605
+ * }
606
+ * })
607
+ * ```
608
+ *
609
+ * @example Create a signed URL which triggers the download of the asset
610
+ * ```js
611
+ * const { data } = await supabase
612
+ * .storage
613
+ * .from('avatars')
614
+ * .createSignedUrl('folder/avatar1.png', 60, {
615
+ * download: true,
616
+ * })
617
+ * ```
618
+ */
619
+ createSignedUrl(path: string, expiresIn: number, options?: {
620
+ download?: string | boolean;
621
+ transform?: TransformOptions;
622
+ }): Promise<{
623
+ data: {
624
+ signedUrl: string;
625
+ };
626
+ error: null;
627
+ } | {
628
+ data: null;
629
+ error: StorageError;
630
+ }>;
631
+ /**
632
+ * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.
633
+ *
634
+ * @category File Buckets
635
+ * @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`.
636
+ * @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.
637
+ * @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
638
+ * @returns Promise with response containing array of objects with signedUrl, path, and error or error
639
+ *
640
+ * @example Create Signed URLs
641
+ * ```js
642
+ * const { data, error } = await supabase
643
+ * .storage
644
+ * .from('avatars')
645
+ * .createSignedUrls(['folder/avatar1.png', 'folder/avatar2.png'], 60)
646
+ * ```
647
+ *
648
+ * Response:
649
+ * ```json
650
+ * {
651
+ * "data": [
652
+ * {
653
+ * "error": null,
654
+ * "path": "folder/avatar1.png",
655
+ * "signedURL": "/object/sign/avatars/folder/avatar1.png?token=<TOKEN>",
656
+ * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar1.png?token=<TOKEN>"
657
+ * },
658
+ * {
659
+ * "error": null,
660
+ * "path": "folder/avatar2.png",
661
+ * "signedURL": "/object/sign/avatars/folder/avatar2.png?token=<TOKEN>",
662
+ * "signedUrl": "https://example.supabase.co/storage/v1/object/sign/avatars/folder/avatar2.png?token=<TOKEN>"
663
+ * }
664
+ * ],
665
+ * "error": null
666
+ * }
667
+ * ```
668
+ */
669
+ createSignedUrls(paths: string[], expiresIn: number, options?: {
670
+ download: string | boolean;
671
+ }): Promise<{
672
+ data: {
673
+ error: string | null;
674
+ path: string | null;
675
+ signedUrl: string;
676
+ }[];
677
+ error: null;
678
+ } | {
679
+ data: null;
680
+ error: StorageError;
681
+ }>;
682
+ /**
683
+ * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead.
684
+ *
685
+ * @category File Buckets
686
+ * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
687
+ * @param options.transform Transform the asset before serving it to the client.
688
+ * @returns BlobDownloadBuilder instance for downloading the file
689
+ *
690
+ * @example Download file
691
+ * ```js
692
+ * const { data, error } = await supabase
693
+ * .storage
694
+ * .from('avatars')
695
+ * .download('folder/avatar1.png')
696
+ * ```
697
+ *
698
+ * Response:
699
+ * ```json
700
+ * {
701
+ * "data": <BLOB>,
702
+ * "error": null
703
+ * }
704
+ * ```
705
+ *
706
+ * @example Download file with transformations
707
+ * ```js
708
+ * const { data, error } = await supabase
709
+ * .storage
710
+ * .from('avatars')
711
+ * .download('folder/avatar1.png', {
712
+ * transform: {
713
+ * width: 100,
714
+ * height: 100,
715
+ * quality: 80
716
+ * }
717
+ * })
718
+ * ```
719
+ */
720
+ download<Options extends {
721
+ transform?: TransformOptions;
722
+ }>(path: string, options?: Options): BlobDownloadBuilder;
723
+ /**
724
+ * Retrieves the details of an existing file.
725
+ *
726
+ * @category File Buckets
727
+ * @param path The file path, including the file name. For example `folder/image.png`.
728
+ * @returns Promise with response containing file metadata or error
729
+ *
730
+ * @example Get file info
731
+ * ```js
732
+ * const { data, error } = await supabase
733
+ * .storage
734
+ * .from('avatars')
735
+ * .info('folder/avatar1.png')
736
+ * ```
737
+ */
738
+ info(path: string): Promise<{
739
+ data: Camelize<FileObjectV2>;
740
+ error: null;
741
+ } | {
742
+ data: null;
743
+ error: StorageError;
744
+ }>;
745
+ /**
746
+ * Checks the existence of a file.
747
+ *
748
+ * @category File Buckets
749
+ * @param path The file path, including the file name. For example `folder/image.png`.
750
+ * @returns Promise with response containing boolean indicating file existence or error
751
+ *
752
+ * @example Check file existence
753
+ * ```js
754
+ * const { data, error } = await supabase
755
+ * .storage
756
+ * .from('avatars')
757
+ * .exists('folder/avatar1.png')
758
+ * ```
759
+ */
760
+ exists(path: string): Promise<{
761
+ data: boolean;
762
+ error: null;
763
+ } | {
764
+ data: boolean;
765
+ error: StorageError;
766
+ }>;
767
+ /**
768
+ * A simple convenience function to get the URL for an asset in a public bucket. If you do not want to use this function, you can construct the public URL by concatenating the bucket URL with the path to the asset.
769
+ * This function does not verify if the bucket is public. If a public URL is created for a bucket which is not public, you will not be able to download the asset.
770
+ *
771
+ * @category File Buckets
772
+ * @param path The path and name of the file to generate the public URL for. For example `folder/image.png`.
773
+ * @param options.download Triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
774
+ * @param options.transform Transform the asset before serving it to the client.
775
+ * @returns Object with public URL
776
+ *
777
+ * @example Returns the URL for an asset in a public bucket
778
+ * ```js
779
+ * const { data } = supabase
780
+ * .storage
781
+ * .from('public-bucket')
782
+ * .getPublicUrl('folder/avatar1.png')
783
+ * ```
784
+ *
785
+ * Response:
786
+ * ```json
787
+ * {
788
+ * "data": {
789
+ * "publicUrl": "https://example.supabase.co/storage/v1/object/public/public-bucket/folder/avatar1.png"
790
+ * }
791
+ * }
792
+ * ```
793
+ *
794
+ * @example Returns the URL for an asset in a public bucket with transformations
795
+ * ```js
796
+ * const { data } = supabase
797
+ * .storage
798
+ * .from('public-bucket')
799
+ * .getPublicUrl('folder/avatar1.png', {
800
+ * transform: {
801
+ * width: 100,
802
+ * height: 100,
803
+ * }
804
+ * })
805
+ * ```
806
+ *
807
+ * @example Returns the URL which triggers the download of an asset in a public bucket
808
+ * ```js
809
+ * const { data } = supabase
810
+ * .storage
811
+ * .from('public-bucket')
812
+ * .getPublicUrl('folder/avatar1.png', {
813
+ * download: true,
814
+ * })
815
+ * ```
816
+ */
817
+ getPublicUrl(path: string, options?: {
818
+ download?: string | boolean;
819
+ transform?: TransformOptions;
820
+ }): {
821
+ data: {
822
+ publicUrl: string;
823
+ };
824
+ };
825
+ /**
826
+ * Deletes files within the same bucket
827
+ *
828
+ * @category File Buckets
829
+ * @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].
830
+ * @returns Promise with response containing array of deleted file objects or error
831
+ *
832
+ * @example Delete file
833
+ * ```js
834
+ * const { data, error } = await supabase
835
+ * .storage
836
+ * .from('avatars')
837
+ * .remove(['folder/avatar1.png'])
838
+ * ```
839
+ *
840
+ * Response:
841
+ * ```json
842
+ * {
843
+ * "data": [],
844
+ * "error": null
845
+ * }
846
+ * ```
847
+ */
848
+ remove(paths: string[]): Promise<{
849
+ data: FileObject[];
850
+ error: null;
851
+ } | {
852
+ data: null;
853
+ error: StorageError;
854
+ }>;
855
+ /**
856
+ * Get file metadata
857
+ * @param id the file id to retrieve metadata
858
+ */
859
+ /**
860
+ * Update file metadata
861
+ * @param id the file id to update metadata
862
+ * @param meta the new file metadata
863
+ */
864
+ /**
865
+ * Lists all the files and folders within a path of the bucket.
866
+ *
867
+ * @category File Buckets
868
+ * @param path The folder path.
869
+ * @param options Search options including limit (defaults to 100), offset, sortBy, and search
870
+ * @param parameters Optional fetch parameters including signal for cancellation
871
+ * @returns Promise with response containing array of files or error
872
+ *
873
+ * @example List files in a bucket
874
+ * ```js
875
+ * const { data, error } = await supabase
876
+ * .storage
877
+ * .from('avatars')
878
+ * .list('folder', {
879
+ * limit: 100,
880
+ * offset: 0,
881
+ * sortBy: { column: 'name', order: 'asc' },
882
+ * })
883
+ * ```
884
+ *
885
+ * Response:
886
+ * ```json
887
+ * {
888
+ * "data": [
889
+ * {
890
+ * "name": "avatar1.png",
891
+ * "id": "e668cf7f-821b-4a2f-9dce-7dfa5dd1cfd2",
892
+ * "updated_at": "2024-05-22T23:06:05.580Z",
893
+ * "created_at": "2024-05-22T23:04:34.443Z",
894
+ * "last_accessed_at": "2024-05-22T23:04:34.443Z",
895
+ * "metadata": {
896
+ * "eTag": "\"c5e8c553235d9af30ef4f6e280790b92\"",
897
+ * "size": 32175,
898
+ * "mimetype": "image/png",
899
+ * "cacheControl": "max-age=3600",
900
+ * "lastModified": "2024-05-22T23:06:05.574Z",
901
+ * "contentLength": 32175,
902
+ * "httpStatusCode": 200
903
+ * }
904
+ * }
905
+ * ],
906
+ * "error": null
907
+ * }
908
+ * ```
909
+ *
910
+ * @example Search files in a bucket
911
+ * ```js
912
+ * const { data, error } = await supabase
913
+ * .storage
914
+ * .from('avatars')
915
+ * .list('folder', {
916
+ * limit: 100,
917
+ * offset: 0,
918
+ * sortBy: { column: 'name', order: 'asc' },
919
+ * search: 'jon'
920
+ * })
921
+ * ```
922
+ */
923
+ list(path?: string, options?: SearchOptions, parameters?: FetchParameters): Promise<{
924
+ data: FileObject[];
925
+ error: null;
926
+ } | {
927
+ data: null;
928
+ error: StorageError;
929
+ }>;
930
+ /**
931
+ * @experimental this method signature might change in the future
932
+ *
933
+ * @category File Buckets
934
+ * @param options search options
935
+ * @param parameters
936
+ */
937
+ listV2(options?: SearchV2Options, parameters?: FetchParameters): Promise<{
938
+ data: SearchV2Result;
939
+ error: null;
940
+ } | {
941
+ data: null;
942
+ error: StorageError;
943
+ }>;
944
+ protected encodeMetadata(metadata: Record<string, any>): string;
945
+ toBase64(data: string): string;
946
+ private _getFinalPath;
947
+ private _removeEmptyFolders;
948
+ private transformOptsToQueryString;
949
+ }
950
+ //#endregion
951
+ //#region src/packages/StorageBucketApi.d.ts
952
+ declare class StorageBucketApi {
953
+ protected url: string;
954
+ protected headers: {
955
+ [key: string]: string;
956
+ };
957
+ protected fetch: Fetch$1;
958
+ protected shouldThrowOnError: boolean;
959
+ constructor(url: string, headers?: {
960
+ [key: string]: string;
961
+ }, fetch?: Fetch$1, opts?: StorageClientOptions);
962
+ /**
963
+ * Enable throwing errors instead of returning them.
964
+ *
965
+ * @category File Buckets
966
+ */
967
+ throwOnError(): this;
968
+ /**
969
+ * Retrieves the details of all Storage buckets within an existing project.
970
+ *
971
+ * @category File Buckets
972
+ * @param options Query parameters for listing buckets
973
+ * @param options.limit Maximum number of buckets to return
974
+ * @param options.offset Number of buckets to skip
975
+ * @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at')
976
+ * @param options.sortOrder Sort order ('asc' or 'desc')
977
+ * @param options.search Search term to filter bucket names
978
+ * @returns Promise with response containing array of buckets or error
979
+ *
980
+ * @example List buckets
981
+ * ```js
982
+ * const { data, error } = await supabase
983
+ * .storage
984
+ * .listBuckets()
985
+ * ```
986
+ *
987
+ * @example List buckets with options
988
+ * ```js
989
+ * const { data, error } = await supabase
990
+ * .storage
991
+ * .listBuckets({
992
+ * limit: 10,
993
+ * offset: 0,
994
+ * sortColumn: 'created_at',
995
+ * sortOrder: 'desc',
996
+ * search: 'prod'
997
+ * })
998
+ * ```
999
+ */
1000
+ listBuckets(options?: ListBucketOptions): Promise<{
1001
+ data: Bucket[];
1002
+ error: null;
1003
+ } | {
1004
+ data: null;
1005
+ error: StorageError;
1006
+ }>;
1007
+ /**
1008
+ * Retrieves the details of an existing Storage bucket.
1009
+ *
1010
+ * @category File Buckets
1011
+ * @param id The unique identifier of the bucket you would like to retrieve.
1012
+ * @returns Promise with response containing bucket details or error
1013
+ *
1014
+ * @example Get bucket
1015
+ * ```js
1016
+ * const { data, error } = await supabase
1017
+ * .storage
1018
+ * .getBucket('avatars')
1019
+ * ```
1020
+ *
1021
+ * Response:
1022
+ * ```json
1023
+ * {
1024
+ * "data": {
1025
+ * "id": "avatars",
1026
+ * "name": "avatars",
1027
+ * "owner": "",
1028
+ * "public": false,
1029
+ * "file_size_limit": 1024,
1030
+ * "allowed_mime_types": [
1031
+ * "image/png"
1032
+ * ],
1033
+ * "created_at": "2024-05-22T22:26:05.100Z",
1034
+ * "updated_at": "2024-05-22T22:26:05.100Z"
1035
+ * },
1036
+ * "error": null
1037
+ * }
1038
+ * ```
1039
+ */
1040
+ getBucket(id: string): Promise<{
1041
+ data: Bucket;
1042
+ error: null;
1043
+ } | {
1044
+ data: null;
1045
+ error: StorageError;
1046
+ }>;
1047
+ /**
1048
+ * Creates a new Storage bucket
1049
+ *
1050
+ * @category File Buckets
1051
+ * @param id A unique identifier for the bucket you are creating.
1052
+ * @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations. By default, buckets are private.
1053
+ * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
1054
+ * The global file size limit takes precedence over this value.
1055
+ * The default value is null, which doesn't set a per bucket file size limit.
1056
+ * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
1057
+ * The default value is null, which allows files with all mime types to be uploaded.
1058
+ * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
1059
+ * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details.
1060
+ * - default bucket type is `STANDARD`
1061
+ * @returns Promise with response containing newly created bucket name or error
1062
+ *
1063
+ * @example Create bucket
1064
+ * ```js
1065
+ * const { data, error } = await supabase
1066
+ * .storage
1067
+ * .createBucket('avatars', {
1068
+ * public: false,
1069
+ * allowedMimeTypes: ['image/png'],
1070
+ * fileSizeLimit: 1024
1071
+ * })
1072
+ * ```
1073
+ *
1074
+ * Response:
1075
+ * ```json
1076
+ * {
1077
+ * "data": {
1078
+ * "name": "avatars"
1079
+ * },
1080
+ * "error": null
1081
+ * }
1082
+ * ```
1083
+ */
1084
+ createBucket(id: string, options?: {
1085
+ public: boolean;
1086
+ fileSizeLimit?: number | string | null;
1087
+ allowedMimeTypes?: string[] | null;
1088
+ type?: BucketType;
1089
+ }): Promise<{
1090
+ data: Pick<Bucket, 'name'>;
1091
+ error: null;
1092
+ } | {
1093
+ data: null;
1094
+ error: StorageError;
1095
+ }>;
1096
+ /**
1097
+ * Updates a Storage bucket
1098
+ *
1099
+ * @category File Buckets
1100
+ * @param id A unique identifier for the bucket you are updating.
1101
+ * @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations.
1102
+ * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
1103
+ * The global file size limit takes precedence over this value.
1104
+ * The default value is null, which doesn't set a per bucket file size limit.
1105
+ * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
1106
+ * The default value is null, which allows files with all mime types to be uploaded.
1107
+ * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
1108
+ * @returns Promise with response containing success message or error
1109
+ *
1110
+ * @example Update bucket
1111
+ * ```js
1112
+ * const { data, error } = await supabase
1113
+ * .storage
1114
+ * .updateBucket('avatars', {
1115
+ * public: false,
1116
+ * allowedMimeTypes: ['image/png'],
1117
+ * fileSizeLimit: 1024
1118
+ * })
1119
+ * ```
1120
+ *
1121
+ * Response:
1122
+ * ```json
1123
+ * {
1124
+ * "data": {
1125
+ * "message": "Successfully updated"
1126
+ * },
1127
+ * "error": null
1128
+ * }
1129
+ * ```
1130
+ */
1131
+ updateBucket(id: string, options: {
1132
+ public: boolean;
1133
+ fileSizeLimit?: number | string | null;
1134
+ allowedMimeTypes?: string[] | null;
1135
+ }): Promise<{
1136
+ data: {
1137
+ message: string;
1138
+ };
1139
+ error: null;
1140
+ } | {
1141
+ data: null;
1142
+ error: StorageError;
1143
+ }>;
1144
+ /**
1145
+ * Removes all objects inside a single bucket.
1146
+ *
1147
+ * @category File Buckets
1148
+ * @param id The unique identifier of the bucket you would like to empty.
1149
+ * @returns Promise with success message or error
1150
+ *
1151
+ * @example Empty bucket
1152
+ * ```js
1153
+ * const { data, error } = await supabase
1154
+ * .storage
1155
+ * .emptyBucket('avatars')
1156
+ * ```
1157
+ *
1158
+ * Response:
1159
+ * ```json
1160
+ * {
1161
+ * "data": {
1162
+ * "message": "Successfully emptied"
1163
+ * },
1164
+ * "error": null
1165
+ * }
1166
+ * ```
1167
+ */
1168
+ emptyBucket(id: string): Promise<{
1169
+ data: {
1170
+ message: string;
1171
+ };
1172
+ error: null;
1173
+ } | {
1174
+ data: null;
1175
+ error: StorageError;
1176
+ }>;
1177
+ /**
1178
+ * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
1179
+ * You must first `empty()` the bucket.
1180
+ *
1181
+ * @category File Buckets
1182
+ * @param id The unique identifier of the bucket you would like to delete.
1183
+ * @returns Promise with success message or error
1184
+ *
1185
+ * @example Delete bucket
1186
+ * ```js
1187
+ * const { data, error } = await supabase
1188
+ * .storage
1189
+ * .deleteBucket('avatars')
1190
+ * ```
1191
+ *
1192
+ * Response:
1193
+ * ```json
1194
+ * {
1195
+ * "data": {
1196
+ * "message": "Successfully deleted"
1197
+ * },
1198
+ * "error": null
1199
+ * }
1200
+ * ```
1201
+ */
1202
+ deleteBucket(id: string): Promise<{
1203
+ data: {
1204
+ message: string;
1205
+ };
1206
+ error: null;
1207
+ } | {
1208
+ data: null;
1209
+ error: StorageError;
1210
+ }>;
1211
+ private listBucketOptionsToQueryString;
1212
+ }
1213
+ //#endregion
1214
+ //#region src/packages/StorageAnalyticsClient.d.ts
1215
+ type WrapAsyncMethod<T> = T extends ((...args: infer A) => Promise<infer R>) ? (...args: A) => Promise<{
1216
+ data: R;
1217
+ error: null;
1218
+ } | {
1219
+ data: null;
1220
+ error: IcebergError;
1221
+ }> : T;
1222
+ type WrappedIcebergRestCatalog = { [K in keyof IcebergRestCatalog]: WrapAsyncMethod<IcebergRestCatalog[K]> };
1223
+ /**
1224
+ * Client class for managing Analytics Buckets using Iceberg tables
1225
+ * Provides methods for creating, listing, and deleting analytics buckets
1226
+ */
1227
+ declare class StorageAnalyticsClient {
1228
+ protected url: string;
1229
+ protected headers: {
1230
+ [key: string]: string;
1231
+ };
1232
+ protected fetch: Fetch$1;
1233
+ protected shouldThrowOnError: boolean;
1234
+ /**
1235
+ * @alpha
1236
+ *
1237
+ * Creates a new StorageAnalyticsClient instance
1238
+ *
1239
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1240
+ *
1241
+ * @category Analytics Buckets
1242
+ * @param url - The base URL for the storage API
1243
+ * @param headers - HTTP headers to include in requests
1244
+ * @param fetch - Optional custom fetch implementation
1245
+ *
1246
+ * @example
1247
+ * ```typescript
1248
+ * const client = new StorageAnalyticsClient(url, headers)
1249
+ * ```
1250
+ */
1251
+ constructor(url: string, headers?: {
1252
+ [key: string]: string;
1253
+ }, fetch?: Fetch$1);
1254
+ /**
1255
+ * @alpha
1256
+ *
1257
+ * Enable throwing errors instead of returning them in the response
1258
+ * When enabled, failed operations will throw instead of returning { data: null, error }
1259
+ *
1260
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1261
+ *
1262
+ * @category Analytics Buckets
1263
+ * @returns This instance for method chaining
1264
+ */
1265
+ throwOnError(): this;
1266
+ /**
1267
+ * @alpha
1268
+ *
1269
+ * Creates a new analytics bucket using Iceberg tables
1270
+ * Analytics buckets are optimized for analytical queries and data processing
1271
+ *
1272
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1273
+ *
1274
+ * @category Analytics Buckets
1275
+ * @param name A unique name for the bucket you are creating
1276
+ * @returns Promise with response containing newly created analytics bucket or error
1277
+ *
1278
+ * @example Create analytics bucket
1279
+ * ```js
1280
+ * const { data, error } = await supabase
1281
+ * .storage
1282
+ * .analytics
1283
+ * .createBucket('analytics-data')
1284
+ * ```
1285
+ *
1286
+ * Response:
1287
+ * ```json
1288
+ * {
1289
+ * "data": {
1290
+ * "name": "analytics-data",
1291
+ * "type": "ANALYTICS",
1292
+ * "format": "iceberg",
1293
+ * "created_at": "2024-05-22T22:26:05.100Z",
1294
+ * "updated_at": "2024-05-22T22:26:05.100Z"
1295
+ * },
1296
+ * "error": null
1297
+ * }
1298
+ * ```
1299
+ */
1300
+ createBucket(name: string): Promise<{
1301
+ data: AnalyticBucket;
1302
+ error: null;
1303
+ } | {
1304
+ data: null;
1305
+ error: StorageError;
1306
+ }>;
1307
+ /**
1308
+ * @alpha
1309
+ *
1310
+ * Retrieves the details of all Analytics Storage buckets within an existing project
1311
+ * Only returns buckets of type 'ANALYTICS'
1312
+ *
1313
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1314
+ *
1315
+ * @category Analytics Buckets
1316
+ * @param options Query parameters for listing buckets
1317
+ * @param options.limit Maximum number of buckets to return
1318
+ * @param options.offset Number of buckets to skip
1319
+ * @param options.sortColumn Column to sort by ('name', 'created_at', 'updated_at')
1320
+ * @param options.sortOrder Sort order ('asc' or 'desc')
1321
+ * @param options.search Search term to filter bucket names
1322
+ * @returns Promise with response containing array of analytics buckets or error
1323
+ *
1324
+ * @example List analytics buckets
1325
+ * ```js
1326
+ * const { data, error } = await supabase
1327
+ * .storage
1328
+ * .analytics
1329
+ * .listBuckets({
1330
+ * limit: 10,
1331
+ * offset: 0,
1332
+ * sortColumn: 'created_at',
1333
+ * sortOrder: 'desc'
1334
+ * })
1335
+ * ```
1336
+ *
1337
+ * Response:
1338
+ * ```json
1339
+ * {
1340
+ * "data": [
1341
+ * {
1342
+ * "name": "analytics-data",
1343
+ * "type": "ANALYTICS",
1344
+ * "format": "iceberg",
1345
+ * "created_at": "2024-05-22T22:26:05.100Z",
1346
+ * "updated_at": "2024-05-22T22:26:05.100Z"
1347
+ * }
1348
+ * ],
1349
+ * "error": null
1350
+ * }
1351
+ * ```
1352
+ */
1353
+ listBuckets(options?: {
1354
+ limit?: number;
1355
+ offset?: number;
1356
+ sortColumn?: 'name' | 'created_at' | 'updated_at';
1357
+ sortOrder?: 'asc' | 'desc';
1358
+ search?: string;
1359
+ }): Promise<{
1360
+ data: AnalyticBucket[];
1361
+ error: null;
1362
+ } | {
1363
+ data: null;
1364
+ error: StorageError;
1365
+ }>;
1366
+ /**
1367
+ * @alpha
1368
+ *
1369
+ * Deletes an existing analytics bucket
1370
+ * A bucket can't be deleted with existing objects inside it
1371
+ * You must first empty the bucket before deletion
1372
+ *
1373
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1374
+ *
1375
+ * @category Analytics Buckets
1376
+ * @param bucketName The unique identifier of the bucket you would like to delete
1377
+ * @returns Promise with response containing success message or error
1378
+ *
1379
+ * @example Delete analytics bucket
1380
+ * ```js
1381
+ * const { data, error } = await supabase
1382
+ * .storage
1383
+ * .analytics
1384
+ * .deleteBucket('analytics-data')
1385
+ * ```
1386
+ *
1387
+ * Response:
1388
+ * ```json
1389
+ * {
1390
+ * "data": {
1391
+ * "message": "Successfully deleted"
1392
+ * },
1393
+ * "error": null
1394
+ * }
1395
+ * ```
1396
+ */
1397
+ deleteBucket(bucketName: string): Promise<{
1398
+ data: {
1399
+ message: string;
1400
+ };
1401
+ error: null;
1402
+ } | {
1403
+ data: null;
1404
+ error: StorageError;
1405
+ }>;
1406
+ /**
1407
+ * @alpha
1408
+ *
1409
+ * Get an Iceberg REST Catalog client configured for a specific analytics bucket
1410
+ * Use this to perform advanced table and namespace operations within the bucket
1411
+ * The returned client provides full access to the Apache Iceberg REST Catalog API
1412
+ * with the Supabase `{ data, error }` pattern for consistent error handling on all operations.
1413
+ *
1414
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1415
+ *
1416
+ * @category Analytics Buckets
1417
+ * @param bucketName - The name of the analytics bucket (warehouse) to connect to
1418
+ * @returns The wrapped Iceberg catalog client
1419
+ * @throws {StorageError} If the bucket name is invalid
1420
+ *
1421
+ * @example Get catalog and create table
1422
+ * ```js
1423
+ * // First, create an analytics bucket
1424
+ * const { data: bucket, error: bucketError } = await supabase
1425
+ * .storage
1426
+ * .analytics
1427
+ * .createBucket('analytics-data')
1428
+ *
1429
+ * // Get the Iceberg catalog for that bucket
1430
+ * const catalog = supabase.storage.analytics.from('analytics-data')
1431
+ *
1432
+ * // Create a namespace
1433
+ * const { error: nsError } = await catalog.createNamespace({ namespace: ['default'] })
1434
+ *
1435
+ * // Create a table with schema
1436
+ * const { data: tableMetadata, error: tableError } = await catalog.createTable(
1437
+ * { namespace: ['default'] },
1438
+ * {
1439
+ * name: 'events',
1440
+ * schema: {
1441
+ * type: 'struct',
1442
+ * fields: [
1443
+ * { id: 1, name: 'id', type: 'long', required: true },
1444
+ * { id: 2, name: 'timestamp', type: 'timestamp', required: true },
1445
+ * { id: 3, name: 'user_id', type: 'string', required: false }
1446
+ * ],
1447
+ * 'schema-id': 0,
1448
+ * 'identifier-field-ids': [1]
1449
+ * },
1450
+ * 'partition-spec': {
1451
+ * 'spec-id': 0,
1452
+ * fields: []
1453
+ * },
1454
+ * 'write-order': {
1455
+ * 'order-id': 0,
1456
+ * fields: []
1457
+ * },
1458
+ * properties: {
1459
+ * 'write.format.default': 'parquet'
1460
+ * }
1461
+ * }
1462
+ * )
1463
+ * ```
1464
+ *
1465
+ * @example List tables in namespace
1466
+ * ```js
1467
+ * const catalog = supabase.storage.analytics.from('analytics-data')
1468
+ *
1469
+ * // List all tables in the default namespace
1470
+ * const { data: tables, error: listError } = await catalog.listTables({ namespace: ['default'] })
1471
+ * if (listError) {
1472
+ * if (listError.isNotFound()) {
1473
+ * console.log('Namespace not found')
1474
+ * }
1475
+ * return
1476
+ * }
1477
+ * console.log(tables) // [{ namespace: ['default'], name: 'events' }]
1478
+ * ```
1479
+ *
1480
+ * @example Working with namespaces
1481
+ * ```js
1482
+ * const catalog = supabase.storage.analytics.from('analytics-data')
1483
+ *
1484
+ * // List all namespaces
1485
+ * const { data: namespaces } = await catalog.listNamespaces()
1486
+ *
1487
+ * // Create namespace with properties
1488
+ * await catalog.createNamespace(
1489
+ * { namespace: ['production'] },
1490
+ * { properties: { owner: 'data-team', env: 'prod' } }
1491
+ * )
1492
+ * ```
1493
+ *
1494
+ * @example Cleanup operations
1495
+ * ```js
1496
+ * const catalog = supabase.storage.analytics.from('analytics-data')
1497
+ *
1498
+ * // Drop table with purge option (removes all data)
1499
+ * const { error: dropError } = await catalog.dropTable(
1500
+ * { namespace: ['default'], name: 'events' },
1501
+ * { purge: true }
1502
+ * )
1503
+ *
1504
+ * if (dropError?.isNotFound()) {
1505
+ * console.log('Table does not exist')
1506
+ * }
1507
+ *
1508
+ * // Drop namespace (must be empty)
1509
+ * await catalog.dropNamespace({ namespace: ['default'] })
1510
+ * ```
1511
+ *
1512
+ * @remarks
1513
+ * This method provides a bridge between Supabase's bucket management and the standard
1514
+ * Apache Iceberg REST Catalog API. The bucket name maps to the Iceberg warehouse parameter.
1515
+ * All authentication and configuration is handled automatically using your Supabase credentials.
1516
+ *
1517
+ * **Error Handling**: Invalid bucket names throw immediately. All catalog
1518
+ * operations return `{ data, error }` where errors are `IcebergError` instances from iceberg-js.
1519
+ * Use helper methods like `error.isNotFound()` or check `error.status` for specific error handling.
1520
+ * Use `.throwOnError()` on the analytics client if you prefer exceptions for catalog operations.
1521
+ *
1522
+ * **Cleanup Operations**: When using `dropTable`, the `purge: true` option permanently
1523
+ * deletes all table data. Without it, the table is marked as deleted but data remains.
1524
+ *
1525
+ * **Library Dependency**: The returned catalog wraps `IcebergRestCatalog` from iceberg-js.
1526
+ * For complete API documentation and advanced usage, refer to the
1527
+ * [iceberg-js documentation](https://supabase.github.io/iceberg-js/).
1528
+ */
1529
+ from(bucketName: string): WrappedIcebergRestCatalog;
1530
+ }
1531
+ //#endregion
1532
+ //#region src/lib/vectors/errors.d.ts
1533
+ /**
1534
+ * Base error class for all Storage Vectors errors
1535
+ */
1536
+ declare class StorageVectorsError extends Error {
1537
+ protected __isStorageVectorsError: boolean;
1538
+ constructor(message: string);
1539
+ }
1540
+ /**
1541
+ * Type guard to check if an error is a StorageVectorsError
1542
+ * @param error - The error to check
1543
+ * @returns True if the error is a StorageVectorsError
1544
+ */
1545
+ declare function isStorageVectorsError(error: unknown): error is StorageVectorsError;
1546
+ /**
1547
+ * API error returned from S3 Vectors service
1548
+ * Includes HTTP status code and service-specific error code
1549
+ */
1550
+ declare class StorageVectorsApiError extends StorageVectorsError {
1551
+ status: number;
1552
+ statusCode: string;
1553
+ constructor(message: string, status: number, statusCode: string);
1554
+ toJSON(): {
1555
+ name: string;
1556
+ message: string;
1557
+ status: number;
1558
+ statusCode: string;
1559
+ };
1560
+ }
1561
+ /**
1562
+ * Unknown error that doesn't match expected error patterns
1563
+ * Wraps the original error for debugging
1564
+ */
1565
+ declare class StorageVectorsUnknownError extends StorageVectorsError {
1566
+ originalError: unknown;
1567
+ constructor(message: string, originalError: unknown);
1568
+ }
1569
+ /**
1570
+ * Error codes specific to S3 Vectors API
1571
+ * Maps AWS service errors to application-friendly error codes
1572
+ */
1573
+ declare enum StorageVectorsErrorCode {
1574
+ /** Internal server fault (HTTP 500) */
1575
+ InternalError = "InternalError",
1576
+ /** Resource already exists / conflict (HTTP 409) */
1577
+ S3VectorConflictException = "S3VectorConflictException",
1578
+ /** Resource not found (HTTP 404) */
1579
+ S3VectorNotFoundException = "S3VectorNotFoundException",
1580
+ /** Delete bucket while not empty (HTTP 400) */
1581
+ S3VectorBucketNotEmpty = "S3VectorBucketNotEmpty",
1582
+ /** Exceeds bucket quota/limit (HTTP 400) */
1583
+ S3VectorMaxBucketsExceeded = "S3VectorMaxBucketsExceeded",
1584
+ /** Exceeds index quota/limit (HTTP 400) */
1585
+ S3VectorMaxIndexesExceeded = "S3VectorMaxIndexesExceeded",
1586
+ }
1587
+ //#endregion
1588
+ //#region src/lib/vectors/types.d.ts
1589
+ /**
1590
+ * Configuration for encryption at rest
1591
+ * @property kmsKeyArn - ARN of the KMS key used for encryption
1592
+ * @property sseType - Server-side encryption type (e.g., 'KMS')
1593
+ */
1594
+ interface EncryptionConfiguration {
1595
+ kmsKeyArn?: string;
1596
+ sseType?: string;
1597
+ }
1598
+ /**
1599
+ * Vector bucket metadata
1600
+ * @property vectorBucketName - Unique name of the vector bucket
1601
+ * @property creationTime - Unix timestamp of when the bucket was created
1602
+ * @property encryptionConfiguration - Optional encryption settings
1603
+ */
1604
+ interface VectorBucket {
1605
+ vectorBucketName: string;
1606
+ creationTime?: number;
1607
+ encryptionConfiguration?: EncryptionConfiguration;
1608
+ }
1609
+ /**
1610
+ * Metadata configuration for vector index
1611
+ * Defines which metadata keys should not be indexed for filtering
1612
+ * @property nonFilterableMetadataKeys - Array of metadata keys that cannot be used in filters
1613
+ */
1614
+ interface MetadataConfiguration {
1615
+ nonFilterableMetadataKeys?: string[];
1616
+ }
1617
+ /**
1618
+ * Supported data types for vectors
1619
+ * Currently only float32 is supported
1620
+ */
1621
+ type VectorDataType = 'float32';
1622
+ /**
1623
+ * Distance metrics for vector similarity search
1624
+ */
1625
+ type DistanceMetric = 'cosine' | 'euclidean' | 'dotproduct';
1626
+ /**
1627
+ * Vector index configuration and metadata
1628
+ * @property indexName - Unique name of the index within the bucket
1629
+ * @property vectorBucketName - Name of the parent vector bucket
1630
+ * @property dataType - Data type of vector components (currently only 'float32')
1631
+ * @property dimension - Dimensionality of vectors (e.g., 384, 768, 1536)
1632
+ * @property distanceMetric - Similarity metric used for queries
1633
+ * @property metadataConfiguration - Configuration for metadata filtering
1634
+ * @property creationTime - Unix timestamp of when the index was created
1635
+ */
1636
+ interface VectorIndex {
1637
+ indexName: string;
1638
+ vectorBucketName: string;
1639
+ dataType: VectorDataType;
1640
+ dimension: number;
1641
+ distanceMetric: DistanceMetric;
1642
+ metadataConfiguration?: MetadataConfiguration;
1643
+ creationTime?: number;
1644
+ }
1645
+ /**
1646
+ * Vector data representation
1647
+ * Vectors must be float32 arrays with dimensions matching the index
1648
+ * @property float32 - Array of 32-bit floating point numbers
1649
+ */
1650
+ interface VectorData {
1651
+ float32: number[];
1652
+ }
1653
+ /**
1654
+ * Arbitrary JSON metadata attached to vectors
1655
+ * Keys configured as non-filterable in the index can be stored but not queried
1656
+ */
1657
+ type VectorMetadata = Record<string, any>;
1658
+ /**
1659
+ * Single vector object for insertion/update
1660
+ * @property key - Unique identifier for the vector
1661
+ * @property data - Vector embedding data
1662
+ * @property metadata - Optional arbitrary metadata
1663
+ */
1664
+ interface VectorObject {
1665
+ key: string;
1666
+ data: VectorData;
1667
+ metadata?: VectorMetadata;
1668
+ }
1669
+ /**
1670
+ * Vector object returned from queries with optional distance
1671
+ * @property key - Unique identifier for the vector
1672
+ * @property data - Vector embedding data (if requested)
1673
+ * @property metadata - Arbitrary metadata (if requested)
1674
+ * @property distance - Similarity distance from query vector (if requested)
1675
+ */
1676
+ interface VectorMatch {
1677
+ key: string;
1678
+ data?: VectorData;
1679
+ metadata?: VectorMetadata;
1680
+ distance?: number;
1681
+ }
1682
+ /**
1683
+ * Options for fetching vector buckets
1684
+ * @property prefix - Filter buckets by name prefix
1685
+ * @property maxResults - Maximum number of results to return (default: 100)
1686
+ * @property nextToken - Token for pagination from previous response
1687
+ */
1688
+ interface ListVectorBucketsOptions {
1689
+ prefix?: string;
1690
+ maxResults?: number;
1691
+ nextToken?: string;
1692
+ }
1693
+ /**
1694
+ * Response from listing vector buckets
1695
+ * @property vectorBuckets - Array of bucket names
1696
+ * @property nextToken - Token for fetching next page (if more results exist)
1697
+ */
1698
+ interface ListVectorBucketsResponse {
1699
+ vectorBuckets: {
1700
+ vectorBucketName: string;
1701
+ }[];
1702
+ nextToken?: string;
1703
+ }
1704
+ /**
1705
+ * Options for listing indexes within a bucket
1706
+ * @property vectorBucketName - Name of the parent vector bucket
1707
+ * @property prefix - Filter indexes by name prefix
1708
+ * @property maxResults - Maximum number of results to return (default: 100)
1709
+ * @property nextToken - Token for pagination from previous response
1710
+ */
1711
+ interface ListIndexesOptions {
1712
+ vectorBucketName: string;
1713
+ prefix?: string;
1714
+ maxResults?: number;
1715
+ nextToken?: string;
1716
+ }
1717
+ /**
1718
+ * Response from listing indexes
1719
+ * @property indexes - Array of index names
1720
+ * @property nextToken - Token for fetching next page (if more results exist)
1721
+ */
1722
+ interface ListIndexesResponse {
1723
+ indexes: {
1724
+ indexName: string;
1725
+ }[];
1726
+ nextToken?: string;
1727
+ }
1728
+ /**
1729
+ * Options for batch reading vectors
1730
+ * @property vectorBucketName - Name of the vector bucket
1731
+ * @property indexName - Name of the index
1732
+ * @property keys - Array of vector keys to retrieve
1733
+ * @property returnData - Whether to include vector data in response
1734
+ * @property returnMetadata - Whether to include metadata in response
1735
+ */
1736
+ interface GetVectorsOptions {
1737
+ vectorBucketName: string;
1738
+ indexName: string;
1739
+ keys: string[];
1740
+ returnData?: boolean;
1741
+ returnMetadata?: boolean;
1742
+ }
1743
+ /**
1744
+ * Response from getting vectors
1745
+ * @property vectors - Array of retrieved vector objects
1746
+ */
1747
+ interface GetVectorsResponse {
1748
+ vectors: VectorMatch[];
1749
+ }
1750
+ /**
1751
+ * Options for batch inserting/updating vectors
1752
+ * @property vectorBucketName - Name of the vector bucket
1753
+ * @property indexName - Name of the index
1754
+ * @property vectors - Array of vectors to insert/upsert (1-500 items)
1755
+ */
1756
+ interface PutVectorsOptions {
1757
+ vectorBucketName: string;
1758
+ indexName: string;
1759
+ vectors: VectorObject[];
1760
+ }
1761
+ /**
1762
+ * Options for batch deleting vectors
1763
+ * @property vectorBucketName - Name of the vector bucket
1764
+ * @property indexName - Name of the index
1765
+ * @property keys - Array of vector keys to delete (1-500 items)
1766
+ */
1767
+ interface DeleteVectorsOptions {
1768
+ vectorBucketName: string;
1769
+ indexName: string;
1770
+ keys: string[];
1771
+ }
1772
+ /**
1773
+ * Options for listing/scanning vectors in an index
1774
+ * Supports parallel scanning via segment configuration
1775
+ * @property vectorBucketName - Name of the vector bucket
1776
+ * @property indexName - Name of the index
1777
+ * @property maxResults - Maximum number of results to return (default: 500, max: 1000)
1778
+ * @property nextToken - Token for pagination from previous response
1779
+ * @property returnData - Whether to include vector data in response
1780
+ * @property returnMetadata - Whether to include metadata in response
1781
+ * @property segmentCount - Total number of parallel segments (1-16)
1782
+ * @property segmentIndex - Zero-based index of this segment (0 to segmentCount-1)
1783
+ */
1784
+ interface ListVectorsOptions {
1785
+ vectorBucketName: string;
1786
+ indexName: string;
1787
+ maxResults?: number;
1788
+ nextToken?: string;
1789
+ returnData?: boolean;
1790
+ returnMetadata?: boolean;
1791
+ segmentCount?: number;
1792
+ segmentIndex?: number;
1793
+ }
1794
+ /**
1795
+ * Response from listing vectors
1796
+ * @property vectors - Array of vector objects
1797
+ * @property nextToken - Token for fetching next page (if more results exist)
1798
+ */
1799
+ interface ListVectorsResponse {
1800
+ vectors: VectorMatch[];
1801
+ nextToken?: string;
1802
+ }
1803
+ /**
1804
+ * JSON filter expression for metadata filtering
1805
+ * Format and syntax depend on the S3 Vectors service implementation
1806
+ */
1807
+ type VectorFilter = Record<string, any>;
1808
+ /**
1809
+ * Options for querying similar vectors (ANN search)
1810
+ * @property vectorBucketName - Name of the vector bucket
1811
+ * @property indexName - Name of the index
1812
+ * @property queryVector - Query vector to find similar vectors
1813
+ * @property topK - Number of nearest neighbors to return (default: 10)
1814
+ * @property filter - Optional JSON filter for metadata
1815
+ * @property returnDistance - Whether to include distance scores
1816
+ * @property returnMetadata - Whether to include metadata in results
1817
+ */
1818
+ interface QueryVectorsOptions {
1819
+ vectorBucketName: string;
1820
+ indexName: string;
1821
+ queryVector: VectorData;
1822
+ topK?: number;
1823
+ filter?: VectorFilter;
1824
+ returnDistance?: boolean;
1825
+ returnMetadata?: boolean;
1826
+ }
1827
+ /**
1828
+ * Response from vector similarity query
1829
+ * @property vectors - Array of similar vectors ordered by distance
1830
+ * @property distanceMetric - The distance metric used for the similarity search
1831
+ */
1832
+ interface QueryVectorsResponse {
1833
+ vectors: VectorMatch[];
1834
+ distanceMetric?: DistanceMetric;
1835
+ }
1836
+ /**
1837
+ * Fetch-specific parameters like abort signals
1838
+ * @property signal - AbortSignal for cancelling requests
1839
+ */
1840
+ interface VectorFetchParameters {
1841
+ signal?: AbortSignal;
1842
+ }
1843
+ /**
1844
+ * Standard response wrapper for successful operations
1845
+ * @property data - Response data of type T
1846
+ * @property error - Null on success
1847
+ */
1848
+ interface SuccessResponse<T> {
1849
+ data: T;
1850
+ error: null;
1851
+ }
1852
+ /**
1853
+ * Standard response wrapper for failed operations
1854
+ * @property data - Null on error
1855
+ * @property error - StorageVectorsError with details
1856
+ */
1857
+ interface ErrorResponse {
1858
+ data: null;
1859
+ error: StorageVectorsError;
1860
+ }
1861
+ /**
1862
+ * Union type for all API responses
1863
+ * Follows the pattern: { data: T, error: null } | { data: null, error: Error }
1864
+ */
1865
+ type ApiResponse<T> = SuccessResponse<T> | ErrorResponse;
1866
+ //#endregion
1867
+ //#region src/lib/vectors/fetch.d.ts
1868
+ type Fetch = typeof fetch;
1869
+ /**
1870
+ * Options for fetch requests
1871
+ * @property headers - Custom HTTP headers
1872
+ * @property noResolveJson - If true, return raw Response instead of parsing JSON
1873
+ */
1874
+ interface FetchOptions {
1875
+ headers?: {
1876
+ [key: string]: string;
1877
+ };
1878
+ noResolveJson?: boolean;
1879
+ }
1880
+ /**
1881
+ * HTTP methods supported by the API
1882
+ */
1883
+ type RequestMethodType = 'GET' | 'POST' | 'PUT' | 'DELETE';
1884
+ //#endregion
1885
+ //#region src/lib/vectors/VectorIndexApi.d.ts
1886
+ /**
1887
+ * @alpha
1888
+ *
1889
+ * Options for creating a vector index
1890
+ *
1891
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
1892
+ */
1893
+ interface CreateIndexOptions {
1894
+ vectorBucketName: string;
1895
+ indexName: string;
1896
+ dataType: VectorDataType;
1897
+ dimension: number;
1898
+ distanceMetric: DistanceMetric;
1899
+ metadataConfiguration?: MetadataConfiguration;
1900
+ }
1901
+ /**
1902
+ * @hidden
1903
+ * Base implementation for vector index operations.
1904
+ * Use {@link VectorBucketScope} via `supabase.storage.vectors.from('bucket')` instead.
1905
+ */
1906
+ declare class VectorIndexApi {
1907
+ protected url: string;
1908
+ protected headers: {
1909
+ [key: string]: string;
1910
+ };
1911
+ protected fetch: Fetch;
1912
+ protected shouldThrowOnError: boolean;
1913
+ /** Creates a new VectorIndexApi instance */
1914
+ constructor(url: string, headers?: {
1915
+ [key: string]: string;
1916
+ }, fetch?: Fetch);
1917
+ /** Enable throwing errors instead of returning them in the response */
1918
+ throwOnError(): this;
1919
+ /** Creates a new vector index within a bucket */
1920
+ createIndex(options: CreateIndexOptions): Promise<ApiResponse<undefined>>;
1921
+ /** Retrieves metadata for a specific vector index */
1922
+ getIndex(vectorBucketName: string, indexName: string): Promise<ApiResponse<{
1923
+ index: VectorIndex;
1924
+ }>>;
1925
+ /** Lists vector indexes within a bucket with optional filtering and pagination */
1926
+ listIndexes(options: ListIndexesOptions): Promise<ApiResponse<ListIndexesResponse>>;
1927
+ /** Deletes a vector index and all its data */
1928
+ deleteIndex(vectorBucketName: string, indexName: string): Promise<ApiResponse<undefined>>;
1929
+ }
1930
+ //#endregion
1931
+ //#region src/lib/vectors/VectorDataApi.d.ts
1932
+ /**
1933
+ * @hidden
1934
+ * Base implementation for vector data operations.
1935
+ * Use {@link VectorIndexScope} via `supabase.storage.vectors.from('bucket').index('idx')` instead.
1936
+ */
1937
+ declare class VectorDataApi {
1938
+ protected url: string;
1939
+ protected headers: {
1940
+ [key: string]: string;
1941
+ };
1942
+ protected fetch: Fetch;
1943
+ protected shouldThrowOnError: boolean;
1944
+ /** Creates a new VectorDataApi instance */
1945
+ constructor(url: string, headers?: {
1946
+ [key: string]: string;
1947
+ }, fetch?: Fetch);
1948
+ /** Enable throwing errors instead of returning them in the response */
1949
+ throwOnError(): this;
1950
+ /** Inserts or updates vectors in batch (1-500 per request) */
1951
+ putVectors(options: PutVectorsOptions): Promise<ApiResponse<undefined>>;
1952
+ /** Retrieves vectors by their keys in batch */
1953
+ getVectors(options: GetVectorsOptions): Promise<ApiResponse<GetVectorsResponse>>;
1954
+ /** Lists vectors in an index with pagination */
1955
+ listVectors(options: ListVectorsOptions): Promise<ApiResponse<ListVectorsResponse>>;
1956
+ /** Queries for similar vectors using approximate nearest neighbor search */
1957
+ queryVectors(options: QueryVectorsOptions): Promise<ApiResponse<QueryVectorsResponse>>;
1958
+ /** Deletes vectors by their keys in batch (1-500 per request) */
1959
+ deleteVectors(options: DeleteVectorsOptions): Promise<ApiResponse<undefined>>;
1960
+ }
1961
+ //#endregion
1962
+ //#region src/lib/vectors/VectorBucketApi.d.ts
1963
+ /**
1964
+ * @hidden
1965
+ * Base implementation for vector bucket operations.
1966
+ * Use {@link StorageVectorsClient} via `supabase.storage.vectors` instead.
1967
+ */
1968
+ declare class VectorBucketApi {
1969
+ protected url: string;
1970
+ protected headers: {
1971
+ [key: string]: string;
1972
+ };
1973
+ protected fetch: Fetch;
1974
+ protected shouldThrowOnError: boolean;
1975
+ /** Creates a new VectorBucketApi instance */
1976
+ constructor(url: string, headers?: {
1977
+ [key: string]: string;
1978
+ }, fetch?: Fetch);
1979
+ /** Enable throwing errors instead of returning them in the response */
1980
+ throwOnError(): this;
1981
+ /** Creates a new vector bucket */
1982
+ createBucket(vectorBucketName: string): Promise<ApiResponse<undefined>>;
1983
+ /** Retrieves metadata for a specific vector bucket */
1984
+ getBucket(vectorBucketName: string): Promise<ApiResponse<{
1985
+ vectorBucket: VectorBucket;
1986
+ }>>;
1987
+ /** Lists vector buckets with optional filtering and pagination */
1988
+ listBuckets(options?: ListVectorBucketsOptions): Promise<ApiResponse<ListVectorBucketsResponse>>;
1989
+ /** Deletes a vector bucket (must be empty first) */
1990
+ deleteBucket(vectorBucketName: string): Promise<ApiResponse<undefined>>;
1991
+ }
1992
+ //#endregion
1993
+ //#region src/lib/vectors/StorageVectorsClient.d.ts
1994
+ /**
1995
+ *
1996
+ * @alpha
1997
+ *
1998
+ * Configuration options for the Storage Vectors client
1999
+ *
2000
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2001
+ */
2002
+ interface StorageVectorsClientOptions {
2003
+ /**
2004
+ * Custom headers to include in all requests
2005
+ */
2006
+ headers?: {
2007
+ [key: string]: string;
2008
+ };
2009
+ /**
2010
+ * Custom fetch implementation (optional)
2011
+ * Useful for testing or custom request handling
2012
+ */
2013
+ fetch?: Fetch;
2014
+ }
2015
+ /**
2016
+ *
2017
+ * @alpha
2018
+ *
2019
+ * Main client for interacting with S3 Vectors API
2020
+ * Provides access to bucket, index, and vector data operations
2021
+ *
2022
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2023
+ *
2024
+ * **Usage Patterns:**
2025
+ *
2026
+ * ```typescript
2027
+ * const { data, error } = await supabase
2028
+ * .storage
2029
+ * .vectors
2030
+ * .createBucket('embeddings-prod')
2031
+ *
2032
+ * // Access index operations via buckets
2033
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2034
+ * await bucket.createIndex({
2035
+ * indexName: 'documents',
2036
+ * dataType: 'float32',
2037
+ * dimension: 1536,
2038
+ * distanceMetric: 'cosine'
2039
+ * })
2040
+ *
2041
+ * // Access vector operations via index
2042
+ * const index = bucket.index('documents')
2043
+ * await index.putVectors({
2044
+ * vectors: [
2045
+ * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } }
2046
+ * ]
2047
+ * })
2048
+ *
2049
+ * // Query similar vectors
2050
+ * const { data } = await index.queryVectors({
2051
+ * queryVector: { float32: [...] },
2052
+ * topK: 5,
2053
+ * returnDistance: true
2054
+ * })
2055
+ * ```
2056
+ */
2057
+ declare class StorageVectorsClient extends VectorBucketApi {
2058
+ /**
2059
+ * @alpha
2060
+ *
2061
+ * Creates a StorageVectorsClient that can manage buckets, indexes, and vectors.
2062
+ *
2063
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2064
+ *
2065
+ * @category Vector Buckets
2066
+ * @param url - Base URL of the Storage Vectors REST API.
2067
+ * @param options.headers - Optional headers (for example `Authorization`) applied to every request.
2068
+ * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes.
2069
+ *
2070
+ * @example
2071
+ * ```typescript
2072
+ * const client = new StorageVectorsClient(url, options)
2073
+ * ```
2074
+ */
2075
+ constructor(url: string, options?: StorageVectorsClientOptions);
2076
+ /**
2077
+ *
2078
+ * @alpha
2079
+ *
2080
+ * Access operations for a specific vector bucket
2081
+ * Returns a scoped client for index and vector operations within the bucket
2082
+ *
2083
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2084
+ *
2085
+ * @category Vector Buckets
2086
+ * @param vectorBucketName - Name of the vector bucket
2087
+ * @returns Bucket-scoped client with index and vector operations
2088
+ *
2089
+ * @example
2090
+ * ```typescript
2091
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2092
+ * ```
2093
+ */
2094
+ from(vectorBucketName: string): VectorBucketScope;
2095
+ /**
2096
+ *
2097
+ * @alpha
2098
+ *
2099
+ * Creates a new vector bucket
2100
+ * Vector buckets are containers for vector indexes and their data
2101
+ *
2102
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2103
+ *
2104
+ * @category Vector Buckets
2105
+ * @param vectorBucketName - Unique name for the vector bucket
2106
+ * @returns Promise with empty response on success or error
2107
+ *
2108
+ * @example
2109
+ * ```typescript
2110
+ * const { data, error } = await supabase
2111
+ * .storage
2112
+ * .vectors
2113
+ * .createBucket('embeddings-prod')
2114
+ * ```
2115
+ */
2116
+ createBucket(vectorBucketName: string): Promise<ApiResponse<undefined>>;
2117
+ /**
2118
+ *
2119
+ * @alpha
2120
+ *
2121
+ * Retrieves metadata for a specific vector bucket
2122
+ *
2123
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2124
+ *
2125
+ * @category Vector Buckets
2126
+ * @param vectorBucketName - Name of the vector bucket
2127
+ * @returns Promise with bucket metadata or error
2128
+ *
2129
+ * @example
2130
+ * ```typescript
2131
+ * const { data, error } = await supabase
2132
+ * .storage
2133
+ * .vectors
2134
+ * .getBucket('embeddings-prod')
2135
+ *
2136
+ * console.log('Bucket created:', data?.vectorBucket.creationTime)
2137
+ * ```
2138
+ */
2139
+ getBucket(vectorBucketName: string): Promise<ApiResponse<{
2140
+ vectorBucket: VectorBucket;
2141
+ }>>;
2142
+ /**
2143
+ *
2144
+ * @alpha
2145
+ *
2146
+ * Lists all vector buckets with optional filtering and pagination
2147
+ *
2148
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2149
+ *
2150
+ * @category Vector Buckets
2151
+ * @param options - Optional filters (prefix, maxResults, nextToken)
2152
+ * @returns Promise with list of buckets or error
2153
+ *
2154
+ * @example
2155
+ * ```typescript
2156
+ * const { data, error } = await supabase
2157
+ * .storage
2158
+ * .vectors
2159
+ * .listBuckets({ prefix: 'embeddings-' })
2160
+ *
2161
+ * data?.vectorBuckets.forEach(bucket => {
2162
+ * console.log(bucket.vectorBucketName)
2163
+ * })
2164
+ * ```
2165
+ */
2166
+ listBuckets(options?: ListVectorBucketsOptions): Promise<ApiResponse<ListVectorBucketsResponse>>;
2167
+ /**
2168
+ *
2169
+ * @alpha
2170
+ *
2171
+ * Deletes a vector bucket (bucket must be empty)
2172
+ * All indexes must be deleted before deleting the bucket
2173
+ *
2174
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2175
+ *
2176
+ * @category Vector Buckets
2177
+ * @param vectorBucketName - Name of the vector bucket to delete
2178
+ * @returns Promise with empty response on success or error
2179
+ *
2180
+ * @example
2181
+ * ```typescript
2182
+ * const { data, error } = await supabase
2183
+ * .storage
2184
+ * .vectors
2185
+ * .deleteBucket('embeddings-old')
2186
+ * ```
2187
+ */
2188
+ deleteBucket(vectorBucketName: string): Promise<ApiResponse<undefined>>;
2189
+ }
2190
+ /**
2191
+ *
2192
+ * @alpha
2193
+ *
2194
+ * Scoped client for operations within a specific vector bucket
2195
+ * Provides index management and access to vector operations
2196
+ *
2197
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2198
+ */
2199
+ declare class VectorBucketScope extends VectorIndexApi {
2200
+ private vectorBucketName;
2201
+ /**
2202
+ * @alpha
2203
+ *
2204
+ * Creates a helper that automatically scopes all index operations to the provided bucket.
2205
+ *
2206
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2207
+ *
2208
+ * @category Vector Buckets
2209
+ * @example
2210
+ * ```typescript
2211
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2212
+ * ```
2213
+ */
2214
+ constructor(url: string, headers: {
2215
+ [key: string]: string;
2216
+ }, vectorBucketName: string, fetch?: Fetch);
2217
+ /**
2218
+ *
2219
+ * @alpha
2220
+ *
2221
+ * Creates a new vector index in this bucket
2222
+ * Convenience method that automatically includes the bucket name
2223
+ *
2224
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2225
+ *
2226
+ * @category Vector Buckets
2227
+ * @param options - Index configuration (vectorBucketName is automatically set)
2228
+ * @returns Promise with empty response on success or error
2229
+ *
2230
+ * @example
2231
+ * ```typescript
2232
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2233
+ * await bucket.createIndex({
2234
+ * indexName: 'documents-openai',
2235
+ * dataType: 'float32',
2236
+ * dimension: 1536,
2237
+ * distanceMetric: 'cosine',
2238
+ * metadataConfiguration: {
2239
+ * nonFilterableMetadataKeys: ['raw_text']
2240
+ * }
2241
+ * })
2242
+ * ```
2243
+ */
2244
+ createIndex(options: Omit<CreateIndexOptions, 'vectorBucketName'>): Promise<ApiResponse<undefined>>;
2245
+ /**
2246
+ *
2247
+ * @alpha
2248
+ *
2249
+ * Lists indexes in this bucket
2250
+ * Convenience method that automatically includes the bucket name
2251
+ *
2252
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2253
+ *
2254
+ * @category Vector Buckets
2255
+ * @param options - Listing options (vectorBucketName is automatically set)
2256
+ * @returns Promise with response containing indexes array and pagination token or error
2257
+ *
2258
+ * @example
2259
+ * ```typescript
2260
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2261
+ * const { data } = await bucket.listIndexes({ prefix: 'documents-' })
2262
+ * ```
2263
+ */
2264
+ listIndexes(options?: Omit<ListIndexesOptions, 'vectorBucketName'>): Promise<ApiResponse<ListIndexesResponse>>;
2265
+ /**
2266
+ *
2267
+ * @alpha
2268
+ *
2269
+ * Retrieves metadata for a specific index in this bucket
2270
+ * Convenience method that automatically includes the bucket name
2271
+ *
2272
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2273
+ *
2274
+ * @category Vector Buckets
2275
+ * @param indexName - Name of the index to retrieve
2276
+ * @returns Promise with index metadata or error
2277
+ *
2278
+ * @example
2279
+ * ```typescript
2280
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2281
+ * const { data } = await bucket.getIndex('documents-openai')
2282
+ * console.log('Dimension:', data?.index.dimension)
2283
+ * ```
2284
+ */
2285
+ getIndex(indexName: string): Promise<ApiResponse<{
2286
+ index: VectorIndex;
2287
+ }>>;
2288
+ /**
2289
+ *
2290
+ * @alpha
2291
+ *
2292
+ * Deletes an index from this bucket
2293
+ * Convenience method that automatically includes the bucket name
2294
+ *
2295
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2296
+ *
2297
+ * @category Vector Buckets
2298
+ * @param indexName - Name of the index to delete
2299
+ * @returns Promise with empty response on success or error
2300
+ *
2301
+ * @example
2302
+ * ```typescript
2303
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2304
+ * await bucket.deleteIndex('old-index')
2305
+ * ```
2306
+ */
2307
+ deleteIndex(indexName: string): Promise<ApiResponse<undefined>>;
2308
+ /**
2309
+ *
2310
+ * @alpha
2311
+ *
2312
+ * Access operations for a specific index within this bucket
2313
+ * Returns a scoped client for vector data operations
2314
+ *
2315
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2316
+ *
2317
+ * @category Vector Buckets
2318
+ * @param indexName - Name of the index
2319
+ * @returns Index-scoped client with vector data operations
2320
+ *
2321
+ * @example
2322
+ * ```typescript
2323
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2324
+ *
2325
+ * // Insert vectors
2326
+ * await index.putVectors({
2327
+ * vectors: [
2328
+ * { key: 'doc-1', data: { float32: [...] }, metadata: { title: 'Intro' } }
2329
+ * ]
2330
+ * })
2331
+ *
2332
+ * // Query similar vectors
2333
+ * const { data } = await index.queryVectors({
2334
+ * queryVector: { float32: [...] },
2335
+ * topK: 5
2336
+ * })
2337
+ * ```
2338
+ */
2339
+ index(indexName: string): VectorIndexScope;
2340
+ }
2341
+ /**
2342
+ *
2343
+ * @alpha
2344
+ *
2345
+ * Scoped client for operations within a specific vector index
2346
+ * Provides vector data operations (put, get, list, query, delete)
2347
+ *
2348
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2349
+ */
2350
+ declare class VectorIndexScope extends VectorDataApi {
2351
+ private vectorBucketName;
2352
+ private indexName;
2353
+ /**
2354
+ *
2355
+ * @alpha
2356
+ *
2357
+ * Creates a helper that automatically scopes all vector operations to the provided bucket/index names.
2358
+ *
2359
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2360
+ *
2361
+ * @category Vector Buckets
2362
+ * @example
2363
+ * ```typescript
2364
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2365
+ * ```
2366
+ */
2367
+ constructor(url: string, headers: {
2368
+ [key: string]: string;
2369
+ }, vectorBucketName: string, indexName: string, fetch?: Fetch);
2370
+ /**
2371
+ *
2372
+ * @alpha
2373
+ *
2374
+ * Inserts or updates vectors in this index
2375
+ * Convenience method that automatically includes bucket and index names
2376
+ *
2377
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2378
+ *
2379
+ * @category Vector Buckets
2380
+ * @param options - Vector insertion options (bucket and index names automatically set)
2381
+ * @returns Promise with empty response on success or error
2382
+ *
2383
+ * @example
2384
+ * ```typescript
2385
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2386
+ * await index.putVectors({
2387
+ * vectors: [
2388
+ * {
2389
+ * key: 'doc-1',
2390
+ * data: { float32: [0.1, 0.2, ...] },
2391
+ * metadata: { title: 'Introduction', page: 1 }
2392
+ * }
2393
+ * ]
2394
+ * })
2395
+ * ```
2396
+ */
2397
+ putVectors(options: Omit<PutVectorsOptions, 'vectorBucketName' | 'indexName'>): Promise<ApiResponse<undefined>>;
2398
+ /**
2399
+ *
2400
+ * @alpha
2401
+ *
2402
+ * Retrieves vectors by keys from this index
2403
+ * Convenience method that automatically includes bucket and index names
2404
+ *
2405
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2406
+ *
2407
+ * @category Vector Buckets
2408
+ * @param options - Vector retrieval options (bucket and index names automatically set)
2409
+ * @returns Promise with response containing vectors array or error
2410
+ *
2411
+ * @example
2412
+ * ```typescript
2413
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2414
+ * const { data } = await index.getVectors({
2415
+ * keys: ['doc-1', 'doc-2'],
2416
+ * returnMetadata: true
2417
+ * })
2418
+ * ```
2419
+ */
2420
+ getVectors(options: Omit<GetVectorsOptions, 'vectorBucketName' | 'indexName'>): Promise<ApiResponse<GetVectorsResponse>>;
2421
+ /**
2422
+ *
2423
+ * @alpha
2424
+ *
2425
+ * Lists vectors in this index with pagination
2426
+ * Convenience method that automatically includes bucket and index names
2427
+ *
2428
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2429
+ *
2430
+ * @category Vector Buckets
2431
+ * @param options - Listing options (bucket and index names automatically set)
2432
+ * @returns Promise with response containing vectors array and pagination token or error
2433
+ *
2434
+ * @example
2435
+ * ```typescript
2436
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2437
+ * const { data } = await index.listVectors({
2438
+ * maxResults: 500,
2439
+ * returnMetadata: true
2440
+ * })
2441
+ * ```
2442
+ */
2443
+ listVectors(options?: Omit<ListVectorsOptions, 'vectorBucketName' | 'indexName'>): Promise<ApiResponse<ListVectorsResponse>>;
2444
+ /**
2445
+ *
2446
+ * @alpha
2447
+ *
2448
+ * Queries for similar vectors in this index
2449
+ * Convenience method that automatically includes bucket and index names
2450
+ *
2451
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2452
+ *
2453
+ * @category Vector Buckets
2454
+ * @param options - Query options (bucket and index names automatically set)
2455
+ * @returns Promise with response containing matches array of similar vectors ordered by distance or error
2456
+ *
2457
+ * @example
2458
+ * ```typescript
2459
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2460
+ * const { data } = await index.queryVectors({
2461
+ * queryVector: { float32: [0.1, 0.2, ...] },
2462
+ * topK: 5,
2463
+ * filter: { category: 'technical' },
2464
+ * returnDistance: true,
2465
+ * returnMetadata: true
2466
+ * })
2467
+ * ```
2468
+ */
2469
+ queryVectors(options: Omit<QueryVectorsOptions, 'vectorBucketName' | 'indexName'>): Promise<ApiResponse<QueryVectorsResponse>>;
2470
+ /**
2471
+ *
2472
+ * @alpha
2473
+ *
2474
+ * Deletes vectors by keys from this index
2475
+ * Convenience method that automatically includes bucket and index names
2476
+ *
2477
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2478
+ *
2479
+ * @category Vector Buckets
2480
+ * @param options - Deletion options (bucket and index names automatically set)
2481
+ * @returns Promise with empty response on success or error
2482
+ *
2483
+ * @example
2484
+ * ```typescript
2485
+ * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2486
+ * await index.deleteVectors({
2487
+ * keys: ['doc-1', 'doc-2', 'doc-3']
2488
+ * })
2489
+ * ```
2490
+ */
2491
+ deleteVectors(options: Omit<DeleteVectorsOptions, 'vectorBucketName' | 'indexName'>): Promise<ApiResponse<undefined>>;
2492
+ }
2493
+ //#endregion
2494
+ //#region src/lib/vectors/helpers.d.ts
2495
+ type Fetch$2 = typeof fetch;
2496
+ /**
2497
+ * Resolves the fetch implementation to use
2498
+ * Uses custom fetch if provided, otherwise uses native fetch
2499
+ *
2500
+ * @param customFetch - Optional custom fetch implementation
2501
+ * @returns Resolved fetch function
2502
+ */
2503
+ declare const resolveFetch: (customFetch?: Fetch$2) => Fetch$2;
2504
+ /**
2505
+ * Resolves the Response constructor to use
2506
+ * Returns native Response constructor
2507
+ *
2508
+ * @returns Response constructor
2509
+ */
2510
+ declare const resolveResponse: () => typeof Response;
2511
+ /**
2512
+ * Determine if input is a plain object
2513
+ * An object is plain if it's created by either {}, new Object(), or Object.create(null)
2514
+ *
2515
+ * @param value - Value to check
2516
+ * @returns True if value is a plain object
2517
+ * @source https://github.com/sindresorhus/is-plain-obj
2518
+ */
2519
+ declare const isPlainObject: (value: object) => boolean;
2520
+ /**
2521
+ * Normalizes a number array to float32 format
2522
+ * Ensures all vector values are valid 32-bit floats
2523
+ *
2524
+ * @param values - Array of numbers to normalize
2525
+ * @returns Normalized float32 array
2526
+ */
2527
+ declare const normalizeToFloat32: (values: number[]) => number[];
2528
+ /**
2529
+ * Validates vector dimensions match expected dimension
2530
+ * Throws error if dimensions don't match
2531
+ *
2532
+ * @param vector - Vector data to validate
2533
+ * @param expectedDimension - Expected vector dimension
2534
+ * @throws Error if dimensions don't match
2535
+ */
2536
+ declare const validateVectorDimension: (vector: {
2537
+ float32: number[];
2538
+ }, expectedDimension?: number) => void;
2539
+ //#endregion
2540
+ //#region src/StorageClient.d.ts
2541
+ interface StorageClientOptions {
2542
+ useNewHostname?: boolean;
2543
+ }
2544
+ declare class StorageClient extends StorageBucketApi {
2545
+ /**
2546
+ * Creates a client for Storage buckets, files, analytics, and vectors.
2547
+ *
2548
+ * @category File Buckets
2549
+ * @example
2550
+ * ```ts
2551
+ * import { StorageClient } from '@supabase/storage-js'
2552
+ *
2553
+ * const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', {
2554
+ * apikey: 'public-anon-key',
2555
+ * })
2556
+ * const avatars = storage.from('avatars')
2557
+ * ```
2558
+ */
2559
+ constructor(url: string, headers?: {
2560
+ [key: string]: string;
2561
+ }, fetch?: Fetch$1, opts?: StorageClientOptions);
2562
+ /**
2563
+ * Perform file operation in a bucket.
2564
+ *
2565
+ * @category File Buckets
2566
+ * @param id The bucket id to operate on.
2567
+ *
2568
+ * @example
2569
+ * ```typescript
2570
+ * const avatars = supabase.storage.from('avatars')
2571
+ * ```
2572
+ */
2573
+ from(id: string): StorageFileApi;
2574
+ /**
2575
+ *
2576
+ * @alpha
2577
+ *
2578
+ * Access vector storage operations.
2579
+ *
2580
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2581
+ *
2582
+ * @category Vector Buckets
2583
+ * @returns A StorageVectorsClient instance configured with the current storage settings.
2584
+ */
2585
+ get vectors(): StorageVectorsClient;
2586
+ /**
2587
+ *
2588
+ * @alpha
2589
+ *
2590
+ * Access analytics storage operations using Iceberg tables.
2591
+ *
2592
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2593
+ *
2594
+ * @category Analytics Buckets
2595
+ * @returns A StorageAnalyticsClient instance configured with the current storage settings.
2596
+ */
2597
+ get analytics(): StorageAnalyticsClient;
2598
+ }
2599
+ //#endregion
2600
+ export { AnalyticBucket, ApiResponse, Bucket, BucketType, Camelize, CreateIndexOptions, DeleteVectorsOptions, DestinationOptions, DistanceMetric, DownloadResult, EncryptionConfiguration, ErrorResponse, Fetch, FetchOptions, FetchParameters, FileObject, FileObjectV2, FileOptions, GetVectorsOptions, GetVectorsResponse, ListBucketOptions, ListIndexesOptions, ListIndexesResponse, ListVectorBucketsOptions, ListVectorBucketsResponse, ListVectorsOptions, ListVectorsResponse, Metadata, MetadataConfiguration, PutVectorsOptions, QueryVectorsOptions, QueryVectorsResponse, RequestMethodType, SearchOptions, SearchV2Folder, SearchV2Object, SearchV2Options, SearchV2Result, SortBy, SortByV2, StorageAnalyticsClient, StorageApiError, StorageClient, type StorageClientOptions, StorageError, StorageUnknownError, StorageVectorsApiError, StorageVectorsClient, StorageVectorsClientOptions, StorageVectorsError, StorageVectorsErrorCode, StorageVectorsUnknownError, SuccessResponse, TransformOptions, VectorBucket, VectorBucketApi, VectorBucketScope, VectorData, VectorDataApi, VectorDataType, VectorFetchParameters, VectorFilter, VectorIndex, VectorIndexApi, VectorIndexScope, VectorMatch, VectorMetadata, VectorObject, isPlainObject, isStorageError, isStorageVectorsError, normalizeToFloat32, resolveFetch, resolveResponse, validateVectorDimension };
2601
+ //# sourceMappingURL=index.d.mts.map