@supabase/storage-js 3.0.0-next.1 → 3.0.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -67,7 +67,7 @@ If you're already using `@supabase/supabase-js`, access storage through the clie
67
67
  ```js
68
68
  import { createClient } from '@supabase/supabase-js'
69
69
 
70
- // Use publishable/anon key for frontend applications
70
+ // Use publishable key for frontend applications
71
71
  const supabase = createClient('https://<project_ref>.supabase.co', '<your-publishable-key>')
72
72
 
73
73
  // Access storage
package/dist/index.cjs CHANGED
@@ -710,19 +710,24 @@ var StorageFileApi = class extends BaseApiClient {
710
710
  return _this3.handleOperation(async () => {
711
711
  let body;
712
712
  const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions);
713
- const headers = _objectSpread2(_objectSpread2({}, _this3.headers), { "x-upsert": String(options.upsert) });
713
+ let headers = _objectSpread2(_objectSpread2({}, _this3.headers), { "x-upsert": String(options.upsert) });
714
+ const metadata = options.metadata;
714
715
  if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
715
716
  body = new FormData();
716
717
  body.append("cacheControl", options.cacheControl);
718
+ if (metadata) body.append("metadata", _this3.encodeMetadata(metadata));
717
719
  body.append("", fileBody);
718
720
  } else if (typeof FormData !== "undefined" && fileBody instanceof FormData) {
719
721
  body = fileBody;
720
- body.append("cacheControl", options.cacheControl);
722
+ if (!body.has("cacheControl")) body.append("cacheControl", options.cacheControl);
723
+ if (metadata && !body.has("metadata")) body.append("metadata", _this3.encodeMetadata(metadata));
721
724
  } else {
722
725
  body = fileBody;
723
726
  headers["cache-control"] = `max-age=${options.cacheControl}`;
724
727
  headers["content-type"] = options.contentType;
728
+ if (metadata) headers["x-metadata"] = _this3.toBase64(_this3.encodeMetadata(metadata));
725
729
  }
730
+ if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value);
726
731
  return {
727
732
  path: cleanPath,
728
733
  fullPath: (await put(_this3.fetch, url.toString(), body, { headers })).Key
@@ -1481,7 +1486,7 @@ var StorageFileApi = class extends BaseApiClient {
1481
1486
 
1482
1487
  //#endregion
1483
1488
  //#region src/lib/version.ts
1484
- const version = "3.0.0-next.1";
1489
+ const version = "3.0.0-next.10";
1485
1490
 
1486
1491
  //#endregion
1487
1492
  //#region src/lib/constants.ts
@@ -1807,7 +1812,7 @@ var StorageAnalyticsClient = class extends BaseApiClient {
1807
1812
  * ```typescript
1808
1813
  * import { createClient } from '@supabase/supabase-js'
1809
1814
  *
1810
- * const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
1815
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
1811
1816
  * const { data, error } = await supabase.storage.analytics.listBuckets()
1812
1817
  * ```
1813
1818
  *
@@ -2342,7 +2347,7 @@ var StorageVectorsClient = class extends VectorBucketApi {
2342
2347
  * ```typescript
2343
2348
  * import { createClient } from '@supabase/supabase-js'
2344
2349
  *
2345
- * const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
2350
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
2346
2351
  * const bucket = supabase.storage.vectors.from('embeddings-prod')
2347
2352
  * ```
2348
2353
  *
@@ -2839,7 +2844,7 @@ var StorageClient = class extends StorageBucketApi {
2839
2844
  * ```ts
2840
2845
  * import { createClient } from '@supabase/supabase-js'
2841
2846
  *
2842
- * const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
2847
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
2843
2848
  * const avatars = supabase.storage.from('avatars')
2844
2849
  * ```
2845
2850
  *
@@ -2848,7 +2853,7 @@ var StorageClient = class extends StorageBucketApi {
2848
2853
  * import { StorageClient } from '@supabase/storage-js'
2849
2854
  *
2850
2855
  * const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', {
2851
- * apikey: 'publishable-or-anon-key',
2856
+ * apikey: 'your-publishable-key',
2852
2857
  * })
2853
2858
  * const avatars = storage.from('avatars')
2854
2859
  * ```