dreamboard 0.1.1-beta.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-MP7IBNWW.js → chunk-DD36YMMQ.js} +111 -1841
- package/dist/chunk-DD36YMMQ.js.map +1 -0
- package/dist/{chunk-YSTAFZRY.js → chunk-JUL27YLF.js} +6 -4
- package/dist/{chunk-YSTAFZRY.js.map → chunk-JUL27YLF.js.map} +1 -1
- package/dist/{dist-B3R64F6G.js → dist-W7KDKXWG.js} +2 -2
- package/dist/{embedded-harness-2RNDY5DJ.js → embedded-harness-DQOVBU6E.js} +2 -2
- package/dist/index.js +23 -24
- package/dist/index.js.map +1 -1
- package/dist/{prompt-GMZABCJC.js → prompt-XCUPD2NB.js} +3 -3
- package/dist/{prompt-GMZABCJC.js.map → prompt-XCUPD2NB.js.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-MP7IBNWW.js.map +0 -1
- /package/dist/{dist-B3R64F6G.js.map → dist-W7KDKXWG.js.map} +0 -0
- /package/dist/{embedded-harness-2RNDY5DJ.js.map → embedded-harness-DQOVBU6E.js.map} +0 -0
|
@@ -40,7 +40,7 @@ function __awaiter(thisArg, _arguments, P, generator) {
|
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
// ../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
43
|
+
// ../../node_modules/.pnpm/@supabase+functions-js@2.94.1/node_modules/@supabase/functions-js/dist/module/helper.js
|
|
44
44
|
var resolveFetch = (customFetch) => {
|
|
45
45
|
if (customFetch) {
|
|
46
46
|
return (...args) => customFetch(...args);
|
|
@@ -48,7 +48,7 @@ var resolveFetch = (customFetch) => {
|
|
|
48
48
|
return (...args) => fetch(...args);
|
|
49
49
|
};
|
|
50
50
|
|
|
51
|
-
// ../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
51
|
+
// ../../node_modules/.pnpm/@supabase+functions-js@2.94.1/node_modules/@supabase/functions-js/dist/module/types.js
|
|
52
52
|
var FunctionsError = class extends Error {
|
|
53
53
|
constructor(message, name = "FunctionsError", context) {
|
|
54
54
|
super(message);
|
|
@@ -90,7 +90,7 @@ var FunctionRegion;
|
|
|
90
90
|
FunctionRegion2["UsWest2"] = "us-west-2";
|
|
91
91
|
})(FunctionRegion || (FunctionRegion = {}));
|
|
92
92
|
|
|
93
|
-
// ../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
93
|
+
// ../../node_modules/.pnpm/@supabase+functions-js@2.94.1/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
|
|
94
94
|
var FunctionsClient = class {
|
|
95
95
|
/**
|
|
96
96
|
* Creates a new Functions client bound to an Edge Functions URL.
|
|
@@ -230,7 +230,7 @@ var FunctionsClient = class {
|
|
|
230
230
|
}
|
|
231
231
|
};
|
|
232
232
|
|
|
233
|
-
// ../../node_modules/.pnpm/@supabase+postgrest-js@2.
|
|
233
|
+
// ../../node_modules/.pnpm/@supabase+postgrest-js@2.94.1/node_modules/@supabase/postgrest-js/dist/index.mjs
|
|
234
234
|
var PostgrestError = class extends Error {
|
|
235
235
|
/**
|
|
236
236
|
* @example
|
|
@@ -1094,760 +1094,6 @@ var PostgrestQueryBuilder = class {
|
|
|
1094
1094
|
* @remarks
|
|
1095
1095
|
* When using `count` with `.range()` or `.limit()`, the returned `count` is the total number of rows
|
|
1096
1096
|
* that match your filters, not the number of rows in the current page. Use this to build pagination UI.
|
|
1097
|
-
|
|
1098
|
-
* - By default, Supabase projects return a maximum of 1,000 rows. This setting can be changed in your project's [API settings](/dashboard/project/_/settings/api). It's recommended that you keep it low to limit the payload size of accidental or malicious requests. You can use `range()` queries to paginate through your data.
|
|
1099
|
-
* - `select()` can be combined with [Filters](/docs/reference/javascript/using-filters)
|
|
1100
|
-
* - `select()` can be combined with [Modifiers](/docs/reference/javascript/using-modifiers)
|
|
1101
|
-
* - `apikey` is a reserved keyword if you're using the [Supabase Platform](/docs/guides/platform) and [should be avoided as a column name](https://github.com/supabase/supabase/issues/5465). *
|
|
1102
|
-
* @category Database
|
|
1103
|
-
*
|
|
1104
|
-
* @example Getting your data
|
|
1105
|
-
* ```js
|
|
1106
|
-
* const { data, error } = await supabase
|
|
1107
|
-
* .from('characters')
|
|
1108
|
-
* .select()
|
|
1109
|
-
* ```
|
|
1110
|
-
*
|
|
1111
|
-
* @exampleSql Getting your data
|
|
1112
|
-
* ```sql
|
|
1113
|
-
* create table
|
|
1114
|
-
* characters (id int8 primary key, name text);
|
|
1115
|
-
*
|
|
1116
|
-
* insert into
|
|
1117
|
-
* characters (id, name)
|
|
1118
|
-
* values
|
|
1119
|
-
* (1, 'Harry'),
|
|
1120
|
-
* (2, 'Frodo'),
|
|
1121
|
-
* (3, 'Katniss');
|
|
1122
|
-
* ```
|
|
1123
|
-
*
|
|
1124
|
-
* @exampleResponse Getting your data
|
|
1125
|
-
* ```json
|
|
1126
|
-
* {
|
|
1127
|
-
* "data": [
|
|
1128
|
-
* {
|
|
1129
|
-
* "id": 1,
|
|
1130
|
-
* "name": "Harry"
|
|
1131
|
-
* },
|
|
1132
|
-
* {
|
|
1133
|
-
* "id": 2,
|
|
1134
|
-
* "name": "Frodo"
|
|
1135
|
-
* },
|
|
1136
|
-
* {
|
|
1137
|
-
* "id": 3,
|
|
1138
|
-
* "name": "Katniss"
|
|
1139
|
-
* }
|
|
1140
|
-
* ],
|
|
1141
|
-
* "status": 200,
|
|
1142
|
-
* "statusText": "OK"
|
|
1143
|
-
* }
|
|
1144
|
-
* ```
|
|
1145
|
-
*
|
|
1146
|
-
* @example Selecting specific columns
|
|
1147
|
-
* ```js
|
|
1148
|
-
* const { data, error } = await supabase
|
|
1149
|
-
* .from('characters')
|
|
1150
|
-
* .select('name')
|
|
1151
|
-
* ```
|
|
1152
|
-
*
|
|
1153
|
-
* @exampleSql Selecting specific columns
|
|
1154
|
-
* ```sql
|
|
1155
|
-
* create table
|
|
1156
|
-
* characters (id int8 primary key, name text);
|
|
1157
|
-
*
|
|
1158
|
-
* insert into
|
|
1159
|
-
* characters (id, name)
|
|
1160
|
-
* values
|
|
1161
|
-
* (1, 'Frodo'),
|
|
1162
|
-
* (2, 'Harry'),
|
|
1163
|
-
* (3, 'Katniss');
|
|
1164
|
-
* ```
|
|
1165
|
-
*
|
|
1166
|
-
* @exampleResponse Selecting specific columns
|
|
1167
|
-
* ```json
|
|
1168
|
-
* {
|
|
1169
|
-
* "data": [
|
|
1170
|
-
* {
|
|
1171
|
-
* "name": "Frodo"
|
|
1172
|
-
* },
|
|
1173
|
-
* {
|
|
1174
|
-
* "name": "Harry"
|
|
1175
|
-
* },
|
|
1176
|
-
* {
|
|
1177
|
-
* "name": "Katniss"
|
|
1178
|
-
* }
|
|
1179
|
-
* ],
|
|
1180
|
-
* "status": 200,
|
|
1181
|
-
* "statusText": "OK"
|
|
1182
|
-
* }
|
|
1183
|
-
* ```
|
|
1184
|
-
*
|
|
1185
|
-
* @exampleDescription Query referenced tables
|
|
1186
|
-
* If your database has foreign key relationships, you can query related tables too.
|
|
1187
|
-
*
|
|
1188
|
-
* @example Query referenced tables
|
|
1189
|
-
* ```js
|
|
1190
|
-
* const { data, error } = await supabase
|
|
1191
|
-
* .from('orchestral_sections')
|
|
1192
|
-
* .select(`
|
|
1193
|
-
* name,
|
|
1194
|
-
* instruments (
|
|
1195
|
-
* name
|
|
1196
|
-
* )
|
|
1197
|
-
* `)
|
|
1198
|
-
* ```
|
|
1199
|
-
*
|
|
1200
|
-
* @exampleSql Query referenced tables
|
|
1201
|
-
* ```sql
|
|
1202
|
-
* create table
|
|
1203
|
-
* orchestral_sections (id int8 primary key, name text);
|
|
1204
|
-
* create table
|
|
1205
|
-
* instruments (
|
|
1206
|
-
* id int8 primary key,
|
|
1207
|
-
* section_id int8 not null references orchestral_sections,
|
|
1208
|
-
* name text
|
|
1209
|
-
* );
|
|
1210
|
-
*
|
|
1211
|
-
* insert into
|
|
1212
|
-
* orchestral_sections (id, name)
|
|
1213
|
-
* values
|
|
1214
|
-
* (1, 'strings'),
|
|
1215
|
-
* (2, 'woodwinds');
|
|
1216
|
-
* insert into
|
|
1217
|
-
* instruments (id, section_id, name)
|
|
1218
|
-
* values
|
|
1219
|
-
* (1, 2, 'flute'),
|
|
1220
|
-
* (2, 1, 'violin');
|
|
1221
|
-
* ```
|
|
1222
|
-
*
|
|
1223
|
-
* @exampleResponse Query referenced tables
|
|
1224
|
-
* ```json
|
|
1225
|
-
* {
|
|
1226
|
-
* "data": [
|
|
1227
|
-
* {
|
|
1228
|
-
* "name": "strings",
|
|
1229
|
-
* "instruments": [
|
|
1230
|
-
* {
|
|
1231
|
-
* "name": "violin"
|
|
1232
|
-
* }
|
|
1233
|
-
* ]
|
|
1234
|
-
* },
|
|
1235
|
-
* {
|
|
1236
|
-
* "name": "woodwinds",
|
|
1237
|
-
* "instruments": [
|
|
1238
|
-
* {
|
|
1239
|
-
* "name": "flute"
|
|
1240
|
-
* }
|
|
1241
|
-
* ]
|
|
1242
|
-
* }
|
|
1243
|
-
* ],
|
|
1244
|
-
* "status": 200,
|
|
1245
|
-
* "statusText": "OK"
|
|
1246
|
-
* }
|
|
1247
|
-
* ```
|
|
1248
|
-
*
|
|
1249
|
-
* @exampleDescription Query referenced tables with spaces in their names
|
|
1250
|
-
* If your table name contains spaces, you must use double quotes in the `select` statement to reference the table.
|
|
1251
|
-
*
|
|
1252
|
-
* @example Query referenced tables with spaces in their names
|
|
1253
|
-
* ```js
|
|
1254
|
-
* const { data, error } = await supabase
|
|
1255
|
-
* .from('orchestral sections')
|
|
1256
|
-
* .select(`
|
|
1257
|
-
* name,
|
|
1258
|
-
* "musical instruments" (
|
|
1259
|
-
* name
|
|
1260
|
-
* )
|
|
1261
|
-
* `)
|
|
1262
|
-
* ```
|
|
1263
|
-
*
|
|
1264
|
-
* @exampleSql Query referenced tables with spaces in their names
|
|
1265
|
-
* ```sql
|
|
1266
|
-
* create table
|
|
1267
|
-
* "orchestral sections" (id int8 primary key, name text);
|
|
1268
|
-
* create table
|
|
1269
|
-
* "musical instruments" (
|
|
1270
|
-
* id int8 primary key,
|
|
1271
|
-
* section_id int8 not null references "orchestral sections",
|
|
1272
|
-
* name text
|
|
1273
|
-
* );
|
|
1274
|
-
*
|
|
1275
|
-
* insert into
|
|
1276
|
-
* "orchestral sections" (id, name)
|
|
1277
|
-
* values
|
|
1278
|
-
* (1, 'strings'),
|
|
1279
|
-
* (2, 'woodwinds');
|
|
1280
|
-
* insert into
|
|
1281
|
-
* "musical instruments" (id, section_id, name)
|
|
1282
|
-
* values
|
|
1283
|
-
* (1, 2, 'flute'),
|
|
1284
|
-
* (2, 1, 'violin');
|
|
1285
|
-
* ```
|
|
1286
|
-
*
|
|
1287
|
-
* @exampleResponse Query referenced tables with spaces in their names
|
|
1288
|
-
* ```json
|
|
1289
|
-
* {
|
|
1290
|
-
* "data": [
|
|
1291
|
-
* {
|
|
1292
|
-
* "name": "strings",
|
|
1293
|
-
* "musical instruments": [
|
|
1294
|
-
* {
|
|
1295
|
-
* "name": "violin"
|
|
1296
|
-
* }
|
|
1297
|
-
* ]
|
|
1298
|
-
* },
|
|
1299
|
-
* {
|
|
1300
|
-
* "name": "woodwinds",
|
|
1301
|
-
* "musical instruments": [
|
|
1302
|
-
* {
|
|
1303
|
-
* "name": "flute"
|
|
1304
|
-
* }
|
|
1305
|
-
* ]
|
|
1306
|
-
* }
|
|
1307
|
-
* ],
|
|
1308
|
-
* "status": 200,
|
|
1309
|
-
* "statusText": "OK"
|
|
1310
|
-
* }
|
|
1311
|
-
* ```
|
|
1312
|
-
*
|
|
1313
|
-
* @exampleDescription Query referenced tables through a join table
|
|
1314
|
-
* If you're in a situation where your tables are **NOT** directly
|
|
1315
|
-
* related, but instead are joined by a _join table_, you can still use
|
|
1316
|
-
* the `select()` method to query the related data. The join table needs
|
|
1317
|
-
* to have the foreign keys as part of its composite primary key.
|
|
1318
|
-
*
|
|
1319
|
-
* @example Query referenced tables through a join table
|
|
1320
|
-
* ```ts
|
|
1321
|
-
* const { data, error } = await supabase
|
|
1322
|
-
* .from('users')
|
|
1323
|
-
* .select(`
|
|
1324
|
-
* name,
|
|
1325
|
-
* teams (
|
|
1326
|
-
* name
|
|
1327
|
-
* )
|
|
1328
|
-
* `)
|
|
1329
|
-
*
|
|
1330
|
-
* ```
|
|
1331
|
-
*
|
|
1332
|
-
* @exampleSql Query referenced tables through a join table
|
|
1333
|
-
* ```sql
|
|
1334
|
-
* create table
|
|
1335
|
-
* users (
|
|
1336
|
-
* id int8 primary key,
|
|
1337
|
-
* name text
|
|
1338
|
-
* );
|
|
1339
|
-
* create table
|
|
1340
|
-
* teams (
|
|
1341
|
-
* id int8 primary key,
|
|
1342
|
-
* name text
|
|
1343
|
-
* );
|
|
1344
|
-
* -- join table
|
|
1345
|
-
* create table
|
|
1346
|
-
* users_teams (
|
|
1347
|
-
* user_id int8 not null references users,
|
|
1348
|
-
* team_id int8 not null references teams,
|
|
1349
|
-
* -- both foreign keys must be part of a composite primary key
|
|
1350
|
-
* primary key (user_id, team_id)
|
|
1351
|
-
* );
|
|
1352
|
-
*
|
|
1353
|
-
* insert into
|
|
1354
|
-
* users (id, name)
|
|
1355
|
-
* values
|
|
1356
|
-
* (1, 'Kiran'),
|
|
1357
|
-
* (2, 'Evan');
|
|
1358
|
-
* insert into
|
|
1359
|
-
* teams (id, name)
|
|
1360
|
-
* values
|
|
1361
|
-
* (1, 'Green'),
|
|
1362
|
-
* (2, 'Blue');
|
|
1363
|
-
* insert into
|
|
1364
|
-
* users_teams (user_id, team_id)
|
|
1365
|
-
* values
|
|
1366
|
-
* (1, 1),
|
|
1367
|
-
* (1, 2),
|
|
1368
|
-
* (2, 2);
|
|
1369
|
-
* ```
|
|
1370
|
-
*
|
|
1371
|
-
* @exampleResponse Query referenced tables through a join table
|
|
1372
|
-
* ```json
|
|
1373
|
-
* {
|
|
1374
|
-
* "data": [
|
|
1375
|
-
* {
|
|
1376
|
-
* "name": "Kiran",
|
|
1377
|
-
* "teams": [
|
|
1378
|
-
* {
|
|
1379
|
-
* "name": "Green"
|
|
1380
|
-
* },
|
|
1381
|
-
* {
|
|
1382
|
-
* "name": "Blue"
|
|
1383
|
-
* }
|
|
1384
|
-
* ]
|
|
1385
|
-
* },
|
|
1386
|
-
* {
|
|
1387
|
-
* "name": "Evan",
|
|
1388
|
-
* "teams": [
|
|
1389
|
-
* {
|
|
1390
|
-
* "name": "Blue"
|
|
1391
|
-
* }
|
|
1392
|
-
* ]
|
|
1393
|
-
* }
|
|
1394
|
-
* ],
|
|
1395
|
-
* "status": 200,
|
|
1396
|
-
* "statusText": "OK"
|
|
1397
|
-
* }
|
|
1398
|
-
*
|
|
1399
|
-
* ```
|
|
1400
|
-
*
|
|
1401
|
-
* @exampleDescription Query the same referenced table multiple times
|
|
1402
|
-
* If you need to query the same referenced table twice, use the name of the
|
|
1403
|
-
* joined column to identify which join to use. You can also give each
|
|
1404
|
-
* column an alias.
|
|
1405
|
-
*
|
|
1406
|
-
* @example Query the same referenced table multiple times
|
|
1407
|
-
* ```ts
|
|
1408
|
-
* const { data, error } = await supabase
|
|
1409
|
-
* .from('messages')
|
|
1410
|
-
* .select(`
|
|
1411
|
-
* content,
|
|
1412
|
-
* from:sender_id(name),
|
|
1413
|
-
* to:receiver_id(name)
|
|
1414
|
-
* `)
|
|
1415
|
-
*
|
|
1416
|
-
* // To infer types, use the name of the table (in this case `users`) and
|
|
1417
|
-
* // the name of the foreign key constraint.
|
|
1418
|
-
* const { data, error } = await supabase
|
|
1419
|
-
* .from('messages')
|
|
1420
|
-
* .select(`
|
|
1421
|
-
* content,
|
|
1422
|
-
* from:users!messages_sender_id_fkey(name),
|
|
1423
|
-
* to:users!messages_receiver_id_fkey(name)
|
|
1424
|
-
* `)
|
|
1425
|
-
* ```
|
|
1426
|
-
*
|
|
1427
|
-
* @exampleSql Query the same referenced table multiple times
|
|
1428
|
-
* ```sql
|
|
1429
|
-
* create table
|
|
1430
|
-
* users (id int8 primary key, name text);
|
|
1431
|
-
*
|
|
1432
|
-
* create table
|
|
1433
|
-
* messages (
|
|
1434
|
-
* sender_id int8 not null references users,
|
|
1435
|
-
* receiver_id int8 not null references users,
|
|
1436
|
-
* content text
|
|
1437
|
-
* );
|
|
1438
|
-
*
|
|
1439
|
-
* insert into
|
|
1440
|
-
* users (id, name)
|
|
1441
|
-
* values
|
|
1442
|
-
* (1, 'Kiran'),
|
|
1443
|
-
* (2, 'Evan');
|
|
1444
|
-
*
|
|
1445
|
-
* insert into
|
|
1446
|
-
* messages (sender_id, receiver_id, content)
|
|
1447
|
-
* values
|
|
1448
|
-
* (1, 2, '👋');
|
|
1449
|
-
* ```
|
|
1450
|
-
* ```
|
|
1451
|
-
*
|
|
1452
|
-
* @exampleResponse Query the same referenced table multiple times
|
|
1453
|
-
* ```json
|
|
1454
|
-
* {
|
|
1455
|
-
* "data": [
|
|
1456
|
-
* {
|
|
1457
|
-
* "content": "👋",
|
|
1458
|
-
* "from": {
|
|
1459
|
-
* "name": "Kiran"
|
|
1460
|
-
* },
|
|
1461
|
-
* "to": {
|
|
1462
|
-
* "name": "Evan"
|
|
1463
|
-
* }
|
|
1464
|
-
* }
|
|
1465
|
-
* ],
|
|
1466
|
-
* "status": 200,
|
|
1467
|
-
* "statusText": "OK"
|
|
1468
|
-
* }
|
|
1469
|
-
* ```
|
|
1470
|
-
*
|
|
1471
|
-
* @exampleDescription Query nested foreign tables through a join table
|
|
1472
|
-
* You can use the result of a joined table to gather data in
|
|
1473
|
-
* another foreign table. With multiple references to the same foreign
|
|
1474
|
-
* table you must specify the column on which to conduct the join.
|
|
1475
|
-
*
|
|
1476
|
-
* @example Query nested foreign tables through a join table
|
|
1477
|
-
* ```ts
|
|
1478
|
-
* const { data, error } = await supabase
|
|
1479
|
-
* .from('games')
|
|
1480
|
-
* .select(`
|
|
1481
|
-
* game_id:id,
|
|
1482
|
-
* away_team:teams!games_away_team_fkey (
|
|
1483
|
-
* users (
|
|
1484
|
-
* id,
|
|
1485
|
-
* name
|
|
1486
|
-
* )
|
|
1487
|
-
* )
|
|
1488
|
-
* `)
|
|
1489
|
-
*
|
|
1490
|
-
* ```
|
|
1491
|
-
*
|
|
1492
|
-
* @exampleSql Query nested foreign tables through a join table
|
|
1493
|
-
* ```sql
|
|
1494
|
-
* ```sql
|
|
1495
|
-
* create table
|
|
1496
|
-
* users (
|
|
1497
|
-
* id int8 primary key,
|
|
1498
|
-
* name text
|
|
1499
|
-
* );
|
|
1500
|
-
* create table
|
|
1501
|
-
* teams (
|
|
1502
|
-
* id int8 primary key,
|
|
1503
|
-
* name text
|
|
1504
|
-
* );
|
|
1505
|
-
* -- join table
|
|
1506
|
-
* create table
|
|
1507
|
-
* users_teams (
|
|
1508
|
-
* user_id int8 not null references users,
|
|
1509
|
-
* team_id int8 not null references teams,
|
|
1510
|
-
*
|
|
1511
|
-
* primary key (user_id, team_id)
|
|
1512
|
-
* );
|
|
1513
|
-
* create table
|
|
1514
|
-
* games (
|
|
1515
|
-
* id int8 primary key,
|
|
1516
|
-
* home_team int8 not null references teams,
|
|
1517
|
-
* away_team int8 not null references teams,
|
|
1518
|
-
* name text
|
|
1519
|
-
* );
|
|
1520
|
-
*
|
|
1521
|
-
* insert into users (id, name)
|
|
1522
|
-
* values
|
|
1523
|
-
* (1, 'Kiran'),
|
|
1524
|
-
* (2, 'Evan');
|
|
1525
|
-
* insert into
|
|
1526
|
-
* teams (id, name)
|
|
1527
|
-
* values
|
|
1528
|
-
* (1, 'Green'),
|
|
1529
|
-
* (2, 'Blue');
|
|
1530
|
-
* insert into
|
|
1531
|
-
* users_teams (user_id, team_id)
|
|
1532
|
-
* values
|
|
1533
|
-
* (1, 1),
|
|
1534
|
-
* (1, 2),
|
|
1535
|
-
* (2, 2);
|
|
1536
|
-
* insert into
|
|
1537
|
-
* games (id, home_team, away_team, name)
|
|
1538
|
-
* values
|
|
1539
|
-
* (1, 1, 2, 'Green vs Blue'),
|
|
1540
|
-
* (2, 2, 1, 'Blue vs Green');
|
|
1541
|
-
* ```
|
|
1542
|
-
*
|
|
1543
|
-
* @exampleResponse Query nested foreign tables through a join table
|
|
1544
|
-
* ```json
|
|
1545
|
-
* {
|
|
1546
|
-
* "data": [
|
|
1547
|
-
* {
|
|
1548
|
-
* "game_id": 1,
|
|
1549
|
-
* "away_team": {
|
|
1550
|
-
* "users": [
|
|
1551
|
-
* {
|
|
1552
|
-
* "id": 1,
|
|
1553
|
-
* "name": "Kiran"
|
|
1554
|
-
* },
|
|
1555
|
-
* {
|
|
1556
|
-
* "id": 2,
|
|
1557
|
-
* "name": "Evan"
|
|
1558
|
-
* }
|
|
1559
|
-
* ]
|
|
1560
|
-
* }
|
|
1561
|
-
* },
|
|
1562
|
-
* {
|
|
1563
|
-
* "game_id": 2,
|
|
1564
|
-
* "away_team": {
|
|
1565
|
-
* "users": [
|
|
1566
|
-
* {
|
|
1567
|
-
* "id": 1,
|
|
1568
|
-
* "name": "Kiran"
|
|
1569
|
-
* }
|
|
1570
|
-
* ]
|
|
1571
|
-
* }
|
|
1572
|
-
* }
|
|
1573
|
-
* ],
|
|
1574
|
-
* "status": 200,
|
|
1575
|
-
* "statusText": "OK"
|
|
1576
|
-
* }
|
|
1577
|
-
*
|
|
1578
|
-
* ```
|
|
1579
|
-
*
|
|
1580
|
-
* @exampleDescription Filtering through referenced tables
|
|
1581
|
-
* If the filter on a referenced table's column is not satisfied, the referenced
|
|
1582
|
-
* table returns `[]` or `null` but the parent table is not filtered out.
|
|
1583
|
-
* If you want to filter out the parent table rows, use the `!inner` hint
|
|
1584
|
-
*
|
|
1585
|
-
* @example Filtering through referenced tables
|
|
1586
|
-
* ```ts
|
|
1587
|
-
* const { data, error } = await supabase
|
|
1588
|
-
* .from('instruments')
|
|
1589
|
-
* .select('name, orchestral_sections(*)')
|
|
1590
|
-
* .eq('orchestral_sections.name', 'percussion')
|
|
1591
|
-
* ```
|
|
1592
|
-
*
|
|
1593
|
-
* @exampleSql Filtering through referenced tables
|
|
1594
|
-
* ```sql
|
|
1595
|
-
* create table
|
|
1596
|
-
* orchestral_sections (id int8 primary key, name text);
|
|
1597
|
-
* create table
|
|
1598
|
-
* instruments (
|
|
1599
|
-
* id int8 primary key,
|
|
1600
|
-
* section_id int8 not null references orchestral_sections,
|
|
1601
|
-
* name text
|
|
1602
|
-
* );
|
|
1603
|
-
*
|
|
1604
|
-
* insert into
|
|
1605
|
-
* orchestral_sections (id, name)
|
|
1606
|
-
* values
|
|
1607
|
-
* (1, 'strings'),
|
|
1608
|
-
* (2, 'woodwinds');
|
|
1609
|
-
* insert into
|
|
1610
|
-
* instruments (id, section_id, name)
|
|
1611
|
-
* values
|
|
1612
|
-
* (1, 2, 'flute'),
|
|
1613
|
-
* (2, 1, 'violin');
|
|
1614
|
-
* ```
|
|
1615
|
-
*
|
|
1616
|
-
* @exampleResponse Filtering through referenced tables
|
|
1617
|
-
* ```json
|
|
1618
|
-
* {
|
|
1619
|
-
* "data": [
|
|
1620
|
-
* {
|
|
1621
|
-
* "name": "flute",
|
|
1622
|
-
* "orchestral_sections": null
|
|
1623
|
-
* },
|
|
1624
|
-
* {
|
|
1625
|
-
* "name": "violin",
|
|
1626
|
-
* "orchestral_sections": null
|
|
1627
|
-
* }
|
|
1628
|
-
* ],
|
|
1629
|
-
* "status": 200,
|
|
1630
|
-
* "statusText": "OK"
|
|
1631
|
-
* }
|
|
1632
|
-
* ```
|
|
1633
|
-
*
|
|
1634
|
-
* @exampleDescription Querying referenced table with count
|
|
1635
|
-
* You can get the number of rows in a related table by using the
|
|
1636
|
-
* **count** property.
|
|
1637
|
-
*
|
|
1638
|
-
* @example Querying referenced table with count
|
|
1639
|
-
* ```ts
|
|
1640
|
-
* const { data, error } = await supabase
|
|
1641
|
-
* .from('orchestral_sections')
|
|
1642
|
-
* .select(`*, instruments(count)`)
|
|
1643
|
-
* ```
|
|
1644
|
-
*
|
|
1645
|
-
* @exampleSql Querying referenced table with count
|
|
1646
|
-
* ```sql
|
|
1647
|
-
* create table orchestral_sections (
|
|
1648
|
-
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
1649
|
-
* "name" text
|
|
1650
|
-
* );
|
|
1651
|
-
*
|
|
1652
|
-
* create table characters (
|
|
1653
|
-
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
1654
|
-
* "name" text,
|
|
1655
|
-
* "section_id" "uuid" references public.orchestral_sections on delete cascade
|
|
1656
|
-
* );
|
|
1657
|
-
*
|
|
1658
|
-
* with section as (
|
|
1659
|
-
* insert into orchestral_sections (name)
|
|
1660
|
-
* values ('strings') returning id
|
|
1661
|
-
* )
|
|
1662
|
-
* insert into instruments (name, section_id) values
|
|
1663
|
-
* ('violin', (select id from section)),
|
|
1664
|
-
* ('viola', (select id from section)),
|
|
1665
|
-
* ('cello', (select id from section)),
|
|
1666
|
-
* ('double bass', (select id from section));
|
|
1667
|
-
* ```
|
|
1668
|
-
*
|
|
1669
|
-
* @exampleResponse Querying referenced table with count
|
|
1670
|
-
* ```json
|
|
1671
|
-
* [
|
|
1672
|
-
* {
|
|
1673
|
-
* "id": "693694e7-d993-4360-a6d7-6294e325d9b6",
|
|
1674
|
-
* "name": "strings",
|
|
1675
|
-
* "instruments": [
|
|
1676
|
-
* {
|
|
1677
|
-
* "count": 4
|
|
1678
|
-
* }
|
|
1679
|
-
* ]
|
|
1680
|
-
* }
|
|
1681
|
-
* ]
|
|
1682
|
-
* ```
|
|
1683
|
-
*
|
|
1684
|
-
* @exampleDescription Querying with count option
|
|
1685
|
-
* You can get the number of rows by using the
|
|
1686
|
-
* [count](/docs/reference/javascript/select#parameters) option.
|
|
1687
|
-
*
|
|
1688
|
-
* @example Querying with count option
|
|
1689
|
-
* ```ts
|
|
1690
|
-
* const { count, error } = await supabase
|
|
1691
|
-
* .from('characters')
|
|
1692
|
-
* .select('*', { count: 'exact', head: true })
|
|
1693
|
-
* ```
|
|
1694
|
-
*
|
|
1695
|
-
* @exampleSql Querying with count option
|
|
1696
|
-
* ```sql
|
|
1697
|
-
* create table
|
|
1698
|
-
* characters (id int8 primary key, name text);
|
|
1699
|
-
*
|
|
1700
|
-
* insert into
|
|
1701
|
-
* characters (id, name)
|
|
1702
|
-
* values
|
|
1703
|
-
* (1, 'Luke'),
|
|
1704
|
-
* (2, 'Leia'),
|
|
1705
|
-
* (3, 'Han');
|
|
1706
|
-
* ```
|
|
1707
|
-
*
|
|
1708
|
-
* @exampleResponse Querying with count option
|
|
1709
|
-
* ```json
|
|
1710
|
-
* {
|
|
1711
|
-
* "count": 3,
|
|
1712
|
-
* "status": 200,
|
|
1713
|
-
* "statusText": "OK"
|
|
1714
|
-
* }
|
|
1715
|
-
* ```
|
|
1716
|
-
*
|
|
1717
|
-
* @exampleDescription Querying JSON data
|
|
1718
|
-
* You can select and filter data inside of
|
|
1719
|
-
* [JSON](/docs/guides/database/json) columns. Postgres offers some
|
|
1720
|
-
* [operators](/docs/guides/database/json#query-the-jsonb-data) for
|
|
1721
|
-
* querying JSON data.
|
|
1722
|
-
*
|
|
1723
|
-
* @example Querying JSON data
|
|
1724
|
-
* ```ts
|
|
1725
|
-
* const { data, error } = await supabase
|
|
1726
|
-
* .from('users')
|
|
1727
|
-
* .select(`
|
|
1728
|
-
* id, name,
|
|
1729
|
-
* address->city
|
|
1730
|
-
* `)
|
|
1731
|
-
* ```
|
|
1732
|
-
*
|
|
1733
|
-
* @exampleSql Querying JSON data
|
|
1734
|
-
* ```sql
|
|
1735
|
-
* create table
|
|
1736
|
-
* users (
|
|
1737
|
-
* id int8 primary key,
|
|
1738
|
-
* name text,
|
|
1739
|
-
* address jsonb
|
|
1740
|
-
* );
|
|
1741
|
-
*
|
|
1742
|
-
* insert into
|
|
1743
|
-
* users (id, name, address)
|
|
1744
|
-
* values
|
|
1745
|
-
* (1, 'Frodo', '{"city":"Hobbiton"}');
|
|
1746
|
-
* ```
|
|
1747
|
-
*
|
|
1748
|
-
* @exampleResponse Querying JSON data
|
|
1749
|
-
* ```json
|
|
1750
|
-
* {
|
|
1751
|
-
* "data": [
|
|
1752
|
-
* {
|
|
1753
|
-
* "id": 1,
|
|
1754
|
-
* "name": "Frodo",
|
|
1755
|
-
* "city": "Hobbiton"
|
|
1756
|
-
* }
|
|
1757
|
-
* ],
|
|
1758
|
-
* "status": 200,
|
|
1759
|
-
* "statusText": "OK"
|
|
1760
|
-
* }
|
|
1761
|
-
* ```
|
|
1762
|
-
*
|
|
1763
|
-
* @exampleDescription Querying referenced table with inner join
|
|
1764
|
-
* If you don't want to return the referenced table contents, you can leave the parenthesis empty.
|
|
1765
|
-
* Like `.select('name, orchestral_sections!inner()')`.
|
|
1766
|
-
*
|
|
1767
|
-
* @example Querying referenced table with inner join
|
|
1768
|
-
* ```ts
|
|
1769
|
-
* const { data, error } = await supabase
|
|
1770
|
-
* .from('instruments')
|
|
1771
|
-
* .select('name, orchestral_sections!inner(name)')
|
|
1772
|
-
* .eq('orchestral_sections.name', 'woodwinds')
|
|
1773
|
-
* .limit(1)
|
|
1774
|
-
* ```
|
|
1775
|
-
*
|
|
1776
|
-
* @exampleSql Querying referenced table with inner join
|
|
1777
|
-
* ```sql
|
|
1778
|
-
* create table orchestral_sections (
|
|
1779
|
-
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
1780
|
-
* "name" text
|
|
1781
|
-
* );
|
|
1782
|
-
*
|
|
1783
|
-
* create table instruments (
|
|
1784
|
-
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
1785
|
-
* "name" text,
|
|
1786
|
-
* "section_id" "uuid" references public.orchestral_sections on delete cascade
|
|
1787
|
-
* );
|
|
1788
|
-
*
|
|
1789
|
-
* with section as (
|
|
1790
|
-
* insert into orchestral_sections (name)
|
|
1791
|
-
* values ('woodwinds') returning id
|
|
1792
|
-
* )
|
|
1793
|
-
* insert into instruments (name, section_id) values
|
|
1794
|
-
* ('flute', (select id from section)),
|
|
1795
|
-
* ('clarinet', (select id from section)),
|
|
1796
|
-
* ('bassoon', (select id from section)),
|
|
1797
|
-
* ('piccolo', (select id from section));
|
|
1798
|
-
* ```
|
|
1799
|
-
*
|
|
1800
|
-
* @exampleResponse Querying referenced table with inner join
|
|
1801
|
-
* ```json
|
|
1802
|
-
* {
|
|
1803
|
-
* "data": [
|
|
1804
|
-
* {
|
|
1805
|
-
* "name": "flute",
|
|
1806
|
-
* "orchestral_sections": {"name": "woodwinds"}
|
|
1807
|
-
* }
|
|
1808
|
-
* ],
|
|
1809
|
-
* "status": 200,
|
|
1810
|
-
* "statusText": "OK"
|
|
1811
|
-
* }
|
|
1812
|
-
* ```
|
|
1813
|
-
*
|
|
1814
|
-
* @exampleDescription Switching schemas per query
|
|
1815
|
-
* In addition to setting the schema during initialization, you can also switch schemas on a per-query basis.
|
|
1816
|
-
* Make sure you've set up your [database privileges and API settings](/docs/guides/api/using-custom-schemas).
|
|
1817
|
-
*
|
|
1818
|
-
* @example Switching schemas per query
|
|
1819
|
-
* ```ts
|
|
1820
|
-
* const { data, error } = await supabase
|
|
1821
|
-
* .schema('myschema')
|
|
1822
|
-
* .from('mytable')
|
|
1823
|
-
* .select()
|
|
1824
|
-
* ```
|
|
1825
|
-
*
|
|
1826
|
-
* @exampleSql Switching schemas per query
|
|
1827
|
-
* ```sql
|
|
1828
|
-
* create schema myschema;
|
|
1829
|
-
*
|
|
1830
|
-
* create table myschema.mytable (
|
|
1831
|
-
* id uuid primary key default gen_random_uuid(),
|
|
1832
|
-
* data text
|
|
1833
|
-
* );
|
|
1834
|
-
*
|
|
1835
|
-
* insert into myschema.mytable (data) values ('mydata');
|
|
1836
|
-
* ```
|
|
1837
|
-
*
|
|
1838
|
-
* @exampleResponse Switching schemas per query
|
|
1839
|
-
* ```json
|
|
1840
|
-
* {
|
|
1841
|
-
* "data": [
|
|
1842
|
-
* {
|
|
1843
|
-
* "id": "4162e008-27b0-4c0f-82dc-ccaeee9a624d",
|
|
1844
|
-
* "data": "mydata"
|
|
1845
|
-
* }
|
|
1846
|
-
* ],
|
|
1847
|
-
* "status": 200,
|
|
1848
|
-
* "statusText": "OK"
|
|
1849
|
-
* }
|
|
1850
|
-
* ```
|
|
1851
1097
|
*/
|
|
1852
1098
|
select(columns, options) {
|
|
1853
1099
|
const { head: head2 = false, count } = options !== null && options !== void 0 ? options : {};
|
|
@@ -1895,91 +1141,6 @@ var PostgrestQueryBuilder = class {
|
|
|
1895
1141
|
* @param options.defaultToNull - Make missing fields default to `null`.
|
|
1896
1142
|
* Otherwise, use the default value for the column. Only applies for bulk
|
|
1897
1143
|
* inserts.
|
|
1898
|
-
*
|
|
1899
|
-
* @category Database
|
|
1900
|
-
*
|
|
1901
|
-
* @example Create a record
|
|
1902
|
-
* ```ts
|
|
1903
|
-
* const { error } = await supabase
|
|
1904
|
-
* .from('countries')
|
|
1905
|
-
* .insert({ id: 1, name: 'Mordor' })
|
|
1906
|
-
* ```
|
|
1907
|
-
*
|
|
1908
|
-
* @exampleSql Create a record
|
|
1909
|
-
* ```sql
|
|
1910
|
-
* create table
|
|
1911
|
-
* countries (id int8 primary key, name text);
|
|
1912
|
-
* ```
|
|
1913
|
-
*
|
|
1914
|
-
* @exampleResponse Create a record
|
|
1915
|
-
* ```json
|
|
1916
|
-
* {
|
|
1917
|
-
* "status": 201,
|
|
1918
|
-
* "statusText": "Created"
|
|
1919
|
-
* }
|
|
1920
|
-
* ```
|
|
1921
|
-
*
|
|
1922
|
-
* @example Create a record and return it
|
|
1923
|
-
* ```ts
|
|
1924
|
-
* const { data, error } = await supabase
|
|
1925
|
-
* .from('countries')
|
|
1926
|
-
* .insert({ id: 1, name: 'Mordor' })
|
|
1927
|
-
* .select()
|
|
1928
|
-
* ```
|
|
1929
|
-
*
|
|
1930
|
-
* @exampleSql Create a record and return it
|
|
1931
|
-
* ```sql
|
|
1932
|
-
* create table
|
|
1933
|
-
* countries (id int8 primary key, name text);
|
|
1934
|
-
* ```
|
|
1935
|
-
*
|
|
1936
|
-
* @exampleResponse Create a record and return it
|
|
1937
|
-
* ```json
|
|
1938
|
-
* {
|
|
1939
|
-
* "data": [
|
|
1940
|
-
* {
|
|
1941
|
-
* "id": 1,
|
|
1942
|
-
* "name": "Mordor"
|
|
1943
|
-
* }
|
|
1944
|
-
* ],
|
|
1945
|
-
* "status": 201,
|
|
1946
|
-
* "statusText": "Created"
|
|
1947
|
-
* }
|
|
1948
|
-
* ```
|
|
1949
|
-
*
|
|
1950
|
-
* @exampleDescription Bulk create
|
|
1951
|
-
* A bulk create operation is handled in a single transaction.
|
|
1952
|
-
* If any of the inserts fail, none of the rows are inserted.
|
|
1953
|
-
*
|
|
1954
|
-
* @example Bulk create
|
|
1955
|
-
* ```ts
|
|
1956
|
-
* const { error } = await supabase
|
|
1957
|
-
* .from('countries')
|
|
1958
|
-
* .insert([
|
|
1959
|
-
* { id: 1, name: 'Mordor' },
|
|
1960
|
-
* { id: 1, name: 'The Shire' },
|
|
1961
|
-
* ])
|
|
1962
|
-
* ```
|
|
1963
|
-
*
|
|
1964
|
-
* @exampleSql Bulk create
|
|
1965
|
-
* ```sql
|
|
1966
|
-
* create table
|
|
1967
|
-
* countries (id int8 primary key, name text);
|
|
1968
|
-
* ```
|
|
1969
|
-
*
|
|
1970
|
-
* @exampleResponse Bulk create
|
|
1971
|
-
* ```json
|
|
1972
|
-
* {
|
|
1973
|
-
* "error": {
|
|
1974
|
-
* "code": "23505",
|
|
1975
|
-
* "details": "Key (id)=(1) already exists.",
|
|
1976
|
-
* "hint": null,
|
|
1977
|
-
* "message": "duplicate key value violates unique constraint \"countries_pkey\""
|
|
1978
|
-
* },
|
|
1979
|
-
* "status": 409,
|
|
1980
|
-
* "statusText": "Conflict"
|
|
1981
|
-
* }
|
|
1982
|
-
* ```
|
|
1983
1144
|
*/
|
|
1984
1145
|
insert(values, { count, defaultToNull = true } = {}) {
|
|
1985
1146
|
var _this$fetch;
|
|
@@ -2088,129 +1249,6 @@ var PostgrestQueryBuilder = class {
|
|
|
2088
1249
|
* // error: null
|
|
2089
1250
|
* // }
|
|
2090
1251
|
* ```
|
|
2091
|
-
*
|
|
2092
|
-
* @category Database
|
|
2093
|
-
*
|
|
2094
|
-
* @remarks
|
|
2095
|
-
* - Primary keys must be included in `values` to use upsert.
|
|
2096
|
-
*
|
|
2097
|
-
* @example Upsert your data
|
|
2098
|
-
* ```ts
|
|
2099
|
-
* const { data, error } = await supabase
|
|
2100
|
-
* .from('instruments')
|
|
2101
|
-
* .upsert({ id: 1, name: 'piano' })
|
|
2102
|
-
* .select()
|
|
2103
|
-
* ```
|
|
2104
|
-
*
|
|
2105
|
-
* @exampleSql Upsert your data
|
|
2106
|
-
* ```sql
|
|
2107
|
-
* create table
|
|
2108
|
-
* instruments (id int8 primary key, name text);
|
|
2109
|
-
*
|
|
2110
|
-
* insert into
|
|
2111
|
-
* instruments (id, name)
|
|
2112
|
-
* values
|
|
2113
|
-
* (1, 'harpsichord');
|
|
2114
|
-
* ```
|
|
2115
|
-
*
|
|
2116
|
-
* @exampleResponse Upsert your data
|
|
2117
|
-
* ```json
|
|
2118
|
-
* {
|
|
2119
|
-
* "data": [
|
|
2120
|
-
* {
|
|
2121
|
-
* "id": 1,
|
|
2122
|
-
* "name": "piano"
|
|
2123
|
-
* }
|
|
2124
|
-
* ],
|
|
2125
|
-
* "status": 201,
|
|
2126
|
-
* "statusText": "Created"
|
|
2127
|
-
* }
|
|
2128
|
-
* ```
|
|
2129
|
-
*
|
|
2130
|
-
* @example Bulk Upsert your data
|
|
2131
|
-
* ```ts
|
|
2132
|
-
* const { data, error } = await supabase
|
|
2133
|
-
* .from('instruments')
|
|
2134
|
-
* .upsert([
|
|
2135
|
-
* { id: 1, name: 'piano' },
|
|
2136
|
-
* { id: 2, name: 'harp' },
|
|
2137
|
-
* ])
|
|
2138
|
-
* .select()
|
|
2139
|
-
* ```
|
|
2140
|
-
*
|
|
2141
|
-
* @exampleSql Bulk Upsert your data
|
|
2142
|
-
* ```sql
|
|
2143
|
-
* create table
|
|
2144
|
-
* instruments (id int8 primary key, name text);
|
|
2145
|
-
*
|
|
2146
|
-
* insert into
|
|
2147
|
-
* instruments (id, name)
|
|
2148
|
-
* values
|
|
2149
|
-
* (1, 'harpsichord');
|
|
2150
|
-
* ```
|
|
2151
|
-
*
|
|
2152
|
-
* @exampleResponse Bulk Upsert your data
|
|
2153
|
-
* ```json
|
|
2154
|
-
* {
|
|
2155
|
-
* "data": [
|
|
2156
|
-
* {
|
|
2157
|
-
* "id": 1,
|
|
2158
|
-
* "name": "piano"
|
|
2159
|
-
* },
|
|
2160
|
-
* {
|
|
2161
|
-
* "id": 2,
|
|
2162
|
-
* "name": "harp"
|
|
2163
|
-
* }
|
|
2164
|
-
* ],
|
|
2165
|
-
* "status": 201,
|
|
2166
|
-
* "statusText": "Created"
|
|
2167
|
-
* }
|
|
2168
|
-
* ```
|
|
2169
|
-
*
|
|
2170
|
-
* @exampleDescription Upserting into tables with constraints
|
|
2171
|
-
* In the following query, `upsert()` implicitly uses the `id`
|
|
2172
|
-
* (primary key) column to determine conflicts. If there is no existing
|
|
2173
|
-
* row with the same `id`, `upsert()` inserts a new row, which
|
|
2174
|
-
* will fail in this case as there is already a row with `handle` `"saoirse"`.
|
|
2175
|
-
* Using the `onConflict` option, you can instruct `upsert()` to use
|
|
2176
|
-
* another column with a unique constraint to determine conflicts.
|
|
2177
|
-
*
|
|
2178
|
-
* @example Upserting into tables with constraints
|
|
2179
|
-
* ```ts
|
|
2180
|
-
* const { data, error } = await supabase
|
|
2181
|
-
* .from('users')
|
|
2182
|
-
* .upsert({ id: 42, handle: 'saoirse', display_name: 'Saoirse' })
|
|
2183
|
-
* .select()
|
|
2184
|
-
* ```
|
|
2185
|
-
*
|
|
2186
|
-
* @exampleSql Upserting into tables with constraints
|
|
2187
|
-
* ```sql
|
|
2188
|
-
* create table
|
|
2189
|
-
* users (
|
|
2190
|
-
* id int8 generated by default as identity primary key,
|
|
2191
|
-
* handle text not null unique,
|
|
2192
|
-
* display_name text
|
|
2193
|
-
* );
|
|
2194
|
-
*
|
|
2195
|
-
* insert into
|
|
2196
|
-
* users (id, handle, display_name)
|
|
2197
|
-
* values
|
|
2198
|
-
* (1, 'saoirse', null);
|
|
2199
|
-
* ```
|
|
2200
|
-
*
|
|
2201
|
-
* @exampleResponse Upserting into tables with constraints
|
|
2202
|
-
* ```json
|
|
2203
|
-
* {
|
|
2204
|
-
* "error": {
|
|
2205
|
-
* "code": "23505",
|
|
2206
|
-
* "details": "Key (handle)=(saoirse) already exists.",
|
|
2207
|
-
* "hint": null,
|
|
2208
|
-
* "message": "duplicate key value violates unique constraint \"users_handle_key\""
|
|
2209
|
-
* },
|
|
2210
|
-
* "status": 409,
|
|
2211
|
-
* "statusText": "Conflict"
|
|
2212
|
-
* }
|
|
2213
|
-
* ```
|
|
2214
1252
|
*/
|
|
2215
1253
|
upsert(values, { onConflict, ignoreDuplicates = false, count, defaultToNull = true } = {}) {
|
|
2216
1254
|
var _this$fetch2;
|
|
@@ -2257,124 +1295,6 @@ var PostgrestQueryBuilder = class {
|
|
|
2257
1295
|
*
|
|
2258
1296
|
* `"estimated"`: Uses exact count for low numbers and planned count for high
|
|
2259
1297
|
* numbers.
|
|
2260
|
-
*
|
|
2261
|
-
* @category Database
|
|
2262
|
-
*
|
|
2263
|
-
* @remarks
|
|
2264
|
-
* - `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update.
|
|
2265
|
-
*
|
|
2266
|
-
* @example Updating your data
|
|
2267
|
-
* ```ts
|
|
2268
|
-
* const { error } = await supabase
|
|
2269
|
-
* .from('instruments')
|
|
2270
|
-
* .update({ name: 'piano' })
|
|
2271
|
-
* .eq('id', 1)
|
|
2272
|
-
* ```
|
|
2273
|
-
*
|
|
2274
|
-
* @exampleSql Updating your data
|
|
2275
|
-
* ```sql
|
|
2276
|
-
* create table
|
|
2277
|
-
* instruments (id int8 primary key, name text);
|
|
2278
|
-
*
|
|
2279
|
-
* insert into
|
|
2280
|
-
* instruments (id, name)
|
|
2281
|
-
* values
|
|
2282
|
-
* (1, 'harpsichord');
|
|
2283
|
-
* ```
|
|
2284
|
-
*
|
|
2285
|
-
* @exampleResponse Updating your data
|
|
2286
|
-
* ```json
|
|
2287
|
-
* {
|
|
2288
|
-
* "status": 204,
|
|
2289
|
-
* "statusText": "No Content"
|
|
2290
|
-
* }
|
|
2291
|
-
* ```
|
|
2292
|
-
*
|
|
2293
|
-
* @example Update a record and return it
|
|
2294
|
-
* ```ts
|
|
2295
|
-
* const { data, error } = await supabase
|
|
2296
|
-
* .from('instruments')
|
|
2297
|
-
* .update({ name: 'piano' })
|
|
2298
|
-
* .eq('id', 1)
|
|
2299
|
-
* .select()
|
|
2300
|
-
* ```
|
|
2301
|
-
*
|
|
2302
|
-
* @exampleSql Update a record and return it
|
|
2303
|
-
* ```sql
|
|
2304
|
-
* create table
|
|
2305
|
-
* instruments (id int8 primary key, name text);
|
|
2306
|
-
*
|
|
2307
|
-
* insert into
|
|
2308
|
-
* instruments (id, name)
|
|
2309
|
-
* values
|
|
2310
|
-
* (1, 'harpsichord');
|
|
2311
|
-
* ```
|
|
2312
|
-
*
|
|
2313
|
-
* @exampleResponse Update a record and return it
|
|
2314
|
-
* ```json
|
|
2315
|
-
* {
|
|
2316
|
-
* "data": [
|
|
2317
|
-
* {
|
|
2318
|
-
* "id": 1,
|
|
2319
|
-
* "name": "piano"
|
|
2320
|
-
* }
|
|
2321
|
-
* ],
|
|
2322
|
-
* "status": 200,
|
|
2323
|
-
* "statusText": "OK"
|
|
2324
|
-
* }
|
|
2325
|
-
* ```
|
|
2326
|
-
*
|
|
2327
|
-
* @exampleDescription Updating JSON data
|
|
2328
|
-
* Postgres offers some
|
|
2329
|
-
* [operators](/docs/guides/database/json#query-the-jsonb-data) for
|
|
2330
|
-
* working with JSON data. Currently, it is only possible to update the entire JSON document.
|
|
2331
|
-
*
|
|
2332
|
-
* @example Updating JSON data
|
|
2333
|
-
* ```ts
|
|
2334
|
-
* const { data, error } = await supabase
|
|
2335
|
-
* .from('users')
|
|
2336
|
-
* .update({
|
|
2337
|
-
* address: {
|
|
2338
|
-
* street: 'Melrose Place',
|
|
2339
|
-
* postcode: 90210
|
|
2340
|
-
* }
|
|
2341
|
-
* })
|
|
2342
|
-
* .eq('address->postcode', 90210)
|
|
2343
|
-
* .select()
|
|
2344
|
-
* ```
|
|
2345
|
-
*
|
|
2346
|
-
* @exampleSql Updating JSON data
|
|
2347
|
-
* ```sql
|
|
2348
|
-
* create table
|
|
2349
|
-
* users (
|
|
2350
|
-
* id int8 primary key,
|
|
2351
|
-
* name text,
|
|
2352
|
-
* address jsonb
|
|
2353
|
-
* );
|
|
2354
|
-
*
|
|
2355
|
-
* insert into
|
|
2356
|
-
* users (id, name, address)
|
|
2357
|
-
* values
|
|
2358
|
-
* (1, 'Michael', '{ "postcode": 90210 }');
|
|
2359
|
-
* ```
|
|
2360
|
-
*
|
|
2361
|
-
* @exampleResponse Updating JSON data
|
|
2362
|
-
* ```json
|
|
2363
|
-
* {
|
|
2364
|
-
* "data": [
|
|
2365
|
-
* {
|
|
2366
|
-
* "id": 1,
|
|
2367
|
-
* "name": "Michael",
|
|
2368
|
-
* "address": {
|
|
2369
|
-
* "street": "Melrose Place",
|
|
2370
|
-
* "postcode": 90210
|
|
2371
|
-
* }
|
|
2372
|
-
* }
|
|
2373
|
-
* ],
|
|
2374
|
-
* "status": 200,
|
|
2375
|
-
* "statusText": "OK"
|
|
2376
|
-
* }
|
|
2377
|
-
* ```
|
|
2378
1298
|
*/
|
|
2379
1299
|
update(values, { count } = {}) {
|
|
2380
1300
|
var _this$fetch3;
|
|
@@ -2622,7 +1542,7 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
2622
1542
|
}
|
|
2623
1543
|
};
|
|
2624
1544
|
|
|
2625
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1545
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.94.1/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
|
|
2626
1546
|
var WebSocketFactory = class {
|
|
2627
1547
|
/**
|
|
2628
1548
|
* Static-only utility – prevent instantiation.
|
|
@@ -2738,10 +1658,10 @@ Suggested solution: ${env.workaround}`;
|
|
|
2738
1658
|
};
|
|
2739
1659
|
var websocket_factory_default = WebSocketFactory;
|
|
2740
1660
|
|
|
2741
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
2742
|
-
var version = "2.
|
|
1661
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.94.1/node_modules/@supabase/realtime-js/dist/module/lib/version.js
|
|
1662
|
+
var version = "2.94.1";
|
|
2743
1663
|
|
|
2744
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1664
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.94.1/node_modules/@supabase/realtime-js/dist/module/lib/constants.js
|
|
2745
1665
|
var DEFAULT_VERSION = `realtime-js/${version}`;
|
|
2746
1666
|
var VSN_1_0_0 = "1.0.0";
|
|
2747
1667
|
var VSN_2_0_0 = "2.0.0";
|
|
@@ -2785,7 +1705,7 @@ var CONNECTION_STATE;
|
|
|
2785
1705
|
CONNECTION_STATE2["Closed"] = "closed";
|
|
2786
1706
|
})(CONNECTION_STATE || (CONNECTION_STATE = {}));
|
|
2787
1707
|
|
|
2788
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1708
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.94.1/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
|
|
2789
1709
|
var Serializer = class {
|
|
2790
1710
|
constructor(allowedMetadataKeys) {
|
|
2791
1711
|
this.HEADER_LENGTH = 1;
|
|
@@ -2925,7 +1845,7 @@ var Serializer = class {
|
|
|
2925
1845
|
}
|
|
2926
1846
|
};
|
|
2927
1847
|
|
|
2928
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1848
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.94.1/node_modules/@supabase/realtime-js/dist/module/lib/timer.js
|
|
2929
1849
|
var Timer = class {
|
|
2930
1850
|
constructor(callback, timerCalc) {
|
|
2931
1851
|
this.callback = callback;
|
|
@@ -2950,7 +1870,7 @@ var Timer = class {
|
|
|
2950
1870
|
}
|
|
2951
1871
|
};
|
|
2952
1872
|
|
|
2953
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
1873
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.94.1/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
|
|
2954
1874
|
var PostgresTypes;
|
|
2955
1875
|
(function(PostgresTypes2) {
|
|
2956
1876
|
PostgresTypes2["abstime"] = "abstime";
|
|
@@ -3113,7 +2033,7 @@ var httpEndpointURL = (socketUrl) => {
|
|
|
3113
2033
|
return wsUrl.href;
|
|
3114
2034
|
};
|
|
3115
2035
|
|
|
3116
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
2036
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.94.1/node_modules/@supabase/realtime-js/dist/module/lib/push.js
|
|
3117
2037
|
var Push = class {
|
|
3118
2038
|
/**
|
|
3119
2039
|
* Initializes the Push
|
|
@@ -3212,7 +2132,7 @@ var Push = class {
|
|
|
3212
2132
|
}
|
|
3213
2133
|
};
|
|
3214
2134
|
|
|
3215
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
2135
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.94.1/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
|
|
3216
2136
|
var REALTIME_PRESENCE_LISTEN_EVENTS;
|
|
3217
2137
|
(function(REALTIME_PRESENCE_LISTEN_EVENTS2) {
|
|
3218
2138
|
REALTIME_PRESENCE_LISTEN_EVENTS2["SYNC"] = "sync";
|
|
@@ -3444,7 +2364,7 @@ var RealtimePresence = class _RealtimePresence {
|
|
|
3444
2364
|
}
|
|
3445
2365
|
};
|
|
3446
2366
|
|
|
3447
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
2367
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.94.1/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
|
|
3448
2368
|
var REALTIME_POSTGRES_CHANGES_LISTEN_EVENT;
|
|
3449
2369
|
(function(REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2) {
|
|
3450
2370
|
REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2["ALL"] = "*";
|
|
@@ -4041,7 +2961,7 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
4041
2961
|
}
|
|
4042
2962
|
};
|
|
4043
2963
|
|
|
4044
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
2964
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.94.1/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
|
|
4045
2965
|
var noop2 = () => {
|
|
4046
2966
|
};
|
|
4047
2967
|
var CONNECTION_TIMEOUTS = {
|
|
@@ -4545,18 +3465,6 @@ Option 2: Install and provide the "ws" package:
|
|
|
4545
3465
|
this.log("transport", `connected to ${this.endpointURL()}`);
|
|
4546
3466
|
const authPromise = this._authPromise || (this.accessToken && !this.accessTokenValue ? this.setAuth() : Promise.resolve());
|
|
4547
3467
|
authPromise.then(() => {
|
|
4548
|
-
if (this.accessTokenValue) {
|
|
4549
|
-
this.channels.forEach((channel) => {
|
|
4550
|
-
channel.updateJoinPayload({ access_token: this.accessTokenValue });
|
|
4551
|
-
});
|
|
4552
|
-
this.sendBuffer = [];
|
|
4553
|
-
this.channels.forEach((channel) => {
|
|
4554
|
-
if (channel._isJoining()) {
|
|
4555
|
-
channel.joinPush.sent = false;
|
|
4556
|
-
channel.joinPush.send();
|
|
4557
|
-
}
|
|
4558
|
-
});
|
|
4559
|
-
}
|
|
4560
3468
|
this.flushSendBuffer();
|
|
4561
3469
|
}).catch((e) => {
|
|
4562
3470
|
this.log("error", "error waiting for auth on connect", e);
|
|
@@ -5344,7 +4252,7 @@ var IcebergRestCatalog = class {
|
|
|
5344
4252
|
}
|
|
5345
4253
|
};
|
|
5346
4254
|
|
|
5347
|
-
// ../../node_modules/.pnpm/@supabase+storage-js@2.
|
|
4255
|
+
// ../../node_modules/.pnpm/@supabase+storage-js@2.94.1/node_modules/@supabase/storage-js/dist/index.mjs
|
|
5348
4256
|
var StorageError = class extends Error {
|
|
5349
4257
|
constructor(message, namespace = "storage", status, statusCode) {
|
|
5350
4258
|
super(message);
|
|
@@ -5463,7 +4371,7 @@ var _getErrorMessage = (err) => {
|
|
|
5463
4371
|
return err.msg || err.message || err.error_description || (typeof err.error === "string" ? err.error : (_err$error = err.error) === null || _err$error === void 0 ? void 0 : _err$error.message) || JSON.stringify(err);
|
|
5464
4372
|
};
|
|
5465
4373
|
var handleError = async (error, reject, options, namespace) => {
|
|
5466
|
-
if (error && typeof error === "object" && "status" in error && "ok" in error && typeof error.status === "number") {
|
|
4374
|
+
if (error && typeof error === "object" && "status" in error && "ok" in error && typeof error.status === "number" && !(options === null || options === void 0 ? void 0 : options.noResolveJson)) {
|
|
5467
4375
|
const responseError = error;
|
|
5468
4376
|
const status = responseError.status || 500;
|
|
5469
4377
|
if (typeof responseError.json === "function") responseError.json().then((err) => {
|
|
@@ -5559,18 +4467,6 @@ var BaseApiClient = class {
|
|
|
5559
4467
|
return this;
|
|
5560
4468
|
}
|
|
5561
4469
|
/**
|
|
5562
|
-
* Set an HTTP header for the request.
|
|
5563
|
-
* Creates a shallow copy of headers to avoid mutating shared state.
|
|
5564
|
-
*
|
|
5565
|
-
* @param name - Header name
|
|
5566
|
-
* @param value - Header value
|
|
5567
|
-
* @returns this - For method chaining
|
|
5568
|
-
*/
|
|
5569
|
-
setHeader(name, value) {
|
|
5570
|
-
this.headers = _objectSpread22(_objectSpread22({}, this.headers), {}, { [name]: value });
|
|
5571
|
-
return this;
|
|
5572
|
-
}
|
|
5573
|
-
/**
|
|
5574
4470
|
* Handles API operation with standardized error handling
|
|
5575
4471
|
* Eliminates repetitive try-catch blocks across all API methods
|
|
5576
4472
|
*
|
|
@@ -6071,8 +4967,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
6071
4967
|
let _path = _this8._getFinalPath(path);
|
|
6072
4968
|
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 });
|
|
6073
4969
|
const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
|
|
6074
|
-
|
|
6075
|
-
return { signedUrl: encodeURI(`${_this8.url}${returnedPath}${downloadQueryParam}`) };
|
|
4970
|
+
return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${downloadQueryParam}`) };
|
|
6076
4971
|
});
|
|
6077
4972
|
}
|
|
6078
4973
|
/**
|
|
@@ -6130,7 +5025,6 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
6130
5025
|
* @category File Buckets
|
|
6131
5026
|
* @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
|
|
6132
5027
|
* @param options.transform Transform the asset before serving it to the client.
|
|
6133
|
-
* @param parameters Additional fetch parameters like signal for cancellation. Supports standard fetch options including cache control.
|
|
6134
5028
|
* @returns BlobDownloadBuilder instance for downloading the file
|
|
6135
5029
|
*
|
|
6136
5030
|
* @example Download file
|
|
@@ -6162,27 +5056,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
6162
5056
|
* }
|
|
6163
5057
|
* })
|
|
6164
5058
|
* ```
|
|
6165
|
-
*
|
|
6166
|
-
* @example Download with cache control (useful in Edge Functions)
|
|
6167
|
-
* ```js
|
|
6168
|
-
* const { data, error } = await supabase
|
|
6169
|
-
* .storage
|
|
6170
|
-
* .from('avatars')
|
|
6171
|
-
* .download('folder/avatar1.png', {}, { cache: 'no-store' })
|
|
6172
|
-
* ```
|
|
6173
|
-
*
|
|
6174
|
-
* @example Download with abort signal
|
|
6175
|
-
* ```js
|
|
6176
|
-
* const controller = new AbortController()
|
|
6177
|
-
* setTimeout(() => controller.abort(), 5000)
|
|
6178
|
-
*
|
|
6179
|
-
* const { data, error } = await supabase
|
|
6180
|
-
* .storage
|
|
6181
|
-
* .from('avatars')
|
|
6182
|
-
* .download('folder/avatar1.png', {}, { signal: controller.signal })
|
|
6183
|
-
* ```
|
|
6184
5059
|
*/
|
|
6185
|
-
download(path, options
|
|
5060
|
+
download(path, options) {
|
|
6186
5061
|
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) !== "undefined" ? "render/image/authenticated" : "object";
|
|
6187
5062
|
const transformationQuery = this.transformOptsToQueryString((options === null || options === void 0 ? void 0 : options.transform) || {});
|
|
6188
5063
|
const queryString = transformationQuery ? `?${transformationQuery}` : "";
|
|
@@ -6190,15 +5065,12 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
6190
5065
|
const downloadFn = () => get(this.fetch, `${this.url}/${renderPath}/${_path}${queryString}`, {
|
|
6191
5066
|
headers: this.headers,
|
|
6192
5067
|
noResolveJson: true
|
|
6193
|
-
}
|
|
5068
|
+
});
|
|
6194
5069
|
return new BlobDownloadBuilder(downloadFn, this.shouldThrowOnError);
|
|
6195
5070
|
}
|
|
6196
5071
|
/**
|
|
6197
5072
|
* Retrieves the details of an existing file.
|
|
6198
5073
|
*
|
|
6199
|
-
* Returns detailed file metadata including size, content type, and timestamps.
|
|
6200
|
-
* Note: The API returns `last_modified` field, not `updated_at`.
|
|
6201
|
-
*
|
|
6202
5074
|
* @category File Buckets
|
|
6203
5075
|
* @param path The file path, including the file name. For example `folder/image.png`.
|
|
6204
5076
|
* @returns Promise with response containing file metadata or error
|
|
@@ -6209,11 +5081,6 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
6209
5081
|
* .storage
|
|
6210
5082
|
* .from('avatars')
|
|
6211
5083
|
* .info('folder/avatar1.png')
|
|
6212
|
-
*
|
|
6213
|
-
* if (data) {
|
|
6214
|
-
* console.log('Last modified:', data.lastModified)
|
|
6215
|
-
* console.log('Size:', data.size)
|
|
6216
|
-
* }
|
|
6217
5084
|
* ```
|
|
6218
5085
|
*/
|
|
6219
5086
|
async info(path) {
|
|
@@ -6249,10 +5116,9 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
6249
5116
|
};
|
|
6250
5117
|
} catch (error) {
|
|
6251
5118
|
if (_this11.shouldThrowOnError) throw error;
|
|
6252
|
-
if (isStorageError(error)) {
|
|
6253
|
-
|
|
6254
|
-
|
|
6255
|
-
if (status !== void 0 && [400, 404].includes(status)) return {
|
|
5119
|
+
if (isStorageError(error) && error instanceof StorageUnknownError) {
|
|
5120
|
+
const originalError = error.originalError;
|
|
5121
|
+
if ([400, 404].includes(originalError === null || originalError === void 0 ? void 0 : originalError.status)) return {
|
|
6256
5122
|
data: false,
|
|
6257
5123
|
error
|
|
6258
5124
|
};
|
|
@@ -6325,9 +5191,6 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
6325
5191
|
/**
|
|
6326
5192
|
* Deletes files within the same bucket
|
|
6327
5193
|
*
|
|
6328
|
-
* Returns an array of FileObject entries for the deleted files. Note that deprecated
|
|
6329
|
-
* fields like `bucket_id` may or may not be present in the response - do not rely on them.
|
|
6330
|
-
*
|
|
6331
5194
|
* @category File Buckets
|
|
6332
5195
|
* @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].
|
|
6333
5196
|
* @returns Promise with response containing array of deleted file objects or error
|
|
@@ -6366,16 +5229,11 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
6366
5229
|
/**
|
|
6367
5230
|
* Lists all the files and folders within a path of the bucket.
|
|
6368
5231
|
*
|
|
6369
|
-
* **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`,
|
|
6370
|
-
* `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated.
|
|
6371
|
-
* Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned
|
|
6372
|
-
* by this method.
|
|
6373
|
-
*
|
|
6374
5232
|
* @category File Buckets
|
|
6375
5233
|
* @param path The folder path.
|
|
6376
5234
|
* @param options Search options including limit (defaults to 100), offset, sortBy, and search
|
|
6377
5235
|
* @param parameters Optional fetch parameters including signal for cancellation
|
|
6378
|
-
* @returns Promise with response containing array of files
|
|
5236
|
+
* @returns Promise with response containing array of files or error
|
|
6379
5237
|
*
|
|
6380
5238
|
* @example List files in a bucket
|
|
6381
5239
|
* ```js
|
|
@@ -6387,20 +5245,9 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
6387
5245
|
* offset: 0,
|
|
6388
5246
|
* sortBy: { column: 'name', order: 'asc' },
|
|
6389
5247
|
* })
|
|
6390
|
-
*
|
|
6391
|
-
* // Handle files vs folders
|
|
6392
|
-
* data?.forEach(item => {
|
|
6393
|
-
* if (item.id !== null) {
|
|
6394
|
-
* // It's a file
|
|
6395
|
-
* console.log('File:', item.name, 'Size:', item.metadata?.size)
|
|
6396
|
-
* } else {
|
|
6397
|
-
* // It's a folder
|
|
6398
|
-
* console.log('Folder:', item.name)
|
|
6399
|
-
* }
|
|
6400
|
-
* })
|
|
6401
5248
|
* ```
|
|
6402
5249
|
*
|
|
6403
|
-
* Response
|
|
5250
|
+
* Response:
|
|
6404
5251
|
* ```json
|
|
6405
5252
|
* {
|
|
6406
5253
|
* "data": [
|
|
@@ -6445,51 +5292,12 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
6445
5292
|
return await post(_this13.fetch, `${_this13.url}/object/list/${_this13.bucketId}`, body, { headers: _this13.headers }, parameters);
|
|
6446
5293
|
});
|
|
6447
5294
|
}
|
|
6448
|
-
/**
|
|
6449
|
-
*
|
|
6450
|
-
*
|
|
6451
|
-
*
|
|
6452
|
-
*
|
|
6453
|
-
*
|
|
6454
|
-
*
|
|
6455
|
-
* @experimental this method signature might change in the future
|
|
6456
|
-
*
|
|
6457
|
-
* @category File Buckets
|
|
6458
|
-
* @param options Search options including prefix, cursor for pagination, limit, with_delimiter
|
|
6459
|
-
* @param parameters Optional fetch parameters including signal for cancellation
|
|
6460
|
-
* @returns Promise with response containing folders/objects arrays with pagination info or error
|
|
6461
|
-
*
|
|
6462
|
-
* @example List files with pagination
|
|
6463
|
-
* ```js
|
|
6464
|
-
* const { data, error } = await supabase
|
|
6465
|
-
* .storage
|
|
6466
|
-
* .from('avatars')
|
|
6467
|
-
* .listV2({
|
|
6468
|
-
* prefix: 'folder/',
|
|
6469
|
-
* limit: 100,
|
|
6470
|
-
* })
|
|
6471
|
-
*
|
|
6472
|
-
* // Handle pagination
|
|
6473
|
-
* if (data?.hasNext) {
|
|
6474
|
-
* const nextPage = await supabase
|
|
6475
|
-
* .storage
|
|
6476
|
-
* .from('avatars')
|
|
6477
|
-
* .listV2({
|
|
6478
|
-
* prefix: 'folder/',
|
|
6479
|
-
* cursor: data.nextCursor,
|
|
6480
|
-
* })
|
|
6481
|
-
* }
|
|
6482
|
-
*
|
|
6483
|
-
* // Handle files vs folders
|
|
6484
|
-
* data?.objects.forEach(file => {
|
|
6485
|
-
* if (file.id !== null) {
|
|
6486
|
-
* console.log('File:', file.name, 'Size:', file.metadata?.size)
|
|
6487
|
-
* }
|
|
6488
|
-
* })
|
|
6489
|
-
* data?.folders.forEach(folder => {
|
|
6490
|
-
* console.log('Folder:', folder.name)
|
|
6491
|
-
* })
|
|
6492
|
-
* ```
|
|
5295
|
+
/**
|
|
5296
|
+
* @experimental this method signature might change in the future
|
|
5297
|
+
*
|
|
5298
|
+
* @category File Buckets
|
|
5299
|
+
* @param options search options
|
|
5300
|
+
* @param parameters
|
|
6493
5301
|
*/
|
|
6494
5302
|
async listV2(options, parameters) {
|
|
6495
5303
|
var _this14 = this;
|
|
@@ -6521,7 +5329,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
6521
5329
|
return params.join("&");
|
|
6522
5330
|
}
|
|
6523
5331
|
};
|
|
6524
|
-
var version2 = "2.
|
|
5332
|
+
var version2 = "2.94.1";
|
|
6525
5333
|
var DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version2}` };
|
|
6526
5334
|
var StorageBucketApi = class extends BaseApiClient {
|
|
6527
5335
|
constructor(url, headers = {}, fetch$1, opts) {
|
|
@@ -7765,10 +6573,10 @@ var StorageClient = class extends StorageBucketApi {
|
|
|
7765
6573
|
}
|
|
7766
6574
|
};
|
|
7767
6575
|
|
|
7768
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7769
|
-
var version3 = "2.
|
|
6576
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/version.js
|
|
6577
|
+
var version3 = "2.94.1";
|
|
7770
6578
|
|
|
7771
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
6579
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/constants.js
|
|
7772
6580
|
var AUTO_REFRESH_TICK_DURATION_MS = 30 * 1e3;
|
|
7773
6581
|
var AUTO_REFRESH_TICK_THRESHOLD = 3;
|
|
7774
6582
|
var EXPIRY_MARGIN_MS = AUTO_REFRESH_TICK_THRESHOLD * AUTO_REFRESH_TICK_DURATION_MS;
|
|
@@ -7785,7 +6593,7 @@ var API_VERSIONS = {
|
|
|
7785
6593
|
var BASE64URL_REGEX = /^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;
|
|
7786
6594
|
var JWKS_TTL = 10 * 60 * 1e3;
|
|
7787
6595
|
|
|
7788
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
6596
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/errors.js
|
|
7789
6597
|
var AuthError = class extends Error {
|
|
7790
6598
|
constructor(message, status, code) {
|
|
7791
6599
|
super(message);
|
|
@@ -7905,7 +6713,7 @@ var AuthInvalidJwtError = class extends CustomAuthError {
|
|
|
7905
6713
|
}
|
|
7906
6714
|
};
|
|
7907
6715
|
|
|
7908
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
6716
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/base64url.js
|
|
7909
6717
|
var TO_BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split("");
|
|
7910
6718
|
var IGNORE_BASE64URL = " \n\r=".split("");
|
|
7911
6719
|
var FROM_BASE64URL = (() => {
|
|
@@ -8067,13 +6875,13 @@ function bytesToBase64URL(bytes) {
|
|
|
8067
6875
|
return result.join("");
|
|
8068
6876
|
}
|
|
8069
6877
|
|
|
8070
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
6878
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/helpers.js
|
|
8071
6879
|
function expiresAt(expiresIn) {
|
|
8072
6880
|
const timeNow = Math.round(Date.now() / 1e3);
|
|
8073
6881
|
return timeNow + expiresIn;
|
|
8074
6882
|
}
|
|
8075
6883
|
function generateCallbackId() {
|
|
8076
|
-
return
|
|
6884
|
+
return Symbol("auth-callback");
|
|
8077
6885
|
}
|
|
8078
6886
|
var isBrowser = () => typeof window !== "undefined" && typeof document !== "undefined";
|
|
8079
6887
|
var localStorageWriteTests = {
|
|
@@ -8349,7 +7157,7 @@ function deepClone(obj) {
|
|
|
8349
7157
|
return JSON.parse(JSON.stringify(obj));
|
|
8350
7158
|
}
|
|
8351
7159
|
|
|
8352
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7160
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/fetch.js
|
|
8353
7161
|
var _getErrorMessage2 = (err) => err.msg || err.message || err.error_description || err.error || JSON.stringify(err);
|
|
8354
7162
|
var NETWORK_ERROR_CODES = [502, 503, 504];
|
|
8355
7163
|
async function handleError2(error) {
|
|
@@ -8486,10 +7294,10 @@ function hasSession(data) {
|
|
|
8486
7294
|
return data.access_token && data.refresh_token && data.expires_in;
|
|
8487
7295
|
}
|
|
8488
7296
|
|
|
8489
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7297
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/types.js
|
|
8490
7298
|
var SIGN_OUT_SCOPES = ["global", "local", "others"];
|
|
8491
7299
|
|
|
8492
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7300
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
|
|
8493
7301
|
var GoTrueAdminApi = class {
|
|
8494
7302
|
/**
|
|
8495
7303
|
* Creates an admin API client that can be used to manage users and OAuth clients.
|
|
@@ -8520,13 +7328,6 @@ var GoTrueAdminApi = class {
|
|
|
8520
7328
|
deleteClient: this._deleteOAuthClient.bind(this),
|
|
8521
7329
|
regenerateClientSecret: this._regenerateOAuthClientSecret.bind(this)
|
|
8522
7330
|
};
|
|
8523
|
-
this.customProviders = {
|
|
8524
|
-
listProviders: this._listCustomProviders.bind(this),
|
|
8525
|
-
createProvider: this._createCustomProvider.bind(this),
|
|
8526
|
-
getProvider: this._getCustomProvider.bind(this),
|
|
8527
|
-
updateProvider: this._updateCustomProvider.bind(this),
|
|
8528
|
-
deleteProvider: this._deleteCustomProvider.bind(this)
|
|
8529
|
-
};
|
|
8530
7331
|
}
|
|
8531
7332
|
/**
|
|
8532
7333
|
* Removes a logged-in session.
|
|
@@ -8688,34 +7489,9 @@ var GoTrueAdminApi = class {
|
|
|
8688
7489
|
/**
|
|
8689
7490
|
* Updates the user data. Changes are applied directly without confirmation flows.
|
|
8690
7491
|
*
|
|
8691
|
-
* @param uid The user's unique identifier
|
|
8692
7492
|
* @param attributes The data you want to update.
|
|
8693
7493
|
*
|
|
8694
7494
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
8695
|
-
*
|
|
8696
|
-
* @remarks
|
|
8697
|
-
* **Important:** This is a server-side operation and does **not** trigger client-side
|
|
8698
|
-
* `onAuthStateChange` listeners. The admin API has no connection to client state.
|
|
8699
|
-
*
|
|
8700
|
-
* To sync changes to the client after calling this method:
|
|
8701
|
-
* 1. On the client, call `supabase.auth.refreshSession()` to fetch the updated user data
|
|
8702
|
-
* 2. This will trigger the `TOKEN_REFRESHED` event and notify all listeners
|
|
8703
|
-
*
|
|
8704
|
-
* @example
|
|
8705
|
-
* ```typescript
|
|
8706
|
-
* // Server-side (Edge Function)
|
|
8707
|
-
* const { data, error } = await supabase.auth.admin.updateUserById(
|
|
8708
|
-
* userId,
|
|
8709
|
-
* { user_metadata: { preferences: { theme: 'dark' } } }
|
|
8710
|
-
* )
|
|
8711
|
-
*
|
|
8712
|
-
* // Client-side (to sync the changes)
|
|
8713
|
-
* const { data, error } = await supabase.auth.refreshSession()
|
|
8714
|
-
* // onAuthStateChange listeners will now be notified with updated user
|
|
8715
|
-
* ```
|
|
8716
|
-
*
|
|
8717
|
-
* @see {@link GoTrueClient.refreshSession} for syncing admin changes to the client
|
|
8718
|
-
* @see {@link GoTrueClient.updateUser} for client-side user updates (triggers listeners automatically)
|
|
8719
7495
|
*/
|
|
8720
7496
|
async updateUserById(uid, attributes) {
|
|
8721
7497
|
validateUUID(uid);
|
|
@@ -8936,127 +7712,9 @@ var GoTrueAdminApi = class {
|
|
|
8936
7712
|
throw error;
|
|
8937
7713
|
}
|
|
8938
7714
|
}
|
|
8939
|
-
/**
|
|
8940
|
-
* Lists all custom providers with optional type filter.
|
|
8941
|
-
*
|
|
8942
|
-
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
8943
|
-
*/
|
|
8944
|
-
async _listCustomProviders(params) {
|
|
8945
|
-
try {
|
|
8946
|
-
const query = {};
|
|
8947
|
-
if (params === null || params === void 0 ? void 0 : params.type) {
|
|
8948
|
-
query.type = params.type;
|
|
8949
|
-
}
|
|
8950
|
-
return await _request(this.fetch, "GET", `${this.url}/admin/custom-providers`, {
|
|
8951
|
-
headers: this.headers,
|
|
8952
|
-
query,
|
|
8953
|
-
xform: (data) => {
|
|
8954
|
-
var _a;
|
|
8955
|
-
return { data: { providers: (_a = data === null || data === void 0 ? void 0 : data.providers) !== null && _a !== void 0 ? _a : [] }, error: null };
|
|
8956
|
-
}
|
|
8957
|
-
});
|
|
8958
|
-
} catch (error) {
|
|
8959
|
-
if (isAuthError(error)) {
|
|
8960
|
-
return { data: { providers: [] }, error };
|
|
8961
|
-
}
|
|
8962
|
-
throw error;
|
|
8963
|
-
}
|
|
8964
|
-
}
|
|
8965
|
-
/**
|
|
8966
|
-
* Creates a new custom OIDC/OAuth provider.
|
|
8967
|
-
*
|
|
8968
|
-
* For OIDC providers, the server fetches and validates the OpenID Connect discovery document
|
|
8969
|
-
* from the issuer's well-known endpoint (or the provided `discovery_url`) at creation time.
|
|
8970
|
-
* This may return a validation error (`error_code: "validation_failed"`) if the discovery
|
|
8971
|
-
* document is unreachable, not valid JSON, missing required fields, or if the issuer
|
|
8972
|
-
* in the document does not match the expected issuer.
|
|
8973
|
-
*
|
|
8974
|
-
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
8975
|
-
*/
|
|
8976
|
-
async _createCustomProvider(params) {
|
|
8977
|
-
try {
|
|
8978
|
-
return await _request(this.fetch, "POST", `${this.url}/admin/custom-providers`, {
|
|
8979
|
-
body: params,
|
|
8980
|
-
headers: this.headers,
|
|
8981
|
-
xform: (provider) => {
|
|
8982
|
-
return { data: provider, error: null };
|
|
8983
|
-
}
|
|
8984
|
-
});
|
|
8985
|
-
} catch (error) {
|
|
8986
|
-
if (isAuthError(error)) {
|
|
8987
|
-
return { data: null, error };
|
|
8988
|
-
}
|
|
8989
|
-
throw error;
|
|
8990
|
-
}
|
|
8991
|
-
}
|
|
8992
|
-
/**
|
|
8993
|
-
* Gets details of a specific custom provider by identifier.
|
|
8994
|
-
*
|
|
8995
|
-
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
8996
|
-
*/
|
|
8997
|
-
async _getCustomProvider(identifier) {
|
|
8998
|
-
try {
|
|
8999
|
-
return await _request(this.fetch, "GET", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
9000
|
-
headers: this.headers,
|
|
9001
|
-
xform: (provider) => {
|
|
9002
|
-
return { data: provider, error: null };
|
|
9003
|
-
}
|
|
9004
|
-
});
|
|
9005
|
-
} catch (error) {
|
|
9006
|
-
if (isAuthError(error)) {
|
|
9007
|
-
return { data: null, error };
|
|
9008
|
-
}
|
|
9009
|
-
throw error;
|
|
9010
|
-
}
|
|
9011
|
-
}
|
|
9012
|
-
/**
|
|
9013
|
-
* Updates an existing custom provider.
|
|
9014
|
-
*
|
|
9015
|
-
* When `issuer` or `discovery_url` is changed on an OIDC provider, the server re-fetches and
|
|
9016
|
-
* validates the discovery document before persisting. This may return a validation error
|
|
9017
|
-
* (`error_code: "validation_failed"`) if the discovery document is unreachable, invalid, or
|
|
9018
|
-
* the issuer does not match.
|
|
9019
|
-
*
|
|
9020
|
-
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
9021
|
-
*/
|
|
9022
|
-
async _updateCustomProvider(identifier, params) {
|
|
9023
|
-
try {
|
|
9024
|
-
return await _request(this.fetch, "PUT", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
9025
|
-
body: params,
|
|
9026
|
-
headers: this.headers,
|
|
9027
|
-
xform: (provider) => {
|
|
9028
|
-
return { data: provider, error: null };
|
|
9029
|
-
}
|
|
9030
|
-
});
|
|
9031
|
-
} catch (error) {
|
|
9032
|
-
if (isAuthError(error)) {
|
|
9033
|
-
return { data: null, error };
|
|
9034
|
-
}
|
|
9035
|
-
throw error;
|
|
9036
|
-
}
|
|
9037
|
-
}
|
|
9038
|
-
/**
|
|
9039
|
-
* Deletes a custom provider.
|
|
9040
|
-
*
|
|
9041
|
-
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
9042
|
-
*/
|
|
9043
|
-
async _deleteCustomProvider(identifier) {
|
|
9044
|
-
try {
|
|
9045
|
-
await _request(this.fetch, "DELETE", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
9046
|
-
headers: this.headers,
|
|
9047
|
-
noResolveJson: true
|
|
9048
|
-
});
|
|
9049
|
-
return { data: null, error: null };
|
|
9050
|
-
} catch (error) {
|
|
9051
|
-
if (isAuthError(error)) {
|
|
9052
|
-
return { data: null, error };
|
|
9053
|
-
}
|
|
9054
|
-
throw error;
|
|
9055
|
-
}
|
|
9056
|
-
}
|
|
9057
7715
|
};
|
|
9058
7716
|
|
|
9059
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7717
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
|
|
9060
7718
|
function memoryLocalStorageAdapter(store = {}) {
|
|
9061
7719
|
return {
|
|
9062
7720
|
getItem: (key) => {
|
|
@@ -9071,7 +7729,7 @@ function memoryLocalStorageAdapter(store = {}) {
|
|
|
9071
7729
|
};
|
|
9072
7730
|
}
|
|
9073
7731
|
|
|
9074
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7732
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/locks.js
|
|
9075
7733
|
var internals = {
|
|
9076
7734
|
/**
|
|
9077
7735
|
* @experimental
|
|
@@ -9101,129 +7759,78 @@ async function navigatorLock(name, acquireTimeout, fn) {
|
|
|
9101
7759
|
}
|
|
9102
7760
|
}, acquireTimeout);
|
|
9103
7761
|
}
|
|
9104
|
-
await Promise.resolve()
|
|
9105
|
-
|
|
9106
|
-
|
|
9107
|
-
|
|
9108
|
-
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
|
|
9112
|
-
|
|
9113
|
-
|
|
7762
|
+
return await Promise.resolve().then(() => globalThis.navigator.locks.request(name, acquireTimeout === 0 ? {
|
|
7763
|
+
mode: "exclusive",
|
|
7764
|
+
ifAvailable: true
|
|
7765
|
+
} : {
|
|
7766
|
+
mode: "exclusive",
|
|
7767
|
+
signal: abortController.signal
|
|
7768
|
+
}, async (lock) => {
|
|
7769
|
+
if (lock) {
|
|
7770
|
+
if (internals.debug) {
|
|
7771
|
+
console.log("@supabase/gotrue-js: navigatorLock: acquired", name, lock.name);
|
|
7772
|
+
}
|
|
7773
|
+
try {
|
|
7774
|
+
return await fn();
|
|
7775
|
+
} finally {
|
|
9114
7776
|
if (internals.debug) {
|
|
9115
|
-
console.log("@supabase/gotrue-js: navigatorLock:
|
|
7777
|
+
console.log("@supabase/gotrue-js: navigatorLock: released", name, lock.name);
|
|
9116
7778
|
}
|
|
9117
|
-
|
|
9118
|
-
|
|
9119
|
-
|
|
9120
|
-
|
|
9121
|
-
|
|
9122
|
-
}
|
|
7779
|
+
}
|
|
7780
|
+
} else {
|
|
7781
|
+
if (acquireTimeout === 0) {
|
|
7782
|
+
if (internals.debug) {
|
|
7783
|
+
console.log("@supabase/gotrue-js: navigatorLock: not immediately available", name);
|
|
9123
7784
|
}
|
|
7785
|
+
throw new NavigatorLockAcquireTimeoutError(`Acquiring an exclusive Navigator LockManager lock "${name}" immediately failed`);
|
|
9124
7786
|
} else {
|
|
9125
|
-
if (
|
|
9126
|
-
if (internals.debug) {
|
|
9127
|
-
console.log("@supabase/gotrue-js: navigatorLock: not immediately available", name);
|
|
9128
|
-
}
|
|
9129
|
-
throw new NavigatorLockAcquireTimeoutError(`Acquiring an exclusive Navigator LockManager lock "${name}" immediately failed`);
|
|
9130
|
-
} else {
|
|
9131
|
-
if (internals.debug) {
|
|
9132
|
-
try {
|
|
9133
|
-
const result = await globalThis.navigator.locks.query();
|
|
9134
|
-
console.log("@supabase/gotrue-js: Navigator LockManager state", JSON.stringify(result, null, " "));
|
|
9135
|
-
} catch (e) {
|
|
9136
|
-
console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state", e);
|
|
9137
|
-
}
|
|
9138
|
-
}
|
|
9139
|
-
console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request");
|
|
9140
|
-
return await fn();
|
|
9141
|
-
}
|
|
9142
|
-
}
|
|
9143
|
-
});
|
|
9144
|
-
} catch (e) {
|
|
9145
|
-
if ((e === null || e === void 0 ? void 0 : e.name) === "AbortError" && acquireTimeout > 0) {
|
|
9146
|
-
if (internals.debug) {
|
|
9147
|
-
console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock", name);
|
|
9148
|
-
}
|
|
9149
|
-
console.warn(`@supabase/gotrue-js: Lock "${name}" was not released within ${acquireTimeout}ms. This may indicate an orphaned lock from a component unmount (e.g., React Strict Mode). Forcefully acquiring the lock to recover.`);
|
|
9150
|
-
return await Promise.resolve().then(() => globalThis.navigator.locks.request(name, {
|
|
9151
|
-
mode: "exclusive",
|
|
9152
|
-
steal: true
|
|
9153
|
-
}, async (lock) => {
|
|
9154
|
-
if (lock) {
|
|
9155
|
-
if (internals.debug) {
|
|
9156
|
-
console.log("@supabase/gotrue-js: navigatorLock: recovered (stolen)", name, lock.name);
|
|
9157
|
-
}
|
|
7787
|
+
if (internals.debug) {
|
|
9158
7788
|
try {
|
|
9159
|
-
|
|
9160
|
-
|
|
9161
|
-
|
|
9162
|
-
|
|
9163
|
-
}
|
|
7789
|
+
const result = await globalThis.navigator.locks.query();
|
|
7790
|
+
console.log("@supabase/gotrue-js: Navigator LockManager state", JSON.stringify(result, null, " "));
|
|
7791
|
+
} catch (e) {
|
|
7792
|
+
console.warn("@supabase/gotrue-js: Error when querying Navigator LockManager state", e);
|
|
9164
7793
|
}
|
|
9165
|
-
} else {
|
|
9166
|
-
console.warn("@supabase/gotrue-js: Navigator LockManager returned null lock even with steal: true");
|
|
9167
|
-
return await fn();
|
|
9168
7794
|
}
|
|
9169
|
-
|
|
7795
|
+
console.warn("@supabase/gotrue-js: Navigator LockManager returned a null lock when using #request without ifAvailable set to true, it appears this browser is not following the LockManager spec https://developer.mozilla.org/en-US/docs/Web/API/LockManager/request");
|
|
7796
|
+
return await fn();
|
|
7797
|
+
}
|
|
9170
7798
|
}
|
|
9171
|
-
|
|
9172
|
-
}
|
|
7799
|
+
}));
|
|
9173
7800
|
}
|
|
9174
7801
|
var PROCESS_LOCKS = {};
|
|
9175
7802
|
async function processLock(name, acquireTimeout, fn) {
|
|
9176
7803
|
var _a;
|
|
9177
7804
|
const previousOperation = (_a = PROCESS_LOCKS[name]) !== null && _a !== void 0 ? _a : Promise.resolve();
|
|
9178
|
-
const
|
|
9179
|
-
|
|
9180
|
-
await previousOperation;
|
|
9181
|
-
return null;
|
|
9182
|
-
} catch (e) {
|
|
7805
|
+
const currentOperation = Promise.race([
|
|
7806
|
+
previousOperation.catch(() => {
|
|
9183
7807
|
return null;
|
|
7808
|
+
}),
|
|
7809
|
+
acquireTimeout >= 0 ? new Promise((_, reject) => {
|
|
7810
|
+
setTimeout(() => {
|
|
7811
|
+
console.warn(`@supabase/gotrue-js: Lock "${name}" acquisition timed out after ${acquireTimeout}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`);
|
|
7812
|
+
reject(new ProcessLockAcquireTimeoutError(`Acquiring process lock with name "${name}" timed out`));
|
|
7813
|
+
}, acquireTimeout);
|
|
7814
|
+
}) : null
|
|
7815
|
+
].filter((x) => x)).catch((e) => {
|
|
7816
|
+
if (e && e.isAcquireTimeout) {
|
|
7817
|
+
throw e;
|
|
9184
7818
|
}
|
|
9185
|
-
|
|
9186
|
-
|
|
9187
|
-
let timeoutId = null;
|
|
9188
|
-
try {
|
|
9189
|
-
const timeoutPromise = acquireTimeout >= 0 ? new Promise((_, reject) => {
|
|
9190
|
-
timeoutId = setTimeout(() => {
|
|
9191
|
-
console.warn(`@supabase/gotrue-js: Lock "${name}" acquisition timed out after ${acquireTimeout}ms. This may be caused by another operation holding the lock. Consider increasing lockAcquireTimeout or checking for stuck operations.`);
|
|
9192
|
-
reject(new ProcessLockAcquireTimeoutError(`Acquiring process lock with name "${name}" timed out`));
|
|
9193
|
-
}, acquireTimeout);
|
|
9194
|
-
}) : null;
|
|
9195
|
-
await Promise.race([previousOperationHandled, timeoutPromise].filter((x) => x));
|
|
9196
|
-
if (timeoutId !== null) {
|
|
9197
|
-
clearTimeout(timeoutId);
|
|
9198
|
-
}
|
|
9199
|
-
} catch (e) {
|
|
9200
|
-
if (timeoutId !== null) {
|
|
9201
|
-
clearTimeout(timeoutId);
|
|
9202
|
-
}
|
|
9203
|
-
if (e && e.isAcquireTimeout) {
|
|
9204
|
-
throw e;
|
|
9205
|
-
}
|
|
9206
|
-
}
|
|
7819
|
+
return null;
|
|
7820
|
+
}).then(async () => {
|
|
9207
7821
|
return await fn();
|
|
9208
|
-
})
|
|
9209
|
-
PROCESS_LOCKS[name] = (async () => {
|
|
9210
|
-
|
|
9211
|
-
|
|
9212
|
-
|
|
9213
|
-
if (e && e.isAcquireTimeout) {
|
|
9214
|
-
try {
|
|
9215
|
-
await previousOperation;
|
|
9216
|
-
} catch (prevError) {
|
|
9217
|
-
}
|
|
9218
|
-
return null;
|
|
9219
|
-
}
|
|
9220
|
-
throw e;
|
|
7822
|
+
});
|
|
7823
|
+
PROCESS_LOCKS[name] = currentOperation.catch(async (e) => {
|
|
7824
|
+
if (e && e.isAcquireTimeout) {
|
|
7825
|
+
await previousOperation;
|
|
7826
|
+
return null;
|
|
9221
7827
|
}
|
|
9222
|
-
|
|
7828
|
+
throw e;
|
|
7829
|
+
});
|
|
9223
7830
|
return await currentOperation;
|
|
9224
7831
|
}
|
|
9225
7832
|
|
|
9226
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7833
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
|
|
9227
7834
|
function polyfillGlobalThis() {
|
|
9228
7835
|
if (typeof globalThis === "object")
|
|
9229
7836
|
return;
|
|
@@ -9243,7 +7850,7 @@ function polyfillGlobalThis() {
|
|
|
9243
7850
|
}
|
|
9244
7851
|
}
|
|
9245
7852
|
|
|
9246
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7853
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
|
|
9247
7854
|
function getAddress(address) {
|
|
9248
7855
|
if (!/^0x[a-fA-F0-9]{40}$/.test(address)) {
|
|
9249
7856
|
throw new Error(`@supabase/auth-js: Address "${address}" is invalid.`);
|
|
@@ -9311,7 +7918,7 @@ Request ID: ${requestId}`;
|
|
|
9311
7918
|
${suffix}`;
|
|
9312
7919
|
}
|
|
9313
7920
|
|
|
9314
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
7921
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
|
|
9315
7922
|
var WebAuthnError = class extends Error {
|
|
9316
7923
|
constructor({ message, code, cause, name }) {
|
|
9317
7924
|
var _a;
|
|
@@ -9479,7 +8086,7 @@ function identifyAuthenticationError({ error, options }) {
|
|
|
9479
8086
|
});
|
|
9480
8087
|
}
|
|
9481
8088
|
|
|
9482
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
8089
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
|
|
9483
8090
|
var WebAuthnAbortService = class {
|
|
9484
8091
|
/**
|
|
9485
8092
|
* Create an abort signal for a new WebAuthn operation.
|
|
@@ -10002,7 +8609,7 @@ var WebAuthnApi = class {
|
|
|
10002
8609
|
}
|
|
10003
8610
|
};
|
|
10004
8611
|
|
|
10005
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
8612
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
|
|
10006
8613
|
polyfillGlobalThis();
|
|
10007
8614
|
var DEFAULT_OPTIONS = {
|
|
10008
8615
|
url: GOTRUE_URL,
|
|
@@ -10015,9 +8622,8 @@ var DEFAULT_OPTIONS = {
|
|
|
10015
8622
|
debug: false,
|
|
10016
8623
|
hasCustomAuthorizationHeader: false,
|
|
10017
8624
|
throwOnError: false,
|
|
10018
|
-
lockAcquireTimeout:
|
|
10019
|
-
//
|
|
10020
|
-
skipAutoInitialize: false
|
|
8625
|
+
lockAcquireTimeout: 1e4
|
|
8626
|
+
// 10 seconds
|
|
10021
8627
|
};
|
|
10022
8628
|
async function lockNoOp(name, acquireTimeout, fn) {
|
|
10023
8629
|
return await fn();
|
|
@@ -10164,11 +8770,9 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
10164
8770
|
}
|
|
10165
8771
|
});
|
|
10166
8772
|
}
|
|
10167
|
-
|
|
10168
|
-
this.initialize()
|
|
10169
|
-
|
|
10170
|
-
});
|
|
10171
|
-
}
|
|
8773
|
+
this.initialize().catch((error) => {
|
|
8774
|
+
this._debug("#initialize()", "error", error);
|
|
8775
|
+
});
|
|
10172
8776
|
}
|
|
10173
8777
|
/**
|
|
10174
8778
|
* Returns whether error throwing mode is enabled for this client.
|
|
@@ -10312,173 +8916,6 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
10312
8916
|
*
|
|
10313
8917
|
* @returns A logged-in session if the server has "autoconfirm" ON
|
|
10314
8918
|
* @returns A user if the server has "autoconfirm" OFF
|
|
10315
|
-
*
|
|
10316
|
-
* @category Auth
|
|
10317
|
-
*
|
|
10318
|
-
* @remarks
|
|
10319
|
-
* - By default, the user needs to verify their email address before logging in. To turn this off, disable **Confirm email** in [your project](/dashboard/project/_/auth/providers).
|
|
10320
|
-
* - **Confirm email** determines if users need to confirm their email address after signing up.
|
|
10321
|
-
* - If **Confirm email** is enabled, a `user` is returned but `session` is null.
|
|
10322
|
-
* - If **Confirm email** is disabled, both a `user` and a `session` are returned.
|
|
10323
|
-
* - When the user confirms their email address, they are redirected to the [`SITE_URL`](/docs/guides/auth/redirect-urls#use-wildcards-in-redirect-urls) by default. You can modify your `SITE_URL` or add additional redirect URLs in [your project](/dashboard/project/_/auth/url-configuration).
|
|
10324
|
-
* - If signUp() is called for an existing confirmed user:
|
|
10325
|
-
* - When both **Confirm email** and **Confirm phone** (even when phone provider is disabled) are enabled in [your project](/dashboard/project/_/auth/providers), an obfuscated/fake user object is returned.
|
|
10326
|
-
* - When either **Confirm email** or **Confirm phone** (even when phone provider is disabled) is disabled, the error message, `User already registered` is returned.
|
|
10327
|
-
* - To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/auth-getuser).
|
|
10328
|
-
*
|
|
10329
|
-
* @example Sign up with an email and password
|
|
10330
|
-
* ```js
|
|
10331
|
-
* const { data, error } = await supabase.auth.signUp({
|
|
10332
|
-
* email: 'example@email.com',
|
|
10333
|
-
* password: 'example-password',
|
|
10334
|
-
* })
|
|
10335
|
-
* ```
|
|
10336
|
-
*
|
|
10337
|
-
* @exampleResponse Sign up with an email and password
|
|
10338
|
-
* ```json
|
|
10339
|
-
* // Some fields may be null if "confirm email" is enabled.
|
|
10340
|
-
* {
|
|
10341
|
-
* "data": {
|
|
10342
|
-
* "user": {
|
|
10343
|
-
* "id": "11111111-1111-1111-1111-111111111111",
|
|
10344
|
-
* "aud": "authenticated",
|
|
10345
|
-
* "role": "authenticated",
|
|
10346
|
-
* "email": "example@email.com",
|
|
10347
|
-
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
10348
|
-
* "phone": "",
|
|
10349
|
-
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
10350
|
-
* "app_metadata": {
|
|
10351
|
-
* "provider": "email",
|
|
10352
|
-
* "providers": [
|
|
10353
|
-
* "email"
|
|
10354
|
-
* ]
|
|
10355
|
-
* },
|
|
10356
|
-
* "user_metadata": {},
|
|
10357
|
-
* "identities": [
|
|
10358
|
-
* {
|
|
10359
|
-
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
10360
|
-
* "id": "11111111-1111-1111-1111-111111111111",
|
|
10361
|
-
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
10362
|
-
* "identity_data": {
|
|
10363
|
-
* "email": "example@email.com",
|
|
10364
|
-
* "email_verified": false,
|
|
10365
|
-
* "phone_verified": false,
|
|
10366
|
-
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
10367
|
-
* },
|
|
10368
|
-
* "provider": "email",
|
|
10369
|
-
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
10370
|
-
* "created_at": "2024-01-01T00:00:00Z",
|
|
10371
|
-
* "updated_at": "2024-01-01T00:00:00Z",
|
|
10372
|
-
* "email": "example@email.com"
|
|
10373
|
-
* }
|
|
10374
|
-
* ],
|
|
10375
|
-
* "created_at": "2024-01-01T00:00:00Z",
|
|
10376
|
-
* "updated_at": "2024-01-01T00:00:00Z"
|
|
10377
|
-
* },
|
|
10378
|
-
* "session": {
|
|
10379
|
-
* "access_token": "<ACCESS_TOKEN>",
|
|
10380
|
-
* "token_type": "bearer",
|
|
10381
|
-
* "expires_in": 3600,
|
|
10382
|
-
* "expires_at": 1700000000,
|
|
10383
|
-
* "refresh_token": "<REFRESH_TOKEN>",
|
|
10384
|
-
* "user": {
|
|
10385
|
-
* "id": "11111111-1111-1111-1111-111111111111",
|
|
10386
|
-
* "aud": "authenticated",
|
|
10387
|
-
* "role": "authenticated",
|
|
10388
|
-
* "email": "example@email.com",
|
|
10389
|
-
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
10390
|
-
* "phone": "",
|
|
10391
|
-
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
10392
|
-
* "app_metadata": {
|
|
10393
|
-
* "provider": "email",
|
|
10394
|
-
* "providers": [
|
|
10395
|
-
* "email"
|
|
10396
|
-
* ]
|
|
10397
|
-
* },
|
|
10398
|
-
* "user_metadata": {},
|
|
10399
|
-
* "identities": [
|
|
10400
|
-
* {
|
|
10401
|
-
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
10402
|
-
* "id": "11111111-1111-1111-1111-111111111111",
|
|
10403
|
-
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
10404
|
-
* "identity_data": {
|
|
10405
|
-
* "email": "example@email.com",
|
|
10406
|
-
* "email_verified": false,
|
|
10407
|
-
* "phone_verified": false,
|
|
10408
|
-
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
10409
|
-
* },
|
|
10410
|
-
* "provider": "email",
|
|
10411
|
-
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
10412
|
-
* "created_at": "2024-01-01T00:00:00Z",
|
|
10413
|
-
* "updated_at": "2024-01-01T00:00:00Z",
|
|
10414
|
-
* "email": "example@email.com"
|
|
10415
|
-
* }
|
|
10416
|
-
* ],
|
|
10417
|
-
* "created_at": "2024-01-01T00:00:00Z",
|
|
10418
|
-
* "updated_at": "2024-01-01T00:00:00Z"
|
|
10419
|
-
* }
|
|
10420
|
-
* }
|
|
10421
|
-
* },
|
|
10422
|
-
* "error": null
|
|
10423
|
-
* }
|
|
10424
|
-
* ```
|
|
10425
|
-
*
|
|
10426
|
-
* @example Sign up with a phone number and password (SMS)
|
|
10427
|
-
* ```js
|
|
10428
|
-
* const { data, error } = await supabase.auth.signUp({
|
|
10429
|
-
* phone: '123456789',
|
|
10430
|
-
* password: 'example-password',
|
|
10431
|
-
* options: {
|
|
10432
|
-
* channel: 'sms'
|
|
10433
|
-
* }
|
|
10434
|
-
* })
|
|
10435
|
-
* ```
|
|
10436
|
-
*
|
|
10437
|
-
* @exampleDescription Sign up with a phone number and password (whatsapp)
|
|
10438
|
-
* The user will be sent a WhatsApp message which contains a OTP. By default, a given user can only request a OTP once every 60 seconds. Note that a user will need to have a valid WhatsApp account that is linked to Twilio in order to use this feature.
|
|
10439
|
-
*
|
|
10440
|
-
* @example Sign up with a phone number and password (whatsapp)
|
|
10441
|
-
* ```js
|
|
10442
|
-
* const { data, error } = await supabase.auth.signUp({
|
|
10443
|
-
* phone: '123456789',
|
|
10444
|
-
* password: 'example-password',
|
|
10445
|
-
* options: {
|
|
10446
|
-
* channel: 'whatsapp'
|
|
10447
|
-
* }
|
|
10448
|
-
* })
|
|
10449
|
-
* ```
|
|
10450
|
-
*
|
|
10451
|
-
* @example Sign up with additional user metadata
|
|
10452
|
-
* ```js
|
|
10453
|
-
* const { data, error } = await supabase.auth.signUp(
|
|
10454
|
-
* {
|
|
10455
|
-
* email: 'example@email.com',
|
|
10456
|
-
* password: 'example-password',
|
|
10457
|
-
* options: {
|
|
10458
|
-
* data: {
|
|
10459
|
-
* first_name: 'John',
|
|
10460
|
-
* age: 27,
|
|
10461
|
-
* }
|
|
10462
|
-
* }
|
|
10463
|
-
* }
|
|
10464
|
-
* )
|
|
10465
|
-
* ```
|
|
10466
|
-
*
|
|
10467
|
-
* @exampleDescription Sign up with a redirect URL
|
|
10468
|
-
* - See [redirect URLs and wildcards](/docs/guides/auth/redirect-urls#use-wildcards-in-redirect-urls) to add additional redirect URLs to your project.
|
|
10469
|
-
*
|
|
10470
|
-
* @example Sign up with a redirect URL
|
|
10471
|
-
* ```js
|
|
10472
|
-
* const { data, error } = await supabase.auth.signUp(
|
|
10473
|
-
* {
|
|
10474
|
-
* email: 'example@email.com',
|
|
10475
|
-
* password: 'example-password',
|
|
10476
|
-
* options: {
|
|
10477
|
-
* emailRedirectTo: 'https://example.com/welcome'
|
|
10478
|
-
* }
|
|
10479
|
-
* }
|
|
10480
|
-
* )
|
|
10481
|
-
* ```
|
|
10482
8919
|
*/
|
|
10483
8920
|
async signUp(credentials) {
|
|
10484
8921
|
var _a, _b, _c;
|
|
@@ -12724,16 +11161,16 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
12724
11161
|
GoTrueClient.nextInstanceID = {};
|
|
12725
11162
|
var GoTrueClient_default = GoTrueClient;
|
|
12726
11163
|
|
|
12727
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
11164
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js
|
|
12728
11165
|
var AuthAdminApi = GoTrueAdminApi;
|
|
12729
11166
|
var AuthAdminApi_default = AuthAdminApi;
|
|
12730
11167
|
|
|
12731
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
11168
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.94.1/node_modules/@supabase/auth-js/dist/module/AuthClient.js
|
|
12732
11169
|
var AuthClient = GoTrueClient_default;
|
|
12733
11170
|
var AuthClient_default = AuthClient;
|
|
12734
11171
|
|
|
12735
|
-
// ../../node_modules/.pnpm/@supabase+supabase-js@2.
|
|
12736
|
-
var version4 = "2.
|
|
11172
|
+
// ../../node_modules/.pnpm/@supabase+supabase-js@2.94.1/node_modules/@supabase/supabase-js/dist/index.mjs
|
|
11173
|
+
var version4 = "2.94.1";
|
|
12737
11174
|
var JS_ENV = "";
|
|
12738
11175
|
if (typeof Deno !== "undefined") JS_ENV = "deno";
|
|
12739
11176
|
else if (typeof document !== "undefined") JS_ENV = "web";
|
|
@@ -12856,9 +11293,6 @@ var SupabaseAuthClient = class extends AuthClient_default {
|
|
|
12856
11293
|
var SupabaseClient = class {
|
|
12857
11294
|
/**
|
|
12858
11295
|
* Create a new client for use in the browser.
|
|
12859
|
-
*
|
|
12860
|
-
* @category Initializing
|
|
12861
|
-
*
|
|
12862
11296
|
* @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.
|
|
12863
11297
|
* @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard.
|
|
12864
11298
|
* @param options.db.schema You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase.
|
|
@@ -12869,175 +11303,11 @@ var SupabaseClient = class {
|
|
|
12869
11303
|
* @param options.storage Options passed along to the storage-js constructor.
|
|
12870
11304
|
* @param options.global.fetch A custom fetch implementation.
|
|
12871
11305
|
* @param options.global.headers Any additional headers to send with each network request.
|
|
12872
|
-
*
|
|
12873
|
-
* @example Creating a client
|
|
12874
|
-
* ```js
|
|
12875
|
-
* import { createClient } from '@supabase/supabase-js'
|
|
12876
|
-
*
|
|
12877
|
-
* // Create a single supabase client for interacting with your database
|
|
12878
|
-
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
|
|
12879
|
-
* ```
|
|
12880
|
-
*
|
|
12881
|
-
* @example With a custom domain
|
|
12882
|
-
* ```js
|
|
12883
|
-
* import { createClient } from '@supabase/supabase-js'
|
|
12884
|
-
*
|
|
12885
|
-
* // Use a custom domain as the supabase URL
|
|
12886
|
-
* const supabase = createClient('https://my-custom-domain.com', 'publishable-or-anon-key')
|
|
12887
|
-
* ```
|
|
12888
|
-
*
|
|
12889
|
-
* @example With additional parameters
|
|
12890
|
-
* ```js
|
|
12891
|
-
* import { createClient } from '@supabase/supabase-js'
|
|
12892
|
-
*
|
|
12893
|
-
* const options = {
|
|
12894
|
-
* db: {
|
|
12895
|
-
* schema: 'public',
|
|
12896
|
-
* },
|
|
12897
|
-
* auth: {
|
|
12898
|
-
* autoRefreshToken: true,
|
|
12899
|
-
* persistSession: true,
|
|
12900
|
-
* detectSessionInUrl: true
|
|
12901
|
-
* },
|
|
12902
|
-
* global: {
|
|
12903
|
-
* headers: { 'x-my-custom-header': 'my-app-name' },
|
|
12904
|
-
* },
|
|
12905
|
-
* }
|
|
12906
|
-
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", options)
|
|
12907
|
-
* ```
|
|
12908
|
-
*
|
|
12909
|
-
* @exampleDescription With custom schemas
|
|
12910
|
-
* By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard.
|
|
12911
|
-
* Go to [Settings > API > Exposed schemas](/dashboard/project/_/settings/api) and add the schema which you want to expose to the API.
|
|
12912
|
-
*
|
|
12913
|
-
* Note: each client connection can only access a single schema, so the code above can access the `other_schema` schema but cannot access the `public` schema.
|
|
12914
|
-
*
|
|
12915
|
-
* @example With custom schemas
|
|
12916
|
-
* ```js
|
|
12917
|
-
* import { createClient } from '@supabase/supabase-js'
|
|
12918
|
-
*
|
|
12919
|
-
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', {
|
|
12920
|
-
* // Provide a custom schema. Defaults to "public".
|
|
12921
|
-
* db: { schema: 'other_schema' }
|
|
12922
|
-
* })
|
|
12923
|
-
* ```
|
|
12924
|
-
*
|
|
12925
|
-
* @exampleDescription Custom fetch implementation
|
|
12926
|
-
* `supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests,
|
|
12927
|
-
* but an alternative `fetch` implementation can be provided as an option.
|
|
12928
|
-
* This is most useful in environments where `cross-fetch` is not compatible (for instance Cloudflare Workers).
|
|
12929
|
-
*
|
|
12930
|
-
* @example Custom fetch implementation
|
|
12931
|
-
* ```js
|
|
12932
|
-
* import { createClient } from '@supabase/supabase-js'
|
|
12933
|
-
*
|
|
12934
|
-
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', {
|
|
12935
|
-
* global: { fetch: fetch.bind(globalThis) }
|
|
12936
|
-
* })
|
|
12937
|
-
* ```
|
|
12938
|
-
*
|
|
12939
|
-
* @exampleDescription React Native options with AsyncStorage
|
|
12940
|
-
* For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth.
|
|
12941
|
-
*
|
|
12942
|
-
* @example React Native options with AsyncStorage
|
|
12943
|
-
* ```js
|
|
12944
|
-
* import 'react-native-url-polyfill/auto'
|
|
12945
|
-
* import { createClient } from '@supabase/supabase-js'
|
|
12946
|
-
* import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
12947
|
-
*
|
|
12948
|
-
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", {
|
|
12949
|
-
* auth: {
|
|
12950
|
-
* storage: AsyncStorage,
|
|
12951
|
-
* autoRefreshToken: true,
|
|
12952
|
-
* persistSession: true,
|
|
12953
|
-
* detectSessionInUrl: false,
|
|
12954
|
-
* },
|
|
12955
|
-
* });
|
|
12956
|
-
* ```
|
|
12957
|
-
*
|
|
12958
|
-
* @exampleDescription React Native options with Expo SecureStore
|
|
12959
|
-
* If you wish to encrypt the user's session information, you can use `aes-js` and store the encryption key in Expo SecureStore.
|
|
12960
|
-
* The `aes-js` library, a reputable JavaScript-only implementation of the AES encryption algorithm in CTR mode.
|
|
12961
|
-
* A new 256-bit encryption key is generated using the `react-native-get-random-values` library.
|
|
12962
|
-
* This key is stored inside Expo's SecureStore, while the value is encrypted and placed inside AsyncStorage.
|
|
12963
|
-
*
|
|
12964
|
-
* Please make sure that:
|
|
12965
|
-
* - You keep the `expo-secure-store`, `aes-js` and `react-native-get-random-values` libraries up-to-date.
|
|
12966
|
-
* - Choose the correct [`SecureStoreOptions`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestoreoptions) for your app's needs.
|
|
12967
|
-
* E.g. [`SecureStore.WHEN_UNLOCKED`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestorewhen_unlocked) regulates when the data can be accessed.
|
|
12968
|
-
* - Carefully consider optimizations or other modifications to the above example, as those can lead to introducing subtle security vulnerabilities.
|
|
12969
|
-
*
|
|
12970
|
-
* @example React Native options with Expo SecureStore
|
|
12971
|
-
* ```ts
|
|
12972
|
-
* import 'react-native-url-polyfill/auto'
|
|
12973
|
-
* import { createClient } from '@supabase/supabase-js'
|
|
12974
|
-
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
12975
|
-
* import * as SecureStore from 'expo-secure-store';
|
|
12976
|
-
* import * as aesjs from 'aes-js';
|
|
12977
|
-
* import 'react-native-get-random-values';
|
|
12978
|
-
*
|
|
12979
|
-
* // As Expo's SecureStore does not support values larger than 2048
|
|
12980
|
-
* // bytes, an AES-256 key is generated and stored in SecureStore, while
|
|
12981
|
-
* // it is used to encrypt/decrypt values stored in AsyncStorage.
|
|
12982
|
-
* class LargeSecureStore {
|
|
12983
|
-
* private async _encrypt(key: string, value: string) {
|
|
12984
|
-
* const encryptionKey = crypto.getRandomValues(new Uint8Array(256 / 8));
|
|
12985
|
-
*
|
|
12986
|
-
* const cipher = new aesjs.ModeOfOperation.ctr(encryptionKey, new aesjs.Counter(1));
|
|
12987
|
-
* const encryptedBytes = cipher.encrypt(aesjs.utils.utf8.toBytes(value));
|
|
12988
|
-
*
|
|
12989
|
-
* await SecureStore.setItemAsync(key, aesjs.utils.hex.fromBytes(encryptionKey));
|
|
12990
|
-
*
|
|
12991
|
-
* return aesjs.utils.hex.fromBytes(encryptedBytes);
|
|
12992
|
-
* }
|
|
12993
|
-
*
|
|
12994
|
-
* private async _decrypt(key: string, value: string) {
|
|
12995
|
-
* const encryptionKeyHex = await SecureStore.getItemAsync(key);
|
|
12996
|
-
* if (!encryptionKeyHex) {
|
|
12997
|
-
* return encryptionKeyHex;
|
|
12998
|
-
* }
|
|
12999
|
-
*
|
|
13000
|
-
* const cipher = new aesjs.ModeOfOperation.ctr(aesjs.utils.hex.toBytes(encryptionKeyHex), new aesjs.Counter(1));
|
|
13001
|
-
* const decryptedBytes = cipher.decrypt(aesjs.utils.hex.toBytes(value));
|
|
13002
|
-
*
|
|
13003
|
-
* return aesjs.utils.utf8.fromBytes(decryptedBytes);
|
|
13004
|
-
* }
|
|
13005
|
-
*
|
|
13006
|
-
* async getItem(key: string) {
|
|
13007
|
-
* const encrypted = await AsyncStorage.getItem(key);
|
|
13008
|
-
* if (!encrypted) { return encrypted; }
|
|
13009
|
-
*
|
|
13010
|
-
* return await this._decrypt(key, encrypted);
|
|
13011
|
-
* }
|
|
13012
|
-
*
|
|
13013
|
-
* async removeItem(key: string) {
|
|
13014
|
-
* await AsyncStorage.removeItem(key);
|
|
13015
|
-
* await SecureStore.deleteItemAsync(key);
|
|
13016
|
-
* }
|
|
13017
|
-
*
|
|
13018
|
-
* async setItem(key: string, value: string) {
|
|
13019
|
-
* const encrypted = await this._encrypt(key, value);
|
|
13020
|
-
*
|
|
13021
|
-
* await AsyncStorage.setItem(key, encrypted);
|
|
13022
|
-
* }
|
|
13023
|
-
* }
|
|
13024
|
-
*
|
|
13025
|
-
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", {
|
|
13026
|
-
* auth: {
|
|
13027
|
-
* storage: new LargeSecureStore(),
|
|
13028
|
-
* autoRefreshToken: true,
|
|
13029
|
-
* persistSession: true,
|
|
13030
|
-
* detectSessionInUrl: false,
|
|
13031
|
-
* },
|
|
13032
|
-
* });
|
|
13033
|
-
* ```
|
|
13034
|
-
*
|
|
13035
|
-
* @example With a database query
|
|
11306
|
+
* @example
|
|
13036
11307
|
* ```ts
|
|
13037
11308
|
* import { createClient } from '@supabase/supabase-js'
|
|
13038
11309
|
*
|
|
13039
11310
|
* const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
|
|
13040
|
-
*
|
|
13041
11311
|
* const { data } = await supabase.from('profiles').select('*')
|
|
13042
11312
|
* ```
|
|
13043
11313
|
*/
|
|
@@ -13286,4 +11556,4 @@ export {
|
|
|
13286
11556
|
SupabaseClient,
|
|
13287
11557
|
createClient
|
|
13288
11558
|
};
|
|
13289
|
-
//# sourceMappingURL=chunk-
|
|
11559
|
+
//# sourceMappingURL=chunk-DD36YMMQ.js.map
|