@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.mjs
CHANGED
|
@@ -276,7 +276,7 @@ var PostgrestBuilder = class {
|
|
|
276
276
|
* ```
|
|
277
277
|
*/
|
|
278
278
|
constructor(builder) {
|
|
279
|
-
var _builder$shouldThrowO, _builder$isMaybeSingl;
|
|
279
|
+
var _builder$shouldThrowO, _builder$isMaybeSingl, _builder$urlLengthLim;
|
|
280
280
|
this.shouldThrowOnError = false;
|
|
281
281
|
this.method = builder.method;
|
|
282
282
|
this.url = builder.url;
|
|
@@ -286,6 +286,7 @@ var PostgrestBuilder = class {
|
|
|
286
286
|
this.shouldThrowOnError = (_builder$shouldThrowO = builder.shouldThrowOnError) !== null && _builder$shouldThrowO !== void 0 ? _builder$shouldThrowO : false;
|
|
287
287
|
this.signal = builder.signal;
|
|
288
288
|
this.isMaybeSingle = (_builder$isMaybeSingl = builder.isMaybeSingle) !== null && _builder$isMaybeSingl !== void 0 ? _builder$isMaybeSingl : false;
|
|
289
|
+
this.urlLengthLimit = (_builder$urlLengthLim = builder.urlLengthLimit) !== null && _builder$urlLengthLim !== void 0 ? _builder$urlLengthLim : 8e3;
|
|
289
290
|
if (builder.fetch) this.fetch = builder.fetch;
|
|
290
291
|
else this.fetch = fetch;
|
|
291
292
|
}
|
|
@@ -386,6 +387,8 @@ var PostgrestBuilder = class {
|
|
|
386
387
|
if (!this.shouldThrowOnError) res = res.catch((fetchError) => {
|
|
387
388
|
var _fetchError$name2;
|
|
388
389
|
let errorDetails = "";
|
|
390
|
+
let hint = "";
|
|
391
|
+
let code = "";
|
|
389
392
|
const cause = fetchError === null || fetchError === void 0 ? void 0 : fetchError.cause;
|
|
390
393
|
if (cause) {
|
|
391
394
|
var _cause$message, _cause$code, _fetchError$name, _cause$name;
|
|
@@ -402,12 +405,22 @@ ${cause.stack}`;
|
|
|
402
405
|
var _fetchError$stack;
|
|
403
406
|
errorDetails = (_fetchError$stack = fetchError === null || fetchError === void 0 ? void 0 : fetchError.stack) !== null && _fetchError$stack !== void 0 ? _fetchError$stack : "";
|
|
404
407
|
}
|
|
408
|
+
const urlLength = this.url.toString().length;
|
|
409
|
+
if ((fetchError === null || fetchError === void 0 ? void 0 : fetchError.name) === "AbortError" || (fetchError === null || fetchError === void 0 ? void 0 : fetchError.code) === "ABORT_ERR") {
|
|
410
|
+
code = "";
|
|
411
|
+
hint = "Request was aborted (timeout or manual cancellation)";
|
|
412
|
+
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.`;
|
|
413
|
+
} 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") {
|
|
414
|
+
code = "";
|
|
415
|
+
hint = "HTTP headers exceeded server limits (typically 16KB)";
|
|
416
|
+
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.`;
|
|
417
|
+
}
|
|
405
418
|
return {
|
|
406
419
|
error: {
|
|
407
420
|
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}`,
|
|
408
421
|
details: errorDetails,
|
|
409
|
-
hint
|
|
410
|
-
code
|
|
422
|
+
hint,
|
|
423
|
+
code
|
|
411
424
|
},
|
|
412
425
|
data: null,
|
|
413
426
|
count: null,
|
|
@@ -1049,11 +1062,12 @@ var PostgrestQueryBuilder = class {
|
|
|
1049
1062
|
* )
|
|
1050
1063
|
* ```
|
|
1051
1064
|
*/
|
|
1052
|
-
constructor(url, { headers = {}, schema, fetch: fetch$1 }) {
|
|
1065
|
+
constructor(url, { headers = {}, schema, fetch: fetch$1, urlLengthLimit = 8e3 }) {
|
|
1053
1066
|
this.url = url;
|
|
1054
1067
|
this.headers = new Headers(headers);
|
|
1055
1068
|
this.schema = schema;
|
|
1056
1069
|
this.fetch = fetch$1;
|
|
1070
|
+
this.urlLengthLimit = urlLengthLimit;
|
|
1057
1071
|
}
|
|
1058
1072
|
/**
|
|
1059
1073
|
* Clone URL and headers to prevent shared state between operations.
|
|
@@ -1106,7 +1120,8 @@ var PostgrestQueryBuilder = class {
|
|
|
1106
1120
|
url,
|
|
1107
1121
|
headers,
|
|
1108
1122
|
schema: this.schema,
|
|
1109
|
-
fetch: this.fetch
|
|
1123
|
+
fetch: this.fetch,
|
|
1124
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1110
1125
|
});
|
|
1111
1126
|
}
|
|
1112
1127
|
/**
|
|
@@ -1154,7 +1169,8 @@ var PostgrestQueryBuilder = class {
|
|
|
1154
1169
|
headers,
|
|
1155
1170
|
schema: this.schema,
|
|
1156
1171
|
body: values,
|
|
1157
|
-
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
|
|
1172
|
+
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
|
|
1173
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1158
1174
|
});
|
|
1159
1175
|
}
|
|
1160
1176
|
/**
|
|
@@ -1263,7 +1279,8 @@ var PostgrestQueryBuilder = class {
|
|
|
1263
1279
|
headers,
|
|
1264
1280
|
schema: this.schema,
|
|
1265
1281
|
body: values,
|
|
1266
|
-
fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch
|
|
1282
|
+
fetch: (_this$fetch2 = this.fetch) !== null && _this$fetch2 !== void 0 ? _this$fetch2 : fetch,
|
|
1283
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1267
1284
|
});
|
|
1268
1285
|
}
|
|
1269
1286
|
/**
|
|
@@ -1298,7 +1315,8 @@ var PostgrestQueryBuilder = class {
|
|
|
1298
1315
|
headers,
|
|
1299
1316
|
schema: this.schema,
|
|
1300
1317
|
body: values,
|
|
1301
|
-
fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch
|
|
1318
|
+
fetch: (_this$fetch3 = this.fetch) !== null && _this$fetch3 !== void 0 ? _this$fetch3 : fetch,
|
|
1319
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1302
1320
|
});
|
|
1303
1321
|
}
|
|
1304
1322
|
/**
|
|
@@ -1330,10 +1348,62 @@ var PostgrestQueryBuilder = class {
|
|
|
1330
1348
|
url,
|
|
1331
1349
|
headers,
|
|
1332
1350
|
schema: this.schema,
|
|
1333
|
-
fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch
|
|
1351
|
+
fetch: (_this$fetch4 = this.fetch) !== null && _this$fetch4 !== void 0 ? _this$fetch4 : fetch,
|
|
1352
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1334
1353
|
});
|
|
1335
1354
|
}
|
|
1336
1355
|
};
|
|
1356
|
+
function _typeof(o) {
|
|
1357
|
+
"@babel/helpers - typeof";
|
|
1358
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
1359
|
+
return typeof o$1;
|
|
1360
|
+
} : function(o$1) {
|
|
1361
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
1362
|
+
}, _typeof(o);
|
|
1363
|
+
}
|
|
1364
|
+
function toPrimitive(t, r) {
|
|
1365
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
1366
|
+
var e = t[Symbol.toPrimitive];
|
|
1367
|
+
if (void 0 !== e) {
|
|
1368
|
+
var i = e.call(t, r || "default");
|
|
1369
|
+
if ("object" != _typeof(i)) return i;
|
|
1370
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1371
|
+
}
|
|
1372
|
+
return ("string" === r ? String : Number)(t);
|
|
1373
|
+
}
|
|
1374
|
+
function toPropertyKey(t) {
|
|
1375
|
+
var i = toPrimitive(t, "string");
|
|
1376
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
1377
|
+
}
|
|
1378
|
+
function _defineProperty(e, r, t) {
|
|
1379
|
+
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1380
|
+
value: t,
|
|
1381
|
+
enumerable: true,
|
|
1382
|
+
configurable: true,
|
|
1383
|
+
writable: true
|
|
1384
|
+
}) : e[r] = t, e;
|
|
1385
|
+
}
|
|
1386
|
+
function ownKeys(e, r) {
|
|
1387
|
+
var t = Object.keys(e);
|
|
1388
|
+
if (Object.getOwnPropertySymbols) {
|
|
1389
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
1390
|
+
r && (o = o.filter(function(r$1) {
|
|
1391
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
1392
|
+
})), t.push.apply(t, o);
|
|
1393
|
+
}
|
|
1394
|
+
return t;
|
|
1395
|
+
}
|
|
1396
|
+
function _objectSpread2(e) {
|
|
1397
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
1398
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
1399
|
+
r % 2 ? ownKeys(Object(t), true).forEach(function(r$1) {
|
|
1400
|
+
_defineProperty(e, r$1, t[r$1]);
|
|
1401
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r$1) {
|
|
1402
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
return e;
|
|
1406
|
+
}
|
|
1337
1407
|
var PostgrestClient = class PostgrestClient2 {
|
|
1338
1408
|
/**
|
|
1339
1409
|
* Creates a PostgREST client.
|
|
@@ -1343,6 +1413,8 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
1343
1413
|
* @param options.headers - Custom headers
|
|
1344
1414
|
* @param options.schema - Postgres schema to switch to
|
|
1345
1415
|
* @param options.fetch - Custom fetch
|
|
1416
|
+
* @param options.timeout - Optional timeout in milliseconds for all requests. When set, requests will automatically abort after this duration to prevent indefinite hangs.
|
|
1417
|
+
* @param options.urlLengthLimit - Maximum URL length in characters before warnings/errors are triggered. Defaults to 8000.
|
|
1346
1418
|
* @example
|
|
1347
1419
|
* ```ts
|
|
1348
1420
|
* import PostgrestClient from '@supabase/postgrest-js'
|
|
@@ -1350,14 +1422,38 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
1350
1422
|
* const postgrest = new PostgrestClient('https://xyzcompany.supabase.co/rest/v1', {
|
|
1351
1423
|
* headers: { apikey: 'public-anon-key' },
|
|
1352
1424
|
* schema: 'public',
|
|
1425
|
+
* timeout: 30000, // 30 second timeout
|
|
1353
1426
|
* })
|
|
1354
1427
|
* ```
|
|
1355
1428
|
*/
|
|
1356
|
-
constructor(url, { headers = {}, schema, fetch: fetch$1 } = {}) {
|
|
1429
|
+
constructor(url, { headers = {}, schema, fetch: fetch$1, timeout, urlLengthLimit = 8e3 } = {}) {
|
|
1357
1430
|
this.url = url;
|
|
1358
1431
|
this.headers = new Headers(headers);
|
|
1359
1432
|
this.schemaName = schema;
|
|
1360
|
-
this.
|
|
1433
|
+
this.urlLengthLimit = urlLengthLimit;
|
|
1434
|
+
const originalFetch = fetch$1 !== null && fetch$1 !== void 0 ? fetch$1 : globalThis.fetch;
|
|
1435
|
+
if (timeout !== void 0 && timeout > 0) this.fetch = (input, init) => {
|
|
1436
|
+
const controller = new AbortController();
|
|
1437
|
+
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
1438
|
+
const existingSignal = init === null || init === void 0 ? void 0 : init.signal;
|
|
1439
|
+
if (existingSignal) {
|
|
1440
|
+
if (existingSignal.aborted) {
|
|
1441
|
+
clearTimeout(timeoutId);
|
|
1442
|
+
return originalFetch(input, init);
|
|
1443
|
+
}
|
|
1444
|
+
const abortHandler = () => {
|
|
1445
|
+
clearTimeout(timeoutId);
|
|
1446
|
+
controller.abort();
|
|
1447
|
+
};
|
|
1448
|
+
existingSignal.addEventListener("abort", abortHandler, { once: true });
|
|
1449
|
+
return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => {
|
|
1450
|
+
clearTimeout(timeoutId);
|
|
1451
|
+
existingSignal.removeEventListener("abort", abortHandler);
|
|
1452
|
+
});
|
|
1453
|
+
}
|
|
1454
|
+
return originalFetch(input, _objectSpread2(_objectSpread2({}, init), {}, { signal: controller.signal })).finally(() => clearTimeout(timeoutId));
|
|
1455
|
+
};
|
|
1456
|
+
else this.fetch = originalFetch;
|
|
1361
1457
|
}
|
|
1362
1458
|
/**
|
|
1363
1459
|
* Perform a query on a table or a view.
|
|
@@ -1369,7 +1465,8 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
1369
1465
|
return new PostgrestQueryBuilder(new URL(`${this.url}/${relation}`), {
|
|
1370
1466
|
headers: new Headers(this.headers),
|
|
1371
1467
|
schema: this.schemaName,
|
|
1372
|
-
fetch: this.fetch
|
|
1468
|
+
fetch: this.fetch,
|
|
1469
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1373
1470
|
});
|
|
1374
1471
|
}
|
|
1375
1472
|
/**
|
|
@@ -1383,7 +1480,8 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
1383
1480
|
return new PostgrestClient2(this.url, {
|
|
1384
1481
|
headers: this.headers,
|
|
1385
1482
|
schema,
|
|
1386
|
-
fetch: this.fetch
|
|
1483
|
+
fetch: this.fetch,
|
|
1484
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1387
1485
|
});
|
|
1388
1486
|
}
|
|
1389
1487
|
/**
|
|
@@ -1446,7 +1544,8 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
1446
1544
|
headers,
|
|
1447
1545
|
schema: this.schemaName,
|
|
1448
1546
|
body,
|
|
1449
|
-
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch
|
|
1547
|
+
fetch: (_this$fetch = this.fetch) !== null && _this$fetch !== void 0 ? _this$fetch : fetch,
|
|
1548
|
+
urlLengthLimit: this.urlLengthLimit
|
|
1450
1549
|
});
|
|
1451
1550
|
}
|
|
1452
1551
|
};
|
|
@@ -1568,7 +1667,7 @@ Suggested solution: ${env.workaround}`;
|
|
|
1568
1667
|
var websocket_factory_default = WebSocketFactory;
|
|
1569
1668
|
|
|
1570
1669
|
// ../../node_modules/@supabase/realtime-js/dist/module/lib/version.js
|
|
1571
|
-
var version = "2.
|
|
1670
|
+
var version = "2.95.3";
|
|
1572
1671
|
|
|
1573
1672
|
// ../../node_modules/@supabase/realtime-js/dist/module/lib/constants.js
|
|
1574
1673
|
var DEFAULT_VERSION = `realtime-js/${version}`;
|
|
@@ -3055,6 +3154,9 @@ Option 2: Install and provide the "ws" package:
|
|
|
3055
3154
|
*/
|
|
3056
3155
|
async removeChannel(channel) {
|
|
3057
3156
|
const status = await channel.unsubscribe();
|
|
3157
|
+
if (status === "ok") {
|
|
3158
|
+
this._remove(channel);
|
|
3159
|
+
}
|
|
3058
3160
|
if (this.channels.length === 0) {
|
|
3059
3161
|
this.disconnect();
|
|
3060
3162
|
}
|
|
@@ -4223,37 +4325,37 @@ var isValidBucketName = (bucketName) => {
|
|
|
4223
4325
|
if (bucketName.includes("/") || bucketName.includes("\\")) return false;
|
|
4224
4326
|
return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
|
|
4225
4327
|
};
|
|
4226
|
-
function
|
|
4328
|
+
function _typeof2(o) {
|
|
4227
4329
|
"@babel/helpers - typeof";
|
|
4228
|
-
return
|
|
4330
|
+
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
4229
4331
|
return typeof o$1;
|
|
4230
4332
|
} : function(o$1) {
|
|
4231
4333
|
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
4232
|
-
},
|
|
4334
|
+
}, _typeof2(o);
|
|
4233
4335
|
}
|
|
4234
|
-
function
|
|
4235
|
-
if ("object" !=
|
|
4336
|
+
function toPrimitive2(t, r) {
|
|
4337
|
+
if ("object" != _typeof2(t) || !t) return t;
|
|
4236
4338
|
var e = t[Symbol.toPrimitive];
|
|
4237
4339
|
if (void 0 !== e) {
|
|
4238
4340
|
var i = e.call(t, r || "default");
|
|
4239
|
-
if ("object" !=
|
|
4341
|
+
if ("object" != _typeof2(i)) return i;
|
|
4240
4342
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
4241
4343
|
}
|
|
4242
4344
|
return ("string" === r ? String : Number)(t);
|
|
4243
4345
|
}
|
|
4244
|
-
function
|
|
4245
|
-
var i =
|
|
4246
|
-
return "symbol" ==
|
|
4346
|
+
function toPropertyKey2(t) {
|
|
4347
|
+
var i = toPrimitive2(t, "string");
|
|
4348
|
+
return "symbol" == _typeof2(i) ? i : i + "";
|
|
4247
4349
|
}
|
|
4248
|
-
function
|
|
4249
|
-
return (r =
|
|
4350
|
+
function _defineProperty2(e, r, t) {
|
|
4351
|
+
return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
|
|
4250
4352
|
value: t,
|
|
4251
4353
|
enumerable: true,
|
|
4252
4354
|
configurable: true,
|
|
4253
4355
|
writable: true
|
|
4254
4356
|
}) : e[r] = t, e;
|
|
4255
4357
|
}
|
|
4256
|
-
function
|
|
4358
|
+
function ownKeys2(e, r) {
|
|
4257
4359
|
var t = Object.keys(e);
|
|
4258
4360
|
if (Object.getOwnPropertySymbols) {
|
|
4259
4361
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -4263,12 +4365,12 @@ function ownKeys(e, r) {
|
|
|
4263
4365
|
}
|
|
4264
4366
|
return t;
|
|
4265
4367
|
}
|
|
4266
|
-
function
|
|
4368
|
+
function _objectSpread22(e) {
|
|
4267
4369
|
for (var r = 1; r < arguments.length; r++) {
|
|
4268
4370
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
4269
|
-
r % 2 ?
|
|
4270
|
-
|
|
4271
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) :
|
|
4371
|
+
r % 2 ? ownKeys2(Object(t), true).forEach(function(r$1) {
|
|
4372
|
+
_defineProperty2(e, r$1, t[r$1]);
|
|
4373
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r$1) {
|
|
4272
4374
|
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
4273
4375
|
});
|
|
4274
4376
|
}
|
|
@@ -4305,13 +4407,13 @@ var _getRequestParams = (method, options, parameters, body) => {
|
|
|
4305
4407
|
method,
|
|
4306
4408
|
headers: (options === null || options === void 0 ? void 0 : options.headers) || {}
|
|
4307
4409
|
};
|
|
4308
|
-
if (method === "GET" || method === "HEAD" || !body) return
|
|
4410
|
+
if (method === "GET" || method === "HEAD" || !body) return _objectSpread22(_objectSpread22({}, params), parameters);
|
|
4309
4411
|
if (isPlainObject(body)) {
|
|
4310
|
-
params.headers =
|
|
4412
|
+
params.headers = _objectSpread22({ "Content-Type": "application/json" }, options === null || options === void 0 ? void 0 : options.headers);
|
|
4311
4413
|
params.body = JSON.stringify(body);
|
|
4312
4414
|
} else params.body = body;
|
|
4313
4415
|
if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex;
|
|
4314
|
-
return
|
|
4416
|
+
return _objectSpread22(_objectSpread22({}, params), parameters);
|
|
4315
4417
|
};
|
|
4316
4418
|
async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) {
|
|
4317
4419
|
return new Promise((resolve, reject) => {
|
|
@@ -4320,6 +4422,7 @@ async function _handleRequest(fetcher, method, url, options, parameters, body, n
|
|
|
4320
4422
|
if (options === null || options === void 0 ? void 0 : options.noResolveJson) return result;
|
|
4321
4423
|
if (namespace === "vectors") {
|
|
4322
4424
|
const contentType = result.headers.get("content-type");
|
|
4425
|
+
if (result.headers.get("content-length") === "0" || result.status === 204) return {};
|
|
4323
4426
|
if (!contentType || !contentType.includes("application/json")) return {};
|
|
4324
4427
|
}
|
|
4325
4428
|
return result.json();
|
|
@@ -4338,7 +4441,7 @@ function createFetchApi(namespace = "storage") {
|
|
|
4338
4441
|
return _handleRequest(fetcher, "PUT", url, options, parameters, body, namespace);
|
|
4339
4442
|
},
|
|
4340
4443
|
head: async (fetcher, url, options, parameters) => {
|
|
4341
|
-
return _handleRequest(fetcher, "HEAD", url,
|
|
4444
|
+
return _handleRequest(fetcher, "HEAD", url, _objectSpread22(_objectSpread22({}, options), {}, { noResolveJson: true }), parameters, void 0, namespace);
|
|
4342
4445
|
},
|
|
4343
4446
|
remove: async (fetcher, url, body, options, parameters) => {
|
|
4344
4447
|
return _handleRequest(fetcher, "DELETE", url, options, parameters, body, namespace);
|
|
@@ -4347,6 +4450,7 @@ function createFetchApi(namespace = "storage") {
|
|
|
4347
4450
|
}
|
|
4348
4451
|
var defaultApi = createFetchApi("storage");
|
|
4349
4452
|
var { get, post, put, head, remove } = defaultApi;
|
|
4453
|
+
var vectorsApi = createFetchApi("vectors");
|
|
4350
4454
|
var BaseApiClient = class {
|
|
4351
4455
|
/**
|
|
4352
4456
|
* Creates a new BaseApiClient instance
|
|
@@ -4510,8 +4614,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4510
4614
|
var _this = this;
|
|
4511
4615
|
return _this.handleOperation(async () => {
|
|
4512
4616
|
let body;
|
|
4513
|
-
const options =
|
|
4514
|
-
let headers =
|
|
4617
|
+
const options = _objectSpread22(_objectSpread22({}, DEFAULT_FILE_OPTIONS), fileOptions);
|
|
4618
|
+
let headers = _objectSpread22(_objectSpread22({}, _this.headers), method === "POST" && { "x-upsert": String(options.upsert) });
|
|
4515
4619
|
const metadata = options.metadata;
|
|
4516
4620
|
if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
|
|
4517
4621
|
body = new FormData();
|
|
@@ -4529,10 +4633,10 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4529
4633
|
if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata));
|
|
4530
4634
|
if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
|
|
4531
4635
|
}
|
|
4532
|
-
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers =
|
|
4636
|
+
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers = _objectSpread22(_objectSpread22({}, headers), fileOptions.headers);
|
|
4533
4637
|
const cleanPath = _this._removeEmptyFolders(path);
|
|
4534
4638
|
const _path = _this._getFinalPath(cleanPath);
|
|
4535
|
-
const data = await (method == "PUT" ? put : post)(_this.fetch, `${_this.url}/object/${_path}`, body,
|
|
4639
|
+
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 } : {}));
|
|
4536
4640
|
return {
|
|
4537
4641
|
path: cleanPath,
|
|
4538
4642
|
id: data.Id,
|
|
@@ -4626,8 +4730,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4626
4730
|
url.searchParams.set("token", token);
|
|
4627
4731
|
return _this3.handleOperation(async () => {
|
|
4628
4732
|
let body;
|
|
4629
|
-
const options =
|
|
4630
|
-
const headers =
|
|
4733
|
+
const options = _objectSpread22({ upsert: DEFAULT_FILE_OPTIONS.upsert }, fileOptions);
|
|
4734
|
+
const headers = _objectSpread22(_objectSpread22({}, _this3.headers), { "x-upsert": String(options.upsert) });
|
|
4631
4735
|
if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
|
|
4632
4736
|
body = new FormData();
|
|
4633
4737
|
body.append("cacheControl", options.cacheControl);
|
|
@@ -4680,7 +4784,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4680
4784
|
var _this4 = this;
|
|
4681
4785
|
return _this4.handleOperation(async () => {
|
|
4682
4786
|
let _path = _this4._getFinalPath(path);
|
|
4683
|
-
const headers =
|
|
4787
|
+
const headers = _objectSpread22({}, _this4.headers);
|
|
4684
4788
|
if (options === null || options === void 0 ? void 0 : options.upsert) headers["x-upsert"] = "true";
|
|
4685
4789
|
const data = await post(_this4.fetch, `${_this4.url}/object/upload/sign/${_path}`, {}, { headers });
|
|
4686
4790
|
const url = new URL(_this4.url + data.url);
|
|
@@ -4871,7 +4975,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4871
4975
|
var _this8 = this;
|
|
4872
4976
|
return _this8.handleOperation(async () => {
|
|
4873
4977
|
let _path = _this8._getFinalPath(path);
|
|
4874
|
-
let data = await post(_this8.fetch, `${_this8.url}/object/sign/${_path}`,
|
|
4978
|
+
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 });
|
|
4875
4979
|
const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
|
|
4876
4980
|
return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${downloadQueryParam}`) };
|
|
4877
4981
|
});
|
|
@@ -4922,7 +5026,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4922
5026
|
paths
|
|
4923
5027
|
}, { headers: _this9.headers });
|
|
4924
5028
|
const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
|
|
4925
|
-
return data.map((datum) =>
|
|
5029
|
+
return data.map((datum) => _objectSpread22(_objectSpread22({}, datum), {}, { signedUrl: datum.signedURL ? encodeURI(`${_this9.url}${datum.signedURL}${downloadQueryParam}`) : null }));
|
|
4926
5030
|
});
|
|
4927
5031
|
}
|
|
4928
5032
|
/**
|
|
@@ -4931,6 +5035,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4931
5035
|
* @category File Buckets
|
|
4932
5036
|
* @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
|
|
4933
5037
|
* @param options.transform Transform the asset before serving it to the client.
|
|
5038
|
+
* @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
|
|
4934
5039
|
* @returns BlobDownloadBuilder instance for downloading the file
|
|
4935
5040
|
*
|
|
4936
5041
|
* @example Download file
|
|
@@ -4962,8 +5067,27 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4962
5067
|
* }
|
|
4963
5068
|
* })
|
|
4964
5069
|
* ```
|
|
5070
|
+
*
|
|
5071
|
+
* @example Download with cache control (useful in Edge Functions)
|
|
5072
|
+
* ```js
|
|
5073
|
+
* const { data, error } = await supabase
|
|
5074
|
+
* .storage
|
|
5075
|
+
* .from('avatars')
|
|
5076
|
+
* .download('folder/avatar1.png', {}, { cache: 'no-store' })
|
|
5077
|
+
* ```
|
|
5078
|
+
*
|
|
5079
|
+
* @example Download with abort signal
|
|
5080
|
+
* ```js
|
|
5081
|
+
* const controller = new AbortController()
|
|
5082
|
+
* setTimeout(() => controller.abort(), 5000)
|
|
5083
|
+
*
|
|
5084
|
+
* const { data, error } = await supabase
|
|
5085
|
+
* .storage
|
|
5086
|
+
* .from('avatars')
|
|
5087
|
+
* .download('folder/avatar1.png', {}, { signal: controller.signal })
|
|
5088
|
+
* ```
|
|
4965
5089
|
*/
|
|
4966
|
-
download(path, options) {
|
|
5090
|
+
download(path, options, parameters) {
|
|
4967
5091
|
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image/authenticated" : "object";
|
|
4968
5092
|
const transformationQuery = this.transformOptsToQueryString((options === null || options === void 0 ? void 0 : options.transform) || {});
|
|
4969
5093
|
const queryString = transformationQuery ? `?${transformationQuery}` : "";
|
|
@@ -4971,7 +5095,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
4971
5095
|
const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString}`, {
|
|
4972
5096
|
headers: this.headers,
|
|
4973
5097
|
noResolveJson: true
|
|
4974
|
-
});
|
|
5098
|
+
}, parameters);
|
|
4975
5099
|
return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError);
|
|
4976
5100
|
}
|
|
4977
5101
|
/**
|
|
@@ -5194,7 +5318,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
5194
5318
|
async list(path, options, parameters) {
|
|
5195
5319
|
var _this13 = this;
|
|
5196
5320
|
return _this13.handleOperation(async () => {
|
|
5197
|
-
const body =
|
|
5321
|
+
const body = _objectSpread22(_objectSpread22(_objectSpread22({}, DEFAULT_SEARCH_OPTIONS), options), {}, { prefix: path || "" });
|
|
5198
5322
|
return await post(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters);
|
|
5199
5323
|
});
|
|
5200
5324
|
}
|
|
@@ -5208,7 +5332,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
5208
5332
|
async listV2(options, parameters) {
|
|
5209
5333
|
var _this14 = this;
|
|
5210
5334
|
return _this14.handleOperation(async () => {
|
|
5211
|
-
const body =
|
|
5335
|
+
const body = _objectSpread22({}, options);
|
|
5212
5336
|
return await post(_this14.fetch, `${_this14.url}/object/list-v2/${_this14.bucketId}`, body, { headers: _this14.headers }, parameters);
|
|
5213
5337
|
});
|
|
5214
5338
|
}
|
|
@@ -5235,7 +5359,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
5235
5359
|
return params.join("&");
|
|
5236
5360
|
}
|
|
5237
5361
|
};
|
|
5238
|
-
var version2 = "2.
|
|
5362
|
+
var version2 = "2.95.3";
|
|
5239
5363
|
var DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version2}` };
|
|
5240
5364
|
var StorageBucketApi = class extends BaseApiClient {
|
|
5241
5365
|
constructor(url, headers = {}, fetch$1, opts) {
|
|
@@ -5244,7 +5368,7 @@ var StorageBucketApi = class extends BaseApiClient {
|
|
|
5244
5368
|
if (/supabase\.(co|in|red)$/.test(baseUrl.hostname) && !baseUrl.hostname.includes("storage.supabase.")) baseUrl.hostname = baseUrl.hostname.replace("supabase.", "storage.supabase.");
|
|
5245
5369
|
}
|
|
5246
5370
|
const finalUrl = baseUrl.href.replace(/\/$/, "");
|
|
5247
|
-
const finalHeaders =
|
|
5371
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
|
|
5248
5372
|
super(finalUrl, finalHeaders, fetch$1, "storage");
|
|
5249
5373
|
}
|
|
5250
5374
|
/**
|
|
@@ -5515,7 +5639,7 @@ var StorageAnalyticsClient = class extends BaseApiClient {
|
|
|
5515
5639
|
*/
|
|
5516
5640
|
constructor(url, headers = {}, fetch$1) {
|
|
5517
5641
|
const finalUrl = url.replace(/\/$/, "");
|
|
5518
|
-
const finalHeaders =
|
|
5642
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), headers);
|
|
5519
5643
|
super(finalUrl, finalHeaders, fetch$1, "storage");
|
|
5520
5644
|
}
|
|
5521
5645
|
/**
|
|
@@ -5815,21 +5939,21 @@ var VectorIndexApi = class extends BaseApiClient {
|
|
|
5815
5939
|
/** Creates a new VectorIndexApi instance */
|
|
5816
5940
|
constructor(url, headers = {}, fetch$1) {
|
|
5817
5941
|
const finalUrl = url.replace(/\/$/, "");
|
|
5818
|
-
const finalHeaders =
|
|
5942
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
5819
5943
|
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
5820
5944
|
}
|
|
5821
5945
|
/** Creates a new vector index within a bucket */
|
|
5822
5946
|
async createIndex(options) {
|
|
5823
5947
|
var _this = this;
|
|
5824
5948
|
return _this.handleOperation(async () => {
|
|
5825
|
-
return await post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
|
|
5949
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/CreateIndex`, options, { headers: _this.headers }) || {};
|
|
5826
5950
|
});
|
|
5827
5951
|
}
|
|
5828
5952
|
/** Retrieves metadata for a specific vector index */
|
|
5829
5953
|
async getIndex(vectorBucketName, indexName) {
|
|
5830
5954
|
var _this2 = this;
|
|
5831
5955
|
return _this2.handleOperation(async () => {
|
|
5832
|
-
return await post(_this2.fetch, `${_this2.url}/GetIndex`, {
|
|
5956
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetIndex`, {
|
|
5833
5957
|
vectorBucketName,
|
|
5834
5958
|
indexName
|
|
5835
5959
|
}, { headers: _this2.headers });
|
|
@@ -5839,14 +5963,14 @@ var VectorIndexApi = class extends BaseApiClient {
|
|
|
5839
5963
|
async listIndexes(options) {
|
|
5840
5964
|
var _this3 = this;
|
|
5841
5965
|
return _this3.handleOperation(async () => {
|
|
5842
|
-
return await post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
|
|
5966
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListIndexes`, options, { headers: _this3.headers });
|
|
5843
5967
|
});
|
|
5844
5968
|
}
|
|
5845
5969
|
/** Deletes a vector index and all its data */
|
|
5846
5970
|
async deleteIndex(vectorBucketName, indexName) {
|
|
5847
5971
|
var _this4 = this;
|
|
5848
5972
|
return _this4.handleOperation(async () => {
|
|
5849
|
-
return await post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
|
|
5973
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteIndex`, {
|
|
5850
5974
|
vectorBucketName,
|
|
5851
5975
|
indexName
|
|
5852
5976
|
}, { headers: _this4.headers }) || {};
|
|
@@ -5857,7 +5981,7 @@ var VectorDataApi = class extends BaseApiClient {
|
|
|
5857
5981
|
/** Creates a new VectorDataApi instance */
|
|
5858
5982
|
constructor(url, headers = {}, fetch$1) {
|
|
5859
5983
|
const finalUrl = url.replace(/\/$/, "");
|
|
5860
|
-
const finalHeaders =
|
|
5984
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
5861
5985
|
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
5862
5986
|
}
|
|
5863
5987
|
/** Inserts or updates vectors in batch (1-500 per request) */
|
|
@@ -5865,14 +5989,14 @@ var VectorDataApi = class extends BaseApiClient {
|
|
|
5865
5989
|
var _this = this;
|
|
5866
5990
|
if (options.vectors.length < 1 || options.vectors.length > 500) throw new Error("Vector batch size must be between 1 and 500 items");
|
|
5867
5991
|
return _this.handleOperation(async () => {
|
|
5868
|
-
return await post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
|
|
5992
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/PutVectors`, options, { headers: _this.headers }) || {};
|
|
5869
5993
|
});
|
|
5870
5994
|
}
|
|
5871
5995
|
/** Retrieves vectors by their keys in batch */
|
|
5872
5996
|
async getVectors(options) {
|
|
5873
5997
|
var _this2 = this;
|
|
5874
5998
|
return _this2.handleOperation(async () => {
|
|
5875
|
-
return await post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
|
|
5999
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectors`, options, { headers: _this2.headers });
|
|
5876
6000
|
});
|
|
5877
6001
|
}
|
|
5878
6002
|
/** Lists vectors in an index with pagination */
|
|
@@ -5885,14 +6009,14 @@ var VectorDataApi = class extends BaseApiClient {
|
|
|
5885
6009
|
}
|
|
5886
6010
|
}
|
|
5887
6011
|
return _this3.handleOperation(async () => {
|
|
5888
|
-
return await post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
|
|
6012
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectors`, options, { headers: _this3.headers });
|
|
5889
6013
|
});
|
|
5890
6014
|
}
|
|
5891
6015
|
/** Queries for similar vectors using approximate nearest neighbor search */
|
|
5892
6016
|
async queryVectors(options) {
|
|
5893
6017
|
var _this4 = this;
|
|
5894
6018
|
return _this4.handleOperation(async () => {
|
|
5895
|
-
return await post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
|
|
6019
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/QueryVectors`, options, { headers: _this4.headers });
|
|
5896
6020
|
});
|
|
5897
6021
|
}
|
|
5898
6022
|
/** Deletes vectors by their keys in batch (1-500 per request) */
|
|
@@ -5900,7 +6024,7 @@ var VectorDataApi = class extends BaseApiClient {
|
|
|
5900
6024
|
var _this5 = this;
|
|
5901
6025
|
if (options.keys.length < 1 || options.keys.length > 500) throw new Error("Keys batch size must be between 1 and 500 items");
|
|
5902
6026
|
return _this5.handleOperation(async () => {
|
|
5903
|
-
return await post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
|
|
6027
|
+
return await vectorsApi.post(_this5.fetch, `${_this5.url}/DeleteVectors`, options, { headers: _this5.headers }) || {};
|
|
5904
6028
|
});
|
|
5905
6029
|
}
|
|
5906
6030
|
};
|
|
@@ -5908,35 +6032,35 @@ var VectorBucketApi = class extends BaseApiClient {
|
|
|
5908
6032
|
/** Creates a new VectorBucketApi instance */
|
|
5909
6033
|
constructor(url, headers = {}, fetch$1) {
|
|
5910
6034
|
const finalUrl = url.replace(/\/$/, "");
|
|
5911
|
-
const finalHeaders =
|
|
6035
|
+
const finalHeaders = _objectSpread22(_objectSpread22({}, DEFAULT_HEADERS), {}, { "Content-Type": "application/json" }, headers);
|
|
5912
6036
|
super(finalUrl, finalHeaders, fetch$1, "vectors");
|
|
5913
6037
|
}
|
|
5914
6038
|
/** Creates a new vector bucket */
|
|
5915
6039
|
async createBucket(vectorBucketName) {
|
|
5916
6040
|
var _this = this;
|
|
5917
6041
|
return _this.handleOperation(async () => {
|
|
5918
|
-
return await post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
|
|
6042
|
+
return await vectorsApi.post(_this.fetch, `${_this.url}/CreateVectorBucket`, { vectorBucketName }, { headers: _this.headers }) || {};
|
|
5919
6043
|
});
|
|
5920
6044
|
}
|
|
5921
6045
|
/** Retrieves metadata for a specific vector bucket */
|
|
5922
6046
|
async getBucket(vectorBucketName) {
|
|
5923
6047
|
var _this2 = this;
|
|
5924
6048
|
return _this2.handleOperation(async () => {
|
|
5925
|
-
return await post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
|
|
6049
|
+
return await vectorsApi.post(_this2.fetch, `${_this2.url}/GetVectorBucket`, { vectorBucketName }, { headers: _this2.headers });
|
|
5926
6050
|
});
|
|
5927
6051
|
}
|
|
5928
6052
|
/** Lists vector buckets with optional filtering and pagination */
|
|
5929
6053
|
async listBuckets(options = {}) {
|
|
5930
6054
|
var _this3 = this;
|
|
5931
6055
|
return _this3.handleOperation(async () => {
|
|
5932
|
-
return await post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
|
|
6056
|
+
return await vectorsApi.post(_this3.fetch, `${_this3.url}/ListVectorBuckets`, options, { headers: _this3.headers });
|
|
5933
6057
|
});
|
|
5934
6058
|
}
|
|
5935
6059
|
/** Deletes a vector bucket (must be empty first) */
|
|
5936
6060
|
async deleteBucket(vectorBucketName) {
|
|
5937
6061
|
var _this4 = this;
|
|
5938
6062
|
return _this4.handleOperation(async () => {
|
|
5939
|
-
return await post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
|
|
6063
|
+
return await vectorsApi.post(_this4.fetch, `${_this4.url}/DeleteVectorBucket`, { vectorBucketName }, { headers: _this4.headers }) || {};
|
|
5940
6064
|
});
|
|
5941
6065
|
}
|
|
5942
6066
|
};
|
|
@@ -6134,7 +6258,7 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
6134
6258
|
*/
|
|
6135
6259
|
async createIndex(options) {
|
|
6136
6260
|
var _superprop_getCreateIndex = () => super.createIndex, _this5 = this;
|
|
6137
|
-
return _superprop_getCreateIndex().call(_this5,
|
|
6261
|
+
return _superprop_getCreateIndex().call(_this5, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this5.vectorBucketName }));
|
|
6138
6262
|
}
|
|
6139
6263
|
/**
|
|
6140
6264
|
*
|
|
@@ -6157,7 +6281,7 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
6157
6281
|
*/
|
|
6158
6282
|
async listIndexes(options = {}) {
|
|
6159
6283
|
var _superprop_getListIndexes = () => super.listIndexes, _this6 = this;
|
|
6160
|
-
return _superprop_getListIndexes().call(_this6,
|
|
6284
|
+
return _superprop_getListIndexes().call(_this6, _objectSpread22(_objectSpread22({}, options), {}, { vectorBucketName: _this6.vectorBucketName }));
|
|
6161
6285
|
}
|
|
6162
6286
|
/**
|
|
6163
6287
|
*
|
|
@@ -6290,7 +6414,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
6290
6414
|
*/
|
|
6291
6415
|
async putVectors(options) {
|
|
6292
6416
|
var _superprop_getPutVectors = () => super.putVectors, _this9 = this;
|
|
6293
|
-
return _superprop_getPutVectors().call(_this9,
|
|
6417
|
+
return _superprop_getPutVectors().call(_this9, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
6294
6418
|
vectorBucketName: _this9.vectorBucketName,
|
|
6295
6419
|
indexName: _this9.indexName
|
|
6296
6420
|
}));
|
|
@@ -6319,7 +6443,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
6319
6443
|
*/
|
|
6320
6444
|
async getVectors(options) {
|
|
6321
6445
|
var _superprop_getGetVectors = () => super.getVectors, _this10 = this;
|
|
6322
|
-
return _superprop_getGetVectors().call(_this10,
|
|
6446
|
+
return _superprop_getGetVectors().call(_this10, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
6323
6447
|
vectorBucketName: _this10.vectorBucketName,
|
|
6324
6448
|
indexName: _this10.indexName
|
|
6325
6449
|
}));
|
|
@@ -6348,7 +6472,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
6348
6472
|
*/
|
|
6349
6473
|
async listVectors(options = {}) {
|
|
6350
6474
|
var _superprop_getListVectors = () => super.listVectors, _this11 = this;
|
|
6351
|
-
return _superprop_getListVectors().call(_this11,
|
|
6475
|
+
return _superprop_getListVectors().call(_this11, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
6352
6476
|
vectorBucketName: _this11.vectorBucketName,
|
|
6353
6477
|
indexName: _this11.indexName
|
|
6354
6478
|
}));
|
|
@@ -6380,7 +6504,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
6380
6504
|
*/
|
|
6381
6505
|
async queryVectors(options) {
|
|
6382
6506
|
var _superprop_getQueryVectors = () => super.queryVectors, _this12 = this;
|
|
6383
|
-
return _superprop_getQueryVectors().call(_this12,
|
|
6507
|
+
return _superprop_getQueryVectors().call(_this12, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
6384
6508
|
vectorBucketName: _this12.vectorBucketName,
|
|
6385
6509
|
indexName: _this12.indexName
|
|
6386
6510
|
}));
|
|
@@ -6408,7 +6532,7 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
6408
6532
|
*/
|
|
6409
6533
|
async deleteVectors(options) {
|
|
6410
6534
|
var _superprop_getDeleteVectors = () => super.deleteVectors, _this13 = this;
|
|
6411
|
-
return _superprop_getDeleteVectors().call(_this13,
|
|
6535
|
+
return _superprop_getDeleteVectors().call(_this13, _objectSpread22(_objectSpread22({}, options), {}, {
|
|
6412
6536
|
vectorBucketName: _this13.vectorBucketName,
|
|
6413
6537
|
indexName: _this13.indexName
|
|
6414
6538
|
}));
|
|
@@ -6480,7 +6604,7 @@ var StorageClient = class extends StorageBucketApi {
|
|
|
6480
6604
|
};
|
|
6481
6605
|
|
|
6482
6606
|
// ../../node_modules/@supabase/auth-js/dist/module/lib/version.js
|
|
6483
|
-
var version3 = "2.
|
|
6607
|
+
var version3 = "2.95.3";
|
|
6484
6608
|
|
|
6485
6609
|
// ../../node_modules/@supabase/auth-js/dist/module/lib/constants.js
|
|
6486
6610
|
var AUTO_REFRESH_TICK_DURATION_MS = 30 * 1e3;
|
|
@@ -8248,6 +8372,7 @@ var WebAuthnApi = class {
|
|
|
8248
8372
|
* @see {@link https://w3c.github.io/webauthn/#sctn-verifying-assertion W3C WebAuthn Spec - Verifying Assertion}
|
|
8249
8373
|
*/
|
|
8250
8374
|
async _challenge({ factorId, webauthn, friendlyName, signal }, overrides) {
|
|
8375
|
+
var _a;
|
|
8251
8376
|
try {
|
|
8252
8377
|
const { data: challengeResponse, error: challengeError } = await this.client.mfa.challenge({
|
|
8253
8378
|
factorId,
|
|
@@ -8260,7 +8385,15 @@ var WebAuthnApi = class {
|
|
|
8260
8385
|
if (challengeResponse.webauthn.type === "create") {
|
|
8261
8386
|
const { user } = challengeResponse.webauthn.credential_options.publicKey;
|
|
8262
8387
|
if (!user.name) {
|
|
8263
|
-
|
|
8388
|
+
const nameToUse = friendlyName;
|
|
8389
|
+
if (!nameToUse) {
|
|
8390
|
+
const currentUser = await this.client.getUser();
|
|
8391
|
+
const userData = currentUser.data.user;
|
|
8392
|
+
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";
|
|
8393
|
+
user.name = `${user.id}:${fallbackName}`;
|
|
8394
|
+
} else {
|
|
8395
|
+
user.name = `${user.id}:${nameToUse}`;
|
|
8396
|
+
}
|
|
8264
8397
|
}
|
|
8265
8398
|
if (!user.displayName) {
|
|
8266
8399
|
user.displayName = user.name;
|
|
@@ -10770,7 +10903,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
10770
10903
|
* Only relevant when the OAuth 2.1 server is enabled in Supabase Auth.
|
|
10771
10904
|
*
|
|
10772
10905
|
* Returns authorization details including client info, scopes, and user information.
|
|
10773
|
-
* If the
|
|
10906
|
+
* If the response includes only a redirect_url field, it means consent was already given - the caller
|
|
10774
10907
|
* should handle the redirect manually if needed.
|
|
10775
10908
|
*/
|
|
10776
10909
|
async _getAuthorizationDetails(authorizationId) {
|
|
@@ -11024,7 +11157,7 @@ var AuthClient = GoTrueClient_default;
|
|
|
11024
11157
|
var AuthClient_default = AuthClient;
|
|
11025
11158
|
|
|
11026
11159
|
// ../../node_modules/@supabase/supabase-js/dist/index.mjs
|
|
11027
|
-
var version4 = "2.
|
|
11160
|
+
var version4 = "2.95.3";
|
|
11028
11161
|
var JS_ENV = "";
|
|
11029
11162
|
if (typeof Deno !== "undefined") JS_ENV = "deno";
|
|
11030
11163
|
else if (typeof document !== "undefined") JS_ENV = "web";
|
|
@@ -11040,37 +11173,37 @@ var DEFAULT_AUTH_OPTIONS = {
|
|
|
11040
11173
|
flowType: "implicit"
|
|
11041
11174
|
};
|
|
11042
11175
|
var DEFAULT_REALTIME_OPTIONS = {};
|
|
11043
|
-
function
|
|
11176
|
+
function _typeof3(o) {
|
|
11044
11177
|
"@babel/helpers - typeof";
|
|
11045
|
-
return
|
|
11178
|
+
return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
11046
11179
|
return typeof o$1;
|
|
11047
11180
|
} : function(o$1) {
|
|
11048
11181
|
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
11049
|
-
},
|
|
11182
|
+
}, _typeof3(o);
|
|
11050
11183
|
}
|
|
11051
|
-
function
|
|
11052
|
-
if ("object" !=
|
|
11184
|
+
function toPrimitive3(t, r) {
|
|
11185
|
+
if ("object" != _typeof3(t) || !t) return t;
|
|
11053
11186
|
var e = t[Symbol.toPrimitive];
|
|
11054
11187
|
if (void 0 !== e) {
|
|
11055
11188
|
var i = e.call(t, r || "default");
|
|
11056
|
-
if ("object" !=
|
|
11189
|
+
if ("object" != _typeof3(i)) return i;
|
|
11057
11190
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
11058
11191
|
}
|
|
11059
11192
|
return ("string" === r ? String : Number)(t);
|
|
11060
11193
|
}
|
|
11061
|
-
function
|
|
11062
|
-
var i =
|
|
11063
|
-
return "symbol" ==
|
|
11194
|
+
function toPropertyKey3(t) {
|
|
11195
|
+
var i = toPrimitive3(t, "string");
|
|
11196
|
+
return "symbol" == _typeof3(i) ? i : i + "";
|
|
11064
11197
|
}
|
|
11065
|
-
function
|
|
11066
|
-
return (r =
|
|
11198
|
+
function _defineProperty3(e, r, t) {
|
|
11199
|
+
return (r = toPropertyKey3(r)) in e ? Object.defineProperty(e, r, {
|
|
11067
11200
|
value: t,
|
|
11068
11201
|
enumerable: true,
|
|
11069
11202
|
configurable: true,
|
|
11070
11203
|
writable: true
|
|
11071
11204
|
}) : e[r] = t, e;
|
|
11072
11205
|
}
|
|
11073
|
-
function
|
|
11206
|
+
function ownKeys3(e, r) {
|
|
11074
11207
|
var t = Object.keys(e);
|
|
11075
11208
|
if (Object.getOwnPropertySymbols) {
|
|
11076
11209
|
var o = Object.getOwnPropertySymbols(e);
|
|
@@ -11080,12 +11213,12 @@ function ownKeys2(e, r) {
|
|
|
11080
11213
|
}
|
|
11081
11214
|
return t;
|
|
11082
11215
|
}
|
|
11083
|
-
function
|
|
11216
|
+
function _objectSpread23(e) {
|
|
11084
11217
|
for (var r = 1; r < arguments.length; r++) {
|
|
11085
11218
|
var t = null != arguments[r] ? arguments[r] : {};
|
|
11086
|
-
r % 2 ?
|
|
11087
|
-
|
|
11088
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) :
|
|
11219
|
+
r % 2 ? ownKeys3(Object(t), true).forEach(function(r$1) {
|
|
11220
|
+
_defineProperty3(e, r$1, t[r$1]);
|
|
11221
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys3(Object(t)).forEach(function(r$1) {
|
|
11089
11222
|
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
11090
11223
|
});
|
|
11091
11224
|
}
|
|
@@ -11107,7 +11240,7 @@ var fetchWithAuth = (supabaseKey, getAccessToken, customFetch) => {
|
|
|
11107
11240
|
let headers = new HeadersConstructor(init === null || init === void 0 ? void 0 : init.headers);
|
|
11108
11241
|
if (!headers.has("apikey")) headers.set("apikey", supabaseKey);
|
|
11109
11242
|
if (!headers.has("Authorization")) headers.set("Authorization", `Bearer ${accessToken}`);
|
|
11110
|
-
return fetch$1(input,
|
|
11243
|
+
return fetch$1(input, _objectSpread23(_objectSpread23({}, init), {}, { headers }));
|
|
11111
11244
|
};
|
|
11112
11245
|
};
|
|
11113
11246
|
function ensureTrailingSlash(url) {
|
|
@@ -11118,11 +11251,11 @@ function applySettingDefaults(options, defaults) {
|
|
|
11118
11251
|
const { db: dbOptions, auth: authOptions, realtime: realtimeOptions, global: globalOptions } = options;
|
|
11119
11252
|
const { db: DEFAULT_DB_OPTIONS$1, auth: DEFAULT_AUTH_OPTIONS$1, realtime: DEFAULT_REALTIME_OPTIONS$1, global: DEFAULT_GLOBAL_OPTIONS$1 } = defaults;
|
|
11120
11253
|
const result = {
|
|
11121
|
-
db:
|
|
11122
|
-
auth:
|
|
11123
|
-
realtime:
|
|
11254
|
+
db: _objectSpread23(_objectSpread23({}, DEFAULT_DB_OPTIONS$1), dbOptions),
|
|
11255
|
+
auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS$1), authOptions),
|
|
11256
|
+
realtime: _objectSpread23(_objectSpread23({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions),
|
|
11124
11257
|
storage: {},
|
|
11125
|
-
global:
|
|
11258
|
+
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 : {}) }),
|
|
11126
11259
|
accessToken: async () => ""
|
|
11127
11260
|
};
|
|
11128
11261
|
if (options.accessToken) result.accessToken = options.accessToken;
|
|
@@ -11180,7 +11313,7 @@ var SupabaseClient = class {
|
|
|
11180
11313
|
const DEFAULTS = {
|
|
11181
11314
|
db: DEFAULT_DB_OPTIONS,
|
|
11182
11315
|
realtime: DEFAULT_REALTIME_OPTIONS,
|
|
11183
|
-
auth:
|
|
11316
|
+
auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }),
|
|
11184
11317
|
global: DEFAULT_GLOBAL_OPTIONS
|
|
11185
11318
|
};
|
|
11186
11319
|
const settings = applySettingDefaults(options !== null && options !== void 0 ? options : {}, DEFAULTS);
|
|
@@ -11196,7 +11329,7 @@ var SupabaseClient = class {
|
|
|
11196
11329
|
} });
|
|
11197
11330
|
}
|
|
11198
11331
|
this.fetch = fetchWithAuth(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch);
|
|
11199
|
-
this.realtime = this._initRealtimeClient(
|
|
11332
|
+
this.realtime = this._initRealtimeClient(_objectSpread23({
|
|
11200
11333
|
headers: this.headers,
|
|
11201
11334
|
accessToken: this._getAccessToken.bind(this)
|
|
11202
11335
|
}, settings.realtime));
|
|
@@ -11204,7 +11337,9 @@ var SupabaseClient = class {
|
|
|
11204
11337
|
this.rest = new PostgrestClient(new URL("rest/v1", baseUrl).href, {
|
|
11205
11338
|
headers: this.headers,
|
|
11206
11339
|
schema: settings.db.schema,
|
|
11207
|
-
fetch: this.fetch
|
|
11340
|
+
fetch: this.fetch,
|
|
11341
|
+
timeout: settings.db.timeout,
|
|
11342
|
+
urlLengthLimit: settings.db.urlLengthLimit
|
|
11208
11343
|
});
|
|
11209
11344
|
this.storage = new StorageClient(this.storageUrl.href, this.headers, this.fetch, options === null || options === void 0 ? void 0 : options.storage);
|
|
11210
11345
|
if (!settings.accessToken) this._listenForAuthEvents();
|
|
@@ -11311,7 +11446,7 @@ var SupabaseClient = class {
|
|
|
11311
11446
|
};
|
|
11312
11447
|
return new SupabaseAuthClient({
|
|
11313
11448
|
url: this.authUrl.href,
|
|
11314
|
-
headers:
|
|
11449
|
+
headers: _objectSpread23(_objectSpread23({}, authHeaders), headers),
|
|
11315
11450
|
storageKey,
|
|
11316
11451
|
autoRefreshToken,
|
|
11317
11452
|
persistSession,
|
|
@@ -11327,7 +11462,7 @@ var SupabaseClient = class {
|
|
|
11327
11462
|
});
|
|
11328
11463
|
}
|
|
11329
11464
|
_initRealtimeClient(options) {
|
|
11330
|
-
return new RealtimeClient(this.realtimeUrl.href,
|
|
11465
|
+
return new RealtimeClient(this.realtimeUrl.href, _objectSpread23(_objectSpread23({}, options), {}, { params: _objectSpread23(_objectSpread23({}, { apikey: this.supabaseKey }), options === null || options === void 0 ? void 0 : options.params) }));
|
|
11331
11466
|
}
|
|
11332
11467
|
_listenForAuthEvents() {
|
|
11333
11468
|
return this.auth.onAuthStateChange((event, session) => {
|
|
@@ -11434,7 +11569,7 @@ var ContextCaptureManager = class {
|
|
|
11434
11569
|
if (this.navigationHistory.length > 0) {
|
|
11435
11570
|
return this.navigationHistory[this.navigationHistory.length - 1];
|
|
11436
11571
|
}
|
|
11437
|
-
if (typeof window !== "undefined") {
|
|
11572
|
+
if (typeof window !== "undefined" && window.location) {
|
|
11438
11573
|
return window.location.pathname;
|
|
11439
11574
|
}
|
|
11440
11575
|
return "unknown";
|
|
@@ -11546,7 +11681,7 @@ var ContextCaptureManager = class {
|
|
|
11546
11681
|
};
|
|
11547
11682
|
}
|
|
11548
11683
|
captureNavigation() {
|
|
11549
|
-
if (typeof window === "undefined" || typeof history === "undefined") return;
|
|
11684
|
+
if (typeof window === "undefined" || typeof history === "undefined" || !window.location) return;
|
|
11550
11685
|
this.trackNavigation(window.location.pathname);
|
|
11551
11686
|
const self2 = this;
|
|
11552
11687
|
this.originalPushState = history.pushState;
|
|
@@ -11584,13 +11719,13 @@ var ContextCaptureManager = class {
|
|
|
11584
11719
|
return Object.keys(metrics).length > 0 ? metrics : void 0;
|
|
11585
11720
|
}
|
|
11586
11721
|
getEnvironmentInfo() {
|
|
11587
|
-
if (typeof window === "undefined" || typeof navigator === "undefined") return void 0;
|
|
11722
|
+
if (typeof window === "undefined" || typeof navigator === "undefined" || typeof document === "undefined") return void 0;
|
|
11588
11723
|
return {
|
|
11589
11724
|
language: navigator.language,
|
|
11590
11725
|
timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
|
|
11591
|
-
cookiesEnabled: navigator.cookieEnabled,
|
|
11726
|
+
cookiesEnabled: navigator.cookieEnabled ?? false,
|
|
11592
11727
|
localStorage: typeof localStorage !== "undefined",
|
|
11593
|
-
online: navigator.onLine
|
|
11728
|
+
online: navigator.onLine ?? true
|
|
11594
11729
|
};
|
|
11595
11730
|
}
|
|
11596
11731
|
};
|
|
@@ -12934,15 +13069,18 @@ var BugBearClient = class {
|
|
|
12934
13069
|
* Get device info (override in platform-specific implementations)
|
|
12935
13070
|
*/
|
|
12936
13071
|
getDeviceInfo() {
|
|
12937
|
-
if (typeof window !== "undefined") {
|
|
12938
|
-
|
|
12939
|
-
|
|
12940
|
-
userAgent
|
|
12941
|
-
|
|
13072
|
+
if (typeof window !== "undefined" && typeof document !== "undefined") {
|
|
13073
|
+
const info = { platform: "web" };
|
|
13074
|
+
if (typeof navigator !== "undefined" && navigator.userAgent) {
|
|
13075
|
+
info.userAgent = navigator.userAgent;
|
|
13076
|
+
}
|
|
13077
|
+
if (window.screen) {
|
|
13078
|
+
info.screenSize = {
|
|
12942
13079
|
width: window.screen.width,
|
|
12943
13080
|
height: window.screen.height
|
|
12944
|
-
}
|
|
12945
|
-
}
|
|
13081
|
+
};
|
|
13082
|
+
}
|
|
13083
|
+
return info;
|
|
12946
13084
|
}
|
|
12947
13085
|
return { platform: "web" };
|
|
12948
13086
|
}
|