@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
@@ -1,359 +0,0 @@
1
- import { __awaiter } from "tslib";
2
- import { DEFAULT_HEADERS } from '../lib/constants';
3
- import { isStorageError } from '../lib/errors';
4
- import { get, post, put, remove } from '../lib/fetch';
5
- import { resolveFetch } from '../lib/helpers';
6
- export default class StorageBucketApi {
7
- constructor(url, headers = {}, fetch, opts) {
8
- this.shouldThrowOnError = false;
9
- const baseUrl = new URL(url);
10
- // if legacy uri is used, replace with new storage host (disables request buffering to allow > 50GB uploads)
11
- // "project-ref.supabase.co" becomes "project-ref.storage.supabase.co"
12
- if (opts === null || opts === void 0 ? void 0 : opts.useNewHostname) {
13
- const isSupabaseHost = /supabase\.(co|in|red)$/.test(baseUrl.hostname);
14
- if (isSupabaseHost && !baseUrl.hostname.includes('storage.supabase.')) {
15
- baseUrl.hostname = baseUrl.hostname.replace('supabase.', 'storage.supabase.');
16
- }
17
- }
18
- this.url = baseUrl.href.replace(/\/$/, '');
19
- this.headers = Object.assign(Object.assign({}, DEFAULT_HEADERS), headers);
20
- this.fetch = resolveFetch(fetch);
21
- }
22
- /**
23
- * Enable throwing errors instead of returning them.
24
- *
25
- * @category File Buckets
26
- */
27
- throwOnError() {
28
- this.shouldThrowOnError = true;
29
- return this;
30
- }
31
- /**
32
- * Retrieves the details of all Storage buckets within an existing project.
33
- *
34
- * @category File Buckets
35
- * @param options Query parameters for listing buckets
36
- * @param options.limit Maximum number of buckets to return
37
- * @param options.offset Number of buckets to skip
38
- * @param options.sortColumn Column to sort by ('id', 'name', 'created_at', 'updated_at')
39
- * @param options.sortOrder Sort order ('asc' or 'desc')
40
- * @param options.search Search term to filter bucket names
41
- * @returns Promise with response containing array of buckets or error
42
- *
43
- * @example List buckets
44
- * ```js
45
- * const { data, error } = await supabase
46
- * .storage
47
- * .listBuckets()
48
- * ```
49
- *
50
- * @example List buckets with options
51
- * ```js
52
- * const { data, error } = await supabase
53
- * .storage
54
- * .listBuckets({
55
- * limit: 10,
56
- * offset: 0,
57
- * sortColumn: 'created_at',
58
- * sortOrder: 'desc',
59
- * search: 'prod'
60
- * })
61
- * ```
62
- */
63
- listBuckets(options) {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- try {
66
- const queryString = this.listBucketOptionsToQueryString(options);
67
- const data = yield get(this.fetch, `${this.url}/bucket${queryString}`, {
68
- headers: this.headers,
69
- });
70
- return { data, error: null };
71
- }
72
- catch (error) {
73
- if (this.shouldThrowOnError) {
74
- throw error;
75
- }
76
- if (isStorageError(error)) {
77
- return { data: null, error };
78
- }
79
- throw error;
80
- }
81
- });
82
- }
83
- /**
84
- * Retrieves the details of an existing Storage bucket.
85
- *
86
- * @category File Buckets
87
- * @param id The unique identifier of the bucket you would like to retrieve.
88
- * @returns Promise with response containing bucket details or error
89
- *
90
- * @example Get bucket
91
- * ```js
92
- * const { data, error } = await supabase
93
- * .storage
94
- * .getBucket('avatars')
95
- * ```
96
- *
97
- * Response:
98
- * ```json
99
- * {
100
- * "data": {
101
- * "id": "avatars",
102
- * "name": "avatars",
103
- * "owner": "",
104
- * "public": false,
105
- * "file_size_limit": 1024,
106
- * "allowed_mime_types": [
107
- * "image/png"
108
- * ],
109
- * "created_at": "2024-05-22T22:26:05.100Z",
110
- * "updated_at": "2024-05-22T22:26:05.100Z"
111
- * },
112
- * "error": null
113
- * }
114
- * ```
115
- */
116
- getBucket(id) {
117
- return __awaiter(this, void 0, void 0, function* () {
118
- try {
119
- const data = yield get(this.fetch, `${this.url}/bucket/${id}`, { headers: this.headers });
120
- return { data, error: null };
121
- }
122
- catch (error) {
123
- if (this.shouldThrowOnError) {
124
- throw error;
125
- }
126
- if (isStorageError(error)) {
127
- return { data: null, error };
128
- }
129
- throw error;
130
- }
131
- });
132
- }
133
- /**
134
- * Creates a new Storage bucket
135
- *
136
- * @category File Buckets
137
- * @param id A unique identifier for the bucket you are creating.
138
- * @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.
139
- * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
140
- * The global file size limit takes precedence over this value.
141
- * The default value is null, which doesn't set a per bucket file size limit.
142
- * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
143
- * The default value is null, which allows files with all mime types to be uploaded.
144
- * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
145
- * @param options.type (private-beta) specifies the bucket type. see `BucketType` for more details.
146
- * - default bucket type is `STANDARD`
147
- * @returns Promise with response containing newly created bucket name or error
148
- *
149
- * @example Create bucket
150
- * ```js
151
- * const { data, error } = await supabase
152
- * .storage
153
- * .createBucket('avatars', {
154
- * public: false,
155
- * allowedMimeTypes: ['image/png'],
156
- * fileSizeLimit: 1024
157
- * })
158
- * ```
159
- *
160
- * Response:
161
- * ```json
162
- * {
163
- * "data": {
164
- * "name": "avatars"
165
- * },
166
- * "error": null
167
- * }
168
- * ```
169
- */
170
- createBucket(id_1) {
171
- return __awaiter(this, arguments, void 0, function* (id, options = {
172
- public: false,
173
- }) {
174
- try {
175
- const data = yield post(this.fetch, `${this.url}/bucket`, {
176
- id,
177
- name: id,
178
- type: options.type,
179
- public: options.public,
180
- file_size_limit: options.fileSizeLimit,
181
- allowed_mime_types: options.allowedMimeTypes,
182
- }, { headers: this.headers });
183
- return { data, error: null };
184
- }
185
- catch (error) {
186
- if (this.shouldThrowOnError) {
187
- throw error;
188
- }
189
- if (isStorageError(error)) {
190
- return { data: null, error };
191
- }
192
- throw error;
193
- }
194
- });
195
- }
196
- /**
197
- * Updates a Storage bucket
198
- *
199
- * @category File Buckets
200
- * @param id A unique identifier for the bucket you are updating.
201
- * @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.
202
- * @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
203
- * The global file size limit takes precedence over this value.
204
- * The default value is null, which doesn't set a per bucket file size limit.
205
- * @param options.allowedMimeTypes specifies the allowed mime types that this bucket can accept during upload.
206
- * The default value is null, which allows files with all mime types to be uploaded.
207
- * Each mime type specified can be a wildcard, e.g. image/*, or a specific mime type, e.g. image/png.
208
- * @returns Promise with response containing success message or error
209
- *
210
- * @example Update bucket
211
- * ```js
212
- * const { data, error } = await supabase
213
- * .storage
214
- * .updateBucket('avatars', {
215
- * public: false,
216
- * allowedMimeTypes: ['image/png'],
217
- * fileSizeLimit: 1024
218
- * })
219
- * ```
220
- *
221
- * Response:
222
- * ```json
223
- * {
224
- * "data": {
225
- * "message": "Successfully updated"
226
- * },
227
- * "error": null
228
- * }
229
- * ```
230
- */
231
- updateBucket(id, options) {
232
- return __awaiter(this, void 0, void 0, function* () {
233
- try {
234
- const data = yield put(this.fetch, `${this.url}/bucket/${id}`, {
235
- id,
236
- name: id,
237
- public: options.public,
238
- file_size_limit: options.fileSizeLimit,
239
- allowed_mime_types: options.allowedMimeTypes,
240
- }, { headers: this.headers });
241
- return { data, error: null };
242
- }
243
- catch (error) {
244
- if (this.shouldThrowOnError) {
245
- throw error;
246
- }
247
- if (isStorageError(error)) {
248
- return { data: null, error };
249
- }
250
- throw error;
251
- }
252
- });
253
- }
254
- /**
255
- * Removes all objects inside a single bucket.
256
- *
257
- * @category File Buckets
258
- * @param id The unique identifier of the bucket you would like to empty.
259
- * @returns Promise with success message or error
260
- *
261
- * @example Empty bucket
262
- * ```js
263
- * const { data, error } = await supabase
264
- * .storage
265
- * .emptyBucket('avatars')
266
- * ```
267
- *
268
- * Response:
269
- * ```json
270
- * {
271
- * "data": {
272
- * "message": "Successfully emptied"
273
- * },
274
- * "error": null
275
- * }
276
- * ```
277
- */
278
- emptyBucket(id) {
279
- return __awaiter(this, void 0, void 0, function* () {
280
- try {
281
- const data = yield post(this.fetch, `${this.url}/bucket/${id}/empty`, {}, { headers: this.headers });
282
- return { data, error: null };
283
- }
284
- catch (error) {
285
- if (this.shouldThrowOnError) {
286
- throw error;
287
- }
288
- if (isStorageError(error)) {
289
- return { data: null, error };
290
- }
291
- throw error;
292
- }
293
- });
294
- }
295
- /**
296
- * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
297
- * You must first `empty()` the bucket.
298
- *
299
- * @category File Buckets
300
- * @param id The unique identifier of the bucket you would like to delete.
301
- * @returns Promise with success message or error
302
- *
303
- * @example Delete bucket
304
- * ```js
305
- * const { data, error } = await supabase
306
- * .storage
307
- * .deleteBucket('avatars')
308
- * ```
309
- *
310
- * Response:
311
- * ```json
312
- * {
313
- * "data": {
314
- * "message": "Successfully deleted"
315
- * },
316
- * "error": null
317
- * }
318
- * ```
319
- */
320
- deleteBucket(id) {
321
- return __awaiter(this, void 0, void 0, function* () {
322
- try {
323
- const data = yield remove(this.fetch, `${this.url}/bucket/${id}`, {}, { headers: this.headers });
324
- return { data, error: null };
325
- }
326
- catch (error) {
327
- if (this.shouldThrowOnError) {
328
- throw error;
329
- }
330
- if (isStorageError(error)) {
331
- return { data: null, error };
332
- }
333
- throw error;
334
- }
335
- });
336
- }
337
- listBucketOptionsToQueryString(options) {
338
- const params = {};
339
- if (options) {
340
- if ('limit' in options) {
341
- params.limit = String(options.limit);
342
- }
343
- if ('offset' in options) {
344
- params.offset = String(options.offset);
345
- }
346
- if (options.search) {
347
- params.search = options.search;
348
- }
349
- if (options.sortColumn) {
350
- params.sortColumn = options.sortColumn;
351
- }
352
- if (options.sortOrder) {
353
- params.sortOrder = options.sortOrder;
354
- }
355
- }
356
- return Object.keys(params).length > 0 ? '?' + new URLSearchParams(params).toString() : '';
357
- }
358
- }
359
- //# sourceMappingURL=StorageBucketApi.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"StorageBucketApi.js","sourceRoot":"","sources":["../../../src/packages/StorageBucketApi.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,cAAc,EAAgB,MAAM,eAAe,CAAA;AAC5D,OAAO,EAAS,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAI7C,MAAM,CAAC,OAAO,OAAO,gBAAgB;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