@cupcodev/ui 1.2.7 → 1.2.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/dist/index.cjs CHANGED
@@ -1202,6 +1202,7 @@ var import_react7 = require("react");
1202
1202
  var import_react6 = require("react");
1203
1203
 
1204
1204
  // src/lib/runtimeEnv.ts
1205
+ var import_meta = {};
1205
1206
  var runtimeStore = {};
1206
1207
  var normalizeValue = (value) => {
1207
1208
  if (value === null || typeof value === "undefined") return void 0;
@@ -1227,6 +1228,14 @@ var readFromProcessEnv = (key) => {
1227
1228
  const processEnv = (_a72 = globalThis.process) == null ? void 0 : _a72.env;
1228
1229
  return normalizeValue(processEnv == null ? void 0 : processEnv[key]);
1229
1230
  };
1231
+ var readFromImportMetaEnv = (key) => {
1232
+ try {
1233
+ const importMetaEnv = import_meta.env;
1234
+ return normalizeValue(importMetaEnv == null ? void 0 : importMetaEnv[key]);
1235
+ } catch (e) {
1236
+ return void 0;
1237
+ }
1238
+ };
1230
1239
  var getRuntimeEnv = (key) => {
1231
1240
  var _a72;
1232
1241
  const normalizedKey = key.trim();
@@ -1237,6 +1246,8 @@ var getRuntimeEnv = (key) => {
1237
1246
  if (fromGlobalStore) return fromGlobalStore;
1238
1247
  const fromGlobalKey = normalizeValue(globalThis[normalizedKey]);
1239
1248
  if (fromGlobalKey) return fromGlobalKey;
1249
+ const fromImportMetaEnv = readFromImportMetaEnv(normalizedKey);
1250
+ if (fromImportMetaEnv) return fromImportMetaEnv;
1240
1251
  return readFromProcessEnv(normalizedKey);
1241
1252
  };
1242
1253
  var getRuntimeEnvOr = (key, fallback) => {
@@ -2744,8 +2755,8 @@ var NavbarCupcode = ({
2744
2755
  {
2745
2756
  ref: navRef,
2746
2757
  className: cn(
2747
- "fixed top-0 left-0 right-0 z-[200] pointer-events-auto",
2748
- "glass border-b border-border",
2758
+ "fixed left-2 right-2 top-[max(env(safe-area-inset-top),0.75rem)] z-[200] overflow-hidden rounded-2xl",
2759
+ "glass border-border/70 shadow-[var(--elevation-3)] md:left-4 md:right-4",
2749
2760
  className
2750
2761
  ),
2751
2762
  children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "cc-container", children: [
@@ -2815,7 +2826,7 @@ var NavbarCupcode = ({
2815
2826
  "div",
2816
2827
  {
2817
2828
  id: mobileMenuId,
2818
- className: "md:hidden max-h-[calc(100dvh-4rem)] space-y-3 overflow-y-auto border-t border-border/60 py-4 animate-slide-up",
2829
+ className: "md:hidden max-h-[calc(100dvh-5rem)] space-y-3 overflow-y-auto border-t border-border/60 py-4 animate-slide-up",
2819
2830
  children: [
2820
2831
  items.map((item, index) => {
2821
2832
  const key = `${item.label}-${index}`;
@@ -8445,7 +8456,7 @@ var UserMenuCupcode = ({
8445
8456
  "button",
8446
8457
  {
8447
8458
  type: "button",
8448
- className: "absolute -bottom-0.5 -right-0.5 inline-flex h-6 w-6 items-center justify-center rounded-full border border-border/70 bg-background/85 transition-all hover:bg-background",
8459
+ className: "absolute bottom-0 -right-0.5 inline-flex items-center justify-center rounded-full p-0.5 transition-transform hover:scale-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
8449
8460
  "aria-label": "Alterar status",
8450
8461
  title: "Alterar status",
8451
8462
  children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PresenceBadge, { status: currentStatus, size: "lg" })
@@ -10252,10 +10263,10 @@ var UserMenuCupcode = ({
10252
10263
  "button",
10253
10264
  {
10254
10265
  type: "button",
10255
- className: "absolute -bottom-1 -right-1 z-20 inline-flex h-6 w-6 items-center justify-center rounded-full border border-border/70 bg-background/95 text-foreground shadow-[var(--elevation-2)] transition-all hover:bg-background",
10266
+ className: "absolute bottom-0 -right-0.5 z-20 inline-flex items-center justify-center rounded-full p-0.5 text-foreground transition-transform hover:scale-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40",
10256
10267
  "aria-label": "Alterar status",
10257
10268
  title: `Status: ${PRESENCE_META[currentStatus].label}`,
10258
- children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PresenceBadge, { status: currentStatus, size: "sm" })
10269
+ children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(PresenceBadge, { status: currentStatus, size: "md" })
10259
10270
  }
10260
10271
  ) }),
10261
10272
  /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(DropdownMenuContent, { align: "end", sideOffset: 8, className: "z-[1800] w-44", children: renderPresenceStatusOptions() })
@@ -10402,7 +10413,7 @@ var getMainNavItems = () => [
10402
10413
  }
10403
10414
  ];
10404
10415
 
10405
- // node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
10416
+ // node_modules/tslib/tslib.es6.mjs
10406
10417
  function __rest(s, e) {
10407
10418
  var t = {};
10408
10419
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -10442,7 +10453,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
10442
10453
  });
10443
10454
  }
10444
10455
 
10445
- // node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/helper.js
10456
+ // node_modules/@supabase/functions-js/dist/module/helper.js
10446
10457
  var resolveFetch = (customFetch) => {
10447
10458
  if (customFetch) {
10448
10459
  return (...args) => customFetch(...args);
@@ -10450,7 +10461,7 @@ var resolveFetch = (customFetch) => {
10450
10461
  return (...args) => fetch(...args);
10451
10462
  };
10452
10463
 
10453
- // node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/types.js
10464
+ // node_modules/@supabase/functions-js/dist/module/types.js
10454
10465
  var FunctionsError = class extends Error {
10455
10466
  constructor(message, name = "FunctionsError", context) {
10456
10467
  super(message);
@@ -10492,7 +10503,7 @@ var FunctionRegion;
10492
10503
  FunctionRegion2["UsWest2"] = "us-west-2";
10493
10504
  })(FunctionRegion || (FunctionRegion = {}));
10494
10505
 
10495
- // node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
10506
+ // node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
10496
10507
  var FunctionsClient = class {
10497
10508
  /**
10498
10509
  * Creates a new Functions client bound to an Edge Functions URL.
@@ -10632,7 +10643,7 @@ var FunctionsClient = class {
10632
10643
  }
10633
10644
  };
10634
10645
 
10635
- // node_modules/.pnpm/@supabase+postgrest-js@2.95.1/node_modules/@supabase/postgrest-js/dist/index.mjs
10646
+ // node_modules/@supabase/postgrest-js/dist/index.mjs
10636
10647
  var PostgrestError = class extends Error {
10637
10648
  /**
10638
10649
  * @example
@@ -10670,7 +10681,7 @@ var PostgrestBuilder = class {
10670
10681
  * ```
10671
10682
  */
10672
10683
  constructor(builder) {
10673
- var _builder$shouldThrowO, _builder$isMaybeSingl, _builder$urlLengthLim;
10684
+ var _builder$shouldThrowO, _builder$isMaybeSingl;
10674
10685
  this.shouldThrowOnError = false;
10675
10686
  this.method = builder.method;
10676
10687
  this.url = builder.url;
@@ -10680,7 +10691,6 @@ var PostgrestBuilder = class {
10680
10691
  this.shouldThrowOnError = (_builder$shouldThrowO = builder.shouldThrowOnError) !== null && _builder$shouldThrowO !== void 0 ? _builder$shouldThrowO : false;
10681
10692
  this.signal = builder.signal;
10682
10693
  this.isMaybeSingle = (_builder$isMaybeSingl = builder.isMaybeSingle) !== null && _builder$isMaybeSingl !== void 0 ? _builder$isMaybeSingl : false;
10683
- this.urlLengthLimit = (_builder$urlLengthLim = builder.urlLengthLimit) !== null && _builder$urlLengthLim !== void 0 ? _builder$urlLengthLim : 8e3;
10684
10694
  if (builder.fetch) this.fetch = builder.fetch;
10685
10695
  else this.fetch = fetch;
10686
10696
  }
@@ -10781,8 +10791,6 @@ var PostgrestBuilder = class {
10781
10791
  if (!this.shouldThrowOnError) res = res.catch((fetchError) => {
10782
10792
  var _fetchError$name2;
10783
10793
  let errorDetails = "";
10784
- let hint = "";
10785
- let code = "";
10786
10794
  const cause = fetchError === null || fetchError === void 0 ? void 0 : fetchError.cause;
10787
10795
  if (cause) {
10788
10796
  var _cause$message, _cause$code, _fetchError$name, _cause$name;
@@ -10799,22 +10807,12 @@ ${cause.stack}`;
10799
10807
  var _fetchError$stack;
10800
10808
  errorDetails = (_fetchError$stack = fetchError === null || fetchError === void 0 ? void 0 : fetchError.stack) !== null && _fetchError$stack !== void 0 ? _fetchError$stack : "";
10801
10809
  }
10802
- const urlLength = this.url.toString().length;
10803
- if ((fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) === "AbortError" || (fetchError === null || fetchError === void 0 ? void 0 : fetchError.code) === "ABORT_ERR") {
10804
- code = "";
10805
- hint = "Request was aborted (timeout or manual cancellation)";
10806
- if (urlLength > this.urlLengthLimit) hint += `. Note: Your request URL is ${urlLength} characters, which may exceed server limits. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [many IDs])), consider using an RPC function to pass values server-side.`;
10807
- } else if ((cause === null || cause === void 0 ? void 0 : cause.name) === "HeadersOverflowError" || (cause === null || cause === void 0 ? void 0 : cause.code) === "UND_ERR_HEADERS_OVERFLOW") {
10808
- code = "";
10809
- hint = "HTTP headers exceeded server limits (typically 16KB)";
10810
- if (urlLength > this.urlLengthLimit) hint += `. Your request URL is ${urlLength} characters. If selecting many fields, consider using views. If filtering with large arrays (e.g., .in('id', [200+ IDs])), consider using an RPC function instead.`;
10811
- }
10812
10810
  return {
10813
10811
  error: {
10814
10812
  message: `${(_fetchError$name2 = fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) !== null && _fetchError$name2 !== void 0 ? _fetchError$name2 : "FetchError"}: ${fetchError === null || fetchError === void 0 ? void 0 : fetchError.message}`,
10815
10813
  details: errorDetails,
10816
- hint,
10817
- code
10814
+ hint: "",
10815
+ code: ""
10818
10816
  },
10819
10817
  data: null,
10820
10818
  count: null,
@@ -11456,12 +11454,11 @@ var PostgrestQueryBuilder = class {
11456
11454
  * )
11457
11455
  * ```
11458
11456
  */
11459
- constructor(url, { headers = {}, schema, fetch: fetch$1, urlLengthLimit = 8e3 }) {
11457
+ constructor(url, { headers = {}, schema, fetch: fetch$1 }) {
11460
11458
  this.url = url;
11461
11459
  this.headers = new Headers(headers);
11462
11460
  this.schema = schema;
11463
11461
  this.fetch = fetch$1;
11464
- this.urlLengthLimit = urlLengthLimit;
11465
11462
  }
11466
11463
  /**
11467
11464
  * Clone URL and headers to prevent shared state between operations.
@@ -11492,10 +11489,6 @@ var PostgrestQueryBuilder = class {
11492
11489
  *
11493
11490
  * `"estimated"`: Uses exact count for low numbers and planned count for high
11494
11491
  * numbers.
11495
- *
11496
- * @remarks
11497
- * When using `count` with `.range()` or `.limit()`, the returned `count` is the total number of rows
11498
- * that match your filters, not the number of rows in the current page. Use this to build pagination UI.
11499
11492
  */
11500
11493
  select(columns, options) {
11501
11494
  const { head: head2 = false, count: count2 } = options !== null && options !== void 0 ? options : {};
@@ -11514,8 +11507,7 @@ var PostgrestQueryBuilder = class {
11514
11507
  url,
11515
11508
  headers,
11516
11509
  schema: this.schema,
11517
- fetch: this.fetch,
11518
- urlLengthLimit: this.urlLengthLimit
11510
+ fetch: this.fetch
11519
11511
  });
11520
11512
  }
11521
11513
  /**
@@ -11563,8 +11555,7 @@ var PostgrestQueryBuilder = class {
11563
11555
  headers,
11564
11556
  schema: this.schema,
11565
11557
  body: values,
11566
- fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
11567
- urlLengthLimit: this.urlLengthLimit
11558
+ fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
11568
11559
  });
11569
11560
  }
11570
11561
  /**
@@ -11673,8 +11664,7 @@ var PostgrestQueryBuilder = class {
11673
11664
  headers,
11674
11665
  schema: this.schema,
11675
11666
  body: values,
11676
- fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch,
11677
- urlLengthLimit: this.urlLengthLimit
11667
+ fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch
11678
11668
  });
11679
11669
  }
11680
11670
  /**
@@ -11709,8 +11699,7 @@ var PostgrestQueryBuilder = class {
11709
11699
  headers,
11710
11700
  schema: this.schema,
11711
11701
  body: values,
11712
- fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch,
11713
- urlLengthLimit: this.urlLengthLimit
11702
+ fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch
11714
11703
  });
11715
11704
  }
11716
11705
  /**
@@ -11742,62 +11731,10 @@ var PostgrestQueryBuilder = class {
11742
11731
  url,
11743
11732
  headers,
11744
11733
  schema: this.schema,
11745
- fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch,
11746
- urlLengthLimit: this.urlLengthLimit
11734
+ fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch
11747
11735
  });
11748
11736
  }
11749
11737
  };
11750
- function _typeof(o) {
11751
- "@babel/helpers - typeof";
11752
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
11753
- return typeof o$1;
11754
- } : function(o$1) {
11755
- return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
11756
- }, _typeof(o);
11757
- }
11758
- function toPrimitive(t, r) {
11759
- if ("object" != _typeof(t) || !t) return t;
11760
- var e = t[Symbol.toPrimitive];
11761
- if (void 0 !== e) {
11762
- var i = e.call(t, r || "default");
11763
- if ("object" != _typeof(i)) return i;
11764
- throw new TypeError("@@toPrimitive must return a primitive value.");
11765
- }
11766
- return ("string" === r ? String : Number)(t);
11767
- }
11768
- function toPropertyKey(t) {
11769
- var i = toPrimitive(t, "string");
11770
- return "symbol" == _typeof(i) ? i : i + "";
11771
- }
11772
- function _defineProperty(e, r, t) {
11773
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
11774
- value: t,
11775
- enumerable: true,
11776
- configurable: true,
11777
- writable: true
11778
- }) : e[r] = t, e;
11779
- }
11780
- function ownKeys(e, r) {
11781
- var t = Object.keys(e);
11782
- if (Object.getOwnPropertySymbols) {
11783
- var o = Object.getOwnPropertySymbols(e);
11784
- r && (o = o.filter(function(r$1) {
11785
- return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
11786
- })), t.push.apply(t, o);
11787
- }
11788
- return t;
11789
- }
11790
- function _objectSpread2(e) {
11791
- for (var r = 1; r < arguments.length; r++) {
11792
- var t = null != arguments[r] ? arguments[r] : {};
11793
- r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
11794
- _defineProperty(e, r$1, t[r$1]);
11795
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
11796
- Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
11797
- });
11798
- }
11799
- return e;
11800
- }
11801
11738
  var PostgrestClient = class PostgrestClient2 {
11802
11739
  /**
11803
11740
  * Creates a PostgREST client.
@@ -11807,8 +11744,6 @@ var PostgrestClient = class PostgrestClient2 {
11807
11744
  * @param options.headers - Custom headers
11808
11745
  * @param options.schema - Postgres schema to switch to
11809
11746
  * @param options.fetch - Custom fetch
11810
- * @param options.timeout - Optional timeout in milliseconds for all requests. When set, requests will automatically abort after this duration to prevent indefinite hangs.
11811
- * @param options.urlLengthLimit - Maximum URL length in characters before warnings/errors are triggered. Defaults to 8000.
11812
11747
  * @example
11813
11748
  * ```ts
11814
11749
  * import PostgrestClient from '@supabase/postgrest-js'
@@ -11816,38 +11751,14 @@ var PostgrestClient = class PostgrestClient2 {
11816
11751
  * const postgrest = new PostgrestClient('https://xyzcompany.supabase.co/rest/v1', {
11817
11752
  * headers: { apikey: 'public-anon-key' },
11818
11753
  * schema: 'public',
11819
- * timeout: 30000, // 30 second timeout
11820
11754
  * })
11821
11755
  * ```
11822
11756
  */
11823
- constructor(url, { headers = {}, schema, fetch: fetch$1, timeout, urlLengthLimit = 8e3 } = {}) {
11757
+ constructor(url, { headers = {}, schema, fetch: fetch$1 } = {}) {
11824
11758
  this.url = url;
11825
11759
  this.headers = new Headers(headers);
11826
11760
  this.schemaName = schema;
11827
- this.urlLengthLimit = urlLengthLimit;
11828
- const originalFetch = fetch$1 !== null && fetch$1 !== void 0 ? fetch$1 : globalThis.fetch;
11829
- if (timeout !== void 0 && timeout > 0) this.fetch = (input, init) => {
11830
- const controller = new AbortController();
11831
- const timeoutId = setTimeout(() => controller.abort(), timeout);
11832
- const existingSignal = init === null || init === void 0 ? void 0 : init.signal;
11833
- if (existingSignal) {
11834
- if (existingSignal.aborted) {
11835
- clearTimeout(timeoutId);
11836
- return originalFetch(input, init);
11837
- }
11838
- const abortHandler = () => {
11839
- clearTimeout(timeoutId);
11840
- controller.abort();
11841
- };
11842
- existingSignal.addEventListener("abort", abortHandler, { once: true });
11843
- return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => {
11844
- clearTimeout(timeoutId);
11845
- existingSignal.removeEventListener("abort", abortHandler);
11846
- });
11847
- }
11848
- return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => clearTimeout(timeoutId));
11849
- };
11850
- else this.fetch = originalFetch;
11761
+ this.fetch = fetch$1;
11851
11762
  }
11852
11763
  /**
11853
11764
  * Perform a query on a table or a view.
@@ -11859,8 +11770,7 @@ var PostgrestClient = class PostgrestClient2 {
11859
11770
  return new PostgrestQueryBuilder(new URL(`${this.url}/${relation}`), {
11860
11771
  headers: new Headers(this.headers),
11861
11772
  schema: this.schemaName,
11862
- fetch: this.fetch,
11863
- urlLengthLimit: this.urlLengthLimit
11773
+ fetch: this.fetch
11864
11774
  });
11865
11775
  }
11866
11776
  /**
@@ -11874,8 +11784,7 @@ var PostgrestClient = class PostgrestClient2 {
11874
11784
  return new PostgrestClient2(this.url, {
11875
11785
  headers: this.headers,
11876
11786
  schema,
11877
- fetch: this.fetch,
11878
- urlLengthLimit: this.urlLengthLimit
11787
+ fetch: this.fetch
11879
11788
  });
11880
11789
  }
11881
11790
  /**
@@ -11938,13 +11847,12 @@ var PostgrestClient = class PostgrestClient2 {
11938
11847
  headers,
11939
11848
  schema: this.schemaName,
11940
11849
  body,
11941
- fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
11942
- urlLengthLimit: this.urlLengthLimit
11850
+ fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
11943
11851
  });
11944
11852
  }
11945
11853
  };
11946
11854
 
11947
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
11855
+ // node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
11948
11856
  var WebSocketFactory = class {
11949
11857
  /**
11950
11858
  * Static-only utility – prevent instantiation.
@@ -12060,10 +11968,10 @@ Suggested solution: ${env.workaround}`;
12060
11968
  };
12061
11969
  var websocket_factory_default = WebSocketFactory;
12062
11970
 
12063
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/version.js
12064
- var version = "2.95.1";
11971
+ // node_modules/@supabase/realtime-js/dist/module/lib/version.js
11972
+ var version = "2.91.0";
12065
11973
 
12066
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/constants.js
11974
+ // node_modules/@supabase/realtime-js/dist/module/lib/constants.js
12067
11975
  var DEFAULT_VERSION = `realtime-js/${version}`;
12068
11976
  var VSN_1_0_0 = "1.0.0";
12069
11977
  var VSN_2_0_0 = "2.0.0";
@@ -12107,7 +12015,7 @@ var CONNECTION_STATE;
12107
12015
  CONNECTION_STATE2["Closed"] = "closed";
12108
12016
  })(CONNECTION_STATE || (CONNECTION_STATE = {}));
12109
12017
 
12110
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
12018
+ // node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
12111
12019
  var Serializer = class {
12112
12020
  constructor(allowedMetadataKeys) {
12113
12021
  this.HEADER_LENGTH = 1;
@@ -12247,7 +12155,7 @@ var Serializer = class {
12247
12155
  }
12248
12156
  };
12249
12157
 
12250
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/timer.js
12158
+ // node_modules/@supabase/realtime-js/dist/module/lib/timer.js
12251
12159
  var Timer = class {
12252
12160
  constructor(callback, timerCalc) {
12253
12161
  this.callback = callback;
@@ -12272,7 +12180,7 @@ var Timer = class {
12272
12180
  }
12273
12181
  };
12274
12182
 
12275
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
12183
+ // node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
12276
12184
  var PostgresTypes;
12277
12185
  (function(PostgresTypes2) {
12278
12186
  PostgresTypes2["abstime"] = "abstime";
@@ -12435,7 +12343,7 @@ var httpEndpointURL = (socketUrl) => {
12435
12343
  return wsUrl.href;
12436
12344
  };
12437
12345
 
12438
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/push.js
12346
+ // node_modules/@supabase/realtime-js/dist/module/lib/push.js
12439
12347
  var Push = class {
12440
12348
  /**
12441
12349
  * Initializes the Push
@@ -12534,7 +12442,7 @@ var Push = class {
12534
12442
  }
12535
12443
  };
12536
12444
 
12537
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
12445
+ // node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
12538
12446
  var REALTIME_PRESENCE_LISTEN_EVENTS;
12539
12447
  (function(REALTIME_PRESENCE_LISTEN_EVENTS2) {
12540
12448
  REALTIME_PRESENCE_LISTEN_EVENTS2["SYNC"] = "sync";
@@ -12766,7 +12674,7 @@ var RealtimePresence = class _RealtimePresence {
12766
12674
  }
12767
12675
  };
12768
12676
 
12769
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
12677
+ // node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
12770
12678
  var REALTIME_POSTGRES_CHANGES_LISTEN_EVENT;
12771
12679
  (function(REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2) {
12772
12680
  REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2["ALL"] = "*";
@@ -13206,15 +13114,15 @@ var RealtimeChannel = class _RealtimeChannel {
13206
13114
  }).map((bind) => bind.callback(handledPayload, ref));
13207
13115
  } else {
13208
13116
  (_b6 = this.bindings[typeLower]) === null || _b6 === void 0 ? void 0 : _b6.filter((bind) => {
13209
- var _a73, _b7, _c, _d, _e, _f;
13117
+ var _a73, _b7, _c, _d, _e, _f, _g, _h;
13210
13118
  if (["broadcast", "presence", "postgres_changes"].includes(typeLower)) {
13211
13119
  if ("id" in bind) {
13212
13120
  const bindId = bind.id;
13213
13121
  const bindEvent = (_a73 = bind.filter) === null || _a73 === void 0 ? void 0 : _a73.event;
13214
- return bindId && ((_b7 = payload.ids) === null || _b7 === void 0 ? void 0 : _b7.includes(bindId)) && (bindEvent === "*" || (bindEvent === null || bindEvent === void 0 ? void 0 : bindEvent.toLocaleLowerCase()) === ((_c = payload.data) === null || _c === void 0 ? void 0 : _c.type.toLocaleLowerCase()));
13122
+ return bindId && ((_b7 = payload.ids) === null || _b7 === void 0 ? void 0 : _b7.includes(bindId)) && (bindEvent === "*" || (bindEvent === null || bindEvent === void 0 ? void 0 : bindEvent.toLocaleLowerCase()) === ((_c = payload.data) === null || _c === void 0 ? void 0 : _c.type.toLocaleLowerCase())) && (!((_d = bind.filter) === null || _d === void 0 ? void 0 : _d.table) || bind.filter.table === ((_e = payload.data) === null || _e === void 0 ? void 0 : _e.table));
13215
13123
  } else {
13216
- const bindEvent = (_e = (_d = bind === null || bind === void 0 ? void 0 : bind.filter) === null || _d === void 0 ? void 0 : _d.event) === null || _e === void 0 ? void 0 : _e.toLocaleLowerCase();
13217
- return bindEvent === "*" || bindEvent === ((_f = payload === null || payload === void 0 ? void 0 : payload.event) === null || _f === void 0 ? void 0 : _f.toLocaleLowerCase());
13124
+ const bindEvent = (_g = (_f = bind === null || bind === void 0 ? void 0 : bind.filter) === null || _f === void 0 ? void 0 : _f.event) === null || _g === void 0 ? void 0 : _g.toLocaleLowerCase();
13125
+ return bindEvent === "*" || bindEvent === ((_h = payload === null || payload === void 0 ? void 0 : payload.event) === null || _h === void 0 ? void 0 : _h.toLocaleLowerCase());
13218
13126
  }
13219
13127
  } else {
13220
13128
  return bind.type.toLocaleLowerCase() === typeLower;
@@ -13362,7 +13270,7 @@ var RealtimeChannel = class _RealtimeChannel {
13362
13270
  }
13363
13271
  };
13364
13272
 
13365
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
13273
+ // node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
13366
13274
  var noop2 = () => {
13367
13275
  };
13368
13276
  var CONNECTION_TIMEOUTS = {
@@ -13548,9 +13456,6 @@ Option 2: Install and provide the "ws" package:
13548
13456
  */
13549
13457
  async removeChannel(channel) {
13550
13458
  const status = await channel.unsubscribe();
13551
- if (status === "ok") {
13552
- this._remove(channel);
13553
- }
13554
13459
  if (this.channels.length === 0) {
13555
13460
  this.disconnect();
13556
13461
  }
@@ -13941,11 +13846,6 @@ Option 2: Install and provide the "ws" package:
13941
13846
  this.log("transport", `${error}`);
13942
13847
  this._triggerChanError();
13943
13848
  this._triggerStateCallbacks("error", error);
13944
- try {
13945
- this.heartbeatCallback("error");
13946
- } catch (e) {
13947
- this.log("error", "error in heartbeat callback", e);
13948
- }
13949
13849
  }
13950
13850
  /** @internal */
13951
13851
  _triggerChanError() {
@@ -14123,7 +14023,7 @@ Option 2: Install and provide the "ws" package:
14123
14023
  }
14124
14024
  };
14125
14025
 
14126
- // node_modules/.pnpm/iceberg-js@0.8.1/node_modules/iceberg-js/dist/index.mjs
14026
+ // node_modules/iceberg-js/dist/index.mjs
14127
14027
  var IcebergError = class extends Error {
14128
14028
  constructor(message, opts) {
14129
14029
  var _a72;
@@ -14661,24 +14561,21 @@ var IcebergRestCatalog = class {
14661
14561
  }
14662
14562
  };
14663
14563
 
14664
- // node_modules/.pnpm/@supabase+storage-js@2.95.1/node_modules/@supabase/storage-js/dist/index.mjs
14564
+ // node_modules/@supabase/storage-js/dist/index.mjs
14665
14565
  var StorageError = class extends Error {
14666
- constructor(message, namespace = "storage", status, statusCode) {
14566
+ constructor(message) {
14667
14567
  super(message);
14668
14568
  this.__isStorageError = true;
14669
- this.namespace = namespace;
14670
- this.name = namespace === "vectors" ? "StorageVectorsError" : "StorageError";
14671
- this.status = status;
14672
- this.statusCode = statusCode;
14569
+ this.name = "StorageError";
14673
14570
  }
14674
14571
  };
14675
14572
  function isStorageError(error) {
14676
14573
  return typeof error === "object" && error !== null && "__isStorageError" in error;
14677
14574
  }
14678
14575
  var StorageApiError = class extends StorageError {
14679
- constructor(message, status, statusCode, namespace = "storage") {
14680
- super(message, namespace, status, statusCode);
14681
- this.name = namespace === "vectors" ? "StorageVectorsApiError" : "StorageApiError";
14576
+ constructor(message, status, statusCode) {
14577
+ super(message);
14578
+ this.name = "StorageApiError";
14682
14579
  this.status = status;
14683
14580
  this.statusCode = statusCode;
14684
14581
  }
@@ -14692,20 +14589,18 @@ var StorageApiError = class extends StorageError {
14692
14589
  }
14693
14590
  };
14694
14591
  var StorageUnknownError = class extends StorageError {
14695
- constructor(message, originalError, namespace = "storage") {
14696
- super(message, namespace);
14697
- this.name = namespace === "vectors" ? "StorageVectorsUnknownError" : "StorageUnknownError";
14592
+ constructor(message, originalError) {
14593
+ super(message);
14594
+ this.name = "StorageUnknownError";
14698
14595
  this.originalError = originalError;
14699
14596
  }
14700
14597
  };
14701
- var resolveFetch2 = (customFetch) => {
14598
+ var resolveFetch$1 = (customFetch) => {
14702
14599
  if (customFetch) return (...args) => customFetch(...args);
14703
14600
  return (...args) => fetch(...args);
14704
14601
  };
14705
- var isPlainObject = (value) => {
14706
- if (typeof value !== "object" || value === null) return false;
14707
- const prototype = Object.getPrototypeOf(value);
14708
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
14602
+ var resolveResponse$1 = () => {
14603
+ return Response;
14709
14604
  };
14710
14605
  var recursiveToCamel = (item) => {
14711
14606
  if (Array.isArray(item)) return item.map((el) => recursiveToCamel(el));
@@ -14717,6 +14612,11 @@ var recursiveToCamel = (item) => {
14717
14612
  });
14718
14613
  return result;
14719
14614
  };
14615
+ var isPlainObject$1 = (value) => {
14616
+ if (typeof value !== "object" || value === null) return false;
14617
+ const prototype = Object.getPrototypeOf(value);
14618
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
14619
+ };
14720
14620
  var isValidBucketName = (bucketName) => {
14721
14621
  if (!bucketName || typeof bucketName !== "string") return false;
14722
14622
  if (bucketName.length === 0 || bucketName.length > 100) return false;
@@ -14724,37 +14624,37 @@ var isValidBucketName = (bucketName) => {
14724
14624
  if (bucketName.includes("/") || bucketName.includes("\\")) return false;
14725
14625
  return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
14726
14626
  };
14727
- function _typeof2(o) {
14627
+ function _typeof(o) {
14728
14628
  "@babel/helpers - typeof";
14729
- return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
14629
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
14730
14630
  return typeof o$1;
14731
14631
  } : function(o$1) {
14732
14632
  return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
14733
- }, _typeof2(o);
14633
+ }, _typeof(o);
14734
14634
  }
14735
- function toPrimitive2(t, r) {
14736
- if ("object" != _typeof2(t) || !t) return t;
14635
+ function toPrimitive(t, r) {
14636
+ if ("object" != _typeof(t) || !t) return t;
14737
14637
  var e = t[Symbol.toPrimitive];
14738
14638
  if (void 0 !== e) {
14739
14639
  var i = e.call(t, r || "default");
14740
- if ("object" != _typeof2(i)) return i;
14640
+ if ("object" != _typeof(i)) return i;
14741
14641
  throw new TypeError("@@toPrimitive must return a primitive value.");
14742
14642
  }
14743
14643
  return ("string" === r ? String : Number)(t);
14744
14644
  }
14745
- function toPropertyKey2(t) {
14746
- var i = toPrimitive2(t, "string");
14747
- return "symbol" == _typeof2(i) ? i : i + "";
14645
+ function toPropertyKey(t) {
14646
+ var i = toPrimitive(t, "string");
14647
+ return "symbol" == _typeof(i) ? i : i + "";
14748
14648
  }
14749
- function _defineProperty2(e, r, t) {
14750
- return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
14649
+ function _defineProperty(e, r, t) {
14650
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
14751
14651
  value: t,
14752
14652
  enumerable: true,
14753
14653
  configurable: true,
14754
14654
  writable: true
14755
14655
  }) : e[r] = t, e;
14756
14656
  }
14757
- function ownKeys2(e, r) {
14657
+ function ownKeys(e, r) {
14758
14658
  var t = Object.keys(e);
14759
14659
  if (Object.getOwnPropertySymbols) {
14760
14660
  var o = Object.getOwnPropertySymbols(e);
@@ -14764,159 +14664,68 @@ function ownKeys2(e, r) {
14764
14664
  }
14765
14665
  return t;
14766
14666
  }
14767
- function _objectSpread22(e) {
14667
+ function _objectSpread2(e) {
14768
14668
  for (var r = 1; r < arguments.length; r++) {
14769
14669
  var t = null != arguments[r] ? arguments[r] : {};
14770
- r % 2 ? ownKeys2(Object(t), true).forEach(function(r$1) {
14771
- _defineProperty2(e, r$1, t[r$1]);
14772
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r$1) {
14670
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
14671
+ _defineProperty(e, r$1, t[r$1]);
14672
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
14773
14673
  Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
14774
14674
  });
14775
14675
  }
14776
14676
  return e;
14777
14677
  }
14778
- var _getErrorMessage = (err) => {
14678
+ var _getErrorMessage$1 = (err) => {
14779
14679
  var _err$error;
14780
14680
  return err.msg || err.message || err.error_description || (typeof err.error === "string" ? err.error : (_err$error = err.error) === null || _err$error === void 0 ? void 0 : _err$error.message) || JSON.stringify(err);
14781
14681
  };
14782
- var handleError = async (error, reject, options, namespace) => {
14783
- if (error && typeof error === "object" && "status" in error && "ok" in error && typeof error.status === "number" && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) {
14784
- const responseError = error;
14785
- const status = responseError.status || 500;
14786
- if (typeof responseError.json === "function") responseError.json().then((err) => {
14787
- const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
14788
- reject(new StorageApiError(_getErrorMessage(err), status, statusCode, namespace));
14789
- }).catch(() => {
14790
- if (namespace === "vectors") {
14791
- const statusCode = status + "";
14792
- reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
14793
- } else {
14794
- const statusCode = status + "";
14795
- reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
14796
- }
14797
- });
14798
- else {
14799
- const statusCode = status + "";
14800
- reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
14801
- }
14802
- } else reject(new StorageUnknownError(_getErrorMessage(error), error, namespace));
14682
+ var handleError$1 = async (error, reject, options) => {
14683
+ if (error instanceof await resolveResponse$1() && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) error.json().then((err) => {
14684
+ const status = error.status || 500;
14685
+ const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || status + "";
14686
+ reject(new StorageApiError(_getErrorMessage$1(err), status, statusCode));
14687
+ }).catch((err) => {
14688
+ reject(new StorageUnknownError(_getErrorMessage$1(err), err));
14689
+ });
14690
+ else reject(new StorageUnknownError(_getErrorMessage$1(error), error));
14803
14691
  };
14804
- var _getRequestParams = (method, options, parameters, body) => {
14692
+ var _getRequestParams$1 = (method, options, parameters, body) => {
14805
14693
  const params = {
14806
14694
  method,
14807
14695
  headers: (options === null || options === void 0 ? void 0 : options.headers) || {}
14808
14696
  };
14809
- if (method === "GET" || method === "HEAD" || !body) return _objectSpread22(_objectSpread22({}, params), parameters);
14810
- if (isPlainObject(body)) {
14811
- params.headers = _objectSpread22({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
14697
+ if (method === "GET" || !body) return params;
14698
+ if (isPlainObject$1(body)) {
14699
+ params.headers = _objectSpread2({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
14812
14700
  params.body = JSON.stringify(body);
14813
14701
  } else params.body = body;
14814
14702
  if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex;
14815
- return _objectSpread22(_objectSpread22({}, params), parameters);
14703
+ return _objectSpread2(_objectSpread2({}, params), parameters);
14816
14704
  };
14817
- async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) {
14705
+ async function _handleRequest$1(fetcher, method, url, options, parameters, body) {
14818
14706
  return new Promise((resolve, reject) => {
14819
- fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
14707
+ fetcher(url, _getRequestParams$1(method, options, parameters, body)).then((result) => {
14820
14708
  if (!result.ok) throw result;
14821
14709
  if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
14822
- if (namespace === "vectors") {
14823
- const contentType = result.headers.get("content-type");
14824
- if (result.headers.get("content-length") === "0" || result.status === 204) return {};
14825
- if (!contentType || !contentType.includes("application/json")) return {};
14826
- }
14827
14710
  return result.json();
14828
- }).then((data) => resolve(data)).catch((error) => handleError(error, reject, options, namespace));
14711
+ }).then((data) => resolve(data)).catch((error) => handleError$1(error, reject, options));
14829
14712
  });
14830
14713
  }
14831
- function createFetchApi(namespace = "storage") {
14832
- return {
14833
- get: async (fetcher, url, options, parameters) => {
14834
- return _handleRequest(fetcher, "GET", url, options, parameters, void 0, namespace);
14835
- },
14836
- post: async (fetcher, url, body, options, parameters) => {
14837
- return _handleRequest(fetcher, "POST", url, options, parameters, body, namespace);
14838
- },
14839
- put: async (fetcher, url, body, options, parameters) => {
14840
- return _handleRequest(fetcher, "PUT", url, options, parameters, body, namespace);
14841
- },
14842
- head: async (fetcher, url, options, parameters) => {
14843
- return _handleRequest(fetcher, "HEAD", url, _objectSpread22(_objectSpread22({}, options), {}, { noResolveJson: true }), parameters, void 0, namespace);
14844
- },
14845
- remove: async (fetcher, url, body, options, parameters) => {
14846
- return _handleRequest(fetcher, "DELETE", url, options, parameters, body, namespace);
14847
- }
14848
- };
14714
+ async function get(fetcher, url, options, parameters) {
14715
+ return _handleRequest$1(fetcher, "GET", url, options, parameters);
14716
+ }
14717
+ async function post$1(fetcher, url, body, options, parameters) {
14718
+ return _handleRequest$1(fetcher, "POST", url, options, parameters, body);
14719
+ }
14720
+ async function put(fetcher, url, body, options, parameters) {
14721
+ return _handleRequest$1(fetcher, "PUT", url, options, parameters, body);
14722
+ }
14723
+ async function head(fetcher, url, options, parameters) {
14724
+ return _handleRequest$1(fetcher, "HEAD", url, _objectSpread2(_objectSpread2({}, options), {}, { noResolveJson: true }), parameters);
14725
+ }
14726
+ async function remove(fetcher, url, body, options, parameters) {
14727
+ return _handleRequest$1(fetcher, "DELETE", url, options, parameters, body);
14849
14728
  }
14850
- var defaultApi = createFetchApi("storage");
14851
- var { get, post, put, head, remove } = defaultApi;
14852
- var vectorsApi = createFetchApi("vectors");
14853
- var BaseApiClient = class {
14854
- /**
14855
- * Creates a new BaseApiClient instance
14856
- * @param url - Base URL for API requests
14857
- * @param headers - Default headers for API requests
14858
- * @param fetch - Optional custom fetch implementation
14859
- * @param namespace - Error namespace ('storage' or 'vectors')
14860
- */
14861
- constructor(url, headers = {}, fetch$1, namespace = "storage") {
14862
- this.shouldThrowOnError = false;
14863
- this.url = url;
14864
- this.headers = headers;
14865
- this.fetch = resolveFetch2(fetch$1);
14866
- this.namespace = namespace;
14867
- }
14868
- /**
14869
- * Enable throwing errors instead of returning them.
14870
- * When enabled, errors are thrown instead of returned in { data, error } format.
14871
- *
14872
- * @returns this - For method chaining
14873
- */
14874
- throwOnError() {
14875
- this.shouldThrowOnError = true;
14876
- return this;
14877
- }
14878
- /**
14879
- * Handles API operation with standardized error handling
14880
- * Eliminates repetitive try-catch blocks across all API methods
14881
- *
14882
- * This wrapper:
14883
- * 1. Executes the operation
14884
- * 2. Returns { data, error: null } on success
14885
- * 3. Returns { data: null, error } on failure (if shouldThrowOnError is false)
14886
- * 4. Throws error on failure (if shouldThrowOnError is true)
14887
- *
14888
- * @typeParam T - The expected data type from the operation
14889
- * @param operation - Async function that performs the API call
14890
- * @returns Promise with { data, error } tuple
14891
- *
14892
- * @example
14893
- * ```typescript
14894
- * async listBuckets() {
14895
- * return this.handleOperation(async () => {
14896
- * return await get(this.fetch, `${this.url}/bucket`, {
14897
- * headers: this.headers,
14898
- * })
14899
- * })
14900
- * }
14901
- * ```
14902
- */
14903
- async handleOperation(operation) {
14904
- var _this = this;
14905
- try {
14906
- return {
14907
- data: await operation(),
14908
- error: null
14909
- };
14910
- } catch (error) {
14911
- if (_this.shouldThrowOnError) throw error;
14912
- if (isStorageError(error)) return {
14913
- data: null,
14914
- error
14915
- };
14916
- throw error;
14917
- }
14918
- }
14919
- };
14920
14729
  var StreamDownloadBuilder = class {
14921
14730
  constructor(downloadFn, shouldThrowOnError) {
14922
14731
  this.downloadFn = downloadFn;
@@ -14997,10 +14806,22 @@ var DEFAULT_FILE_OPTIONS = {
14997
14806
  contentType: "text/plain;charset=UTF-8",
14998
14807
  upsert: false
14999
14808
  };
15000
- var StorageFileApi = class extends BaseApiClient {
14809
+ var StorageFileApi = class {
15001
14810
  constructor(url, headers = {}, bucketId, fetch$1) {
15002
- super(url, headers, fetch$1, "storage");
14811
+ this.shouldThrowOnError = false;
14812
+ this.url = url;
14813
+ this.headers = headers;
15003
14814
  this.bucketId = bucketId;
14815
+ this.fetch = resolveFetch$1(fetch$1);
14816
+ }
14817
+ /**
14818
+ * Enable throwing errors instead of returning them.
14819
+ *
14820
+ * @category File Buckets
14821
+ */
14822
+ throwOnError() {
14823
+ this.shouldThrowOnError = true;
14824
+ return this;
15004
14825
  }
15005
14826
  /**
15006
14827
  * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one.
@@ -15011,10 +14832,10 @@ var StorageFileApi = class extends BaseApiClient {
15011
14832
  */
15012
14833
  async uploadOrUpdate(method, path, fileBody, fileOptions) {
15013
14834
  var _this = this;
15014
- return _this.handleOperation(async () => {
14835
+ try {
15015
14836
  let body;
15016
- const options = _objectSpread22(_objectSpread22({}, DEFAULT_FILE_OPTIONS), fileOptions);
15017
- let headers = _objectSpread22(_objectSpread22({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
14837
+ const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions);
14838
+ let headers = _objectSpread2(_objectSpread2({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
15018
14839
  const metadata = options.metadata;
15019
14840
  if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
15020
14841
  body = new FormData();
@@ -15032,16 +14853,26 @@ var StorageFileApi = class extends BaseApiClient {
15032
14853
  if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata));
15033
14854
  if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
15034
14855
  }
15035
- if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers = _objectSpread22(_objectSpread22({}, headers), fileOptions.headers);
14856
+ if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers = _objectSpread2(_objectSpread2({}, headers), fileOptions.headers);
15036
14857
  const cleanPath = _this._removeEmptyFolders(path);
15037
14858
  const _path = _this._getFinalPath(cleanPath);
15038
- const data = await (method == "PUT" ? put : post)(_this.fetch, `${_this.url}/object/${_path}`, body, _objectSpread22({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}));
14859
+ const data = await (method == "PUT" ? put : post$1)(_this.fetch, `${_this.url}/object/${_path}`, body, _objectSpread2({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}));
15039
14860
  return {
15040
- path: cleanPath,
15041
- id: data.Id,
15042
- fullPath: data.Key
14861
+ data: {
14862
+ path: cleanPath,
14863
+ id: data.Id,
14864
+ fullPath: data.Key
14865
+ },
14866
+ error: null
15043
14867
  };
15044
- });
14868
+ } catch (error) {
14869
+ if (_this.shouldThrowOnError) throw error;
14870
+ if (isStorageError(error)) return {
14871
+ data: null,
14872
+ error
14873
+ };
14874
+ throw error;
14875
+ }
15045
14876
  }
15046
14877
  /**
15047
14878
  * Uploads a file to an existing bucket.
@@ -15127,10 +14958,10 @@ var StorageFileApi = class extends BaseApiClient {
15127
14958
  const _path = _this3._getFinalPath(cleanPath);
15128
14959
  const url = new URL(_this3.url + `/object/upload/sign/${_path}`);
15129
14960
  url.searchParams.set("token", token);
15130
- return _this3.handleOperation(async () => {
14961
+ try {
15131
14962
  let body;
15132
- const options = _objectSpread22({ upsert: DEFAULT_FILE_OPTIONS.upsert }, fileOptions);
15133
- const headers = _objectSpread22(_objectSpread22({}, _this3.headers), { "x-upsert": String(options.upsert) });
14963
+ const options = _objectSpread2({ upsert: DEFAULT_FILE_OPTIONS.upsert }, fileOptions);
14964
+ const headers = _objectSpread2(_objectSpread2({}, _this3.headers), { "x-upsert": String(options.upsert) });
15134
14965
  if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
15135
14966
  body = new FormData();
15136
14967
  body.append("cacheControl", options.cacheControl);
@@ -15144,10 +14975,20 @@ var StorageFileApi = class extends BaseApiClient {
15144
14975
  headers["content-type"] = options.contentType;
15145
14976
  }
15146
14977
  return {
15147
- path: cleanPath,
15148
- fullPath: (await put(_this3.fetch, url.toString(), body, { headers })).Key
14978
+ data: {
14979
+ path: cleanPath,
14980
+ fullPath: (await put(_this3.fetch, url.toString(), body, { headers })).Key
14981
+ },
14982
+ error: null
15149
14983
  };
15150
- });
14984
+ } catch (error) {
14985
+ if (_this3.shouldThrowOnError) throw error;
14986
+ if (isStorageError(error)) return {
14987
+ data: null,
14988
+ error
14989
+ };
14990
+ throw error;
14991
+ }
15151
14992
  }
15152
14993
  /**
15153
14994
  * Creates a signed upload URL.
@@ -15181,20 +15022,30 @@ var StorageFileApi = class extends BaseApiClient {
15181
15022
  */
15182
15023
  async createSignedUploadUrl(path, options) {
15183
15024
  var _this4 = this;
15184
- return _this4.handleOperation(async () => {
15025
+ try {
15185
15026
  let _path = _this4._getFinalPath(path);
15186
- const headers = _objectSpread22({}, _this4.headers);
15027
+ const headers = _objectSpread2({}, _this4.headers);
15187
15028
  if (options === null || options === void 0 ? void 0 : options.upsert) headers["x-upsert"] = "true";
15188
- const data = await post(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers });
15029
+ const data = await post$1(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers });
15189
15030
  const url = new URL(_this4.url + data.url);
15190
15031
  const token = url.searchParams.get("token");
15191
15032
  if (!token) throw new StorageError("No token returned by API");
15192
15033
  return {
15193
- signedUrl: url.toString(),
15194
- path,
15195
- token
15034
+ data: {
15035
+ signedUrl: url.toString(),
15036
+ path,
15037
+ token
15038
+ },
15039
+ error: null
15196
15040
  };
15197
- });
15041
+ } catch (error) {
15042
+ if (_this4.shouldThrowOnError) throw error;
15043
+ if (isStorageError(error)) return {
15044
+ data: null,
15045
+ error
15046
+ };
15047
+ throw error;
15048
+ }
15198
15049
  }
15199
15050
  /**
15200
15051
  * Replaces an existing file at the specified path with a new one.
@@ -15272,14 +15123,24 @@ var StorageFileApi = class extends BaseApiClient {
15272
15123
  */
15273
15124
  async move(fromPath, toPath, options) {
15274
15125
  var _this6 = this;
15275
- return _this6.handleOperation(async () => {
15276
- return await post(_this6.fetch, `${_this6.url}/object/move`, {
15277
- bucketId: _this6.bucketId,
15278
- sourceKey: fromPath,
15279
- destinationKey: toPath,
15280
- destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
15281
- }, { headers: _this6.headers });
15282
- });
15126
+ try {
15127
+ return {
15128
+ data: await post$1(_this6.fetch, `${_this6.url}/object/move`, {
15129
+ bucketId: _this6.bucketId,
15130
+ sourceKey: fromPath,
15131
+ destinationKey: toPath,
15132
+ destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
15133
+ }, { headers: _this6.headers }),
15134
+ error: null
15135
+ };
15136
+ } catch (error) {
15137
+ if (_this6.shouldThrowOnError) throw error;
15138
+ if (isStorageError(error)) return {
15139
+ data: null,
15140
+ error
15141
+ };
15142
+ throw error;
15143
+ }
15283
15144
  }
15284
15145
  /**
15285
15146
  * Copies an existing file to a new path in the same bucket.
@@ -15310,17 +15171,27 @@ var StorageFileApi = class extends BaseApiClient {
15310
15171
  */
15311
15172
  async copy(fromPath, toPath, options) {
15312
15173
  var _this7 = this;
15313
- return _this7.handleOperation(async () => {
15314
- return { path: (await post(_this7.fetch, `${_this7.url}/object/copy`, {
15315
- bucketId: _this7.bucketId,
15316
- sourceKey: fromPath,
15317
- destinationKey: toPath,
15318
- destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
15319
- }, { headers: _this7.headers })).Key };
15320
- });
15321
- }
15322
- /**
15323
- * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
15174
+ try {
15175
+ return {
15176
+ data: { path: (await post$1(_this7.fetch, `${_this7.url}/object/copy`, {
15177
+ bucketId: _this7.bucketId,
15178
+ sourceKey: fromPath,
15179
+ destinationKey: toPath,
15180
+ destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
15181
+ }, { headers: _this7.headers })).Key },
15182
+ error: null
15183
+ };
15184
+ } catch (error) {
15185
+ if (_this7.shouldThrowOnError) throw error;
15186
+ if (isStorageError(error)) return {
15187
+ data: null,
15188
+ error
15189
+ };
15190
+ throw error;
15191
+ }
15192
+ }
15193
+ /**
15194
+ * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
15324
15195
  *
15325
15196
  * @category File Buckets
15326
15197
  * @param path The file path, including the current file name. For example `folder/image.png`.
@@ -15372,12 +15243,23 @@ var StorageFileApi = class extends BaseApiClient {
15372
15243
  */
15373
15244
  async createSignedUrl(path, expiresIn, options) {
15374
15245
  var _this8 = this;
15375
- return _this8.handleOperation(async () => {
15246
+ try {
15376
15247
  let _path = _this8._getFinalPath(path);
15377
- let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread22({ expiresIn }, (options === null || options === void 0 ? void 0 : options.transform) ? { transform: options.transform } : {}), { headers: _this8.headers });
15248
+ let data = await post$1(_this8.fetch, `${_this8.url}/object/sign/${_path}`, _objectSpread2({ expiresIn }, (options === null || options === void 0 ? void 0 : options.transform) ? { transform: options.transform } : {}), { headers: _this8.headers });
15378
15249
  const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
15379
- return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${downloadQueryParam}`) };
15380
- });
15250
+ data = { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${downloadQueryParam}`) };
15251
+ return {
15252
+ data,
15253
+ error: null
15254
+ };
15255
+ } catch (error) {
15256
+ if (_this8.shouldThrowOnError) throw error;
15257
+ if (isStorageError(error)) return {
15258
+ data: null,
15259
+ error
15260
+ };
15261
+ throw error;
15262
+ }
15381
15263
  }
15382
15264
  /**
15383
15265
  * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.
@@ -15419,14 +15301,24 @@ var StorageFileApi = class extends BaseApiClient {
15419
15301
  */
15420
15302
  async createSignedUrls(paths, expiresIn, options) {
15421
15303
  var _this9 = this;
15422
- return _this9.handleOperation(async () => {
15423
- const data = await post(_this9.fetch, `${_this9.url}/object/sign/${_this9.bucketId}`, {
15304
+ try {
15305
+ const data = await post$1(_this9.fetch, `${_this9.url}/object/sign/${_this9.bucketId}`, {
15424
15306
  expiresIn,
15425
15307
  paths
15426
15308
  }, { headers: _this9.headers });
15427
15309
  const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
15428
- return data.map((datum) => _objectSpread22(_objectSpread22({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${downloadQueryParam}`) : null }));
15429
- });
15310
+ return {
15311
+ data: data.map((datum) => _objectSpread2(_objectSpread2({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${downloadQueryParam}`) : null })),
15312
+ error: null
15313
+ };
15314
+ } catch (error) {
15315
+ if (_this9.shouldThrowOnError) throw error;
15316
+ if (isStorageError(error)) return {
15317
+ data: null,
15318
+ error
15319
+ };
15320
+ throw error;
15321
+ }
15430
15322
  }
15431
15323
  /**
15432
15324
  * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead.
@@ -15434,7 +15326,6 @@ var StorageFileApi = class extends BaseApiClient {
15434
15326
  * @category File Buckets
15435
15327
  * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
15436
15328
  * @param options.transform Transform the asset before serving it to the client.
15437
- * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
15438
15329
  * @returns BlobDownloadBuilder instance for downloading the file
15439
15330
  *
15440
15331
  * @example Download file
@@ -15466,27 +15357,8 @@ var StorageFileApi = class extends BaseApiClient {
15466
15357
  * }
15467
15358
  * })
15468
15359
  * ```
15469
- *
15470
- * @example Download with cache control (useful in Edge Functions)
15471
- * ```js
15472
- * const { data, error } = await supabase
15473
- * .storage
15474
- * .from('avatars')
15475
- * .download('folder/avatar1.png', {}, { cache: 'no-store' })
15476
- * ```
15477
- *
15478
- * @example Download with abort signal
15479
- * ```js
15480
- * const controller = new AbortController()
15481
- * setTimeout(() => controller.abort(), 5000)
15482
- *
15483
- * const { data, error } = await supabase
15484
- * .storage
15485
- * .from('avatars')
15486
- * .download('folder/avatar1.png', {}, { signal: controller.signal })
15487
- * ```
15488
15360
  */
15489
- download(path, options, parameters) {
15361
+ download(path, options) {
15490
15362
  const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image/authenticated" : "object";
15491
15363
  const transformationQuery = this.transformOptsToQueryString((options === null || options === void 0 ? void 0 : options.transform) || {});
15492
15364
  const queryString = transformationQuery ? `?${transformationQuery}` : "";
@@ -15494,7 +15366,7 @@ var StorageFileApi = class extends BaseApiClient {
15494
15366
  const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString}`, {
15495
15367
  headers: this.headers,
15496
15368
  noResolveJson: true
15497
- }, parameters);
15369
+ });
15498
15370
  return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError);
15499
15371
  }
15500
15372
  /**
@@ -15515,9 +15387,19 @@ var StorageFileApi = class extends BaseApiClient {
15515
15387
  async info(path) {
15516
15388
  var _this10 = this;
15517
15389
  const _path = _this10._getFinalPath(path);
15518
- return _this10.handleOperation(async () => {
15519
- return recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers }));
15520
- });
15390
+ try {
15391
+ return {
15392
+ data: recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers })),
15393
+ error: null
15394
+ };
15395
+ } catch (error) {
15396
+ if (_this10.shouldThrowOnError) throw error;
15397
+ if (isStorageError(error)) return {
15398
+ data: null,
15399
+ error
15400
+ };
15401
+ throw error;
15402
+ }
15521
15403
  }
15522
15404
  /**
15523
15405
  * Checks the existence of a file.
@@ -15642,9 +15524,19 @@ var StorageFileApi = class extends BaseApiClient {
15642
15524
  */
15643
15525
  async remove(paths) {
15644
15526
  var _this12 = this;
15645
- return _this12.handleOperation(async () => {
15646
- return await remove(_this12.fetch, `${_this12.url}/object/${_this12.bucketId}`, { prefixes: paths }, { headers: _this12.headers });
15647
- });
15527
+ try {
15528
+ return {
15529
+ data: await remove(_this12.fetch, `${_this12.url}/object/${_this12.bucketId}`, { prefixes: paths }, { headers: _this12.headers }),
15530
+ error: null
15531
+ };
15532
+ } catch (error) {
15533
+ if (_this12.shouldThrowOnError) throw error;
15534
+ if (isStorageError(error)) return {
15535
+ data: null,
15536
+ error
15537
+ };
15538
+ throw error;
15539
+ }
15648
15540
  }
15649
15541
  /**
15650
15542
  * Get file metadata
@@ -15716,10 +15608,20 @@ var StorageFileApi = class extends BaseApiClient {
15716
15608
  */
15717
15609
  async list(path, options, parameters) {
15718
15610
  var _this13 = this;
15719
- return _this13.handleOperation(async () => {
15720
- const body = _objectSpread22(_objectSpread22(_objectSpread22({}, DEFAULT_SEARCH_OPTIONS), options), {}, { prefix: path || "" });
15721
- return await post(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters);
15722
- });
15611
+ try {
15612
+ const body = _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_SEARCH_OPTIONS), options), {}, { prefix: path || "" });
15613
+ return {
15614
+ data: await post$1(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters),
15615
+ error: null
15616
+ };
15617
+ } catch (error) {
15618
+ if (_this13.shouldThrowOnError) throw error;
15619
+ if (isStorageError(error)) return {
15620
+ data: null,
15621
+ error
15622
+ };
15623
+ throw error;
15624
+ }
15723
15625
  }
15724
15626
  /**
15725
15627
  * @experimental this method signature might change in the future
@@ -15730,10 +15632,20 @@ var StorageFileApi = class extends BaseApiClient {
15730
15632
  */
15731
15633
  async listV2(options, parameters) {
15732
15634
  var _this14 = this;
15733
- return _this14.handleOperation(async () => {
15734
- const body = _objectSpread22({}, options);
15735
- return await post(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters);
15736
- });
15635
+ try {
15636
+ const body = _objectSpread2({}, options);
15637
+ return {
15638
+ data: await post$1(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters),
15639
+ error: null
15640
+ };
15641
+ } catch (error) {
15642
+ if (_this14.shouldThrowOnError) throw error;
15643
+ if (isStorageError(error)) return {
15644
+ data: null,
15645
+ error
15646
+ };
15647
+ throw error;
15648
+ }
15737
15649
  }
15738
15650
  encodeMetadata(metadata) {
15739
15651
  return JSON.stringify(metadata);
@@ -15758,17 +15670,27 @@ var StorageFileApi = class extends BaseApiClient {
15758
15670
  return params.join("&");
15759
15671
  }
15760
15672
  };
15761
- var version2 = "2.95.1";
15762
- var DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version2}` };
15763
- var StorageBucketApi = class extends BaseApiClient {
15673
+ var version2 = "2.91.0";
15674
+ var DEFAULT_HEADERS$1 = { "X-Client-Info": `storage-js/${version2}` };
15675
+ var StorageBucketApi = class {
15764
15676
  constructor(url, headers = {}, fetch$1, opts) {
15677
+ this.shouldThrowOnError = false;
15765
15678
  const baseUrl = new URL(url);
15766
15679
  if (opts === null || opts === void 0 ? void 0 : opts.useNewHostname) {
15767
15680
  if (/supabase\.(co|in|red)$/.test(baseUrl.hostname) && !baseUrl.hostname.includes("storage.supabase.")) baseUrl.hostname = baseUrl.hostname.replace("supabase.", "storage.supabase.");
15768
15681
  }
15769
- const finalUrl = baseUrl.href.replace(/\/$/, "");
15770
- const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
15771
- super(finalUrl, finalHeaders, fetch$1, "storage");
15682
+ this.url = baseUrl.href.replace(/\/$/, "");
15683
+ this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS$1), headers);
15684
+ this.fetch = resolveFetch$1(fetch$1);
15685
+ }
15686
+ /**
15687
+ * Enable throwing errors instead of returning them.
15688
+ *
15689
+ * @category File Buckets
15690
+ */
15691
+ throwOnError() {
15692
+ this.shouldThrowOnError = true;
15693
+ return this;
15772
15694
  }
15773
15695
  /**
15774
15696
  * Retrieves the details of all Storage buckets within an existing project.
@@ -15804,10 +15726,20 @@ var StorageBucketApi = class extends BaseApiClient {
15804
15726
  */
15805
15727
  async listBuckets(options) {
15806
15728
  var _this = this;
15807
- return _this.handleOperation(async () => {
15729
+ try {
15808
15730
  const queryString = _this.listBucketOptionsToQueryString(options);
15809
- return await get(_this.fetch, `${_this.url}/bucket${queryString}`, { headers: _this.headers });
15810
- });
15731
+ return {
15732
+ data: await get(_this.fetch, `${_this.url}/bucket${queryString}`, { headers: _this.headers }),
15733
+ error: null
15734
+ };
15735
+ } catch (error) {
15736
+ if (_this.shouldThrowOnError) throw error;
15737
+ if (isStorageError(error)) return {
15738
+ data: null,
15739
+ error
15740
+ };
15741
+ throw error;
15742
+ }
15811
15743
  }
15812
15744
  /**
15813
15745
  * Retrieves the details of an existing Storage bucket.
@@ -15844,9 +15776,19 @@ var StorageBucketApi = class extends BaseApiClient {
15844
15776
  */
15845
15777
  async getBucket(id) {
15846
15778
  var _this2 = this;
15847
- return _this2.handleOperation(async () => {
15848
- return await get(_this2.fetch, `${_this2.url}/bucket/${id}`, { headers: _this2.headers });
15849
- });
15779
+ try {
15780
+ return {
15781
+ data: await get(_this2.fetch, `${_this2.url}/bucket/${id}`, { headers: _this2.headers }),
15782
+ error: null
15783
+ };
15784
+ } catch (error) {
15785
+ if (_this2.shouldThrowOnError) throw error;
15786
+ if (isStorageError(error)) return {
15787
+ data: null,
15788
+ error
15789
+ };
15790
+ throw error;
15791
+ }
15850
15792
  }
15851
15793
  /**
15852
15794
  * Creates a new Storage bucket
@@ -15887,16 +15829,26 @@ var StorageBucketApi = class extends BaseApiClient {
15887
15829
  */
15888
15830
  async createBucket(id, options = { public: false }) {
15889
15831
  var _this3 = this;
15890
- return _this3.handleOperation(async () => {
15891
- return await post(_this3.fetch, `${_this3.url}/bucket`, {
15892
- id,
15893
- name: id,
15894
- type: options.type,
15895
- public: options.public,
15896
- file_size_limit: options.fileSizeLimit,
15897
- allowed_mime_types: options.allowedMimeTypes
15898
- }, { headers: _this3.headers });
15899
- });
15832
+ try {
15833
+ return {
15834
+ data: await post$1(_this3.fetch, `${_this3.url}/bucket`, {
15835
+ id,
15836
+ name: id,
15837
+ type: options.type,
15838
+ public: options.public,
15839
+ file_size_limit: options.fileSizeLimit,
15840
+ allowed_mime_types: options.allowedMimeTypes
15841
+ }, { headers: _this3.headers }),
15842
+ error: null
15843
+ };
15844
+ } catch (error) {
15845
+ if (_this3.shouldThrowOnError) throw error;
15846
+ if (isStorageError(error)) return {
15847
+ data: null,
15848
+ error
15849
+ };
15850
+ throw error;
15851
+ }
15900
15852
  }
15901
15853
  /**
15902
15854
  * Updates a Storage bucket
@@ -15935,15 +15887,25 @@ var StorageBucketApi = class extends BaseApiClient {
15935
15887
  */
15936
15888
  async updateBucket(id, options) {
15937
15889
  var _this4 = this;
15938
- return _this4.handleOperation(async () => {
15939
- return await put(_this4.fetch, `${_this4.url}/bucket/${id}`, {
15940
- id,
15941
- name: id,
15942
- public: options.public,
15943
- file_size_limit: options.fileSizeLimit,
15944
- allowed_mime_types: options.allowedMimeTypes
15945
- }, { headers: _this4.headers });
15946
- });
15890
+ try {
15891
+ return {
15892
+ data: await put(_this4.fetch, `${_this4.url}/bucket/${id}`, {
15893
+ id,
15894
+ name: id,
15895
+ public: options.public,
15896
+ file_size_limit: options.fileSizeLimit,
15897
+ allowed_mime_types: options.allowedMimeTypes
15898
+ }, { headers: _this4.headers }),
15899
+ error: null
15900
+ };
15901
+ } catch (error) {
15902
+ if (_this4.shouldThrowOnError) throw error;
15903
+ if (isStorageError(error)) return {
15904
+ data: null,
15905
+ error
15906
+ };
15907
+ throw error;
15908
+ }
15947
15909
  }
15948
15910
  /**
15949
15911
  * Removes all objects inside a single bucket.
@@ -15971,9 +15933,19 @@ var StorageBucketApi = class extends BaseApiClient {
15971
15933
  */
15972
15934
  async emptyBucket(id) {
15973
15935
  var _this5 = this;
15974
- return _this5.handleOperation(async () => {
15975
- return await post(_this5.fetch, `${_this5.url}/bucket/${id}/empty`, {}, { headers: _this5.headers });
15976
- });
15936
+ try {
15937
+ return {
15938
+ data: await post$1(_this5.fetch, `${_this5.url}/bucket/${id}/empty`, {}, { headers: _this5.headers }),
15939
+ error: null
15940
+ };
15941
+ } catch (error) {
15942
+ if (_this5.shouldThrowOnError) throw error;
15943
+ if (isStorageError(error)) return {
15944
+ data: null,
15945
+ error
15946
+ };
15947
+ throw error;
15948
+ }
15977
15949
  }
15978
15950
  /**
15979
15951
  * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
@@ -16002,9 +15974,19 @@ var StorageBucketApi = class extends BaseApiClient {
16002
15974
  */
16003
15975
  async deleteBucket(id) {
16004
15976
  var _this6 = this;
16005
- return _this6.handleOperation(async () => {
16006
- return await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers });
16007
- });
15977
+ try {
15978
+ return {
15979
+ data: await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers }),
15980
+ error: null
15981
+ };
15982
+ } catch (error) {
15983
+ if (_this6.shouldThrowOnError) throw error;
15984
+ if (isStorageError(error)) return {
15985
+ data: null,
15986
+ error
15987
+ };
15988
+ throw error;
15989
+ }
16008
15990
  }
16009
15991
  listBucketOptionsToQueryString(options) {
16010
15992
  const params = {};
@@ -16018,7 +16000,7 @@ var StorageBucketApi = class extends BaseApiClient {
16018
16000
  return Object.keys(params).length > 0 ? "?" + new URLSearchParams(params).toString() : "";
16019
16001
  }
16020
16002
  };
16021
- var StorageAnalyticsClient = class extends BaseApiClient {
16003
+ var StorageAnalyticsClient = class {
16022
16004
  /**
16023
16005
  * @alpha
16024
16006
  *
@@ -16037,9 +16019,25 @@ var StorageAnalyticsClient = class extends BaseApiClient {
16037
16019
  * ```
16038
16020
  */
16039
16021
  constructor(url, headers = {}, fetch$1) {
16040
- const finalUrl = url.replace(/\/$/, "");
16041
- const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
16042
- super(finalUrl, finalHeaders, fetch$1, "storage");
16022
+ this.shouldThrowOnError = false;
16023
+ this.url = url.replace(/\/$/, "");
16024
+ this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS$1), headers);
16025
+ this.fetch = resolveFetch$1(fetch$1);
16026
+ }
16027
+ /**
16028
+ * @alpha
16029
+ *
16030
+ * Enable throwing errors instead of returning them in the response
16031
+ * When enabled, failed operations will throw instead of returning { data: null, error }
16032
+ *
16033
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
16034
+ *
16035
+ * @category Analytics Buckets
16036
+ * @returns This instance for method chaining
16037
+ */
16038
+ throwOnError() {
16039
+ this.shouldThrowOnError = true;
16040
+ return this;
16043
16041
  }
16044
16042
  /**
16045
16043
  * @alpha
@@ -16077,9 +16075,19 @@ var StorageAnalyticsClient = class extends BaseApiClient {
16077
16075
  */
16078
16076
  async createBucket(name) {
16079
16077
  var _this = this;
16080
- return _this.handleOperation(async () => {
16081
- return await post(_this.fetch, `${_this.url}/bucket`, { name }, { headers: _this.headers });
16082
- });
16078
+ try {
16079
+ return {
16080
+ data: await post$1(_this.fetch, `${_this.url}/bucket`, { name }, { headers: _this.headers }),
16081
+ error: null
16082
+ };
16083
+ } catch (error) {
16084
+ if (_this.shouldThrowOnError) throw error;
16085
+ if (isStorageError(error)) return {
16086
+ data: null,
16087
+ error
16088
+ };
16089
+ throw error;
16090
+ }
16083
16091
  }
16084
16092
  /**
16085
16093
  * @alpha
@@ -16129,7 +16137,7 @@ var StorageAnalyticsClient = class extends BaseApiClient {
16129
16137
  */
16130
16138
  async listBuckets(options) {
16131
16139
  var _this2 = this;
16132
- return _this2.handleOperation(async () => {
16140
+ try {
16133
16141
  const queryParams = new URLSearchParams();
16134
16142
  if ((options === null || options === void 0 ? void 0 : options.limit) !== void 0) queryParams.set("limit", options.limit.toString());
16135
16143
  if ((options === null || options === void 0 ? void 0 : options.offset) !== void 0) queryParams.set("offset", options.offset.toString());
@@ -16138,8 +16146,18 @@ var StorageAnalyticsClient = class extends BaseApiClient {
16138
16146
  if (options === null || options === void 0 ? void 0 : options.search) queryParams.set("search", options.search);
16139
16147
  const queryString = queryParams.toString();
16140
16148
  const url = queryString ? `${_this2.url}/bucket?${queryString}` : `${_this2.url}/bucket`;
16141
- return await get(_this2.fetch, url, { headers: _this2.headers });
16142
- });
16149
+ return {
16150
+ data: await get(_this2.fetch, url, { headers: _this2.headers }),
16151
+ error: null
16152
+ };
16153
+ } catch (error) {
16154
+ if (_this2.shouldThrowOnError) throw error;
16155
+ if (isStorageError(error)) return {
16156
+ data: null,
16157
+ error
16158
+ };
16159
+ throw error;
16160
+ }
16143
16161
  }
16144
16162
  /**
16145
16163
  * @alpha
@@ -16174,9 +16192,19 @@ var StorageAnalyticsClient = class extends BaseApiClient {
16174
16192
  */
16175
16193
  async deleteBucket(bucketName) {
16176
16194
  var _this3 = this;
16177
- return _this3.handleOperation(async () => {
16178
- return await remove(_this3.fetch, `${_this3.url}/bucket/${bucketName}`, {}, { headers: _this3.headers });
16179
- });
16195
+ try {
16196
+ return {
16197
+ data: await remove(_this3.fetch, `${_this3.url}/bucket/${bucketName}`, {}, { headers: _this3.headers }),
16198
+ error: null
16199
+ };
16200
+ } catch (error) {
16201
+ if (_this3.shouldThrowOnError) throw error;
16202
+ if (isStorageError(error)) return {
16203
+ data: null,
16204
+ error
16205
+ };
16206
+ throw error;
16207
+ }
16180
16208
  }
16181
16209
  /**
16182
16210
  * @alpha
@@ -16334,133 +16362,371 @@ var StorageAnalyticsClient = class extends BaseApiClient {
16334
16362
  } });
16335
16363
  }
16336
16364
  };
16337
- var VectorIndexApi = class extends BaseApiClient {
16365
+ var DEFAULT_HEADERS = {
16366
+ "X-Client-Info": `storage-js/${version2}`,
16367
+ "Content-Type": "application/json"
16368
+ };
16369
+ var StorageVectorsError = class extends Error {
16370
+ constructor(message) {
16371
+ super(message);
16372
+ this.__isStorageVectorsError = true;
16373
+ this.name = "StorageVectorsError";
16374
+ }
16375
+ };
16376
+ function isStorageVectorsError(error) {
16377
+ return typeof error === "object" && error !== null && "__isStorageVectorsError" in error;
16378
+ }
16379
+ var StorageVectorsApiError = class extends StorageVectorsError {
16380
+ constructor(message, status, statusCode) {
16381
+ super(message);
16382
+ this.name = "StorageVectorsApiError";
16383
+ this.status = status;
16384
+ this.statusCode = statusCode;
16385
+ }
16386
+ toJSON() {
16387
+ return {
16388
+ name: this.name,
16389
+ message: this.message,
16390
+ status: this.status,
16391
+ statusCode: this.statusCode
16392
+ };
16393
+ }
16394
+ };
16395
+ var StorageVectorsUnknownError = class extends StorageVectorsError {
16396
+ constructor(message, originalError) {
16397
+ super(message);
16398
+ this.name = "StorageVectorsUnknownError";
16399
+ this.originalError = originalError;
16400
+ }
16401
+ };
16402
+ var resolveFetch2 = (customFetch) => {
16403
+ if (customFetch) return (...args) => customFetch(...args);
16404
+ return (...args) => fetch(...args);
16405
+ };
16406
+ var isPlainObject = (value) => {
16407
+ if (typeof value !== "object" || value === null) return false;
16408
+ const prototype = Object.getPrototypeOf(value);
16409
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
16410
+ };
16411
+ var _getErrorMessage = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
16412
+ var handleError = async (error, reject, options) => {
16413
+ if (error && typeof error === "object" && "status" in error && "ok" in error && typeof error.status === "number" && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) {
16414
+ const status = error.status || 500;
16415
+ const responseError = error;
16416
+ if (typeof responseError.json === "function") responseError.json().then((err) => {
16417
+ const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
16418
+ reject(new StorageVectorsApiError(_getErrorMessage(err), status, statusCode));
16419
+ }).catch(() => {
16420
+ const statusCode = status + "";
16421
+ reject(new StorageVectorsApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode));
16422
+ });
16423
+ else {
16424
+ const statusCode = status + "";
16425
+ reject(new StorageVectorsApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode));
16426
+ }
16427
+ } else reject(new StorageVectorsUnknownError(_getErrorMessage(error), error));
16428
+ };
16429
+ var _getRequestParams = (method, options, parameters, body) => {
16430
+ const params = {
16431
+ method,
16432
+ headers: (options === null || options === void 0 ? void 0 : options.headers) || {}
16433
+ };
16434
+ if (method === "GET" || !body) return params;
16435
+ if (isPlainObject(body)) {
16436
+ params.headers = _objectSpread2({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
16437
+ params.body = JSON.stringify(body);
16438
+ } else params.body = body;
16439
+ return _objectSpread2(_objectSpread2({}, params), parameters);
16440
+ };
16441
+ async function _handleRequest(fetcher, method, url, options, parameters, body) {
16442
+ return new Promise((resolve, reject) => {
16443
+ fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
16444
+ if (!result.ok) throw result;
16445
+ if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
16446
+ const contentType = result.headers.get("content-type");
16447
+ if (!contentType || !contentType.includes("application/json")) return {};
16448
+ return result.json();
16449
+ }).then((data) => resolve(data)).catch((error) => handleError(error, reject, options));
16450
+ });
16451
+ }
16452
+ async function post(fetcher, url, body, options, parameters) {
16453
+ return _handleRequest(fetcher, "POST", url, options, parameters, body);
16454
+ }
16455
+ var VectorIndexApi = class {
16338
16456
  /** Creates a new VectorIndexApi instance */
16339
16457
  constructor(url, headers = {}, fetch$1) {
16340
- const finalUrl = url.replace(/\/$/, "");
16341
- const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
16342
- super(finalUrl, finalHeaders, fetch$1, "vectors");
16458
+ this.shouldThrowOnError = false;
16459
+ this.url = url.replace(/\/$/, "");
16460
+ this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
16461
+ this.fetch = resolveFetch2(fetch$1);
16462
+ }
16463
+ /** Enable throwing errors instead of returning them in the response */
16464
+ throwOnError() {
16465
+ this.shouldThrowOnError = true;
16466
+ return this;
16343
16467
  }
16344
16468
  /** Creates a new vector index within a bucket */
16345
16469
  async createIndex(options) {
16346
16470
  var _this = this;
16347
- return _this.handleOperation(async () => {
16348
- return await vectorsApi.post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
16349
- });
16471
+ try {
16472
+ return {
16473
+ data: await post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {},
16474
+ error: null
16475
+ };
16476
+ } catch (error) {
16477
+ if (_this.shouldThrowOnError) throw error;
16478
+ if (isStorageVectorsError(error)) return {
16479
+ data: null,
16480
+ error
16481
+ };
16482
+ throw error;
16483
+ }
16350
16484
  }
16351
16485
  /** Retrieves metadata for a specific vector index */
16352
16486
  async getIndex(vectorBucketName, indexName) {
16353
16487
  var _this2 = this;
16354
- return _this2.handleOperation(async () => {
16355
- return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetIndex`, {
16356
- vectorBucketName,
16357
- indexName
16358
- }, { headers: _this2.headers });
16359
- });
16488
+ try {
16489
+ return {
16490
+ data: await post(_this2.fetch, `${_this2.url}/GetIndex`, {
16491
+ vectorBucketName,
16492
+ indexName
16493
+ }, { headers: _this2.headers }),
16494
+ error: null
16495
+ };
16496
+ } catch (error) {
16497
+ if (_this2.shouldThrowOnError) throw error;
16498
+ if (isStorageVectorsError(error)) return {
16499
+ data: null,
16500
+ error
16501
+ };
16502
+ throw error;
16503
+ }
16360
16504
  }
16361
16505
  /** Lists vector indexes within a bucket with optional filtering and pagination */
16362
16506
  async listIndexes(options) {
16363
16507
  var _this3 = this;
16364
- return _this3.handleOperation(async () => {
16365
- return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
16366
- });
16508
+ try {
16509
+ return {
16510
+ data: await post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers }),
16511
+ error: null
16512
+ };
16513
+ } catch (error) {
16514
+ if (_this3.shouldThrowOnError) throw error;
16515
+ if (isStorageVectorsError(error)) return {
16516
+ data: null,
16517
+ error
16518
+ };
16519
+ throw error;
16520
+ }
16367
16521
  }
16368
16522
  /** Deletes a vector index and all its data */
16369
16523
  async deleteIndex(vectorBucketName, indexName) {
16370
16524
  var _this4 = this;
16371
- return _this4.handleOperation(async () => {
16372
- return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
16373
- vectorBucketName,
16374
- indexName
16375
- }, { headers: _this4.headers }) || {};
16376
- });
16525
+ try {
16526
+ return {
16527
+ data: await post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
16528
+ vectorBucketName,
16529
+ indexName
16530
+ }, { headers: _this4.headers }) || {},
16531
+ error: null
16532
+ };
16533
+ } catch (error) {
16534
+ if (_this4.shouldThrowOnError) throw error;
16535
+ if (isStorageVectorsError(error)) return {
16536
+ data: null,
16537
+ error
16538
+ };
16539
+ throw error;
16540
+ }
16377
16541
  }
16378
16542
  };
16379
- var VectorDataApi = class extends BaseApiClient {
16543
+ var VectorDataApi = class {
16380
16544
  /** Creates a new VectorDataApi instance */
16381
16545
  constructor(url, headers = {}, fetch$1) {
16382
- const finalUrl = url.replace(/\/$/, "");
16383
- const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
16384
- super(finalUrl, finalHeaders, fetch$1, "vectors");
16546
+ this.shouldThrowOnError = false;
16547
+ this.url = url.replace(/\/$/, "");
16548
+ this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
16549
+ this.fetch = resolveFetch2(fetch$1);
16550
+ }
16551
+ /** Enable throwing errors instead of returning them in the response */
16552
+ throwOnError() {
16553
+ this.shouldThrowOnError = true;
16554
+ return this;
16385
16555
  }
16386
16556
  /** Inserts or updates vectors in batch (1-500 per request) */
16387
16557
  async putVectors(options) {
16388
16558
  var _this = this;
16389
- if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
16390
- return _this.handleOperation(async () => {
16391
- return await vectorsApi.post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
16392
- });
16559
+ try {
16560
+ if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
16561
+ return {
16562
+ data: await post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {},
16563
+ error: null
16564
+ };
16565
+ } catch (error) {
16566
+ if (_this.shouldThrowOnError) throw error;
16567
+ if (isStorageVectorsError(error)) return {
16568
+ data: null,
16569
+ error
16570
+ };
16571
+ throw error;
16572
+ }
16393
16573
  }
16394
16574
  /** Retrieves vectors by their keys in batch */
16395
16575
  async getVectors(options) {
16396
16576
  var _this2 = this;
16397
- return _this2.handleOperation(async () => {
16398
- return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
16399
- });
16577
+ try {
16578
+ return {
16579
+ data: await post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers }),
16580
+ error: null
16581
+ };
16582
+ } catch (error) {
16583
+ if (_this2.shouldThrowOnError) throw error;
16584
+ if (isStorageVectorsError(error)) return {
16585
+ data: null,
16586
+ error
16587
+ };
16588
+ throw error;
16589
+ }
16400
16590
  }
16401
16591
  /** Lists vectors in an index with pagination */
16402
16592
  async listVectors(options) {
16403
16593
  var _this3 = this;
16404
- if (options.segmentCount !== void 0) {
16405
- if (options.segmentCount < 1 || options.segmentCount > 16) throw new Error("segmentCount must be between 1 and 16");
16406
- if (options.segmentIndex !== void 0) {
16407
- if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
16594
+ try {
16595
+ if (options.segmentCount !== void 0) {
16596
+ if (options.segmentCount < 1 || options.segmentCount > 16) throw new Error("segmentCount must be between 1 and 16");
16597
+ if (options.segmentIndex !== void 0) {
16598
+ if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
16599
+ }
16408
16600
  }
16601
+ return {
16602
+ data: await post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers }),
16603
+ error: null
16604
+ };
16605
+ } catch (error) {
16606
+ if (_this3.shouldThrowOnError) throw error;
16607
+ if (isStorageVectorsError(error)) return {
16608
+ data: null,
16609
+ error
16610
+ };
16611
+ throw error;
16409
16612
  }
16410
- return _this3.handleOperation(async () => {
16411
- return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
16412
- });
16413
16613
  }
16414
16614
  /** Queries for similar vectors using approximate nearest neighbor search */
16415
16615
  async queryVectors(options) {
16416
16616
  var _this4 = this;
16417
- return _this4.handleOperation(async () => {
16418
- return await vectorsApi.post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
16419
- });
16617
+ try {
16618
+ return {
16619
+ data: await post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers }),
16620
+ error: null
16621
+ };
16622
+ } catch (error) {
16623
+ if (_this4.shouldThrowOnError) throw error;
16624
+ if (isStorageVectorsError(error)) return {
16625
+ data: null,
16626
+ error
16627
+ };
16628
+ throw error;
16629
+ }
16420
16630
  }
16421
16631
  /** Deletes vectors by their keys in batch (1-500 per request) */
16422
16632
  async deleteVectors(options) {
16423
16633
  var _this5 = this;
16424
- if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
16425
- return _this5.handleOperation(async () => {
16426
- return await vectorsApi.post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
16427
- });
16634
+ try {
16635
+ if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
16636
+ return {
16637
+ data: await post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {},
16638
+ error: null
16639
+ };
16640
+ } catch (error) {
16641
+ if (_this5.shouldThrowOnError) throw error;
16642
+ if (isStorageVectorsError(error)) return {
16643
+ data: null,
16644
+ error
16645
+ };
16646
+ throw error;
16647
+ }
16428
16648
  }
16429
16649
  };
16430
- var VectorBucketApi = class extends BaseApiClient {
16650
+ var VectorBucketApi = class {
16431
16651
  /** Creates a new VectorBucketApi instance */
16432
16652
  constructor(url, headers = {}, fetch$1) {
16433
- const finalUrl = url.replace(/\/$/, "");
16434
- const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
16435
- super(finalUrl, finalHeaders, fetch$1, "vectors");
16653
+ this.shouldThrowOnError = false;
16654
+ this.url = url.replace(/\/$/, "");
16655
+ this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
16656
+ this.fetch = resolveFetch2(fetch$1);
16657
+ }
16658
+ /** Enable throwing errors instead of returning them in the response */
16659
+ throwOnError() {
16660
+ this.shouldThrowOnError = true;
16661
+ return this;
16436
16662
  }
16437
16663
  /** Creates a new vector bucket */
16438
16664
  async createBucket(vectorBucketName) {
16439
16665
  var _this = this;
16440
- return _this.handleOperation(async () => {
16441
- return await vectorsApi.post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
16442
- });
16666
+ try {
16667
+ return {
16668
+ data: await post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {},
16669
+ error: null
16670
+ };
16671
+ } catch (error) {
16672
+ if (_this.shouldThrowOnError) throw error;
16673
+ if (isStorageVectorsError(error)) return {
16674
+ data: null,
16675
+ error
16676
+ };
16677
+ throw error;
16678
+ }
16443
16679
  }
16444
16680
  /** Retrieves metadata for a specific vector bucket */
16445
16681
  async getBucket(vectorBucketName) {
16446
16682
  var _this2 = this;
16447
- return _this2.handleOperation(async () => {
16448
- return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
16449
- });
16683
+ try {
16684
+ return {
16685
+ data: await post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers }),
16686
+ error: null
16687
+ };
16688
+ } catch (error) {
16689
+ if (_this2.shouldThrowOnError) throw error;
16690
+ if (isStorageVectorsError(error)) return {
16691
+ data: null,
16692
+ error
16693
+ };
16694
+ throw error;
16695
+ }
16450
16696
  }
16451
16697
  /** Lists vector buckets with optional filtering and pagination */
16452
16698
  async listBuckets(options = {}) {
16453
16699
  var _this3 = this;
16454
- return _this3.handleOperation(async () => {
16455
- return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
16456
- });
16700
+ try {
16701
+ return {
16702
+ data: await post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers }),
16703
+ error: null
16704
+ };
16705
+ } catch (error) {
16706
+ if (_this3.shouldThrowOnError) throw error;
16707
+ if (isStorageVectorsError(error)) return {
16708
+ data: null,
16709
+ error
16710
+ };
16711
+ throw error;
16712
+ }
16457
16713
  }
16458
16714
  /** Deletes a vector bucket (must be empty first) */
16459
16715
  async deleteBucket(vectorBucketName) {
16460
16716
  var _this4 = this;
16461
- return _this4.handleOperation(async () => {
16462
- return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
16463
- });
16717
+ try {
16718
+ return {
16719
+ data: await post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {},
16720
+ error: null
16721
+ };
16722
+ } catch (error) {
16723
+ if (_this4.shouldThrowOnError) throw error;
16724
+ if (isStorageVectorsError(error)) return {
16725
+ data: null,
16726
+ error
16727
+ };
16728
+ throw error;
16729
+ }
16464
16730
  }
16465
16731
  };
16466
16732
  var StorageVectorsClient = class extends VectorBucketApi {
@@ -16657,7 +16923,7 @@ var VectorBucketScope = class extends VectorIndexApi {
16657
16923
  */
16658
16924
  async createIndex(options) {
16659
16925
  var _superprop_getCreateIndex = () => super.createIndex, _this5 = this;
16660
- return _superprop_getCreateIndex().call(_this5, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this5.vectorBucketName }));
16926
+ return _superprop_getCreateIndex().call(_this5, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this5.vectorBucketName }));
16661
16927
  }
16662
16928
  /**
16663
16929
  *
@@ -16680,7 +16946,7 @@ var VectorBucketScope = class extends VectorIndexApi {
16680
16946
  */
16681
16947
  async listIndexes(options = {}) {
16682
16948
  var _superprop_getListIndexes = () => super.listIndexes, _this6 = this;
16683
- return _superprop_getListIndexes().call(_this6, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this6.vectorBucketName }));
16949
+ return _superprop_getListIndexes().call(_this6, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this6.vectorBucketName }));
16684
16950
  }
16685
16951
  /**
16686
16952
  *
@@ -16813,7 +17079,7 @@ var VectorIndexScope = class extends VectorDataApi {
16813
17079
  */
16814
17080
  async putVectors(options) {
16815
17081
  var _superprop_getPutVectors = () => super.putVectors, _this9 = this;
16816
- return _superprop_getPutVectors().call(_this9, _objectSpread22(_objectSpread22({}, options), {}, {
17082
+ return _superprop_getPutVectors().call(_this9, _objectSpread2(_objectSpread2({}, options), {}, {
16817
17083
  vectorBucketName: _this9.vectorBucketName,
16818
17084
  indexName: _this9.indexName
16819
17085
  }));
@@ -16842,7 +17108,7 @@ var VectorIndexScope = class extends VectorDataApi {
16842
17108
  */
16843
17109
  async getVectors(options) {
16844
17110
  var _superprop_getGetVectors = () => super.getVectors, _this10 = this;
16845
- return _superprop_getGetVectors().call(_this10, _objectSpread22(_objectSpread22({}, options), {}, {
17111
+ return _superprop_getGetVectors().call(_this10, _objectSpread2(_objectSpread2({}, options), {}, {
16846
17112
  vectorBucketName: _this10.vectorBucketName,
16847
17113
  indexName: _this10.indexName
16848
17114
  }));
@@ -16871,7 +17137,7 @@ var VectorIndexScope = class extends VectorDataApi {
16871
17137
  */
16872
17138
  async listVectors(options = {}) {
16873
17139
  var _superprop_getListVectors = () => super.listVectors, _this11 = this;
16874
- return _superprop_getListVectors().call(_this11, _objectSpread22(_objectSpread22({}, options), {}, {
17140
+ return _superprop_getListVectors().call(_this11, _objectSpread2(_objectSpread2({}, options), {}, {
16875
17141
  vectorBucketName: _this11.vectorBucketName,
16876
17142
  indexName: _this11.indexName
16877
17143
  }));
@@ -16903,7 +17169,7 @@ var VectorIndexScope = class extends VectorDataApi {
16903
17169
  */
16904
17170
  async queryVectors(options) {
16905
17171
  var _superprop_getQueryVectors = () => super.queryVectors, _this12 = this;
16906
- return _superprop_getQueryVectors().call(_this12, _objectSpread22(_objectSpread22({}, options), {}, {
17172
+ return _superprop_getQueryVectors().call(_this12, _objectSpread2(_objectSpread2({}, options), {}, {
16907
17173
  vectorBucketName: _this12.vectorBucketName,
16908
17174
  indexName: _this12.indexName
16909
17175
  }));
@@ -16931,7 +17197,7 @@ var VectorIndexScope = class extends VectorDataApi {
16931
17197
  */
16932
17198
  async deleteVectors(options) {
16933
17199
  var _superprop_getDeleteVectors = () => super.deleteVectors, _this13 = this;
16934
- return _superprop_getDeleteVectors().call(_this13, _objectSpread22(_objectSpread22({}, options), {}, {
17200
+ return _superprop_getDeleteVectors().call(_this13, _objectSpread2(_objectSpread2({}, options), {}, {
16935
17201
  vectorBucketName: _this13.vectorBucketName,
16936
17202
  indexName: _this13.indexName
16937
17203
  }));
@@ -17002,10 +17268,10 @@ var StorageClient = class extends StorageBucketApi {
17002
17268
  }
17003
17269
  };
17004
17270
 
17005
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/version.js
17006
- var version3 = "2.95.1";
17271
+ // node_modules/@supabase/auth-js/dist/module/lib/version.js
17272
+ var version3 = "2.91.0";
17007
17273
 
17008
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/constants.js
17274
+ // node_modules/@supabase/auth-js/dist/module/lib/constants.js
17009
17275
  var AUTO_REFRESH_TICK_DURATION_MS = 30 * 1e3;
17010
17276
  var AUTO_REFRESH_TICK_THRESHOLD = 3;
17011
17277
  var EXPIRY_MARGIN_MS = AUTO_REFRESH_TICK_THRESHOLD * AUTO_REFRESH_TICK_DURATION_MS;
@@ -17022,7 +17288,7 @@ var API_VERSIONS = {
17022
17288
  var BASE64URL_REGEX = /^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;
17023
17289
  var JWKS_TTL = 10 * 60 * 1e3;
17024
17290
 
17025
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/errors.js
17291
+ // node_modules/@supabase/auth-js/dist/module/lib/errors.js
17026
17292
  var AuthError = class extends Error {
17027
17293
  constructor(message, status, code) {
17028
17294
  super(message);
@@ -17136,7 +17402,7 @@ var AuthInvalidJwtError = class extends CustomAuthError {
17136
17402
  }
17137
17403
  };
17138
17404
 
17139
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/base64url.js
17405
+ // node_modules/@supabase/auth-js/dist/module/lib/base64url.js
17140
17406
  var TO_BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split("");
17141
17407
  var IGNORE_BASE64URL = " \n\r=".split("");
17142
17408
  var FROM_BASE64URL = (() => {
@@ -17298,7 +17564,7 @@ function bytesToBase64URL(bytes) {
17298
17564
  return result.join("");
17299
17565
  }
17300
17566
 
17301
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/helpers.js
17567
+ // node_modules/@supabase/auth-js/dist/module/lib/helpers.js
17302
17568
  function expiresAt(expiresIn) {
17303
17569
  const timeNow = Math.round(Date.now() / 1e3);
17304
17570
  return timeNow + expiresIn;
@@ -17580,7 +17846,7 @@ function deepClone(obj) {
17580
17846
  return JSON.parse(JSON.stringify(obj));
17581
17847
  }
17582
17848
 
17583
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/fetch.js
17849
+ // node_modules/@supabase/auth-js/dist/module/lib/fetch.js
17584
17850
  var _getErrorMessage2 = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
17585
17851
  var NETWORK_ERROR_CODES = [502, 503, 504];
17586
17852
  async function handleError2(error) {
@@ -17717,10 +17983,10 @@ function hasSession(data) {
17717
17983
  return data.access_token && data.refresh_token && data.expires_in;
17718
17984
  }
17719
17985
 
17720
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/types.js
17986
+ // node_modules/@supabase/auth-js/dist/module/lib/types.js
17721
17987
  var SIGN_OUT_SCOPES = ["global", "local", "others"];
17722
17988
 
17723
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
17989
+ // node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
17724
17990
  var GoTrueAdminApi = class {
17725
17991
  /**
17726
17992
  * Creates an admin API client that can be used to manage users and OAuth clients.
@@ -18137,7 +18403,7 @@ var GoTrueAdminApi = class {
18137
18403
  }
18138
18404
  };
18139
18405
 
18140
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
18406
+ // node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
18141
18407
  function memoryLocalStorageAdapter(store = {}) {
18142
18408
  return {
18143
18409
  getItem: (key) => {
@@ -18152,7 +18418,7 @@ function memoryLocalStorageAdapter(store = {}) {
18152
18418
  };
18153
18419
  }
18154
18420
 
18155
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/locks.js
18421
+ // node_modules/@supabase/auth-js/dist/module/lib/locks.js
18156
18422
  var internals = {
18157
18423
  /**
18158
18424
  * @experimental
@@ -18220,7 +18486,7 @@ async function navigatorLock(name, acquireTimeout, fn) {
18220
18486
  }));
18221
18487
  }
18222
18488
 
18223
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
18489
+ // node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
18224
18490
  function polyfillGlobalThis() {
18225
18491
  if (typeof globalThis === "object")
18226
18492
  return;
@@ -18240,7 +18506,7 @@ function polyfillGlobalThis() {
18240
18506
  }
18241
18507
  }
18242
18508
 
18243
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
18509
+ // node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
18244
18510
  function getAddress(address) {
18245
18511
  if (!/^0x[a-fA-F0-9]{40}$/.test(address)) {
18246
18512
  throw new Error(`@supabase/auth-js: Address "${address}" is invalid.`);
@@ -18308,7 +18574,7 @@ Request ID: ${requestId}`;
18308
18574
  ${suffix}`;
18309
18575
  }
18310
18576
 
18311
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
18577
+ // node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
18312
18578
  var WebAuthnError = class extends Error {
18313
18579
  constructor({ message, code, cause, name }) {
18314
18580
  var _a72;
@@ -18476,7 +18742,7 @@ function identifyAuthenticationError({ error, options }) {
18476
18742
  });
18477
18743
  }
18478
18744
 
18479
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
18745
+ // node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
18480
18746
  var WebAuthnAbortService = class {
18481
18747
  /**
18482
18748
  * Create an abort signal for a new WebAuthn operation.
@@ -18771,7 +19037,6 @@ var WebAuthnApi = class {
18771
19037
  * @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying Assertion}
18772
19038
  */
18773
19039
  async _challenge({ factorId, webauthn, friendlyName, signal }, overrides) {
18774
- var _a72;
18775
19040
  try {
18776
19041
  const { data: challengeResponse, error: challengeError } = await this.client.mfa.challenge({
18777
19042
  factorId,
@@ -18784,15 +19049,7 @@ var WebAuthnApi = class {
18784
19049
  if (challengeResponse.webauthn.type === "create") {
18785
19050
  const { user } = challengeResponse.webauthn.credential_options.publicKey;
18786
19051
  if (!user.name) {
18787
- const nameToUse = friendlyName;
18788
- if (!nameToUse) {
18789
- const currentUser = await this.client.getUser();
18790
- const userData = currentUser.data.user;
18791
- const fallbackName = ((_a72 = userData === null || userData === void 0 ? void 0 : userData.user_metadata) === null || _a72 === void 0 ? void 0 : _a72.name) || (userData === null || userData === void 0 ? void 0 : userData.email) || (userData === null || userData === void 0 ? void 0 : userData.id) || "User";
18792
- user.name = `${user.id}:${fallbackName}`;
18793
- } else {
18794
- user.name = `${user.id}:${nameToUse}`;
18795
- }
19052
+ user.name = `${user.id}:${friendlyName}`;
18796
19053
  }
18797
19054
  if (!user.displayName) {
18798
19055
  user.displayName = user.name;
@@ -18999,7 +19256,7 @@ var WebAuthnApi = class {
18999
19256
  }
19000
19257
  };
19001
19258
 
19002
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
19259
+ // node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
19003
19260
  polyfillGlobalThis();
19004
19261
  var DEFAULT_OPTIONS = {
19005
19262
  url: GOTRUE_URL,
@@ -19153,16 +19410,10 @@ var GoTrueClient = class _GoTrueClient {
19153
19410
  }
19154
19411
  (_c = this.broadcastChannel) === null || _c === void 0 ? void 0 : _c.addEventListener("message", async (event) => {
19155
19412
  this._debug("received broadcast notification from other tab or client", event);
19156
- try {
19157
- await this._notifyAllSubscribers(event.data.event, event.data.session, false);
19158
- } catch (error) {
19159
- this._debug("#broadcastChannel", "error", error);
19160
- }
19413
+ await this._notifyAllSubscribers(event.data.event, event.data.session, false);
19161
19414
  });
19162
19415
  }
19163
- this.initialize().catch((error) => {
19164
- this._debug("#initialize()", "error", error);
19165
- });
19416
+ this.initialize();
19166
19417
  }
19167
19418
  /**
19168
19419
  * Returns whether error throwing mode is enabled for this client.
@@ -19685,7 +19936,9 @@ var GoTrueClient = class _GoTrueClient {
19685
19936
  }
19686
19937
  if (data.session) {
19687
19938
  await this._saveSession(data.session);
19688
- await this._notifyAllSubscribers("SIGNED_IN", data.session);
19939
+ setTimeout(async () => {
19940
+ await this._notifyAllSubscribers("SIGNED_IN", data.session);
19941
+ }, 0);
19689
19942
  }
19690
19943
  return this._returnResult({ data: Object.assign(Object.assign({}, data), { redirectType: redirectType !== null && redirectType !== void 0 ? redirectType : null }), error });
19691
19944
  } catch (error) {
@@ -20232,7 +20485,7 @@ var GoTrueClient = class _GoTrueClient {
20232
20485
  } else {
20233
20486
  const { data, error } = await this._getUser(currentSession.access_token);
20234
20487
  if (error) {
20235
- return this._returnResult({ data: { user: null, session: null }, error });
20488
+ throw error;
20236
20489
  }
20237
20490
  session = {
20238
20491
  access_token: currentSession.access_token,
@@ -20414,14 +20667,14 @@ var GoTrueClient = class _GoTrueClient {
20414
20667
  return await this._useSession(async (result) => {
20415
20668
  var _a72;
20416
20669
  const { data, error: sessionError } = result;
20417
- if (sessionError && !isAuthSessionMissingError(sessionError)) {
20670
+ if (sessionError) {
20418
20671
  return this._returnResult({ error: sessionError });
20419
20672
  }
20420
20673
  const accessToken = (_a72 = data.session) === null || _a72 === void 0 ? void 0 : _a72.access_token;
20421
20674
  if (accessToken) {
20422
20675
  const { error } = await this.admin.signOut(accessToken, scope);
20423
20676
  if (error) {
20424
- if (!(isAuthApiError(error) && (error.status === 404 || error.status === 401 || error.status === 403) || isAuthSessionMissingError(error))) {
20677
+ if (!(isAuthApiError(error) && (error.status === 404 || error.status === 401 || error.status === 403))) {
20425
20678
  return this._returnResult({ error });
20426
20679
  }
20427
20680
  }
@@ -21008,13 +21261,7 @@ var GoTrueClient = class _GoTrueClient {
21008
21261
  return false;
21009
21262
  }
21010
21263
  try {
21011
- this.visibilityChangedCallback = async () => {
21012
- try {
21013
- await this._onVisibilityChanged(false);
21014
- } catch (error) {
21015
- this._debug("#visibilityChangedCallback", "error", error);
21016
- }
21017
- };
21264
+ this.visibilityChangedCallback = async () => await this._onVisibilityChanged(false);
21018
21265
  window === null || window === void 0 ? void 0 : window.addEventListener("visibilitychange", this.visibilityChangedCallback);
21019
21266
  await this._onVisibilityChanged(true);
21020
21267
  } catch (error) {
@@ -21247,33 +21494,8 @@ var GoTrueClient = class _GoTrueClient {
21247
21494
  /**
21248
21495
  * {@see GoTrueMFAApi#getAuthenticatorAssuranceLevel}
21249
21496
  */
21250
- async _getAuthenticatorAssuranceLevel(jwt) {
21251
- var _a72, _b6, _c, _d;
21252
- if (jwt) {
21253
- try {
21254
- const { payload: payload2 } = decodeJWT(jwt);
21255
- let currentLevel2 = null;
21256
- if (payload2.aal) {
21257
- currentLevel2 = payload2.aal;
21258
- }
21259
- let nextLevel2 = currentLevel2;
21260
- const { data: { user }, error: userError } = await this.getUser(jwt);
21261
- if (userError) {
21262
- return this._returnResult({ data: null, error: userError });
21263
- }
21264
- const verifiedFactors2 = (_b6 = (_a72 = user === null || user === void 0 ? void 0 : user.factors) === null || _a72 === void 0 ? void 0 : _a72.filter((factor) => factor.status === "verified")) !== null && _b6 !== void 0 ? _b6 : [];
21265
- if (verifiedFactors2.length > 0) {
21266
- nextLevel2 = "aal2";
21267
- }
21268
- const currentAuthenticationMethods2 = payload2.amr || [];
21269
- return { data: { currentLevel: currentLevel2, nextLevel: nextLevel2, currentAuthenticationMethods: currentAuthenticationMethods2 }, error: null };
21270
- } catch (error) {
21271
- if (isAuthError(error)) {
21272
- return this._returnResult({ data: null, error });
21273
- }
21274
- throw error;
21275
- }
21276
- }
21497
+ async _getAuthenticatorAssuranceLevel() {
21498
+ var _a72, _b6;
21277
21499
  const { data: { session }, error: sessionError } = await this.getSession();
21278
21500
  if (sessionError) {
21279
21501
  return this._returnResult({ data: null, error: sessionError });
@@ -21290,7 +21512,7 @@ var GoTrueClient = class _GoTrueClient {
21290
21512
  currentLevel = payload.aal;
21291
21513
  }
21292
21514
  let nextLevel = currentLevel;
21293
- const verifiedFactors = (_d = (_c = session.user.factors) === null || _c === void 0 ? void 0 : _c.filter((factor) => factor.status === "verified")) !== null && _d !== void 0 ? _d : [];
21515
+ const verifiedFactors = (_b6 = (_a72 = session.user.factors) === null || _a72 === void 0 ? void 0 : _a72.filter((factor) => factor.status === "verified")) !== null && _b6 !== void 0 ? _b6 : [];
21294
21516
  if (verifiedFactors.length > 0) {
21295
21517
  nextLevel = "aal2";
21296
21518
  }
@@ -21302,7 +21524,7 @@ var GoTrueClient = class _GoTrueClient {
21302
21524
  * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
21303
21525
  *
21304
21526
  * Returns authorization details including client info, scopes, and user information.
21305
- * If the response includes only a redirect_url field, it means consent was already given - the caller
21527
+ * If the API returns a redirect_uri, it means consent was already given - the caller
21306
21528
  * should handle the redirect manually if needed.
21307
21529
  */
21308
21530
  async _getAuthorizationDetails(authorizationId) {
@@ -21551,12 +21773,12 @@ var GoTrueClient = class _GoTrueClient {
21551
21773
  GoTrueClient.nextInstanceID = {};
21552
21774
  var GoTrueClient_default = GoTrueClient;
21553
21775
 
21554
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/AuthClient.js
21776
+ // node_modules/@supabase/auth-js/dist/module/AuthClient.js
21555
21777
  var AuthClient = GoTrueClient_default;
21556
21778
  var AuthClient_default = AuthClient;
21557
21779
 
21558
- // node_modules/.pnpm/@supabase+supabase-js@2.95.1/node_modules/@supabase/supabase-js/dist/index.mjs
21559
- var version4 = "2.95.1";
21780
+ // node_modules/@supabase/supabase-js/dist/index.mjs
21781
+ var version4 = "2.91.0";
21560
21782
  var JS_ENV = "";
21561
21783
  if (typeof Deno !== "undefined") JS_ENV = "deno";
21562
21784
  else if (typeof document !== "undefined") JS_ENV = "web";
@@ -21572,37 +21794,37 @@ var DEFAULT_AUTH_OPTIONS = {
21572
21794
  flowType: "implicit"
21573
21795
  };
21574
21796
  var DEFAULT_REALTIME_OPTIONS = {};
21575
- function _typeof3(o) {
21797
+ function _typeof2(o) {
21576
21798
  "@babel/helpers - typeof";
21577
- return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
21799
+ return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
21578
21800
  return typeof o$1;
21579
21801
  } : function(o$1) {
21580
21802
  return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
21581
- }, _typeof3(o);
21803
+ }, _typeof2(o);
21582
21804
  }
21583
- function toPrimitive3(t, r) {
21584
- if ("object" != _typeof3(t) || !t) return t;
21805
+ function toPrimitive2(t, r) {
21806
+ if ("object" != _typeof2(t) || !t) return t;
21585
21807
  var e = t[Symbol.toPrimitive];
21586
21808
  if (void 0 !== e) {
21587
21809
  var i = e.call(t, r || "default");
21588
- if ("object" != _typeof3(i)) return i;
21810
+ if ("object" != _typeof2(i)) return i;
21589
21811
  throw new TypeError("@@toPrimitive must return a primitive value.");
21590
21812
  }
21591
21813
  return ("string" === r ? String : Number)(t);
21592
21814
  }
21593
- function toPropertyKey3(t) {
21594
- var i = toPrimitive3(t, "string");
21595
- return "symbol" == _typeof3(i) ? i : i + "";
21815
+ function toPropertyKey2(t) {
21816
+ var i = toPrimitive2(t, "string");
21817
+ return "symbol" == _typeof2(i) ? i : i + "";
21596
21818
  }
21597
- function _defineProperty3(e, r, t) {
21598
- return (r = toPropertyKey3(r)) in e ? Object.defineProperty(e, r, {
21819
+ function _defineProperty2(e, r, t) {
21820
+ return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
21599
21821
  value: t,
21600
21822
  enumerable: true,
21601
21823
  configurable: true,
21602
21824
  writable: true
21603
21825
  }) : e[r] = t, e;
21604
21826
  }
21605
- function ownKeys3(e, r) {
21827
+ function ownKeys2(e, r) {
21606
21828
  var t = Object.keys(e);
21607
21829
  if (Object.getOwnPropertySymbols) {
21608
21830
  var o = Object.getOwnPropertySymbols(e);
@@ -21612,12 +21834,12 @@ function ownKeys3(e, r) {
21612
21834
  }
21613
21835
  return t;
21614
21836
  }
21615
- function _objectSpread23(e) {
21837
+ function _objectSpread22(e) {
21616
21838
  for (var r = 1; r < arguments.length; r++) {
21617
21839
  var t = null != arguments[r] ? arguments[r] : {};
21618
- r % 2 ? ownKeys3(Object(t), true).forEach(function(r$1) {
21619
- _defineProperty3(e, r$1, t[r$1]);
21620
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys3(Object(t)).forEach(function(r$1) {
21840
+ r % 2 ? ownKeys2(Object(t), true).forEach(function(r$1) {
21841
+ _defineProperty2(e, r$1, t[r$1]);
21842
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r$1) {
21621
21843
  Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
21622
21844
  });
21623
21845
  }
@@ -21639,7 +21861,7 @@ var fetchWithAuth = (supabaseKey, getAccessToken, customFetch) => {
21639
21861
  let headers = new HeadersConstructor(init === null || init === void 0 ? void 0 : init.headers);
21640
21862
  if (!headers.has("apikey")) headers.set("apikey", supabaseKey);
21641
21863
  if (!headers.has("Authorization")) headers.set("Authorization", `Bearer ${accessToken}`);
21642
- return fetch$1(input, _objectSpread23(_objectSpread23({}, init), {}, { headers }));
21864
+ return fetch$1(input, _objectSpread22(_objectSpread22({}, init), {}, { headers }));
21643
21865
  };
21644
21866
  };
21645
21867
  function ensureTrailingSlash(url) {
@@ -21650,11 +21872,11 @@ function applySettingDefaults(options, defaults) {
21650
21872
  const { db: dbOptions, auth: authOptions, realtime: realtimeOptions, global: globalOptions } = options;
21651
21873
  const { db: DEFAULT_DB_OPTIONS$1, auth: DEFAULT_AUTH_OPTIONS$1, realtime: DEFAULT_REALTIME_OPTIONS$1, global: DEFAULT_GLOBAL_OPTIONS$1 } = defaults;
21652
21874
  const result = {
21653
- db: _objectSpread23(_objectSpread23({}, DEFAULT_DB_OPTIONS$1), dbOptions),
21654
- auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS$1), authOptions),
21655
- realtime: _objectSpread23(_objectSpread23({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions),
21875
+ db: _objectSpread22(_objectSpread22({}, DEFAULT_DB_OPTIONS$1), dbOptions),
21876
+ auth: _objectSpread22(_objectSpread22({}, DEFAULT_AUTH_OPTIONS$1), authOptions),
21877
+ realtime: _objectSpread22(_objectSpread22({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions),
21656
21878
  storage: {},
21657
- global: _objectSpread23(_objectSpread23(_objectSpread23({}, DEFAULT_GLOBAL_OPTIONS$1), globalOptions), {}, { headers: _objectSpread23(_objectSpread23({}, (_DEFAULT_GLOBAL_OPTIO = DEFAULT_GLOBAL_OPTIONS$1 === null || DEFAULT_GLOBAL_OPTIONS$1 === void 0 ? void 0 : DEFAULT_GLOBAL_OPTIONS$1.headers) !== null && _DEFAULT_GLOBAL_OPTIO !== void 0 ? _DEFAULT_GLOBAL_OPTIO : {}), (_globalOptions$header = globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.headers) !== null && _globalOptions$header !== void 0 ? _globalOptions$header : {}) }),
21879
+ global: _objectSpread22(_objectSpread22(_objectSpread22({}, DEFAULT_GLOBAL_OPTIONS$1), globalOptions), {}, { headers: _objectSpread22(_objectSpread22({}, (_DEFAULT_GLOBAL_OPTIO = DEFAULT_GLOBAL_OPTIONS$1 === null || DEFAULT_GLOBAL_OPTIONS$1 === void 0 ? void 0 : DEFAULT_GLOBAL_OPTIONS$1.headers) !== null && _DEFAULT_GLOBAL_OPTIO !== void 0 ? _DEFAULT_GLOBAL_OPTIO : {}), (_globalOptions$header = globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.headers) !== null && _globalOptions$header !== void 0 ? _globalOptions$header : {}) }),
21658
21880
  accessToken: async () => ""
21659
21881
  };
21660
21882
  if (options.accessToken) result.accessToken = options.accessToken;
@@ -21712,7 +21934,7 @@ var SupabaseClient = class {
21712
21934
  const DEFAULTS = {
21713
21935
  db: DEFAULT_DB_OPTIONS,
21714
21936
  realtime: DEFAULT_REALTIME_OPTIONS,
21715
- auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }),
21937
+ auth: _objectSpread22(_objectSpread22({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }),
21716
21938
  global: DEFAULT_GLOBAL_OPTIONS
21717
21939
  };
21718
21940
  const settings = applySettingDefaults(options !== null && options !== void 0 ? options : {}, DEFAULTS);
@@ -21728,7 +21950,7 @@ var SupabaseClient = class {
21728
21950
  } });
21729
21951
  }
21730
21952
  this.fetch = fetchWithAuth(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch);
21731
- this.realtime = this._initRealtimeClient(_objectSpread23({
21953
+ this.realtime = this._initRealtimeClient(_objectSpread22({
21732
21954
  headers: this.headers,
21733
21955
  accessToken: this._getAccessToken.bind(this)
21734
21956
  }, settings.realtime));
@@ -21736,9 +21958,7 @@ var SupabaseClient = class {
21736
21958
  this.rest = new PostgrestClient(new URL("rest/v1", baseUrl).href, {
21737
21959
  headers: this.headers,
21738
21960
  schema: settings.db.schema,
21739
- fetch: this.fetch,
21740
- timeout: settings.db.timeout,
21741
- urlLengthLimit: settings.db.urlLengthLimit
21961
+ fetch: this.fetch
21742
21962
  });
21743
21963
  this.storage = new StorageClient(this.storageUrl.href, this.headers, this.fetch, options === null || options === void 0 ? void 0 : options.storage);
21744
21964
  if (!settings.accessToken) this._listenForAuthEvents();
@@ -21845,7 +22065,7 @@ var SupabaseClient = class {
21845
22065
  };
21846
22066
  return new SupabaseAuthClient({
21847
22067
  url: this.authUrl.href,
21848
- headers: _objectSpread23(_objectSpread23({}, authHeaders), headers),
22068
+ headers: _objectSpread22(_objectSpread22({}, authHeaders), headers),
21849
22069
  storageKey,
21850
22070
  autoRefreshToken,
21851
22071
  persistSession,
@@ -21861,7 +22081,7 @@ var SupabaseClient = class {
21861
22081
  });
21862
22082
  }
21863
22083
  _initRealtimeClient(options) {
21864
- return new RealtimeClient(this.realtimeUrl.href, _objectSpread23(_objectSpread23({}, options), {}, { params: _objectSpread23(_objectSpread23({}, { apikey: this.supabaseKey }), options === null || options === void 0 ? void 0 : options.params) }));
22084
+ return new RealtimeClient(this.realtimeUrl.href, _objectSpread22(_objectSpread22({}, options), {}, { params: _objectSpread22(_objectSpread22({}, { apikey: this.supabaseKey }), options === null || options === void 0 ? void 0 : options.params) }));
21865
22085
  }
21866
22086
  _listenForAuthEvents() {
21867
22087
  return this.auth.onAuthStateChange((event, session) => {