@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.js CHANGED
@@ -810,6 +810,7 @@ import { useEffect as useEffect5, useRef as useRef4, useMemo } from "react";
810
810
  import { useState as useState2, useEffect as useEffect4 } from "react";
811
811
 
812
812
  // src/lib/runtimeEnv.ts
813
+ var import_meta = {};
813
814
  var runtimeStore = {};
814
815
  var normalizeValue = (value) => {
815
816
  if (value === null || typeof value === "undefined") return void 0;
@@ -835,6 +836,14 @@ var readFromProcessEnv = (key) => {
835
836
  const processEnv = (_a72 = globalThis.process) == null ? void 0 : _a72.env;
836
837
  return normalizeValue(processEnv == null ? void 0 : processEnv[key]);
837
838
  };
839
+ var readFromImportMetaEnv = (key) => {
840
+ try {
841
+ const importMetaEnv = import_meta.env;
842
+ return normalizeValue(importMetaEnv == null ? void 0 : importMetaEnv[key]);
843
+ } catch (e) {
844
+ return void 0;
845
+ }
846
+ };
838
847
  var getRuntimeEnv = (key) => {
839
848
  var _a72;
840
849
  const normalizedKey = key.trim();
@@ -845,6 +854,8 @@ var getRuntimeEnv = (key) => {
845
854
  if (fromGlobalStore) return fromGlobalStore;
846
855
  const fromGlobalKey = normalizeValue(globalThis[normalizedKey]);
847
856
  if (fromGlobalKey) return fromGlobalKey;
857
+ const fromImportMetaEnv = readFromImportMetaEnv(normalizedKey);
858
+ if (fromImportMetaEnv) return fromImportMetaEnv;
848
859
  return readFromProcessEnv(normalizedKey);
849
860
  };
850
861
  var getRuntimeEnvOr = (key, fallback) => {
@@ -2352,8 +2363,8 @@ var NavbarCupcode = ({
2352
2363
  {
2353
2364
  ref: navRef,
2354
2365
  className: cn(
2355
- "fixed top-0 left-0 right-0 z-[200] pointer-events-auto",
2356
- "glass border-b border-border",
2366
+ "fixed left-2 right-2 top-[max(env(safe-area-inset-top),0.75rem)] z-[200] overflow-hidden rounded-2xl",
2367
+ "glass border-border/70 shadow-[var(--elevation-3)] md:left-4 md:right-4",
2357
2368
  className
2358
2369
  ),
2359
2370
  children: /* @__PURE__ */ jsxs17("div", { className: "cc-container", children: [
@@ -2423,7 +2434,7 @@ var NavbarCupcode = ({
2423
2434
  "div",
2424
2435
  {
2425
2436
  id: mobileMenuId,
2426
- className: "md:hidden max-h-[calc(100dvh-4rem)] space-y-3 overflow-y-auto border-t border-border/60 py-4 animate-slide-up",
2437
+ className: "md:hidden max-h-[calc(100dvh-5rem)] space-y-3 overflow-y-auto border-t border-border/60 py-4 animate-slide-up",
2427
2438
  children: [
2428
2439
  items.map((item, index) => {
2429
2440
  const key = `${item.label}-${index}`;
@@ -8103,7 +8114,7 @@ var UserMenuCupcode = ({
8103
8114
  "button",
8104
8115
  {
8105
8116
  type: "button",
8106
- 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",
8117
+ 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",
8107
8118
  "aria-label": "Alterar status",
8108
8119
  title: "Alterar status",
8109
8120
  children: /* @__PURE__ */ jsx42(PresenceBadge, { status: currentStatus, size: "lg" })
@@ -9910,10 +9921,10 @@ var UserMenuCupcode = ({
9910
9921
  "button",
9911
9922
  {
9912
9923
  type: "button",
9913
- 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",
9924
+ 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",
9914
9925
  "aria-label": "Alterar status",
9915
9926
  title: `Status: ${PRESENCE_META[currentStatus].label}`,
9916
- children: /* @__PURE__ */ jsx42(PresenceBadge, { status: currentStatus, size: "sm" })
9927
+ children: /* @__PURE__ */ jsx42(PresenceBadge, { status: currentStatus, size: "md" })
9917
9928
  }
9918
9929
  ) }),
9919
9930
  /* @__PURE__ */ jsx42(DropdownMenuContent, { align: "end", sideOffset: 8, className: "z-[1800] w-44", children: renderPresenceStatusOptions() })
@@ -10060,7 +10071,7 @@ var getMainNavItems = () => [
10060
10071
  }
10061
10072
  ];
10062
10073
 
10063
- // node_modules/.pnpm/tslib@2.8.1/node_modules/tslib/tslib.es6.mjs
10074
+ // node_modules/tslib/tslib.es6.mjs
10064
10075
  function __rest(s, e) {
10065
10076
  var t = {};
10066
10077
  for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
@@ -10100,7 +10111,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
10100
10111
  });
10101
10112
  }
10102
10113
 
10103
- // node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/helper.js
10114
+ // node_modules/@supabase/functions-js/dist/module/helper.js
10104
10115
  var resolveFetch = (customFetch) => {
10105
10116
  if (customFetch) {
10106
10117
  return (...args) => customFetch(...args);
@@ -10108,7 +10119,7 @@ var resolveFetch = (customFetch) => {
10108
10119
  return (...args) => fetch(...args);
10109
10120
  };
10110
10121
 
10111
- // node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/types.js
10122
+ // node_modules/@supabase/functions-js/dist/module/types.js
10112
10123
  var FunctionsError = class extends Error {
10113
10124
  constructor(message, name = "FunctionsError", context) {
10114
10125
  super(message);
@@ -10150,7 +10161,7 @@ var FunctionRegion;
10150
10161
  FunctionRegion2["UsWest2"] = "us-west-2";
10151
10162
  })(FunctionRegion || (FunctionRegion = {}));
10152
10163
 
10153
- // node_modules/.pnpm/@supabase+functions-js@2.95.1/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
10164
+ // node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
10154
10165
  var FunctionsClient = class {
10155
10166
  /**
10156
10167
  * Creates a new Functions client bound to an Edge Functions URL.
@@ -10290,7 +10301,7 @@ var FunctionsClient = class {
10290
10301
  }
10291
10302
  };
10292
10303
 
10293
- // node_modules/.pnpm/@supabase+postgrest-js@2.95.1/node_modules/@supabase/postgrest-js/dist/index.mjs
10304
+ // node_modules/@supabase/postgrest-js/dist/index.mjs
10294
10305
  var PostgrestError = class extends Error {
10295
10306
  /**
10296
10307
  * @example
@@ -10328,7 +10339,7 @@ var PostgrestBuilder = class {
10328
10339
  * ```
10329
10340
  */
10330
10341
  constructor(builder) {
10331
- var _builder$shouldThrowO, _builder$isMaybeSingl, _builder$urlLengthLim;
10342
+ var _builder$shouldThrowO, _builder$isMaybeSingl;
10332
10343
  this.shouldThrowOnError = false;
10333
10344
  this.method = builder.method;
10334
10345
  this.url = builder.url;
@@ -10338,7 +10349,6 @@ var PostgrestBuilder = class {
10338
10349
  this.shouldThrowOnError = (_builder$shouldThrowO = builder.shouldThrowOnError) !== null && _builder$shouldThrowO !== void 0 ? _builder$shouldThrowO : false;
10339
10350
  this.signal = builder.signal;
10340
10351
  this.isMaybeSingle = (_builder$isMaybeSingl = builder.isMaybeSingle) !== null && _builder$isMaybeSingl !== void 0 ? _builder$isMaybeSingl : false;
10341
- this.urlLengthLimit = (_builder$urlLengthLim = builder.urlLengthLimit) !== null && _builder$urlLengthLim !== void 0 ? _builder$urlLengthLim : 8e3;
10342
10352
  if (builder.fetch) this.fetch = builder.fetch;
10343
10353
  else this.fetch = fetch;
10344
10354
  }
@@ -10439,8 +10449,6 @@ var PostgrestBuilder = class {
10439
10449
  if (!this.shouldThrowOnError) res = res.catch((fetchError) => {
10440
10450
  var _fetchError$name2;
10441
10451
  let errorDetails = "";
10442
- let hint = "";
10443
- let code = "";
10444
10452
  const cause = fetchError === null || fetchError === void 0 ? void 0 : fetchError.cause;
10445
10453
  if (cause) {
10446
10454
  var _cause$message, _cause$code, _fetchError$name, _cause$name;
@@ -10457,22 +10465,12 @@ ${cause.stack}`;
10457
10465
  var _fetchError$stack;
10458
10466
  errorDetails = (_fetchError$stack = fetchError === null || fetchError === void 0 ? void 0 : fetchError.stack) !== null && _fetchError$stack !== void 0 ? _fetchError$stack : "";
10459
10467
  }
10460
- const urlLength = this.url.toString().length;
10461
- if ((fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) === "AbortError" || (fetchError === null || fetchError === void 0 ? void 0 : fetchError.code) === "ABORT_ERR") {
10462
- code = "";
10463
- hint = "Request was aborted (timeout or manual cancellation)";
10464
- 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.`;
10465
- } 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") {
10466
- code = "";
10467
- hint = "HTTP headers exceeded server limits (typically 16KB)";
10468
- 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.`;
10469
- }
10470
10468
  return {
10471
10469
  error: {
10472
10470
  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}`,
10473
10471
  details: errorDetails,
10474
- hint,
10475
- code
10472
+ hint: "",
10473
+ code: ""
10476
10474
  },
10477
10475
  data: null,
10478
10476
  count: null,
@@ -11114,12 +11112,11 @@ var PostgrestQueryBuilder = class {
11114
11112
  * )
11115
11113
  * ```
11116
11114
  */
11117
- constructor(url, { headers = {}, schema, fetch: fetch$1, urlLengthLimit = 8e3 }) {
11115
+ constructor(url, { headers = {}, schema, fetch: fetch$1 }) {
11118
11116
  this.url = url;
11119
11117
  this.headers = new Headers(headers);
11120
11118
  this.schema = schema;
11121
11119
  this.fetch = fetch$1;
11122
- this.urlLengthLimit = urlLengthLimit;
11123
11120
  }
11124
11121
  /**
11125
11122
  * Clone URL and headers to prevent shared state between operations.
@@ -11150,10 +11147,6 @@ var PostgrestQueryBuilder = class {
11150
11147
  *
11151
11148
  * `"estimated"`: Uses exact count for low numbers and planned count for high
11152
11149
  * numbers.
11153
- *
11154
- * @remarks
11155
- * When using `count` with `.range()` or `.limit()`, the returned `count` is the total number of rows
11156
- * that match your filters, not the number of rows in the current page. Use this to build pagination UI.
11157
11150
  */
11158
11151
  select(columns, options) {
11159
11152
  const { head: head2 = false, count: count2 } = options !== null && options !== void 0 ? options : {};
@@ -11172,8 +11165,7 @@ var PostgrestQueryBuilder = class {
11172
11165
  url,
11173
11166
  headers,
11174
11167
  schema: this.schema,
11175
- fetch: this.fetch,
11176
- urlLengthLimit: this.urlLengthLimit
11168
+ fetch: this.fetch
11177
11169
  });
11178
11170
  }
11179
11171
  /**
@@ -11221,8 +11213,7 @@ var PostgrestQueryBuilder = class {
11221
11213
  headers,
11222
11214
  schema: this.schema,
11223
11215
  body: values,
11224
- fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
11225
- urlLengthLimit: this.urlLengthLimit
11216
+ fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
11226
11217
  });
11227
11218
  }
11228
11219
  /**
@@ -11331,8 +11322,7 @@ var PostgrestQueryBuilder = class {
11331
11322
  headers,
11332
11323
  schema: this.schema,
11333
11324
  body: values,
11334
- fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch,
11335
- urlLengthLimit: this.urlLengthLimit
11325
+ fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch
11336
11326
  });
11337
11327
  }
11338
11328
  /**
@@ -11367,8 +11357,7 @@ var PostgrestQueryBuilder = class {
11367
11357
  headers,
11368
11358
  schema: this.schema,
11369
11359
  body: values,
11370
- fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch,
11371
- urlLengthLimit: this.urlLengthLimit
11360
+ fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch
11372
11361
  });
11373
11362
  }
11374
11363
  /**
@@ -11400,62 +11389,10 @@ var PostgrestQueryBuilder = class {
11400
11389
  url,
11401
11390
  headers,
11402
11391
  schema: this.schema,
11403
- fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch,
11404
- urlLengthLimit: this.urlLengthLimit
11392
+ fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch
11405
11393
  });
11406
11394
  }
11407
11395
  };
11408
- function _typeof(o) {
11409
- "@babel/helpers - typeof";
11410
- return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
11411
- return typeof o$1;
11412
- } : function(o$1) {
11413
- return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
11414
- }, _typeof(o);
11415
- }
11416
- function toPrimitive(t, r) {
11417
- if ("object" != _typeof(t) || !t) return t;
11418
- var e = t[Symbol.toPrimitive];
11419
- if (void 0 !== e) {
11420
- var i = e.call(t, r || "default");
11421
- if ("object" != _typeof(i)) return i;
11422
- throw new TypeError("@@toPrimitive must return a primitive value.");
11423
- }
11424
- return ("string" === r ? String : Number)(t);
11425
- }
11426
- function toPropertyKey(t) {
11427
- var i = toPrimitive(t, "string");
11428
- return "symbol" == _typeof(i) ? i : i + "";
11429
- }
11430
- function _defineProperty(e, r, t) {
11431
- return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
11432
- value: t,
11433
- enumerable: true,
11434
- configurable: true,
11435
- writable: true
11436
- }) : e[r] = t, e;
11437
- }
11438
- function ownKeys(e, r) {
11439
- var t = Object.keys(e);
11440
- if (Object.getOwnPropertySymbols) {
11441
- var o = Object.getOwnPropertySymbols(e);
11442
- r && (o = o.filter(function(r$1) {
11443
- return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
11444
- })), t.push.apply(t, o);
11445
- }
11446
- return t;
11447
- }
11448
- function _objectSpread2(e) {
11449
- for (var r = 1; r < arguments.length; r++) {
11450
- var t = null != arguments[r] ? arguments[r] : {};
11451
- r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
11452
- _defineProperty(e, r$1, t[r$1]);
11453
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
11454
- Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
11455
- });
11456
- }
11457
- return e;
11458
- }
11459
11396
  var PostgrestClient = class PostgrestClient2 {
11460
11397
  /**
11461
11398
  * Creates a PostgREST client.
@@ -11465,8 +11402,6 @@ var PostgrestClient = class PostgrestClient2 {
11465
11402
  * @param options.headers - Custom headers
11466
11403
  * @param options.schema - Postgres schema to switch to
11467
11404
  * @param options.fetch - Custom fetch
11468
- * @param options.timeout - Optional timeout in milliseconds for all requests. When set, requests will automatically abort after this duration to prevent indefinite hangs.
11469
- * @param options.urlLengthLimit - Maximum URL length in characters before warnings/errors are triggered. Defaults to 8000.
11470
11405
  * @example
11471
11406
  * ```ts
11472
11407
  * import PostgrestClient from '@supabase/postgrest-js'
@@ -11474,38 +11409,14 @@ var PostgrestClient = class PostgrestClient2 {
11474
11409
  * const postgrest = new PostgrestClient('https://xyzcompany.supabase.co/rest/v1', {
11475
11410
  * headers: { apikey: 'public-anon-key' },
11476
11411
  * schema: 'public',
11477
- * timeout: 30000, // 30 second timeout
11478
11412
  * })
11479
11413
  * ```
11480
11414
  */
11481
- constructor(url, { headers = {}, schema, fetch: fetch$1, timeout, urlLengthLimit = 8e3 } = {}) {
11415
+ constructor(url, { headers = {}, schema, fetch: fetch$1 } = {}) {
11482
11416
  this.url = url;
11483
11417
  this.headers = new Headers(headers);
11484
11418
  this.schemaName = schema;
11485
- this.urlLengthLimit = urlLengthLimit;
11486
- const originalFetch = fetch$1 !== null && fetch$1 !== void 0 ? fetch$1 : globalThis.fetch;
11487
- if (timeout !== void 0 && timeout > 0) this.fetch = (input, init) => {
11488
- const controller = new AbortController();
11489
- const timeoutId = setTimeout(() => controller.abort(), timeout);
11490
- const existingSignal = init === null || init === void 0 ? void 0 : init.signal;
11491
- if (existingSignal) {
11492
- if (existingSignal.aborted) {
11493
- clearTimeout(timeoutId);
11494
- return originalFetch(input, init);
11495
- }
11496
- const abortHandler = () => {
11497
- clearTimeout(timeoutId);
11498
- controller.abort();
11499
- };
11500
- existingSignal.addEventListener("abort", abortHandler, { once: true });
11501
- return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => {
11502
- clearTimeout(timeoutId);
11503
- existingSignal.removeEventListener("abort", abortHandler);
11504
- });
11505
- }
11506
- return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => clearTimeout(timeoutId));
11507
- };
11508
- else this.fetch = originalFetch;
11419
+ this.fetch = fetch$1;
11509
11420
  }
11510
11421
  /**
11511
11422
  * Perform a query on a table or a view.
@@ -11517,8 +11428,7 @@ var PostgrestClient = class PostgrestClient2 {
11517
11428
  return new PostgrestQueryBuilder(new URL(`${this.url}/${relation}`), {
11518
11429
  headers: new Headers(this.headers),
11519
11430
  schema: this.schemaName,
11520
- fetch: this.fetch,
11521
- urlLengthLimit: this.urlLengthLimit
11431
+ fetch: this.fetch
11522
11432
  });
11523
11433
  }
11524
11434
  /**
@@ -11532,8 +11442,7 @@ var PostgrestClient = class PostgrestClient2 {
11532
11442
  return new PostgrestClient2(this.url, {
11533
11443
  headers: this.headers,
11534
11444
  schema,
11535
- fetch: this.fetch,
11536
- urlLengthLimit: this.urlLengthLimit
11445
+ fetch: this.fetch
11537
11446
  });
11538
11447
  }
11539
11448
  /**
@@ -11596,13 +11505,12 @@ var PostgrestClient = class PostgrestClient2 {
11596
11505
  headers,
11597
11506
  schema: this.schemaName,
11598
11507
  body,
11599
- fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
11600
- urlLengthLimit: this.urlLengthLimit
11508
+ fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
11601
11509
  });
11602
11510
  }
11603
11511
  };
11604
11512
 
11605
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
11513
+ // node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
11606
11514
  var WebSocketFactory = class {
11607
11515
  /**
11608
11516
  * Static-only utility – prevent instantiation.
@@ -11718,10 +11626,10 @@ Suggested solution: ${env.workaround}`;
11718
11626
  };
11719
11627
  var websocket_factory_default = WebSocketFactory;
11720
11628
 
11721
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/version.js
11722
- var version = "2.95.1";
11629
+ // node_modules/@supabase/realtime-js/dist/module/lib/version.js
11630
+ var version = "2.91.0";
11723
11631
 
11724
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/constants.js
11632
+ // node_modules/@supabase/realtime-js/dist/module/lib/constants.js
11725
11633
  var DEFAULT_VERSION = `realtime-js/${version}`;
11726
11634
  var VSN_1_0_0 = "1.0.0";
11727
11635
  var VSN_2_0_0 = "2.0.0";
@@ -11765,7 +11673,7 @@ var CONNECTION_STATE;
11765
11673
  CONNECTION_STATE2["Closed"] = "closed";
11766
11674
  })(CONNECTION_STATE || (CONNECTION_STATE = {}));
11767
11675
 
11768
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
11676
+ // node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
11769
11677
  var Serializer = class {
11770
11678
  constructor(allowedMetadataKeys) {
11771
11679
  this.HEADER_LENGTH = 1;
@@ -11905,7 +11813,7 @@ var Serializer = class {
11905
11813
  }
11906
11814
  };
11907
11815
 
11908
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/timer.js
11816
+ // node_modules/@supabase/realtime-js/dist/module/lib/timer.js
11909
11817
  var Timer = class {
11910
11818
  constructor(callback, timerCalc) {
11911
11819
  this.callback = callback;
@@ -11930,7 +11838,7 @@ var Timer = class {
11930
11838
  }
11931
11839
  };
11932
11840
 
11933
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
11841
+ // node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
11934
11842
  var PostgresTypes;
11935
11843
  (function(PostgresTypes2) {
11936
11844
  PostgresTypes2["abstime"] = "abstime";
@@ -12093,7 +12001,7 @@ var httpEndpointURL = (socketUrl) => {
12093
12001
  return wsUrl.href;
12094
12002
  };
12095
12003
 
12096
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/lib/push.js
12004
+ // node_modules/@supabase/realtime-js/dist/module/lib/push.js
12097
12005
  var Push = class {
12098
12006
  /**
12099
12007
  * Initializes the Push
@@ -12192,7 +12100,7 @@ var Push = class {
12192
12100
  }
12193
12101
  };
12194
12102
 
12195
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
12103
+ // node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
12196
12104
  var REALTIME_PRESENCE_LISTEN_EVENTS;
12197
12105
  (function(REALTIME_PRESENCE_LISTEN_EVENTS2) {
12198
12106
  REALTIME_PRESENCE_LISTEN_EVENTS2["SYNC"] = "sync";
@@ -12424,7 +12332,7 @@ var RealtimePresence = class _RealtimePresence {
12424
12332
  }
12425
12333
  };
12426
12334
 
12427
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
12335
+ // node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
12428
12336
  var REALTIME_POSTGRES_CHANGES_LISTEN_EVENT;
12429
12337
  (function(REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2) {
12430
12338
  REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2["ALL"] = "*";
@@ -12864,15 +12772,15 @@ var RealtimeChannel = class _RealtimeChannel {
12864
12772
  }).map((bind) => bind.callback(handledPayload, ref));
12865
12773
  } else {
12866
12774
  (_b6 = this.bindings[typeLower]) === null || _b6 === void 0 ? void 0 : _b6.filter((bind) => {
12867
- var _a73, _b7, _c, _d, _e, _f;
12775
+ var _a73, _b7, _c, _d, _e, _f, _g, _h;
12868
12776
  if (["broadcast", "presence", "postgres_changes"].includes(typeLower)) {
12869
12777
  if ("id" in bind) {
12870
12778
  const bindId = bind.id;
12871
12779
  const bindEvent = (_a73 = bind.filter) === null || _a73 === void 0 ? void 0 : _a73.event;
12872
- 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()));
12780
+ 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));
12873
12781
  } else {
12874
- 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();
12875
- return bindEvent === "*" || bindEvent === ((_f = payload === null || payload === void 0 ? void 0 : payload.event) === null || _f === void 0 ? void 0 : _f.toLocaleLowerCase());
12782
+ 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();
12783
+ return bindEvent === "*" || bindEvent === ((_h = payload === null || payload === void 0 ? void 0 : payload.event) === null || _h === void 0 ? void 0 : _h.toLocaleLowerCase());
12876
12784
  }
12877
12785
  } else {
12878
12786
  return bind.type.toLocaleLowerCase() === typeLower;
@@ -13020,7 +12928,7 @@ var RealtimeChannel = class _RealtimeChannel {
13020
12928
  }
13021
12929
  };
13022
12930
 
13023
- // node_modules/.pnpm/@supabase+realtime-js@2.95.1/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
12931
+ // node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
13024
12932
  var noop2 = () => {
13025
12933
  };
13026
12934
  var CONNECTION_TIMEOUTS = {
@@ -13206,9 +13114,6 @@ Option 2: Install and provide the "ws" package:
13206
13114
  */
13207
13115
  async removeChannel(channel) {
13208
13116
  const status = await channel.unsubscribe();
13209
- if (status === "ok") {
13210
- this._remove(channel);
13211
- }
13212
13117
  if (this.channels.length === 0) {
13213
13118
  this.disconnect();
13214
13119
  }
@@ -13599,11 +13504,6 @@ Option 2: Install and provide the "ws" package:
13599
13504
  this.log("transport", `${error}`);
13600
13505
  this._triggerChanError();
13601
13506
  this._triggerStateCallbacks("error", error);
13602
- try {
13603
- this.heartbeatCallback("error");
13604
- } catch (e) {
13605
- this.log("error", "error in heartbeat callback", e);
13606
- }
13607
13507
  }
13608
13508
  /** @internal */
13609
13509
  _triggerChanError() {
@@ -13781,7 +13681,7 @@ Option 2: Install and provide the "ws" package:
13781
13681
  }
13782
13682
  };
13783
13683
 
13784
- // node_modules/.pnpm/iceberg-js@0.8.1/node_modules/iceberg-js/dist/index.mjs
13684
+ // node_modules/iceberg-js/dist/index.mjs
13785
13685
  var IcebergError = class extends Error {
13786
13686
  constructor(message, opts) {
13787
13687
  var _a72;
@@ -14319,24 +14219,21 @@ var IcebergRestCatalog = class {
14319
14219
  }
14320
14220
  };
14321
14221
 
14322
- // node_modules/.pnpm/@supabase+storage-js@2.95.1/node_modules/@supabase/storage-js/dist/index.mjs
14222
+ // node_modules/@supabase/storage-js/dist/index.mjs
14323
14223
  var StorageError = class extends Error {
14324
- constructor(message, namespace = "storage", status, statusCode) {
14224
+ constructor(message) {
14325
14225
  super(message);
14326
14226
  this.__isStorageError = true;
14327
- this.namespace = namespace;
14328
- this.name = namespace === "vectors" ? "StorageVectorsError" : "StorageError";
14329
- this.status = status;
14330
- this.statusCode = statusCode;
14227
+ this.name = "StorageError";
14331
14228
  }
14332
14229
  };
14333
14230
  function isStorageError(error) {
14334
14231
  return typeof error === "object" && error !== null && "__isStorageError" in error;
14335
14232
  }
14336
14233
  var StorageApiError = class extends StorageError {
14337
- constructor(message, status, statusCode, namespace = "storage") {
14338
- super(message, namespace, status, statusCode);
14339
- this.name = namespace === "vectors" ? "StorageVectorsApiError" : "StorageApiError";
14234
+ constructor(message, status, statusCode) {
14235
+ super(message);
14236
+ this.name = "StorageApiError";
14340
14237
  this.status = status;
14341
14238
  this.statusCode = statusCode;
14342
14239
  }
@@ -14350,20 +14247,18 @@ var StorageApiError = class extends StorageError {
14350
14247
  }
14351
14248
  };
14352
14249
  var StorageUnknownError = class extends StorageError {
14353
- constructor(message, originalError, namespace = "storage") {
14354
- super(message, namespace);
14355
- this.name = namespace === "vectors" ? "StorageVectorsUnknownError" : "StorageUnknownError";
14250
+ constructor(message, originalError) {
14251
+ super(message);
14252
+ this.name = "StorageUnknownError";
14356
14253
  this.originalError = originalError;
14357
14254
  }
14358
14255
  };
14359
- var resolveFetch2 = (customFetch) => {
14256
+ var resolveFetch$1 = (customFetch) => {
14360
14257
  if (customFetch) return (...args) => customFetch(...args);
14361
14258
  return (...args) => fetch(...args);
14362
14259
  };
14363
- var isPlainObject = (value) => {
14364
- if (typeof value !== "object" || value === null) return false;
14365
- const prototype = Object.getPrototypeOf(value);
14366
- return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
14260
+ var resolveResponse$1 = () => {
14261
+ return Response;
14367
14262
  };
14368
14263
  var recursiveToCamel = (item) => {
14369
14264
  if (Array.isArray(item)) return item.map((el) => recursiveToCamel(el));
@@ -14375,6 +14270,11 @@ var recursiveToCamel = (item) => {
14375
14270
  });
14376
14271
  return result;
14377
14272
  };
14273
+ var isPlainObject$1 = (value) => {
14274
+ if (typeof value !== "object" || value === null) return false;
14275
+ const prototype = Object.getPrototypeOf(value);
14276
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
14277
+ };
14378
14278
  var isValidBucketName = (bucketName) => {
14379
14279
  if (!bucketName || typeof bucketName !== "string") return false;
14380
14280
  if (bucketName.length === 0 || bucketName.length > 100) return false;
@@ -14382,37 +14282,37 @@ var isValidBucketName = (bucketName) => {
14382
14282
  if (bucketName.includes("/") || bucketName.includes("\\")) return false;
14383
14283
  return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
14384
14284
  };
14385
- function _typeof2(o) {
14285
+ function _typeof(o) {
14386
14286
  "@babel/helpers - typeof";
14387
- return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
14287
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
14388
14288
  return typeof o$1;
14389
14289
  } : function(o$1) {
14390
14290
  return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
14391
- }, _typeof2(o);
14291
+ }, _typeof(o);
14392
14292
  }
14393
- function toPrimitive2(t, r) {
14394
- if ("object" != _typeof2(t) || !t) return t;
14293
+ function toPrimitive(t, r) {
14294
+ if ("object" != _typeof(t) || !t) return t;
14395
14295
  var e = t[Symbol.toPrimitive];
14396
14296
  if (void 0 !== e) {
14397
14297
  var i = e.call(t, r || "default");
14398
- if ("object" != _typeof2(i)) return i;
14298
+ if ("object" != _typeof(i)) return i;
14399
14299
  throw new TypeError("@@toPrimitive must return a primitive value.");
14400
14300
  }
14401
14301
  return ("string" === r ? String : Number)(t);
14402
14302
  }
14403
- function toPropertyKey2(t) {
14404
- var i = toPrimitive2(t, "string");
14405
- return "symbol" == _typeof2(i) ? i : i + "";
14303
+ function toPropertyKey(t) {
14304
+ var i = toPrimitive(t, "string");
14305
+ return "symbol" == _typeof(i) ? i : i + "";
14406
14306
  }
14407
- function _defineProperty2(e, r, t) {
14408
- return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
14307
+ function _defineProperty(e, r, t) {
14308
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
14409
14309
  value: t,
14410
14310
  enumerable: true,
14411
14311
  configurable: true,
14412
14312
  writable: true
14413
14313
  }) : e[r] = t, e;
14414
14314
  }
14415
- function ownKeys2(e, r) {
14315
+ function ownKeys(e, r) {
14416
14316
  var t = Object.keys(e);
14417
14317
  if (Object.getOwnPropertySymbols) {
14418
14318
  var o = Object.getOwnPropertySymbols(e);
@@ -14422,159 +14322,68 @@ function ownKeys2(e, r) {
14422
14322
  }
14423
14323
  return t;
14424
14324
  }
14425
- function _objectSpread22(e) {
14325
+ function _objectSpread2(e) {
14426
14326
  for (var r = 1; r < arguments.length; r++) {
14427
14327
  var t = null != arguments[r] ? arguments[r] : {};
14428
- r % 2 ? ownKeys2(Object(t), true).forEach(function(r$1) {
14429
- _defineProperty2(e, r$1, t[r$1]);
14430
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r$1) {
14328
+ r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
14329
+ _defineProperty(e, r$1, t[r$1]);
14330
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
14431
14331
  Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
14432
14332
  });
14433
14333
  }
14434
14334
  return e;
14435
14335
  }
14436
- var _getErrorMessage = (err) => {
14336
+ var _getErrorMessage$1 = (err) => {
14437
14337
  var _err$error;
14438
14338
  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);
14439
14339
  };
14440
- var handleError = async (error, reject, options, namespace) => {
14441
- if (error && typeof error === "object" && "status" in error && "ok" in error && typeof error.status === "number" && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) {
14442
- const responseError = error;
14443
- const status = responseError.status || 500;
14444
- if (typeof responseError.json === "function") responseError.json().then((err) => {
14445
- const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
14446
- reject(new StorageApiError(_getErrorMessage(err), status, statusCode, namespace));
14447
- }).catch(() => {
14448
- if (namespace === "vectors") {
14449
- const statusCode = status + "";
14450
- reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
14451
- } else {
14452
- const statusCode = status + "";
14453
- reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
14454
- }
14455
- });
14456
- else {
14457
- const statusCode = status + "";
14458
- reject(new StorageApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode, namespace));
14459
- }
14460
- } else reject(new StorageUnknownError(_getErrorMessage(error), error, namespace));
14340
+ var handleError$1 = async (error, reject, options) => {
14341
+ if (error instanceof await resolveResponse$1() && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) error.json().then((err) => {
14342
+ const status = error.status || 500;
14343
+ const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || status + "";
14344
+ reject(new StorageApiError(_getErrorMessage$1(err), status, statusCode));
14345
+ }).catch((err) => {
14346
+ reject(new StorageUnknownError(_getErrorMessage$1(err), err));
14347
+ });
14348
+ else reject(new StorageUnknownError(_getErrorMessage$1(error), error));
14461
14349
  };
14462
- var _getRequestParams = (method, options, parameters, body) => {
14350
+ var _getRequestParams$1 = (method, options, parameters, body) => {
14463
14351
  const params = {
14464
14352
  method,
14465
14353
  headers: (options === null || options === void 0 ? void 0 : options.headers) || {}
14466
14354
  };
14467
- if (method === "GET" || method === "HEAD" || !body) return _objectSpread22(_objectSpread22({}, params), parameters);
14468
- if (isPlainObject(body)) {
14469
- params.headers = _objectSpread22({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
14355
+ if (method === "GET" || !body) return params;
14356
+ if (isPlainObject$1(body)) {
14357
+ params.headers = _objectSpread2({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
14470
14358
  params.body = JSON.stringify(body);
14471
14359
  } else params.body = body;
14472
14360
  if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex;
14473
- return _objectSpread22(_objectSpread22({}, params), parameters);
14361
+ return _objectSpread2(_objectSpread2({}, params), parameters);
14474
14362
  };
14475
- async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) {
14363
+ async function _handleRequest$1(fetcher, method, url, options, parameters, body) {
14476
14364
  return new Promise((resolve, reject) => {
14477
- fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
14365
+ fetcher(url, _getRequestParams$1(method, options, parameters, body)).then((result) => {
14478
14366
  if (!result.ok) throw result;
14479
14367
  if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
14480
- if (namespace === "vectors") {
14481
- const contentType = result.headers.get("content-type");
14482
- if (result.headers.get("content-length") === "0" || result.status === 204) return {};
14483
- if (!contentType || !contentType.includes("application/json")) return {};
14484
- }
14485
14368
  return result.json();
14486
- }).then((data) => resolve(data)).catch((error) => handleError(error, reject, options, namespace));
14369
+ }).then((data) => resolve(data)).catch((error) => handleError$1(error, reject, options));
14487
14370
  });
14488
14371
  }
14489
- function createFetchApi(namespace = "storage") {
14490
- return {
14491
- get: async (fetcher, url, options, parameters) => {
14492
- return _handleRequest(fetcher, "GET", url, options, parameters, void 0, namespace);
14493
- },
14494
- post: async (fetcher, url, body, options, parameters) => {
14495
- return _handleRequest(fetcher, "POST", url, options, parameters, body, namespace);
14496
- },
14497
- put: async (fetcher, url, body, options, parameters) => {
14498
- return _handleRequest(fetcher, "PUT", url, options, parameters, body, namespace);
14499
- },
14500
- head: async (fetcher, url, options, parameters) => {
14501
- return _handleRequest(fetcher, "HEAD", url, _objectSpread22(_objectSpread22({}, options), {}, { noResolveJson: true }), parameters, void 0, namespace);
14502
- },
14503
- remove: async (fetcher, url, body, options, parameters) => {
14504
- return _handleRequest(fetcher, "DELETE", url, options, parameters, body, namespace);
14505
- }
14506
- };
14372
+ async function get(fetcher, url, options, parameters) {
14373
+ return _handleRequest$1(fetcher, "GET", url, options, parameters);
14374
+ }
14375
+ async function post$1(fetcher, url, body, options, parameters) {
14376
+ return _handleRequest$1(fetcher, "POST", url, options, parameters, body);
14377
+ }
14378
+ async function put(fetcher, url, body, options, parameters) {
14379
+ return _handleRequest$1(fetcher, "PUT", url, options, parameters, body);
14380
+ }
14381
+ async function head(fetcher, url, options, parameters) {
14382
+ return _handleRequest$1(fetcher, "HEAD", url, _objectSpread2(_objectSpread2({}, options), {}, { noResolveJson: true }), parameters);
14383
+ }
14384
+ async function remove(fetcher, url, body, options, parameters) {
14385
+ return _handleRequest$1(fetcher, "DELETE", url, options, parameters, body);
14507
14386
  }
14508
- var defaultApi = createFetchApi("storage");
14509
- var { get, post, put, head, remove } = defaultApi;
14510
- var vectorsApi = createFetchApi("vectors");
14511
- var BaseApiClient = class {
14512
- /**
14513
- * Creates a new BaseApiClient instance
14514
- * @param url - Base URL for API requests
14515
- * @param headers - Default headers for API requests
14516
- * @param fetch - Optional custom fetch implementation
14517
- * @param namespace - Error namespace ('storage' or 'vectors')
14518
- */
14519
- constructor(url, headers = {}, fetch$1, namespace = "storage") {
14520
- this.shouldThrowOnError = false;
14521
- this.url = url;
14522
- this.headers = headers;
14523
- this.fetch = resolveFetch2(fetch$1);
14524
- this.namespace = namespace;
14525
- }
14526
- /**
14527
- * Enable throwing errors instead of returning them.
14528
- * When enabled, errors are thrown instead of returned in { data, error } format.
14529
- *
14530
- * @returns this - For method chaining
14531
- */
14532
- throwOnError() {
14533
- this.shouldThrowOnError = true;
14534
- return this;
14535
- }
14536
- /**
14537
- * Handles API operation with standardized error handling
14538
- * Eliminates repetitive try-catch blocks across all API methods
14539
- *
14540
- * This wrapper:
14541
- * 1. Executes the operation
14542
- * 2. Returns { data, error: null } on success
14543
- * 3. Returns { data: null, error } on failure (if shouldThrowOnError is false)
14544
- * 4. Throws error on failure (if shouldThrowOnError is true)
14545
- *
14546
- * @typeParam T - The expected data type from the operation
14547
- * @param operation - Async function that performs the API call
14548
- * @returns Promise with { data, error } tuple
14549
- *
14550
- * @example
14551
- * ```typescript
14552
- * async listBuckets() {
14553
- * return this.handleOperation(async () => {
14554
- * return await get(this.fetch, `${this.url}/bucket`, {
14555
- * headers: this.headers,
14556
- * })
14557
- * })
14558
- * }
14559
- * ```
14560
- */
14561
- async handleOperation(operation) {
14562
- var _this = this;
14563
- try {
14564
- return {
14565
- data: await operation(),
14566
- error: null
14567
- };
14568
- } catch (error) {
14569
- if (_this.shouldThrowOnError) throw error;
14570
- if (isStorageError(error)) return {
14571
- data: null,
14572
- error
14573
- };
14574
- throw error;
14575
- }
14576
- }
14577
- };
14578
14387
  var StreamDownloadBuilder = class {
14579
14388
  constructor(downloadFn, shouldThrowOnError) {
14580
14389
  this.downloadFn = downloadFn;
@@ -14655,10 +14464,22 @@ var DEFAULT_FILE_OPTIONS = {
14655
14464
  contentType: "text/plain;charset=UTF-8",
14656
14465
  upsert: false
14657
14466
  };
14658
- var StorageFileApi = class extends BaseApiClient {
14467
+ var StorageFileApi = class {
14659
14468
  constructor(url, headers = {}, bucketId, fetch$1) {
14660
- super(url, headers, fetch$1, "storage");
14469
+ this.shouldThrowOnError = false;
14470
+ this.url = url;
14471
+ this.headers = headers;
14661
14472
  this.bucketId = bucketId;
14473
+ this.fetch = resolveFetch$1(fetch$1);
14474
+ }
14475
+ /**
14476
+ * Enable throwing errors instead of returning them.
14477
+ *
14478
+ * @category File Buckets
14479
+ */
14480
+ throwOnError() {
14481
+ this.shouldThrowOnError = true;
14482
+ return this;
14662
14483
  }
14663
14484
  /**
14664
14485
  * Uploads a file to an existing bucket or replaces an existing file at the specified path with a new one.
@@ -14669,10 +14490,10 @@ var StorageFileApi = class extends BaseApiClient {
14669
14490
  */
14670
14491
  async uploadOrUpdate(method, path, fileBody, fileOptions) {
14671
14492
  var _this = this;
14672
- return _this.handleOperation(async () => {
14493
+ try {
14673
14494
  let body;
14674
- const options = _objectSpread22(_objectSpread22({}, DEFAULT_FILE_OPTIONS), fileOptions);
14675
- let headers = _objectSpread22(_objectSpread22({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
14495
+ const options = _objectSpread2(_objectSpread2({}, DEFAULT_FILE_OPTIONS), fileOptions);
14496
+ let headers = _objectSpread2(_objectSpread2({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
14676
14497
  const metadata = options.metadata;
14677
14498
  if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
14678
14499
  body = new FormData();
@@ -14690,16 +14511,26 @@ var StorageFileApi = class extends BaseApiClient {
14690
14511
  if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata));
14691
14512
  if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
14692
14513
  }
14693
- if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers = _objectSpread22(_objectSpread22({}, headers), fileOptions.headers);
14514
+ if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers = _objectSpread2(_objectSpread2({}, headers), fileOptions.headers);
14694
14515
  const cleanPath = _this._removeEmptyFolders(path);
14695
14516
  const _path = _this._getFinalPath(cleanPath);
14696
- 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 } : {}));
14517
+ 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 } : {}));
14697
14518
  return {
14698
- path: cleanPath,
14699
- id: data.Id,
14700
- fullPath: data.Key
14519
+ data: {
14520
+ path: cleanPath,
14521
+ id: data.Id,
14522
+ fullPath: data.Key
14523
+ },
14524
+ error: null
14701
14525
  };
14702
- });
14526
+ } catch (error) {
14527
+ if (_this.shouldThrowOnError) throw error;
14528
+ if (isStorageError(error)) return {
14529
+ data: null,
14530
+ error
14531
+ };
14532
+ throw error;
14533
+ }
14703
14534
  }
14704
14535
  /**
14705
14536
  * Uploads a file to an existing bucket.
@@ -14785,10 +14616,10 @@ var StorageFileApi = class extends BaseApiClient {
14785
14616
  const _path = _this3._getFinalPath(cleanPath);
14786
14617
  const url = new URL(_this3.url + `/object/upload/sign/${_path}`);
14787
14618
  url.searchParams.set("token", token);
14788
- return _this3.handleOperation(async () => {
14619
+ try {
14789
14620
  let body;
14790
- const options = _objectSpread22({ upsert: DEFAULT_FILE_OPTIONS.upsert }, fileOptions);
14791
- const headers = _objectSpread22(_objectSpread22({}, _this3.headers), { "x-upsert": String(options.upsert) });
14621
+ const options = _objectSpread2({ upsert: DEFAULT_FILE_OPTIONS.upsert }, fileOptions);
14622
+ const headers = _objectSpread2(_objectSpread2({}, _this3.headers), { "x-upsert": String(options.upsert) });
14792
14623
  if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
14793
14624
  body = new FormData();
14794
14625
  body.append("cacheControl", options.cacheControl);
@@ -14802,10 +14633,20 @@ var StorageFileApi = class extends BaseApiClient {
14802
14633
  headers["content-type"] = options.contentType;
14803
14634
  }
14804
14635
  return {
14805
- path: cleanPath,
14806
- fullPath: (await put(_this3.fetch, url.toString(), body, { headers })).Key
14636
+ data: {
14637
+ path: cleanPath,
14638
+ fullPath: (await put(_this3.fetch, url.toString(), body, { headers })).Key
14639
+ },
14640
+ error: null
14807
14641
  };
14808
- });
14642
+ } catch (error) {
14643
+ if (_this3.shouldThrowOnError) throw error;
14644
+ if (isStorageError(error)) return {
14645
+ data: null,
14646
+ error
14647
+ };
14648
+ throw error;
14649
+ }
14809
14650
  }
14810
14651
  /**
14811
14652
  * Creates a signed upload URL.
@@ -14839,20 +14680,30 @@ var StorageFileApi = class extends BaseApiClient {
14839
14680
  */
14840
14681
  async createSignedUploadUrl(path, options) {
14841
14682
  var _this4 = this;
14842
- return _this4.handleOperation(async () => {
14683
+ try {
14843
14684
  let _path = _this4._getFinalPath(path);
14844
- const headers = _objectSpread22({}, _this4.headers);
14685
+ const headers = _objectSpread2({}, _this4.headers);
14845
14686
  if (options === null || options === void 0 ? void 0 : options.upsert) headers["x-upsert"] = "true";
14846
- const data = await post(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers });
14687
+ const data = await post$1(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers });
14847
14688
  const url = new URL(_this4.url + data.url);
14848
14689
  const token = url.searchParams.get("token");
14849
14690
  if (!token) throw new StorageError("No token returned by API");
14850
14691
  return {
14851
- signedUrl: url.toString(),
14852
- path,
14853
- token
14692
+ data: {
14693
+ signedUrl: url.toString(),
14694
+ path,
14695
+ token
14696
+ },
14697
+ error: null
14854
14698
  };
14855
- });
14699
+ } catch (error) {
14700
+ if (_this4.shouldThrowOnError) throw error;
14701
+ if (isStorageError(error)) return {
14702
+ data: null,
14703
+ error
14704
+ };
14705
+ throw error;
14706
+ }
14856
14707
  }
14857
14708
  /**
14858
14709
  * Replaces an existing file at the specified path with a new one.
@@ -14930,14 +14781,24 @@ var StorageFileApi = class extends BaseApiClient {
14930
14781
  */
14931
14782
  async move(fromPath, toPath, options) {
14932
14783
  var _this6 = this;
14933
- return _this6.handleOperation(async () => {
14934
- return await post(_this6.fetch, `${_this6.url}/object/move`, {
14935
- bucketId: _this6.bucketId,
14936
- sourceKey: fromPath,
14937
- destinationKey: toPath,
14938
- destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
14939
- }, { headers: _this6.headers });
14940
- });
14784
+ try {
14785
+ return {
14786
+ data: await post$1(_this6.fetch, `${_this6.url}/object/move`, {
14787
+ bucketId: _this6.bucketId,
14788
+ sourceKey: fromPath,
14789
+ destinationKey: toPath,
14790
+ destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
14791
+ }, { headers: _this6.headers }),
14792
+ error: null
14793
+ };
14794
+ } catch (error) {
14795
+ if (_this6.shouldThrowOnError) throw error;
14796
+ if (isStorageError(error)) return {
14797
+ data: null,
14798
+ error
14799
+ };
14800
+ throw error;
14801
+ }
14941
14802
  }
14942
14803
  /**
14943
14804
  * Copies an existing file to a new path in the same bucket.
@@ -14968,17 +14829,27 @@ var StorageFileApi = class extends BaseApiClient {
14968
14829
  */
14969
14830
  async copy(fromPath, toPath, options) {
14970
14831
  var _this7 = this;
14971
- return _this7.handleOperation(async () => {
14972
- return { path: (await post(_this7.fetch, `${_this7.url}/object/copy`, {
14973
- bucketId: _this7.bucketId,
14974
- sourceKey: fromPath,
14975
- destinationKey: toPath,
14976
- destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
14977
- }, { headers: _this7.headers })).Key };
14978
- });
14979
- }
14980
- /**
14981
- * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
14832
+ try {
14833
+ return {
14834
+ data: { path: (await post$1(_this7.fetch, `${_this7.url}/object/copy`, {
14835
+ bucketId: _this7.bucketId,
14836
+ sourceKey: fromPath,
14837
+ destinationKey: toPath,
14838
+ destinationBucket: options === null || options === void 0 ? void 0 : options.destinationBucket
14839
+ }, { headers: _this7.headers })).Key },
14840
+ error: null
14841
+ };
14842
+ } catch (error) {
14843
+ if (_this7.shouldThrowOnError) throw error;
14844
+ if (isStorageError(error)) return {
14845
+ data: null,
14846
+ error
14847
+ };
14848
+ throw error;
14849
+ }
14850
+ }
14851
+ /**
14852
+ * Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
14982
14853
  *
14983
14854
  * @category File Buckets
14984
14855
  * @param path The file path, including the current file name. For example `folder/image.png`.
@@ -15030,12 +14901,23 @@ var StorageFileApi = class extends BaseApiClient {
15030
14901
  */
15031
14902
  async createSignedUrl(path, expiresIn, options) {
15032
14903
  var _this8 = this;
15033
- return _this8.handleOperation(async () => {
14904
+ try {
15034
14905
  let _path = _this8._getFinalPath(path);
15035
- 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 });
14906
+ 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 });
15036
14907
  const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
15037
- return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${downloadQueryParam}`) };
15038
- });
14908
+ data = { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${downloadQueryParam}`) };
14909
+ return {
14910
+ data,
14911
+ error: null
14912
+ };
14913
+ } catch (error) {
14914
+ if (_this8.shouldThrowOnError) throw error;
14915
+ if (isStorageError(error)) return {
14916
+ data: null,
14917
+ error
14918
+ };
14919
+ throw error;
14920
+ }
15039
14921
  }
15040
14922
  /**
15041
14923
  * Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.
@@ -15077,14 +14959,24 @@ var StorageFileApi = class extends BaseApiClient {
15077
14959
  */
15078
14960
  async createSignedUrls(paths, expiresIn, options) {
15079
14961
  var _this9 = this;
15080
- return _this9.handleOperation(async () => {
15081
- const data = await post(_this9.fetch, `${_this9.url}/object/sign/${_this9.bucketId}`, {
14962
+ try {
14963
+ const data = await post$1(_this9.fetch, `${_this9.url}/object/sign/${_this9.bucketId}`, {
15082
14964
  expiresIn,
15083
14965
  paths
15084
14966
  }, { headers: _this9.headers });
15085
14967
  const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
15086
- return data.map((datum) => _objectSpread22(_objectSpread22({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${downloadQueryParam}`) : null }));
15087
- });
14968
+ return {
14969
+ data: data.map((datum) => _objectSpread2(_objectSpread2({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${downloadQueryParam}`) : null })),
14970
+ error: null
14971
+ };
14972
+ } catch (error) {
14973
+ if (_this9.shouldThrowOnError) throw error;
14974
+ if (isStorageError(error)) return {
14975
+ data: null,
14976
+ error
14977
+ };
14978
+ throw error;
14979
+ }
15088
14980
  }
15089
14981
  /**
15090
14982
  * Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead.
@@ -15092,7 +14984,6 @@ var StorageFileApi = class extends BaseApiClient {
15092
14984
  * @category File Buckets
15093
14985
  * @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
15094
14986
  * @param options.transform Transform the asset before serving it to the client.
15095
- * @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
15096
14987
  * @returns BlobDownloadBuilder instance for downloading the file
15097
14988
  *
15098
14989
  * @example Download file
@@ -15124,27 +15015,8 @@ var StorageFileApi = class extends BaseApiClient {
15124
15015
  * }
15125
15016
  * })
15126
15017
  * ```
15127
- *
15128
- * @example Download with cache control (useful in Edge Functions)
15129
- * ```js
15130
- * const { data, error } = await supabase
15131
- * .storage
15132
- * .from('avatars')
15133
- * .download('folder/avatar1.png', {}, { cache: 'no-store' })
15134
- * ```
15135
- *
15136
- * @example Download with abort signal
15137
- * ```js
15138
- * const controller = new AbortController()
15139
- * setTimeout(() => controller.abort(), 5000)
15140
- *
15141
- * const { data, error } = await supabase
15142
- * .storage
15143
- * .from('avatars')
15144
- * .download('folder/avatar1.png', {}, { signal: controller.signal })
15145
- * ```
15146
15018
  */
15147
- download(path, options, parameters) {
15019
+ download(path, options) {
15148
15020
  const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image/authenticated" : "object";
15149
15021
  const transformationQuery = this.transformOptsToQueryString((options === null || options === void 0 ? void 0 : options.transform) || {});
15150
15022
  const queryString = transformationQuery ? `?${transformationQuery}` : "";
@@ -15152,7 +15024,7 @@ var StorageFileApi = class extends BaseApiClient {
15152
15024
  const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString}`, {
15153
15025
  headers: this.headers,
15154
15026
  noResolveJson: true
15155
- }, parameters);
15027
+ });
15156
15028
  return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError);
15157
15029
  }
15158
15030
  /**
@@ -15173,9 +15045,19 @@ var StorageFileApi = class extends BaseApiClient {
15173
15045
  async info(path) {
15174
15046
  var _this10 = this;
15175
15047
  const _path = _this10._getFinalPath(path);
15176
- return _this10.handleOperation(async () => {
15177
- return recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers }));
15178
- });
15048
+ try {
15049
+ return {
15050
+ data: recursiveToCamel(await get(_this10.fetch, `${_this10.url}/object/info/${_path}`, { headers: _this10.headers })),
15051
+ error: null
15052
+ };
15053
+ } catch (error) {
15054
+ if (_this10.shouldThrowOnError) throw error;
15055
+ if (isStorageError(error)) return {
15056
+ data: null,
15057
+ error
15058
+ };
15059
+ throw error;
15060
+ }
15179
15061
  }
15180
15062
  /**
15181
15063
  * Checks the existence of a file.
@@ -15300,9 +15182,19 @@ var StorageFileApi = class extends BaseApiClient {
15300
15182
  */
15301
15183
  async remove(paths) {
15302
15184
  var _this12 = this;
15303
- return _this12.handleOperation(async () => {
15304
- return await remove(_this12.fetch, `${_this12.url}/object/${_this12.bucketId}`, { prefixes: paths }, { headers: _this12.headers });
15305
- });
15185
+ try {
15186
+ return {
15187
+ data: await remove(_this12.fetch, `${_this12.url}/object/${_this12.bucketId}`, { prefixes: paths }, { headers: _this12.headers }),
15188
+ error: null
15189
+ };
15190
+ } catch (error) {
15191
+ if (_this12.shouldThrowOnError) throw error;
15192
+ if (isStorageError(error)) return {
15193
+ data: null,
15194
+ error
15195
+ };
15196
+ throw error;
15197
+ }
15306
15198
  }
15307
15199
  /**
15308
15200
  * Get file metadata
@@ -15374,10 +15266,20 @@ var StorageFileApi = class extends BaseApiClient {
15374
15266
  */
15375
15267
  async list(path, options, parameters) {
15376
15268
  var _this13 = this;
15377
- return _this13.handleOperation(async () => {
15378
- const body = _objectSpread22(_objectSpread22(_objectSpread22({}, DEFAULT_SEARCH_OPTIONS), options), {}, { prefix: path || "" });
15379
- return await post(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters);
15380
- });
15269
+ try {
15270
+ const body = _objectSpread2(_objectSpread2(_objectSpread2({}, DEFAULT_SEARCH_OPTIONS), options), {}, { prefix: path || "" });
15271
+ return {
15272
+ data: await post$1(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters),
15273
+ error: null
15274
+ };
15275
+ } catch (error) {
15276
+ if (_this13.shouldThrowOnError) throw error;
15277
+ if (isStorageError(error)) return {
15278
+ data: null,
15279
+ error
15280
+ };
15281
+ throw error;
15282
+ }
15381
15283
  }
15382
15284
  /**
15383
15285
  * @experimental this method signature might change in the future
@@ -15388,10 +15290,20 @@ var StorageFileApi = class extends BaseApiClient {
15388
15290
  */
15389
15291
  async listV2(options, parameters) {
15390
15292
  var _this14 = this;
15391
- return _this14.handleOperation(async () => {
15392
- const body = _objectSpread22({}, options);
15393
- return await post(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters);
15394
- });
15293
+ try {
15294
+ const body = _objectSpread2({}, options);
15295
+ return {
15296
+ data: await post$1(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters),
15297
+ error: null
15298
+ };
15299
+ } catch (error) {
15300
+ if (_this14.shouldThrowOnError) throw error;
15301
+ if (isStorageError(error)) return {
15302
+ data: null,
15303
+ error
15304
+ };
15305
+ throw error;
15306
+ }
15395
15307
  }
15396
15308
  encodeMetadata(metadata) {
15397
15309
  return JSON.stringify(metadata);
@@ -15416,17 +15328,27 @@ var StorageFileApi = class extends BaseApiClient {
15416
15328
  return params.join("&");
15417
15329
  }
15418
15330
  };
15419
- var version2 = "2.95.1";
15420
- var DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version2}` };
15421
- var StorageBucketApi = class extends BaseApiClient {
15331
+ var version2 = "2.91.0";
15332
+ var DEFAULT_HEADERS$1 = { "X-Client-Info": `storage-js/${version2}` };
15333
+ var StorageBucketApi = class {
15422
15334
  constructor(url, headers = {}, fetch$1, opts) {
15335
+ this.shouldThrowOnError = false;
15423
15336
  const baseUrl = new URL(url);
15424
15337
  if (opts === null || opts === void 0 ? void 0 : opts.useNewHostname) {
15425
15338
  if (/supabase\.(co|in|red)$/.test(baseUrl.hostname) && !baseUrl.hostname.includes("storage.supabase.")) baseUrl.hostname = baseUrl.hostname.replace("supabase.", "storage.supabase.");
15426
15339
  }
15427
- const finalUrl = baseUrl.href.replace(/\/$/, "");
15428
- const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
15429
- super(finalUrl, finalHeaders, fetch$1, "storage");
15340
+ this.url = baseUrl.href.replace(/\/$/, "");
15341
+ this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS$1), headers);
15342
+ this.fetch = resolveFetch$1(fetch$1);
15343
+ }
15344
+ /**
15345
+ * Enable throwing errors instead of returning them.
15346
+ *
15347
+ * @category File Buckets
15348
+ */
15349
+ throwOnError() {
15350
+ this.shouldThrowOnError = true;
15351
+ return this;
15430
15352
  }
15431
15353
  /**
15432
15354
  * Retrieves the details of all Storage buckets within an existing project.
@@ -15462,10 +15384,20 @@ var StorageBucketApi = class extends BaseApiClient {
15462
15384
  */
15463
15385
  async listBuckets(options) {
15464
15386
  var _this = this;
15465
- return _this.handleOperation(async () => {
15387
+ try {
15466
15388
  const queryString = _this.listBucketOptionsToQueryString(options);
15467
- return await get(_this.fetch, `${_this.url}/bucket${queryString}`, { headers: _this.headers });
15468
- });
15389
+ return {
15390
+ data: await get(_this.fetch, `${_this.url}/bucket${queryString}`, { headers: _this.headers }),
15391
+ error: null
15392
+ };
15393
+ } catch (error) {
15394
+ if (_this.shouldThrowOnError) throw error;
15395
+ if (isStorageError(error)) return {
15396
+ data: null,
15397
+ error
15398
+ };
15399
+ throw error;
15400
+ }
15469
15401
  }
15470
15402
  /**
15471
15403
  * Retrieves the details of an existing Storage bucket.
@@ -15502,9 +15434,19 @@ var StorageBucketApi = class extends BaseApiClient {
15502
15434
  */
15503
15435
  async getBucket(id) {
15504
15436
  var _this2 = this;
15505
- return _this2.handleOperation(async () => {
15506
- return await get(_this2.fetch, `${_this2.url}/bucket/${id}`, { headers: _this2.headers });
15507
- });
15437
+ try {
15438
+ return {
15439
+ data: await get(_this2.fetch, `${_this2.url}/bucket/${id}`, { headers: _this2.headers }),
15440
+ error: null
15441
+ };
15442
+ } catch (error) {
15443
+ if (_this2.shouldThrowOnError) throw error;
15444
+ if (isStorageError(error)) return {
15445
+ data: null,
15446
+ error
15447
+ };
15448
+ throw error;
15449
+ }
15508
15450
  }
15509
15451
  /**
15510
15452
  * Creates a new Storage bucket
@@ -15545,16 +15487,26 @@ var StorageBucketApi = class extends BaseApiClient {
15545
15487
  */
15546
15488
  async createBucket(id, options = { public: false }) {
15547
15489
  var _this3 = this;
15548
- return _this3.handleOperation(async () => {
15549
- return await post(_this3.fetch, `${_this3.url}/bucket`, {
15550
- id,
15551
- name: id,
15552
- type: options.type,
15553
- public: options.public,
15554
- file_size_limit: options.fileSizeLimit,
15555
- allowed_mime_types: options.allowedMimeTypes
15556
- }, { headers: _this3.headers });
15557
- });
15490
+ try {
15491
+ return {
15492
+ data: await post$1(_this3.fetch, `${_this3.url}/bucket`, {
15493
+ id,
15494
+ name: id,
15495
+ type: options.type,
15496
+ public: options.public,
15497
+ file_size_limit: options.fileSizeLimit,
15498
+ allowed_mime_types: options.allowedMimeTypes
15499
+ }, { headers: _this3.headers }),
15500
+ error: null
15501
+ };
15502
+ } catch (error) {
15503
+ if (_this3.shouldThrowOnError) throw error;
15504
+ if (isStorageError(error)) return {
15505
+ data: null,
15506
+ error
15507
+ };
15508
+ throw error;
15509
+ }
15558
15510
  }
15559
15511
  /**
15560
15512
  * Updates a Storage bucket
@@ -15593,15 +15545,25 @@ var StorageBucketApi = class extends BaseApiClient {
15593
15545
  */
15594
15546
  async updateBucket(id, options) {
15595
15547
  var _this4 = this;
15596
- return _this4.handleOperation(async () => {
15597
- return await put(_this4.fetch, `${_this4.url}/bucket/${id}`, {
15598
- id,
15599
- name: id,
15600
- public: options.public,
15601
- file_size_limit: options.fileSizeLimit,
15602
- allowed_mime_types: options.allowedMimeTypes
15603
- }, { headers: _this4.headers });
15604
- });
15548
+ try {
15549
+ return {
15550
+ data: await put(_this4.fetch, `${_this4.url}/bucket/${id}`, {
15551
+ id,
15552
+ name: id,
15553
+ public: options.public,
15554
+ file_size_limit: options.fileSizeLimit,
15555
+ allowed_mime_types: options.allowedMimeTypes
15556
+ }, { headers: _this4.headers }),
15557
+ error: null
15558
+ };
15559
+ } catch (error) {
15560
+ if (_this4.shouldThrowOnError) throw error;
15561
+ if (isStorageError(error)) return {
15562
+ data: null,
15563
+ error
15564
+ };
15565
+ throw error;
15566
+ }
15605
15567
  }
15606
15568
  /**
15607
15569
  * Removes all objects inside a single bucket.
@@ -15629,9 +15591,19 @@ var StorageBucketApi = class extends BaseApiClient {
15629
15591
  */
15630
15592
  async emptyBucket(id) {
15631
15593
  var _this5 = this;
15632
- return _this5.handleOperation(async () => {
15633
- return await post(_this5.fetch, `${_this5.url}/bucket/${id}/empty`, {}, { headers: _this5.headers });
15634
- });
15594
+ try {
15595
+ return {
15596
+ data: await post$1(_this5.fetch, `${_this5.url}/bucket/${id}/empty`, {}, { headers: _this5.headers }),
15597
+ error: null
15598
+ };
15599
+ } catch (error) {
15600
+ if (_this5.shouldThrowOnError) throw error;
15601
+ if (isStorageError(error)) return {
15602
+ data: null,
15603
+ error
15604
+ };
15605
+ throw error;
15606
+ }
15635
15607
  }
15636
15608
  /**
15637
15609
  * Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
@@ -15660,9 +15632,19 @@ var StorageBucketApi = class extends BaseApiClient {
15660
15632
  */
15661
15633
  async deleteBucket(id) {
15662
15634
  var _this6 = this;
15663
- return _this6.handleOperation(async () => {
15664
- return await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers });
15665
- });
15635
+ try {
15636
+ return {
15637
+ data: await remove(_this6.fetch, `${_this6.url}/bucket/${id}`, {}, { headers: _this6.headers }),
15638
+ error: null
15639
+ };
15640
+ } catch (error) {
15641
+ if (_this6.shouldThrowOnError) throw error;
15642
+ if (isStorageError(error)) return {
15643
+ data: null,
15644
+ error
15645
+ };
15646
+ throw error;
15647
+ }
15666
15648
  }
15667
15649
  listBucketOptionsToQueryString(options) {
15668
15650
  const params = {};
@@ -15676,7 +15658,7 @@ var StorageBucketApi = class extends BaseApiClient {
15676
15658
  return Object.keys(params).length > 0 ? "?" + new URLSearchParams(params).toString() : "";
15677
15659
  }
15678
15660
  };
15679
- var StorageAnalyticsClient = class extends BaseApiClient {
15661
+ var StorageAnalyticsClient = class {
15680
15662
  /**
15681
15663
  * @alpha
15682
15664
  *
@@ -15695,9 +15677,25 @@ var StorageAnalyticsClient = class extends BaseApiClient {
15695
15677
  * ```
15696
15678
  */
15697
15679
  constructor(url, headers = {}, fetch$1) {
15698
- const finalUrl = url.replace(/\/$/, "");
15699
- const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
15700
- super(finalUrl, finalHeaders, fetch$1, "storage");
15680
+ this.shouldThrowOnError = false;
15681
+ this.url = url.replace(/\/$/, "");
15682
+ this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS$1), headers);
15683
+ this.fetch = resolveFetch$1(fetch$1);
15684
+ }
15685
+ /**
15686
+ * @alpha
15687
+ *
15688
+ * Enable throwing errors instead of returning them in the response
15689
+ * When enabled, failed operations will throw instead of returning { data: null, error }
15690
+ *
15691
+ * **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
15692
+ *
15693
+ * @category Analytics Buckets
15694
+ * @returns This instance for method chaining
15695
+ */
15696
+ throwOnError() {
15697
+ this.shouldThrowOnError = true;
15698
+ return this;
15701
15699
  }
15702
15700
  /**
15703
15701
  * @alpha
@@ -15735,9 +15733,19 @@ var StorageAnalyticsClient = class extends BaseApiClient {
15735
15733
  */
15736
15734
  async createBucket(name) {
15737
15735
  var _this = this;
15738
- return _this.handleOperation(async () => {
15739
- return await post(_this.fetch, `${_this.url}/bucket`, { name }, { headers: _this.headers });
15740
- });
15736
+ try {
15737
+ return {
15738
+ data: await post$1(_this.fetch, `${_this.url}/bucket`, { name }, { headers: _this.headers }),
15739
+ error: null
15740
+ };
15741
+ } catch (error) {
15742
+ if (_this.shouldThrowOnError) throw error;
15743
+ if (isStorageError(error)) return {
15744
+ data: null,
15745
+ error
15746
+ };
15747
+ throw error;
15748
+ }
15741
15749
  }
15742
15750
  /**
15743
15751
  * @alpha
@@ -15787,7 +15795,7 @@ var StorageAnalyticsClient = class extends BaseApiClient {
15787
15795
  */
15788
15796
  async listBuckets(options) {
15789
15797
  var _this2 = this;
15790
- return _this2.handleOperation(async () => {
15798
+ try {
15791
15799
  const queryParams = new URLSearchParams();
15792
15800
  if ((options === null || options === void 0 ? void 0 : options.limit) !== void 0) queryParams.set("limit", options.limit.toString());
15793
15801
  if ((options === null || options === void 0 ? void 0 : options.offset) !== void 0) queryParams.set("offset", options.offset.toString());
@@ -15796,8 +15804,18 @@ var StorageAnalyticsClient = class extends BaseApiClient {
15796
15804
  if (options === null || options === void 0 ? void 0 : options.search) queryParams.set("search", options.search);
15797
15805
  const queryString = queryParams.toString();
15798
15806
  const url = queryString ? `${_this2.url}/bucket?${queryString}` : `${_this2.url}/bucket`;
15799
- return await get(_this2.fetch, url, { headers: _this2.headers });
15800
- });
15807
+ return {
15808
+ data: await get(_this2.fetch, url, { headers: _this2.headers }),
15809
+ error: null
15810
+ };
15811
+ } catch (error) {
15812
+ if (_this2.shouldThrowOnError) throw error;
15813
+ if (isStorageError(error)) return {
15814
+ data: null,
15815
+ error
15816
+ };
15817
+ throw error;
15818
+ }
15801
15819
  }
15802
15820
  /**
15803
15821
  * @alpha
@@ -15832,9 +15850,19 @@ var StorageAnalyticsClient = class extends BaseApiClient {
15832
15850
  */
15833
15851
  async deleteBucket(bucketName) {
15834
15852
  var _this3 = this;
15835
- return _this3.handleOperation(async () => {
15836
- return await remove(_this3.fetch, `${_this3.url}/bucket/${bucketName}`, {}, { headers: _this3.headers });
15837
- });
15853
+ try {
15854
+ return {
15855
+ data: await remove(_this3.fetch, `${_this3.url}/bucket/${bucketName}`, {}, { headers: _this3.headers }),
15856
+ error: null
15857
+ };
15858
+ } catch (error) {
15859
+ if (_this3.shouldThrowOnError) throw error;
15860
+ if (isStorageError(error)) return {
15861
+ data: null,
15862
+ error
15863
+ };
15864
+ throw error;
15865
+ }
15838
15866
  }
15839
15867
  /**
15840
15868
  * @alpha
@@ -15992,133 +16020,371 @@ var StorageAnalyticsClient = class extends BaseApiClient {
15992
16020
  } });
15993
16021
  }
15994
16022
  };
15995
- var VectorIndexApi = class extends BaseApiClient {
16023
+ var DEFAULT_HEADERS = {
16024
+ "X-Client-Info": `storage-js/${version2}`,
16025
+ "Content-Type": "application/json"
16026
+ };
16027
+ var StorageVectorsError = class extends Error {
16028
+ constructor(message) {
16029
+ super(message);
16030
+ this.__isStorageVectorsError = true;
16031
+ this.name = "StorageVectorsError";
16032
+ }
16033
+ };
16034
+ function isStorageVectorsError(error) {
16035
+ return typeof error === "object" && error !== null && "__isStorageVectorsError" in error;
16036
+ }
16037
+ var StorageVectorsApiError = class extends StorageVectorsError {
16038
+ constructor(message, status, statusCode) {
16039
+ super(message);
16040
+ this.name = "StorageVectorsApiError";
16041
+ this.status = status;
16042
+ this.statusCode = statusCode;
16043
+ }
16044
+ toJSON() {
16045
+ return {
16046
+ name: this.name,
16047
+ message: this.message,
16048
+ status: this.status,
16049
+ statusCode: this.statusCode
16050
+ };
16051
+ }
16052
+ };
16053
+ var StorageVectorsUnknownError = class extends StorageVectorsError {
16054
+ constructor(message, originalError) {
16055
+ super(message);
16056
+ this.name = "StorageVectorsUnknownError";
16057
+ this.originalError = originalError;
16058
+ }
16059
+ };
16060
+ var resolveFetch2 = (customFetch) => {
16061
+ if (customFetch) return (...args) => customFetch(...args);
16062
+ return (...args) => fetch(...args);
16063
+ };
16064
+ var isPlainObject = (value) => {
16065
+ if (typeof value !== "object" || value === null) return false;
16066
+ const prototype = Object.getPrototypeOf(value);
16067
+ return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
16068
+ };
16069
+ var _getErrorMessage = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
16070
+ var handleError = async (error, reject, options) => {
16071
+ if (error && typeof error === "object" && "status" in error && "ok" in error && typeof error.status === "number" && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) {
16072
+ const status = error.status || 500;
16073
+ const responseError = error;
16074
+ if (typeof responseError.json === "function") responseError.json().then((err) => {
16075
+ const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
16076
+ reject(new StorageVectorsApiError(_getErrorMessage(err), status, statusCode));
16077
+ }).catch(() => {
16078
+ const statusCode = status + "";
16079
+ reject(new StorageVectorsApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode));
16080
+ });
16081
+ else {
16082
+ const statusCode = status + "";
16083
+ reject(new StorageVectorsApiError(responseError.statusText || `HTTP ${status} error`, status, statusCode));
16084
+ }
16085
+ } else reject(new StorageVectorsUnknownError(_getErrorMessage(error), error));
16086
+ };
16087
+ var _getRequestParams = (method, options, parameters, body) => {
16088
+ const params = {
16089
+ method,
16090
+ headers: (options === null || options === void 0 ? void 0 : options.headers) || {}
16091
+ };
16092
+ if (method === "GET" || !body) return params;
16093
+ if (isPlainObject(body)) {
16094
+ params.headers = _objectSpread2({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
16095
+ params.body = JSON.stringify(body);
16096
+ } else params.body = body;
16097
+ return _objectSpread2(_objectSpread2({}, params), parameters);
16098
+ };
16099
+ async function _handleRequest(fetcher, method, url, options, parameters, body) {
16100
+ return new Promise((resolve, reject) => {
16101
+ fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
16102
+ if (!result.ok) throw result;
16103
+ if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
16104
+ const contentType = result.headers.get("content-type");
16105
+ if (!contentType || !contentType.includes("application/json")) return {};
16106
+ return result.json();
16107
+ }).then((data) => resolve(data)).catch((error) => handleError(error, reject, options));
16108
+ });
16109
+ }
16110
+ async function post(fetcher, url, body, options, parameters) {
16111
+ return _handleRequest(fetcher, "POST", url, options, parameters, body);
16112
+ }
16113
+ var VectorIndexApi = class {
15996
16114
  /** Creates a new VectorIndexApi instance */
15997
16115
  constructor(url, headers = {}, fetch$1) {
15998
- const finalUrl = url.replace(/\/$/, "");
15999
- const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
16000
- super(finalUrl, finalHeaders, fetch$1, "vectors");
16116
+ this.shouldThrowOnError = false;
16117
+ this.url = url.replace(/\/$/, "");
16118
+ this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
16119
+ this.fetch = resolveFetch2(fetch$1);
16120
+ }
16121
+ /** Enable throwing errors instead of returning them in the response */
16122
+ throwOnError() {
16123
+ this.shouldThrowOnError = true;
16124
+ return this;
16001
16125
  }
16002
16126
  /** Creates a new vector index within a bucket */
16003
16127
  async createIndex(options) {
16004
16128
  var _this = this;
16005
- return _this.handleOperation(async () => {
16006
- return await vectorsApi.post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
16007
- });
16129
+ try {
16130
+ return {
16131
+ data: await post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {},
16132
+ error: null
16133
+ };
16134
+ } catch (error) {
16135
+ if (_this.shouldThrowOnError) throw error;
16136
+ if (isStorageVectorsError(error)) return {
16137
+ data: null,
16138
+ error
16139
+ };
16140
+ throw error;
16141
+ }
16008
16142
  }
16009
16143
  /** Retrieves metadata for a specific vector index */
16010
16144
  async getIndex(vectorBucketName, indexName) {
16011
16145
  var _this2 = this;
16012
- return _this2.handleOperation(async () => {
16013
- return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetIndex`, {
16014
- vectorBucketName,
16015
- indexName
16016
- }, { headers: _this2.headers });
16017
- });
16146
+ try {
16147
+ return {
16148
+ data: await post(_this2.fetch, `${_this2.url}/GetIndex`, {
16149
+ vectorBucketName,
16150
+ indexName
16151
+ }, { headers: _this2.headers }),
16152
+ error: null
16153
+ };
16154
+ } catch (error) {
16155
+ if (_this2.shouldThrowOnError) throw error;
16156
+ if (isStorageVectorsError(error)) return {
16157
+ data: null,
16158
+ error
16159
+ };
16160
+ throw error;
16161
+ }
16018
16162
  }
16019
16163
  /** Lists vector indexes within a bucket with optional filtering and pagination */
16020
16164
  async listIndexes(options) {
16021
16165
  var _this3 = this;
16022
- return _this3.handleOperation(async () => {
16023
- return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
16024
- });
16166
+ try {
16167
+ return {
16168
+ data: await post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers }),
16169
+ error: null
16170
+ };
16171
+ } catch (error) {
16172
+ if (_this3.shouldThrowOnError) throw error;
16173
+ if (isStorageVectorsError(error)) return {
16174
+ data: null,
16175
+ error
16176
+ };
16177
+ throw error;
16178
+ }
16025
16179
  }
16026
16180
  /** Deletes a vector index and all its data */
16027
16181
  async deleteIndex(vectorBucketName, indexName) {
16028
16182
  var _this4 = this;
16029
- return _this4.handleOperation(async () => {
16030
- return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
16031
- vectorBucketName,
16032
- indexName
16033
- }, { headers: _this4.headers }) || {};
16034
- });
16183
+ try {
16184
+ return {
16185
+ data: await post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
16186
+ vectorBucketName,
16187
+ indexName
16188
+ }, { headers: _this4.headers }) || {},
16189
+ error: null
16190
+ };
16191
+ } catch (error) {
16192
+ if (_this4.shouldThrowOnError) throw error;
16193
+ if (isStorageVectorsError(error)) return {
16194
+ data: null,
16195
+ error
16196
+ };
16197
+ throw error;
16198
+ }
16035
16199
  }
16036
16200
  };
16037
- var VectorDataApi = class extends BaseApiClient {
16201
+ var VectorDataApi = class {
16038
16202
  /** Creates a new VectorDataApi instance */
16039
16203
  constructor(url, headers = {}, fetch$1) {
16040
- const finalUrl = url.replace(/\/$/, "");
16041
- const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
16042
- super(finalUrl, finalHeaders, fetch$1, "vectors");
16204
+ this.shouldThrowOnError = false;
16205
+ this.url = url.replace(/\/$/, "");
16206
+ this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
16207
+ this.fetch = resolveFetch2(fetch$1);
16208
+ }
16209
+ /** Enable throwing errors instead of returning them in the response */
16210
+ throwOnError() {
16211
+ this.shouldThrowOnError = true;
16212
+ return this;
16043
16213
  }
16044
16214
  /** Inserts or updates vectors in batch (1-500 per request) */
16045
16215
  async putVectors(options) {
16046
16216
  var _this = this;
16047
- if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
16048
- return _this.handleOperation(async () => {
16049
- return await vectorsApi.post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
16050
- });
16217
+ try {
16218
+ if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
16219
+ return {
16220
+ data: await post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {},
16221
+ error: null
16222
+ };
16223
+ } catch (error) {
16224
+ if (_this.shouldThrowOnError) throw error;
16225
+ if (isStorageVectorsError(error)) return {
16226
+ data: null,
16227
+ error
16228
+ };
16229
+ throw error;
16230
+ }
16051
16231
  }
16052
16232
  /** Retrieves vectors by their keys in batch */
16053
16233
  async getVectors(options) {
16054
16234
  var _this2 = this;
16055
- return _this2.handleOperation(async () => {
16056
- return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
16057
- });
16235
+ try {
16236
+ return {
16237
+ data: await post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers }),
16238
+ error: null
16239
+ };
16240
+ } catch (error) {
16241
+ if (_this2.shouldThrowOnError) throw error;
16242
+ if (isStorageVectorsError(error)) return {
16243
+ data: null,
16244
+ error
16245
+ };
16246
+ throw error;
16247
+ }
16058
16248
  }
16059
16249
  /** Lists vectors in an index with pagination */
16060
16250
  async listVectors(options) {
16061
16251
  var _this3 = this;
16062
- if (options.segmentCount !== void 0) {
16063
- if (options.segmentCount < 1 || options.segmentCount > 16) throw new Error("segmentCount must be between 1 and 16");
16064
- if (options.segmentIndex !== void 0) {
16065
- if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
16252
+ try {
16253
+ if (options.segmentCount !== void 0) {
16254
+ if (options.segmentCount < 1 || options.segmentCount > 16) throw new Error("segmentCount must be between 1 and 16");
16255
+ if (options.segmentIndex !== void 0) {
16256
+ if (options.segmentIndex < 0 || options.segmentIndex >= options.segmentCount) throw new Error(`segmentIndex must be between 0 and ${options.segmentCount - 1}`);
16257
+ }
16066
16258
  }
16259
+ return {
16260
+ data: await post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers }),
16261
+ error: null
16262
+ };
16263
+ } catch (error) {
16264
+ if (_this3.shouldThrowOnError) throw error;
16265
+ if (isStorageVectorsError(error)) return {
16266
+ data: null,
16267
+ error
16268
+ };
16269
+ throw error;
16067
16270
  }
16068
- return _this3.handleOperation(async () => {
16069
- return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
16070
- });
16071
16271
  }
16072
16272
  /** Queries for similar vectors using approximate nearest neighbor search */
16073
16273
  async queryVectors(options) {
16074
16274
  var _this4 = this;
16075
- return _this4.handleOperation(async () => {
16076
- return await vectorsApi.post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
16077
- });
16275
+ try {
16276
+ return {
16277
+ data: await post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers }),
16278
+ error: null
16279
+ };
16280
+ } catch (error) {
16281
+ if (_this4.shouldThrowOnError) throw error;
16282
+ if (isStorageVectorsError(error)) return {
16283
+ data: null,
16284
+ error
16285
+ };
16286
+ throw error;
16287
+ }
16078
16288
  }
16079
16289
  /** Deletes vectors by their keys in batch (1-500 per request) */
16080
16290
  async deleteVectors(options) {
16081
16291
  var _this5 = this;
16082
- if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
16083
- return _this5.handleOperation(async () => {
16084
- return await vectorsApi.post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
16085
- });
16292
+ try {
16293
+ if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
16294
+ return {
16295
+ data: await post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {},
16296
+ error: null
16297
+ };
16298
+ } catch (error) {
16299
+ if (_this5.shouldThrowOnError) throw error;
16300
+ if (isStorageVectorsError(error)) return {
16301
+ data: null,
16302
+ error
16303
+ };
16304
+ throw error;
16305
+ }
16086
16306
  }
16087
16307
  };
16088
- var VectorBucketApi = class extends BaseApiClient {
16308
+ var VectorBucketApi = class {
16089
16309
  /** Creates a new VectorBucketApi instance */
16090
16310
  constructor(url, headers = {}, fetch$1) {
16091
- const finalUrl = url.replace(/\/$/, "");
16092
- const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
16093
- super(finalUrl, finalHeaders, fetch$1, "vectors");
16311
+ this.shouldThrowOnError = false;
16312
+ this.url = url.replace(/\/$/, "");
16313
+ this.headers = _objectSpread2(_objectSpread2({}, DEFAULT_HEADERS), headers);
16314
+ this.fetch = resolveFetch2(fetch$1);
16315
+ }
16316
+ /** Enable throwing errors instead of returning them in the response */
16317
+ throwOnError() {
16318
+ this.shouldThrowOnError = true;
16319
+ return this;
16094
16320
  }
16095
16321
  /** Creates a new vector bucket */
16096
16322
  async createBucket(vectorBucketName) {
16097
16323
  var _this = this;
16098
- return _this.handleOperation(async () => {
16099
- return await vectorsApi.post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
16100
- });
16324
+ try {
16325
+ return {
16326
+ data: await post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {},
16327
+ error: null
16328
+ };
16329
+ } catch (error) {
16330
+ if (_this.shouldThrowOnError) throw error;
16331
+ if (isStorageVectorsError(error)) return {
16332
+ data: null,
16333
+ error
16334
+ };
16335
+ throw error;
16336
+ }
16101
16337
  }
16102
16338
  /** Retrieves metadata for a specific vector bucket */
16103
16339
  async getBucket(vectorBucketName) {
16104
16340
  var _this2 = this;
16105
- return _this2.handleOperation(async () => {
16106
- return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
16107
- });
16341
+ try {
16342
+ return {
16343
+ data: await post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers }),
16344
+ error: null
16345
+ };
16346
+ } catch (error) {
16347
+ if (_this2.shouldThrowOnError) throw error;
16348
+ if (isStorageVectorsError(error)) return {
16349
+ data: null,
16350
+ error
16351
+ };
16352
+ throw error;
16353
+ }
16108
16354
  }
16109
16355
  /** Lists vector buckets with optional filtering and pagination */
16110
16356
  async listBuckets(options = {}) {
16111
16357
  var _this3 = this;
16112
- return _this3.handleOperation(async () => {
16113
- return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
16114
- });
16358
+ try {
16359
+ return {
16360
+ data: await post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers }),
16361
+ error: null
16362
+ };
16363
+ } catch (error) {
16364
+ if (_this3.shouldThrowOnError) throw error;
16365
+ if (isStorageVectorsError(error)) return {
16366
+ data: null,
16367
+ error
16368
+ };
16369
+ throw error;
16370
+ }
16115
16371
  }
16116
16372
  /** Deletes a vector bucket (must be empty first) */
16117
16373
  async deleteBucket(vectorBucketName) {
16118
16374
  var _this4 = this;
16119
- return _this4.handleOperation(async () => {
16120
- return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
16121
- });
16375
+ try {
16376
+ return {
16377
+ data: await post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {},
16378
+ error: null
16379
+ };
16380
+ } catch (error) {
16381
+ if (_this4.shouldThrowOnError) throw error;
16382
+ if (isStorageVectorsError(error)) return {
16383
+ data: null,
16384
+ error
16385
+ };
16386
+ throw error;
16387
+ }
16122
16388
  }
16123
16389
  };
16124
16390
  var StorageVectorsClient = class extends VectorBucketApi {
@@ -16315,7 +16581,7 @@ var VectorBucketScope = class extends VectorIndexApi {
16315
16581
  */
16316
16582
  async createIndex(options) {
16317
16583
  var _superprop_getCreateIndex = () => super.createIndex, _this5 = this;
16318
- return _superprop_getCreateIndex().call(_this5, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this5.vectorBucketName }));
16584
+ return _superprop_getCreateIndex().call(_this5, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this5.vectorBucketName }));
16319
16585
  }
16320
16586
  /**
16321
16587
  *
@@ -16338,7 +16604,7 @@ var VectorBucketScope = class extends VectorIndexApi {
16338
16604
  */
16339
16605
  async listIndexes(options = {}) {
16340
16606
  var _superprop_getListIndexes = () => super.listIndexes, _this6 = this;
16341
- return _superprop_getListIndexes().call(_this6, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this6.vectorBucketName }));
16607
+ return _superprop_getListIndexes().call(_this6, _objectSpread2(_objectSpread2({}, options), {}, { vectorBucketName: _this6.vectorBucketName }));
16342
16608
  }
16343
16609
  /**
16344
16610
  *
@@ -16471,7 +16737,7 @@ var VectorIndexScope = class extends VectorDataApi {
16471
16737
  */
16472
16738
  async putVectors(options) {
16473
16739
  var _superprop_getPutVectors = () => super.putVectors, _this9 = this;
16474
- return _superprop_getPutVectors().call(_this9, _objectSpread22(_objectSpread22({}, options), {}, {
16740
+ return _superprop_getPutVectors().call(_this9, _objectSpread2(_objectSpread2({}, options), {}, {
16475
16741
  vectorBucketName: _this9.vectorBucketName,
16476
16742
  indexName: _this9.indexName
16477
16743
  }));
@@ -16500,7 +16766,7 @@ var VectorIndexScope = class extends VectorDataApi {
16500
16766
  */
16501
16767
  async getVectors(options) {
16502
16768
  var _superprop_getGetVectors = () => super.getVectors, _this10 = this;
16503
- return _superprop_getGetVectors().call(_this10, _objectSpread22(_objectSpread22({}, options), {}, {
16769
+ return _superprop_getGetVectors().call(_this10, _objectSpread2(_objectSpread2({}, options), {}, {
16504
16770
  vectorBucketName: _this10.vectorBucketName,
16505
16771
  indexName: _this10.indexName
16506
16772
  }));
@@ -16529,7 +16795,7 @@ var VectorIndexScope = class extends VectorDataApi {
16529
16795
  */
16530
16796
  async listVectors(options = {}) {
16531
16797
  var _superprop_getListVectors = () => super.listVectors, _this11 = this;
16532
- return _superprop_getListVectors().call(_this11, _objectSpread22(_objectSpread22({}, options), {}, {
16798
+ return _superprop_getListVectors().call(_this11, _objectSpread2(_objectSpread2({}, options), {}, {
16533
16799
  vectorBucketName: _this11.vectorBucketName,
16534
16800
  indexName: _this11.indexName
16535
16801
  }));
@@ -16561,7 +16827,7 @@ var VectorIndexScope = class extends VectorDataApi {
16561
16827
  */
16562
16828
  async queryVectors(options) {
16563
16829
  var _superprop_getQueryVectors = () => super.queryVectors, _this12 = this;
16564
- return _superprop_getQueryVectors().call(_this12, _objectSpread22(_objectSpread22({}, options), {}, {
16830
+ return _superprop_getQueryVectors().call(_this12, _objectSpread2(_objectSpread2({}, options), {}, {
16565
16831
  vectorBucketName: _this12.vectorBucketName,
16566
16832
  indexName: _this12.indexName
16567
16833
  }));
@@ -16589,7 +16855,7 @@ var VectorIndexScope = class extends VectorDataApi {
16589
16855
  */
16590
16856
  async deleteVectors(options) {
16591
16857
  var _superprop_getDeleteVectors = () => super.deleteVectors, _this13 = this;
16592
- return _superprop_getDeleteVectors().call(_this13, _objectSpread22(_objectSpread22({}, options), {}, {
16858
+ return _superprop_getDeleteVectors().call(_this13, _objectSpread2(_objectSpread2({}, options), {}, {
16593
16859
  vectorBucketName: _this13.vectorBucketName,
16594
16860
  indexName: _this13.indexName
16595
16861
  }));
@@ -16660,10 +16926,10 @@ var StorageClient = class extends StorageBucketApi {
16660
16926
  }
16661
16927
  };
16662
16928
 
16663
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/version.js
16664
- var version3 = "2.95.1";
16929
+ // node_modules/@supabase/auth-js/dist/module/lib/version.js
16930
+ var version3 = "2.91.0";
16665
16931
 
16666
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/constants.js
16932
+ // node_modules/@supabase/auth-js/dist/module/lib/constants.js
16667
16933
  var AUTO_REFRESH_TICK_DURATION_MS = 30 * 1e3;
16668
16934
  var AUTO_REFRESH_TICK_THRESHOLD = 3;
16669
16935
  var EXPIRY_MARGIN_MS = AUTO_REFRESH_TICK_THRESHOLD * AUTO_REFRESH_TICK_DURATION_MS;
@@ -16680,7 +16946,7 @@ var API_VERSIONS = {
16680
16946
  var BASE64URL_REGEX = /^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;
16681
16947
  var JWKS_TTL = 10 * 60 * 1e3;
16682
16948
 
16683
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/errors.js
16949
+ // node_modules/@supabase/auth-js/dist/module/lib/errors.js
16684
16950
  var AuthError = class extends Error {
16685
16951
  constructor(message, status, code) {
16686
16952
  super(message);
@@ -16794,7 +17060,7 @@ var AuthInvalidJwtError = class extends CustomAuthError {
16794
17060
  }
16795
17061
  };
16796
17062
 
16797
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/base64url.js
17063
+ // node_modules/@supabase/auth-js/dist/module/lib/base64url.js
16798
17064
  var TO_BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split("");
16799
17065
  var IGNORE_BASE64URL = " \n\r=".split("");
16800
17066
  var FROM_BASE64URL = (() => {
@@ -16956,7 +17222,7 @@ function bytesToBase64URL(bytes) {
16956
17222
  return result.join("");
16957
17223
  }
16958
17224
 
16959
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/helpers.js
17225
+ // node_modules/@supabase/auth-js/dist/module/lib/helpers.js
16960
17226
  function expiresAt(expiresIn) {
16961
17227
  const timeNow = Math.round(Date.now() / 1e3);
16962
17228
  return timeNow + expiresIn;
@@ -17238,7 +17504,7 @@ function deepClone(obj) {
17238
17504
  return JSON.parse(JSON.stringify(obj));
17239
17505
  }
17240
17506
 
17241
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/fetch.js
17507
+ // node_modules/@supabase/auth-js/dist/module/lib/fetch.js
17242
17508
  var _getErrorMessage2 = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
17243
17509
  var NETWORK_ERROR_CODES = [502, 503, 504];
17244
17510
  async function handleError2(error) {
@@ -17375,10 +17641,10 @@ function hasSession(data) {
17375
17641
  return data.access_token && data.refresh_token && data.expires_in;
17376
17642
  }
17377
17643
 
17378
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/types.js
17644
+ // node_modules/@supabase/auth-js/dist/module/lib/types.js
17379
17645
  var SIGN_OUT_SCOPES = ["global", "local", "others"];
17380
17646
 
17381
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
17647
+ // node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
17382
17648
  var GoTrueAdminApi = class {
17383
17649
  /**
17384
17650
  * Creates an admin API client that can be used to manage users and OAuth clients.
@@ -17795,7 +18061,7 @@ var GoTrueAdminApi = class {
17795
18061
  }
17796
18062
  };
17797
18063
 
17798
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
18064
+ // node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
17799
18065
  function memoryLocalStorageAdapter(store = {}) {
17800
18066
  return {
17801
18067
  getItem: (key) => {
@@ -17810,7 +18076,7 @@ function memoryLocalStorageAdapter(store = {}) {
17810
18076
  };
17811
18077
  }
17812
18078
 
17813
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/locks.js
18079
+ // node_modules/@supabase/auth-js/dist/module/lib/locks.js
17814
18080
  var internals = {
17815
18081
  /**
17816
18082
  * @experimental
@@ -17878,7 +18144,7 @@ async function navigatorLock(name, acquireTimeout, fn) {
17878
18144
  }));
17879
18145
  }
17880
18146
 
17881
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
18147
+ // node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
17882
18148
  function polyfillGlobalThis() {
17883
18149
  if (typeof globalThis === "object")
17884
18150
  return;
@@ -17898,7 +18164,7 @@ function polyfillGlobalThis() {
17898
18164
  }
17899
18165
  }
17900
18166
 
17901
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
18167
+ // node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
17902
18168
  function getAddress(address) {
17903
18169
  if (!/^0x[a-fA-F0-9]{40}$/.test(address)) {
17904
18170
  throw new Error(`@supabase/auth-js: Address "${address}" is invalid.`);
@@ -17966,7 +18232,7 @@ Request ID: ${requestId}`;
17966
18232
  ${suffix}`;
17967
18233
  }
17968
18234
 
17969
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
18235
+ // node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
17970
18236
  var WebAuthnError = class extends Error {
17971
18237
  constructor({ message, code, cause, name }) {
17972
18238
  var _a72;
@@ -18134,7 +18400,7 @@ function identifyAuthenticationError({ error, options }) {
18134
18400
  });
18135
18401
  }
18136
18402
 
18137
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
18403
+ // node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
18138
18404
  var WebAuthnAbortService = class {
18139
18405
  /**
18140
18406
  * Create an abort signal for a new WebAuthn operation.
@@ -18429,7 +18695,6 @@ var WebAuthnApi = class {
18429
18695
  * @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying Assertion}
18430
18696
  */
18431
18697
  async _challenge({ factorId, webauthn, friendlyName, signal }, overrides) {
18432
- var _a72;
18433
18698
  try {
18434
18699
  const { data: challengeResponse, error: challengeError } = await this.client.mfa.challenge({
18435
18700
  factorId,
@@ -18442,15 +18707,7 @@ var WebAuthnApi = class {
18442
18707
  if (challengeResponse.webauthn.type === "create") {
18443
18708
  const { user } = challengeResponse.webauthn.credential_options.publicKey;
18444
18709
  if (!user.name) {
18445
- const nameToUse = friendlyName;
18446
- if (!nameToUse) {
18447
- const currentUser = await this.client.getUser();
18448
- const userData = currentUser.data.user;
18449
- 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";
18450
- user.name = `${user.id}:${fallbackName}`;
18451
- } else {
18452
- user.name = `${user.id}:${nameToUse}`;
18453
- }
18710
+ user.name = `${user.id}:${friendlyName}`;
18454
18711
  }
18455
18712
  if (!user.displayName) {
18456
18713
  user.displayName = user.name;
@@ -18657,7 +18914,7 @@ var WebAuthnApi = class {
18657
18914
  }
18658
18915
  };
18659
18916
 
18660
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
18917
+ // node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
18661
18918
  polyfillGlobalThis();
18662
18919
  var DEFAULT_OPTIONS = {
18663
18920
  url: GOTRUE_URL,
@@ -18811,16 +19068,10 @@ var GoTrueClient = class _GoTrueClient {
18811
19068
  }
18812
19069
  (_c = this.broadcastChannel) === null || _c === void 0 ? void 0 : _c.addEventListener("message", async (event) => {
18813
19070
  this._debug("received broadcast notification from other tab or client", event);
18814
- try {
18815
- await this._notifyAllSubscribers(event.data.event, event.data.session, false);
18816
- } catch (error) {
18817
- this._debug("#broadcastChannel", "error", error);
18818
- }
19071
+ await this._notifyAllSubscribers(event.data.event, event.data.session, false);
18819
19072
  });
18820
19073
  }
18821
- this.initialize().catch((error) => {
18822
- this._debug("#initialize()", "error", error);
18823
- });
19074
+ this.initialize();
18824
19075
  }
18825
19076
  /**
18826
19077
  * Returns whether error throwing mode is enabled for this client.
@@ -19343,7 +19594,9 @@ var GoTrueClient = class _GoTrueClient {
19343
19594
  }
19344
19595
  if (data.session) {
19345
19596
  await this._saveSession(data.session);
19346
- await this._notifyAllSubscribers("SIGNED_IN", data.session);
19597
+ setTimeout(async () => {
19598
+ await this._notifyAllSubscribers("SIGNED_IN", data.session);
19599
+ }, 0);
19347
19600
  }
19348
19601
  return this._returnResult({ data: Object.assign(Object.assign({}, data), { redirectType: redirectType !== null && redirectType !== void 0 ? redirectType : null }), error });
19349
19602
  } catch (error) {
@@ -19890,7 +20143,7 @@ var GoTrueClient = class _GoTrueClient {
19890
20143
  } else {
19891
20144
  const { data, error } = await this._getUser(currentSession.access_token);
19892
20145
  if (error) {
19893
- return this._returnResult({ data: { user: null, session: null }, error });
20146
+ throw error;
19894
20147
  }
19895
20148
  session = {
19896
20149
  access_token: currentSession.access_token,
@@ -20072,14 +20325,14 @@ var GoTrueClient = class _GoTrueClient {
20072
20325
  return await this._useSession(async (result) => {
20073
20326
  var _a72;
20074
20327
  const { data, error: sessionError } = result;
20075
- if (sessionError && !isAuthSessionMissingError(sessionError)) {
20328
+ if (sessionError) {
20076
20329
  return this._returnResult({ error: sessionError });
20077
20330
  }
20078
20331
  const accessToken = (_a72 = data.session) === null || _a72 === void 0 ? void 0 : _a72.access_token;
20079
20332
  if (accessToken) {
20080
20333
  const { error } = await this.admin.signOut(accessToken, scope);
20081
20334
  if (error) {
20082
- if (!(isAuthApiError(error) && (error.status === 404 || error.status === 401 || error.status === 403) || isAuthSessionMissingError(error))) {
20335
+ if (!(isAuthApiError(error) && (error.status === 404 || error.status === 401 || error.status === 403))) {
20083
20336
  return this._returnResult({ error });
20084
20337
  }
20085
20338
  }
@@ -20666,13 +20919,7 @@ var GoTrueClient = class _GoTrueClient {
20666
20919
  return false;
20667
20920
  }
20668
20921
  try {
20669
- this.visibilityChangedCallback = async () => {
20670
- try {
20671
- await this._onVisibilityChanged(false);
20672
- } catch (error) {
20673
- this._debug("#visibilityChangedCallback", "error", error);
20674
- }
20675
- };
20922
+ this.visibilityChangedCallback = async () => await this._onVisibilityChanged(false);
20676
20923
  window === null || window === void 0 ? void 0 : window.addEventListener("visibilitychange", this.visibilityChangedCallback);
20677
20924
  await this._onVisibilityChanged(true);
20678
20925
  } catch (error) {
@@ -20905,33 +21152,8 @@ var GoTrueClient = class _GoTrueClient {
20905
21152
  /**
20906
21153
  * {@see GoTrueMFAApi#getAuthenticatorAssuranceLevel}
20907
21154
  */
20908
- async _getAuthenticatorAssuranceLevel(jwt) {
20909
- var _a72, _b6, _c, _d;
20910
- if (jwt) {
20911
- try {
20912
- const { payload: payload2 } = decodeJWT(jwt);
20913
- let currentLevel2 = null;
20914
- if (payload2.aal) {
20915
- currentLevel2 = payload2.aal;
20916
- }
20917
- let nextLevel2 = currentLevel2;
20918
- const { data: { user }, error: userError } = await this.getUser(jwt);
20919
- if (userError) {
20920
- return this._returnResult({ data: null, error: userError });
20921
- }
20922
- 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 : [];
20923
- if (verifiedFactors2.length > 0) {
20924
- nextLevel2 = "aal2";
20925
- }
20926
- const currentAuthenticationMethods2 = payload2.amr || [];
20927
- return { data: { currentLevel: currentLevel2, nextLevel: nextLevel2, currentAuthenticationMethods: currentAuthenticationMethods2 }, error: null };
20928
- } catch (error) {
20929
- if (isAuthError(error)) {
20930
- return this._returnResult({ data: null, error });
20931
- }
20932
- throw error;
20933
- }
20934
- }
21155
+ async _getAuthenticatorAssuranceLevel() {
21156
+ var _a72, _b6;
20935
21157
  const { data: { session }, error: sessionError } = await this.getSession();
20936
21158
  if (sessionError) {
20937
21159
  return this._returnResult({ data: null, error: sessionError });
@@ -20948,7 +21170,7 @@ var GoTrueClient = class _GoTrueClient {
20948
21170
  currentLevel = payload.aal;
20949
21171
  }
20950
21172
  let nextLevel = currentLevel;
20951
- const verifiedFactors = (_d = (_c = session.user.factors) === null || _c === void 0 ? void 0 : _c.filter((factor) => factor.status === "verified")) !== null && _d !== void 0 ? _d : [];
21173
+ const verifiedFactors = (_b6 = (_a72 = session.user.factors) === null || _a72 === void 0 ? void 0 : _a72.filter((factor) => factor.status === "verified")) !== null && _b6 !== void 0 ? _b6 : [];
20952
21174
  if (verifiedFactors.length > 0) {
20953
21175
  nextLevel = "aal2";
20954
21176
  }
@@ -20960,7 +21182,7 @@ var GoTrueClient = class _GoTrueClient {
20960
21182
  * Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
20961
21183
  *
20962
21184
  * Returns authorization details including client info, scopes, and user information.
20963
- * If the response includes only a redirect_url field, it means consent was already given - the caller
21185
+ * If the API returns a redirect_uri, it means consent was already given - the caller
20964
21186
  * should handle the redirect manually if needed.
20965
21187
  */
20966
21188
  async _getAuthorizationDetails(authorizationId) {
@@ -21209,12 +21431,12 @@ var GoTrueClient = class _GoTrueClient {
21209
21431
  GoTrueClient.nextInstanceID = {};
21210
21432
  var GoTrueClient_default = GoTrueClient;
21211
21433
 
21212
- // node_modules/.pnpm/@supabase+auth-js@2.95.1/node_modules/@supabase/auth-js/dist/module/AuthClient.js
21434
+ // node_modules/@supabase/auth-js/dist/module/AuthClient.js
21213
21435
  var AuthClient = GoTrueClient_default;
21214
21436
  var AuthClient_default = AuthClient;
21215
21437
 
21216
- // node_modules/.pnpm/@supabase+supabase-js@2.95.1/node_modules/@supabase/supabase-js/dist/index.mjs
21217
- var version4 = "2.95.1";
21438
+ // node_modules/@supabase/supabase-js/dist/index.mjs
21439
+ var version4 = "2.91.0";
21218
21440
  var JS_ENV = "";
21219
21441
  if (typeof Deno !== "undefined") JS_ENV = "deno";
21220
21442
  else if (typeof document !== "undefined") JS_ENV = "web";
@@ -21230,37 +21452,37 @@ var DEFAULT_AUTH_OPTIONS = {
21230
21452
  flowType: "implicit"
21231
21453
  };
21232
21454
  var DEFAULT_REALTIME_OPTIONS = {};
21233
- function _typeof3(o) {
21455
+ function _typeof2(o) {
21234
21456
  "@babel/helpers - typeof";
21235
- return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
21457
+ return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
21236
21458
  return typeof o$1;
21237
21459
  } : function(o$1) {
21238
21460
  return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
21239
- }, _typeof3(o);
21461
+ }, _typeof2(o);
21240
21462
  }
21241
- function toPrimitive3(t, r) {
21242
- if ("object" != _typeof3(t) || !t) return t;
21463
+ function toPrimitive2(t, r) {
21464
+ if ("object" != _typeof2(t) || !t) return t;
21243
21465
  var e = t[Symbol.toPrimitive];
21244
21466
  if (void 0 !== e) {
21245
21467
  var i = e.call(t, r || "default");
21246
- if ("object" != _typeof3(i)) return i;
21468
+ if ("object" != _typeof2(i)) return i;
21247
21469
  throw new TypeError("@@toPrimitive must return a primitive value.");
21248
21470
  }
21249
21471
  return ("string" === r ? String : Number)(t);
21250
21472
  }
21251
- function toPropertyKey3(t) {
21252
- var i = toPrimitive3(t, "string");
21253
- return "symbol" == _typeof3(i) ? i : i + "";
21473
+ function toPropertyKey2(t) {
21474
+ var i = toPrimitive2(t, "string");
21475
+ return "symbol" == _typeof2(i) ? i : i + "";
21254
21476
  }
21255
- function _defineProperty3(e, r, t) {
21256
- return (r = toPropertyKey3(r)) in e ? Object.defineProperty(e, r, {
21477
+ function _defineProperty2(e, r, t) {
21478
+ return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
21257
21479
  value: t,
21258
21480
  enumerable: true,
21259
21481
  configurable: true,
21260
21482
  writable: true
21261
21483
  }) : e[r] = t, e;
21262
21484
  }
21263
- function ownKeys3(e, r) {
21485
+ function ownKeys2(e, r) {
21264
21486
  var t = Object.keys(e);
21265
21487
  if (Object.getOwnPropertySymbols) {
21266
21488
  var o = Object.getOwnPropertySymbols(e);
@@ -21270,12 +21492,12 @@ function ownKeys3(e, r) {
21270
21492
  }
21271
21493
  return t;
21272
21494
  }
21273
- function _objectSpread23(e) {
21495
+ function _objectSpread22(e) {
21274
21496
  for (var r = 1; r < arguments.length; r++) {
21275
21497
  var t = null != arguments[r] ? arguments[r] : {};
21276
- r % 2 ? ownKeys3(Object(t), true).forEach(function(r$1) {
21277
- _defineProperty3(e, r$1, t[r$1]);
21278
- }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys3(Object(t)).forEach(function(r$1) {
21498
+ r % 2 ? ownKeys2(Object(t), true).forEach(function(r$1) {
21499
+ _defineProperty2(e, r$1, t[r$1]);
21500
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r$1) {
21279
21501
  Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
21280
21502
  });
21281
21503
  }
@@ -21297,7 +21519,7 @@ var fetchWithAuth = (supabaseKey, getAccessToken, customFetch) => {
21297
21519
  let headers = new HeadersConstructor(init === null || init === void 0 ? void 0 : init.headers);
21298
21520
  if (!headers.has("apikey")) headers.set("apikey", supabaseKey);
21299
21521
  if (!headers.has("Authorization")) headers.set("Authorization", `Bearer ${accessToken}`);
21300
- return fetch$1(input, _objectSpread23(_objectSpread23({}, init), {}, { headers }));
21522
+ return fetch$1(input, _objectSpread22(_objectSpread22({}, init), {}, { headers }));
21301
21523
  };
21302
21524
  };
21303
21525
  function ensureTrailingSlash(url) {
@@ -21308,11 +21530,11 @@ function applySettingDefaults(options, defaults) {
21308
21530
  const { db: dbOptions, auth: authOptions, realtime: realtimeOptions, global: globalOptions } = options;
21309
21531
  const { db: DEFAULT_DB_OPTIONS$1, auth: DEFAULT_AUTH_OPTIONS$1, realtime: DEFAULT_REALTIME_OPTIONS$1, global: DEFAULT_GLOBAL_OPTIONS$1 } = defaults;
21310
21532
  const result = {
21311
- db: _objectSpread23(_objectSpread23({}, DEFAULT_DB_OPTIONS$1), dbOptions),
21312
- auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS$1), authOptions),
21313
- realtime: _objectSpread23(_objectSpread23({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions),
21533
+ db: _objectSpread22(_objectSpread22({}, DEFAULT_DB_OPTIONS$1), dbOptions),
21534
+ auth: _objectSpread22(_objectSpread22({}, DEFAULT_AUTH_OPTIONS$1), authOptions),
21535
+ realtime: _objectSpread22(_objectSpread22({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions),
21314
21536
  storage: {},
21315
- 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 : {}) }),
21537
+ 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 : {}) }),
21316
21538
  accessToken: async () => ""
21317
21539
  };
21318
21540
  if (options.accessToken) result.accessToken = options.accessToken;
@@ -21370,7 +21592,7 @@ var SupabaseClient = class {
21370
21592
  const DEFAULTS = {
21371
21593
  db: DEFAULT_DB_OPTIONS,
21372
21594
  realtime: DEFAULT_REALTIME_OPTIONS,
21373
- auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }),
21595
+ auth: _objectSpread22(_objectSpread22({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }),
21374
21596
  global: DEFAULT_GLOBAL_OPTIONS
21375
21597
  };
21376
21598
  const settings = applySettingDefaults(options !== null && options !== void 0 ? options : {}, DEFAULTS);
@@ -21386,7 +21608,7 @@ var SupabaseClient = class {
21386
21608
  } });
21387
21609
  }
21388
21610
  this.fetch = fetchWithAuth(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch);
21389
- this.realtime = this._initRealtimeClient(_objectSpread23({
21611
+ this.realtime = this._initRealtimeClient(_objectSpread22({
21390
21612
  headers: this.headers,
21391
21613
  accessToken: this._getAccessToken.bind(this)
21392
21614
  }, settings.realtime));
@@ -21394,9 +21616,7 @@ var SupabaseClient = class {
21394
21616
  this.rest = new PostgrestClient(new URL("rest/v1", baseUrl).href, {
21395
21617
  headers: this.headers,
21396
21618
  schema: settings.db.schema,
21397
- fetch: this.fetch,
21398
- timeout: settings.db.timeout,
21399
- urlLengthLimit: settings.db.urlLengthLimit
21619
+ fetch: this.fetch
21400
21620
  });
21401
21621
  this.storage = new StorageClient(this.storageUrl.href, this.headers, this.fetch, options === null || options === void 0 ? void 0 : options.storage);
21402
21622
  if (!settings.accessToken) this._listenForAuthEvents();
@@ -21503,7 +21723,7 @@ var SupabaseClient = class {
21503
21723
  };
21504
21724
  return new SupabaseAuthClient({
21505
21725
  url: this.authUrl.href,
21506
- headers: _objectSpread23(_objectSpread23({}, authHeaders), headers),
21726
+ headers: _objectSpread22(_objectSpread22({}, authHeaders), headers),
21507
21727
  storageKey,
21508
21728
  autoRefreshToken,
21509
21729
  persistSession,
@@ -21519,7 +21739,7 @@ var SupabaseClient = class {
21519
21739
  });
21520
21740
  }
21521
21741
  _initRealtimeClient(options) {
21522
- return new RealtimeClient(this.realtimeUrl.href, _objectSpread23(_objectSpread23({}, options), {}, { params: _objectSpread23(_objectSpread23({}, { apikey: this.supabaseKey }), options === null || options === void 0 ? void 0 : options.params) }));
21742
+ return new RealtimeClient(this.realtimeUrl.href, _objectSpread22(_objectSpread22({}, options), {}, { params: _objectSpread22(_objectSpread22({}, { apikey: this.supabaseKey }), options === null || options === void 0 ? void 0 : options.params) }));
21523
21743
  }
21524
21744
  _listenForAuthEvents() {
21525
21745
  return this.auth.onAuthStateChange((event, session) => {