@bbearai/react-native 0.6.2 → 0.6.3
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 +254 -116
- package/dist/index.mjs +254 -116
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -309,7 +309,7 @@ var PostgrestBuilder = class {
|
|
|
309
309
|
* ```
|
|
310
310
|
*/
|
|
311
311
|
constructor(builder) {
|
|
312
|
-
var _builder$shouldThrowO, _builder$isMaybeSingl;
|
|
312
|
+
var _builder$shouldThrowO, _builder$isMaybeSingl, _builder$urlLengthLim;
|
|
313
313
|
this.shouldThrowOnError = false;
|
|
314
314
|
this.method = builder.method;
|
|
315
315
|
this.url = builder.url;
|
|
@@ -319,6 +319,7 @@ var PostgrestBuilder = class {
|
|
|
319
319
|
this.shouldThrowOnError = (_builder$shouldThrowO = builder.shouldThrowOnError) !== null && _builder$shouldThrowO !== void 0 ? _builder$shouldThrowO : false;
|
|
320
320
|
this.signal = builder.signal;
|
|
321
321
|
this.isMaybeSingle = (_builder$isMaybeSingl = builder.isMaybeSingle) !== null && _builder$isMaybeSingl !== void 0 ? _builder$isMaybeSingl : false;
|
|
322
|
+
this.urlLengthLimit = (_builder$urlLengthLim = builder.urlLengthLimit) !== null && _builder$urlLengthLim !== void 0 ? _builder$urlLengthLim : 8e3;
|
|
322
323
|
if (builder.fetch) this.fetch = builder.fetch;
|
|
323
324
|
else this.fetch = fetch;
|
|
324
325
|
}
|
|
@@ -419,6 +420,8 @@ var PostgrestBuilder = class {
|
|
|
419
420
|
if (!this.shouldThrowOnError) res = res.catch((fetchError) => {
|
|
420
421
|
var _fetchError$name2;
|
|
421
422
|
let errorDetails = "";
|
|
423
|
+
let hint = "";
|
|
424
|
+
let code = "";
|
|
422
425
|
const cause = fetchError === null || fetchError === void 0 ? void 0 : fetchError.cause;
|
|
423
426
|
if (cause) {
|
|
424
427
|
var _cause$message, _cause$code, _fetchError$name, _cause$name;
|
|
@@ -435,12 +438,22 @@ ${cause.stack}`;
|
|
|
435
438
|
var _fetchError$stack;
|
|
436
439
|
errorDetails = (_fetchError$stack = fetchError === null || fetchError === void 0 ? void 0 : fetchError.stack) !== null && _fetchError$stack !== void 0 ? _fetchError$stack : "";
|
|
437
440
|
}
|
|
441
|
+
const urlLength = this.url.toString().length;
|
|
442
|
+
if ((fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) === "AbortError" || (fetchError === null || fetchError === void 0 ? void 0 : fetchError.code) === "ABORT_ERR") {
|
|
443
|
+
code = "";
|
|
444
|
+
hint = "Request was aborted (timeout or manual cancellation)";
|
|
445
|
+
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.`;
|
|
446
|
+
} 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") {
|
|
447
|
+
code = "";
|
|
448
|
+
hint = "HTTP headers exceeded server limits (typically 16KB)";
|
|
449
|
+
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.`;
|
|
450
|
+
}
|
|
438
451
|
return {
|
|
439
452
|
error: {
|
|
440
453
|
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}`,
|
|
441
454
|
details: errorDetails,
|
|
442
|
-
hint
|
|
443
|
-
code
|
|
455
|
+
hint,
|
|
456
|
+
code
|
|
444
457
|
},
|
|
445
458
|
data: null,
|
|
446
459
|
count: null,
|
|
@@ -1082,11 +1095,12 @@ var PostgrestQueryBuilder = class {
|
|
|
1082
1095
|
* )
|
|
1083
1096
|
* ```
|
|
1084
1097
|
*/
|
|
1085
|
-
constructor(url, { headers = {}, schema, fetch: fetch$1 }) {
|
|
1098
|
+
constructor(url, { headers = {}, schema, fetch: fetch$1, urlLengthLimit = 8e3 }) {
|
|
1086
1099
|
this.url = url;
|
|
1087
1100
|
this.headers = new Headers(headers);
|
|
1088
1101
|
this.schema = schema;
|
|
1089
1102
|
this.fetch = fetch$1;
|
|
1103
|
+
this.urlLengthLimit = urlLengthLimit;
|
|
1090
1104
|
}
|
|
1091
1105
|
/**
|
|
1092
1106
|
* Clone URL and headers to prevent shared state between operations.
|
|
@@ -1139,7 +1153,8 @@ var PostgrestQueryBuilder = class {
|
|
|
1139
1153
|
url,
|
|
1140
1154
|
headers,
|
|
1141
1155
|
schema: this.schema,
|
|
1142
|
-
fetch: this.fetch
|
|
1156
|
+
fetch: this.fetch,
|
|
1157
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1143
1158
|
});
|
|
1144
1159
|
}
|
|
1145
1160
|
/**
|
|
@@ -1187,7 +1202,8 @@ var PostgrestQueryBuilder = class {
|
|
|
1187
1202
|
headers,
|
|
1188
1203
|
schema: this.schema,
|
|
1189
1204
|
body: values,
|
|
1190
|
-
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
|
|
1205
|
+
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
|
|
1206
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1191
1207
|
});
|
|
1192
1208
|
}
|
|
1193
1209
|
/**
|
|
@@ -1296,7 +1312,8 @@ var PostgrestQueryBuilder = class {
|
|
|
1296
1312
|
headers,
|
|
1297
1313
|
schema: this.schema,
|
|
1298
1314
|
body: values,
|
|
1299
|
-
fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch
|
|
1315
|
+
fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch,
|
|
1316
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1300
1317
|
});
|
|
1301
1318
|
}
|
|
1302
1319
|
/**
|
|
@@ -1331,7 +1348,8 @@ var PostgrestQueryBuilder = class {
|
|
|
1331
1348
|
headers,
|
|
1332
1349
|
schema: this.schema,
|
|
1333
1350
|
body: values,
|
|
1334
|
-
fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch
|
|
1351
|
+
fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch,
|
|
1352
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1335
1353
|
});
|
|
1336
1354
|
}
|
|
1337
1355
|
/**
|
|
@@ -1363,10 +1381,62 @@ var PostgrestQueryBuilder = class {
|
|
|
1363
1381
|
url,
|
|
1364
1382
|
headers,
|
|
1365
1383
|
schema: this.schema,
|
|
1366
|
-
fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch
|
|
1384
|
+
fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch,
|
|
1385
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1367
1386
|
});
|
|
1368
1387
|
}
|
|
1369
1388
|
};
|
|
1389
|
+
function _typeof(o) {
|
|
1390
|
+
"@babel/helpers - typeof";
|
|
1391
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
1392
|
+
return typeof o$1;
|
|
1393
|
+
} : function(o$1) {
|
|
1394
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
1395
|
+
}, _typeof(o);
|
|
1396
|
+
}
|
|
1397
|
+
function toPrimitive(t, r) {
|
|
1398
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
1399
|
+
var e = t[Symbol.toPrimitive];
|
|
1400
|
+
if (void 0 !== e) {
|
|
1401
|
+
var i = e.call(t, r || "default");
|
|
1402
|
+
if ("object" != _typeof(i)) return i;
|
|
1403
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1404
|
+
}
|
|
1405
|
+
return ("string" === r ? String : Number)(t);
|
|
1406
|
+
}
|
|
1407
|
+
function toPropertyKey(t) {
|
|
1408
|
+
var i = toPrimitive(t, "string");
|
|
1409
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
1410
|
+
}
|
|
1411
|
+
function _defineProperty(e, r, t) {
|
|
1412
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1413
|
+
value: t,
|
|
1414
|
+
enumerable: true,
|
|
1415
|
+
configurable: true,
|
|
1416
|
+
writable: true
|
|
1417
|
+
}) : e[r] = t, e;
|
|
1418
|
+
}
|
|
1419
|
+
function ownKeys(e, r) {
|
|
1420
|
+
var t = Object.keys(e);
|
|
1421
|
+
if (Object.getOwnPropertySymbols) {
|
|
1422
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
1423
|
+
r && (o = o.filter(function(r$1) {
|
|
1424
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
1425
|
+
})), t.push.apply(t, o);
|
|
1426
|
+
}
|
|
1427
|
+
return t;
|
|
1428
|
+
}
|
|
1429
|
+
function _objectSpread2(e) {
|
|
1430
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1431
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
1432
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
|
|
1433
|
+
_defineProperty(e, r$1, t[r$1]);
|
|
1434
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
1435
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
1436
|
+
});
|
|
1437
|
+
}
|
|
1438
|
+
return e;
|
|
1439
|
+
}
|
|
1370
1440
|
var PostgrestClient = class PostgrestClient2 {
|
|
1371
1441
|
/**
|
|
1372
1442
|
* Creates a PostgREST client.
|
|
@@ -1376,6 +1446,8 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
1376
1446
|
* @param options.headers - Custom headers
|
|
1377
1447
|
* @param options.schema - Postgres schema to switch to
|
|
1378
1448
|
* @param options.fetch - Custom fetch
|
|
1449
|
+
* @param options.timeout - Optional timeout in milliseconds for all requests. When set, requests will automatically abort after this duration to prevent indefinite hangs.
|
|
1450
|
+
* @param options.urlLengthLimit - Maximum URL length in characters before warnings/errors are triggered. Defaults to 8000.
|
|
1379
1451
|
* @example
|
|
1380
1452
|
* ```ts
|
|
1381
1453
|
* import PostgrestClient from '@supabase/postgrest-js'
|
|
@@ -1383,14 +1455,38 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
1383
1455
|
* const postgrest = new PostgrestClient('https://xyzcompany.supabase.co/rest/v1', {
|
|
1384
1456
|
* headers: { apikey: 'public-anon-key' },
|
|
1385
1457
|
* schema: 'public',
|
|
1458
|
+
* timeout: 30000, // 30 second timeout
|
|
1386
1459
|
* })
|
|
1387
1460
|
* ```
|
|
1388
1461
|
*/
|
|
1389
|
-
constructor(url, { headers = {}, schema, fetch: fetch$1 } = {}) {
|
|
1462
|
+
constructor(url, { headers = {}, schema, fetch: fetch$1, timeout, urlLengthLimit = 8e3 } = {}) {
|
|
1390
1463
|
this.url = url;
|
|
1391
1464
|
this.headers = new Headers(headers);
|
|
1392
1465
|
this.schemaName = schema;
|
|
1393
|
-
this.
|
|
1466
|
+
this.urlLengthLimit = urlLengthLimit;
|
|
1467
|
+
const originalFetch = fetch$1 !== null && fetch$1 !== void 0 ? fetch$1 : globalThis.fetch;
|
|
1468
|
+
if (timeout !== void 0 && timeout > 0) this.fetch = (input, init) => {
|
|
1469
|
+
const controller = new AbortController();
|
|
1470
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
1471
|
+
const existingSignal = init === null || init === void 0 ? void 0 : init.signal;
|
|
1472
|
+
if (existingSignal) {
|
|
1473
|
+
if (existingSignal.aborted) {
|
|
1474
|
+
clearTimeout(timeoutId);
|
|
1475
|
+
return originalFetch(input, init);
|
|
1476
|
+
}
|
|
1477
|
+
const abortHandler = () => {
|
|
1478
|
+
clearTimeout(timeoutId);
|
|
1479
|
+
controller.abort();
|
|
1480
|
+
};
|
|
1481
|
+
existingSignal.addEventListener("abort", abortHandler, { once: true });
|
|
1482
|
+
return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => {
|
|
1483
|
+
clearTimeout(timeoutId);
|
|
1484
|
+
existingSignal.removeEventListener("abort", abortHandler);
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => clearTimeout(timeoutId));
|
|
1488
|
+
};
|
|
1489
|
+
else this.fetch = originalFetch;
|
|
1394
1490
|
}
|
|
1395
1491
|
/**
|
|
1396
1492
|
* Perform a query on a table or a view.
|
|
@@ -1402,7 +1498,8 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
1402
1498
|
return new PostgrestQueryBuilder(new URL(`${this.url}/${relation}`), {
|
|
1403
1499
|
headers: new Headers(this.headers),
|
|
1404
1500
|
schema: this.schemaName,
|
|
1405
|
-
fetch: this.fetch
|
|
1501
|
+
fetch: this.fetch,
|
|
1502
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1406
1503
|
});
|
|
1407
1504
|
}
|
|
1408
1505
|
/**
|
|
@@ -1416,7 +1513,8 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
1416
1513
|
return new PostgrestClient2(this.url, {
|
|
1417
1514
|
headers: this.headers,
|
|
1418
1515
|
schema,
|
|
1419
|
-
fetch: this.fetch
|
|
1516
|
+
fetch: this.fetch,
|
|
1517
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1420
1518
|
});
|
|
1421
1519
|
}
|
|
1422
1520
|
/**
|
|
@@ -1479,7 +1577,8 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
1479
1577
|
headers,
|
|
1480
1578
|
schema: this.schemaName,
|
|
1481
1579
|
body,
|
|
1482
|
-
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
|
|
1580
|
+
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
|
|
1581
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1483
1582
|
});
|
|
1484
1583
|
}
|
|
1485
1584
|
};
|
|
@@ -1601,7 +1700,7 @@ Suggested solution: ${env.workaround}`;
|
|
|
1601
1700
|
var websocket_factory_default = WebSocketFactory;
|
|
1602
1701
|
|
|
1603
1702
|
// ../../node_modules/@supabase/realtime-js/dist/module/lib/version.js
|
|
1604
|
-
var version = "2.
|
|
1703
|
+
var version = "2.95.3";
|
|
1605
1704
|
|
|
1606
1705
|
// ../../node_modules/@supabase/realtime-js/dist/module/lib/constants.js
|
|
1607
1706
|
var DEFAULT_VERSION = `realtime-js/${version}`;
|
|
@@ -3088,6 +3187,9 @@ Option 2: Install and provide the "ws" package:
|
|
|
3088
3187
|
*/
|
|
3089
3188
|
async removeChannel(channel) {
|
|
3090
3189
|
const status = await channel.unsubscribe();
|
|
3190
|
+
if (status === "ok") {
|
|
3191
|
+
this._remove(channel);
|
|
3192
|
+
}
|
|
3091
3193
|
if (this.channels.length === 0) {
|
|
3092
3194
|
this.disconnect();
|
|
3093
3195
|
}
|
|
@@ -4256,37 +4358,37 @@ var isValidBucketName = (bucketName) => {
|
|
|
4256
4358
|
if (bucketName.includes("/") || bucketName.includes("\\")) return false;
|
|
4257
4359
|
return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
|
|
4258
4360
|
};
|
|
4259
|
-
function
|
|
4361
|
+
function _typeof2(o) {
|
|
4260
4362
|
"@babel/helpers - typeof";
|
|
4261
|
-
return
|
|
4363
|
+
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
4262
4364
|
return typeof o$1;
|
|
4263
4365
|
} : function(o$1) {
|
|
4264
4366
|
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
4265
|
-
},
|
|
4367
|
+
}, _typeof2(o);
|
|
4266
4368
|
}
|
|
4267
|
-
function
|
|
4268
|
-
if ("object" !=
|
|
4369
|
+
function toPrimitive2(t, r) {
|
|
4370
|
+
if ("object" != _typeof2(t) || !t) return t;
|
|
4269
4371
|
var e = t[Symbol.toPrimitive];
|
|
4270
4372
|
if (void 0 !== e) {
|
|
4271
4373
|
var i = e.call(t, r || "default");
|
|
4272
|
-
if ("object" !=
|
|
4374
|
+
if ("object" != _typeof2(i)) return i;
|
|
4273
4375
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4274
4376
|
}
|
|
4275
4377
|
return ("string" === r ? String : Number)(t);
|
|
4276
4378
|
}
|
|
4277
|
-
function
|
|
4278
|
-
var i =
|
|
4279
|
-
return "symbol" ==
|
|
4379
|
+
function toPropertyKey2(t) {
|
|
4380
|
+
var i = toPrimitive2(t, "string");
|
|
4381
|
+
return "symbol" == _typeof2(i) ? i : i + "";
|
|
4280
4382
|
}
|
|
4281
|
-
function
|
|
4282
|
-
return (r =
|
|
4383
|
+
function _defineProperty2(e, r, t) {
|
|
4384
|
+
return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
|
|
4283
4385
|
value: t,
|
|
4284
4386
|
enumerable: true,
|
|
4285
4387
|
configurable: true,
|
|
4286
4388
|
writable: true
|
|
4287
4389
|
}) : e[r] = t, e;
|
|
4288
4390
|
}
|
|
4289
|
-
function
|
|
4391
|
+
function ownKeys2(e, r) {
|
|
4290
4392
|
var t = Object.keys(e);
|
|
4291
4393
|
if (Object.getOwnPropertySymbols) {
|
|
4292
4394
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -4296,12 +4398,12 @@ function ownKeys(e, r) {
|
|
|
4296
4398
|
}
|
|
4297
4399
|
return t;
|
|
4298
4400
|
}
|
|
4299
|
-
function
|
|
4401
|
+
function _objectSpread22(e) {
|
|
4300
4402
|
for (var r = 1; r < arguments.length; r++) {
|
|
4301
4403
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
4302
|
-
r % 2 ?
|
|
4303
|
-
|
|
4304
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) :
|
|
4404
|
+
r % 2 ? ownKeys2(Object(t), true).forEach(function(r$1) {
|
|
4405
|
+
_defineProperty2(e, r$1, t[r$1]);
|
|
4406
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r$1) {
|
|
4305
4407
|
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
4306
4408
|
});
|
|
4307
4409
|
}
|
|
@@ -4338,13 +4440,13 @@ var _getRequestParams = (method, options, parameters, body) => {
|
|
|
4338
4440
|
method,
|
|
4339
4441
|
headers: (options === null || options === void 0 ? void 0 : options.headers) || {}
|
|
4340
4442
|
};
|
|
4341
|
-
if (method === "GET" || method === "HEAD" || !body) return
|
|
4443
|
+
if (method === "GET" || method === "HEAD" || !body) return _objectSpread22(_objectSpread22({}, params), parameters);
|
|
4342
4444
|
if (isPlainObject(body)) {
|
|
4343
|
-
params.headers =
|
|
4445
|
+
params.headers = _objectSpread22({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
|
|
4344
4446
|
params.body = JSON.stringify(body);
|
|
4345
4447
|
} else params.body = body;
|
|
4346
4448
|
if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex;
|
|
4347
|
-
return
|
|
4449
|
+
return _objectSpread22(_objectSpread22({}, params), parameters);
|
|
4348
4450
|
};
|
|
4349
4451
|
async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) {
|
|
4350
4452
|
return new Promise((resolve, reject) => {
|
|
@@ -4353,6 +4455,7 @@ async function _handleRequest(fetcher, method, url, options, parameters, body, n
|
|
|
4353
4455
|
if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
|
|
4354
4456
|
if (namespace === "vectors") {
|
|
4355
4457
|
const contentType = result.headers.get("content-type");
|
|
4458
|
+
if (result.headers.get("content-length") === "0" || result.status === 204) return {};
|
|
4356
4459
|
if (!contentType || !contentType.includes("application/json")) return {};
|
|
4357
4460
|
}
|
|
4358
4461
|
return result.json();
|
|
@@ -4371,7 +4474,7 @@ function createFetchApi(namespace = "storage") {
|
|
|
4371
4474
|
return _handleRequest(fetcher, "PUT", url, options, parameters, body, namespace);
|
|
4372
4475
|
},
|
|
4373
4476
|
head: async (fetcher, url, options, parameters) => {
|
|
4374
|
-
return _handleRequest(fetcher, "HEAD", url,
|
|
4477
|
+
return _handleRequest(fetcher, "HEAD", url, _objectSpread22(_objectSpread22({}, options), {}, { noResolveJson: true }), parameters, void 0, namespace);
|
|
4375
4478
|
},
|
|
4376
4479
|
remove: async (fetcher, url, body, options, parameters) => {
|
|
4377
4480
|
return _handleRequest(fetcher, "DELETE", url, options, parameters, body, namespace);
|
|
@@ -4380,6 +4483,7 @@ function createFetchApi(namespace = "storage") {
|
|
|
4380
4483
|
}
|
|
4381
4484
|
var defaultApi = createFetchApi("storage");
|
|
4382
4485
|
var { get, post, put, head, remove } = defaultApi;
|
|
4486
|
+
var vectorsApi = createFetchApi("vectors");
|
|
4383
4487
|
var BaseApiClient = class {
|
|
4384
4488
|
/**
|
|
4385
4489
|
* Creates a new BaseApiClient instance
|
|
@@ -4543,8 +4647,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4543
4647
|
var _this = this;
|
|
4544
4648
|
return _this.handleOperation(async () => {
|
|
4545
4649
|
let body;
|
|
4546
|
-
const options =
|
|
4547
|
-
let headers =
|
|
4650
|
+
const options = _objectSpread22(_objectSpread22({}, DEFAULT_FILE_OPTIONS), fileOptions);
|
|
4651
|
+
let headers = _objectSpread22(_objectSpread22({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
|
|
4548
4652
|
const metadata = options.metadata;
|
|
4549
4653
|
if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
|
|
4550
4654
|
body = new FormData();
|
|
@@ -4562,10 +4666,10 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4562
4666
|
if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata));
|
|
4563
4667
|
if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
|
|
4564
4668
|
}
|
|
4565
|
-
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers =
|
|
4669
|
+
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers = _objectSpread22(_objectSpread22({}, headers), fileOptions.headers);
|
|
4566
4670
|
const cleanPath = _this._removeEmptyFolders(path);
|
|
4567
4671
|
const _path = _this._getFinalPath(cleanPath);
|
|
4568
|
-
const data = await (method == "PUT" ? put : post)(_this.fetch, `${_this.url}/object/${_path}`, body,
|
|
4672
|
+
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 } : {}));
|
|
4569
4673
|
return {
|
|
4570
4674
|
path: cleanPath,
|
|
4571
4675
|
id: data.Id,
|
|
@@ -4659,8 +4763,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4659
4763
|
url.searchParams.set("token", token);
|
|
4660
4764
|
return _this3.handleOperation(async () => {
|
|
4661
4765
|
let body;
|
|
4662
|
-
const options =
|
|
4663
|
-
const headers =
|
|
4766
|
+
const options = _objectSpread22({ upsert: DEFAULT_FILE_OPTIONS.upsert }, fileOptions);
|
|
4767
|
+
const headers = _objectSpread22(_objectSpread22({}, _this3.headers), { "x-upsert": String(options.upsert) });
|
|
4664
4768
|
if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
|
|
4665
4769
|
body = new FormData();
|
|
4666
4770
|
body.append("cacheControl", options.cacheControl);
|
|
@@ -4713,7 +4817,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4713
4817
|
var _this4 = this;
|
|
4714
4818
|
return _this4.handleOperation(async () => {
|
|
4715
4819
|
let _path = _this4._getFinalPath(path);
|
|
4716
|
-
const headers =
|
|
4820
|
+
const headers = _objectSpread22({}, _this4.headers);
|
|
4717
4821
|
if (options === null || options === void 0 ? void 0 : options.upsert) headers["x-upsert"] = "true";
|
|
4718
4822
|
const data = await post(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers });
|
|
4719
4823
|
const url = new URL(_this4.url + data.url);
|
|
@@ -4904,7 +5008,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4904
5008
|
var _this8 = this;
|
|
4905
5009
|
return _this8.handleOperation(async () => {
|
|
4906
5010
|
let _path = _this8._getFinalPath(path);
|
|
4907
|
-
let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`,
|
|
5011
|
+
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 });
|
|
4908
5012
|
const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
|
|
4909
5013
|
return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${downloadQueryParam}`) };
|
|
4910
5014
|
});
|
|
@@ -4955,7 +5059,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4955
5059
|
paths
|
|
4956
5060
|
}, { headers: _this9.headers });
|
|
4957
5061
|
const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
|
|
4958
|
-
return data.map((datum) =>
|
|
5062
|
+
return data.map((datum) => _objectSpread22(_objectSpread22({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${downloadQueryParam}`) : null }));
|
|
4959
5063
|
});
|
|
4960
5064
|
}
|
|
4961
5065
|
/**
|
|
@@ -4964,6 +5068,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4964
5068
|
* @category File Buckets
|
|
4965
5069
|
* @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
|
|
4966
5070
|
* @param options.transform Transform the asset before serving it to the client.
|
|
5071
|
+
* @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
|
|
4967
5072
|
* @returns BlobDownloadBuilder instance for downloading the file
|
|
4968
5073
|
*
|
|
4969
5074
|
* @example Download file
|
|
@@ -4995,8 +5100,27 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4995
5100
|
* }
|
|
4996
5101
|
* })
|
|
4997
5102
|
* ```
|
|
5103
|
+
*
|
|
5104
|
+
* @example Download with cache control (useful in Edge Functions)
|
|
5105
|
+
* ```js
|
|
5106
|
+
* const { data, error } = await supabase
|
|
5107
|
+
* .storage
|
|
5108
|
+
* .from('avatars')
|
|
5109
|
+
* .download('folder/avatar1.png', {}, { cache: 'no-store' })
|
|
5110
|
+
* ```
|
|
5111
|
+
*
|
|
5112
|
+
* @example Download with abort signal
|
|
5113
|
+
* ```js
|
|
5114
|
+
* const controller = new AbortController()
|
|
5115
|
+
* setTimeout(() => controller.abort(), 5000)
|
|
5116
|
+
*
|
|
5117
|
+
* const { data, error } = await supabase
|
|
5118
|
+
* .storage
|
|
5119
|
+
* .from('avatars')
|
|
5120
|
+
* .download('folder/avatar1.png', {}, { signal: controller.signal })
|
|
5121
|
+
* ```
|
|
4998
5122
|
*/
|
|
4999
|
-
download(path, options) {
|
|
5123
|
+
download(path, options, parameters) {
|
|
5000
5124
|
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image/authenticated" : "object";
|
|
5001
5125
|
const transformationQuery = this.transformOptsToQueryString((options === null || options === void 0 ? void 0 : options.transform) || {});
|
|
5002
5126
|
const queryString = transformationQuery ? `?${transformationQuery}` : "";
|
|
@@ -5004,7 +5128,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
5004
5128
|
const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString}`, {
|
|
5005
5129
|
headers: this.headers,
|
|
5006
5130
|
noResolveJson: true
|
|
5007
|
-
});
|
|
5131
|
+
}, parameters);
|
|
5008
5132
|
return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError);
|
|
5009
5133
|
}
|
|
5010
5134
|
/**
|
|
@@ -5227,7 +5351,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
5227
5351
|
async list(path, options, parameters) {
|
|
5228
5352
|
var _this13 = this;
|
|
5229
5353
|
return _this13.handleOperation(async () => {
|
|
5230
|
-
const body =
|
|
5354
|
+
const body = _objectSpread22(_objectSpread22(_objectSpread22({}, DEFAULT_SEARCH_OPTIONS), options), {}, { prefix: path || "" });
|
|
5231
5355
|
return await post(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters);
|
|
5232
5356
|
});
|
|
5233
5357
|
}
|
|
@@ -5241,7 +5365,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
5241
5365
|
async listV2(options, parameters) {
|
|
5242
5366
|
var _this14 = this;
|
|
5243
5367
|
return _this14.handleOperation(async () => {
|
|
5244
|
-
const body =
|
|
5368
|
+
const body = _objectSpread22({}, options);
|
|
5245
5369
|
return await post(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters);
|
|
5246
5370
|
});
|
|
5247
5371
|
}
|
|
@@ -5268,7 +5392,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
5268
5392
|
return params.join("&");
|
|
5269
5393
|
}
|
|
5270
5394
|
};
|
|
5271
|
-
var version2 = "2.
|
|
5395
|
+
var version2 = "2.95.3";
|
|
5272
5396
|
var DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version2}` };
|
|
5273
5397
|
var StorageBucketApi = class extends BaseApiClient {
|
|
5274
5398
|
constructor(url, headers = {}, fetch$1, opts) {
|
|
@@ -5277,7 +5401,7 @@ var StorageBucketApi = class extends BaseApiClient {
|
|
|
5277
5401
|
if (/supabase\.(co|in|red)$/.test(baseUrl.hostname) && !baseUrl.hostname.includes("storage.supabase.")) baseUrl.hostname = baseUrl.hostname.replace("supabase.", "storage.supabase.");
|
|
5278
5402
|
}
|
|
5279
5403
|
const finalUrl = baseUrl.href.replace(/\/$/, "");
|
|
5280
|
-
const finalHeaders =
|
|
5404
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
|
|
5281
5405
|
super(finalUrl, finalHeaders, fetch$1, "storage");
|
|
5282
5406
|
}
|
|
5283
5407
|
/**
|
|
@@ -5548,7 +5672,7 @@ var StorageAnalyticsClient = class extends BaseApiClient {
|
|
|
5548
5672
|
*/
|
|
5549
5673
|
constructor(url, headers = {}, fetch$1) {
|
|
5550
5674
|
const finalUrl = url.replace(/\/$/, "");
|
|
5551
|
-
const finalHeaders =
|
|
5675
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
|
|
5552
5676
|
super(finalUrl, finalHeaders, fetch$1, "storage");
|
|
5553
5677
|
}
|
|
5554
5678
|
/**
|
|
@@ -5848,21 +5972,21 @@ var VectorIndexApi = class extends BaseApiClient {
|
|
|
5848
5972
|
/** Creates a new VectorIndexApi instance */
|
|
5849
5973
|
constructor(url, headers = {}, fetch$1) {
|
|
5850
5974
|
const finalUrl = url.replace(/\/$/, "");
|
|
5851
|
-
const finalHeaders =
|
|
5975
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
5852
5976
|
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
5853
5977
|
}
|
|
5854
5978
|
/** Creates a new vector index within a bucket */
|
|
5855
5979
|
async createIndex(options) {
|
|
5856
5980
|
var _this = this;
|
|
5857
5981
|
return _this.handleOperation(async () => {
|
|
5858
|
-
return await post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
|
|
5982
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
|
|
5859
5983
|
});
|
|
5860
5984
|
}
|
|
5861
5985
|
/** Retrieves metadata for a specific vector index */
|
|
5862
5986
|
async getIndex(vectorBucketName, indexName) {
|
|
5863
5987
|
var _this2 = this;
|
|
5864
5988
|
return _this2.handleOperation(async () => {
|
|
5865
|
-
return await post(_this2.fetch, `${_this2.url}/GetIndex`, {
|
|
5989
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetIndex`, {
|
|
5866
5990
|
vectorBucketName,
|
|
5867
5991
|
indexName
|
|
5868
5992
|
}, { headers: _this2.headers });
|
|
@@ -5872,14 +5996,14 @@ var VectorIndexApi = class extends BaseApiClient {
|
|
|
5872
5996
|
async listIndexes(options) {
|
|
5873
5997
|
var _this3 = this;
|
|
5874
5998
|
return _this3.handleOperation(async () => {
|
|
5875
|
-
return await post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
|
|
5999
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
|
|
5876
6000
|
});
|
|
5877
6001
|
}
|
|
5878
6002
|
/** Deletes a vector index and all its data */
|
|
5879
6003
|
async deleteIndex(vectorBucketName, indexName) {
|
|
5880
6004
|
var _this4 = this;
|
|
5881
6005
|
return _this4.handleOperation(async () => {
|
|
5882
|
-
return await post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
|
|
6006
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
|
|
5883
6007
|
vectorBucketName,
|
|
5884
6008
|
indexName
|
|
5885
6009
|
}, { headers: _this4.headers }) || {};
|
|
@@ -5890,7 +6014,7 @@ var VectorDataApi = class extends BaseApiClient {
|
|
|
5890
6014
|
/** Creates a new VectorDataApi instance */
|
|
5891
6015
|
constructor(url, headers = {}, fetch$1) {
|
|
5892
6016
|
const finalUrl = url.replace(/\/$/, "");
|
|
5893
|
-
const finalHeaders =
|
|
6017
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
5894
6018
|
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
5895
6019
|
}
|
|
5896
6020
|
/** Inserts or updates vectors in batch (1-500 per request) */
|
|
@@ -5898,14 +6022,14 @@ var VectorDataApi = class extends BaseApiClient {
|
|
|
5898
6022
|
var _this = this;
|
|
5899
6023
|
if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
|
|
5900
6024
|
return _this.handleOperation(async () => {
|
|
5901
|
-
return await post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
|
|
6025
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
|
|
5902
6026
|
});
|
|
5903
6027
|
}
|
|
5904
6028
|
/** Retrieves vectors by their keys in batch */
|
|
5905
6029
|
async getVectors(options) {
|
|
5906
6030
|
var _this2 = this;
|
|
5907
6031
|
return _this2.handleOperation(async () => {
|
|
5908
|
-
return await post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
|
|
6032
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
|
|
5909
6033
|
});
|
|
5910
6034
|
}
|
|
5911
6035
|
/** Lists vectors in an index with pagination */
|
|
@@ -5918,14 +6042,14 @@ var VectorDataApi = class extends BaseApiClient {
|
|
|
5918
6042
|
}
|
|
5919
6043
|
}
|
|
5920
6044
|
return _this3.handleOperation(async () => {
|
|
5921
|
-
return await post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
|
|
6045
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
|
|
5922
6046
|
});
|
|
5923
6047
|
}
|
|
5924
6048
|
/** Queries for similar vectors using approximate nearest neighbor search */
|
|
5925
6049
|
async queryVectors(options) {
|
|
5926
6050
|
var _this4 = this;
|
|
5927
6051
|
return _this4.handleOperation(async () => {
|
|
5928
|
-
return await post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
|
|
6052
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
|
|
5929
6053
|
});
|
|
5930
6054
|
}
|
|
5931
6055
|
/** Deletes vectors by their keys in batch (1-500 per request) */
|
|
@@ -5933,7 +6057,7 @@ var VectorDataApi = class extends BaseApiClient {
|
|
|
5933
6057
|
var _this5 = this;
|
|
5934
6058
|
if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
|
|
5935
6059
|
return _this5.handleOperation(async () => {
|
|
5936
|
-
return await post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
|
|
6060
|
+
return await vectorsApi.post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
|
|
5937
6061
|
});
|
|
5938
6062
|
}
|
|
5939
6063
|
};
|
|
@@ -5941,35 +6065,35 @@ var VectorBucketApi = class extends BaseApiClient {
|
|
|
5941
6065
|
/** Creates a new VectorBucketApi instance */
|
|
5942
6066
|
constructor(url, headers = {}, fetch$1) {
|
|
5943
6067
|
const finalUrl = url.replace(/\/$/, "");
|
|
5944
|
-
const finalHeaders =
|
|
6068
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
5945
6069
|
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
5946
6070
|
}
|
|
5947
6071
|
/** Creates a new vector bucket */
|
|
5948
6072
|
async createBucket(vectorBucketName) {
|
|
5949
6073
|
var _this = this;
|
|
5950
6074
|
return _this.handleOperation(async () => {
|
|
5951
|
-
return await post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
|
|
6075
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
|
|
5952
6076
|
});
|
|
5953
6077
|
}
|
|
5954
6078
|
/** Retrieves metadata for a specific vector bucket */
|
|
5955
6079
|
async getBucket(vectorBucketName) {
|
|
5956
6080
|
var _this2 = this;
|
|
5957
6081
|
return _this2.handleOperation(async () => {
|
|
5958
|
-
return await post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
|
|
6082
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
|
|
5959
6083
|
});
|
|
5960
6084
|
}
|
|
5961
6085
|
/** Lists vector buckets with optional filtering and pagination */
|
|
5962
6086
|
async listBuckets(options = {}) {
|
|
5963
6087
|
var _this3 = this;
|
|
5964
6088
|
return _this3.handleOperation(async () => {
|
|
5965
|
-
return await post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
|
|
6089
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
|
|
5966
6090
|
});
|
|
5967
6091
|
}
|
|
5968
6092
|
/** Deletes a vector bucket (must be empty first) */
|
|
5969
6093
|
async deleteBucket(vectorBucketName) {
|
|
5970
6094
|
var _this4 = this;
|
|
5971
6095
|
return _this4.handleOperation(async () => {
|
|
5972
|
-
return await post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
|
|
6096
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
|
|
5973
6097
|
});
|
|
5974
6098
|
}
|
|
5975
6099
|
};
|
|
@@ -6167,7 +6291,7 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
6167
6291
|
*/
|
|
6168
6292
|
async createIndex(options) {
|
|
6169
6293
|
var _superprop_getCreateIndex = () => super.createIndex, _this5 = this;
|
|
6170
|
-
return _superprop_getCreateIndex().call(_this5,
|
|
6294
|
+
return _superprop_getCreateIndex().call(_this5, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this5.vectorBucketName }));
|
|
6171
6295
|
}
|
|
6172
6296
|
/**
|
|
6173
6297
|
*
|
|
@@ -6190,7 +6314,7 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
6190
6314
|
*/
|
|
6191
6315
|
async listIndexes(options = {}) {
|
|
6192
6316
|
var _superprop_getListIndexes = () => super.listIndexes, _this6 = this;
|
|
6193
|
-
return _superprop_getListIndexes().call(_this6,
|
|
6317
|
+
return _superprop_getListIndexes().call(_this6, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this6.vectorBucketName }));
|
|
6194
6318
|
}
|
|
6195
6319
|
/**
|
|
6196
6320
|
*
|
|
@@ -6323,7 +6447,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
6323
6447
|
*/
|
|
6324
6448
|
async putVectors(options) {
|
|
6325
6449
|
var _superprop_getPutVectors = () => super.putVectors, _this9 = this;
|
|
6326
|
-
return _superprop_getPutVectors().call(_this9,
|
|
6450
|
+
return _superprop_getPutVectors().call(_this9, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
6327
6451
|
vectorBucketName: _this9.vectorBucketName,
|
|
6328
6452
|
indexName: _this9.indexName
|
|
6329
6453
|
}));
|
|
@@ -6352,7 +6476,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
6352
6476
|
*/
|
|
6353
6477
|
async getVectors(options) {
|
|
6354
6478
|
var _superprop_getGetVectors = () => super.getVectors, _this10 = this;
|
|
6355
|
-
return _superprop_getGetVectors().call(_this10,
|
|
6479
|
+
return _superprop_getGetVectors().call(_this10, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
6356
6480
|
vectorBucketName: _this10.vectorBucketName,
|
|
6357
6481
|
indexName: _this10.indexName
|
|
6358
6482
|
}));
|
|
@@ -6381,7 +6505,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
6381
6505
|
*/
|
|
6382
6506
|
async listVectors(options = {}) {
|
|
6383
6507
|
var _superprop_getListVectors = () => super.listVectors, _this11 = this;
|
|
6384
|
-
return _superprop_getListVectors().call(_this11,
|
|
6508
|
+
return _superprop_getListVectors().call(_this11, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
6385
6509
|
vectorBucketName: _this11.vectorBucketName,
|
|
6386
6510
|
indexName: _this11.indexName
|
|
6387
6511
|
}));
|
|
@@ -6413,7 +6537,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
6413
6537
|
*/
|
|
6414
6538
|
async queryVectors(options) {
|
|
6415
6539
|
var _superprop_getQueryVectors = () => super.queryVectors, _this12 = this;
|
|
6416
|
-
return _superprop_getQueryVectors().call(_this12,
|
|
6540
|
+
return _superprop_getQueryVectors().call(_this12, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
6417
6541
|
vectorBucketName: _this12.vectorBucketName,
|
|
6418
6542
|
indexName: _this12.indexName
|
|
6419
6543
|
}));
|
|
@@ -6441,7 +6565,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
6441
6565
|
*/
|
|
6442
6566
|
async deleteVectors(options) {
|
|
6443
6567
|
var _superprop_getDeleteVectors = () => super.deleteVectors, _this13 = this;
|
|
6444
|
-
return _superprop_getDeleteVectors().call(_this13,
|
|
6568
|
+
return _superprop_getDeleteVectors().call(_this13, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
6445
6569
|
vectorBucketName: _this13.vectorBucketName,
|
|
6446
6570
|
indexName: _this13.indexName
|
|
6447
6571
|
}));
|
|
@@ -6513,7 +6637,7 @@ var StorageClient = class extends StorageBucketApi {
|
|
|
6513
6637
|
};
|
|
6514
6638
|
|
|
6515
6639
|
// ../../node_modules/@supabase/auth-js/dist/module/lib/version.js
|
|
6516
|
-
var version3 = "2.
|
|
6640
|
+
var version3 = "2.95.3";
|
|
6517
6641
|
|
|
6518
6642
|
// ../../node_modules/@supabase/auth-js/dist/module/lib/constants.js
|
|
6519
6643
|
var AUTO_REFRESH_TICK_DURATION_MS = 30 * 1e3;
|
|
@@ -8281,6 +8405,7 @@ var WebAuthnApi = class {
|
|
|
8281
8405
|
* @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying Assertion}
|
|
8282
8406
|
*/
|
|
8283
8407
|
async _challenge({ factorId, webauthn, friendlyName, signal }, overrides) {
|
|
8408
|
+
var _a;
|
|
8284
8409
|
try {
|
|
8285
8410
|
const { data: challengeResponse, error: challengeError } = await this.client.mfa.challenge({
|
|
8286
8411
|
factorId,
|
|
@@ -8293,7 +8418,15 @@ var WebAuthnApi = class {
|
|
|
8293
8418
|
if (challengeResponse.webauthn.type === "create") {
|
|
8294
8419
|
const { user } = challengeResponse.webauthn.credential_options.publicKey;
|
|
8295
8420
|
if (!user.name) {
|
|
8296
|
-
|
|
8421
|
+
const nameToUse = friendlyName;
|
|
8422
|
+
if (!nameToUse) {
|
|
8423
|
+
const currentUser = await this.client.getUser();
|
|
8424
|
+
const userData = currentUser.data.user;
|
|
8425
|
+
const fallbackName = ((_a = userData === null || userData === void 0 ? void 0 : userData.user_metadata) === null || _a === void 0 ? void 0 : _a.name) || (userData === null || userData === void 0 ? void 0 : userData.email) || (userData === null || userData === void 0 ? void 0 : userData.id) || "User";
|
|
8426
|
+
user.name = `${user.id}:${fallbackName}`;
|
|
8427
|
+
} else {
|
|
8428
|
+
user.name = `${user.id}:${nameToUse}`;
|
|
8429
|
+
}
|
|
8297
8430
|
}
|
|
8298
8431
|
if (!user.displayName) {
|
|
8299
8432
|
user.displayName = user.name;
|
|
@@ -10803,7 +10936,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
10803
10936
|
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
10804
10937
|
*
|
|
10805
10938
|
* Returns authorization details including client info, scopes, and user information.
|
|
10806
|
-
* If the
|
|
10939
|
+
* If the response includes only a redirect_url field, it means consent was already given - the caller
|
|
10807
10940
|
* should handle the redirect manually if needed.
|
|
10808
10941
|
*/
|
|
10809
10942
|
async _getAuthorizationDetails(authorizationId) {
|
|
@@ -11057,7 +11190,7 @@ var AuthClient = GoTrueClient_default;
|
|
|
11057
11190
|
var AuthClient_default = AuthClient;
|
|
11058
11191
|
|
|
11059
11192
|
// ../../node_modules/@supabase/supabase-js/dist/index.mjs
|
|
11060
|
-
var version4 = "2.
|
|
11193
|
+
var version4 = "2.95.3";
|
|
11061
11194
|
var JS_ENV = "";
|
|
11062
11195
|
if (typeof Deno !== "undefined") JS_ENV = "deno";
|
|
11063
11196
|
else if (typeof document !== "undefined") JS_ENV = "web";
|
|
@@ -11073,37 +11206,37 @@ var DEFAULT_AUTH_OPTIONS = {
|
|
|
11073
11206
|
flowType: "implicit"
|
|
11074
11207
|
};
|
|
11075
11208
|
var DEFAULT_REALTIME_OPTIONS = {};
|
|
11076
|
-
function
|
|
11209
|
+
function _typeof3(o) {
|
|
11077
11210
|
"@babel/helpers - typeof";
|
|
11078
|
-
return
|
|
11211
|
+
return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
11079
11212
|
return typeof o$1;
|
|
11080
11213
|
} : function(o$1) {
|
|
11081
11214
|
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
11082
|
-
},
|
|
11215
|
+
}, _typeof3(o);
|
|
11083
11216
|
}
|
|
11084
|
-
function
|
|
11085
|
-
if ("object" !=
|
|
11217
|
+
function toPrimitive3(t, r) {
|
|
11218
|
+
if ("object" != _typeof3(t) || !t) return t;
|
|
11086
11219
|
var e = t[Symbol.toPrimitive];
|
|
11087
11220
|
if (void 0 !== e) {
|
|
11088
11221
|
var i = e.call(t, r || "default");
|
|
11089
|
-
if ("object" !=
|
|
11222
|
+
if ("object" != _typeof3(i)) return i;
|
|
11090
11223
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11091
11224
|
}
|
|
11092
11225
|
return ("string" === r ? String : Number)(t);
|
|
11093
11226
|
}
|
|
11094
|
-
function
|
|
11095
|
-
var i =
|
|
11096
|
-
return "symbol" ==
|
|
11227
|
+
function toPropertyKey3(t) {
|
|
11228
|
+
var i = toPrimitive3(t, "string");
|
|
11229
|
+
return "symbol" == _typeof3(i) ? i : i + "";
|
|
11097
11230
|
}
|
|
11098
|
-
function
|
|
11099
|
-
return (r =
|
|
11231
|
+
function _defineProperty3(e, r, t) {
|
|
11232
|
+
return (r = toPropertyKey3(r)) in e ? Object.defineProperty(e, r, {
|
|
11100
11233
|
value: t,
|
|
11101
11234
|
enumerable: true,
|
|
11102
11235
|
configurable: true,
|
|
11103
11236
|
writable: true
|
|
11104
11237
|
}) : e[r] = t, e;
|
|
11105
11238
|
}
|
|
11106
|
-
function
|
|
11239
|
+
function ownKeys3(e, r) {
|
|
11107
11240
|
var t = Object.keys(e);
|
|
11108
11241
|
if (Object.getOwnPropertySymbols) {
|
|
11109
11242
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -11113,12 +11246,12 @@ function ownKeys2(e, r) {
|
|
|
11113
11246
|
}
|
|
11114
11247
|
return t;
|
|
11115
11248
|
}
|
|
11116
|
-
function
|
|
11249
|
+
function _objectSpread23(e) {
|
|
11117
11250
|
for (var r = 1; r < arguments.length; r++) {
|
|
11118
11251
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
11119
|
-
r % 2 ?
|
|
11120
|
-
|
|
11121
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) :
|
|
11252
|
+
r % 2 ? ownKeys3(Object(t), true).forEach(function(r$1) {
|
|
11253
|
+
_defineProperty3(e, r$1, t[r$1]);
|
|
11254
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys3(Object(t)).forEach(function(r$1) {
|
|
11122
11255
|
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
11123
11256
|
});
|
|
11124
11257
|
}
|
|
@@ -11140,7 +11273,7 @@ var fetchWithAuth = (supabaseKey, getAccessToken, customFetch) => {
|
|
|
11140
11273
|
let headers = new HeadersConstructor(init === null || init === void 0 ? void 0 : init.headers);
|
|
11141
11274
|
if (!headers.has("apikey")) headers.set("apikey", supabaseKey);
|
|
11142
11275
|
if (!headers.has("Authorization")) headers.set("Authorization", `Bearer ${accessToken}`);
|
|
11143
|
-
return fetch$1(input,
|
|
11276
|
+
return fetch$1(input, _objectSpread23(_objectSpread23({}, init), {}, { headers }));
|
|
11144
11277
|
};
|
|
11145
11278
|
};
|
|
11146
11279
|
function ensureTrailingSlash(url) {
|
|
@@ -11151,11 +11284,11 @@ function applySettingDefaults(options, defaults) {
|
|
|
11151
11284
|
const { db: dbOptions, auth: authOptions, realtime: realtimeOptions, global: globalOptions } = options;
|
|
11152
11285
|
const { db: DEFAULT_DB_OPTIONS$1, auth: DEFAULT_AUTH_OPTIONS$1, realtime: DEFAULT_REALTIME_OPTIONS$1, global: DEFAULT_GLOBAL_OPTIONS$1 } = defaults;
|
|
11153
11286
|
const result = {
|
|
11154
|
-
db:
|
|
11155
|
-
auth:
|
|
11156
|
-
realtime:
|
|
11287
|
+
db: _objectSpread23(_objectSpread23({}, DEFAULT_DB_OPTIONS$1), dbOptions),
|
|
11288
|
+
auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS$1), authOptions),
|
|
11289
|
+
realtime: _objectSpread23(_objectSpread23({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions),
|
|
11157
11290
|
storage: {},
|
|
11158
|
-
global:
|
|
11291
|
+
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 : {}) }),
|
|
11159
11292
|
accessToken: async () => ""
|
|
11160
11293
|
};
|
|
11161
11294
|
if (options.accessToken) result.accessToken = options.accessToken;
|
|
@@ -11213,7 +11346,7 @@ var SupabaseClient = class {
|
|
|
11213
11346
|
const DEFAULTS = {
|
|
11214
11347
|
db: DEFAULT_DB_OPTIONS,
|
|
11215
11348
|
realtime: DEFAULT_REALTIME_OPTIONS,
|
|
11216
|
-
auth:
|
|
11349
|
+
auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }),
|
|
11217
11350
|
global: DEFAULT_GLOBAL_OPTIONS
|
|
11218
11351
|
};
|
|
11219
11352
|
const settings = applySettingDefaults(options !== null && options !== void 0 ? options : {}, DEFAULTS);
|
|
@@ -11229,7 +11362,7 @@ var SupabaseClient = class {
|
|
|
11229
11362
|
} });
|
|
11230
11363
|
}
|
|
11231
11364
|
this.fetch = fetchWithAuth(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch);
|
|
11232
|
-
this.realtime = this._initRealtimeClient(
|
|
11365
|
+
this.realtime = this._initRealtimeClient(_objectSpread23({
|
|
11233
11366
|
headers: this.headers,
|
|
11234
11367
|
accessToken: this._getAccessToken.bind(this)
|
|
11235
11368
|
}, settings.realtime));
|
|
@@ -11237,7 +11370,9 @@ var SupabaseClient = class {
|
|
|
11237
11370
|
this.rest = new PostgrestClient(new URL("rest/v1", baseUrl).href, {
|
|
11238
11371
|
headers: this.headers,
|
|
11239
11372
|
schema: settings.db.schema,
|
|
11240
|
-
fetch: this.fetch
|
|
11373
|
+
fetch: this.fetch,
|
|
11374
|
+
timeout: settings.db.timeout,
|
|
11375
|
+
urlLengthLimit: settings.db.urlLengthLimit
|
|
11241
11376
|
});
|
|
11242
11377
|
this.storage = new StorageClient(this.storageUrl.href, this.headers, this.fetch, options === null || options === void 0 ? void 0 : options.storage);
|
|
11243
11378
|
if (!settings.accessToken) this._listenForAuthEvents();
|
|
@@ -11344,7 +11479,7 @@ var SupabaseClient = class {
|
|
|
11344
11479
|
};
|
|
11345
11480
|
return new SupabaseAuthClient({
|
|
11346
11481
|
url: this.authUrl.href,
|
|
11347
|
-
headers:
|
|
11482
|
+
headers: _objectSpread23(_objectSpread23({}, authHeaders), headers),
|
|
11348
11483
|
storageKey,
|
|
11349
11484
|
autoRefreshToken,
|
|
11350
11485
|
persistSession,
|
|
@@ -11360,7 +11495,7 @@ var SupabaseClient = class {
|
|
|
11360
11495
|
});
|
|
11361
11496
|
}
|
|
11362
11497
|
_initRealtimeClient(options) {
|
|
11363
|
-
return new RealtimeClient(this.realtimeUrl.href,
|
|
11498
|
+
return new RealtimeClient(this.realtimeUrl.href, _objectSpread23(_objectSpread23({}, options), {}, { params: _objectSpread23(_objectSpread23({}, { apikey: this.supabaseKey }), options === null || options === void 0 ? void 0 : options.params) }));
|
|
11364
11499
|
}
|
|
11365
11500
|
_listenForAuthEvents() {
|
|
11366
11501
|
return this.auth.onAuthStateChange((event, session) => {
|
|
@@ -11467,7 +11602,7 @@ var ContextCaptureManager = class {
|
|
|
11467
11602
|
if (this.navigationHistory.length > 0) {
|
|
11468
11603
|
return this.navigationHistory[this.navigationHistory.length - 1];
|
|
11469
11604
|
}
|
|
11470
|
-
if (typeof window !== "undefined") {
|
|
11605
|
+
if (typeof window !== "undefined" && window.location) {
|
|
11471
11606
|
return window.location.pathname;
|
|
11472
11607
|
}
|
|
11473
11608
|
return "unknown";
|
|
@@ -11579,7 +11714,7 @@ var ContextCaptureManager = class {
|
|
|
11579
11714
|
};
|
|
11580
11715
|
}
|
|
11581
11716
|
captureNavigation() {
|
|
11582
|
-
if (typeof window === "undefined" || typeof history === "undefined") return;
|
|
11717
|
+
if (typeof window === "undefined" || typeof history === "undefined" || !window.location) return;
|
|
11583
11718
|
this.trackNavigation(window.location.pathname);
|
|
11584
11719
|
const self2 = this;
|
|
11585
11720
|
this.originalPushState = history.pushState;
|
|
@@ -11617,13 +11752,13 @@ var ContextCaptureManager = class {
|
|
|
11617
11752
|
return Object.keys(metrics).length > 0 ? metrics : void 0;
|
|
11618
11753
|
}
|
|
11619
11754
|
getEnvironmentInfo() {
|
|
11620
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") return void 0;
|
|
11755
|
+
if (typeof window === "undefined" || typeof navigator === "undefined" || typeof document === "undefined") return void 0;
|
|
11621
11756
|
return {
|
|
11622
11757
|
language: navigator.language,
|
|
11623
11758
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
11624
|
-
cookiesEnabled: navigator.cookieEnabled,
|
|
11759
|
+
cookiesEnabled: navigator.cookieEnabled ?? false,
|
|
11625
11760
|
localStorage: typeof localStorage !== "undefined",
|
|
11626
|
-
online: navigator.onLine
|
|
11761
|
+
online: navigator.onLine ?? true
|
|
11627
11762
|
};
|
|
11628
11763
|
}
|
|
11629
11764
|
};
|
|
@@ -12967,15 +13102,18 @@ var BugBearClient = class {
|
|
|
12967
13102
|
* Get device info (override in platform-specific implementations)
|
|
12968
13103
|
*/
|
|
12969
13104
|
getDeviceInfo() {
|
|
12970
|
-
if (typeof window !== "undefined") {
|
|
12971
|
-
|
|
12972
|
-
|
|
12973
|
-
userAgent
|
|
12974
|
-
|
|
13105
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
13106
|
+
const info = { platform: "web" };
|
|
13107
|
+
if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
13108
|
+
info.userAgent = navigator.userAgent;
|
|
13109
|
+
}
|
|
13110
|
+
if (window.screen) {
|
|
13111
|
+
info.screenSize = {
|
|
12975
13112
|
width: window.screen.width,
|
|
12976
13113
|
height: window.screen.height
|
|
12977
|
-
}
|
|
12978
|
-
}
|
|
13114
|
+
};
|
|
13115
|
+
}
|
|
13116
|
+
return info;
|
|
12979
13117
|
}
|
|
12980
13118
|
return { platform: "web" };
|
|
12981
13119
|
}
|