@supabase/storage-js 2.100.0 → 2.100.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -407,7 +407,7 @@ var BaseApiClient = class {
407
407
  * @param operation - Async function that performs the API call
408
408
  * @returns Promise with { data, error } tuple
409
409
  *
410
- * @example
410
+ * @example Handling an operation
411
411
  * ```typescript
412
412
  * async listBuckets() {
413
413
  * return this.handleOperation(async () => {
@@ -613,6 +613,13 @@ var StorageFileApi = class extends BaseApiClient {
613
613
  * contentType: 'image/png'
614
614
  * })
615
615
  * ```
616
+ *
617
+ * @remarks
618
+ * - RLS policy permissions required:
619
+ * - `buckets` table permissions: none
620
+ * - `objects` table permissions: only `insert` when you are uploading new files and `select`, `insert` and `update` when you are upserting files
621
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
622
+ * - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Upload file using `ArrayBuffer` from base64 file data instead, see example below.
616
623
  */
617
624
  async upload(path, fileBody, fileOptions) {
618
625
  return this.uploadOrUpdate("POST", path, fileBody, fileOptions);
@@ -647,6 +654,12 @@ var StorageFileApi = class extends BaseApiClient {
647
654
  * "error": null
648
655
  * }
649
656
  * ```
657
+ *
658
+ * @remarks
659
+ * - RLS policy permissions required:
660
+ * - `buckets` table permissions: none
661
+ * - `objects` table permissions: none
662
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
650
663
  */
651
664
  async uploadToSignedUrl(path, token, fileBody, fileOptions) {
652
665
  var _this3 = this;
@@ -656,7 +669,7 @@ var StorageFileApi = class extends BaseApiClient {
656
669
  url.searchParams.set("token", token);
657
670
  return _this3.handleOperation(async () => {
658
671
  let body;
659
- const options = _objectSpread2({ upsert: DEFAULT_FILE_OPTIONS.upsert }, fileOptions);
672
+ const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions);
660
673
  const headers = _objectSpread2(_objectSpread2({}, _this3.headers), { "x-upsert": String(options.upsert) });
661
674
  if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
662
675
  body = new FormData();
@@ -705,6 +718,12 @@ var StorageFileApi = class extends BaseApiClient {
705
718
  * "error": null
706
719
  * }
707
720
  * ```
721
+ *
722
+ * @remarks
723
+ * - RLS policy permissions required:
724
+ * - `buckets` table permissions: none
725
+ * - `objects` table permissions: `insert`
726
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
708
727
  */
709
728
  async createSignedUploadUrl(path, options) {
710
729
  var _this4 = this;
@@ -766,6 +785,13 @@ var StorageFileApi = class extends BaseApiClient {
766
785
  * contentType: 'image/png'
767
786
  * })
768
787
  * ```
788
+ *
789
+ * @remarks
790
+ * - RLS policy permissions required:
791
+ * - `buckets` table permissions: none
792
+ * - `objects` table permissions: `update` and `select`
793
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
794
+ * - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below.
769
795
  */
770
796
  async update(path, fileBody, fileOptions) {
771
797
  return this.uploadOrUpdate("PUT", path, fileBody, fileOptions);
@@ -796,6 +822,12 @@ var StorageFileApi = class extends BaseApiClient {
796
822
  * "error": null
797
823
  * }
798
824
  * ```
825
+ *
826
+ * @remarks
827
+ * - RLS policy permissions required:
828
+ * - `buckets` table permissions: none
829
+ * - `objects` table permissions: `update` and `select`
830
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
799
831
  */
800
832
  async move(fromPath, toPath, options) {
801
833
  var _this6 = this;
@@ -834,6 +866,12 @@ var StorageFileApi = class extends BaseApiClient {
834
866
  * "error": null
835
867
  * }
836
868
  * ```
869
+ *
870
+ * @remarks
871
+ * - RLS policy permissions required:
872
+ * - `buckets` table permissions: none
873
+ * - `objects` table permissions: `insert` and `select`
874
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
837
875
  */
838
876
  async copy(fromPath, toPath, options) {
839
877
  var _this7 = this;
@@ -896,6 +934,12 @@ var StorageFileApi = class extends BaseApiClient {
896
934
  * download: true,
897
935
  * })
898
936
  * ```
937
+ *
938
+ * @remarks
939
+ * - RLS policy permissions required:
940
+ * - `buckets` table permissions: none
941
+ * - `objects` table permissions: `select`
942
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
899
943
  */
900
944
  async createSignedUrl(path, expiresIn, options) {
901
945
  var _this8 = this;
@@ -945,6 +989,12 @@ var StorageFileApi = class extends BaseApiClient {
945
989
  * "error": null
946
990
  * }
947
991
  * ```
992
+ *
993
+ * @remarks
994
+ * - RLS policy permissions required:
995
+ * - `buckets` table permissions: none
996
+ * - `objects` table permissions: `select`
997
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
948
998
  */
949
999
  async createSignedUrls(paths, expiresIn, options) {
950
1000
  var _this9 = this;
@@ -1014,6 +1064,12 @@ var StorageFileApi = class extends BaseApiClient {
1014
1064
  * .from('avatars')
1015
1065
  * .download('folder/avatar1.png', {}, { signal: controller.signal })
1016
1066
  * ```
1067
+ *
1068
+ * @remarks
1069
+ * - RLS policy permissions required:
1070
+ * - `buckets` table permissions: none
1071
+ * - `objects` table permissions: `select`
1072
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1017
1073
  */
1018
1074
  download(path, options, parameters) {
1019
1075
  const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image/authenticated" : "object";
@@ -1142,6 +1198,13 @@ var StorageFileApi = class extends BaseApiClient {
1142
1198
  * download: true,
1143
1199
  * })
1144
1200
  * ```
1201
+ *
1202
+ * @remarks
1203
+ * - The bucket needs to be set to public, either via [updateBucket()](/docs/reference/javascript/storage-updatebucket) or by going to Storage on [supabase.com/dashboard](https://supabase.com/dashboard), clicking the overflow menu on a bucket and choosing "Make public"
1204
+ * - RLS policy permissions required:
1205
+ * - `buckets` table permissions: none
1206
+ * - `objects` table permissions: none
1207
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1145
1208
  */
1146
1209
  getPublicUrl(path, options) {
1147
1210
  const _path = this._getFinalPath(path);
@@ -1180,6 +1243,12 @@ var StorageFileApi = class extends BaseApiClient {
1180
1243
  * "error": null
1181
1244
  * }
1182
1245
  * ```
1246
+ *
1247
+ * @remarks
1248
+ * - RLS policy permissions required:
1249
+ * - `buckets` table permissions: none
1250
+ * - `objects` table permissions: `delete` and `select`
1251
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1183
1252
  */
1184
1253
  async remove(paths) {
1185
1254
  var _this12 = this;
@@ -1233,7 +1302,7 @@ var StorageFileApi = class extends BaseApiClient {
1233
1302
  * })
1234
1303
  * ```
1235
1304
  *
1236
- * Response (file entry):
1305
+ * Response:
1237
1306
  * ```json
1238
1307
  * {
1239
1308
  * "data": [
@@ -1270,6 +1339,12 @@ var StorageFileApi = class extends BaseApiClient {
1270
1339
  * search: 'jon'
1271
1340
  * })
1272
1341
  * ```
1342
+ *
1343
+ * @remarks
1344
+ * - RLS policy permissions required:
1345
+ * - `buckets` table permissions: none
1346
+ * - `objects` table permissions: `select`
1347
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1273
1348
  */
1274
1349
  async list(path, options, parameters) {
1275
1350
  var _this13 = this;
@@ -1357,7 +1432,7 @@ var StorageFileApi = class extends BaseApiClient {
1357
1432
 
1358
1433
  //#endregion
1359
1434
  //#region src/lib/version.ts
1360
- const version = "2.100.0";
1435
+ const version = "2.100.1";
1361
1436
 
1362
1437
  //#endregion
1363
1438
  //#region src/lib/constants.ts
@@ -1406,6 +1481,12 @@ var StorageBucketApi = class extends BaseApiClient {
1406
1481
  * search: 'prod'
1407
1482
  * })
1408
1483
  * ```
1484
+ *
1485
+ * @remarks
1486
+ * - RLS policy permissions required:
1487
+ * - `buckets` table permissions: `select`
1488
+ * - `objects` table permissions: none
1489
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1409
1490
  */
1410
1491
  async listBuckets(options) {
1411
1492
  var _this = this;
@@ -1446,6 +1527,12 @@ var StorageBucketApi = class extends BaseApiClient {
1446
1527
  * "error": null
1447
1528
  * }
1448
1529
  * ```
1530
+ *
1531
+ * @remarks
1532
+ * - RLS policy permissions required:
1533
+ * - `buckets` table permissions: `select`
1534
+ * - `objects` table permissions: none
1535
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1449
1536
  */
1450
1537
  async getBucket(id) {
1451
1538
  var _this2 = this;
@@ -1489,6 +1576,12 @@ var StorageBucketApi = class extends BaseApiClient {
1489
1576
  * "error": null
1490
1577
  * }
1491
1578
  * ```
1579
+ *
1580
+ * @remarks
1581
+ * - RLS policy permissions required:
1582
+ * - `buckets` table permissions: `insert`
1583
+ * - `objects` table permissions: none
1584
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1492
1585
  */
1493
1586
  async createBucket(id, options = { public: false }) {
1494
1587
  var _this3 = this;
@@ -1537,6 +1630,12 @@ var StorageBucketApi = class extends BaseApiClient {
1537
1630
  * "error": null
1538
1631
  * }
1539
1632
  * ```
1633
+ *
1634
+ * @remarks
1635
+ * - RLS policy permissions required:
1636
+ * - `buckets` table permissions: `select` and `update`
1637
+ * - `objects` table permissions: none
1638
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1540
1639
  */
1541
1640
  async updateBucket(id, options) {
1542
1641
  var _this4 = this;
@@ -1573,6 +1672,12 @@ var StorageBucketApi = class extends BaseApiClient {
1573
1672
  * "error": null
1574
1673
  * }
1575
1674
  * ```
1675
+ *
1676
+ * @remarks
1677
+ * - RLS policy permissions required:
1678
+ * - `buckets` table permissions: `select`
1679
+ * - `objects` table permissions: `select` and `delete`
1680
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1576
1681
  */
1577
1682
  async emptyBucket(id) {
1578
1683
  var _this5 = this;
@@ -1604,6 +1709,12 @@ var StorageBucketApi = class extends BaseApiClient {
1604
1709
  * "error": null
1605
1710
  * }
1606
1711
  * ```
1712
+ *
1713
+ * @remarks
1714
+ * - RLS policy permissions required:
1715
+ * - `buckets` table permissions: `select` and `delete`
1716
+ * - `objects` table permissions: none
1717
+ * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1607
1718
  */
1608
1719
  async deleteBucket(id) {
1609
1720
  var _this6 = this;
@@ -1643,7 +1754,7 @@ var StorageAnalyticsClient = class extends BaseApiClient {
1643
1754
  * @param headers - HTTP headers to include in requests
1644
1755
  * @param fetch - Optional custom fetch implementation
1645
1756
  *
1646
- * @example
1757
+ * @example Creating a StorageAnalyticsClient instance
1647
1758
  * ```typescript
1648
1759
  * const client = new StorageAnalyticsClient(url, headers)
1649
1760
  * ```
@@ -1686,6 +1797,10 @@ var StorageAnalyticsClient = class extends BaseApiClient {
1686
1797
  * "error": null
1687
1798
  * }
1688
1799
  * ```
1800
+ *
1801
+ * @remarks
1802
+ * - Creates a new analytics bucket using Iceberg tables
1803
+ * - Analytics buckets are optimized for analytical queries and data processing
1689
1804
  */
1690
1805
  async createBucket(name) {
1691
1806
  var _this = this;
@@ -1738,6 +1853,10 @@ var StorageAnalyticsClient = class extends BaseApiClient {
1738
1853
  * "error": null
1739
1854
  * }
1740
1855
  * ```
1856
+ *
1857
+ * @remarks
1858
+ * - Retrieves the details of all Analytics Storage buckets within an existing project
1859
+ * - Only returns buckets of type 'ANALYTICS'
1741
1860
  */
1742
1861
  async listBuckets(options) {
1743
1862
  var _this2 = this;
@@ -1783,6 +1902,9 @@ var StorageAnalyticsClient = class extends BaseApiClient {
1783
1902
  * "error": null
1784
1903
  * }
1785
1904
  * ```
1905
+ *
1906
+ * @remarks
1907
+ * - Deletes an analytics bucket
1786
1908
  */
1787
1909
  async deleteBucket(bucketName) {
1788
1910
  var _this3 = this;
@@ -2157,7 +2279,7 @@ var StorageVectorsClient = class extends VectorBucketApi {
2157
2279
  * @param options.headers - Optional headers (for example `Authorization`) applied to every request.
2158
2280
  * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes.
2159
2281
  *
2160
- * @example
2282
+ * @example Creating a StorageVectorsClient instance
2161
2283
  * ```typescript
2162
2284
  * const client = new StorageVectorsClient(url, options)
2163
2285
  * ```
@@ -2178,7 +2300,7 @@ var StorageVectorsClient = class extends VectorBucketApi {
2178
2300
  * @param vectorBucketName - Name of the vector bucket
2179
2301
  * @returns Bucket-scoped client with index and vector operations
2180
2302
  *
2181
- * @example
2303
+ * @example Accessing a vector bucket
2182
2304
  * ```typescript
2183
2305
  * const bucket = supabase.storage.vectors.from('embeddings-prod')
2184
2306
  * ```
@@ -2199,7 +2321,7 @@ var StorageVectorsClient = class extends VectorBucketApi {
2199
2321
  * @param vectorBucketName - Unique name for the vector bucket
2200
2322
  * @returns Promise with empty response on success or error
2201
2323
  *
2202
- * @example
2324
+ * @example Creating a vector bucket
2203
2325
  * ```typescript
2204
2326
  * const { data, error } = await supabase
2205
2327
  * .storage
@@ -2223,7 +2345,7 @@ var StorageVectorsClient = class extends VectorBucketApi {
2223
2345
  * @param vectorBucketName - Name of the vector bucket
2224
2346
  * @returns Promise with bucket metadata or error
2225
2347
  *
2226
- * @example
2348
+ * @example Get bucket metadata
2227
2349
  * ```typescript
2228
2350
  * const { data, error } = await supabase
2229
2351
  * .storage
@@ -2249,7 +2371,7 @@ var StorageVectorsClient = class extends VectorBucketApi {
2249
2371
  * @param options - Optional filters (prefix, maxResults, nextToken)
2250
2372
  * @returns Promise with list of buckets or error
2251
2373
  *
2252
- * @example
2374
+ * @example List vector buckets
2253
2375
  * ```typescript
2254
2376
  * const { data, error } = await supabase
2255
2377
  * .storage
@@ -2278,7 +2400,7 @@ var StorageVectorsClient = class extends VectorBucketApi {
2278
2400
  * @param vectorBucketName - Name of the vector bucket to delete
2279
2401
  * @returns Promise with empty response on success or error
2280
2402
  *
2281
- * @example
2403
+ * @example Delete a vector bucket
2282
2404
  * ```typescript
2283
2405
  * const { data, error } = await supabase
2284
2406
  * .storage
@@ -2309,7 +2431,7 @@ var VectorBucketScope = class extends VectorIndexApi {
2309
2431
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2310
2432
  *
2311
2433
  * @category Vector Buckets
2312
- * @example
2434
+ * @example Creating a vector bucket scope
2313
2435
  * ```typescript
2314
2436
  * const bucket = supabase.storage.vectors.from('embeddings-prod')
2315
2437
  * ```
@@ -2331,7 +2453,7 @@ var VectorBucketScope = class extends VectorIndexApi {
2331
2453
  * @param options - Index configuration (vectorBucketName is automatically set)
2332
2454
  * @returns Promise with empty response on success or error
2333
2455
  *
2334
- * @example
2456
+ * @example Creating a vector index
2335
2457
  * ```typescript
2336
2458
  * const bucket = supabase.storage.vectors.from('embeddings-prod')
2337
2459
  * await bucket.createIndex({
@@ -2362,7 +2484,7 @@ var VectorBucketScope = class extends VectorIndexApi {
2362
2484
  * @param options - Listing options (vectorBucketName is automatically set)
2363
2485
  * @returns Promise with response containing indexes array and pagination token or error
2364
2486
  *
2365
- * @example
2487
+ * @example List indexes
2366
2488
  * ```typescript
2367
2489
  * const bucket = supabase.storage.vectors.from('embeddings-prod')
2368
2490
  * const { data } = await bucket.listIndexes({ prefix: 'documents-' })
@@ -2385,7 +2507,7 @@ var VectorBucketScope = class extends VectorIndexApi {
2385
2507
  * @param indexName - Name of the index to retrieve
2386
2508
  * @returns Promise with index metadata or error
2387
2509
  *
2388
- * @example
2510
+ * @example Get index metadata
2389
2511
  * ```typescript
2390
2512
  * const bucket = supabase.storage.vectors.from('embeddings-prod')
2391
2513
  * const { data } = await bucket.getIndex('documents-openai')
@@ -2409,7 +2531,7 @@ var VectorBucketScope = class extends VectorIndexApi {
2409
2531
  * @param indexName - Name of the index to delete
2410
2532
  * @returns Promise with empty response on success or error
2411
2533
  *
2412
- * @example
2534
+ * @example Delete an index
2413
2535
  * ```typescript
2414
2536
  * const bucket = supabase.storage.vectors.from('embeddings-prod')
2415
2537
  * await bucket.deleteIndex('old-index')
@@ -2432,7 +2554,7 @@ var VectorBucketScope = class extends VectorIndexApi {
2432
2554
  * @param indexName - Name of the index
2433
2555
  * @returns Index-scoped client with vector data operations
2434
2556
  *
2435
- * @example
2557
+ * @example Accessing an index
2436
2558
  * ```typescript
2437
2559
  * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2438
2560
  *
@@ -2473,7 +2595,7 @@ var VectorIndexScope = class extends VectorDataApi {
2473
2595
  * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
2474
2596
  *
2475
2597
  * @category Vector Buckets
2476
- * @example
2598
+ * @example Creating a vector index scope
2477
2599
  * ```typescript
2478
2600
  * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2479
2601
  * ```
@@ -2496,7 +2618,7 @@ var VectorIndexScope = class extends VectorDataApi {
2496
2618
  * @param options - Vector insertion options (bucket and index names automatically set)
2497
2619
  * @returns Promise with empty response on success or error
2498
2620
  *
2499
- * @example
2621
+ * @example Insert vectors into an index
2500
2622
  * ```typescript
2501
2623
  * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2502
2624
  * await index.putVectors({
@@ -2530,7 +2652,7 @@ var VectorIndexScope = class extends VectorDataApi {
2530
2652
  * @param options - Vector retrieval options (bucket and index names automatically set)
2531
2653
  * @returns Promise with response containing vectors array or error
2532
2654
  *
2533
- * @example
2655
+ * @example Get vectors by keys
2534
2656
  * ```typescript
2535
2657
  * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2536
2658
  * const { data } = await index.getVectors({
@@ -2559,7 +2681,7 @@ var VectorIndexScope = class extends VectorDataApi {
2559
2681
  * @param options - Listing options (bucket and index names automatically set)
2560
2682
  * @returns Promise with response containing vectors array and pagination token or error
2561
2683
  *
2562
- * @example
2684
+ * @example List vectors with pagination
2563
2685
  * ```typescript
2564
2686
  * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2565
2687
  * const { data } = await index.listVectors({
@@ -2588,7 +2710,7 @@ var VectorIndexScope = class extends VectorDataApi {
2588
2710
  * @param options - Query options (bucket and index names automatically set)
2589
2711
  * @returns Promise with response containing matches array of similar vectors ordered by distance or error
2590
2712
  *
2591
- * @example
2713
+ * @example Query similar vectors
2592
2714
  * ```typescript
2593
2715
  * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2594
2716
  * const { data } = await index.queryVectors({
@@ -2620,7 +2742,7 @@ var VectorIndexScope = class extends VectorDataApi {
2620
2742
  * @param options - Deletion options (bucket and index names automatically set)
2621
2743
  * @returns Promise with empty response on success or error
2622
2744
  *
2623
- * @example
2745
+ * @example Delete vectors by keys
2624
2746
  * ```typescript
2625
2747
  * const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
2626
2748
  * await index.deleteVectors({
@@ -2644,7 +2766,7 @@ var StorageClient = class extends StorageBucketApi {
2644
2766
  * Creates a client for Storage buckets, files, analytics, and vectors.
2645
2767
  *
2646
2768
  * @category File Buckets
2647
- * @example
2769
+ * @example Creating a Storage client
2648
2770
  * ```ts
2649
2771
  * import { StorageClient } from '@supabase/storage-js'
2650
2772
  *
@@ -2663,7 +2785,7 @@ var StorageClient = class extends StorageBucketApi {
2663
2785
  * @category File Buckets
2664
2786
  * @param id The bucket id to operate on.
2665
2787
  *
2666
- * @example
2788
+ * @example Accessing a bucket
2667
2789
  * ```typescript
2668
2790
  * const avatars = supabase.storage.from('avatars')
2669
2791
  * ```