@donotdev/cli 0.0.37 → 0.1.0
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/LICENSE.md +21 -48
- package/dependencies-matrix.json +24 -24
- package/dist/bin/commands/agent-setup.js +6963 -123
- package/dist/bin/commands/build.js +4 -1
- package/dist/bin/commands/bump.js +23 -12
- package/dist/bin/commands/cacheout.js +17 -1
- package/dist/bin/commands/coach.js +4 -1
- package/dist/bin/commands/create-app.js +16 -2
- package/dist/bin/commands/create-project.js +17 -3
- package/dist/bin/commands/db.js +1708 -98
- package/dist/bin/commands/deploy.js +142 -96
- package/dist/bin/commands/dev.js +6 -5
- package/dist/bin/commands/doctor.js +4 -1
- package/dist/bin/commands/emu.js +6 -5
- package/dist/bin/commands/format.js +5 -3
- package/dist/bin/commands/get-demo.js +16 -2
- package/dist/bin/commands/make-admin.js +1717 -87
- package/dist/bin/commands/preview.js +6 -5
- package/dist/bin/commands/seed.js +1708 -98
- package/dist/bin/commands/setup-cicd.js +4 -1
- package/dist/bin/commands/setup.js +21 -18
- package/dist/bin/commands/staging.js +142 -96
- package/dist/bin/commands/sync-secrets.js +4 -1
- package/dist/bin/commands/type-check.js +4 -1
- package/dist/bin/commands/wai.js +4 -1
- package/dist/bin/dndev.js +21 -1
- package/dist/bin/donotdev.js +21 -1
- package/dist/index.js +170 -105
- package/package.json +2 -2
- package/templates/functions-supabase/supabase/functions/.env.example +12 -0
- package/templates/functions-supabase/supabase/functions/disconnect-oauth/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/exchange-token/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/get-connections/index.ts.example +7 -0
- package/templates/functions-supabase/supabase/functions/refresh-token/index.ts.example +7 -0
- package/templates/preset-admin/src/pages/DashboardPage.tsx.example +189 -0
- package/templates/preset-admin/src/pages/EntityPage.tsx.example +84 -0
- package/templates/preset-admin/src/pages/ReportsPage.tsx.example +243 -0
- package/templates/preset-admin/src/pages/SettingsPage.tsx.example +283 -0
- package/templates/preset-admin/src/pages/UsersPage.tsx.example +128 -0
- package/templates/preset-ecommerce/src/pages/CartPage.tsx.example +167 -0
- package/templates/preset-ecommerce/src/pages/CatalogPage.tsx.example +187 -0
- package/templates/preset-ecommerce/src/pages/CheckoutPage.tsx.example +244 -0
- package/templates/preset-ecommerce/src/pages/HomePage.tsx.example +268 -0
- package/templates/preset-ecommerce/src/pages/ProductPage.tsx.example +228 -0
- package/templates/preset-landing/src/pages/AboutPage.tsx.example +237 -0
- package/templates/preset-landing/src/pages/ContactPage.tsx.example +192 -0
- package/templates/preset-landing/src/pages/HomePage.tsx.example +399 -0
- package/templates/preset-saas/src/pages/DashboardPage.tsx.example +195 -0
- package/templates/preset-saas/src/pages/HomePage.tsx.example +270 -0
- package/templates/preset-saas/src/pages/PricingPage.tsx.example +204 -0
- package/templates/preset-saas/src/pages/ProfilePage.tsx.example +191 -0
- package/templates/preset-saas/src/pages/SettingsPage.tsx.example +292 -0
- package/templates/root-consumer/.claude/commands/brainstorm.md.example +28 -0
- package/templates/root-consumer/.claude/commands/design.md.example +31 -0
- package/templates/root-consumer/.claude/commands/grill.md.example +33 -6
- package/templates/root-consumer/.claude/skills/brainstorm/SKILL.md.example +16 -0
- package/templates/root-consumer/.claude/skills/design/SKILL.md.example +17 -0
- package/templates/root-consumer/.claude/skills/grill/SKILL.md.example +11 -5
- package/templates/root-consumer/guides/dndev/SETUP_OAUTH.md.example +2 -1
|
@@ -7775,7 +7775,10 @@ var init_PathResolver = __esm({
|
|
|
7775
7775
|
*/
|
|
7776
7776
|
getEmptyCjsModulePath() {
|
|
7777
7777
|
const resolved = this.resolvePackage("@donotdev/core/empty");
|
|
7778
|
-
if (!resolved)
|
|
7778
|
+
if (!resolved)
|
|
7779
|
+
throw new Error(
|
|
7780
|
+
"Cannot resolve @donotdev/core/empty \u2014 package setup is broken"
|
|
7781
|
+
);
|
|
7779
7782
|
return resolved;
|
|
7780
7783
|
}
|
|
7781
7784
|
// === PRIVATE METHODS ===
|
|
@@ -8217,10 +8220,10 @@ var init_tslib_es6 = __esm({
|
|
|
8217
8220
|
}
|
|
8218
8221
|
});
|
|
8219
8222
|
|
|
8220
|
-
// node_modules/.bun/@supabase+functions-js@2.
|
|
8223
|
+
// node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/helper.js
|
|
8221
8224
|
var resolveFetch;
|
|
8222
8225
|
var init_helper = __esm({
|
|
8223
|
-
"node_modules/.bun/@supabase+functions-js@2.
|
|
8226
|
+
"node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/helper.js"() {
|
|
8224
8227
|
init_utils();
|
|
8225
8228
|
resolveFetch = (customFetch) => {
|
|
8226
8229
|
if (customFetch) {
|
|
@@ -8231,10 +8234,10 @@ var init_helper = __esm({
|
|
|
8231
8234
|
}
|
|
8232
8235
|
});
|
|
8233
8236
|
|
|
8234
|
-
// node_modules/.bun/@supabase+functions-js@2.
|
|
8237
|
+
// node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/types.js
|
|
8235
8238
|
var FunctionsError, FunctionsFetchError, FunctionsRelayError, FunctionsHttpError, FunctionRegion;
|
|
8236
8239
|
var init_types = __esm({
|
|
8237
|
-
"node_modules/.bun/@supabase+functions-js@2.
|
|
8240
|
+
"node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/types.js"() {
|
|
8238
8241
|
init_utils();
|
|
8239
8242
|
FunctionsError = class extends Error {
|
|
8240
8243
|
constructor(message, name = "FunctionsError", context) {
|
|
@@ -8278,10 +8281,10 @@ var init_types = __esm({
|
|
|
8278
8281
|
}
|
|
8279
8282
|
});
|
|
8280
8283
|
|
|
8281
|
-
// node_modules/.bun/@supabase+functions-js@2.
|
|
8284
|
+
// node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
|
|
8282
8285
|
var FunctionsClient;
|
|
8283
8286
|
var init_FunctionsClient = __esm({
|
|
8284
|
-
"node_modules/.bun/@supabase+functions-js@2.
|
|
8287
|
+
"node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js"() {
|
|
8285
8288
|
init_utils();
|
|
8286
8289
|
init_tslib_es6();
|
|
8287
8290
|
init_helper();
|
|
@@ -8427,15 +8430,15 @@ var init_FunctionsClient = __esm({
|
|
|
8427
8430
|
}
|
|
8428
8431
|
});
|
|
8429
8432
|
|
|
8430
|
-
// node_modules/.bun/@supabase+functions-js@2.
|
|
8433
|
+
// node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/index.js
|
|
8431
8434
|
var init_module = __esm({
|
|
8432
|
-
"node_modules/.bun/@supabase+functions-js@2.
|
|
8435
|
+
"node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/index.js"() {
|
|
8433
8436
|
init_utils();
|
|
8434
8437
|
init_FunctionsClient();
|
|
8435
8438
|
}
|
|
8436
8439
|
});
|
|
8437
8440
|
|
|
8438
|
-
// node_modules/.bun/@supabase+postgrest-js@2.
|
|
8441
|
+
// node_modules/.bun/@supabase+postgrest-js@2.99.1/node_modules/@supabase/postgrest-js/dist/index.mjs
|
|
8439
8442
|
function _typeof(o2) {
|
|
8440
8443
|
"@babel/helpers - typeof";
|
|
8441
8444
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
@@ -8489,7 +8492,7 @@ function _objectSpread2(e3) {
|
|
|
8489
8492
|
}
|
|
8490
8493
|
var PostgrestError, PostgrestBuilder, PostgrestTransformBuilder, PostgrestReservedCharsRegexp, PostgrestFilterBuilder, PostgrestQueryBuilder, PostgrestClient;
|
|
8491
8494
|
var init_dist3 = __esm({
|
|
8492
|
-
"node_modules/.bun/@supabase+postgrest-js@2.
|
|
8495
|
+
"node_modules/.bun/@supabase+postgrest-js@2.99.1/node_modules/@supabase/postgrest-js/dist/index.mjs"() {
|
|
8493
8496
|
init_utils();
|
|
8494
8497
|
PostgrestError = class extends Error {
|
|
8495
8498
|
/**
|
|
@@ -9354,6 +9357,760 @@ ${cause.stack}`;
|
|
|
9354
9357
|
* @remarks
|
|
9355
9358
|
* When using `count` with `.range()` or `.limit()`, the returned `count` is the total number of rows
|
|
9356
9359
|
* that match your filters, not the number of rows in the current page. Use this to build pagination UI.
|
|
9360
|
+
|
|
9361
|
+
* - 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.
|
|
9362
|
+
* - `select()` can be combined with [Filters](/docs/reference/javascript/using-filters)
|
|
9363
|
+
* - `select()` can be combined with [Modifiers](/docs/reference/javascript/using-modifiers)
|
|
9364
|
+
* - `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). *
|
|
9365
|
+
* @category Database
|
|
9366
|
+
*
|
|
9367
|
+
* @example Getting your data
|
|
9368
|
+
* ```js
|
|
9369
|
+
* const { data, error } = await supabase
|
|
9370
|
+
* .from('characters')
|
|
9371
|
+
* .select()
|
|
9372
|
+
* ```
|
|
9373
|
+
*
|
|
9374
|
+
* @exampleSql Getting your data
|
|
9375
|
+
* ```sql
|
|
9376
|
+
* create table
|
|
9377
|
+
* characters (id int8 primary key, name text);
|
|
9378
|
+
*
|
|
9379
|
+
* insert into
|
|
9380
|
+
* characters (id, name)
|
|
9381
|
+
* values
|
|
9382
|
+
* (1, 'Harry'),
|
|
9383
|
+
* (2, 'Frodo'),
|
|
9384
|
+
* (3, 'Katniss');
|
|
9385
|
+
* ```
|
|
9386
|
+
*
|
|
9387
|
+
* @exampleResponse Getting your data
|
|
9388
|
+
* ```json
|
|
9389
|
+
* {
|
|
9390
|
+
* "data": [
|
|
9391
|
+
* {
|
|
9392
|
+
* "id": 1,
|
|
9393
|
+
* "name": "Harry"
|
|
9394
|
+
* },
|
|
9395
|
+
* {
|
|
9396
|
+
* "id": 2,
|
|
9397
|
+
* "name": "Frodo"
|
|
9398
|
+
* },
|
|
9399
|
+
* {
|
|
9400
|
+
* "id": 3,
|
|
9401
|
+
* "name": "Katniss"
|
|
9402
|
+
* }
|
|
9403
|
+
* ],
|
|
9404
|
+
* "status": 200,
|
|
9405
|
+
* "statusText": "OK"
|
|
9406
|
+
* }
|
|
9407
|
+
* ```
|
|
9408
|
+
*
|
|
9409
|
+
* @example Selecting specific columns
|
|
9410
|
+
* ```js
|
|
9411
|
+
* const { data, error } = await supabase
|
|
9412
|
+
* .from('characters')
|
|
9413
|
+
* .select('name')
|
|
9414
|
+
* ```
|
|
9415
|
+
*
|
|
9416
|
+
* @exampleSql Selecting specific columns
|
|
9417
|
+
* ```sql
|
|
9418
|
+
* create table
|
|
9419
|
+
* characters (id int8 primary key, name text);
|
|
9420
|
+
*
|
|
9421
|
+
* insert into
|
|
9422
|
+
* characters (id, name)
|
|
9423
|
+
* values
|
|
9424
|
+
* (1, 'Frodo'),
|
|
9425
|
+
* (2, 'Harry'),
|
|
9426
|
+
* (3, 'Katniss');
|
|
9427
|
+
* ```
|
|
9428
|
+
*
|
|
9429
|
+
* @exampleResponse Selecting specific columns
|
|
9430
|
+
* ```json
|
|
9431
|
+
* {
|
|
9432
|
+
* "data": [
|
|
9433
|
+
* {
|
|
9434
|
+
* "name": "Frodo"
|
|
9435
|
+
* },
|
|
9436
|
+
* {
|
|
9437
|
+
* "name": "Harry"
|
|
9438
|
+
* },
|
|
9439
|
+
* {
|
|
9440
|
+
* "name": "Katniss"
|
|
9441
|
+
* }
|
|
9442
|
+
* ],
|
|
9443
|
+
* "status": 200,
|
|
9444
|
+
* "statusText": "OK"
|
|
9445
|
+
* }
|
|
9446
|
+
* ```
|
|
9447
|
+
*
|
|
9448
|
+
* @exampleDescription Query referenced tables
|
|
9449
|
+
* If your database has foreign key relationships, you can query related tables too.
|
|
9450
|
+
*
|
|
9451
|
+
* @example Query referenced tables
|
|
9452
|
+
* ```js
|
|
9453
|
+
* const { data, error } = await supabase
|
|
9454
|
+
* .from('orchestral_sections')
|
|
9455
|
+
* .select(`
|
|
9456
|
+
* name,
|
|
9457
|
+
* instruments (
|
|
9458
|
+
* name
|
|
9459
|
+
* )
|
|
9460
|
+
* `)
|
|
9461
|
+
* ```
|
|
9462
|
+
*
|
|
9463
|
+
* @exampleSql Query referenced tables
|
|
9464
|
+
* ```sql
|
|
9465
|
+
* create table
|
|
9466
|
+
* orchestral_sections (id int8 primary key, name text);
|
|
9467
|
+
* create table
|
|
9468
|
+
* instruments (
|
|
9469
|
+
* id int8 primary key,
|
|
9470
|
+
* section_id int8 not null references orchestral_sections,
|
|
9471
|
+
* name text
|
|
9472
|
+
* );
|
|
9473
|
+
*
|
|
9474
|
+
* insert into
|
|
9475
|
+
* orchestral_sections (id, name)
|
|
9476
|
+
* values
|
|
9477
|
+
* (1, 'strings'),
|
|
9478
|
+
* (2, 'woodwinds');
|
|
9479
|
+
* insert into
|
|
9480
|
+
* instruments (id, section_id, name)
|
|
9481
|
+
* values
|
|
9482
|
+
* (1, 2, 'flute'),
|
|
9483
|
+
* (2, 1, 'violin');
|
|
9484
|
+
* ```
|
|
9485
|
+
*
|
|
9486
|
+
* @exampleResponse Query referenced tables
|
|
9487
|
+
* ```json
|
|
9488
|
+
* {
|
|
9489
|
+
* "data": [
|
|
9490
|
+
* {
|
|
9491
|
+
* "name": "strings",
|
|
9492
|
+
* "instruments": [
|
|
9493
|
+
* {
|
|
9494
|
+
* "name": "violin"
|
|
9495
|
+
* }
|
|
9496
|
+
* ]
|
|
9497
|
+
* },
|
|
9498
|
+
* {
|
|
9499
|
+
* "name": "woodwinds",
|
|
9500
|
+
* "instruments": [
|
|
9501
|
+
* {
|
|
9502
|
+
* "name": "flute"
|
|
9503
|
+
* }
|
|
9504
|
+
* ]
|
|
9505
|
+
* }
|
|
9506
|
+
* ],
|
|
9507
|
+
* "status": 200,
|
|
9508
|
+
* "statusText": "OK"
|
|
9509
|
+
* }
|
|
9510
|
+
* ```
|
|
9511
|
+
*
|
|
9512
|
+
* @exampleDescription Query referenced tables with spaces in their names
|
|
9513
|
+
* If your table name contains spaces, you must use double quotes in the `select` statement to reference the table.
|
|
9514
|
+
*
|
|
9515
|
+
* @example Query referenced tables with spaces in their names
|
|
9516
|
+
* ```js
|
|
9517
|
+
* const { data, error } = await supabase
|
|
9518
|
+
* .from('orchestral sections')
|
|
9519
|
+
* .select(`
|
|
9520
|
+
* name,
|
|
9521
|
+
* "musical instruments" (
|
|
9522
|
+
* name
|
|
9523
|
+
* )
|
|
9524
|
+
* `)
|
|
9525
|
+
* ```
|
|
9526
|
+
*
|
|
9527
|
+
* @exampleSql Query referenced tables with spaces in their names
|
|
9528
|
+
* ```sql
|
|
9529
|
+
* create table
|
|
9530
|
+
* "orchestral sections" (id int8 primary key, name text);
|
|
9531
|
+
* create table
|
|
9532
|
+
* "musical instruments" (
|
|
9533
|
+
* id int8 primary key,
|
|
9534
|
+
* section_id int8 not null references "orchestral sections",
|
|
9535
|
+
* name text
|
|
9536
|
+
* );
|
|
9537
|
+
*
|
|
9538
|
+
* insert into
|
|
9539
|
+
* "orchestral sections" (id, name)
|
|
9540
|
+
* values
|
|
9541
|
+
* (1, 'strings'),
|
|
9542
|
+
* (2, 'woodwinds');
|
|
9543
|
+
* insert into
|
|
9544
|
+
* "musical instruments" (id, section_id, name)
|
|
9545
|
+
* values
|
|
9546
|
+
* (1, 2, 'flute'),
|
|
9547
|
+
* (2, 1, 'violin');
|
|
9548
|
+
* ```
|
|
9549
|
+
*
|
|
9550
|
+
* @exampleResponse Query referenced tables with spaces in their names
|
|
9551
|
+
* ```json
|
|
9552
|
+
* {
|
|
9553
|
+
* "data": [
|
|
9554
|
+
* {
|
|
9555
|
+
* "name": "strings",
|
|
9556
|
+
* "musical instruments": [
|
|
9557
|
+
* {
|
|
9558
|
+
* "name": "violin"
|
|
9559
|
+
* }
|
|
9560
|
+
* ]
|
|
9561
|
+
* },
|
|
9562
|
+
* {
|
|
9563
|
+
* "name": "woodwinds",
|
|
9564
|
+
* "musical instruments": [
|
|
9565
|
+
* {
|
|
9566
|
+
* "name": "flute"
|
|
9567
|
+
* }
|
|
9568
|
+
* ]
|
|
9569
|
+
* }
|
|
9570
|
+
* ],
|
|
9571
|
+
* "status": 200,
|
|
9572
|
+
* "statusText": "OK"
|
|
9573
|
+
* }
|
|
9574
|
+
* ```
|
|
9575
|
+
*
|
|
9576
|
+
* @exampleDescription Query referenced tables through a join table
|
|
9577
|
+
* If you're in a situation where your tables are **NOT** directly
|
|
9578
|
+
* related, but instead are joined by a _join table_, you can still use
|
|
9579
|
+
* the `select()` method to query the related data. The join table needs
|
|
9580
|
+
* to have the foreign keys as part of its composite primary key.
|
|
9581
|
+
*
|
|
9582
|
+
* @example Query referenced tables through a join table
|
|
9583
|
+
* ```ts
|
|
9584
|
+
* const { data, error } = await supabase
|
|
9585
|
+
* .from('users')
|
|
9586
|
+
* .select(`
|
|
9587
|
+
* name,
|
|
9588
|
+
* teams (
|
|
9589
|
+
* name
|
|
9590
|
+
* )
|
|
9591
|
+
* `)
|
|
9592
|
+
*
|
|
9593
|
+
* ```
|
|
9594
|
+
*
|
|
9595
|
+
* @exampleSql Query referenced tables through a join table
|
|
9596
|
+
* ```sql
|
|
9597
|
+
* create table
|
|
9598
|
+
* users (
|
|
9599
|
+
* id int8 primary key,
|
|
9600
|
+
* name text
|
|
9601
|
+
* );
|
|
9602
|
+
* create table
|
|
9603
|
+
* teams (
|
|
9604
|
+
* id int8 primary key,
|
|
9605
|
+
* name text
|
|
9606
|
+
* );
|
|
9607
|
+
* -- join table
|
|
9608
|
+
* create table
|
|
9609
|
+
* users_teams (
|
|
9610
|
+
* user_id int8 not null references users,
|
|
9611
|
+
* team_id int8 not null references teams,
|
|
9612
|
+
* -- both foreign keys must be part of a composite primary key
|
|
9613
|
+
* primary key (user_id, team_id)
|
|
9614
|
+
* );
|
|
9615
|
+
*
|
|
9616
|
+
* insert into
|
|
9617
|
+
* users (id, name)
|
|
9618
|
+
* values
|
|
9619
|
+
* (1, 'Kiran'),
|
|
9620
|
+
* (2, 'Evan');
|
|
9621
|
+
* insert into
|
|
9622
|
+
* teams (id, name)
|
|
9623
|
+
* values
|
|
9624
|
+
* (1, 'Green'),
|
|
9625
|
+
* (2, 'Blue');
|
|
9626
|
+
* insert into
|
|
9627
|
+
* users_teams (user_id, team_id)
|
|
9628
|
+
* values
|
|
9629
|
+
* (1, 1),
|
|
9630
|
+
* (1, 2),
|
|
9631
|
+
* (2, 2);
|
|
9632
|
+
* ```
|
|
9633
|
+
*
|
|
9634
|
+
* @exampleResponse Query referenced tables through a join table
|
|
9635
|
+
* ```json
|
|
9636
|
+
* {
|
|
9637
|
+
* "data": [
|
|
9638
|
+
* {
|
|
9639
|
+
* "name": "Kiran",
|
|
9640
|
+
* "teams": [
|
|
9641
|
+
* {
|
|
9642
|
+
* "name": "Green"
|
|
9643
|
+
* },
|
|
9644
|
+
* {
|
|
9645
|
+
* "name": "Blue"
|
|
9646
|
+
* }
|
|
9647
|
+
* ]
|
|
9648
|
+
* },
|
|
9649
|
+
* {
|
|
9650
|
+
* "name": "Evan",
|
|
9651
|
+
* "teams": [
|
|
9652
|
+
* {
|
|
9653
|
+
* "name": "Blue"
|
|
9654
|
+
* }
|
|
9655
|
+
* ]
|
|
9656
|
+
* }
|
|
9657
|
+
* ],
|
|
9658
|
+
* "status": 200,
|
|
9659
|
+
* "statusText": "OK"
|
|
9660
|
+
* }
|
|
9661
|
+
*
|
|
9662
|
+
* ```
|
|
9663
|
+
*
|
|
9664
|
+
* @exampleDescription Query the same referenced table multiple times
|
|
9665
|
+
* If you need to query the same referenced table twice, use the name of the
|
|
9666
|
+
* joined column to identify which join to use. You can also give each
|
|
9667
|
+
* column an alias.
|
|
9668
|
+
*
|
|
9669
|
+
* @example Query the same referenced table multiple times
|
|
9670
|
+
* ```ts
|
|
9671
|
+
* const { data, error } = await supabase
|
|
9672
|
+
* .from('messages')
|
|
9673
|
+
* .select(`
|
|
9674
|
+
* content,
|
|
9675
|
+
* from:sender_id(name),
|
|
9676
|
+
* to:receiver_id(name)
|
|
9677
|
+
* `)
|
|
9678
|
+
*
|
|
9679
|
+
* // To infer types, use the name of the table (in this case `users`) and
|
|
9680
|
+
* // the name of the foreign key constraint.
|
|
9681
|
+
* const { data, error } = await supabase
|
|
9682
|
+
* .from('messages')
|
|
9683
|
+
* .select(`
|
|
9684
|
+
* content,
|
|
9685
|
+
* from:users!messages_sender_id_fkey(name),
|
|
9686
|
+
* to:users!messages_receiver_id_fkey(name)
|
|
9687
|
+
* `)
|
|
9688
|
+
* ```
|
|
9689
|
+
*
|
|
9690
|
+
* @exampleSql Query the same referenced table multiple times
|
|
9691
|
+
* ```sql
|
|
9692
|
+
* create table
|
|
9693
|
+
* users (id int8 primary key, name text);
|
|
9694
|
+
*
|
|
9695
|
+
* create table
|
|
9696
|
+
* messages (
|
|
9697
|
+
* sender_id int8 not null references users,
|
|
9698
|
+
* receiver_id int8 not null references users,
|
|
9699
|
+
* content text
|
|
9700
|
+
* );
|
|
9701
|
+
*
|
|
9702
|
+
* insert into
|
|
9703
|
+
* users (id, name)
|
|
9704
|
+
* values
|
|
9705
|
+
* (1, 'Kiran'),
|
|
9706
|
+
* (2, 'Evan');
|
|
9707
|
+
*
|
|
9708
|
+
* insert into
|
|
9709
|
+
* messages (sender_id, receiver_id, content)
|
|
9710
|
+
* values
|
|
9711
|
+
* (1, 2, '👋');
|
|
9712
|
+
* ```
|
|
9713
|
+
* ```
|
|
9714
|
+
*
|
|
9715
|
+
* @exampleResponse Query the same referenced table multiple times
|
|
9716
|
+
* ```json
|
|
9717
|
+
* {
|
|
9718
|
+
* "data": [
|
|
9719
|
+
* {
|
|
9720
|
+
* "content": "👋",
|
|
9721
|
+
* "from": {
|
|
9722
|
+
* "name": "Kiran"
|
|
9723
|
+
* },
|
|
9724
|
+
* "to": {
|
|
9725
|
+
* "name": "Evan"
|
|
9726
|
+
* }
|
|
9727
|
+
* }
|
|
9728
|
+
* ],
|
|
9729
|
+
* "status": 200,
|
|
9730
|
+
* "statusText": "OK"
|
|
9731
|
+
* }
|
|
9732
|
+
* ```
|
|
9733
|
+
*
|
|
9734
|
+
* @exampleDescription Query nested foreign tables through a join table
|
|
9735
|
+
* You can use the result of a joined table to gather data in
|
|
9736
|
+
* another foreign table. With multiple references to the same foreign
|
|
9737
|
+
* table you must specify the column on which to conduct the join.
|
|
9738
|
+
*
|
|
9739
|
+
* @example Query nested foreign tables through a join table
|
|
9740
|
+
* ```ts
|
|
9741
|
+
* const { data, error } = await supabase
|
|
9742
|
+
* .from('games')
|
|
9743
|
+
* .select(`
|
|
9744
|
+
* game_id:id,
|
|
9745
|
+
* away_team:teams!games_away_team_fkey (
|
|
9746
|
+
* users (
|
|
9747
|
+
* id,
|
|
9748
|
+
* name
|
|
9749
|
+
* )
|
|
9750
|
+
* )
|
|
9751
|
+
* `)
|
|
9752
|
+
*
|
|
9753
|
+
* ```
|
|
9754
|
+
*
|
|
9755
|
+
* @exampleSql Query nested foreign tables through a join table
|
|
9756
|
+
* ```sql
|
|
9757
|
+
* ```sql
|
|
9758
|
+
* create table
|
|
9759
|
+
* users (
|
|
9760
|
+
* id int8 primary key,
|
|
9761
|
+
* name text
|
|
9762
|
+
* );
|
|
9763
|
+
* create table
|
|
9764
|
+
* teams (
|
|
9765
|
+
* id int8 primary key,
|
|
9766
|
+
* name text
|
|
9767
|
+
* );
|
|
9768
|
+
* -- join table
|
|
9769
|
+
* create table
|
|
9770
|
+
* users_teams (
|
|
9771
|
+
* user_id int8 not null references users,
|
|
9772
|
+
* team_id int8 not null references teams,
|
|
9773
|
+
*
|
|
9774
|
+
* primary key (user_id, team_id)
|
|
9775
|
+
* );
|
|
9776
|
+
* create table
|
|
9777
|
+
* games (
|
|
9778
|
+
* id int8 primary key,
|
|
9779
|
+
* home_team int8 not null references teams,
|
|
9780
|
+
* away_team int8 not null references teams,
|
|
9781
|
+
* name text
|
|
9782
|
+
* );
|
|
9783
|
+
*
|
|
9784
|
+
* insert into users (id, name)
|
|
9785
|
+
* values
|
|
9786
|
+
* (1, 'Kiran'),
|
|
9787
|
+
* (2, 'Evan');
|
|
9788
|
+
* insert into
|
|
9789
|
+
* teams (id, name)
|
|
9790
|
+
* values
|
|
9791
|
+
* (1, 'Green'),
|
|
9792
|
+
* (2, 'Blue');
|
|
9793
|
+
* insert into
|
|
9794
|
+
* users_teams (user_id, team_id)
|
|
9795
|
+
* values
|
|
9796
|
+
* (1, 1),
|
|
9797
|
+
* (1, 2),
|
|
9798
|
+
* (2, 2);
|
|
9799
|
+
* insert into
|
|
9800
|
+
* games (id, home_team, away_team, name)
|
|
9801
|
+
* values
|
|
9802
|
+
* (1, 1, 2, 'Green vs Blue'),
|
|
9803
|
+
* (2, 2, 1, 'Blue vs Green');
|
|
9804
|
+
* ```
|
|
9805
|
+
*
|
|
9806
|
+
* @exampleResponse Query nested foreign tables through a join table
|
|
9807
|
+
* ```json
|
|
9808
|
+
* {
|
|
9809
|
+
* "data": [
|
|
9810
|
+
* {
|
|
9811
|
+
* "game_id": 1,
|
|
9812
|
+
* "away_team": {
|
|
9813
|
+
* "users": [
|
|
9814
|
+
* {
|
|
9815
|
+
* "id": 1,
|
|
9816
|
+
* "name": "Kiran"
|
|
9817
|
+
* },
|
|
9818
|
+
* {
|
|
9819
|
+
* "id": 2,
|
|
9820
|
+
* "name": "Evan"
|
|
9821
|
+
* }
|
|
9822
|
+
* ]
|
|
9823
|
+
* }
|
|
9824
|
+
* },
|
|
9825
|
+
* {
|
|
9826
|
+
* "game_id": 2,
|
|
9827
|
+
* "away_team": {
|
|
9828
|
+
* "users": [
|
|
9829
|
+
* {
|
|
9830
|
+
* "id": 1,
|
|
9831
|
+
* "name": "Kiran"
|
|
9832
|
+
* }
|
|
9833
|
+
* ]
|
|
9834
|
+
* }
|
|
9835
|
+
* }
|
|
9836
|
+
* ],
|
|
9837
|
+
* "status": 200,
|
|
9838
|
+
* "statusText": "OK"
|
|
9839
|
+
* }
|
|
9840
|
+
*
|
|
9841
|
+
* ```
|
|
9842
|
+
*
|
|
9843
|
+
* @exampleDescription Filtering through referenced tables
|
|
9844
|
+
* If the filter on a referenced table's column is not satisfied, the referenced
|
|
9845
|
+
* table returns `[]` or `null` but the parent table is not filtered out.
|
|
9846
|
+
* If you want to filter out the parent table rows, use the `!inner` hint
|
|
9847
|
+
*
|
|
9848
|
+
* @example Filtering through referenced tables
|
|
9849
|
+
* ```ts
|
|
9850
|
+
* const { data, error } = await supabase
|
|
9851
|
+
* .from('instruments')
|
|
9852
|
+
* .select('name, orchestral_sections(*)')
|
|
9853
|
+
* .eq('orchestral_sections.name', 'percussion')
|
|
9854
|
+
* ```
|
|
9855
|
+
*
|
|
9856
|
+
* @exampleSql Filtering through referenced tables
|
|
9857
|
+
* ```sql
|
|
9858
|
+
* create table
|
|
9859
|
+
* orchestral_sections (id int8 primary key, name text);
|
|
9860
|
+
* create table
|
|
9861
|
+
* instruments (
|
|
9862
|
+
* id int8 primary key,
|
|
9863
|
+
* section_id int8 not null references orchestral_sections,
|
|
9864
|
+
* name text
|
|
9865
|
+
* );
|
|
9866
|
+
*
|
|
9867
|
+
* insert into
|
|
9868
|
+
* orchestral_sections (id, name)
|
|
9869
|
+
* values
|
|
9870
|
+
* (1, 'strings'),
|
|
9871
|
+
* (2, 'woodwinds');
|
|
9872
|
+
* insert into
|
|
9873
|
+
* instruments (id, section_id, name)
|
|
9874
|
+
* values
|
|
9875
|
+
* (1, 2, 'flute'),
|
|
9876
|
+
* (2, 1, 'violin');
|
|
9877
|
+
* ```
|
|
9878
|
+
*
|
|
9879
|
+
* @exampleResponse Filtering through referenced tables
|
|
9880
|
+
* ```json
|
|
9881
|
+
* {
|
|
9882
|
+
* "data": [
|
|
9883
|
+
* {
|
|
9884
|
+
* "name": "flute",
|
|
9885
|
+
* "orchestral_sections": null
|
|
9886
|
+
* },
|
|
9887
|
+
* {
|
|
9888
|
+
* "name": "violin",
|
|
9889
|
+
* "orchestral_sections": null
|
|
9890
|
+
* }
|
|
9891
|
+
* ],
|
|
9892
|
+
* "status": 200,
|
|
9893
|
+
* "statusText": "OK"
|
|
9894
|
+
* }
|
|
9895
|
+
* ```
|
|
9896
|
+
*
|
|
9897
|
+
* @exampleDescription Querying referenced table with count
|
|
9898
|
+
* You can get the number of rows in a related table by using the
|
|
9899
|
+
* **count** property.
|
|
9900
|
+
*
|
|
9901
|
+
* @example Querying referenced table with count
|
|
9902
|
+
* ```ts
|
|
9903
|
+
* const { data, error } = await supabase
|
|
9904
|
+
* .from('orchestral_sections')
|
|
9905
|
+
* .select(`*, instruments(count)`)
|
|
9906
|
+
* ```
|
|
9907
|
+
*
|
|
9908
|
+
* @exampleSql Querying referenced table with count
|
|
9909
|
+
* ```sql
|
|
9910
|
+
* create table orchestral_sections (
|
|
9911
|
+
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
9912
|
+
* "name" text
|
|
9913
|
+
* );
|
|
9914
|
+
*
|
|
9915
|
+
* create table characters (
|
|
9916
|
+
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
9917
|
+
* "name" text,
|
|
9918
|
+
* "section_id" "uuid" references public.orchestral_sections on delete cascade
|
|
9919
|
+
* );
|
|
9920
|
+
*
|
|
9921
|
+
* with section as (
|
|
9922
|
+
* insert into orchestral_sections (name)
|
|
9923
|
+
* values ('strings') returning id
|
|
9924
|
+
* )
|
|
9925
|
+
* insert into instruments (name, section_id) values
|
|
9926
|
+
* ('violin', (select id from section)),
|
|
9927
|
+
* ('viola', (select id from section)),
|
|
9928
|
+
* ('cello', (select id from section)),
|
|
9929
|
+
* ('double bass', (select id from section));
|
|
9930
|
+
* ```
|
|
9931
|
+
*
|
|
9932
|
+
* @exampleResponse Querying referenced table with count
|
|
9933
|
+
* ```json
|
|
9934
|
+
* [
|
|
9935
|
+
* {
|
|
9936
|
+
* "id": "693694e7-d993-4360-a6d7-6294e325d9b6",
|
|
9937
|
+
* "name": "strings",
|
|
9938
|
+
* "instruments": [
|
|
9939
|
+
* {
|
|
9940
|
+
* "count": 4
|
|
9941
|
+
* }
|
|
9942
|
+
* ]
|
|
9943
|
+
* }
|
|
9944
|
+
* ]
|
|
9945
|
+
* ```
|
|
9946
|
+
*
|
|
9947
|
+
* @exampleDescription Querying with count option
|
|
9948
|
+
* You can get the number of rows by using the
|
|
9949
|
+
* [count](/docs/reference/javascript/select#parameters) option.
|
|
9950
|
+
*
|
|
9951
|
+
* @example Querying with count option
|
|
9952
|
+
* ```ts
|
|
9953
|
+
* const { count, error } = await supabase
|
|
9954
|
+
* .from('characters')
|
|
9955
|
+
* .select('*', { count: 'exact', head: true })
|
|
9956
|
+
* ```
|
|
9957
|
+
*
|
|
9958
|
+
* @exampleSql Querying with count option
|
|
9959
|
+
* ```sql
|
|
9960
|
+
* create table
|
|
9961
|
+
* characters (id int8 primary key, name text);
|
|
9962
|
+
*
|
|
9963
|
+
* insert into
|
|
9964
|
+
* characters (id, name)
|
|
9965
|
+
* values
|
|
9966
|
+
* (1, 'Luke'),
|
|
9967
|
+
* (2, 'Leia'),
|
|
9968
|
+
* (3, 'Han');
|
|
9969
|
+
* ```
|
|
9970
|
+
*
|
|
9971
|
+
* @exampleResponse Querying with count option
|
|
9972
|
+
* ```json
|
|
9973
|
+
* {
|
|
9974
|
+
* "count": 3,
|
|
9975
|
+
* "status": 200,
|
|
9976
|
+
* "statusText": "OK"
|
|
9977
|
+
* }
|
|
9978
|
+
* ```
|
|
9979
|
+
*
|
|
9980
|
+
* @exampleDescription Querying JSON data
|
|
9981
|
+
* You can select and filter data inside of
|
|
9982
|
+
* [JSON](/docs/guides/database/json) columns. Postgres offers some
|
|
9983
|
+
* [operators](/docs/guides/database/json#query-the-jsonb-data) for
|
|
9984
|
+
* querying JSON data.
|
|
9985
|
+
*
|
|
9986
|
+
* @example Querying JSON data
|
|
9987
|
+
* ```ts
|
|
9988
|
+
* const { data, error } = await supabase
|
|
9989
|
+
* .from('users')
|
|
9990
|
+
* .select(`
|
|
9991
|
+
* id, name,
|
|
9992
|
+
* address->city
|
|
9993
|
+
* `)
|
|
9994
|
+
* ```
|
|
9995
|
+
*
|
|
9996
|
+
* @exampleSql Querying JSON data
|
|
9997
|
+
* ```sql
|
|
9998
|
+
* create table
|
|
9999
|
+
* users (
|
|
10000
|
+
* id int8 primary key,
|
|
10001
|
+
* name text,
|
|
10002
|
+
* address jsonb
|
|
10003
|
+
* );
|
|
10004
|
+
*
|
|
10005
|
+
* insert into
|
|
10006
|
+
* users (id, name, address)
|
|
10007
|
+
* values
|
|
10008
|
+
* (1, 'Frodo', '{"city":"Hobbiton"}');
|
|
10009
|
+
* ```
|
|
10010
|
+
*
|
|
10011
|
+
* @exampleResponse Querying JSON data
|
|
10012
|
+
* ```json
|
|
10013
|
+
* {
|
|
10014
|
+
* "data": [
|
|
10015
|
+
* {
|
|
10016
|
+
* "id": 1,
|
|
10017
|
+
* "name": "Frodo",
|
|
10018
|
+
* "city": "Hobbiton"
|
|
10019
|
+
* }
|
|
10020
|
+
* ],
|
|
10021
|
+
* "status": 200,
|
|
10022
|
+
* "statusText": "OK"
|
|
10023
|
+
* }
|
|
10024
|
+
* ```
|
|
10025
|
+
*
|
|
10026
|
+
* @exampleDescription Querying referenced table with inner join
|
|
10027
|
+
* If you don't want to return the referenced table contents, you can leave the parenthesis empty.
|
|
10028
|
+
* Like `.select('name, orchestral_sections!inner()')`.
|
|
10029
|
+
*
|
|
10030
|
+
* @example Querying referenced table with inner join
|
|
10031
|
+
* ```ts
|
|
10032
|
+
* const { data, error } = await supabase
|
|
10033
|
+
* .from('instruments')
|
|
10034
|
+
* .select('name, orchestral_sections!inner(name)')
|
|
10035
|
+
* .eq('orchestral_sections.name', 'woodwinds')
|
|
10036
|
+
* .limit(1)
|
|
10037
|
+
* ```
|
|
10038
|
+
*
|
|
10039
|
+
* @exampleSql Querying referenced table with inner join
|
|
10040
|
+
* ```sql
|
|
10041
|
+
* create table orchestral_sections (
|
|
10042
|
+
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
10043
|
+
* "name" text
|
|
10044
|
+
* );
|
|
10045
|
+
*
|
|
10046
|
+
* create table instruments (
|
|
10047
|
+
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
10048
|
+
* "name" text,
|
|
10049
|
+
* "section_id" "uuid" references public.orchestral_sections on delete cascade
|
|
10050
|
+
* );
|
|
10051
|
+
*
|
|
10052
|
+
* with section as (
|
|
10053
|
+
* insert into orchestral_sections (name)
|
|
10054
|
+
* values ('woodwinds') returning id
|
|
10055
|
+
* )
|
|
10056
|
+
* insert into instruments (name, section_id) values
|
|
10057
|
+
* ('flute', (select id from section)),
|
|
10058
|
+
* ('clarinet', (select id from section)),
|
|
10059
|
+
* ('bassoon', (select id from section)),
|
|
10060
|
+
* ('piccolo', (select id from section));
|
|
10061
|
+
* ```
|
|
10062
|
+
*
|
|
10063
|
+
* @exampleResponse Querying referenced table with inner join
|
|
10064
|
+
* ```json
|
|
10065
|
+
* {
|
|
10066
|
+
* "data": [
|
|
10067
|
+
* {
|
|
10068
|
+
* "name": "flute",
|
|
10069
|
+
* "orchestral_sections": {"name": "woodwinds"}
|
|
10070
|
+
* }
|
|
10071
|
+
* ],
|
|
10072
|
+
* "status": 200,
|
|
10073
|
+
* "statusText": "OK"
|
|
10074
|
+
* }
|
|
10075
|
+
* ```
|
|
10076
|
+
*
|
|
10077
|
+
* @exampleDescription Switching schemas per query
|
|
10078
|
+
* In addition to setting the schema during initialization, you can also switch schemas on a per-query basis.
|
|
10079
|
+
* Make sure you've set up your [database privileges and API settings](/docs/guides/api/using-custom-schemas).
|
|
10080
|
+
*
|
|
10081
|
+
* @example Switching schemas per query
|
|
10082
|
+
* ```ts
|
|
10083
|
+
* const { data, error } = await supabase
|
|
10084
|
+
* .schema('myschema')
|
|
10085
|
+
* .from('mytable')
|
|
10086
|
+
* .select()
|
|
10087
|
+
* ```
|
|
10088
|
+
*
|
|
10089
|
+
* @exampleSql Switching schemas per query
|
|
10090
|
+
* ```sql
|
|
10091
|
+
* create schema myschema;
|
|
10092
|
+
*
|
|
10093
|
+
* create table myschema.mytable (
|
|
10094
|
+
* id uuid primary key default gen_random_uuid(),
|
|
10095
|
+
* data text
|
|
10096
|
+
* );
|
|
10097
|
+
*
|
|
10098
|
+
* insert into myschema.mytable (data) values ('mydata');
|
|
10099
|
+
* ```
|
|
10100
|
+
*
|
|
10101
|
+
* @exampleResponse Switching schemas per query
|
|
10102
|
+
* ```json
|
|
10103
|
+
* {
|
|
10104
|
+
* "data": [
|
|
10105
|
+
* {
|
|
10106
|
+
* "id": "4162e008-27b0-4c0f-82dc-ccaeee9a624d",
|
|
10107
|
+
* "data": "mydata"
|
|
10108
|
+
* }
|
|
10109
|
+
* ],
|
|
10110
|
+
* "status": 200,
|
|
10111
|
+
* "statusText": "OK"
|
|
10112
|
+
* }
|
|
10113
|
+
* ```
|
|
9357
10114
|
*/
|
|
9358
10115
|
select(columns, options) {
|
|
9359
10116
|
const { head: head2 = false, count } = options !== null && options !== void 0 ? options : {};
|
|
@@ -9401,6 +10158,91 @@ ${cause.stack}`;
|
|
|
9401
10158
|
* @param options.defaultToNull - Make missing fields default to `null`.
|
|
9402
10159
|
* Otherwise, use the default value for the column. Only applies for bulk
|
|
9403
10160
|
* inserts.
|
|
10161
|
+
*
|
|
10162
|
+
* @category Database
|
|
10163
|
+
*
|
|
10164
|
+
* @example Create a record
|
|
10165
|
+
* ```ts
|
|
10166
|
+
* const { error } = await supabase
|
|
10167
|
+
* .from('countries')
|
|
10168
|
+
* .insert({ id: 1, name: 'Mordor' })
|
|
10169
|
+
* ```
|
|
10170
|
+
*
|
|
10171
|
+
* @exampleSql Create a record
|
|
10172
|
+
* ```sql
|
|
10173
|
+
* create table
|
|
10174
|
+
* countries (id int8 primary key, name text);
|
|
10175
|
+
* ```
|
|
10176
|
+
*
|
|
10177
|
+
* @exampleResponse Create a record
|
|
10178
|
+
* ```json
|
|
10179
|
+
* {
|
|
10180
|
+
* "status": 201,
|
|
10181
|
+
* "statusText": "Created"
|
|
10182
|
+
* }
|
|
10183
|
+
* ```
|
|
10184
|
+
*
|
|
10185
|
+
* @example Create a record and return it
|
|
10186
|
+
* ```ts
|
|
10187
|
+
* const { data, error } = await supabase
|
|
10188
|
+
* .from('countries')
|
|
10189
|
+
* .insert({ id: 1, name: 'Mordor' })
|
|
10190
|
+
* .select()
|
|
10191
|
+
* ```
|
|
10192
|
+
*
|
|
10193
|
+
* @exampleSql Create a record and return it
|
|
10194
|
+
* ```sql
|
|
10195
|
+
* create table
|
|
10196
|
+
* countries (id int8 primary key, name text);
|
|
10197
|
+
* ```
|
|
10198
|
+
*
|
|
10199
|
+
* @exampleResponse Create a record and return it
|
|
10200
|
+
* ```json
|
|
10201
|
+
* {
|
|
10202
|
+
* "data": [
|
|
10203
|
+
* {
|
|
10204
|
+
* "id": 1,
|
|
10205
|
+
* "name": "Mordor"
|
|
10206
|
+
* }
|
|
10207
|
+
* ],
|
|
10208
|
+
* "status": 201,
|
|
10209
|
+
* "statusText": "Created"
|
|
10210
|
+
* }
|
|
10211
|
+
* ```
|
|
10212
|
+
*
|
|
10213
|
+
* @exampleDescription Bulk create
|
|
10214
|
+
* A bulk create operation is handled in a single transaction.
|
|
10215
|
+
* If any of the inserts fail, none of the rows are inserted.
|
|
10216
|
+
*
|
|
10217
|
+
* @example Bulk create
|
|
10218
|
+
* ```ts
|
|
10219
|
+
* const { error } = await supabase
|
|
10220
|
+
* .from('countries')
|
|
10221
|
+
* .insert([
|
|
10222
|
+
* { id: 1, name: 'Mordor' },
|
|
10223
|
+
* { id: 1, name: 'The Shire' },
|
|
10224
|
+
* ])
|
|
10225
|
+
* ```
|
|
10226
|
+
*
|
|
10227
|
+
* @exampleSql Bulk create
|
|
10228
|
+
* ```sql
|
|
10229
|
+
* create table
|
|
10230
|
+
* countries (id int8 primary key, name text);
|
|
10231
|
+
* ```
|
|
10232
|
+
*
|
|
10233
|
+
* @exampleResponse Bulk create
|
|
10234
|
+
* ```json
|
|
10235
|
+
* {
|
|
10236
|
+
* "error": {
|
|
10237
|
+
* "code": "23505",
|
|
10238
|
+
* "details": "Key (id)=(1) already exists.",
|
|
10239
|
+
* "hint": null,
|
|
10240
|
+
* "message": "duplicate key value violates unique constraint \"countries_pkey\""
|
|
10241
|
+
* },
|
|
10242
|
+
* "status": 409,
|
|
10243
|
+
* "statusText": "Conflict"
|
|
10244
|
+
* }
|
|
10245
|
+
* ```
|
|
9404
10246
|
*/
|
|
9405
10247
|
insert(values, { count, defaultToNull = true } = {}) {
|
|
9406
10248
|
var _this$fetch;
|
|
@@ -9509,6 +10351,129 @@ ${cause.stack}`;
|
|
|
9509
10351
|
* // error: null
|
|
9510
10352
|
* // }
|
|
9511
10353
|
* ```
|
|
10354
|
+
*
|
|
10355
|
+
* @category Database
|
|
10356
|
+
*
|
|
10357
|
+
* @remarks
|
|
10358
|
+
* - Primary keys must be included in `values` to use upsert.
|
|
10359
|
+
*
|
|
10360
|
+
* @example Upsert your data
|
|
10361
|
+
* ```ts
|
|
10362
|
+
* const { data, error } = await supabase
|
|
10363
|
+
* .from('instruments')
|
|
10364
|
+
* .upsert({ id: 1, name: 'piano' })
|
|
10365
|
+
* .select()
|
|
10366
|
+
* ```
|
|
10367
|
+
*
|
|
10368
|
+
* @exampleSql Upsert your data
|
|
10369
|
+
* ```sql
|
|
10370
|
+
* create table
|
|
10371
|
+
* instruments (id int8 primary key, name text);
|
|
10372
|
+
*
|
|
10373
|
+
* insert into
|
|
10374
|
+
* instruments (id, name)
|
|
10375
|
+
* values
|
|
10376
|
+
* (1, 'harpsichord');
|
|
10377
|
+
* ```
|
|
10378
|
+
*
|
|
10379
|
+
* @exampleResponse Upsert your data
|
|
10380
|
+
* ```json
|
|
10381
|
+
* {
|
|
10382
|
+
* "data": [
|
|
10383
|
+
* {
|
|
10384
|
+
* "id": 1,
|
|
10385
|
+
* "name": "piano"
|
|
10386
|
+
* }
|
|
10387
|
+
* ],
|
|
10388
|
+
* "status": 201,
|
|
10389
|
+
* "statusText": "Created"
|
|
10390
|
+
* }
|
|
10391
|
+
* ```
|
|
10392
|
+
*
|
|
10393
|
+
* @example Bulk Upsert your data
|
|
10394
|
+
* ```ts
|
|
10395
|
+
* const { data, error } = await supabase
|
|
10396
|
+
* .from('instruments')
|
|
10397
|
+
* .upsert([
|
|
10398
|
+
* { id: 1, name: 'piano' },
|
|
10399
|
+
* { id: 2, name: 'harp' },
|
|
10400
|
+
* ])
|
|
10401
|
+
* .select()
|
|
10402
|
+
* ```
|
|
10403
|
+
*
|
|
10404
|
+
* @exampleSql Bulk Upsert your data
|
|
10405
|
+
* ```sql
|
|
10406
|
+
* create table
|
|
10407
|
+
* instruments (id int8 primary key, name text);
|
|
10408
|
+
*
|
|
10409
|
+
* insert into
|
|
10410
|
+
* instruments (id, name)
|
|
10411
|
+
* values
|
|
10412
|
+
* (1, 'harpsichord');
|
|
10413
|
+
* ```
|
|
10414
|
+
*
|
|
10415
|
+
* @exampleResponse Bulk Upsert your data
|
|
10416
|
+
* ```json
|
|
10417
|
+
* {
|
|
10418
|
+
* "data": [
|
|
10419
|
+
* {
|
|
10420
|
+
* "id": 1,
|
|
10421
|
+
* "name": "piano"
|
|
10422
|
+
* },
|
|
10423
|
+
* {
|
|
10424
|
+
* "id": 2,
|
|
10425
|
+
* "name": "harp"
|
|
10426
|
+
* }
|
|
10427
|
+
* ],
|
|
10428
|
+
* "status": 201,
|
|
10429
|
+
* "statusText": "Created"
|
|
10430
|
+
* }
|
|
10431
|
+
* ```
|
|
10432
|
+
*
|
|
10433
|
+
* @exampleDescription Upserting into tables with constraints
|
|
10434
|
+
* In the following query, `upsert()` implicitly uses the `id`
|
|
10435
|
+
* (primary key) column to determine conflicts. If there is no existing
|
|
10436
|
+
* row with the same `id`, `upsert()` inserts a new row, which
|
|
10437
|
+
* will fail in this case as there is already a row with `handle` `"saoirse"`.
|
|
10438
|
+
* Using the `onConflict` option, you can instruct `upsert()` to use
|
|
10439
|
+
* another column with a unique constraint to determine conflicts.
|
|
10440
|
+
*
|
|
10441
|
+
* @example Upserting into tables with constraints
|
|
10442
|
+
* ```ts
|
|
10443
|
+
* const { data, error } = await supabase
|
|
10444
|
+
* .from('users')
|
|
10445
|
+
* .upsert({ id: 42, handle: 'saoirse', display_name: 'Saoirse' })
|
|
10446
|
+
* .select()
|
|
10447
|
+
* ```
|
|
10448
|
+
*
|
|
10449
|
+
* @exampleSql Upserting into tables with constraints
|
|
10450
|
+
* ```sql
|
|
10451
|
+
* create table
|
|
10452
|
+
* users (
|
|
10453
|
+
* id int8 generated by default as identity primary key,
|
|
10454
|
+
* handle text not null unique,
|
|
10455
|
+
* display_name text
|
|
10456
|
+
* );
|
|
10457
|
+
*
|
|
10458
|
+
* insert into
|
|
10459
|
+
* users (id, handle, display_name)
|
|
10460
|
+
* values
|
|
10461
|
+
* (1, 'saoirse', null);
|
|
10462
|
+
* ```
|
|
10463
|
+
*
|
|
10464
|
+
* @exampleResponse Upserting into tables with constraints
|
|
10465
|
+
* ```json
|
|
10466
|
+
* {
|
|
10467
|
+
* "error": {
|
|
10468
|
+
* "code": "23505",
|
|
10469
|
+
* "details": "Key (handle)=(saoirse) already exists.",
|
|
10470
|
+
* "hint": null,
|
|
10471
|
+
* "message": "duplicate key value violates unique constraint \"users_handle_key\""
|
|
10472
|
+
* },
|
|
10473
|
+
* "status": 409,
|
|
10474
|
+
* "statusText": "Conflict"
|
|
10475
|
+
* }
|
|
10476
|
+
* ```
|
|
9512
10477
|
*/
|
|
9513
10478
|
upsert(values, { onConflict, ignoreDuplicates = false, count, defaultToNull = true } = {}) {
|
|
9514
10479
|
var _this$fetch2;
|
|
@@ -9555,6 +10520,124 @@ ${cause.stack}`;
|
|
|
9555
10520
|
*
|
|
9556
10521
|
* `"estimated"`: Uses exact count for low numbers and planned count for high
|
|
9557
10522
|
* numbers.
|
|
10523
|
+
*
|
|
10524
|
+
* @category Database
|
|
10525
|
+
*
|
|
10526
|
+
* @remarks
|
|
10527
|
+
* - `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update.
|
|
10528
|
+
*
|
|
10529
|
+
* @example Updating your data
|
|
10530
|
+
* ```ts
|
|
10531
|
+
* const { error } = await supabase
|
|
10532
|
+
* .from('instruments')
|
|
10533
|
+
* .update({ name: 'piano' })
|
|
10534
|
+
* .eq('id', 1)
|
|
10535
|
+
* ```
|
|
10536
|
+
*
|
|
10537
|
+
* @exampleSql Updating your data
|
|
10538
|
+
* ```sql
|
|
10539
|
+
* create table
|
|
10540
|
+
* instruments (id int8 primary key, name text);
|
|
10541
|
+
*
|
|
10542
|
+
* insert into
|
|
10543
|
+
* instruments (id, name)
|
|
10544
|
+
* values
|
|
10545
|
+
* (1, 'harpsichord');
|
|
10546
|
+
* ```
|
|
10547
|
+
*
|
|
10548
|
+
* @exampleResponse Updating your data
|
|
10549
|
+
* ```json
|
|
10550
|
+
* {
|
|
10551
|
+
* "status": 204,
|
|
10552
|
+
* "statusText": "No Content"
|
|
10553
|
+
* }
|
|
10554
|
+
* ```
|
|
10555
|
+
*
|
|
10556
|
+
* @example Update a record and return it
|
|
10557
|
+
* ```ts
|
|
10558
|
+
* const { data, error } = await supabase
|
|
10559
|
+
* .from('instruments')
|
|
10560
|
+
* .update({ name: 'piano' })
|
|
10561
|
+
* .eq('id', 1)
|
|
10562
|
+
* .select()
|
|
10563
|
+
* ```
|
|
10564
|
+
*
|
|
10565
|
+
* @exampleSql Update a record and return it
|
|
10566
|
+
* ```sql
|
|
10567
|
+
* create table
|
|
10568
|
+
* instruments (id int8 primary key, name text);
|
|
10569
|
+
*
|
|
10570
|
+
* insert into
|
|
10571
|
+
* instruments (id, name)
|
|
10572
|
+
* values
|
|
10573
|
+
* (1, 'harpsichord');
|
|
10574
|
+
* ```
|
|
10575
|
+
*
|
|
10576
|
+
* @exampleResponse Update a record and return it
|
|
10577
|
+
* ```json
|
|
10578
|
+
* {
|
|
10579
|
+
* "data": [
|
|
10580
|
+
* {
|
|
10581
|
+
* "id": 1,
|
|
10582
|
+
* "name": "piano"
|
|
10583
|
+
* }
|
|
10584
|
+
* ],
|
|
10585
|
+
* "status": 200,
|
|
10586
|
+
* "statusText": "OK"
|
|
10587
|
+
* }
|
|
10588
|
+
* ```
|
|
10589
|
+
*
|
|
10590
|
+
* @exampleDescription Updating JSON data
|
|
10591
|
+
* Postgres offers some
|
|
10592
|
+
* [operators](/docs/guides/database/json#query-the-jsonb-data) for
|
|
10593
|
+
* working with JSON data. Currently, it is only possible to update the entire JSON document.
|
|
10594
|
+
*
|
|
10595
|
+
* @example Updating JSON data
|
|
10596
|
+
* ```ts
|
|
10597
|
+
* const { data, error } = await supabase
|
|
10598
|
+
* .from('users')
|
|
10599
|
+
* .update({
|
|
10600
|
+
* address: {
|
|
10601
|
+
* street: 'Melrose Place',
|
|
10602
|
+
* postcode: 90210
|
|
10603
|
+
* }
|
|
10604
|
+
* })
|
|
10605
|
+
* .eq('address->postcode', 90210)
|
|
10606
|
+
* .select()
|
|
10607
|
+
* ```
|
|
10608
|
+
*
|
|
10609
|
+
* @exampleSql Updating JSON data
|
|
10610
|
+
* ```sql
|
|
10611
|
+
* create table
|
|
10612
|
+
* users (
|
|
10613
|
+
* id int8 primary key,
|
|
10614
|
+
* name text,
|
|
10615
|
+
* address jsonb
|
|
10616
|
+
* );
|
|
10617
|
+
*
|
|
10618
|
+
* insert into
|
|
10619
|
+
* users (id, name, address)
|
|
10620
|
+
* values
|
|
10621
|
+
* (1, 'Michael', '{ "postcode": 90210 }');
|
|
10622
|
+
* ```
|
|
10623
|
+
*
|
|
10624
|
+
* @exampleResponse Updating JSON data
|
|
10625
|
+
* ```json
|
|
10626
|
+
* {
|
|
10627
|
+
* "data": [
|
|
10628
|
+
* {
|
|
10629
|
+
* "id": 1,
|
|
10630
|
+
* "name": "Michael",
|
|
10631
|
+
* "address": {
|
|
10632
|
+
* "street": "Melrose Place",
|
|
10633
|
+
* "postcode": 90210
|
|
10634
|
+
* }
|
|
10635
|
+
* }
|
|
10636
|
+
* ],
|
|
10637
|
+
* "status": 200,
|
|
10638
|
+
* "statusText": "OK"
|
|
10639
|
+
* }
|
|
10640
|
+
* ```
|
|
9558
10641
|
*/
|
|
9559
10642
|
update(values, { count } = {}) {
|
|
9560
10643
|
var _this$fetch3;
|
|
@@ -9753,10 +10836,10 @@ ${cause.stack}`;
|
|
|
9753
10836
|
}
|
|
9754
10837
|
});
|
|
9755
10838
|
|
|
9756
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
10839
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
|
|
9757
10840
|
var WebSocketFactory, websocket_factory_default;
|
|
9758
10841
|
var init_websocket_factory = __esm({
|
|
9759
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
10842
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js"() {
|
|
9760
10843
|
init_utils();
|
|
9761
10844
|
WebSocketFactory = class {
|
|
9762
10845
|
/**
|
|
@@ -9875,19 +10958,19 @@ Suggested solution: ${env.workaround}`;
|
|
|
9875
10958
|
}
|
|
9876
10959
|
});
|
|
9877
10960
|
|
|
9878
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
10961
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/version.js
|
|
9879
10962
|
var version;
|
|
9880
10963
|
var init_version = __esm({
|
|
9881
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
10964
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/version.js"() {
|
|
9882
10965
|
init_utils();
|
|
9883
|
-
version = "2.
|
|
10966
|
+
version = "2.99.1";
|
|
9884
10967
|
}
|
|
9885
10968
|
});
|
|
9886
10969
|
|
|
9887
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
10970
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/constants.js
|
|
9888
10971
|
var DEFAULT_VERSION, VSN_1_0_0, VSN_2_0_0, DEFAULT_VSN, DEFAULT_TIMEOUT, WS_CLOSE_NORMAL, MAX_PUSH_BUFFER_SIZE, SOCKET_STATES, CHANNEL_STATES, CHANNEL_EVENTS, TRANSPORTS, CONNECTION_STATE;
|
|
9889
10972
|
var init_constants2 = __esm({
|
|
9890
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
10973
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/constants.js"() {
|
|
9891
10974
|
init_utils();
|
|
9892
10975
|
init_version();
|
|
9893
10976
|
DEFAULT_VERSION = `realtime-js/${version}`;
|
|
@@ -9930,10 +11013,10 @@ var init_constants2 = __esm({
|
|
|
9930
11013
|
}
|
|
9931
11014
|
});
|
|
9932
11015
|
|
|
9933
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11016
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
|
|
9934
11017
|
var Serializer;
|
|
9935
11018
|
var init_serializer = __esm({
|
|
9936
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11019
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js"() {
|
|
9937
11020
|
init_utils();
|
|
9938
11021
|
Serializer = class {
|
|
9939
11022
|
constructor(allowedMetadataKeys) {
|
|
@@ -10076,10 +11159,10 @@ var init_serializer = __esm({
|
|
|
10076
11159
|
}
|
|
10077
11160
|
});
|
|
10078
11161
|
|
|
10079
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11162
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/timer.js
|
|
10080
11163
|
var Timer;
|
|
10081
11164
|
var init_timer = __esm({
|
|
10082
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11165
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/timer.js"() {
|
|
10083
11166
|
init_utils();
|
|
10084
11167
|
Timer = class {
|
|
10085
11168
|
constructor(callback, timerCalc) {
|
|
@@ -10107,10 +11190,10 @@ var init_timer = __esm({
|
|
|
10107
11190
|
}
|
|
10108
11191
|
});
|
|
10109
11192
|
|
|
10110
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11193
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
|
|
10111
11194
|
var PostgresTypes, convertChangeData, convertColumn, convertCell, noop, toBoolean, toNumber, toJson, toArray, toTimestampString, httpEndpointURL;
|
|
10112
11195
|
var init_transformers = __esm({
|
|
10113
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11196
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js"() {
|
|
10114
11197
|
init_utils();
|
|
10115
11198
|
(function(PostgresTypes2) {
|
|
10116
11199
|
PostgresTypes2["abstime"] = "abstime";
|
|
@@ -10275,10 +11358,10 @@ var init_transformers = __esm({
|
|
|
10275
11358
|
}
|
|
10276
11359
|
});
|
|
10277
11360
|
|
|
10278
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11361
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/push.js
|
|
10279
11362
|
var Push;
|
|
10280
11363
|
var init_push = __esm({
|
|
10281
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11364
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/push.js"() {
|
|
10282
11365
|
init_utils();
|
|
10283
11366
|
init_constants2();
|
|
10284
11367
|
Push = class {
|
|
@@ -10381,10 +11464,10 @@ var init_push = __esm({
|
|
|
10381
11464
|
}
|
|
10382
11465
|
});
|
|
10383
11466
|
|
|
10384
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11467
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
|
|
10385
11468
|
var REALTIME_PRESENCE_LISTEN_EVENTS, RealtimePresence;
|
|
10386
11469
|
var init_RealtimePresence = __esm({
|
|
10387
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11470
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js"() {
|
|
10388
11471
|
init_utils();
|
|
10389
11472
|
(function(REALTIME_PRESENCE_LISTEN_EVENTS2) {
|
|
10390
11473
|
REALTIME_PRESENCE_LISTEN_EVENTS2["SYNC"] = "sync";
|
|
@@ -10618,10 +11701,10 @@ var init_RealtimePresence = __esm({
|
|
|
10618
11701
|
}
|
|
10619
11702
|
});
|
|
10620
11703
|
|
|
10621
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11704
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
|
|
10622
11705
|
var REALTIME_POSTGRES_CHANGES_LISTEN_EVENT, REALTIME_LISTEN_TYPES, REALTIME_SUBSCRIBE_STATES, RealtimeChannel;
|
|
10623
11706
|
var init_RealtimeChannel = __esm({
|
|
10624
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11707
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js"() {
|
|
10625
11708
|
init_utils();
|
|
10626
11709
|
init_constants2();
|
|
10627
11710
|
init_push();
|
|
@@ -11222,10 +12305,10 @@ var init_RealtimeChannel = __esm({
|
|
|
11222
12305
|
}
|
|
11223
12306
|
});
|
|
11224
12307
|
|
|
11225
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
12308
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
|
|
11226
12309
|
var noop2, CONNECTION_TIMEOUTS, RECONNECT_INTERVALS, DEFAULT_RECONNECT_FALLBACK, WORKER_SCRIPT, RealtimeClient;
|
|
11227
12310
|
var init_RealtimeClient = __esm({
|
|
11228
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
12311
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js"() {
|
|
11229
12312
|
init_utils();
|
|
11230
12313
|
init_websocket_factory();
|
|
11231
12314
|
init_constants2();
|
|
@@ -12004,9 +13087,9 @@ Option 2: Install and provide the "ws" package:
|
|
|
12004
13087
|
}
|
|
12005
13088
|
});
|
|
12006
13089
|
|
|
12007
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
13090
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/index.js
|
|
12008
13091
|
var init_module2 = __esm({
|
|
12009
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
13092
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/index.js"() {
|
|
12010
13093
|
init_utils();
|
|
12011
13094
|
init_RealtimeClient();
|
|
12012
13095
|
init_RealtimeChannel();
|
|
@@ -12554,7 +13637,7 @@ var init_dist4 = __esm({
|
|
|
12554
13637
|
}
|
|
12555
13638
|
});
|
|
12556
13639
|
|
|
12557
|
-
// node_modules/.bun/@supabase+storage-js@2.
|
|
13640
|
+
// node_modules/.bun/@supabase+storage-js@2.99.1/node_modules/@supabase/storage-js/dist/index.mjs
|
|
12558
13641
|
function isStorageError(error2) {
|
|
12559
13642
|
return typeof error2 === "object" && error2 !== null && "__isStorageError" in error2;
|
|
12560
13643
|
}
|
|
@@ -12644,7 +13727,7 @@ function createFetchApi(namespace = "storage") {
|
|
|
12644
13727
|
}
|
|
12645
13728
|
var StorageError, StorageApiError, StorageUnknownError, resolveFetch2, isPlainObject, recursiveToCamel, isValidBucketName, _getErrorMessage, handleError, _getRequestParams, defaultApi, get, post, put, head, remove, vectorsApi, BaseApiClient, StreamDownloadBuilder, _Symbol$toStringTag, BlobDownloadBuilder, DEFAULT_SEARCH_OPTIONS, DEFAULT_FILE_OPTIONS, StorageFileApi, version2, DEFAULT_HEADERS, StorageBucketApi, StorageAnalyticsClient, VectorIndexApi, VectorDataApi, VectorBucketApi, StorageVectorsClient, VectorBucketScope, VectorIndexScope, StorageClient;
|
|
12646
13729
|
var init_dist5 = __esm({
|
|
12647
|
-
"node_modules/.bun/@supabase+storage-js@2.
|
|
13730
|
+
"node_modules/.bun/@supabase+storage-js@2.99.1/node_modules/@supabase/storage-js/dist/index.mjs"() {
|
|
12648
13731
|
init_utils();
|
|
12649
13732
|
init_dist4();
|
|
12650
13733
|
StorageError = class extends Error {
|
|
@@ -12711,7 +13794,7 @@ var init_dist5 = __esm({
|
|
|
12711
13794
|
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);
|
|
12712
13795
|
};
|
|
12713
13796
|
handleError = async (error2, reject, options, namespace) => {
|
|
12714
|
-
if (error2 && typeof error2 === "object" && "status" in error2 && "ok" in error2 && typeof error2.status === "number"
|
|
13797
|
+
if (error2 && typeof error2 === "object" && "status" in error2 && "ok" in error2 && typeof error2.status === "number") {
|
|
12715
13798
|
const responseError = error2;
|
|
12716
13799
|
const status = responseError.status || 500;
|
|
12717
13800
|
if (typeof responseError.json === "function") responseError.json().then((err) => {
|
|
@@ -13285,7 +14368,8 @@ var init_dist5 = __esm({
|
|
|
13285
14368
|
let _path = _this8._getFinalPath(path);
|
|
13286
14369
|
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 });
|
|
13287
14370
|
const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
|
|
13288
|
-
|
|
14371
|
+
const returnedPath = (options === null || options === void 0 ? void 0 : options.transform) && data.signedURL.includes("/object/sign/") ? data.signedURL.replace("/object/sign/", "/render/image/sign/") : data.signedURL;
|
|
14372
|
+
return { signedUrl: encodeURI(`${_this8.url}${returnedPath}${downloadQueryParam}`) };
|
|
13289
14373
|
});
|
|
13290
14374
|
}
|
|
13291
14375
|
/**
|
|
@@ -13409,6 +14493,9 @@ var init_dist5 = __esm({
|
|
|
13409
14493
|
/**
|
|
13410
14494
|
* Retrieves the details of an existing file.
|
|
13411
14495
|
*
|
|
14496
|
+
* Returns detailed file metadata including size, content type, and timestamps.
|
|
14497
|
+
* Note: The API returns `last_modified` field, not `updated_at`.
|
|
14498
|
+
*
|
|
13412
14499
|
* @category File Buckets
|
|
13413
14500
|
* @param path The file path, including the file name. For example `folder/image.png`.
|
|
13414
14501
|
* @returns Promise with response containing file metadata or error
|
|
@@ -13419,6 +14506,11 @@ var init_dist5 = __esm({
|
|
|
13419
14506
|
* .storage
|
|
13420
14507
|
* .from('avatars')
|
|
13421
14508
|
* .info('folder/avatar1.png')
|
|
14509
|
+
*
|
|
14510
|
+
* if (data) {
|
|
14511
|
+
* console.log('Last modified:', data.lastModified)
|
|
14512
|
+
* console.log('Size:', data.size)
|
|
14513
|
+
* }
|
|
13422
14514
|
* ```
|
|
13423
14515
|
*/
|
|
13424
14516
|
async info(path) {
|
|
@@ -13454,9 +14546,10 @@ var init_dist5 = __esm({
|
|
|
13454
14546
|
};
|
|
13455
14547
|
} catch (error2) {
|
|
13456
14548
|
if (_this11.shouldThrowOnError) throw error2;
|
|
13457
|
-
if (isStorageError(error2)
|
|
13458
|
-
|
|
13459
|
-
|
|
14549
|
+
if (isStorageError(error2)) {
|
|
14550
|
+
var _error$originalError;
|
|
14551
|
+
const status = error2 instanceof StorageApiError ? error2.status : error2 instanceof StorageUnknownError ? (_error$originalError = error2.originalError) === null || _error$originalError === void 0 ? void 0 : _error$originalError.status : void 0;
|
|
14552
|
+
if (status !== void 0 && [400, 404].includes(status)) return {
|
|
13460
14553
|
data: false,
|
|
13461
14554
|
error: error2
|
|
13462
14555
|
};
|
|
@@ -13529,6 +14622,9 @@ var init_dist5 = __esm({
|
|
|
13529
14622
|
/**
|
|
13530
14623
|
* Deletes files within the same bucket
|
|
13531
14624
|
*
|
|
14625
|
+
* Returns an array of FileObject entries for the deleted files. Note that deprecated
|
|
14626
|
+
* fields like `bucket_id` may or may not be present in the response - do not rely on them.
|
|
14627
|
+
*
|
|
13532
14628
|
* @category File Buckets
|
|
13533
14629
|
* @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].
|
|
13534
14630
|
* @returns Promise with response containing array of deleted file objects or error
|
|
@@ -13567,11 +14663,16 @@ var init_dist5 = __esm({
|
|
|
13567
14663
|
/**
|
|
13568
14664
|
* Lists all the files and folders within a path of the bucket.
|
|
13569
14665
|
*
|
|
14666
|
+
* **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`,
|
|
14667
|
+
* `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated.
|
|
14668
|
+
* Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned
|
|
14669
|
+
* by this method.
|
|
14670
|
+
*
|
|
13570
14671
|
* @category File Buckets
|
|
13571
14672
|
* @param path The folder path.
|
|
13572
14673
|
* @param options Search options including limit (defaults to 100), offset, sortBy, and search
|
|
13573
14674
|
* @param parameters Optional fetch parameters including signal for cancellation
|
|
13574
|
-
* @returns Promise with response containing array of files or error
|
|
14675
|
+
* @returns Promise with response containing array of files/folders or error
|
|
13575
14676
|
*
|
|
13576
14677
|
* @example List files in a bucket
|
|
13577
14678
|
* ```js
|
|
@@ -13583,9 +14684,20 @@ var init_dist5 = __esm({
|
|
|
13583
14684
|
* offset: 0,
|
|
13584
14685
|
* sortBy: { column: 'name', order: 'asc' },
|
|
13585
14686
|
* })
|
|
14687
|
+
*
|
|
14688
|
+
* // Handle files vs folders
|
|
14689
|
+
* data?.forEach(item => {
|
|
14690
|
+
* if (item.id !== null) {
|
|
14691
|
+
* // It's a file
|
|
14692
|
+
* console.log('File:', item.name, 'Size:', item.metadata?.size)
|
|
14693
|
+
* } else {
|
|
14694
|
+
* // It's a folder
|
|
14695
|
+
* console.log('Folder:', item.name)
|
|
14696
|
+
* }
|
|
14697
|
+
* })
|
|
13586
14698
|
* ```
|
|
13587
14699
|
*
|
|
13588
|
-
* Response:
|
|
14700
|
+
* Response (file entry):
|
|
13589
14701
|
* ```json
|
|
13590
14702
|
* {
|
|
13591
14703
|
* "data": [
|
|
@@ -13631,11 +14743,50 @@ var init_dist5 = __esm({
|
|
|
13631
14743
|
});
|
|
13632
14744
|
}
|
|
13633
14745
|
/**
|
|
14746
|
+
* Lists all the files and folders within a bucket using the V2 API with pagination support.
|
|
14747
|
+
*
|
|
14748
|
+
* **Important:** Folder entries in the `folders` array only contain `name` and optionally `key` —
|
|
14749
|
+
* they have no `id`, timestamps, or `metadata` fields. Full file metadata is only available
|
|
14750
|
+
* on entries in the `objects` array.
|
|
14751
|
+
*
|
|
13634
14752
|
* @experimental this method signature might change in the future
|
|
13635
14753
|
*
|
|
13636
14754
|
* @category File Buckets
|
|
13637
|
-
* @param options
|
|
13638
|
-
* @param parameters
|
|
14755
|
+
* @param options Search options including prefix, cursor for pagination, limit, with_delimiter
|
|
14756
|
+
* @param parameters Optional fetch parameters including signal for cancellation
|
|
14757
|
+
* @returns Promise with response containing folders/objects arrays with pagination info or error
|
|
14758
|
+
*
|
|
14759
|
+
* @example List files with pagination
|
|
14760
|
+
* ```js
|
|
14761
|
+
* const { data, error } = await supabase
|
|
14762
|
+
* .storage
|
|
14763
|
+
* .from('avatars')
|
|
14764
|
+
* .listV2({
|
|
14765
|
+
* prefix: 'folder/',
|
|
14766
|
+
* limit: 100,
|
|
14767
|
+
* })
|
|
14768
|
+
*
|
|
14769
|
+
* // Handle pagination
|
|
14770
|
+
* if (data?.hasNext) {
|
|
14771
|
+
* const nextPage = await supabase
|
|
14772
|
+
* .storage
|
|
14773
|
+
* .from('avatars')
|
|
14774
|
+
* .listV2({
|
|
14775
|
+
* prefix: 'folder/',
|
|
14776
|
+
* cursor: data.nextCursor,
|
|
14777
|
+
* })
|
|
14778
|
+
* }
|
|
14779
|
+
*
|
|
14780
|
+
* // Handle files vs folders
|
|
14781
|
+
* data?.objects.forEach(file => {
|
|
14782
|
+
* if (file.id !== null) {
|
|
14783
|
+
* console.log('File:', file.name, 'Size:', file.metadata?.size)
|
|
14784
|
+
* }
|
|
14785
|
+
* })
|
|
14786
|
+
* data?.folders.forEach(folder => {
|
|
14787
|
+
* console.log('Folder:', folder.name)
|
|
14788
|
+
* })
|
|
14789
|
+
* ```
|
|
13639
14790
|
*/
|
|
13640
14791
|
async listV2(options, parameters) {
|
|
13641
14792
|
var _this14 = this;
|
|
@@ -13667,7 +14818,7 @@ var init_dist5 = __esm({
|
|
|
13667
14818
|
return params.join("&");
|
|
13668
14819
|
}
|
|
13669
14820
|
};
|
|
13670
|
-
version2 = "2.
|
|
14821
|
+
version2 = "2.99.1";
|
|
13671
14822
|
DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version2}` };
|
|
13672
14823
|
StorageBucketApi = class extends BaseApiClient {
|
|
13673
14824
|
constructor(url, headers = {}, fetch$1, opts) {
|
|
@@ -14913,19 +16064,19 @@ var init_dist5 = __esm({
|
|
|
14913
16064
|
}
|
|
14914
16065
|
});
|
|
14915
16066
|
|
|
14916
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16067
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/version.js
|
|
14917
16068
|
var version3;
|
|
14918
16069
|
var init_version2 = __esm({
|
|
14919
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16070
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/version.js"() {
|
|
14920
16071
|
init_utils();
|
|
14921
|
-
version3 = "2.
|
|
16072
|
+
version3 = "2.99.1";
|
|
14922
16073
|
}
|
|
14923
16074
|
});
|
|
14924
16075
|
|
|
14925
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16076
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/constants.js
|
|
14926
16077
|
var AUTO_REFRESH_TICK_DURATION_MS, AUTO_REFRESH_TICK_THRESHOLD, EXPIRY_MARGIN_MS, GOTRUE_URL, STORAGE_KEY, DEFAULT_HEADERS2, API_VERSION_HEADER_NAME, API_VERSIONS, BASE64URL_REGEX, JWKS_TTL;
|
|
14927
16078
|
var init_constants3 = __esm({
|
|
14928
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16079
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/constants.js"() {
|
|
14929
16080
|
init_utils();
|
|
14930
16081
|
init_version2();
|
|
14931
16082
|
AUTO_REFRESH_TICK_DURATION_MS = 30 * 1e3;
|
|
@@ -14946,7 +16097,7 @@ var init_constants3 = __esm({
|
|
|
14946
16097
|
}
|
|
14947
16098
|
});
|
|
14948
16099
|
|
|
14949
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16100
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/errors.js
|
|
14950
16101
|
function isAuthError(error2) {
|
|
14951
16102
|
return typeof error2 === "object" && error2 !== null && "__isAuthError" in error2;
|
|
14952
16103
|
}
|
|
@@ -14964,7 +16115,7 @@ function isAuthRetryableFetchError(error2) {
|
|
|
14964
16115
|
}
|
|
14965
16116
|
var AuthError, AuthApiError, AuthUnknownError, CustomAuthError, AuthSessionMissingError, AuthInvalidTokenResponseError, AuthInvalidCredentialsError, AuthImplicitGrantRedirectError, AuthPKCEGrantCodeExchangeError, AuthPKCECodeVerifierMissingError, AuthRetryableFetchError, AuthWeakPasswordError, AuthInvalidJwtError;
|
|
14966
16117
|
var init_errors2 = __esm({
|
|
14967
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16118
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/errors.js"() {
|
|
14968
16119
|
init_utils();
|
|
14969
16120
|
AuthError = class extends Error {
|
|
14970
16121
|
constructor(message, status, code) {
|
|
@@ -15066,7 +16217,7 @@ var init_errors2 = __esm({
|
|
|
15066
16217
|
}
|
|
15067
16218
|
});
|
|
15068
16219
|
|
|
15069
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16220
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/base64url.js
|
|
15070
16221
|
function byteToBase64URL(byte, state, emit) {
|
|
15071
16222
|
if (byte !== null) {
|
|
15072
16223
|
state.queue = state.queue << 8 | byte;
|
|
@@ -15214,7 +16365,7 @@ function bytesToBase64URL(bytes) {
|
|
|
15214
16365
|
}
|
|
15215
16366
|
var TO_BASE64URL, IGNORE_BASE64URL, FROM_BASE64URL;
|
|
15216
16367
|
var init_base64url = __esm({
|
|
15217
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16368
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/base64url.js"() {
|
|
15218
16369
|
init_utils();
|
|
15219
16370
|
TO_BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split("");
|
|
15220
16371
|
IGNORE_BASE64URL = " \n\r=".split("");
|
|
@@ -15234,7 +16385,7 @@ var init_base64url = __esm({
|
|
|
15234
16385
|
}
|
|
15235
16386
|
});
|
|
15236
16387
|
|
|
15237
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16388
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/helpers.js
|
|
15238
16389
|
function expiresAt(expiresIn) {
|
|
15239
16390
|
const timeNow = Math.round(Date.now() / 1e3);
|
|
15240
16391
|
return timeNow + expiresIn;
|
|
@@ -15445,7 +16596,7 @@ function deepClone(obj) {
|
|
|
15445
16596
|
}
|
|
15446
16597
|
var isBrowser, localStorageWriteTests, supportsLocalStorage, resolveFetch3, looksLikeFetchResponse, setItemAsync, getItemAsync, removeItemAsync, Deferred, API_VERSION_REGEX, UUID_REGEX;
|
|
15447
16598
|
var init_helpers = __esm({
|
|
15448
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16599
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/helpers.js"() {
|
|
15449
16600
|
init_utils();
|
|
15450
16601
|
init_constants3();
|
|
15451
16602
|
init_errors2();
|
|
@@ -15523,7 +16674,7 @@ var init_helpers = __esm({
|
|
|
15523
16674
|
}
|
|
15524
16675
|
});
|
|
15525
16676
|
|
|
15526
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16677
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/fetch.js
|
|
15527
16678
|
async function handleError2(error2) {
|
|
15528
16679
|
var _a;
|
|
15529
16680
|
if (!looksLikeFetchResponse(error2)) {
|
|
@@ -15649,7 +16800,7 @@ function hasSession(data) {
|
|
|
15649
16800
|
}
|
|
15650
16801
|
var _getErrorMessage2, NETWORK_ERROR_CODES, _getRequestParams2;
|
|
15651
16802
|
var init_fetch = __esm({
|
|
15652
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16803
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/fetch.js"() {
|
|
15653
16804
|
init_utils();
|
|
15654
16805
|
init_tslib_es6();
|
|
15655
16806
|
init_constants3();
|
|
@@ -15669,19 +16820,19 @@ var init_fetch = __esm({
|
|
|
15669
16820
|
}
|
|
15670
16821
|
});
|
|
15671
16822
|
|
|
15672
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16823
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/types.js
|
|
15673
16824
|
var SIGN_OUT_SCOPES;
|
|
15674
16825
|
var init_types2 = __esm({
|
|
15675
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16826
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/types.js"() {
|
|
15676
16827
|
init_utils();
|
|
15677
16828
|
SIGN_OUT_SCOPES = ["global", "local", "others"];
|
|
15678
16829
|
}
|
|
15679
16830
|
});
|
|
15680
16831
|
|
|
15681
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16832
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
|
|
15682
16833
|
var GoTrueAdminApi;
|
|
15683
16834
|
var init_GoTrueAdminApi = __esm({
|
|
15684
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16835
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js"() {
|
|
15685
16836
|
init_utils();
|
|
15686
16837
|
init_tslib_es6();
|
|
15687
16838
|
init_fetch();
|
|
@@ -15718,6 +16869,13 @@ var init_GoTrueAdminApi = __esm({
|
|
|
15718
16869
|
deleteClient: this._deleteOAuthClient.bind(this),
|
|
15719
16870
|
regenerateClientSecret: this._regenerateOAuthClientSecret.bind(this)
|
|
15720
16871
|
};
|
|
16872
|
+
this.customProviders = {
|
|
16873
|
+
listProviders: this._listCustomProviders.bind(this),
|
|
16874
|
+
createProvider: this._createCustomProvider.bind(this),
|
|
16875
|
+
getProvider: this._getCustomProvider.bind(this),
|
|
16876
|
+
updateProvider: this._updateCustomProvider.bind(this),
|
|
16877
|
+
deleteProvider: this._deleteCustomProvider.bind(this)
|
|
16878
|
+
};
|
|
15721
16879
|
}
|
|
15722
16880
|
/**
|
|
15723
16881
|
* Removes a logged-in session.
|
|
@@ -16127,11 +17285,129 @@ var init_GoTrueAdminApi = __esm({
|
|
|
16127
17285
|
throw error2;
|
|
16128
17286
|
}
|
|
16129
17287
|
}
|
|
17288
|
+
/**
|
|
17289
|
+
* Lists all custom providers with optional type filter.
|
|
17290
|
+
*
|
|
17291
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
17292
|
+
*/
|
|
17293
|
+
async _listCustomProviders(params) {
|
|
17294
|
+
try {
|
|
17295
|
+
const query = {};
|
|
17296
|
+
if (params === null || params === void 0 ? void 0 : params.type) {
|
|
17297
|
+
query.type = params.type;
|
|
17298
|
+
}
|
|
17299
|
+
return await _request(this.fetch, "GET", `${this.url}/admin/custom-providers`, {
|
|
17300
|
+
headers: this.headers,
|
|
17301
|
+
query,
|
|
17302
|
+
xform: (data) => {
|
|
17303
|
+
var _a;
|
|
17304
|
+
return { data: { providers: (_a = data === null || data === void 0 ? void 0 : data.providers) !== null && _a !== void 0 ? _a : [] }, error: null };
|
|
17305
|
+
}
|
|
17306
|
+
});
|
|
17307
|
+
} catch (error2) {
|
|
17308
|
+
if (isAuthError(error2)) {
|
|
17309
|
+
return { data: { providers: [] }, error: error2 };
|
|
17310
|
+
}
|
|
17311
|
+
throw error2;
|
|
17312
|
+
}
|
|
17313
|
+
}
|
|
17314
|
+
/**
|
|
17315
|
+
* Creates a new custom OIDC/OAuth provider.
|
|
17316
|
+
*
|
|
17317
|
+
* For OIDC providers, the server fetches and validates the OpenID Connect discovery document
|
|
17318
|
+
* from the issuer's well-known endpoint (or the provided `discovery_url`) at creation time.
|
|
17319
|
+
* This may return a validation error (`error_code: "validation_failed"`) if the discovery
|
|
17320
|
+
* document is unreachable, not valid JSON, missing required fields, or if the issuer
|
|
17321
|
+
* in the document does not match the expected issuer.
|
|
17322
|
+
*
|
|
17323
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
17324
|
+
*/
|
|
17325
|
+
async _createCustomProvider(params) {
|
|
17326
|
+
try {
|
|
17327
|
+
return await _request(this.fetch, "POST", `${this.url}/admin/custom-providers`, {
|
|
17328
|
+
body: params,
|
|
17329
|
+
headers: this.headers,
|
|
17330
|
+
xform: (provider) => {
|
|
17331
|
+
return { data: provider, error: null };
|
|
17332
|
+
}
|
|
17333
|
+
});
|
|
17334
|
+
} catch (error2) {
|
|
17335
|
+
if (isAuthError(error2)) {
|
|
17336
|
+
return { data: null, error: error2 };
|
|
17337
|
+
}
|
|
17338
|
+
throw error2;
|
|
17339
|
+
}
|
|
17340
|
+
}
|
|
17341
|
+
/**
|
|
17342
|
+
* Gets details of a specific custom provider by identifier.
|
|
17343
|
+
*
|
|
17344
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
17345
|
+
*/
|
|
17346
|
+
async _getCustomProvider(identifier) {
|
|
17347
|
+
try {
|
|
17348
|
+
return await _request(this.fetch, "GET", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
17349
|
+
headers: this.headers,
|
|
17350
|
+
xform: (provider) => {
|
|
17351
|
+
return { data: provider, error: null };
|
|
17352
|
+
}
|
|
17353
|
+
});
|
|
17354
|
+
} catch (error2) {
|
|
17355
|
+
if (isAuthError(error2)) {
|
|
17356
|
+
return { data: null, error: error2 };
|
|
17357
|
+
}
|
|
17358
|
+
throw error2;
|
|
17359
|
+
}
|
|
17360
|
+
}
|
|
17361
|
+
/**
|
|
17362
|
+
* Updates an existing custom provider.
|
|
17363
|
+
*
|
|
17364
|
+
* When `issuer` or `discovery_url` is changed on an OIDC provider, the server re-fetches and
|
|
17365
|
+
* validates the discovery document before persisting. This may return a validation error
|
|
17366
|
+
* (`error_code: "validation_failed"`) if the discovery document is unreachable, invalid, or
|
|
17367
|
+
* the issuer does not match.
|
|
17368
|
+
*
|
|
17369
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
17370
|
+
*/
|
|
17371
|
+
async _updateCustomProvider(identifier, params) {
|
|
17372
|
+
try {
|
|
17373
|
+
return await _request(this.fetch, "PUT", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
17374
|
+
body: params,
|
|
17375
|
+
headers: this.headers,
|
|
17376
|
+
xform: (provider) => {
|
|
17377
|
+
return { data: provider, error: null };
|
|
17378
|
+
}
|
|
17379
|
+
});
|
|
17380
|
+
} catch (error2) {
|
|
17381
|
+
if (isAuthError(error2)) {
|
|
17382
|
+
return { data: null, error: error2 };
|
|
17383
|
+
}
|
|
17384
|
+
throw error2;
|
|
17385
|
+
}
|
|
17386
|
+
}
|
|
17387
|
+
/**
|
|
17388
|
+
* Deletes a custom provider.
|
|
17389
|
+
*
|
|
17390
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
17391
|
+
*/
|
|
17392
|
+
async _deleteCustomProvider(identifier) {
|
|
17393
|
+
try {
|
|
17394
|
+
await _request(this.fetch, "DELETE", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
17395
|
+
headers: this.headers,
|
|
17396
|
+
noResolveJson: true
|
|
17397
|
+
});
|
|
17398
|
+
return { data: null, error: null };
|
|
17399
|
+
} catch (error2) {
|
|
17400
|
+
if (isAuthError(error2)) {
|
|
17401
|
+
return { data: null, error: error2 };
|
|
17402
|
+
}
|
|
17403
|
+
throw error2;
|
|
17404
|
+
}
|
|
17405
|
+
}
|
|
16130
17406
|
};
|
|
16131
17407
|
}
|
|
16132
17408
|
});
|
|
16133
17409
|
|
|
16134
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17410
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
|
|
16135
17411
|
function memoryLocalStorageAdapter(store = {}) {
|
|
16136
17412
|
return {
|
|
16137
17413
|
getItem: (key) => {
|
|
@@ -16146,12 +17422,12 @@ function memoryLocalStorageAdapter(store = {}) {
|
|
|
16146
17422
|
};
|
|
16147
17423
|
}
|
|
16148
17424
|
var init_local_storage = __esm({
|
|
16149
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17425
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js"() {
|
|
16150
17426
|
init_utils();
|
|
16151
17427
|
}
|
|
16152
17428
|
});
|
|
16153
17429
|
|
|
16154
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17430
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/locks.js
|
|
16155
17431
|
async function navigatorLock(name, acquireTimeout, fn) {
|
|
16156
17432
|
if (internals.debug) {
|
|
16157
17433
|
}
|
|
@@ -16224,7 +17500,7 @@ async function navigatorLock(name, acquireTimeout, fn) {
|
|
|
16224
17500
|
}
|
|
16225
17501
|
var internals, LockAcquireTimeoutError, NavigatorLockAcquireTimeoutError;
|
|
16226
17502
|
var init_locks = __esm({
|
|
16227
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17503
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/locks.js"() {
|
|
16228
17504
|
init_utils();
|
|
16229
17505
|
init_helpers();
|
|
16230
17506
|
internals = {
|
|
@@ -16244,7 +17520,7 @@ var init_locks = __esm({
|
|
|
16244
17520
|
}
|
|
16245
17521
|
});
|
|
16246
17522
|
|
|
16247
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17523
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
|
|
16248
17524
|
function polyfillGlobalThis() {
|
|
16249
17525
|
if (typeof globalThis === "object")
|
|
16250
17526
|
return;
|
|
@@ -16264,12 +17540,12 @@ function polyfillGlobalThis() {
|
|
|
16264
17540
|
}
|
|
16265
17541
|
}
|
|
16266
17542
|
var init_polyfills = __esm({
|
|
16267
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17543
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js"() {
|
|
16268
17544
|
init_utils();
|
|
16269
17545
|
}
|
|
16270
17546
|
});
|
|
16271
17547
|
|
|
16272
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17548
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
|
|
16273
17549
|
function getAddress(address) {
|
|
16274
17550
|
if (!/^0x[a-fA-F0-9]{40}$/.test(address)) {
|
|
16275
17551
|
throw new Error(`@supabase/auth-js: Address "${address}" is invalid.`);
|
|
@@ -16337,12 +17613,12 @@ Request ID: ${requestId}`;
|
|
|
16337
17613
|
${suffix}`;
|
|
16338
17614
|
}
|
|
16339
17615
|
var init_ethereum = __esm({
|
|
16340
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17616
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js"() {
|
|
16341
17617
|
init_utils();
|
|
16342
17618
|
}
|
|
16343
17619
|
});
|
|
16344
17620
|
|
|
16345
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17621
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
|
|
16346
17622
|
function identifyRegistrationError({ error: error2, options }) {
|
|
16347
17623
|
var _a, _b, _c;
|
|
16348
17624
|
const { publicKey } = options;
|
|
@@ -16491,7 +17767,7 @@ function identifyAuthenticationError({ error: error2, options }) {
|
|
|
16491
17767
|
}
|
|
16492
17768
|
var WebAuthnError, WebAuthnUnknownError;
|
|
16493
17769
|
var init_webauthn_errors = __esm({
|
|
16494
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17770
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js"() {
|
|
16495
17771
|
init_utils();
|
|
16496
17772
|
init_webauthn();
|
|
16497
17773
|
WebAuthnError = class extends Error {
|
|
@@ -16517,7 +17793,7 @@ var init_webauthn_errors = __esm({
|
|
|
16517
17793
|
}
|
|
16518
17794
|
});
|
|
16519
17795
|
|
|
16520
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17796
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
|
|
16521
17797
|
function deserializeCredentialCreationOptions(options) {
|
|
16522
17798
|
if (!options) {
|
|
16523
17799
|
throw new Error("Credential creation options are required");
|
|
@@ -16727,7 +18003,7 @@ function mergeCredentialRequestOptions(baseOptions, overrides) {
|
|
|
16727
18003
|
}
|
|
16728
18004
|
var WebAuthnAbortService, webAuthnAbortService, DEFAULT_CREATION_OPTIONS, DEFAULT_REQUEST_OPTIONS, WebAuthnApi;
|
|
16729
18005
|
var init_webauthn = __esm({
|
|
16730
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
18006
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js"() {
|
|
16731
18007
|
init_utils();
|
|
16732
18008
|
init_tslib_es6();
|
|
16733
18009
|
init_base64url();
|
|
@@ -17051,13 +18327,13 @@ var init_webauthn = __esm({
|
|
|
17051
18327
|
}
|
|
17052
18328
|
});
|
|
17053
18329
|
|
|
17054
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
18330
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
|
|
17055
18331
|
async function lockNoOp(name, acquireTimeout, fn) {
|
|
17056
18332
|
return await fn();
|
|
17057
18333
|
}
|
|
17058
18334
|
var DEFAULT_OPTIONS, GLOBAL_JWKS, GoTrueClient, GoTrueClient_default;
|
|
17059
18335
|
var init_GoTrueClient = __esm({
|
|
17060
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
18336
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js"() {
|
|
17061
18337
|
init_utils();
|
|
17062
18338
|
init_GoTrueAdminApi();
|
|
17063
18339
|
init_constants3();
|
|
@@ -17374,6 +18650,173 @@ var init_GoTrueClient = __esm({
|
|
|
17374
18650
|
*
|
|
17375
18651
|
* @returns A logged-in session if the server has "autoconfirm" ON
|
|
17376
18652
|
* @returns A user if the server has "autoconfirm" OFF
|
|
18653
|
+
*
|
|
18654
|
+
* @category Auth
|
|
18655
|
+
*
|
|
18656
|
+
* @remarks
|
|
18657
|
+
* - 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).
|
|
18658
|
+
* - **Confirm email** determines if users need to confirm their email address after signing up.
|
|
18659
|
+
* - If **Confirm email** is enabled, a `user` is returned but `session` is null.
|
|
18660
|
+
* - If **Confirm email** is disabled, both a `user` and a `session` are returned.
|
|
18661
|
+
* - 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).
|
|
18662
|
+
* - If signUp() is called for an existing confirmed user:
|
|
18663
|
+
* - 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.
|
|
18664
|
+
* - When either **Confirm email** or **Confirm phone** (even when phone provider is disabled) is disabled, the error message, `User already registered` is returned.
|
|
18665
|
+
* - To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/auth-getuser).
|
|
18666
|
+
*
|
|
18667
|
+
* @example Sign up with an email and password
|
|
18668
|
+
* ```js
|
|
18669
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
18670
|
+
* email: 'example@email.com',
|
|
18671
|
+
* password: 'example-password',
|
|
18672
|
+
* })
|
|
18673
|
+
* ```
|
|
18674
|
+
*
|
|
18675
|
+
* @exampleResponse Sign up with an email and password
|
|
18676
|
+
* ```json
|
|
18677
|
+
* // Some fields may be null if "confirm email" is enabled.
|
|
18678
|
+
* {
|
|
18679
|
+
* "data": {
|
|
18680
|
+
* "user": {
|
|
18681
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
18682
|
+
* "aud": "authenticated",
|
|
18683
|
+
* "role": "authenticated",
|
|
18684
|
+
* "email": "example@email.com",
|
|
18685
|
+
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
18686
|
+
* "phone": "",
|
|
18687
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
18688
|
+
* "app_metadata": {
|
|
18689
|
+
* "provider": "email",
|
|
18690
|
+
* "providers": [
|
|
18691
|
+
* "email"
|
|
18692
|
+
* ]
|
|
18693
|
+
* },
|
|
18694
|
+
* "user_metadata": {},
|
|
18695
|
+
* "identities": [
|
|
18696
|
+
* {
|
|
18697
|
+
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
18698
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
18699
|
+
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
18700
|
+
* "identity_data": {
|
|
18701
|
+
* "email": "example@email.com",
|
|
18702
|
+
* "email_verified": false,
|
|
18703
|
+
* "phone_verified": false,
|
|
18704
|
+
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
18705
|
+
* },
|
|
18706
|
+
* "provider": "email",
|
|
18707
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
18708
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
18709
|
+
* "updated_at": "2024-01-01T00:00:00Z",
|
|
18710
|
+
* "email": "example@email.com"
|
|
18711
|
+
* }
|
|
18712
|
+
* ],
|
|
18713
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
18714
|
+
* "updated_at": "2024-01-01T00:00:00Z"
|
|
18715
|
+
* },
|
|
18716
|
+
* "session": {
|
|
18717
|
+
* "access_token": "<ACCESS_TOKEN>",
|
|
18718
|
+
* "token_type": "bearer",
|
|
18719
|
+
* "expires_in": 3600,
|
|
18720
|
+
* "expires_at": 1700000000,
|
|
18721
|
+
* "refresh_token": "<REFRESH_TOKEN>",
|
|
18722
|
+
* "user": {
|
|
18723
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
18724
|
+
* "aud": "authenticated",
|
|
18725
|
+
* "role": "authenticated",
|
|
18726
|
+
* "email": "example@email.com",
|
|
18727
|
+
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
18728
|
+
* "phone": "",
|
|
18729
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
18730
|
+
* "app_metadata": {
|
|
18731
|
+
* "provider": "email",
|
|
18732
|
+
* "providers": [
|
|
18733
|
+
* "email"
|
|
18734
|
+
* ]
|
|
18735
|
+
* },
|
|
18736
|
+
* "user_metadata": {},
|
|
18737
|
+
* "identities": [
|
|
18738
|
+
* {
|
|
18739
|
+
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
18740
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
18741
|
+
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
18742
|
+
* "identity_data": {
|
|
18743
|
+
* "email": "example@email.com",
|
|
18744
|
+
* "email_verified": false,
|
|
18745
|
+
* "phone_verified": false,
|
|
18746
|
+
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
18747
|
+
* },
|
|
18748
|
+
* "provider": "email",
|
|
18749
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
18750
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
18751
|
+
* "updated_at": "2024-01-01T00:00:00Z",
|
|
18752
|
+
* "email": "example@email.com"
|
|
18753
|
+
* }
|
|
18754
|
+
* ],
|
|
18755
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
18756
|
+
* "updated_at": "2024-01-01T00:00:00Z"
|
|
18757
|
+
* }
|
|
18758
|
+
* }
|
|
18759
|
+
* },
|
|
18760
|
+
* "error": null
|
|
18761
|
+
* }
|
|
18762
|
+
* ```
|
|
18763
|
+
*
|
|
18764
|
+
* @example Sign up with a phone number and password (SMS)
|
|
18765
|
+
* ```js
|
|
18766
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
18767
|
+
* phone: '123456789',
|
|
18768
|
+
* password: 'example-password',
|
|
18769
|
+
* options: {
|
|
18770
|
+
* channel: 'sms'
|
|
18771
|
+
* }
|
|
18772
|
+
* })
|
|
18773
|
+
* ```
|
|
18774
|
+
*
|
|
18775
|
+
* @exampleDescription Sign up with a phone number and password (whatsapp)
|
|
18776
|
+
* 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.
|
|
18777
|
+
*
|
|
18778
|
+
* @example Sign up with a phone number and password (whatsapp)
|
|
18779
|
+
* ```js
|
|
18780
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
18781
|
+
* phone: '123456789',
|
|
18782
|
+
* password: 'example-password',
|
|
18783
|
+
* options: {
|
|
18784
|
+
* channel: 'whatsapp'
|
|
18785
|
+
* }
|
|
18786
|
+
* })
|
|
18787
|
+
* ```
|
|
18788
|
+
*
|
|
18789
|
+
* @example Sign up with additional user metadata
|
|
18790
|
+
* ```js
|
|
18791
|
+
* const { data, error } = await supabase.auth.signUp(
|
|
18792
|
+
* {
|
|
18793
|
+
* email: 'example@email.com',
|
|
18794
|
+
* password: 'example-password',
|
|
18795
|
+
* options: {
|
|
18796
|
+
* data: {
|
|
18797
|
+
* first_name: 'John',
|
|
18798
|
+
* age: 27,
|
|
18799
|
+
* }
|
|
18800
|
+
* }
|
|
18801
|
+
* }
|
|
18802
|
+
* )
|
|
18803
|
+
* ```
|
|
18804
|
+
*
|
|
18805
|
+
* @exampleDescription Sign up with a redirect URL
|
|
18806
|
+
* - See [redirect URLs and wildcards](/docs/guides/auth/redirect-urls#use-wildcards-in-redirect-urls) to add additional redirect URLs to your project.
|
|
18807
|
+
*
|
|
18808
|
+
* @example Sign up with a redirect URL
|
|
18809
|
+
* ```js
|
|
18810
|
+
* const { data, error } = await supabase.auth.signUp(
|
|
18811
|
+
* {
|
|
18812
|
+
* email: 'example@email.com',
|
|
18813
|
+
* password: 'example-password',
|
|
18814
|
+
* options: {
|
|
18815
|
+
* emailRedirectTo: 'https://example.com/welcome'
|
|
18816
|
+
* }
|
|
18817
|
+
* }
|
|
18818
|
+
* )
|
|
18819
|
+
* ```
|
|
17377
18820
|
*/
|
|
17378
18821
|
async signUp(credentials) {
|
|
17379
18822
|
var _a, _b, _c;
|
|
@@ -19610,18 +21053,18 @@ var init_GoTrueClient = __esm({
|
|
|
19610
21053
|
}
|
|
19611
21054
|
});
|
|
19612
21055
|
|
|
19613
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
21056
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js
|
|
19614
21057
|
var init_AuthAdminApi = __esm({
|
|
19615
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
21058
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js"() {
|
|
19616
21059
|
init_utils();
|
|
19617
21060
|
init_GoTrueAdminApi();
|
|
19618
21061
|
}
|
|
19619
21062
|
});
|
|
19620
21063
|
|
|
19621
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
21064
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/AuthClient.js
|
|
19622
21065
|
var AuthClient, AuthClient_default;
|
|
19623
21066
|
var init_AuthClient = __esm({
|
|
19624
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
21067
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/AuthClient.js"() {
|
|
19625
21068
|
init_utils();
|
|
19626
21069
|
init_GoTrueClient();
|
|
19627
21070
|
AuthClient = GoTrueClient_default;
|
|
@@ -19629,9 +21072,9 @@ var init_AuthClient = __esm({
|
|
|
19629
21072
|
}
|
|
19630
21073
|
});
|
|
19631
21074
|
|
|
19632
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
21075
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/index.js
|
|
19633
21076
|
var init_module3 = __esm({
|
|
19634
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
21077
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/index.js"() {
|
|
19635
21078
|
init_utils();
|
|
19636
21079
|
init_GoTrueAdminApi();
|
|
19637
21080
|
init_GoTrueClient();
|
|
@@ -19643,7 +21086,7 @@ var init_module3 = __esm({
|
|
|
19643
21086
|
}
|
|
19644
21087
|
});
|
|
19645
21088
|
|
|
19646
|
-
// node_modules/.bun/@supabase+supabase-js@2.
|
|
21089
|
+
// node_modules/.bun/@supabase+supabase-js@2.99.1/node_modules/@supabase/supabase-js/dist/index.mjs
|
|
19647
21090
|
function _typeof3(o2) {
|
|
19648
21091
|
"@babel/helpers - typeof";
|
|
19649
21092
|
return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
@@ -19736,7 +21179,7 @@ function shouldShowDeprecationWarning() {
|
|
|
19736
21179
|
}
|
|
19737
21180
|
var version4, JS_ENV, DEFAULT_HEADERS3, DEFAULT_GLOBAL_OPTIONS, DEFAULT_DB_OPTIONS, DEFAULT_AUTH_OPTIONS, DEFAULT_REALTIME_OPTIONS, resolveFetch4, resolveHeadersConstructor, fetchWithAuth, SupabaseAuthClient, SupabaseClient, createClient;
|
|
19738
21181
|
var init_dist6 = __esm({
|
|
19739
|
-
"node_modules/.bun/@supabase+supabase-js@2.
|
|
21182
|
+
"node_modules/.bun/@supabase+supabase-js@2.99.1/node_modules/@supabase/supabase-js/dist/index.mjs"() {
|
|
19740
21183
|
init_utils();
|
|
19741
21184
|
init_module();
|
|
19742
21185
|
init_dist3();
|
|
@@ -19745,7 +21188,7 @@ var init_dist6 = __esm({
|
|
|
19745
21188
|
init_module3();
|
|
19746
21189
|
init_module2();
|
|
19747
21190
|
init_module3();
|
|
19748
|
-
version4 = "2.
|
|
21191
|
+
version4 = "2.99.1";
|
|
19749
21192
|
JS_ENV = "";
|
|
19750
21193
|
if (typeof Deno !== "undefined") JS_ENV = "deno";
|
|
19751
21194
|
else if (typeof document !== "undefined") JS_ENV = "web";
|
|
@@ -19788,6 +21231,9 @@ var init_dist6 = __esm({
|
|
|
19788
21231
|
SupabaseClient = class {
|
|
19789
21232
|
/**
|
|
19790
21233
|
* Create a new client for use in the browser.
|
|
21234
|
+
*
|
|
21235
|
+
* @category Initializing
|
|
21236
|
+
*
|
|
19791
21237
|
* @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.
|
|
19792
21238
|
* @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard.
|
|
19793
21239
|
* @param options.db.schema You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase.
|
|
@@ -19798,11 +21244,175 @@ var init_dist6 = __esm({
|
|
|
19798
21244
|
* @param options.storage Options passed along to the storage-js constructor.
|
|
19799
21245
|
* @param options.global.fetch A custom fetch implementation.
|
|
19800
21246
|
* @param options.global.headers Any additional headers to send with each network request.
|
|
19801
|
-
*
|
|
21247
|
+
*
|
|
21248
|
+
* @example Creating a client
|
|
21249
|
+
* ```js
|
|
21250
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21251
|
+
*
|
|
21252
|
+
* // Create a single supabase client for interacting with your database
|
|
21253
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
|
|
21254
|
+
* ```
|
|
21255
|
+
*
|
|
21256
|
+
* @example With a custom domain
|
|
21257
|
+
* ```js
|
|
21258
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21259
|
+
*
|
|
21260
|
+
* // Use a custom domain as the supabase URL
|
|
21261
|
+
* const supabase = createClient('https://my-custom-domain.com', 'publishable-or-anon-key')
|
|
21262
|
+
* ```
|
|
21263
|
+
*
|
|
21264
|
+
* @example With additional parameters
|
|
21265
|
+
* ```js
|
|
21266
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21267
|
+
*
|
|
21268
|
+
* const options = {
|
|
21269
|
+
* db: {
|
|
21270
|
+
* schema: 'public',
|
|
21271
|
+
* },
|
|
21272
|
+
* auth: {
|
|
21273
|
+
* autoRefreshToken: true,
|
|
21274
|
+
* persistSession: true,
|
|
21275
|
+
* detectSessionInUrl: true
|
|
21276
|
+
* },
|
|
21277
|
+
* global: {
|
|
21278
|
+
* headers: { 'x-my-custom-header': 'my-app-name' },
|
|
21279
|
+
* },
|
|
21280
|
+
* }
|
|
21281
|
+
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", options)
|
|
21282
|
+
* ```
|
|
21283
|
+
*
|
|
21284
|
+
* @exampleDescription With custom schemas
|
|
21285
|
+
* By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard.
|
|
21286
|
+
* Go to [Settings > API > Exposed schemas](/dashboard/project/_/settings/api) and add the schema which you want to expose to the API.
|
|
21287
|
+
*
|
|
21288
|
+
* 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.
|
|
21289
|
+
*
|
|
21290
|
+
* @example With custom schemas
|
|
21291
|
+
* ```js
|
|
21292
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21293
|
+
*
|
|
21294
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', {
|
|
21295
|
+
* // Provide a custom schema. Defaults to "public".
|
|
21296
|
+
* db: { schema: 'other_schema' }
|
|
21297
|
+
* })
|
|
21298
|
+
* ```
|
|
21299
|
+
*
|
|
21300
|
+
* @exampleDescription Custom fetch implementation
|
|
21301
|
+
* `supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests,
|
|
21302
|
+
* but an alternative `fetch` implementation can be provided as an option.
|
|
21303
|
+
* This is most useful in environments where `cross-fetch` is not compatible (for instance Cloudflare Workers).
|
|
21304
|
+
*
|
|
21305
|
+
* @example Custom fetch implementation
|
|
21306
|
+
* ```js
|
|
21307
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21308
|
+
*
|
|
21309
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', {
|
|
21310
|
+
* global: { fetch: fetch.bind(globalThis) }
|
|
21311
|
+
* })
|
|
21312
|
+
* ```
|
|
21313
|
+
*
|
|
21314
|
+
* @exampleDescription React Native options with AsyncStorage
|
|
21315
|
+
* For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth.
|
|
21316
|
+
*
|
|
21317
|
+
* @example React Native options with AsyncStorage
|
|
21318
|
+
* ```js
|
|
21319
|
+
* import 'react-native-url-polyfill/auto'
|
|
21320
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21321
|
+
* import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
21322
|
+
*
|
|
21323
|
+
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", {
|
|
21324
|
+
* auth: {
|
|
21325
|
+
* storage: AsyncStorage,
|
|
21326
|
+
* autoRefreshToken: true,
|
|
21327
|
+
* persistSession: true,
|
|
21328
|
+
* detectSessionInUrl: false,
|
|
21329
|
+
* },
|
|
21330
|
+
* });
|
|
21331
|
+
* ```
|
|
21332
|
+
*
|
|
21333
|
+
* @exampleDescription React Native options with Expo SecureStore
|
|
21334
|
+
* If you wish to encrypt the user's session information, you can use `aes-js` and store the encryption key in Expo SecureStore.
|
|
21335
|
+
* The `aes-js` library, a reputable JavaScript-only implementation of the AES encryption algorithm in CTR mode.
|
|
21336
|
+
* A new 256-bit encryption key is generated using the `react-native-get-random-values` library.
|
|
21337
|
+
* This key is stored inside Expo's SecureStore, while the value is encrypted and placed inside AsyncStorage.
|
|
21338
|
+
*
|
|
21339
|
+
* Please make sure that:
|
|
21340
|
+
* - You keep the `expo-secure-store`, `aes-js` and `react-native-get-random-values` libraries up-to-date.
|
|
21341
|
+
* - Choose the correct [`SecureStoreOptions`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestoreoptions) for your app's needs.
|
|
21342
|
+
* E.g. [`SecureStore.WHEN_UNLOCKED`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestorewhen_unlocked) regulates when the data can be accessed.
|
|
21343
|
+
* - Carefully consider optimizations or other modifications to the above example, as those can lead to introducing subtle security vulnerabilities.
|
|
21344
|
+
*
|
|
21345
|
+
* @example React Native options with Expo SecureStore
|
|
21346
|
+
* ```ts
|
|
21347
|
+
* import 'react-native-url-polyfill/auto'
|
|
21348
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21349
|
+
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
21350
|
+
* import * as SecureStore from 'expo-secure-store';
|
|
21351
|
+
* import * as aesjs from 'aes-js';
|
|
21352
|
+
* import 'react-native-get-random-values';
|
|
21353
|
+
*
|
|
21354
|
+
* // As Expo's SecureStore does not support values larger than 2048
|
|
21355
|
+
* // bytes, an AES-256 key is generated and stored in SecureStore, while
|
|
21356
|
+
* // it is used to encrypt/decrypt values stored in AsyncStorage.
|
|
21357
|
+
* class LargeSecureStore {
|
|
21358
|
+
* private async _encrypt(key: string, value: string) {
|
|
21359
|
+
* const encryptionKey = crypto.getRandomValues(new Uint8Array(256 / 8));
|
|
21360
|
+
*
|
|
21361
|
+
* const cipher = new aesjs.ModeOfOperation.ctr(encryptionKey, new aesjs.Counter(1));
|
|
21362
|
+
* const encryptedBytes = cipher.encrypt(aesjs.utils.utf8.toBytes(value));
|
|
21363
|
+
*
|
|
21364
|
+
* await SecureStore.setItemAsync(key, aesjs.utils.hex.fromBytes(encryptionKey));
|
|
21365
|
+
*
|
|
21366
|
+
* return aesjs.utils.hex.fromBytes(encryptedBytes);
|
|
21367
|
+
* }
|
|
21368
|
+
*
|
|
21369
|
+
* private async _decrypt(key: string, value: string) {
|
|
21370
|
+
* const encryptionKeyHex = await SecureStore.getItemAsync(key);
|
|
21371
|
+
* if (!encryptionKeyHex) {
|
|
21372
|
+
* return encryptionKeyHex;
|
|
21373
|
+
* }
|
|
21374
|
+
*
|
|
21375
|
+
* const cipher = new aesjs.ModeOfOperation.ctr(aesjs.utils.hex.toBytes(encryptionKeyHex), new aesjs.Counter(1));
|
|
21376
|
+
* const decryptedBytes = cipher.decrypt(aesjs.utils.hex.toBytes(value));
|
|
21377
|
+
*
|
|
21378
|
+
* return aesjs.utils.utf8.fromBytes(decryptedBytes);
|
|
21379
|
+
* }
|
|
21380
|
+
*
|
|
21381
|
+
* async getItem(key: string) {
|
|
21382
|
+
* const encrypted = await AsyncStorage.getItem(key);
|
|
21383
|
+
* if (!encrypted) { return encrypted; }
|
|
21384
|
+
*
|
|
21385
|
+
* return await this._decrypt(key, encrypted);
|
|
21386
|
+
* }
|
|
21387
|
+
*
|
|
21388
|
+
* async removeItem(key: string) {
|
|
21389
|
+
* await AsyncStorage.removeItem(key);
|
|
21390
|
+
* await SecureStore.deleteItemAsync(key);
|
|
21391
|
+
* }
|
|
21392
|
+
*
|
|
21393
|
+
* async setItem(key: string, value: string) {
|
|
21394
|
+
* const encrypted = await this._encrypt(key, value);
|
|
21395
|
+
*
|
|
21396
|
+
* await AsyncStorage.setItem(key, encrypted);
|
|
21397
|
+
* }
|
|
21398
|
+
* }
|
|
21399
|
+
*
|
|
21400
|
+
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", {
|
|
21401
|
+
* auth: {
|
|
21402
|
+
* storage: new LargeSecureStore(),
|
|
21403
|
+
* autoRefreshToken: true,
|
|
21404
|
+
* persistSession: true,
|
|
21405
|
+
* detectSessionInUrl: false,
|
|
21406
|
+
* },
|
|
21407
|
+
* });
|
|
21408
|
+
* ```
|
|
21409
|
+
*
|
|
21410
|
+
* @example With a database query
|
|
19802
21411
|
* ```ts
|
|
19803
21412
|
* import { createClient } from '@supabase/supabase-js'
|
|
19804
21413
|
*
|
|
19805
21414
|
* const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
|
|
21415
|
+
*
|
|
19806
21416
|
* const { data } = await supabase.from('profiles').select('*')
|
|
19807
21417
|
* ```
|
|
19808
21418
|
*/
|
|
@@ -78166,6 +79776,26 @@ var COMMAND_REGISTRY = [
|
|
|
78166
79776
|
loader: "../generators/sql-generator.ts"
|
|
78167
79777
|
},
|
|
78168
79778
|
// ---------------------------------------------------------------------------
|
|
79779
|
+
// Quality Analysis
|
|
79780
|
+
// ---------------------------------------------------------------------------
|
|
79781
|
+
{
|
|
79782
|
+
name: "retro",
|
|
79783
|
+
description: "Engineering retrospective - velocity, patterns, trends from git history",
|
|
79784
|
+
category: "development",
|
|
79785
|
+
options: [
|
|
79786
|
+
{
|
|
79787
|
+
flags: "-w, --window <window>",
|
|
79788
|
+
description: "Time window: 24h, 7d (default), 14d, 30d"
|
|
79789
|
+
},
|
|
79790
|
+
{
|
|
79791
|
+
flags: "--json",
|
|
79792
|
+
description: "Output raw JSON only (no decorative logging)"
|
|
79793
|
+
}
|
|
79794
|
+
],
|
|
79795
|
+
loader: "../quality/retro.ts",
|
|
79796
|
+
exportName: "retro"
|
|
79797
|
+
},
|
|
79798
|
+
// ---------------------------------------------------------------------------
|
|
78169
79799
|
// Other
|
|
78170
79800
|
// ---------------------------------------------------------------------------
|
|
78171
79801
|
{
|