@supabase/storage-js 2.104.0-canary.0 → 2.104.0-canary.2

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.cjs CHANGED
@@ -1,5 +1,71 @@
1
1
  let iceberg_js = require("iceberg-js");
2
2
 
3
+ //#region \0@oxc-project+runtime@0.101.0/helpers/typeof.js
4
+ function _typeof(o) {
5
+ "@babel/helpers - typeof";
6
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
7
+ return typeof o$1;
8
+ } : function(o$1) {
9
+ return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
10
+ }, _typeof(o);
11
+ }
12
+
13
+ //#endregion
14
+ //#region \0@oxc-project+runtime@0.101.0/helpers/toPrimitive.js
15
+ function toPrimitive(t, r) {
16
+ if ("object" != _typeof(t) || !t) return t;
17
+ var e = t[Symbol.toPrimitive];
18
+ if (void 0 !== e) {
19
+ var i = e.call(t, r || "default");
20
+ if ("object" != _typeof(i)) return i;
21
+ throw new TypeError("@@toPrimitive must return a primitive value.");
22
+ }
23
+ return ("string" === r ? String : Number)(t);
24
+ }
25
+
26
+ //#endregion
27
+ //#region \0@oxc-project+runtime@0.101.0/helpers/toPropertyKey.js
28
+ function toPropertyKey(t) {
29
+ var i = toPrimitive(t, "string");
30
+ return "symbol" == _typeof(i) ? i : i + "";
31
+ }
32
+
33
+ //#endregion
34
+ //#region \0@oxc-project+runtime@0.101.0/helpers/defineProperty.js
35
+ function _defineProperty(e, r, t) {
36
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
37
+ value: t,
38
+ enumerable: !0,
39
+ configurable: !0,
40
+ writable: !0
41
+ }) : e[r] = t, e;
42
+ }
43
+
44
+ //#endregion
45
+ //#region \0@oxc-project+runtime@0.101.0/helpers/objectSpread2.js
46
+ function ownKeys(e, r) {
47
+ var t = Object.keys(e);
48
+ if (Object.getOwnPropertySymbols) {
49
+ var o = Object.getOwnPropertySymbols(e);
50
+ r && (o = o.filter(function(r$1) {
51
+ return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
52
+ })), t.push.apply(t, o);
53
+ }
54
+ return t;
55
+ }
56
+ function _objectSpread2(e) {
57
+ for (var r = 1; r < arguments.length; r++) {
58
+ var t = null != arguments[r] ? arguments[r] : {};
59
+ r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
60
+ _defineProperty(e, r$1, t[r$1]);
61
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
62
+ Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
63
+ });
64
+ }
65
+ return e;
66
+ }
67
+
68
+ //#endregion
3
69
  //#region src/lib/common/errors.ts
4
70
  /**
5
71
  * Base error class for all Storage errors
@@ -14,6 +80,14 @@ var StorageError = class extends Error {
14
80
  this.status = status;
15
81
  this.statusCode = statusCode;
16
82
  }
83
+ toJSON() {
84
+ return {
85
+ name: this.name,
86
+ message: this.message,
87
+ status: this.status,
88
+ statusCode: this.statusCode
89
+ };
90
+ }
17
91
  };
18
92
  /**
19
93
  * Type guard to check if an error is a StorageError
@@ -35,12 +109,7 @@ var StorageApiError = class extends StorageError {
35
109
  this.statusCode = statusCode;
36
110
  }
37
111
  toJSON() {
38
- return {
39
- name: this.name,
40
- message: this.message,
41
- status: this.status,
42
- statusCode: this.statusCode
43
- };
112
+ return _objectSpread2({}, super.toJSON());
44
113
  }
45
114
  };
46
115
  /**
@@ -109,6 +178,39 @@ let StorageVectorsErrorCode = /* @__PURE__ */ function(StorageVectorsErrorCode$1
109
178
  return StorageVectorsErrorCode$1;
110
179
  }({});
111
180
 
181
+ //#endregion
182
+ //#region src/lib/common/headers.ts
183
+ /**
184
+ * Sets a header with case-insensitive deduplication.
185
+ * Removes any existing headers whose name matches (case-insensitive),
186
+ * then sets the value under the lowercase key. Does not mutate the input object.
187
+ *
188
+ * @param headers - Existing headers object
189
+ * @param name - Header name to set (stored as lowercase)
190
+ * @param value - Header value
191
+ * @returns New headers object with the header set
192
+ */
193
+ function setHeader(headers, name, value) {
194
+ const result = _objectSpread2({}, headers);
195
+ const nameLower = name.toLowerCase();
196
+ for (const key of Object.keys(result)) if (key.toLowerCase() === nameLower) delete result[key];
197
+ result[nameLower] = value;
198
+ return result;
199
+ }
200
+ /**
201
+ * Normalizes all header keys to lowercase with case-insensitive deduplication.
202
+ * When duplicate keys exist (differing only in case), the last value wins.
203
+ * Does not mutate the input object.
204
+ *
205
+ * @param headers - Headers object to normalize
206
+ * @returns New headers object with all keys lowercased
207
+ */
208
+ function normalizeHeaders(headers) {
209
+ const result = {};
210
+ for (const [key, value] of Object.entries(headers)) result[key.toLowerCase()] = value;
211
+ return result;
212
+ }
213
+
112
214
  //#endregion
113
215
  //#region src/lib/common/helpers.ts
114
216
  /**
@@ -175,72 +277,6 @@ const isValidBucketName = (bucketName) => {
175
277
  return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
176
278
  };
177
279
 
178
- //#endregion
179
- //#region \0@oxc-project+runtime@0.101.0/helpers/typeof.js
180
- function _typeof(o) {
181
- "@babel/helpers - typeof";
182
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
183
- return typeof o$1;
184
- } : function(o$1) {
185
- return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
186
- }, _typeof(o);
187
- }
188
-
189
- //#endregion
190
- //#region \0@oxc-project+runtime@0.101.0/helpers/toPrimitive.js
191
- function toPrimitive(t, r) {
192
- if ("object" != _typeof(t) || !t) return t;
193
- var e = t[Symbol.toPrimitive];
194
- if (void 0 !== e) {
195
- var i = e.call(t, r || "default");
196
- if ("object" != _typeof(i)) return i;
197
- throw new TypeError("@@toPrimitive must return a primitive value.");
198
- }
199
- return ("string" === r ? String : Number)(t);
200
- }
201
-
202
- //#endregion
203
- //#region \0@oxc-project+runtime@0.101.0/helpers/toPropertyKey.js
204
- function toPropertyKey(t) {
205
- var i = toPrimitive(t, "string");
206
- return "symbol" == _typeof(i) ? i : i + "";
207
- }
208
-
209
- //#endregion
210
- //#region \0@oxc-project+runtime@0.101.0/helpers/defineProperty.js
211
- function _defineProperty(e, r, t) {
212
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
213
- value: t,
214
- enumerable: !0,
215
- configurable: !0,
216
- writable: !0
217
- }) : e[r] = t, e;
218
- }
219
-
220
- //#endregion
221
- //#region \0@oxc-project+runtime@0.101.0/helpers/objectSpread2.js
222
- function ownKeys(e, r) {
223
- var t = Object.keys(e);
224
- if (Object.getOwnPropertySymbols) {
225
- var o = Object.getOwnPropertySymbols(e);
226
- r && (o = o.filter(function(r$1) {
227
- return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
228
- })), t.push.apply(t, o);
229
- }
230
- return t;
231
- }
232
- function _objectSpread2(e) {
233
- for (var r = 1; r < arguments.length; r++) {
234
- var t = null != arguments[r] ? arguments[r] : {};
235
- r % 2 ? ownKeys(Object(t), !0).forEach(function(r$1) {
236
- _defineProperty(e, r$1, t[r$1]);
237
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
238
- Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
239
- });
240
- }
241
- return e;
242
- }
243
-
244
280
  //#endregion
245
281
  //#region src/lib/common/fetch.ts
246
282
  /**
@@ -288,7 +324,11 @@ const _getRequestParams = (method, options, parameters, body) => {
288
324
  };
289
325
  if (method === "GET" || method === "HEAD" || !body) return _objectSpread2(_objectSpread2({}, params), parameters);
290
326
  if (isPlainObject(body)) {
291
- params.headers = _objectSpread2({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
327
+ var _contentType;
328
+ const headers = (options === null || options === void 0 ? void 0 : options.headers) || {};
329
+ let contentType;
330
+ for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === "content-type") contentType = value;
331
+ params.headers = setHeader(headers, "Content-Type", (_contentType = contentType) !== null && _contentType !== void 0 ? _contentType : "application/json");
292
332
  params.body = JSON.stringify(body);
293
333
  } else params.body = body;
294
334
  if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex;
@@ -367,7 +407,7 @@ var BaseApiClient = class {
367
407
  constructor(url, headers = {}, fetch$1, namespace = "storage") {
368
408
  this.shouldThrowOnError = false;
369
409
  this.url = url;
370
- this.headers = headers;
410
+ this.headers = normalizeHeaders(headers);
371
411
  this.fetch = resolveFetch(fetch$1);
372
412
  this.namespace = namespace;
373
413
  }
@@ -390,7 +430,7 @@ var BaseApiClient = class {
390
430
  * @returns this - For method chaining
391
431
  */
392
432
  setHeader(name, value) {
393
- this.headers = _objectSpread2(_objectSpread2({}, this.headers), {}, { [name]: value });
433
+ this.headers = setHeader(this.headers, name, value);
394
434
  return this;
395
435
  }
396
436
  /**
@@ -559,7 +599,7 @@ var StorageFileApi = class extends BaseApiClient {
559
599
  if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata));
560
600
  if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
561
601
  }
562
- if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers = _objectSpread2(_objectSpread2({}, headers), fileOptions.headers);
602
+ if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value);
563
603
  const cleanPath = _this._removeEmptyFolders(path);
564
604
  const _path = _this._getFinalPath(cleanPath);
565
605
  const data = await (method == "PUT" ? put : post)(_this.fetch, `${_this.url}/object/${_path}`, body, _objectSpread2({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}));
@@ -892,6 +932,7 @@ var StorageFileApi = class extends BaseApiClient {
892
932
  * @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.
893
933
  * @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.
894
934
  * @param options.transform Transform the asset before serving it to the client.
935
+ * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
895
936
  * @returns Promise with response containing signed URL or error
896
937
  *
897
938
  * @example Create Signed URL
@@ -947,9 +988,11 @@ var StorageFileApi = class extends BaseApiClient {
947
988
  let _path = _this8._getFinalPath(path);
948
989
  const hasTransform = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0;
949
990
  let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread2({ expiresIn }, hasTransform ? { transform: options.transform } : {}), { headers: _this8.headers });
950
- const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
951
- const returnedPath = hasTransform && data.signedURL.includes("/object/sign/") ? data.signedURL.replace("/object/sign/", "/render/image/sign/") : data.signedURL;
952
- return { signedUrl: encodeURI(`${_this8.url}${returnedPath}${downloadQueryParam}`) };
991
+ const query = new URLSearchParams();
992
+ if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
993
+ if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
994
+ const queryString = query.toString();
995
+ return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${queryString ? `&${queryString}` : ""}`) };
953
996
  });
954
997
  }
955
998
  /**
@@ -959,6 +1002,7 @@ var StorageFileApi = class extends BaseApiClient {
959
1002
  * @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`.
960
1003
  * @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.
961
1004
  * @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.
1005
+ * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
962
1006
  * @returns Promise with response containing array of objects with signedUrl, path, and error or error
963
1007
  *
964
1008
  * @example Create Signed URLs
@@ -1003,8 +1047,11 @@ var StorageFileApi = class extends BaseApiClient {
1003
1047
  expiresIn,
1004
1048
  paths
1005
1049
  }, { headers: _this9.headers });
1006
- const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
1007
- return data.map((datum) => _objectSpread2(_objectSpread2({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${downloadQueryParam}`) : null }));
1050
+ const query = new URLSearchParams();
1051
+ if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
1052
+ if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
1053
+ const queryString = query.toString();
1054
+ return data.map((datum) => _objectSpread2(_objectSpread2({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${queryString ? `&${queryString}` : ""}`) : null }));
1008
1055
  });
1009
1056
  }
1010
1057
  /**
@@ -1013,6 +1060,7 @@ var StorageFileApi = class extends BaseApiClient {
1013
1060
  * @category File Buckets
1014
1061
  * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
1015
1062
  * @param options.transform Transform the asset before serving it to the client.
1063
+ * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
1016
1064
  * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
1017
1065
  * @returns BlobDownloadBuilder instance for downloading the file
1018
1066
  *
@@ -1072,11 +1120,13 @@ var StorageFileApi = class extends BaseApiClient {
1072
1120
  * - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
1073
1121
  */
1074
1122
  download(path, options, parameters) {
1075
- const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image/authenticated" : "object";
1076
- const transformationQuery = this.transformOptsToQueryString((options === null || options === void 0 ? void 0 : options.transform) || {});
1077
- const queryString = transformationQuery ? `?${transformationQuery}` : "";
1123
+ const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0 ? "render/image/authenticated" : "object";
1124
+ const query = new URLSearchParams();
1125
+ if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
1126
+ if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
1127
+ const queryString = query.toString();
1078
1128
  const _path = this._getFinalPath(path);
1079
- const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString}`, {
1129
+ const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString ? `?${queryString}` : ""}`, {
1080
1130
  headers: this.headers,
1081
1131
  noResolveJson: true
1082
1132
  }, parameters);
@@ -1157,6 +1207,7 @@ var StorageFileApi = class extends BaseApiClient {
1157
1207
  * @param path The path and name of the file to generate the public URL for. For example `folder/image.png`.
1158
1208
  * @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.
1159
1209
  * @param options.transform Transform the asset before serving it to the client.
1210
+ * @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
1160
1211
  * @returns Object with public URL
1161
1212
  *
1162
1213
  * @example Returns the URL for an asset in a public bucket
@@ -1208,15 +1259,13 @@ var StorageFileApi = class extends BaseApiClient {
1208
1259
  */
1209
1260
  getPublicUrl(path, options) {
1210
1261
  const _path = this._getFinalPath(path);
1211
- const _queryString = [];
1212
- const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `download=${options.download === true ? "" : options.download}` : "";
1213
- if (downloadQueryParam !== "") _queryString.push(downloadQueryParam);
1214
- const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image" : "object";
1215
- const transformationQuery = this.transformOptsToQueryString((options === null || options === void 0 ? void 0 : options.transform) || {});
1216
- if (transformationQuery !== "") _queryString.push(transformationQuery);
1217
- let queryString = _queryString.join("&");
1218
- if (queryString !== "") queryString = `?${queryString}`;
1219
- return { data: { publicUrl: encodeURI(`${this.url}/${renderPath}/public/${_path}${queryString}`) } };
1262
+ const query = new URLSearchParams();
1263
+ if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
1264
+ if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
1265
+ if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
1266
+ const queryString = query.toString();
1267
+ const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0 ? "render/image" : "object";
1268
+ return { data: { publicUrl: encodeURI(`${this.url}/${renderPath}/public/${_path}`) + (queryString ? `?${queryString}` : "") } };
1220
1269
  }
1221
1270
  /**
1222
1271
  * Deletes files within the same bucket
@@ -1419,20 +1468,20 @@ var StorageFileApi = class extends BaseApiClient {
1419
1468
  _removeEmptyFolders(path) {
1420
1469
  return path.replace(/^\/|\/$/g, "").replace(/\/+/g, "/");
1421
1470
  }
1422
- transformOptsToQueryString(transform) {
1423
- const params = [];
1424
- if (transform.width) params.push(`width=${transform.width}`);
1425
- if (transform.height) params.push(`height=${transform.height}`);
1426
- if (transform.resize) params.push(`resize=${transform.resize}`);
1427
- if (transform.format) params.push(`format=${transform.format}`);
1428
- if (transform.quality) params.push(`quality=${transform.quality}`);
1429
- return params.join("&");
1471
+ /** Modifies the `query`, appending values the from `transform` */
1472
+ applyTransformOptsToQuery(query, transform) {
1473
+ if (transform.width) query.set("width", transform.width.toString());
1474
+ if (transform.height) query.set("height", transform.height.toString());
1475
+ if (transform.resize) query.set("resize", transform.resize);
1476
+ if (transform.format) query.set("format", transform.format);
1477
+ if (transform.quality) query.set("quality", transform.quality.toString());
1478
+ return query;
1430
1479
  }
1431
1480
  };
1432
1481
 
1433
1482
  //#endregion
1434
1483
  //#region src/lib/version.ts
1435
- const version = "2.104.0-canary.0";
1484
+ const version = "2.104.0-canary.2";
1436
1485
 
1437
1486
  //#endregion
1438
1487
  //#region src/lib/constants.ts
@@ -1754,8 +1803,18 @@ var StorageAnalyticsClient = class extends BaseApiClient {
1754
1803
  * @param headers - HTTP headers to include in requests
1755
1804
  * @param fetch - Optional custom fetch implementation
1756
1805
  *
1757
- * @example Creating a StorageAnalyticsClient instance
1806
+ * @example Using supabase-js (recommended)
1758
1807
  * ```typescript
1808
+ * import { createClient } from '@supabase/supabase-js'
1809
+ *
1810
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
1811
+ * const { data, error } = await supabase.storage.analytics.listBuckets()
1812
+ * ```
1813
+ *
1814
+ * @example Standalone import for bundle-sensitive environments
1815
+ * ```typescript
1816
+ * import { StorageAnalyticsClient } from '@supabase/storage-js'
1817
+ *
1759
1818
  * const client = new StorageAnalyticsClient(url, headers)
1760
1819
  * ```
1761
1820
  */
@@ -2279,8 +2338,18 @@ var StorageVectorsClient = class extends VectorBucketApi {
2279
2338
  * @param options.headers - Optional headers (for example `Authorization`) applied to every request.
2280
2339
  * @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes.
2281
2340
  *
2282
- * @example Creating a StorageVectorsClient instance
2341
+ * @example Using supabase-js (recommended)
2283
2342
  * ```typescript
2343
+ * import { createClient } from '@supabase/supabase-js'
2344
+ *
2345
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
2346
+ * const bucket = supabase.storage.vectors.from('embeddings-prod')
2347
+ * ```
2348
+ *
2349
+ * @example Standalone import for bundle-sensitive environments
2350
+ * ```typescript
2351
+ * import { StorageVectorsClient } from '@supabase/storage-js'
2352
+ *
2284
2353
  * const client = new StorageVectorsClient(url, options)
2285
2354
  * ```
2286
2355
  */
@@ -2766,12 +2835,20 @@ var StorageClient = class extends StorageBucketApi {
2766
2835
  * Creates a client for Storage buckets, files, analytics, and vectors.
2767
2836
  *
2768
2837
  * @category File Buckets
2769
- * @example Creating a Storage client
2838
+ * @example Using supabase-js (recommended)
2839
+ * ```ts
2840
+ * import { createClient } from '@supabase/supabase-js'
2841
+ *
2842
+ * const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
2843
+ * const avatars = supabase.storage.from('avatars')
2844
+ * ```
2845
+ *
2846
+ * @example Standalone import for bundle-sensitive environments
2770
2847
  * ```ts
2771
2848
  * import { StorageClient } from '@supabase/storage-js'
2772
2849
  *
2773
2850
  * const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', {
2774
- * apikey: 'public-anon-key',
2851
+ * apikey: 'publishable-or-anon-key',
2775
2852
  * })
2776
2853
  * const avatars = storage.from('avatars')
2777
2854
  * ```