@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
package/dist/bin/commands/db.js
CHANGED
|
@@ -7781,7 +7781,10 @@ var init_PathResolver = __esm({
|
|
|
7781
7781
|
*/
|
|
7782
7782
|
getEmptyCjsModulePath() {
|
|
7783
7783
|
const resolved = this.resolvePackage("@donotdev/core/empty");
|
|
7784
|
-
if (!resolved)
|
|
7784
|
+
if (!resolved)
|
|
7785
|
+
throw new Error(
|
|
7786
|
+
"Cannot resolve @donotdev/core/empty \u2014 package setup is broken"
|
|
7787
|
+
);
|
|
7785
7788
|
return resolved;
|
|
7786
7789
|
}
|
|
7787
7790
|
// === PRIVATE METHODS ===
|
|
@@ -8580,10 +8583,10 @@ var init_tslib_es6 = __esm({
|
|
|
8580
8583
|
}
|
|
8581
8584
|
});
|
|
8582
8585
|
|
|
8583
|
-
// node_modules/.bun/@supabase+functions-js@2.
|
|
8586
|
+
// node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/helper.js
|
|
8584
8587
|
var resolveFetch;
|
|
8585
8588
|
var init_helper = __esm({
|
|
8586
|
-
"node_modules/.bun/@supabase+functions-js@2.
|
|
8589
|
+
"node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/helper.js"() {
|
|
8587
8590
|
init_utils();
|
|
8588
8591
|
resolveFetch = (customFetch) => {
|
|
8589
8592
|
if (customFetch) {
|
|
@@ -8594,10 +8597,10 @@ var init_helper = __esm({
|
|
|
8594
8597
|
}
|
|
8595
8598
|
});
|
|
8596
8599
|
|
|
8597
|
-
// node_modules/.bun/@supabase+functions-js@2.
|
|
8600
|
+
// node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/types.js
|
|
8598
8601
|
var FunctionsError, FunctionsFetchError, FunctionsRelayError, FunctionsHttpError, FunctionRegion;
|
|
8599
8602
|
var init_types = __esm({
|
|
8600
|
-
"node_modules/.bun/@supabase+functions-js@2.
|
|
8603
|
+
"node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/types.js"() {
|
|
8601
8604
|
init_utils();
|
|
8602
8605
|
FunctionsError = class extends Error {
|
|
8603
8606
|
constructor(message, name = "FunctionsError", context2) {
|
|
@@ -8641,10 +8644,10 @@ var init_types = __esm({
|
|
|
8641
8644
|
}
|
|
8642
8645
|
});
|
|
8643
8646
|
|
|
8644
|
-
// node_modules/.bun/@supabase+functions-js@2.
|
|
8647
|
+
// node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
|
|
8645
8648
|
var FunctionsClient;
|
|
8646
8649
|
var init_FunctionsClient = __esm({
|
|
8647
|
-
"node_modules/.bun/@supabase+functions-js@2.
|
|
8650
|
+
"node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js"() {
|
|
8648
8651
|
init_utils();
|
|
8649
8652
|
init_tslib_es6();
|
|
8650
8653
|
init_helper();
|
|
@@ -8790,15 +8793,15 @@ var init_FunctionsClient = __esm({
|
|
|
8790
8793
|
}
|
|
8791
8794
|
});
|
|
8792
8795
|
|
|
8793
|
-
// node_modules/.bun/@supabase+functions-js@2.
|
|
8796
|
+
// node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/index.js
|
|
8794
8797
|
var init_module = __esm({
|
|
8795
|
-
"node_modules/.bun/@supabase+functions-js@2.
|
|
8798
|
+
"node_modules/.bun/@supabase+functions-js@2.99.1/node_modules/@supabase/functions-js/dist/module/index.js"() {
|
|
8796
8799
|
init_utils();
|
|
8797
8800
|
init_FunctionsClient();
|
|
8798
8801
|
}
|
|
8799
8802
|
});
|
|
8800
8803
|
|
|
8801
|
-
// node_modules/.bun/@supabase+postgrest-js@2.
|
|
8804
|
+
// node_modules/.bun/@supabase+postgrest-js@2.99.1/node_modules/@supabase/postgrest-js/dist/index.mjs
|
|
8802
8805
|
function _typeof(o2) {
|
|
8803
8806
|
"@babel/helpers - typeof";
|
|
8804
8807
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
@@ -8852,7 +8855,7 @@ function _objectSpread2(e3) {
|
|
|
8852
8855
|
}
|
|
8853
8856
|
var PostgrestError, PostgrestBuilder, PostgrestTransformBuilder, PostgrestReservedCharsRegexp, PostgrestFilterBuilder, PostgrestQueryBuilder, PostgrestClient;
|
|
8854
8857
|
var init_dist3 = __esm({
|
|
8855
|
-
"node_modules/.bun/@supabase+postgrest-js@2.
|
|
8858
|
+
"node_modules/.bun/@supabase+postgrest-js@2.99.1/node_modules/@supabase/postgrest-js/dist/index.mjs"() {
|
|
8856
8859
|
init_utils();
|
|
8857
8860
|
PostgrestError = class extends Error {
|
|
8858
8861
|
/**
|
|
@@ -9717,6 +9720,760 @@ ${cause.stack}`;
|
|
|
9717
9720
|
* @remarks
|
|
9718
9721
|
* When using `count` with `.range()` or `.limit()`, the returned `count` is the total number of rows
|
|
9719
9722
|
* that match your filters, not the number of rows in the current page. Use this to build pagination UI.
|
|
9723
|
+
|
|
9724
|
+
* - 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.
|
|
9725
|
+
* - `select()` can be combined with [Filters](/docs/reference/javascript/using-filters)
|
|
9726
|
+
* - `select()` can be combined with [Modifiers](/docs/reference/javascript/using-modifiers)
|
|
9727
|
+
* - `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). *
|
|
9728
|
+
* @category Database
|
|
9729
|
+
*
|
|
9730
|
+
* @example Getting your data
|
|
9731
|
+
* ```js
|
|
9732
|
+
* const { data, error } = await supabase
|
|
9733
|
+
* .from('characters')
|
|
9734
|
+
* .select()
|
|
9735
|
+
* ```
|
|
9736
|
+
*
|
|
9737
|
+
* @exampleSql Getting your data
|
|
9738
|
+
* ```sql
|
|
9739
|
+
* create table
|
|
9740
|
+
* characters (id int8 primary key, name text);
|
|
9741
|
+
*
|
|
9742
|
+
* insert into
|
|
9743
|
+
* characters (id, name)
|
|
9744
|
+
* values
|
|
9745
|
+
* (1, 'Harry'),
|
|
9746
|
+
* (2, 'Frodo'),
|
|
9747
|
+
* (3, 'Katniss');
|
|
9748
|
+
* ```
|
|
9749
|
+
*
|
|
9750
|
+
* @exampleResponse Getting your data
|
|
9751
|
+
* ```json
|
|
9752
|
+
* {
|
|
9753
|
+
* "data": [
|
|
9754
|
+
* {
|
|
9755
|
+
* "id": 1,
|
|
9756
|
+
* "name": "Harry"
|
|
9757
|
+
* },
|
|
9758
|
+
* {
|
|
9759
|
+
* "id": 2,
|
|
9760
|
+
* "name": "Frodo"
|
|
9761
|
+
* },
|
|
9762
|
+
* {
|
|
9763
|
+
* "id": 3,
|
|
9764
|
+
* "name": "Katniss"
|
|
9765
|
+
* }
|
|
9766
|
+
* ],
|
|
9767
|
+
* "status": 200,
|
|
9768
|
+
* "statusText": "OK"
|
|
9769
|
+
* }
|
|
9770
|
+
* ```
|
|
9771
|
+
*
|
|
9772
|
+
* @example Selecting specific columns
|
|
9773
|
+
* ```js
|
|
9774
|
+
* const { data, error } = await supabase
|
|
9775
|
+
* .from('characters')
|
|
9776
|
+
* .select('name')
|
|
9777
|
+
* ```
|
|
9778
|
+
*
|
|
9779
|
+
* @exampleSql Selecting specific columns
|
|
9780
|
+
* ```sql
|
|
9781
|
+
* create table
|
|
9782
|
+
* characters (id int8 primary key, name text);
|
|
9783
|
+
*
|
|
9784
|
+
* insert into
|
|
9785
|
+
* characters (id, name)
|
|
9786
|
+
* values
|
|
9787
|
+
* (1, 'Frodo'),
|
|
9788
|
+
* (2, 'Harry'),
|
|
9789
|
+
* (3, 'Katniss');
|
|
9790
|
+
* ```
|
|
9791
|
+
*
|
|
9792
|
+
* @exampleResponse Selecting specific columns
|
|
9793
|
+
* ```json
|
|
9794
|
+
* {
|
|
9795
|
+
* "data": [
|
|
9796
|
+
* {
|
|
9797
|
+
* "name": "Frodo"
|
|
9798
|
+
* },
|
|
9799
|
+
* {
|
|
9800
|
+
* "name": "Harry"
|
|
9801
|
+
* },
|
|
9802
|
+
* {
|
|
9803
|
+
* "name": "Katniss"
|
|
9804
|
+
* }
|
|
9805
|
+
* ],
|
|
9806
|
+
* "status": 200,
|
|
9807
|
+
* "statusText": "OK"
|
|
9808
|
+
* }
|
|
9809
|
+
* ```
|
|
9810
|
+
*
|
|
9811
|
+
* @exampleDescription Query referenced tables
|
|
9812
|
+
* If your database has foreign key relationships, you can query related tables too.
|
|
9813
|
+
*
|
|
9814
|
+
* @example Query referenced tables
|
|
9815
|
+
* ```js
|
|
9816
|
+
* const { data, error } = await supabase
|
|
9817
|
+
* .from('orchestral_sections')
|
|
9818
|
+
* .select(`
|
|
9819
|
+
* name,
|
|
9820
|
+
* instruments (
|
|
9821
|
+
* name
|
|
9822
|
+
* )
|
|
9823
|
+
* `)
|
|
9824
|
+
* ```
|
|
9825
|
+
*
|
|
9826
|
+
* @exampleSql Query referenced tables
|
|
9827
|
+
* ```sql
|
|
9828
|
+
* create table
|
|
9829
|
+
* orchestral_sections (id int8 primary key, name text);
|
|
9830
|
+
* create table
|
|
9831
|
+
* instruments (
|
|
9832
|
+
* id int8 primary key,
|
|
9833
|
+
* section_id int8 not null references orchestral_sections,
|
|
9834
|
+
* name text
|
|
9835
|
+
* );
|
|
9836
|
+
*
|
|
9837
|
+
* insert into
|
|
9838
|
+
* orchestral_sections (id, name)
|
|
9839
|
+
* values
|
|
9840
|
+
* (1, 'strings'),
|
|
9841
|
+
* (2, 'woodwinds');
|
|
9842
|
+
* insert into
|
|
9843
|
+
* instruments (id, section_id, name)
|
|
9844
|
+
* values
|
|
9845
|
+
* (1, 2, 'flute'),
|
|
9846
|
+
* (2, 1, 'violin');
|
|
9847
|
+
* ```
|
|
9848
|
+
*
|
|
9849
|
+
* @exampleResponse Query referenced tables
|
|
9850
|
+
* ```json
|
|
9851
|
+
* {
|
|
9852
|
+
* "data": [
|
|
9853
|
+
* {
|
|
9854
|
+
* "name": "strings",
|
|
9855
|
+
* "instruments": [
|
|
9856
|
+
* {
|
|
9857
|
+
* "name": "violin"
|
|
9858
|
+
* }
|
|
9859
|
+
* ]
|
|
9860
|
+
* },
|
|
9861
|
+
* {
|
|
9862
|
+
* "name": "woodwinds",
|
|
9863
|
+
* "instruments": [
|
|
9864
|
+
* {
|
|
9865
|
+
* "name": "flute"
|
|
9866
|
+
* }
|
|
9867
|
+
* ]
|
|
9868
|
+
* }
|
|
9869
|
+
* ],
|
|
9870
|
+
* "status": 200,
|
|
9871
|
+
* "statusText": "OK"
|
|
9872
|
+
* }
|
|
9873
|
+
* ```
|
|
9874
|
+
*
|
|
9875
|
+
* @exampleDescription Query referenced tables with spaces in their names
|
|
9876
|
+
* If your table name contains spaces, you must use double quotes in the `select` statement to reference the table.
|
|
9877
|
+
*
|
|
9878
|
+
* @example Query referenced tables with spaces in their names
|
|
9879
|
+
* ```js
|
|
9880
|
+
* const { data, error } = await supabase
|
|
9881
|
+
* .from('orchestral sections')
|
|
9882
|
+
* .select(`
|
|
9883
|
+
* name,
|
|
9884
|
+
* "musical instruments" (
|
|
9885
|
+
* name
|
|
9886
|
+
* )
|
|
9887
|
+
* `)
|
|
9888
|
+
* ```
|
|
9889
|
+
*
|
|
9890
|
+
* @exampleSql Query referenced tables with spaces in their names
|
|
9891
|
+
* ```sql
|
|
9892
|
+
* create table
|
|
9893
|
+
* "orchestral sections" (id int8 primary key, name text);
|
|
9894
|
+
* create table
|
|
9895
|
+
* "musical instruments" (
|
|
9896
|
+
* id int8 primary key,
|
|
9897
|
+
* section_id int8 not null references "orchestral sections",
|
|
9898
|
+
* name text
|
|
9899
|
+
* );
|
|
9900
|
+
*
|
|
9901
|
+
* insert into
|
|
9902
|
+
* "orchestral sections" (id, name)
|
|
9903
|
+
* values
|
|
9904
|
+
* (1, 'strings'),
|
|
9905
|
+
* (2, 'woodwinds');
|
|
9906
|
+
* insert into
|
|
9907
|
+
* "musical instruments" (id, section_id, name)
|
|
9908
|
+
* values
|
|
9909
|
+
* (1, 2, 'flute'),
|
|
9910
|
+
* (2, 1, 'violin');
|
|
9911
|
+
* ```
|
|
9912
|
+
*
|
|
9913
|
+
* @exampleResponse Query referenced tables with spaces in their names
|
|
9914
|
+
* ```json
|
|
9915
|
+
* {
|
|
9916
|
+
* "data": [
|
|
9917
|
+
* {
|
|
9918
|
+
* "name": "strings",
|
|
9919
|
+
* "musical instruments": [
|
|
9920
|
+
* {
|
|
9921
|
+
* "name": "violin"
|
|
9922
|
+
* }
|
|
9923
|
+
* ]
|
|
9924
|
+
* },
|
|
9925
|
+
* {
|
|
9926
|
+
* "name": "woodwinds",
|
|
9927
|
+
* "musical instruments": [
|
|
9928
|
+
* {
|
|
9929
|
+
* "name": "flute"
|
|
9930
|
+
* }
|
|
9931
|
+
* ]
|
|
9932
|
+
* }
|
|
9933
|
+
* ],
|
|
9934
|
+
* "status": 200,
|
|
9935
|
+
* "statusText": "OK"
|
|
9936
|
+
* }
|
|
9937
|
+
* ```
|
|
9938
|
+
*
|
|
9939
|
+
* @exampleDescription Query referenced tables through a join table
|
|
9940
|
+
* If you're in a situation where your tables are **NOT** directly
|
|
9941
|
+
* related, but instead are joined by a _join table_, you can still use
|
|
9942
|
+
* the `select()` method to query the related data. The join table needs
|
|
9943
|
+
* to have the foreign keys as part of its composite primary key.
|
|
9944
|
+
*
|
|
9945
|
+
* @example Query referenced tables through a join table
|
|
9946
|
+
* ```ts
|
|
9947
|
+
* const { data, error } = await supabase
|
|
9948
|
+
* .from('users')
|
|
9949
|
+
* .select(`
|
|
9950
|
+
* name,
|
|
9951
|
+
* teams (
|
|
9952
|
+
* name
|
|
9953
|
+
* )
|
|
9954
|
+
* `)
|
|
9955
|
+
*
|
|
9956
|
+
* ```
|
|
9957
|
+
*
|
|
9958
|
+
* @exampleSql Query referenced tables through a join table
|
|
9959
|
+
* ```sql
|
|
9960
|
+
* create table
|
|
9961
|
+
* users (
|
|
9962
|
+
* id int8 primary key,
|
|
9963
|
+
* name text
|
|
9964
|
+
* );
|
|
9965
|
+
* create table
|
|
9966
|
+
* teams (
|
|
9967
|
+
* id int8 primary key,
|
|
9968
|
+
* name text
|
|
9969
|
+
* );
|
|
9970
|
+
* -- join table
|
|
9971
|
+
* create table
|
|
9972
|
+
* users_teams (
|
|
9973
|
+
* user_id int8 not null references users,
|
|
9974
|
+
* team_id int8 not null references teams,
|
|
9975
|
+
* -- both foreign keys must be part of a composite primary key
|
|
9976
|
+
* primary key (user_id, team_id)
|
|
9977
|
+
* );
|
|
9978
|
+
*
|
|
9979
|
+
* insert into
|
|
9980
|
+
* users (id, name)
|
|
9981
|
+
* values
|
|
9982
|
+
* (1, 'Kiran'),
|
|
9983
|
+
* (2, 'Evan');
|
|
9984
|
+
* insert into
|
|
9985
|
+
* teams (id, name)
|
|
9986
|
+
* values
|
|
9987
|
+
* (1, 'Green'),
|
|
9988
|
+
* (2, 'Blue');
|
|
9989
|
+
* insert into
|
|
9990
|
+
* users_teams (user_id, team_id)
|
|
9991
|
+
* values
|
|
9992
|
+
* (1, 1),
|
|
9993
|
+
* (1, 2),
|
|
9994
|
+
* (2, 2);
|
|
9995
|
+
* ```
|
|
9996
|
+
*
|
|
9997
|
+
* @exampleResponse Query referenced tables through a join table
|
|
9998
|
+
* ```json
|
|
9999
|
+
* {
|
|
10000
|
+
* "data": [
|
|
10001
|
+
* {
|
|
10002
|
+
* "name": "Kiran",
|
|
10003
|
+
* "teams": [
|
|
10004
|
+
* {
|
|
10005
|
+
* "name": "Green"
|
|
10006
|
+
* },
|
|
10007
|
+
* {
|
|
10008
|
+
* "name": "Blue"
|
|
10009
|
+
* }
|
|
10010
|
+
* ]
|
|
10011
|
+
* },
|
|
10012
|
+
* {
|
|
10013
|
+
* "name": "Evan",
|
|
10014
|
+
* "teams": [
|
|
10015
|
+
* {
|
|
10016
|
+
* "name": "Blue"
|
|
10017
|
+
* }
|
|
10018
|
+
* ]
|
|
10019
|
+
* }
|
|
10020
|
+
* ],
|
|
10021
|
+
* "status": 200,
|
|
10022
|
+
* "statusText": "OK"
|
|
10023
|
+
* }
|
|
10024
|
+
*
|
|
10025
|
+
* ```
|
|
10026
|
+
*
|
|
10027
|
+
* @exampleDescription Query the same referenced table multiple times
|
|
10028
|
+
* If you need to query the same referenced table twice, use the name of the
|
|
10029
|
+
* joined column to identify which join to use. You can also give each
|
|
10030
|
+
* column an alias.
|
|
10031
|
+
*
|
|
10032
|
+
* @example Query the same referenced table multiple times
|
|
10033
|
+
* ```ts
|
|
10034
|
+
* const { data, error } = await supabase
|
|
10035
|
+
* .from('messages')
|
|
10036
|
+
* .select(`
|
|
10037
|
+
* content,
|
|
10038
|
+
* from:sender_id(name),
|
|
10039
|
+
* to:receiver_id(name)
|
|
10040
|
+
* `)
|
|
10041
|
+
*
|
|
10042
|
+
* // To infer types, use the name of the table (in this case `users`) and
|
|
10043
|
+
* // the name of the foreign key constraint.
|
|
10044
|
+
* const { data, error } = await supabase
|
|
10045
|
+
* .from('messages')
|
|
10046
|
+
* .select(`
|
|
10047
|
+
* content,
|
|
10048
|
+
* from:users!messages_sender_id_fkey(name),
|
|
10049
|
+
* to:users!messages_receiver_id_fkey(name)
|
|
10050
|
+
* `)
|
|
10051
|
+
* ```
|
|
10052
|
+
*
|
|
10053
|
+
* @exampleSql Query the same referenced table multiple times
|
|
10054
|
+
* ```sql
|
|
10055
|
+
* create table
|
|
10056
|
+
* users (id int8 primary key, name text);
|
|
10057
|
+
*
|
|
10058
|
+
* create table
|
|
10059
|
+
* messages (
|
|
10060
|
+
* sender_id int8 not null references users,
|
|
10061
|
+
* receiver_id int8 not null references users,
|
|
10062
|
+
* content text
|
|
10063
|
+
* );
|
|
10064
|
+
*
|
|
10065
|
+
* insert into
|
|
10066
|
+
* users (id, name)
|
|
10067
|
+
* values
|
|
10068
|
+
* (1, 'Kiran'),
|
|
10069
|
+
* (2, 'Evan');
|
|
10070
|
+
*
|
|
10071
|
+
* insert into
|
|
10072
|
+
* messages (sender_id, receiver_id, content)
|
|
10073
|
+
* values
|
|
10074
|
+
* (1, 2, '👋');
|
|
10075
|
+
* ```
|
|
10076
|
+
* ```
|
|
10077
|
+
*
|
|
10078
|
+
* @exampleResponse Query the same referenced table multiple times
|
|
10079
|
+
* ```json
|
|
10080
|
+
* {
|
|
10081
|
+
* "data": [
|
|
10082
|
+
* {
|
|
10083
|
+
* "content": "👋",
|
|
10084
|
+
* "from": {
|
|
10085
|
+
* "name": "Kiran"
|
|
10086
|
+
* },
|
|
10087
|
+
* "to": {
|
|
10088
|
+
* "name": "Evan"
|
|
10089
|
+
* }
|
|
10090
|
+
* }
|
|
10091
|
+
* ],
|
|
10092
|
+
* "status": 200,
|
|
10093
|
+
* "statusText": "OK"
|
|
10094
|
+
* }
|
|
10095
|
+
* ```
|
|
10096
|
+
*
|
|
10097
|
+
* @exampleDescription Query nested foreign tables through a join table
|
|
10098
|
+
* You can use the result of a joined table to gather data in
|
|
10099
|
+
* another foreign table. With multiple references to the same foreign
|
|
10100
|
+
* table you must specify the column on which to conduct the join.
|
|
10101
|
+
*
|
|
10102
|
+
* @example Query nested foreign tables through a join table
|
|
10103
|
+
* ```ts
|
|
10104
|
+
* const { data, error } = await supabase
|
|
10105
|
+
* .from('games')
|
|
10106
|
+
* .select(`
|
|
10107
|
+
* game_id:id,
|
|
10108
|
+
* away_team:teams!games_away_team_fkey (
|
|
10109
|
+
* users (
|
|
10110
|
+
* id,
|
|
10111
|
+
* name
|
|
10112
|
+
* )
|
|
10113
|
+
* )
|
|
10114
|
+
* `)
|
|
10115
|
+
*
|
|
10116
|
+
* ```
|
|
10117
|
+
*
|
|
10118
|
+
* @exampleSql Query nested foreign tables through a join table
|
|
10119
|
+
* ```sql
|
|
10120
|
+
* ```sql
|
|
10121
|
+
* create table
|
|
10122
|
+
* users (
|
|
10123
|
+
* id int8 primary key,
|
|
10124
|
+
* name text
|
|
10125
|
+
* );
|
|
10126
|
+
* create table
|
|
10127
|
+
* teams (
|
|
10128
|
+
* id int8 primary key,
|
|
10129
|
+
* name text
|
|
10130
|
+
* );
|
|
10131
|
+
* -- join table
|
|
10132
|
+
* create table
|
|
10133
|
+
* users_teams (
|
|
10134
|
+
* user_id int8 not null references users,
|
|
10135
|
+
* team_id int8 not null references teams,
|
|
10136
|
+
*
|
|
10137
|
+
* primary key (user_id, team_id)
|
|
10138
|
+
* );
|
|
10139
|
+
* create table
|
|
10140
|
+
* games (
|
|
10141
|
+
* id int8 primary key,
|
|
10142
|
+
* home_team int8 not null references teams,
|
|
10143
|
+
* away_team int8 not null references teams,
|
|
10144
|
+
* name text
|
|
10145
|
+
* );
|
|
10146
|
+
*
|
|
10147
|
+
* insert into users (id, name)
|
|
10148
|
+
* values
|
|
10149
|
+
* (1, 'Kiran'),
|
|
10150
|
+
* (2, 'Evan');
|
|
10151
|
+
* insert into
|
|
10152
|
+
* teams (id, name)
|
|
10153
|
+
* values
|
|
10154
|
+
* (1, 'Green'),
|
|
10155
|
+
* (2, 'Blue');
|
|
10156
|
+
* insert into
|
|
10157
|
+
* users_teams (user_id, team_id)
|
|
10158
|
+
* values
|
|
10159
|
+
* (1, 1),
|
|
10160
|
+
* (1, 2),
|
|
10161
|
+
* (2, 2);
|
|
10162
|
+
* insert into
|
|
10163
|
+
* games (id, home_team, away_team, name)
|
|
10164
|
+
* values
|
|
10165
|
+
* (1, 1, 2, 'Green vs Blue'),
|
|
10166
|
+
* (2, 2, 1, 'Blue vs Green');
|
|
10167
|
+
* ```
|
|
10168
|
+
*
|
|
10169
|
+
* @exampleResponse Query nested foreign tables through a join table
|
|
10170
|
+
* ```json
|
|
10171
|
+
* {
|
|
10172
|
+
* "data": [
|
|
10173
|
+
* {
|
|
10174
|
+
* "game_id": 1,
|
|
10175
|
+
* "away_team": {
|
|
10176
|
+
* "users": [
|
|
10177
|
+
* {
|
|
10178
|
+
* "id": 1,
|
|
10179
|
+
* "name": "Kiran"
|
|
10180
|
+
* },
|
|
10181
|
+
* {
|
|
10182
|
+
* "id": 2,
|
|
10183
|
+
* "name": "Evan"
|
|
10184
|
+
* }
|
|
10185
|
+
* ]
|
|
10186
|
+
* }
|
|
10187
|
+
* },
|
|
10188
|
+
* {
|
|
10189
|
+
* "game_id": 2,
|
|
10190
|
+
* "away_team": {
|
|
10191
|
+
* "users": [
|
|
10192
|
+
* {
|
|
10193
|
+
* "id": 1,
|
|
10194
|
+
* "name": "Kiran"
|
|
10195
|
+
* }
|
|
10196
|
+
* ]
|
|
10197
|
+
* }
|
|
10198
|
+
* }
|
|
10199
|
+
* ],
|
|
10200
|
+
* "status": 200,
|
|
10201
|
+
* "statusText": "OK"
|
|
10202
|
+
* }
|
|
10203
|
+
*
|
|
10204
|
+
* ```
|
|
10205
|
+
*
|
|
10206
|
+
* @exampleDescription Filtering through referenced tables
|
|
10207
|
+
* If the filter on a referenced table's column is not satisfied, the referenced
|
|
10208
|
+
* table returns `[]` or `null` but the parent table is not filtered out.
|
|
10209
|
+
* If you want to filter out the parent table rows, use the `!inner` hint
|
|
10210
|
+
*
|
|
10211
|
+
* @example Filtering through referenced tables
|
|
10212
|
+
* ```ts
|
|
10213
|
+
* const { data, error } = await supabase
|
|
10214
|
+
* .from('instruments')
|
|
10215
|
+
* .select('name, orchestral_sections(*)')
|
|
10216
|
+
* .eq('orchestral_sections.name', 'percussion')
|
|
10217
|
+
* ```
|
|
10218
|
+
*
|
|
10219
|
+
* @exampleSql Filtering through referenced tables
|
|
10220
|
+
* ```sql
|
|
10221
|
+
* create table
|
|
10222
|
+
* orchestral_sections (id int8 primary key, name text);
|
|
10223
|
+
* create table
|
|
10224
|
+
* instruments (
|
|
10225
|
+
* id int8 primary key,
|
|
10226
|
+
* section_id int8 not null references orchestral_sections,
|
|
10227
|
+
* name text
|
|
10228
|
+
* );
|
|
10229
|
+
*
|
|
10230
|
+
* insert into
|
|
10231
|
+
* orchestral_sections (id, name)
|
|
10232
|
+
* values
|
|
10233
|
+
* (1, 'strings'),
|
|
10234
|
+
* (2, 'woodwinds');
|
|
10235
|
+
* insert into
|
|
10236
|
+
* instruments (id, section_id, name)
|
|
10237
|
+
* values
|
|
10238
|
+
* (1, 2, 'flute'),
|
|
10239
|
+
* (2, 1, 'violin');
|
|
10240
|
+
* ```
|
|
10241
|
+
*
|
|
10242
|
+
* @exampleResponse Filtering through referenced tables
|
|
10243
|
+
* ```json
|
|
10244
|
+
* {
|
|
10245
|
+
* "data": [
|
|
10246
|
+
* {
|
|
10247
|
+
* "name": "flute",
|
|
10248
|
+
* "orchestral_sections": null
|
|
10249
|
+
* },
|
|
10250
|
+
* {
|
|
10251
|
+
* "name": "violin",
|
|
10252
|
+
* "orchestral_sections": null
|
|
10253
|
+
* }
|
|
10254
|
+
* ],
|
|
10255
|
+
* "status": 200,
|
|
10256
|
+
* "statusText": "OK"
|
|
10257
|
+
* }
|
|
10258
|
+
* ```
|
|
10259
|
+
*
|
|
10260
|
+
* @exampleDescription Querying referenced table with count
|
|
10261
|
+
* You can get the number of rows in a related table by using the
|
|
10262
|
+
* **count** property.
|
|
10263
|
+
*
|
|
10264
|
+
* @example Querying referenced table with count
|
|
10265
|
+
* ```ts
|
|
10266
|
+
* const { data, error } = await supabase
|
|
10267
|
+
* .from('orchestral_sections')
|
|
10268
|
+
* .select(`*, instruments(count)`)
|
|
10269
|
+
* ```
|
|
10270
|
+
*
|
|
10271
|
+
* @exampleSql Querying referenced table with count
|
|
10272
|
+
* ```sql
|
|
10273
|
+
* create table orchestral_sections (
|
|
10274
|
+
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
10275
|
+
* "name" text
|
|
10276
|
+
* );
|
|
10277
|
+
*
|
|
10278
|
+
* create table characters (
|
|
10279
|
+
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
10280
|
+
* "name" text,
|
|
10281
|
+
* "section_id" "uuid" references public.orchestral_sections on delete cascade
|
|
10282
|
+
* );
|
|
10283
|
+
*
|
|
10284
|
+
* with section as (
|
|
10285
|
+
* insert into orchestral_sections (name)
|
|
10286
|
+
* values ('strings') returning id
|
|
10287
|
+
* )
|
|
10288
|
+
* insert into instruments (name, section_id) values
|
|
10289
|
+
* ('violin', (select id from section)),
|
|
10290
|
+
* ('viola', (select id from section)),
|
|
10291
|
+
* ('cello', (select id from section)),
|
|
10292
|
+
* ('double bass', (select id from section));
|
|
10293
|
+
* ```
|
|
10294
|
+
*
|
|
10295
|
+
* @exampleResponse Querying referenced table with count
|
|
10296
|
+
* ```json
|
|
10297
|
+
* [
|
|
10298
|
+
* {
|
|
10299
|
+
* "id": "693694e7-d993-4360-a6d7-6294e325d9b6",
|
|
10300
|
+
* "name": "strings",
|
|
10301
|
+
* "instruments": [
|
|
10302
|
+
* {
|
|
10303
|
+
* "count": 4
|
|
10304
|
+
* }
|
|
10305
|
+
* ]
|
|
10306
|
+
* }
|
|
10307
|
+
* ]
|
|
10308
|
+
* ```
|
|
10309
|
+
*
|
|
10310
|
+
* @exampleDescription Querying with count option
|
|
10311
|
+
* You can get the number of rows by using the
|
|
10312
|
+
* [count](/docs/reference/javascript/select#parameters) option.
|
|
10313
|
+
*
|
|
10314
|
+
* @example Querying with count option
|
|
10315
|
+
* ```ts
|
|
10316
|
+
* const { count, error } = await supabase
|
|
10317
|
+
* .from('characters')
|
|
10318
|
+
* .select('*', { count: 'exact', head: true })
|
|
10319
|
+
* ```
|
|
10320
|
+
*
|
|
10321
|
+
* @exampleSql Querying with count option
|
|
10322
|
+
* ```sql
|
|
10323
|
+
* create table
|
|
10324
|
+
* characters (id int8 primary key, name text);
|
|
10325
|
+
*
|
|
10326
|
+
* insert into
|
|
10327
|
+
* characters (id, name)
|
|
10328
|
+
* values
|
|
10329
|
+
* (1, 'Luke'),
|
|
10330
|
+
* (2, 'Leia'),
|
|
10331
|
+
* (3, 'Han');
|
|
10332
|
+
* ```
|
|
10333
|
+
*
|
|
10334
|
+
* @exampleResponse Querying with count option
|
|
10335
|
+
* ```json
|
|
10336
|
+
* {
|
|
10337
|
+
* "count": 3,
|
|
10338
|
+
* "status": 200,
|
|
10339
|
+
* "statusText": "OK"
|
|
10340
|
+
* }
|
|
10341
|
+
* ```
|
|
10342
|
+
*
|
|
10343
|
+
* @exampleDescription Querying JSON data
|
|
10344
|
+
* You can select and filter data inside of
|
|
10345
|
+
* [JSON](/docs/guides/database/json) columns. Postgres offers some
|
|
10346
|
+
* [operators](/docs/guides/database/json#query-the-jsonb-data) for
|
|
10347
|
+
* querying JSON data.
|
|
10348
|
+
*
|
|
10349
|
+
* @example Querying JSON data
|
|
10350
|
+
* ```ts
|
|
10351
|
+
* const { data, error } = await supabase
|
|
10352
|
+
* .from('users')
|
|
10353
|
+
* .select(`
|
|
10354
|
+
* id, name,
|
|
10355
|
+
* address->city
|
|
10356
|
+
* `)
|
|
10357
|
+
* ```
|
|
10358
|
+
*
|
|
10359
|
+
* @exampleSql Querying JSON data
|
|
10360
|
+
* ```sql
|
|
10361
|
+
* create table
|
|
10362
|
+
* users (
|
|
10363
|
+
* id int8 primary key,
|
|
10364
|
+
* name text,
|
|
10365
|
+
* address jsonb
|
|
10366
|
+
* );
|
|
10367
|
+
*
|
|
10368
|
+
* insert into
|
|
10369
|
+
* users (id, name, address)
|
|
10370
|
+
* values
|
|
10371
|
+
* (1, 'Frodo', '{"city":"Hobbiton"}');
|
|
10372
|
+
* ```
|
|
10373
|
+
*
|
|
10374
|
+
* @exampleResponse Querying JSON data
|
|
10375
|
+
* ```json
|
|
10376
|
+
* {
|
|
10377
|
+
* "data": [
|
|
10378
|
+
* {
|
|
10379
|
+
* "id": 1,
|
|
10380
|
+
* "name": "Frodo",
|
|
10381
|
+
* "city": "Hobbiton"
|
|
10382
|
+
* }
|
|
10383
|
+
* ],
|
|
10384
|
+
* "status": 200,
|
|
10385
|
+
* "statusText": "OK"
|
|
10386
|
+
* }
|
|
10387
|
+
* ```
|
|
10388
|
+
*
|
|
10389
|
+
* @exampleDescription Querying referenced table with inner join
|
|
10390
|
+
* If you don't want to return the referenced table contents, you can leave the parenthesis empty.
|
|
10391
|
+
* Like `.select('name, orchestral_sections!inner()')`.
|
|
10392
|
+
*
|
|
10393
|
+
* @example Querying referenced table with inner join
|
|
10394
|
+
* ```ts
|
|
10395
|
+
* const { data, error } = await supabase
|
|
10396
|
+
* .from('instruments')
|
|
10397
|
+
* .select('name, orchestral_sections!inner(name)')
|
|
10398
|
+
* .eq('orchestral_sections.name', 'woodwinds')
|
|
10399
|
+
* .limit(1)
|
|
10400
|
+
* ```
|
|
10401
|
+
*
|
|
10402
|
+
* @exampleSql Querying referenced table with inner join
|
|
10403
|
+
* ```sql
|
|
10404
|
+
* create table orchestral_sections (
|
|
10405
|
+
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
10406
|
+
* "name" text
|
|
10407
|
+
* );
|
|
10408
|
+
*
|
|
10409
|
+
* create table instruments (
|
|
10410
|
+
* "id" "uuid" primary key default "extensions"."uuid_generate_v4"() not null,
|
|
10411
|
+
* "name" text,
|
|
10412
|
+
* "section_id" "uuid" references public.orchestral_sections on delete cascade
|
|
10413
|
+
* );
|
|
10414
|
+
*
|
|
10415
|
+
* with section as (
|
|
10416
|
+
* insert into orchestral_sections (name)
|
|
10417
|
+
* values ('woodwinds') returning id
|
|
10418
|
+
* )
|
|
10419
|
+
* insert into instruments (name, section_id) values
|
|
10420
|
+
* ('flute', (select id from section)),
|
|
10421
|
+
* ('clarinet', (select id from section)),
|
|
10422
|
+
* ('bassoon', (select id from section)),
|
|
10423
|
+
* ('piccolo', (select id from section));
|
|
10424
|
+
* ```
|
|
10425
|
+
*
|
|
10426
|
+
* @exampleResponse Querying referenced table with inner join
|
|
10427
|
+
* ```json
|
|
10428
|
+
* {
|
|
10429
|
+
* "data": [
|
|
10430
|
+
* {
|
|
10431
|
+
* "name": "flute",
|
|
10432
|
+
* "orchestral_sections": {"name": "woodwinds"}
|
|
10433
|
+
* }
|
|
10434
|
+
* ],
|
|
10435
|
+
* "status": 200,
|
|
10436
|
+
* "statusText": "OK"
|
|
10437
|
+
* }
|
|
10438
|
+
* ```
|
|
10439
|
+
*
|
|
10440
|
+
* @exampleDescription Switching schemas per query
|
|
10441
|
+
* In addition to setting the schema during initialization, you can also switch schemas on a per-query basis.
|
|
10442
|
+
* Make sure you've set up your [database privileges and API settings](/docs/guides/api/using-custom-schemas).
|
|
10443
|
+
*
|
|
10444
|
+
* @example Switching schemas per query
|
|
10445
|
+
* ```ts
|
|
10446
|
+
* const { data, error } = await supabase
|
|
10447
|
+
* .schema('myschema')
|
|
10448
|
+
* .from('mytable')
|
|
10449
|
+
* .select()
|
|
10450
|
+
* ```
|
|
10451
|
+
*
|
|
10452
|
+
* @exampleSql Switching schemas per query
|
|
10453
|
+
* ```sql
|
|
10454
|
+
* create schema myschema;
|
|
10455
|
+
*
|
|
10456
|
+
* create table myschema.mytable (
|
|
10457
|
+
* id uuid primary key default gen_random_uuid(),
|
|
10458
|
+
* data text
|
|
10459
|
+
* );
|
|
10460
|
+
*
|
|
10461
|
+
* insert into myschema.mytable (data) values ('mydata');
|
|
10462
|
+
* ```
|
|
10463
|
+
*
|
|
10464
|
+
* @exampleResponse Switching schemas per query
|
|
10465
|
+
* ```json
|
|
10466
|
+
* {
|
|
10467
|
+
* "data": [
|
|
10468
|
+
* {
|
|
10469
|
+
* "id": "4162e008-27b0-4c0f-82dc-ccaeee9a624d",
|
|
10470
|
+
* "data": "mydata"
|
|
10471
|
+
* }
|
|
10472
|
+
* ],
|
|
10473
|
+
* "status": 200,
|
|
10474
|
+
* "statusText": "OK"
|
|
10475
|
+
* }
|
|
10476
|
+
* ```
|
|
9720
10477
|
*/
|
|
9721
10478
|
select(columns, options) {
|
|
9722
10479
|
const { head: head2 = false, count } = options !== null && options !== void 0 ? options : {};
|
|
@@ -9764,6 +10521,91 @@ ${cause.stack}`;
|
|
|
9764
10521
|
* @param options.defaultToNull - Make missing fields default to `null`.
|
|
9765
10522
|
* Otherwise, use the default value for the column. Only applies for bulk
|
|
9766
10523
|
* inserts.
|
|
10524
|
+
*
|
|
10525
|
+
* @category Database
|
|
10526
|
+
*
|
|
10527
|
+
* @example Create a record
|
|
10528
|
+
* ```ts
|
|
10529
|
+
* const { error } = await supabase
|
|
10530
|
+
* .from('countries')
|
|
10531
|
+
* .insert({ id: 1, name: 'Mordor' })
|
|
10532
|
+
* ```
|
|
10533
|
+
*
|
|
10534
|
+
* @exampleSql Create a record
|
|
10535
|
+
* ```sql
|
|
10536
|
+
* create table
|
|
10537
|
+
* countries (id int8 primary key, name text);
|
|
10538
|
+
* ```
|
|
10539
|
+
*
|
|
10540
|
+
* @exampleResponse Create a record
|
|
10541
|
+
* ```json
|
|
10542
|
+
* {
|
|
10543
|
+
* "status": 201,
|
|
10544
|
+
* "statusText": "Created"
|
|
10545
|
+
* }
|
|
10546
|
+
* ```
|
|
10547
|
+
*
|
|
10548
|
+
* @example Create a record and return it
|
|
10549
|
+
* ```ts
|
|
10550
|
+
* const { data, error } = await supabase
|
|
10551
|
+
* .from('countries')
|
|
10552
|
+
* .insert({ id: 1, name: 'Mordor' })
|
|
10553
|
+
* .select()
|
|
10554
|
+
* ```
|
|
10555
|
+
*
|
|
10556
|
+
* @exampleSql Create a record and return it
|
|
10557
|
+
* ```sql
|
|
10558
|
+
* create table
|
|
10559
|
+
* countries (id int8 primary key, name text);
|
|
10560
|
+
* ```
|
|
10561
|
+
*
|
|
10562
|
+
* @exampleResponse Create a record and return it
|
|
10563
|
+
* ```json
|
|
10564
|
+
* {
|
|
10565
|
+
* "data": [
|
|
10566
|
+
* {
|
|
10567
|
+
* "id": 1,
|
|
10568
|
+
* "name": "Mordor"
|
|
10569
|
+
* }
|
|
10570
|
+
* ],
|
|
10571
|
+
* "status": 201,
|
|
10572
|
+
* "statusText": "Created"
|
|
10573
|
+
* }
|
|
10574
|
+
* ```
|
|
10575
|
+
*
|
|
10576
|
+
* @exampleDescription Bulk create
|
|
10577
|
+
* A bulk create operation is handled in a single transaction.
|
|
10578
|
+
* If any of the inserts fail, none of the rows are inserted.
|
|
10579
|
+
*
|
|
10580
|
+
* @example Bulk create
|
|
10581
|
+
* ```ts
|
|
10582
|
+
* const { error } = await supabase
|
|
10583
|
+
* .from('countries')
|
|
10584
|
+
* .insert([
|
|
10585
|
+
* { id: 1, name: 'Mordor' },
|
|
10586
|
+
* { id: 1, name: 'The Shire' },
|
|
10587
|
+
* ])
|
|
10588
|
+
* ```
|
|
10589
|
+
*
|
|
10590
|
+
* @exampleSql Bulk create
|
|
10591
|
+
* ```sql
|
|
10592
|
+
* create table
|
|
10593
|
+
* countries (id int8 primary key, name text);
|
|
10594
|
+
* ```
|
|
10595
|
+
*
|
|
10596
|
+
* @exampleResponse Bulk create
|
|
10597
|
+
* ```json
|
|
10598
|
+
* {
|
|
10599
|
+
* "error": {
|
|
10600
|
+
* "code": "23505",
|
|
10601
|
+
* "details": "Key (id)=(1) already exists.",
|
|
10602
|
+
* "hint": null,
|
|
10603
|
+
* "message": "duplicate key value violates unique constraint \"countries_pkey\""
|
|
10604
|
+
* },
|
|
10605
|
+
* "status": 409,
|
|
10606
|
+
* "statusText": "Conflict"
|
|
10607
|
+
* }
|
|
10608
|
+
* ```
|
|
9767
10609
|
*/
|
|
9768
10610
|
insert(values, { count, defaultToNull = true } = {}) {
|
|
9769
10611
|
var _this$fetch;
|
|
@@ -9872,6 +10714,129 @@ ${cause.stack}`;
|
|
|
9872
10714
|
* // error: null
|
|
9873
10715
|
* // }
|
|
9874
10716
|
* ```
|
|
10717
|
+
*
|
|
10718
|
+
* @category Database
|
|
10719
|
+
*
|
|
10720
|
+
* @remarks
|
|
10721
|
+
* - Primary keys must be included in `values` to use upsert.
|
|
10722
|
+
*
|
|
10723
|
+
* @example Upsert your data
|
|
10724
|
+
* ```ts
|
|
10725
|
+
* const { data, error } = await supabase
|
|
10726
|
+
* .from('instruments')
|
|
10727
|
+
* .upsert({ id: 1, name: 'piano' })
|
|
10728
|
+
* .select()
|
|
10729
|
+
* ```
|
|
10730
|
+
*
|
|
10731
|
+
* @exampleSql Upsert your data
|
|
10732
|
+
* ```sql
|
|
10733
|
+
* create table
|
|
10734
|
+
* instruments (id int8 primary key, name text);
|
|
10735
|
+
*
|
|
10736
|
+
* insert into
|
|
10737
|
+
* instruments (id, name)
|
|
10738
|
+
* values
|
|
10739
|
+
* (1, 'harpsichord');
|
|
10740
|
+
* ```
|
|
10741
|
+
*
|
|
10742
|
+
* @exampleResponse Upsert your data
|
|
10743
|
+
* ```json
|
|
10744
|
+
* {
|
|
10745
|
+
* "data": [
|
|
10746
|
+
* {
|
|
10747
|
+
* "id": 1,
|
|
10748
|
+
* "name": "piano"
|
|
10749
|
+
* }
|
|
10750
|
+
* ],
|
|
10751
|
+
* "status": 201,
|
|
10752
|
+
* "statusText": "Created"
|
|
10753
|
+
* }
|
|
10754
|
+
* ```
|
|
10755
|
+
*
|
|
10756
|
+
* @example Bulk Upsert your data
|
|
10757
|
+
* ```ts
|
|
10758
|
+
* const { data, error } = await supabase
|
|
10759
|
+
* .from('instruments')
|
|
10760
|
+
* .upsert([
|
|
10761
|
+
* { id: 1, name: 'piano' },
|
|
10762
|
+
* { id: 2, name: 'harp' },
|
|
10763
|
+
* ])
|
|
10764
|
+
* .select()
|
|
10765
|
+
* ```
|
|
10766
|
+
*
|
|
10767
|
+
* @exampleSql Bulk Upsert your data
|
|
10768
|
+
* ```sql
|
|
10769
|
+
* create table
|
|
10770
|
+
* instruments (id int8 primary key, name text);
|
|
10771
|
+
*
|
|
10772
|
+
* insert into
|
|
10773
|
+
* instruments (id, name)
|
|
10774
|
+
* values
|
|
10775
|
+
* (1, 'harpsichord');
|
|
10776
|
+
* ```
|
|
10777
|
+
*
|
|
10778
|
+
* @exampleResponse Bulk Upsert your data
|
|
10779
|
+
* ```json
|
|
10780
|
+
* {
|
|
10781
|
+
* "data": [
|
|
10782
|
+
* {
|
|
10783
|
+
* "id": 1,
|
|
10784
|
+
* "name": "piano"
|
|
10785
|
+
* },
|
|
10786
|
+
* {
|
|
10787
|
+
* "id": 2,
|
|
10788
|
+
* "name": "harp"
|
|
10789
|
+
* }
|
|
10790
|
+
* ],
|
|
10791
|
+
* "status": 201,
|
|
10792
|
+
* "statusText": "Created"
|
|
10793
|
+
* }
|
|
10794
|
+
* ```
|
|
10795
|
+
*
|
|
10796
|
+
* @exampleDescription Upserting into tables with constraints
|
|
10797
|
+
* In the following query, `upsert()` implicitly uses the `id`
|
|
10798
|
+
* (primary key) column to determine conflicts. If there is no existing
|
|
10799
|
+
* row with the same `id`, `upsert()` inserts a new row, which
|
|
10800
|
+
* will fail in this case as there is already a row with `handle` `"saoirse"`.
|
|
10801
|
+
* Using the `onConflict` option, you can instruct `upsert()` to use
|
|
10802
|
+
* another column with a unique constraint to determine conflicts.
|
|
10803
|
+
*
|
|
10804
|
+
* @example Upserting into tables with constraints
|
|
10805
|
+
* ```ts
|
|
10806
|
+
* const { data, error } = await supabase
|
|
10807
|
+
* .from('users')
|
|
10808
|
+
* .upsert({ id: 42, handle: 'saoirse', display_name: 'Saoirse' })
|
|
10809
|
+
* .select()
|
|
10810
|
+
* ```
|
|
10811
|
+
*
|
|
10812
|
+
* @exampleSql Upserting into tables with constraints
|
|
10813
|
+
* ```sql
|
|
10814
|
+
* create table
|
|
10815
|
+
* users (
|
|
10816
|
+
* id int8 generated by default as identity primary key,
|
|
10817
|
+
* handle text not null unique,
|
|
10818
|
+
* display_name text
|
|
10819
|
+
* );
|
|
10820
|
+
*
|
|
10821
|
+
* insert into
|
|
10822
|
+
* users (id, handle, display_name)
|
|
10823
|
+
* values
|
|
10824
|
+
* (1, 'saoirse', null);
|
|
10825
|
+
* ```
|
|
10826
|
+
*
|
|
10827
|
+
* @exampleResponse Upserting into tables with constraints
|
|
10828
|
+
* ```json
|
|
10829
|
+
* {
|
|
10830
|
+
* "error": {
|
|
10831
|
+
* "code": "23505",
|
|
10832
|
+
* "details": "Key (handle)=(saoirse) already exists.",
|
|
10833
|
+
* "hint": null,
|
|
10834
|
+
* "message": "duplicate key value violates unique constraint \"users_handle_key\""
|
|
10835
|
+
* },
|
|
10836
|
+
* "status": 409,
|
|
10837
|
+
* "statusText": "Conflict"
|
|
10838
|
+
* }
|
|
10839
|
+
* ```
|
|
9875
10840
|
*/
|
|
9876
10841
|
upsert(values, { onConflict, ignoreDuplicates = false, count, defaultToNull = true } = {}) {
|
|
9877
10842
|
var _this$fetch2;
|
|
@@ -9901,23 +10866,141 @@ ${cause.stack}`;
|
|
|
9901
10866
|
/**
|
|
9902
10867
|
* Perform an UPDATE on the table or view.
|
|
9903
10868
|
*
|
|
9904
|
-
* By default, updated rows are not returned. To return it, chain the call
|
|
9905
|
-
* with `.select()` after filters.
|
|
10869
|
+
* By default, updated rows are not returned. To return it, chain the call
|
|
10870
|
+
* with `.select()` after filters.
|
|
10871
|
+
*
|
|
10872
|
+
* @param values - The values to update with
|
|
10873
|
+
*
|
|
10874
|
+
* @param options - Named parameters
|
|
10875
|
+
*
|
|
10876
|
+
* @param options.count - Count algorithm to use to count updated rows.
|
|
10877
|
+
*
|
|
10878
|
+
* `"exact"`: Exact but slow count algorithm. Performs a `COUNT(*)` under the
|
|
10879
|
+
* hood.
|
|
10880
|
+
*
|
|
10881
|
+
* `"planned"`: Approximated but fast count algorithm. Uses the Postgres
|
|
10882
|
+
* statistics under the hood.
|
|
10883
|
+
*
|
|
10884
|
+
* `"estimated"`: Uses exact count for low numbers and planned count for high
|
|
10885
|
+
* numbers.
|
|
10886
|
+
*
|
|
10887
|
+
* @category Database
|
|
10888
|
+
*
|
|
10889
|
+
* @remarks
|
|
10890
|
+
* - `update()` should always be combined with [Filters](/docs/reference/javascript/using-filters) to target the item(s) you wish to update.
|
|
10891
|
+
*
|
|
10892
|
+
* @example Updating your data
|
|
10893
|
+
* ```ts
|
|
10894
|
+
* const { error } = await supabase
|
|
10895
|
+
* .from('instruments')
|
|
10896
|
+
* .update({ name: 'piano' })
|
|
10897
|
+
* .eq('id', 1)
|
|
10898
|
+
* ```
|
|
10899
|
+
*
|
|
10900
|
+
* @exampleSql Updating your data
|
|
10901
|
+
* ```sql
|
|
10902
|
+
* create table
|
|
10903
|
+
* instruments (id int8 primary key, name text);
|
|
10904
|
+
*
|
|
10905
|
+
* insert into
|
|
10906
|
+
* instruments (id, name)
|
|
10907
|
+
* values
|
|
10908
|
+
* (1, 'harpsichord');
|
|
10909
|
+
* ```
|
|
10910
|
+
*
|
|
10911
|
+
* @exampleResponse Updating your data
|
|
10912
|
+
* ```json
|
|
10913
|
+
* {
|
|
10914
|
+
* "status": 204,
|
|
10915
|
+
* "statusText": "No Content"
|
|
10916
|
+
* }
|
|
10917
|
+
* ```
|
|
10918
|
+
*
|
|
10919
|
+
* @example Update a record and return it
|
|
10920
|
+
* ```ts
|
|
10921
|
+
* const { data, error } = await supabase
|
|
10922
|
+
* .from('instruments')
|
|
10923
|
+
* .update({ name: 'piano' })
|
|
10924
|
+
* .eq('id', 1)
|
|
10925
|
+
* .select()
|
|
10926
|
+
* ```
|
|
10927
|
+
*
|
|
10928
|
+
* @exampleSql Update a record and return it
|
|
10929
|
+
* ```sql
|
|
10930
|
+
* create table
|
|
10931
|
+
* instruments (id int8 primary key, name text);
|
|
9906
10932
|
*
|
|
9907
|
-
*
|
|
10933
|
+
* insert into
|
|
10934
|
+
* instruments (id, name)
|
|
10935
|
+
* values
|
|
10936
|
+
* (1, 'harpsichord');
|
|
10937
|
+
* ```
|
|
9908
10938
|
*
|
|
9909
|
-
* @
|
|
10939
|
+
* @exampleResponse Update a record and return it
|
|
10940
|
+
* ```json
|
|
10941
|
+
* {
|
|
10942
|
+
* "data": [
|
|
10943
|
+
* {
|
|
10944
|
+
* "id": 1,
|
|
10945
|
+
* "name": "piano"
|
|
10946
|
+
* }
|
|
10947
|
+
* ],
|
|
10948
|
+
* "status": 200,
|
|
10949
|
+
* "statusText": "OK"
|
|
10950
|
+
* }
|
|
10951
|
+
* ```
|
|
9910
10952
|
*
|
|
9911
|
-
* @
|
|
10953
|
+
* @exampleDescription Updating JSON data
|
|
10954
|
+
* Postgres offers some
|
|
10955
|
+
* [operators](/docs/guides/database/json#query-the-jsonb-data) for
|
|
10956
|
+
* working with JSON data. Currently, it is only possible to update the entire JSON document.
|
|
9912
10957
|
*
|
|
9913
|
-
*
|
|
9914
|
-
*
|
|
10958
|
+
* @example Updating JSON data
|
|
10959
|
+
* ```ts
|
|
10960
|
+
* const { data, error } = await supabase
|
|
10961
|
+
* .from('users')
|
|
10962
|
+
* .update({
|
|
10963
|
+
* address: {
|
|
10964
|
+
* street: 'Melrose Place',
|
|
10965
|
+
* postcode: 90210
|
|
10966
|
+
* }
|
|
10967
|
+
* })
|
|
10968
|
+
* .eq('address->postcode', 90210)
|
|
10969
|
+
* .select()
|
|
10970
|
+
* ```
|
|
9915
10971
|
*
|
|
9916
|
-
*
|
|
9917
|
-
*
|
|
10972
|
+
* @exampleSql Updating JSON data
|
|
10973
|
+
* ```sql
|
|
10974
|
+
* create table
|
|
10975
|
+
* users (
|
|
10976
|
+
* id int8 primary key,
|
|
10977
|
+
* name text,
|
|
10978
|
+
* address jsonb
|
|
10979
|
+
* );
|
|
9918
10980
|
*
|
|
9919
|
-
*
|
|
9920
|
-
*
|
|
10981
|
+
* insert into
|
|
10982
|
+
* users (id, name, address)
|
|
10983
|
+
* values
|
|
10984
|
+
* (1, 'Michael', '{ "postcode": 90210 }');
|
|
10985
|
+
* ```
|
|
10986
|
+
*
|
|
10987
|
+
* @exampleResponse Updating JSON data
|
|
10988
|
+
* ```json
|
|
10989
|
+
* {
|
|
10990
|
+
* "data": [
|
|
10991
|
+
* {
|
|
10992
|
+
* "id": 1,
|
|
10993
|
+
* "name": "Michael",
|
|
10994
|
+
* "address": {
|
|
10995
|
+
* "street": "Melrose Place",
|
|
10996
|
+
* "postcode": 90210
|
|
10997
|
+
* }
|
|
10998
|
+
* }
|
|
10999
|
+
* ],
|
|
11000
|
+
* "status": 200,
|
|
11001
|
+
* "statusText": "OK"
|
|
11002
|
+
* }
|
|
11003
|
+
* ```
|
|
9921
11004
|
*/
|
|
9922
11005
|
update(values, { count } = {}) {
|
|
9923
11006
|
var _this$fetch3;
|
|
@@ -10116,10 +11199,10 @@ ${cause.stack}`;
|
|
|
10116
11199
|
}
|
|
10117
11200
|
});
|
|
10118
11201
|
|
|
10119
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11202
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
|
|
10120
11203
|
var WebSocketFactory, websocket_factory_default;
|
|
10121
11204
|
var init_websocket_factory = __esm({
|
|
10122
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11205
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js"() {
|
|
10123
11206
|
init_utils();
|
|
10124
11207
|
WebSocketFactory = class {
|
|
10125
11208
|
/**
|
|
@@ -10238,19 +11321,19 @@ Suggested solution: ${env.workaround}`;
|
|
|
10238
11321
|
}
|
|
10239
11322
|
});
|
|
10240
11323
|
|
|
10241
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11324
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/version.js
|
|
10242
11325
|
var version;
|
|
10243
11326
|
var init_version = __esm({
|
|
10244
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11327
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/version.js"() {
|
|
10245
11328
|
init_utils();
|
|
10246
|
-
version = "2.
|
|
11329
|
+
version = "2.99.1";
|
|
10247
11330
|
}
|
|
10248
11331
|
});
|
|
10249
11332
|
|
|
10250
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11333
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/constants.js
|
|
10251
11334
|
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;
|
|
10252
11335
|
var init_constants2 = __esm({
|
|
10253
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11336
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/constants.js"() {
|
|
10254
11337
|
init_utils();
|
|
10255
11338
|
init_version();
|
|
10256
11339
|
DEFAULT_VERSION = `realtime-js/${version}`;
|
|
@@ -10293,10 +11376,10 @@ var init_constants2 = __esm({
|
|
|
10293
11376
|
}
|
|
10294
11377
|
});
|
|
10295
11378
|
|
|
10296
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11379
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
|
|
10297
11380
|
var Serializer;
|
|
10298
11381
|
var init_serializer = __esm({
|
|
10299
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11382
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js"() {
|
|
10300
11383
|
init_utils();
|
|
10301
11384
|
Serializer = class {
|
|
10302
11385
|
constructor(allowedMetadataKeys) {
|
|
@@ -10439,10 +11522,10 @@ var init_serializer = __esm({
|
|
|
10439
11522
|
}
|
|
10440
11523
|
});
|
|
10441
11524
|
|
|
10442
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11525
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/timer.js
|
|
10443
11526
|
var Timer;
|
|
10444
11527
|
var init_timer = __esm({
|
|
10445
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11528
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/timer.js"() {
|
|
10446
11529
|
init_utils();
|
|
10447
11530
|
Timer = class {
|
|
10448
11531
|
constructor(callback, timerCalc) {
|
|
@@ -10470,10 +11553,10 @@ var init_timer = __esm({
|
|
|
10470
11553
|
}
|
|
10471
11554
|
});
|
|
10472
11555
|
|
|
10473
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11556
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
|
|
10474
11557
|
var PostgresTypes, convertChangeData, convertColumn, convertCell, noop, toBoolean, toNumber, toJson, toArray, toTimestampString, httpEndpointURL;
|
|
10475
11558
|
var init_transformers = __esm({
|
|
10476
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11559
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js"() {
|
|
10477
11560
|
init_utils();
|
|
10478
11561
|
(function(PostgresTypes2) {
|
|
10479
11562
|
PostgresTypes2["abstime"] = "abstime";
|
|
@@ -10638,10 +11721,10 @@ var init_transformers = __esm({
|
|
|
10638
11721
|
}
|
|
10639
11722
|
});
|
|
10640
11723
|
|
|
10641
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11724
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/push.js
|
|
10642
11725
|
var Push;
|
|
10643
11726
|
var init_push = __esm({
|
|
10644
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11727
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/lib/push.js"() {
|
|
10645
11728
|
init_utils();
|
|
10646
11729
|
init_constants2();
|
|
10647
11730
|
Push = class {
|
|
@@ -10744,10 +11827,10 @@ var init_push = __esm({
|
|
|
10744
11827
|
}
|
|
10745
11828
|
});
|
|
10746
11829
|
|
|
10747
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
11830
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
|
|
10748
11831
|
var REALTIME_PRESENCE_LISTEN_EVENTS, RealtimePresence;
|
|
10749
11832
|
var init_RealtimePresence = __esm({
|
|
10750
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
11833
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js"() {
|
|
10751
11834
|
init_utils();
|
|
10752
11835
|
(function(REALTIME_PRESENCE_LISTEN_EVENTS2) {
|
|
10753
11836
|
REALTIME_PRESENCE_LISTEN_EVENTS2["SYNC"] = "sync";
|
|
@@ -10981,10 +12064,10 @@ var init_RealtimePresence = __esm({
|
|
|
10981
12064
|
}
|
|
10982
12065
|
});
|
|
10983
12066
|
|
|
10984
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
12067
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
|
|
10985
12068
|
var REALTIME_POSTGRES_CHANGES_LISTEN_EVENT, REALTIME_LISTEN_TYPES, REALTIME_SUBSCRIBE_STATES, RealtimeChannel;
|
|
10986
12069
|
var init_RealtimeChannel = __esm({
|
|
10987
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
12070
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js"() {
|
|
10988
12071
|
init_utils();
|
|
10989
12072
|
init_constants2();
|
|
10990
12073
|
init_push();
|
|
@@ -11585,10 +12668,10 @@ var init_RealtimeChannel = __esm({
|
|
|
11585
12668
|
}
|
|
11586
12669
|
});
|
|
11587
12670
|
|
|
11588
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
12671
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
|
|
11589
12672
|
var noop2, CONNECTION_TIMEOUTS, RECONNECT_INTERVALS, DEFAULT_RECONNECT_FALLBACK, WORKER_SCRIPT, RealtimeClient;
|
|
11590
12673
|
var init_RealtimeClient = __esm({
|
|
11591
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
12674
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js"() {
|
|
11592
12675
|
init_utils();
|
|
11593
12676
|
init_websocket_factory();
|
|
11594
12677
|
init_constants2();
|
|
@@ -12367,9 +13450,9 @@ Option 2: Install and provide the "ws" package:
|
|
|
12367
13450
|
}
|
|
12368
13451
|
});
|
|
12369
13452
|
|
|
12370
|
-
// node_modules/.bun/@supabase+realtime-js@2.
|
|
13453
|
+
// node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/index.js
|
|
12371
13454
|
var init_module2 = __esm({
|
|
12372
|
-
"node_modules/.bun/@supabase+realtime-js@2.
|
|
13455
|
+
"node_modules/.bun/@supabase+realtime-js@2.99.1/node_modules/@supabase/realtime-js/dist/module/index.js"() {
|
|
12373
13456
|
init_utils();
|
|
12374
13457
|
init_RealtimeClient();
|
|
12375
13458
|
init_RealtimeChannel();
|
|
@@ -12917,7 +14000,7 @@ var init_dist4 = __esm({
|
|
|
12917
14000
|
}
|
|
12918
14001
|
});
|
|
12919
14002
|
|
|
12920
|
-
// node_modules/.bun/@supabase+storage-js@2.
|
|
14003
|
+
// node_modules/.bun/@supabase+storage-js@2.99.1/node_modules/@supabase/storage-js/dist/index.mjs
|
|
12921
14004
|
function isStorageError(error2) {
|
|
12922
14005
|
return typeof error2 === "object" && error2 !== null && "__isStorageError" in error2;
|
|
12923
14006
|
}
|
|
@@ -13007,7 +14090,7 @@ function createFetchApi(namespace = "storage") {
|
|
|
13007
14090
|
}
|
|
13008
14091
|
var StorageError, StorageApiError, StorageUnknownError, resolveFetch2, isPlainObject, recursiveToCamel, isValidBucketName, _getErrorMessage, handleError, _getRequestParams, defaultApi, get, post, put, head, remove2, 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;
|
|
13009
14092
|
var init_dist5 = __esm({
|
|
13010
|
-
"node_modules/.bun/@supabase+storage-js@2.
|
|
14093
|
+
"node_modules/.bun/@supabase+storage-js@2.99.1/node_modules/@supabase/storage-js/dist/index.mjs"() {
|
|
13011
14094
|
init_utils();
|
|
13012
14095
|
init_dist4();
|
|
13013
14096
|
StorageError = class extends Error {
|
|
@@ -13074,7 +14157,7 @@ var init_dist5 = __esm({
|
|
|
13074
14157
|
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);
|
|
13075
14158
|
};
|
|
13076
14159
|
handleError = async (error2, reject, options, namespace) => {
|
|
13077
|
-
if (error2 && typeof error2 === "object" && "status" in error2 && "ok" in error2 && typeof error2.status === "number"
|
|
14160
|
+
if (error2 && typeof error2 === "object" && "status" in error2 && "ok" in error2 && typeof error2.status === "number") {
|
|
13078
14161
|
const responseError = error2;
|
|
13079
14162
|
const status = responseError.status || 500;
|
|
13080
14163
|
if (typeof responseError.json === "function") responseError.json().then((err) => {
|
|
@@ -13648,7 +14731,8 @@ var init_dist5 = __esm({
|
|
|
13648
14731
|
let _path = _this8._getFinalPath(path);
|
|
13649
14732
|
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 });
|
|
13650
14733
|
const downloadQueryParam = (options === null || options === void 0 ? void 0 : options.download) ? `&download=${options.download === true ? "" : options.download}` : "";
|
|
13651
|
-
|
|
14734
|
+
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;
|
|
14735
|
+
return { signedUrl: encodeURI(`${_this8.url}${returnedPath}${downloadQueryParam}`) };
|
|
13652
14736
|
});
|
|
13653
14737
|
}
|
|
13654
14738
|
/**
|
|
@@ -13772,6 +14856,9 @@ var init_dist5 = __esm({
|
|
|
13772
14856
|
/**
|
|
13773
14857
|
* Retrieves the details of an existing file.
|
|
13774
14858
|
*
|
|
14859
|
+
* Returns detailed file metadata including size, content type, and timestamps.
|
|
14860
|
+
* Note: The API returns `last_modified` field, not `updated_at`.
|
|
14861
|
+
*
|
|
13775
14862
|
* @category File Buckets
|
|
13776
14863
|
* @param path The file path, including the file name. For example `folder/image.png`.
|
|
13777
14864
|
* @returns Promise with response containing file metadata or error
|
|
@@ -13782,6 +14869,11 @@ var init_dist5 = __esm({
|
|
|
13782
14869
|
* .storage
|
|
13783
14870
|
* .from('avatars')
|
|
13784
14871
|
* .info('folder/avatar1.png')
|
|
14872
|
+
*
|
|
14873
|
+
* if (data) {
|
|
14874
|
+
* console.log('Last modified:', data.lastModified)
|
|
14875
|
+
* console.log('Size:', data.size)
|
|
14876
|
+
* }
|
|
13785
14877
|
* ```
|
|
13786
14878
|
*/
|
|
13787
14879
|
async info(path) {
|
|
@@ -13817,9 +14909,10 @@ var init_dist5 = __esm({
|
|
|
13817
14909
|
};
|
|
13818
14910
|
} catch (error2) {
|
|
13819
14911
|
if (_this11.shouldThrowOnError) throw error2;
|
|
13820
|
-
if (isStorageError(error2)
|
|
13821
|
-
|
|
13822
|
-
|
|
14912
|
+
if (isStorageError(error2)) {
|
|
14913
|
+
var _error$originalError;
|
|
14914
|
+
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;
|
|
14915
|
+
if (status !== void 0 && [400, 404].includes(status)) return {
|
|
13823
14916
|
data: false,
|
|
13824
14917
|
error: error2
|
|
13825
14918
|
};
|
|
@@ -13892,6 +14985,9 @@ var init_dist5 = __esm({
|
|
|
13892
14985
|
/**
|
|
13893
14986
|
* Deletes files within the same bucket
|
|
13894
14987
|
*
|
|
14988
|
+
* Returns an array of FileObject entries for the deleted files. Note that deprecated
|
|
14989
|
+
* fields like `bucket_id` may or may not be present in the response - do not rely on them.
|
|
14990
|
+
*
|
|
13895
14991
|
* @category File Buckets
|
|
13896
14992
|
* @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].
|
|
13897
14993
|
* @returns Promise with response containing array of deleted file objects or error
|
|
@@ -13930,11 +15026,16 @@ var init_dist5 = __esm({
|
|
|
13930
15026
|
/**
|
|
13931
15027
|
* Lists all the files and folders within a path of the bucket.
|
|
13932
15028
|
*
|
|
15029
|
+
* **Important:** For folder entries, fields like `id`, `updated_at`, `created_at`,
|
|
15030
|
+
* `last_accessed_at`, and `metadata` will be `null`. Only files have these fields populated.
|
|
15031
|
+
* Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned
|
|
15032
|
+
* by this method.
|
|
15033
|
+
*
|
|
13933
15034
|
* @category File Buckets
|
|
13934
15035
|
* @param path The folder path.
|
|
13935
15036
|
* @param options Search options including limit (defaults to 100), offset, sortBy, and search
|
|
13936
15037
|
* @param parameters Optional fetch parameters including signal for cancellation
|
|
13937
|
-
* @returns Promise with response containing array of files or error
|
|
15038
|
+
* @returns Promise with response containing array of files/folders or error
|
|
13938
15039
|
*
|
|
13939
15040
|
* @example List files in a bucket
|
|
13940
15041
|
* ```js
|
|
@@ -13946,9 +15047,20 @@ var init_dist5 = __esm({
|
|
|
13946
15047
|
* offset: 0,
|
|
13947
15048
|
* sortBy: { column: 'name', order: 'asc' },
|
|
13948
15049
|
* })
|
|
15050
|
+
*
|
|
15051
|
+
* // Handle files vs folders
|
|
15052
|
+
* data?.forEach(item => {
|
|
15053
|
+
* if (item.id !== null) {
|
|
15054
|
+
* // It's a file
|
|
15055
|
+
* console.log('File:', item.name, 'Size:', item.metadata?.size)
|
|
15056
|
+
* } else {
|
|
15057
|
+
* // It's a folder
|
|
15058
|
+
* console.log('Folder:', item.name)
|
|
15059
|
+
* }
|
|
15060
|
+
* })
|
|
13949
15061
|
* ```
|
|
13950
15062
|
*
|
|
13951
|
-
* Response:
|
|
15063
|
+
* Response (file entry):
|
|
13952
15064
|
* ```json
|
|
13953
15065
|
* {
|
|
13954
15066
|
* "data": [
|
|
@@ -13994,11 +15106,50 @@ var init_dist5 = __esm({
|
|
|
13994
15106
|
});
|
|
13995
15107
|
}
|
|
13996
15108
|
/**
|
|
15109
|
+
* Lists all the files and folders within a bucket using the V2 API with pagination support.
|
|
15110
|
+
*
|
|
15111
|
+
* **Important:** Folder entries in the `folders` array only contain `name` and optionally `key` —
|
|
15112
|
+
* they have no `id`, timestamps, or `metadata` fields. Full file metadata is only available
|
|
15113
|
+
* on entries in the `objects` array.
|
|
15114
|
+
*
|
|
13997
15115
|
* @experimental this method signature might change in the future
|
|
13998
15116
|
*
|
|
13999
15117
|
* @category File Buckets
|
|
14000
|
-
* @param options
|
|
14001
|
-
* @param parameters
|
|
15118
|
+
* @param options Search options including prefix, cursor for pagination, limit, with_delimiter
|
|
15119
|
+
* @param parameters Optional fetch parameters including signal for cancellation
|
|
15120
|
+
* @returns Promise with response containing folders/objects arrays with pagination info or error
|
|
15121
|
+
*
|
|
15122
|
+
* @example List files with pagination
|
|
15123
|
+
* ```js
|
|
15124
|
+
* const { data, error } = await supabase
|
|
15125
|
+
* .storage
|
|
15126
|
+
* .from('avatars')
|
|
15127
|
+
* .listV2({
|
|
15128
|
+
* prefix: 'folder/',
|
|
15129
|
+
* limit: 100,
|
|
15130
|
+
* })
|
|
15131
|
+
*
|
|
15132
|
+
* // Handle pagination
|
|
15133
|
+
* if (data?.hasNext) {
|
|
15134
|
+
* const nextPage = await supabase
|
|
15135
|
+
* .storage
|
|
15136
|
+
* .from('avatars')
|
|
15137
|
+
* .listV2({
|
|
15138
|
+
* prefix: 'folder/',
|
|
15139
|
+
* cursor: data.nextCursor,
|
|
15140
|
+
* })
|
|
15141
|
+
* }
|
|
15142
|
+
*
|
|
15143
|
+
* // Handle files vs folders
|
|
15144
|
+
* data?.objects.forEach(file => {
|
|
15145
|
+
* if (file.id !== null) {
|
|
15146
|
+
* console.log('File:', file.name, 'Size:', file.metadata?.size)
|
|
15147
|
+
* }
|
|
15148
|
+
* })
|
|
15149
|
+
* data?.folders.forEach(folder => {
|
|
15150
|
+
* console.log('Folder:', folder.name)
|
|
15151
|
+
* })
|
|
15152
|
+
* ```
|
|
14002
15153
|
*/
|
|
14003
15154
|
async listV2(options, parameters) {
|
|
14004
15155
|
var _this14 = this;
|
|
@@ -14030,7 +15181,7 @@ var init_dist5 = __esm({
|
|
|
14030
15181
|
return params.join("&");
|
|
14031
15182
|
}
|
|
14032
15183
|
};
|
|
14033
|
-
version2 = "2.
|
|
15184
|
+
version2 = "2.99.1";
|
|
14034
15185
|
DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version2}` };
|
|
14035
15186
|
StorageBucketApi = class extends BaseApiClient {
|
|
14036
15187
|
constructor(url, headers = {}, fetch$1, opts) {
|
|
@@ -15276,19 +16427,19 @@ var init_dist5 = __esm({
|
|
|
15276
16427
|
}
|
|
15277
16428
|
});
|
|
15278
16429
|
|
|
15279
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16430
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/version.js
|
|
15280
16431
|
var version3;
|
|
15281
16432
|
var init_version2 = __esm({
|
|
15282
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16433
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/version.js"() {
|
|
15283
16434
|
init_utils();
|
|
15284
|
-
version3 = "2.
|
|
16435
|
+
version3 = "2.99.1";
|
|
15285
16436
|
}
|
|
15286
16437
|
});
|
|
15287
16438
|
|
|
15288
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16439
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/constants.js
|
|
15289
16440
|
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;
|
|
15290
16441
|
var init_constants3 = __esm({
|
|
15291
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16442
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/constants.js"() {
|
|
15292
16443
|
init_utils();
|
|
15293
16444
|
init_version2();
|
|
15294
16445
|
AUTO_REFRESH_TICK_DURATION_MS = 30 * 1e3;
|
|
@@ -15309,7 +16460,7 @@ var init_constants3 = __esm({
|
|
|
15309
16460
|
}
|
|
15310
16461
|
});
|
|
15311
16462
|
|
|
15312
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16463
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/errors.js
|
|
15313
16464
|
function isAuthError(error2) {
|
|
15314
16465
|
return typeof error2 === "object" && error2 !== null && "__isAuthError" in error2;
|
|
15315
16466
|
}
|
|
@@ -15327,7 +16478,7 @@ function isAuthRetryableFetchError(error2) {
|
|
|
15327
16478
|
}
|
|
15328
16479
|
var AuthError, AuthApiError, AuthUnknownError, CustomAuthError, AuthSessionMissingError, AuthInvalidTokenResponseError, AuthInvalidCredentialsError, AuthImplicitGrantRedirectError, AuthPKCEGrantCodeExchangeError, AuthPKCECodeVerifierMissingError, AuthRetryableFetchError, AuthWeakPasswordError, AuthInvalidJwtError;
|
|
15329
16480
|
var init_errors2 = __esm({
|
|
15330
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16481
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/errors.js"() {
|
|
15331
16482
|
init_utils();
|
|
15332
16483
|
AuthError = class extends Error {
|
|
15333
16484
|
constructor(message, status, code) {
|
|
@@ -15429,7 +16580,7 @@ var init_errors2 = __esm({
|
|
|
15429
16580
|
}
|
|
15430
16581
|
});
|
|
15431
16582
|
|
|
15432
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16583
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/base64url.js
|
|
15433
16584
|
function byteToBase64URL(byte, state, emit) {
|
|
15434
16585
|
if (byte !== null) {
|
|
15435
16586
|
state.queue = state.queue << 8 | byte;
|
|
@@ -15577,7 +16728,7 @@ function bytesToBase64URL(bytes) {
|
|
|
15577
16728
|
}
|
|
15578
16729
|
var TO_BASE64URL, IGNORE_BASE64URL, FROM_BASE64URL;
|
|
15579
16730
|
var init_base64url = __esm({
|
|
15580
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16731
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/base64url.js"() {
|
|
15581
16732
|
init_utils();
|
|
15582
16733
|
TO_BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split("");
|
|
15583
16734
|
IGNORE_BASE64URL = " \n\r=".split("");
|
|
@@ -15597,7 +16748,7 @@ var init_base64url = __esm({
|
|
|
15597
16748
|
}
|
|
15598
16749
|
});
|
|
15599
16750
|
|
|
15600
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
16751
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/helpers.js
|
|
15601
16752
|
function expiresAt(expiresIn) {
|
|
15602
16753
|
const timeNow = Math.round(Date.now() / 1e3);
|
|
15603
16754
|
return timeNow + expiresIn;
|
|
@@ -15808,7 +16959,7 @@ function deepClone(obj) {
|
|
|
15808
16959
|
}
|
|
15809
16960
|
var isBrowser, localStorageWriteTests, supportsLocalStorage, resolveFetch3, looksLikeFetchResponse, setItemAsync, getItemAsync, removeItemAsync, Deferred, API_VERSION_REGEX, UUID_REGEX;
|
|
15810
16961
|
var init_helpers = __esm({
|
|
15811
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
16962
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/helpers.js"() {
|
|
15812
16963
|
init_utils();
|
|
15813
16964
|
init_constants3();
|
|
15814
16965
|
init_errors2();
|
|
@@ -15886,7 +17037,7 @@ var init_helpers = __esm({
|
|
|
15886
17037
|
}
|
|
15887
17038
|
});
|
|
15888
17039
|
|
|
15889
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17040
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/fetch.js
|
|
15890
17041
|
async function handleError2(error2) {
|
|
15891
17042
|
var _a;
|
|
15892
17043
|
if (!looksLikeFetchResponse(error2)) {
|
|
@@ -16012,7 +17163,7 @@ function hasSession(data) {
|
|
|
16012
17163
|
}
|
|
16013
17164
|
var _getErrorMessage2, NETWORK_ERROR_CODES, _getRequestParams2;
|
|
16014
17165
|
var init_fetch = __esm({
|
|
16015
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17166
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/fetch.js"() {
|
|
16016
17167
|
init_utils();
|
|
16017
17168
|
init_tslib_es6();
|
|
16018
17169
|
init_constants3();
|
|
@@ -16032,19 +17183,19 @@ var init_fetch = __esm({
|
|
|
16032
17183
|
}
|
|
16033
17184
|
});
|
|
16034
17185
|
|
|
16035
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17186
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/types.js
|
|
16036
17187
|
var SIGN_OUT_SCOPES;
|
|
16037
17188
|
var init_types2 = __esm({
|
|
16038
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17189
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/types.js"() {
|
|
16039
17190
|
init_utils();
|
|
16040
17191
|
SIGN_OUT_SCOPES = ["global", "local", "others"];
|
|
16041
17192
|
}
|
|
16042
17193
|
});
|
|
16043
17194
|
|
|
16044
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17195
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
|
|
16045
17196
|
var GoTrueAdminApi;
|
|
16046
17197
|
var init_GoTrueAdminApi = __esm({
|
|
16047
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17198
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js"() {
|
|
16048
17199
|
init_utils();
|
|
16049
17200
|
init_tslib_es6();
|
|
16050
17201
|
init_fetch();
|
|
@@ -16081,6 +17232,13 @@ var init_GoTrueAdminApi = __esm({
|
|
|
16081
17232
|
deleteClient: this._deleteOAuthClient.bind(this),
|
|
16082
17233
|
regenerateClientSecret: this._regenerateOAuthClientSecret.bind(this)
|
|
16083
17234
|
};
|
|
17235
|
+
this.customProviders = {
|
|
17236
|
+
listProviders: this._listCustomProviders.bind(this),
|
|
17237
|
+
createProvider: this._createCustomProvider.bind(this),
|
|
17238
|
+
getProvider: this._getCustomProvider.bind(this),
|
|
17239
|
+
updateProvider: this._updateCustomProvider.bind(this),
|
|
17240
|
+
deleteProvider: this._deleteCustomProvider.bind(this)
|
|
17241
|
+
};
|
|
16084
17242
|
}
|
|
16085
17243
|
/**
|
|
16086
17244
|
* Removes a logged-in session.
|
|
@@ -16490,11 +17648,129 @@ var init_GoTrueAdminApi = __esm({
|
|
|
16490
17648
|
throw error2;
|
|
16491
17649
|
}
|
|
16492
17650
|
}
|
|
17651
|
+
/**
|
|
17652
|
+
* Lists all custom providers with optional type filter.
|
|
17653
|
+
*
|
|
17654
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
17655
|
+
*/
|
|
17656
|
+
async _listCustomProviders(params) {
|
|
17657
|
+
try {
|
|
17658
|
+
const query = {};
|
|
17659
|
+
if (params === null || params === void 0 ? void 0 : params.type) {
|
|
17660
|
+
query.type = params.type;
|
|
17661
|
+
}
|
|
17662
|
+
return await _request(this.fetch, "GET", `${this.url}/admin/custom-providers`, {
|
|
17663
|
+
headers: this.headers,
|
|
17664
|
+
query,
|
|
17665
|
+
xform: (data) => {
|
|
17666
|
+
var _a;
|
|
17667
|
+
return { data: { providers: (_a = data === null || data === void 0 ? void 0 : data.providers) !== null && _a !== void 0 ? _a : [] }, error: null };
|
|
17668
|
+
}
|
|
17669
|
+
});
|
|
17670
|
+
} catch (error2) {
|
|
17671
|
+
if (isAuthError(error2)) {
|
|
17672
|
+
return { data: { providers: [] }, error: error2 };
|
|
17673
|
+
}
|
|
17674
|
+
throw error2;
|
|
17675
|
+
}
|
|
17676
|
+
}
|
|
17677
|
+
/**
|
|
17678
|
+
* Creates a new custom OIDC/OAuth provider.
|
|
17679
|
+
*
|
|
17680
|
+
* For OIDC providers, the server fetches and validates the OpenID Connect discovery document
|
|
17681
|
+
* from the issuer's well-known endpoint (or the provided `discovery_url`) at creation time.
|
|
17682
|
+
* This may return a validation error (`error_code: "validation_failed"`) if the discovery
|
|
17683
|
+
* document is unreachable, not valid JSON, missing required fields, or if the issuer
|
|
17684
|
+
* in the document does not match the expected issuer.
|
|
17685
|
+
*
|
|
17686
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
17687
|
+
*/
|
|
17688
|
+
async _createCustomProvider(params) {
|
|
17689
|
+
try {
|
|
17690
|
+
return await _request(this.fetch, "POST", `${this.url}/admin/custom-providers`, {
|
|
17691
|
+
body: params,
|
|
17692
|
+
headers: this.headers,
|
|
17693
|
+
xform: (provider) => {
|
|
17694
|
+
return { data: provider, error: null };
|
|
17695
|
+
}
|
|
17696
|
+
});
|
|
17697
|
+
} catch (error2) {
|
|
17698
|
+
if (isAuthError(error2)) {
|
|
17699
|
+
return { data: null, error: error2 };
|
|
17700
|
+
}
|
|
17701
|
+
throw error2;
|
|
17702
|
+
}
|
|
17703
|
+
}
|
|
17704
|
+
/**
|
|
17705
|
+
* Gets details of a specific custom provider by identifier.
|
|
17706
|
+
*
|
|
17707
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
17708
|
+
*/
|
|
17709
|
+
async _getCustomProvider(identifier) {
|
|
17710
|
+
try {
|
|
17711
|
+
return await _request(this.fetch, "GET", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
17712
|
+
headers: this.headers,
|
|
17713
|
+
xform: (provider) => {
|
|
17714
|
+
return { data: provider, error: null };
|
|
17715
|
+
}
|
|
17716
|
+
});
|
|
17717
|
+
} catch (error2) {
|
|
17718
|
+
if (isAuthError(error2)) {
|
|
17719
|
+
return { data: null, error: error2 };
|
|
17720
|
+
}
|
|
17721
|
+
throw error2;
|
|
17722
|
+
}
|
|
17723
|
+
}
|
|
17724
|
+
/**
|
|
17725
|
+
* Updates an existing custom provider.
|
|
17726
|
+
*
|
|
17727
|
+
* When `issuer` or `discovery_url` is changed on an OIDC provider, the server re-fetches and
|
|
17728
|
+
* validates the discovery document before persisting. This may return a validation error
|
|
17729
|
+
* (`error_code: "validation_failed"`) if the discovery document is unreachable, invalid, or
|
|
17730
|
+
* the issuer does not match.
|
|
17731
|
+
*
|
|
17732
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
17733
|
+
*/
|
|
17734
|
+
async _updateCustomProvider(identifier, params) {
|
|
17735
|
+
try {
|
|
17736
|
+
return await _request(this.fetch, "PUT", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
17737
|
+
body: params,
|
|
17738
|
+
headers: this.headers,
|
|
17739
|
+
xform: (provider) => {
|
|
17740
|
+
return { data: provider, error: null };
|
|
17741
|
+
}
|
|
17742
|
+
});
|
|
17743
|
+
} catch (error2) {
|
|
17744
|
+
if (isAuthError(error2)) {
|
|
17745
|
+
return { data: null, error: error2 };
|
|
17746
|
+
}
|
|
17747
|
+
throw error2;
|
|
17748
|
+
}
|
|
17749
|
+
}
|
|
17750
|
+
/**
|
|
17751
|
+
* Deletes a custom provider.
|
|
17752
|
+
*
|
|
17753
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
17754
|
+
*/
|
|
17755
|
+
async _deleteCustomProvider(identifier) {
|
|
17756
|
+
try {
|
|
17757
|
+
await _request(this.fetch, "DELETE", `${this.url}/admin/custom-providers/${identifier}`, {
|
|
17758
|
+
headers: this.headers,
|
|
17759
|
+
noResolveJson: true
|
|
17760
|
+
});
|
|
17761
|
+
return { data: null, error: null };
|
|
17762
|
+
} catch (error2) {
|
|
17763
|
+
if (isAuthError(error2)) {
|
|
17764
|
+
return { data: null, error: error2 };
|
|
17765
|
+
}
|
|
17766
|
+
throw error2;
|
|
17767
|
+
}
|
|
17768
|
+
}
|
|
16493
17769
|
};
|
|
16494
17770
|
}
|
|
16495
17771
|
});
|
|
16496
17772
|
|
|
16497
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17773
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
|
|
16498
17774
|
function memoryLocalStorageAdapter(store = {}) {
|
|
16499
17775
|
return {
|
|
16500
17776
|
getItem: (key) => {
|
|
@@ -16509,12 +17785,12 @@ function memoryLocalStorageAdapter(store = {}) {
|
|
|
16509
17785
|
};
|
|
16510
17786
|
}
|
|
16511
17787
|
var init_local_storage = __esm({
|
|
16512
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17788
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js"() {
|
|
16513
17789
|
init_utils();
|
|
16514
17790
|
}
|
|
16515
17791
|
});
|
|
16516
17792
|
|
|
16517
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17793
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/locks.js
|
|
16518
17794
|
async function navigatorLock(name, acquireTimeout, fn) {
|
|
16519
17795
|
if (internals.debug) {
|
|
16520
17796
|
}
|
|
@@ -16587,7 +17863,7 @@ async function navigatorLock(name, acquireTimeout, fn) {
|
|
|
16587
17863
|
}
|
|
16588
17864
|
var internals, LockAcquireTimeoutError, NavigatorLockAcquireTimeoutError;
|
|
16589
17865
|
var init_locks = __esm({
|
|
16590
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17866
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/locks.js"() {
|
|
16591
17867
|
init_utils();
|
|
16592
17868
|
init_helpers();
|
|
16593
17869
|
internals = {
|
|
@@ -16607,7 +17883,7 @@ var init_locks = __esm({
|
|
|
16607
17883
|
}
|
|
16608
17884
|
});
|
|
16609
17885
|
|
|
16610
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17886
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
|
|
16611
17887
|
function polyfillGlobalThis() {
|
|
16612
17888
|
if (typeof globalThis === "object")
|
|
16613
17889
|
return;
|
|
@@ -16627,12 +17903,12 @@ function polyfillGlobalThis() {
|
|
|
16627
17903
|
}
|
|
16628
17904
|
}
|
|
16629
17905
|
var init_polyfills = __esm({
|
|
16630
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17906
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js"() {
|
|
16631
17907
|
init_utils();
|
|
16632
17908
|
}
|
|
16633
17909
|
});
|
|
16634
17910
|
|
|
16635
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17911
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
|
|
16636
17912
|
function getAddress(address) {
|
|
16637
17913
|
if (!/^0x[a-fA-F0-9]{40}$/.test(address)) {
|
|
16638
17914
|
throw new Error(`@supabase/auth-js: Address "${address}" is invalid.`);
|
|
@@ -16700,12 +17976,12 @@ Request ID: ${requestId}`;
|
|
|
16700
17976
|
${suffix}`;
|
|
16701
17977
|
}
|
|
16702
17978
|
var init_ethereum = __esm({
|
|
16703
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
17979
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js"() {
|
|
16704
17980
|
init_utils();
|
|
16705
17981
|
}
|
|
16706
17982
|
});
|
|
16707
17983
|
|
|
16708
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
17984
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
|
|
16709
17985
|
function identifyRegistrationError({ error: error2, options }) {
|
|
16710
17986
|
var _a, _b, _c;
|
|
16711
17987
|
const { publicKey } = options;
|
|
@@ -16854,7 +18130,7 @@ function identifyAuthenticationError({ error: error2, options }) {
|
|
|
16854
18130
|
}
|
|
16855
18131
|
var WebAuthnError, WebAuthnUnknownError;
|
|
16856
18132
|
var init_webauthn_errors = __esm({
|
|
16857
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
18133
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js"() {
|
|
16858
18134
|
init_utils();
|
|
16859
18135
|
init_webauthn();
|
|
16860
18136
|
WebAuthnError = class extends Error {
|
|
@@ -16880,7 +18156,7 @@ var init_webauthn_errors = __esm({
|
|
|
16880
18156
|
}
|
|
16881
18157
|
});
|
|
16882
18158
|
|
|
16883
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
18159
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
|
|
16884
18160
|
function deserializeCredentialCreationOptions(options) {
|
|
16885
18161
|
if (!options) {
|
|
16886
18162
|
throw new Error("Credential creation options are required");
|
|
@@ -17090,7 +18366,7 @@ function mergeCredentialRequestOptions(baseOptions, overrides) {
|
|
|
17090
18366
|
}
|
|
17091
18367
|
var WebAuthnAbortService, webAuthnAbortService, DEFAULT_CREATION_OPTIONS, DEFAULT_REQUEST_OPTIONS, WebAuthnApi;
|
|
17092
18368
|
var init_webauthn = __esm({
|
|
17093
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
18369
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js"() {
|
|
17094
18370
|
init_utils();
|
|
17095
18371
|
init_tslib_es6();
|
|
17096
18372
|
init_base64url();
|
|
@@ -17414,13 +18690,13 @@ var init_webauthn = __esm({
|
|
|
17414
18690
|
}
|
|
17415
18691
|
});
|
|
17416
18692
|
|
|
17417
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
18693
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
|
|
17418
18694
|
async function lockNoOp(name, acquireTimeout, fn) {
|
|
17419
18695
|
return await fn();
|
|
17420
18696
|
}
|
|
17421
18697
|
var DEFAULT_OPTIONS, GLOBAL_JWKS, GoTrueClient, GoTrueClient_default;
|
|
17422
18698
|
var init_GoTrueClient = __esm({
|
|
17423
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
18699
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js"() {
|
|
17424
18700
|
init_utils();
|
|
17425
18701
|
init_GoTrueAdminApi();
|
|
17426
18702
|
init_constants3();
|
|
@@ -17737,6 +19013,173 @@ var init_GoTrueClient = __esm({
|
|
|
17737
19013
|
*
|
|
17738
19014
|
* @returns A logged-in session if the server has "autoconfirm" ON
|
|
17739
19015
|
* @returns A user if the server has "autoconfirm" OFF
|
|
19016
|
+
*
|
|
19017
|
+
* @category Auth
|
|
19018
|
+
*
|
|
19019
|
+
* @remarks
|
|
19020
|
+
* - 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).
|
|
19021
|
+
* - **Confirm email** determines if users need to confirm their email address after signing up.
|
|
19022
|
+
* - If **Confirm email** is enabled, a `user` is returned but `session` is null.
|
|
19023
|
+
* - If **Confirm email** is disabled, both a `user` and a `session` are returned.
|
|
19024
|
+
* - 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).
|
|
19025
|
+
* - If signUp() is called for an existing confirmed user:
|
|
19026
|
+
* - 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.
|
|
19027
|
+
* - When either **Confirm email** or **Confirm phone** (even when phone provider is disabled) is disabled, the error message, `User already registered` is returned.
|
|
19028
|
+
* - To fetch the currently logged-in user, refer to [`getUser()`](/docs/reference/javascript/auth-getuser).
|
|
19029
|
+
*
|
|
19030
|
+
* @example Sign up with an email and password
|
|
19031
|
+
* ```js
|
|
19032
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
19033
|
+
* email: 'example@email.com',
|
|
19034
|
+
* password: 'example-password',
|
|
19035
|
+
* })
|
|
19036
|
+
* ```
|
|
19037
|
+
*
|
|
19038
|
+
* @exampleResponse Sign up with an email and password
|
|
19039
|
+
* ```json
|
|
19040
|
+
* // Some fields may be null if "confirm email" is enabled.
|
|
19041
|
+
* {
|
|
19042
|
+
* "data": {
|
|
19043
|
+
* "user": {
|
|
19044
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
19045
|
+
* "aud": "authenticated",
|
|
19046
|
+
* "role": "authenticated",
|
|
19047
|
+
* "email": "example@email.com",
|
|
19048
|
+
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
19049
|
+
* "phone": "",
|
|
19050
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
19051
|
+
* "app_metadata": {
|
|
19052
|
+
* "provider": "email",
|
|
19053
|
+
* "providers": [
|
|
19054
|
+
* "email"
|
|
19055
|
+
* ]
|
|
19056
|
+
* },
|
|
19057
|
+
* "user_metadata": {},
|
|
19058
|
+
* "identities": [
|
|
19059
|
+
* {
|
|
19060
|
+
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
19061
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
19062
|
+
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
19063
|
+
* "identity_data": {
|
|
19064
|
+
* "email": "example@email.com",
|
|
19065
|
+
* "email_verified": false,
|
|
19066
|
+
* "phone_verified": false,
|
|
19067
|
+
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
19068
|
+
* },
|
|
19069
|
+
* "provider": "email",
|
|
19070
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
19071
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
19072
|
+
* "updated_at": "2024-01-01T00:00:00Z",
|
|
19073
|
+
* "email": "example@email.com"
|
|
19074
|
+
* }
|
|
19075
|
+
* ],
|
|
19076
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
19077
|
+
* "updated_at": "2024-01-01T00:00:00Z"
|
|
19078
|
+
* },
|
|
19079
|
+
* "session": {
|
|
19080
|
+
* "access_token": "<ACCESS_TOKEN>",
|
|
19081
|
+
* "token_type": "bearer",
|
|
19082
|
+
* "expires_in": 3600,
|
|
19083
|
+
* "expires_at": 1700000000,
|
|
19084
|
+
* "refresh_token": "<REFRESH_TOKEN>",
|
|
19085
|
+
* "user": {
|
|
19086
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
19087
|
+
* "aud": "authenticated",
|
|
19088
|
+
* "role": "authenticated",
|
|
19089
|
+
* "email": "example@email.com",
|
|
19090
|
+
* "email_confirmed_at": "2024-01-01T00:00:00Z",
|
|
19091
|
+
* "phone": "",
|
|
19092
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
19093
|
+
* "app_metadata": {
|
|
19094
|
+
* "provider": "email",
|
|
19095
|
+
* "providers": [
|
|
19096
|
+
* "email"
|
|
19097
|
+
* ]
|
|
19098
|
+
* },
|
|
19099
|
+
* "user_metadata": {},
|
|
19100
|
+
* "identities": [
|
|
19101
|
+
* {
|
|
19102
|
+
* "identity_id": "22222222-2222-2222-2222-222222222222",
|
|
19103
|
+
* "id": "11111111-1111-1111-1111-111111111111",
|
|
19104
|
+
* "user_id": "11111111-1111-1111-1111-111111111111",
|
|
19105
|
+
* "identity_data": {
|
|
19106
|
+
* "email": "example@email.com",
|
|
19107
|
+
* "email_verified": false,
|
|
19108
|
+
* "phone_verified": false,
|
|
19109
|
+
* "sub": "11111111-1111-1111-1111-111111111111"
|
|
19110
|
+
* },
|
|
19111
|
+
* "provider": "email",
|
|
19112
|
+
* "last_sign_in_at": "2024-01-01T00:00:00Z",
|
|
19113
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
19114
|
+
* "updated_at": "2024-01-01T00:00:00Z",
|
|
19115
|
+
* "email": "example@email.com"
|
|
19116
|
+
* }
|
|
19117
|
+
* ],
|
|
19118
|
+
* "created_at": "2024-01-01T00:00:00Z",
|
|
19119
|
+
* "updated_at": "2024-01-01T00:00:00Z"
|
|
19120
|
+
* }
|
|
19121
|
+
* }
|
|
19122
|
+
* },
|
|
19123
|
+
* "error": null
|
|
19124
|
+
* }
|
|
19125
|
+
* ```
|
|
19126
|
+
*
|
|
19127
|
+
* @example Sign up with a phone number and password (SMS)
|
|
19128
|
+
* ```js
|
|
19129
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
19130
|
+
* phone: '123456789',
|
|
19131
|
+
* password: 'example-password',
|
|
19132
|
+
* options: {
|
|
19133
|
+
* channel: 'sms'
|
|
19134
|
+
* }
|
|
19135
|
+
* })
|
|
19136
|
+
* ```
|
|
19137
|
+
*
|
|
19138
|
+
* @exampleDescription Sign up with a phone number and password (whatsapp)
|
|
19139
|
+
* 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.
|
|
19140
|
+
*
|
|
19141
|
+
* @example Sign up with a phone number and password (whatsapp)
|
|
19142
|
+
* ```js
|
|
19143
|
+
* const { data, error } = await supabase.auth.signUp({
|
|
19144
|
+
* phone: '123456789',
|
|
19145
|
+
* password: 'example-password',
|
|
19146
|
+
* options: {
|
|
19147
|
+
* channel: 'whatsapp'
|
|
19148
|
+
* }
|
|
19149
|
+
* })
|
|
19150
|
+
* ```
|
|
19151
|
+
*
|
|
19152
|
+
* @example Sign up with additional user metadata
|
|
19153
|
+
* ```js
|
|
19154
|
+
* const { data, error } = await supabase.auth.signUp(
|
|
19155
|
+
* {
|
|
19156
|
+
* email: 'example@email.com',
|
|
19157
|
+
* password: 'example-password',
|
|
19158
|
+
* options: {
|
|
19159
|
+
* data: {
|
|
19160
|
+
* first_name: 'John',
|
|
19161
|
+
* age: 27,
|
|
19162
|
+
* }
|
|
19163
|
+
* }
|
|
19164
|
+
* }
|
|
19165
|
+
* )
|
|
19166
|
+
* ```
|
|
19167
|
+
*
|
|
19168
|
+
* @exampleDescription Sign up with a redirect URL
|
|
19169
|
+
* - See [redirect URLs and wildcards](/docs/guides/auth/redirect-urls#use-wildcards-in-redirect-urls) to add additional redirect URLs to your project.
|
|
19170
|
+
*
|
|
19171
|
+
* @example Sign up with a redirect URL
|
|
19172
|
+
* ```js
|
|
19173
|
+
* const { data, error } = await supabase.auth.signUp(
|
|
19174
|
+
* {
|
|
19175
|
+
* email: 'example@email.com',
|
|
19176
|
+
* password: 'example-password',
|
|
19177
|
+
* options: {
|
|
19178
|
+
* emailRedirectTo: 'https://example.com/welcome'
|
|
19179
|
+
* }
|
|
19180
|
+
* }
|
|
19181
|
+
* )
|
|
19182
|
+
* ```
|
|
17740
19183
|
*/
|
|
17741
19184
|
async signUp(credentials) {
|
|
17742
19185
|
var _a, _b, _c;
|
|
@@ -19973,18 +21416,18 @@ var init_GoTrueClient = __esm({
|
|
|
19973
21416
|
}
|
|
19974
21417
|
});
|
|
19975
21418
|
|
|
19976
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
21419
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js
|
|
19977
21420
|
var init_AuthAdminApi = __esm({
|
|
19978
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
21421
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js"() {
|
|
19979
21422
|
init_utils();
|
|
19980
21423
|
init_GoTrueAdminApi();
|
|
19981
21424
|
}
|
|
19982
21425
|
});
|
|
19983
21426
|
|
|
19984
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
21427
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/AuthClient.js
|
|
19985
21428
|
var AuthClient, AuthClient_default;
|
|
19986
21429
|
var init_AuthClient = __esm({
|
|
19987
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
21430
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/AuthClient.js"() {
|
|
19988
21431
|
init_utils();
|
|
19989
21432
|
init_GoTrueClient();
|
|
19990
21433
|
AuthClient = GoTrueClient_default;
|
|
@@ -19992,9 +21435,9 @@ var init_AuthClient = __esm({
|
|
|
19992
21435
|
}
|
|
19993
21436
|
});
|
|
19994
21437
|
|
|
19995
|
-
// node_modules/.bun/@supabase+auth-js@2.
|
|
21438
|
+
// node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/index.js
|
|
19996
21439
|
var init_module3 = __esm({
|
|
19997
|
-
"node_modules/.bun/@supabase+auth-js@2.
|
|
21440
|
+
"node_modules/.bun/@supabase+auth-js@2.99.1/node_modules/@supabase/auth-js/dist/module/index.js"() {
|
|
19998
21441
|
init_utils();
|
|
19999
21442
|
init_GoTrueAdminApi();
|
|
20000
21443
|
init_GoTrueClient();
|
|
@@ -20006,7 +21449,7 @@ var init_module3 = __esm({
|
|
|
20006
21449
|
}
|
|
20007
21450
|
});
|
|
20008
21451
|
|
|
20009
|
-
// node_modules/.bun/@supabase+supabase-js@2.
|
|
21452
|
+
// node_modules/.bun/@supabase+supabase-js@2.99.1/node_modules/@supabase/supabase-js/dist/index.mjs
|
|
20010
21453
|
function _typeof3(o2) {
|
|
20011
21454
|
"@babel/helpers - typeof";
|
|
20012
21455
|
return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
@@ -20099,7 +21542,7 @@ function shouldShowDeprecationWarning() {
|
|
|
20099
21542
|
}
|
|
20100
21543
|
var version4, JS_ENV, DEFAULT_HEADERS3, DEFAULT_GLOBAL_OPTIONS, DEFAULT_DB_OPTIONS, DEFAULT_AUTH_OPTIONS, DEFAULT_REALTIME_OPTIONS, resolveFetch4, resolveHeadersConstructor, fetchWithAuth, SupabaseAuthClient, SupabaseClient, createClient;
|
|
20101
21544
|
var init_dist6 = __esm({
|
|
20102
|
-
"node_modules/.bun/@supabase+supabase-js@2.
|
|
21545
|
+
"node_modules/.bun/@supabase+supabase-js@2.99.1/node_modules/@supabase/supabase-js/dist/index.mjs"() {
|
|
20103
21546
|
init_utils();
|
|
20104
21547
|
init_module();
|
|
20105
21548
|
init_dist3();
|
|
@@ -20108,7 +21551,7 @@ var init_dist6 = __esm({
|
|
|
20108
21551
|
init_module3();
|
|
20109
21552
|
init_module2();
|
|
20110
21553
|
init_module3();
|
|
20111
|
-
version4 = "2.
|
|
21554
|
+
version4 = "2.99.1";
|
|
20112
21555
|
JS_ENV = "";
|
|
20113
21556
|
if (typeof Deno !== "undefined") JS_ENV = "deno";
|
|
20114
21557
|
else if (typeof document !== "undefined") JS_ENV = "web";
|
|
@@ -20151,6 +21594,9 @@ var init_dist6 = __esm({
|
|
|
20151
21594
|
SupabaseClient = class {
|
|
20152
21595
|
/**
|
|
20153
21596
|
* Create a new client for use in the browser.
|
|
21597
|
+
*
|
|
21598
|
+
* @category Initializing
|
|
21599
|
+
*
|
|
20154
21600
|
* @param supabaseUrl The unique Supabase URL which is supplied when you create a new project in your project dashboard.
|
|
20155
21601
|
* @param supabaseKey The unique Supabase Key which is supplied when you create a new project in your project dashboard.
|
|
20156
21602
|
* @param options.db.schema You can switch in between schemas. The schema needs to be on the list of exposed schemas inside Supabase.
|
|
@@ -20161,11 +21607,175 @@ var init_dist6 = __esm({
|
|
|
20161
21607
|
* @param options.storage Options passed along to the storage-js constructor.
|
|
20162
21608
|
* @param options.global.fetch A custom fetch implementation.
|
|
20163
21609
|
* @param options.global.headers Any additional headers to send with each network request.
|
|
20164
|
-
*
|
|
21610
|
+
*
|
|
21611
|
+
* @example Creating a client
|
|
21612
|
+
* ```js
|
|
21613
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21614
|
+
*
|
|
21615
|
+
* // Create a single supabase client for interacting with your database
|
|
21616
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key')
|
|
21617
|
+
* ```
|
|
21618
|
+
*
|
|
21619
|
+
* @example With a custom domain
|
|
21620
|
+
* ```js
|
|
21621
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21622
|
+
*
|
|
21623
|
+
* // Use a custom domain as the supabase URL
|
|
21624
|
+
* const supabase = createClient('https://my-custom-domain.com', 'publishable-or-anon-key')
|
|
21625
|
+
* ```
|
|
21626
|
+
*
|
|
21627
|
+
* @example With additional parameters
|
|
21628
|
+
* ```js
|
|
21629
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21630
|
+
*
|
|
21631
|
+
* const options = {
|
|
21632
|
+
* db: {
|
|
21633
|
+
* schema: 'public',
|
|
21634
|
+
* },
|
|
21635
|
+
* auth: {
|
|
21636
|
+
* autoRefreshToken: true,
|
|
21637
|
+
* persistSession: true,
|
|
21638
|
+
* detectSessionInUrl: true
|
|
21639
|
+
* },
|
|
21640
|
+
* global: {
|
|
21641
|
+
* headers: { 'x-my-custom-header': 'my-app-name' },
|
|
21642
|
+
* },
|
|
21643
|
+
* }
|
|
21644
|
+
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", options)
|
|
21645
|
+
* ```
|
|
21646
|
+
*
|
|
21647
|
+
* @exampleDescription With custom schemas
|
|
21648
|
+
* By default the API server points to the `public` schema. You can enable other database schemas within the Dashboard.
|
|
21649
|
+
* Go to [Settings > API > Exposed schemas](/dashboard/project/_/settings/api) and add the schema which you want to expose to the API.
|
|
21650
|
+
*
|
|
21651
|
+
* 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.
|
|
21652
|
+
*
|
|
21653
|
+
* @example With custom schemas
|
|
21654
|
+
* ```js
|
|
21655
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21656
|
+
*
|
|
21657
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', {
|
|
21658
|
+
* // Provide a custom schema. Defaults to "public".
|
|
21659
|
+
* db: { schema: 'other_schema' }
|
|
21660
|
+
* })
|
|
21661
|
+
* ```
|
|
21662
|
+
*
|
|
21663
|
+
* @exampleDescription Custom fetch implementation
|
|
21664
|
+
* `supabase-js` uses the [`cross-fetch`](https://www.npmjs.com/package/cross-fetch) library to make HTTP requests,
|
|
21665
|
+
* but an alternative `fetch` implementation can be provided as an option.
|
|
21666
|
+
* This is most useful in environments where `cross-fetch` is not compatible (for instance Cloudflare Workers).
|
|
21667
|
+
*
|
|
21668
|
+
* @example Custom fetch implementation
|
|
21669
|
+
* ```js
|
|
21670
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21671
|
+
*
|
|
21672
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-or-anon-key', {
|
|
21673
|
+
* global: { fetch: fetch.bind(globalThis) }
|
|
21674
|
+
* })
|
|
21675
|
+
* ```
|
|
21676
|
+
*
|
|
21677
|
+
* @exampleDescription React Native options with AsyncStorage
|
|
21678
|
+
* For React Native we recommend using `AsyncStorage` as the storage implementation for Supabase Auth.
|
|
21679
|
+
*
|
|
21680
|
+
* @example React Native options with AsyncStorage
|
|
21681
|
+
* ```js
|
|
21682
|
+
* import 'react-native-url-polyfill/auto'
|
|
21683
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21684
|
+
* import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
21685
|
+
*
|
|
21686
|
+
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", {
|
|
21687
|
+
* auth: {
|
|
21688
|
+
* storage: AsyncStorage,
|
|
21689
|
+
* autoRefreshToken: true,
|
|
21690
|
+
* persistSession: true,
|
|
21691
|
+
* detectSessionInUrl: false,
|
|
21692
|
+
* },
|
|
21693
|
+
* });
|
|
21694
|
+
* ```
|
|
21695
|
+
*
|
|
21696
|
+
* @exampleDescription React Native options with Expo SecureStore
|
|
21697
|
+
* If you wish to encrypt the user's session information, you can use `aes-js` and store the encryption key in Expo SecureStore.
|
|
21698
|
+
* The `aes-js` library, a reputable JavaScript-only implementation of the AES encryption algorithm in CTR mode.
|
|
21699
|
+
* A new 256-bit encryption key is generated using the `react-native-get-random-values` library.
|
|
21700
|
+
* This key is stored inside Expo's SecureStore, while the value is encrypted and placed inside AsyncStorage.
|
|
21701
|
+
*
|
|
21702
|
+
* Please make sure that:
|
|
21703
|
+
* - You keep the `expo-secure-store`, `aes-js` and `react-native-get-random-values` libraries up-to-date.
|
|
21704
|
+
* - Choose the correct [`SecureStoreOptions`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestoreoptions) for your app's needs.
|
|
21705
|
+
* E.g. [`SecureStore.WHEN_UNLOCKED`](https://docs.expo.dev/versions/latest/sdk/securestore/#securestorewhen_unlocked) regulates when the data can be accessed.
|
|
21706
|
+
* - Carefully consider optimizations or other modifications to the above example, as those can lead to introducing subtle security vulnerabilities.
|
|
21707
|
+
*
|
|
21708
|
+
* @example React Native options with Expo SecureStore
|
|
21709
|
+
* ```ts
|
|
21710
|
+
* import 'react-native-url-polyfill/auto'
|
|
21711
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
21712
|
+
* import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
21713
|
+
* import * as SecureStore from 'expo-secure-store';
|
|
21714
|
+
* import * as aesjs from 'aes-js';
|
|
21715
|
+
* import 'react-native-get-random-values';
|
|
21716
|
+
*
|
|
21717
|
+
* // As Expo's SecureStore does not support values larger than 2048
|
|
21718
|
+
* // bytes, an AES-256 key is generated and stored in SecureStore, while
|
|
21719
|
+
* // it is used to encrypt/decrypt values stored in AsyncStorage.
|
|
21720
|
+
* class LargeSecureStore {
|
|
21721
|
+
* private async _encrypt(key: string, value: string) {
|
|
21722
|
+
* const encryptionKey = crypto.getRandomValues(new Uint8Array(256 / 8));
|
|
21723
|
+
*
|
|
21724
|
+
* const cipher = new aesjs.ModeOfOperation.ctr(encryptionKey, new aesjs.Counter(1));
|
|
21725
|
+
* const encryptedBytes = cipher.encrypt(aesjs.utils.utf8.toBytes(value));
|
|
21726
|
+
*
|
|
21727
|
+
* await SecureStore.setItemAsync(key, aesjs.utils.hex.fromBytes(encryptionKey));
|
|
21728
|
+
*
|
|
21729
|
+
* return aesjs.utils.hex.fromBytes(encryptedBytes);
|
|
21730
|
+
* }
|
|
21731
|
+
*
|
|
21732
|
+
* private async _decrypt(key: string, value: string) {
|
|
21733
|
+
* const encryptionKeyHex = await SecureStore.getItemAsync(key);
|
|
21734
|
+
* if (!encryptionKeyHex) {
|
|
21735
|
+
* return encryptionKeyHex;
|
|
21736
|
+
* }
|
|
21737
|
+
*
|
|
21738
|
+
* const cipher = new aesjs.ModeOfOperation.ctr(aesjs.utils.hex.toBytes(encryptionKeyHex), new aesjs.Counter(1));
|
|
21739
|
+
* const decryptedBytes = cipher.decrypt(aesjs.utils.hex.toBytes(value));
|
|
21740
|
+
*
|
|
21741
|
+
* return aesjs.utils.utf8.fromBytes(decryptedBytes);
|
|
21742
|
+
* }
|
|
21743
|
+
*
|
|
21744
|
+
* async getItem(key: string) {
|
|
21745
|
+
* const encrypted = await AsyncStorage.getItem(key);
|
|
21746
|
+
* if (!encrypted) { return encrypted; }
|
|
21747
|
+
*
|
|
21748
|
+
* return await this._decrypt(key, encrypted);
|
|
21749
|
+
* }
|
|
21750
|
+
*
|
|
21751
|
+
* async removeItem(key: string) {
|
|
21752
|
+
* await AsyncStorage.removeItem(key);
|
|
21753
|
+
* await SecureStore.deleteItemAsync(key);
|
|
21754
|
+
* }
|
|
21755
|
+
*
|
|
21756
|
+
* async setItem(key: string, value: string) {
|
|
21757
|
+
* const encrypted = await this._encrypt(key, value);
|
|
21758
|
+
*
|
|
21759
|
+
* await AsyncStorage.setItem(key, encrypted);
|
|
21760
|
+
* }
|
|
21761
|
+
* }
|
|
21762
|
+
*
|
|
21763
|
+
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-or-anon-key", {
|
|
21764
|
+
* auth: {
|
|
21765
|
+
* storage: new LargeSecureStore(),
|
|
21766
|
+
* autoRefreshToken: true,
|
|
21767
|
+
* persistSession: true,
|
|
21768
|
+
* detectSessionInUrl: false,
|
|
21769
|
+
* },
|
|
21770
|
+
* });
|
|
21771
|
+
* ```
|
|
21772
|
+
*
|
|
21773
|
+
* @example With a database query
|
|
20165
21774
|
* ```ts
|
|
20166
21775
|
* import { createClient } from '@supabase/supabase-js'
|
|
20167
21776
|
*
|
|
20168
21777
|
* const supabase = createClient('https://xyzcompany.supabase.co', 'public-anon-key')
|
|
21778
|
+
*
|
|
20169
21779
|
* const { data } = await supabase.from('profiles').select('*')
|
|
20170
21780
|
* ```
|
|
20171
21781
|
*/
|