dreamboard 0.1.25 → 0.1.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-H3O43F5P.js → chunk-3JGO32FA.js} +1229 -348
- package/dist/chunk-3JGO32FA.js.map +1 -0
- package/dist/{chunk-MG6EVR7P.js → chunk-4AN7UTLQ.js} +1898 -519
- package/dist/chunk-4AN7UTLQ.js.map +1 -0
- package/dist/{chunk-2RCUHMGL.js → chunk-YI5DUODD.js} +191 -61
- package/dist/chunk-YI5DUODD.js.map +1 -0
- package/dist/dev-host/dev-api-proxy-plugin.ts +27 -1
- package/dist/dev-host/dev-author-dom-warnings.ts +101 -0
- package/dist/dev-host/dev-hmr-guard-plugin.ts +47 -0
- package/dist/dev-host/dev-host-controller.ts +21 -5
- package/dist/dev-host/host-main.css +131 -89
- package/dist/dev-host/host-main.tsx +320 -136
- package/dist/dev-host/plugin-main.ts +9 -3
- package/dist/dev-host/start-dev-server.ts +2 -0
- package/dist/{dist-FRURQI7Q.js → dist-JNA2CLKS.js} +2 -2
- package/dist/{dist-FEPN3BDN.js → dist-JO2OGKJD.js} +35 -15
- package/dist/dist-JO2OGKJD.js.map +1 -0
- package/dist/index.js +3 -3
- package/dist/internal.js +142 -53
- package/dist/internal.js.map +1 -1
- package/dist/runtime-packages/ui-host-runtime/src/session-ingress-controller.ts +20 -9
- package/package.json +3 -3
- package/dist/chunk-2RCUHMGL.js.map +0 -1
- package/dist/chunk-H3O43F5P.js.map +0 -1
- package/dist/chunk-MG6EVR7P.js.map +0 -1
- package/dist/dist-FEPN3BDN.js.map +0 -1
- /package/dist/{dist-FRURQI7Q.js.map → dist-JNA2CLKS.js.map} +0 -0
|
@@ -18,7 +18,7 @@ var require_tslib = __commonJS({
|
|
|
18
18
|
var __propKey2;
|
|
19
19
|
var __setFunctionName2;
|
|
20
20
|
var __metadata2;
|
|
21
|
-
var
|
|
21
|
+
var __awaiter3;
|
|
22
22
|
var __generator2;
|
|
23
23
|
var __exportStar2;
|
|
24
24
|
var __values2;
|
|
@@ -156,7 +156,7 @@ var require_tslib = __commonJS({
|
|
|
156
156
|
__metadata2 = function(metadataKey, metadataValue) {
|
|
157
157
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
|
|
158
158
|
};
|
|
159
|
-
|
|
159
|
+
__awaiter3 = function(thisArg, _arguments, P, generator) {
|
|
160
160
|
function adopt(value) {
|
|
161
161
|
return value instanceof P ? value : new P(function(resolve) {
|
|
162
162
|
resolve(value);
|
|
@@ -516,7 +516,7 @@ var require_tslib = __commonJS({
|
|
|
516
516
|
exporter("__propKey", __propKey2);
|
|
517
517
|
exporter("__setFunctionName", __setFunctionName2);
|
|
518
518
|
exporter("__metadata", __metadata2);
|
|
519
|
-
exporter("__awaiter",
|
|
519
|
+
exporter("__awaiter", __awaiter3);
|
|
520
520
|
exporter("__generator", __generator2);
|
|
521
521
|
exporter("__exportStar", __exportStar2);
|
|
522
522
|
exporter("__createBinding", __createBinding2);
|
|
@@ -579,7 +579,7 @@ var {
|
|
|
579
579
|
__rewriteRelativeImportExtension
|
|
580
580
|
} = import_tslib.default;
|
|
581
581
|
|
|
582
|
-
// ../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
582
|
+
// ../../node_modules/.pnpm/@supabase+functions-js@2.106.1/node_modules/@supabase/functions-js/dist/module/helper.js
|
|
583
583
|
var resolveFetch = (customFetch) => {
|
|
584
584
|
if (customFetch) {
|
|
585
585
|
return (...args) => customFetch(...args);
|
|
@@ -587,7 +587,7 @@ var resolveFetch = (customFetch) => {
|
|
|
587
587
|
return (...args) => fetch(...args);
|
|
588
588
|
};
|
|
589
589
|
|
|
590
|
-
// ../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
590
|
+
// ../../node_modules/.pnpm/@supabase+functions-js@2.106.1/node_modules/@supabase/functions-js/dist/module/types.js
|
|
591
591
|
var FunctionsError = class extends Error {
|
|
592
592
|
constructor(message, name = "FunctionsError", context) {
|
|
593
593
|
super(message);
|
|
@@ -636,29 +636,27 @@ var FunctionRegion;
|
|
|
636
636
|
FunctionRegion2["UsWest2"] = "us-west-2";
|
|
637
637
|
})(FunctionRegion || (FunctionRegion = {}));
|
|
638
638
|
|
|
639
|
-
// ../../node_modules/.pnpm/@supabase+functions-js@2.
|
|
639
|
+
// ../../node_modules/.pnpm/@supabase+functions-js@2.106.1/node_modules/@supabase/functions-js/dist/module/FunctionsClient.js
|
|
640
640
|
var FunctionsClient = class {
|
|
641
641
|
/**
|
|
642
642
|
* Creates a new Functions client bound to an Edge Functions URL.
|
|
643
643
|
*
|
|
644
|
-
* @example
|
|
644
|
+
* @example Using supabase-js (recommended)
|
|
645
645
|
* ```ts
|
|
646
|
-
* import {
|
|
646
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
647
647
|
*
|
|
648
|
-
* const
|
|
649
|
-
*
|
|
650
|
-
* region: FunctionRegion.UsEast1,
|
|
651
|
-
* })
|
|
648
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
649
|
+
* const { data, error } = await supabase.functions.invoke('hello-world')
|
|
652
650
|
* ```
|
|
653
651
|
*
|
|
654
|
-
* @category Functions
|
|
652
|
+
* @category Edge Functions
|
|
655
653
|
*
|
|
656
|
-
* @example
|
|
654
|
+
* @example Standalone import for bundle-sensitive environments
|
|
657
655
|
* ```ts
|
|
658
656
|
* import { FunctionsClient, FunctionRegion } from '@supabase/functions-js'
|
|
659
657
|
*
|
|
660
658
|
* const functions = new FunctionsClient('https://xyzcompany.supabase.co/functions/v1', {
|
|
661
|
-
* headers: { apikey: '
|
|
659
|
+
* headers: { apikey: 'your-publishable-key' },
|
|
662
660
|
* region: FunctionRegion.UsEast1,
|
|
663
661
|
* })
|
|
664
662
|
* ```
|
|
@@ -673,7 +671,7 @@ var FunctionsClient = class {
|
|
|
673
671
|
* Updates the authorization header
|
|
674
672
|
* @param token - the new jwt token sent in the authorisation header
|
|
675
673
|
*
|
|
676
|
-
* @category Functions
|
|
674
|
+
* @category Edge Functions
|
|
677
675
|
*
|
|
678
676
|
* @example Setting the authorization header
|
|
679
677
|
* ```ts
|
|
@@ -694,7 +692,7 @@ var FunctionsClient = class {
|
|
|
694
692
|
* })
|
|
695
693
|
* ```
|
|
696
694
|
*
|
|
697
|
-
* @category Functions
|
|
695
|
+
* @category Edge Functions
|
|
698
696
|
*
|
|
699
697
|
* @remarks
|
|
700
698
|
* - Requires an Authorization header.
|
|
@@ -801,7 +799,7 @@ var FunctionsClient = class {
|
|
|
801
799
|
* })
|
|
802
800
|
* ```
|
|
803
801
|
*
|
|
804
|
-
* @example
|
|
802
|
+
* @example Standalone client invoke
|
|
805
803
|
* ```ts
|
|
806
804
|
* const { data, error } = await functions.invoke('hello-world', {
|
|
807
805
|
* body: { name: 'Ada' },
|
|
@@ -905,7 +903,7 @@ var FunctionsClient = class {
|
|
|
905
903
|
}
|
|
906
904
|
};
|
|
907
905
|
|
|
908
|
-
// ../../node_modules/.pnpm/@supabase+postgrest-js@2.
|
|
906
|
+
// ../../node_modules/.pnpm/@supabase+postgrest-js@2.106.1/node_modules/@supabase/postgrest-js/dist/index.mjs
|
|
909
907
|
var DEFAULT_MAX_RETRIES = 3;
|
|
910
908
|
var getRetryDelay = (attemptIndex) => Math.min(1e3 * 2 ** attemptIndex, 3e4);
|
|
911
909
|
var RETRYABLE_STATUS_CODES = [520, 503];
|
|
@@ -972,25 +970,23 @@ var PostgrestBuilder = class {
|
|
|
972
970
|
/**
|
|
973
971
|
* Creates a builder configured for a specific PostgREST request.
|
|
974
972
|
*
|
|
975
|
-
* @example
|
|
973
|
+
* @example Using supabase-js (recommended)
|
|
976
974
|
* ```ts
|
|
977
|
-
* import {
|
|
975
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
978
976
|
*
|
|
979
|
-
* const
|
|
980
|
-
*
|
|
981
|
-
* { headers: new Headers({ apikey: 'public-anon-key' }) }
|
|
982
|
-
* )
|
|
977
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
978
|
+
* const { data, error } = await supabase.from('users').select('*')
|
|
983
979
|
* ```
|
|
984
980
|
*
|
|
985
981
|
* @category Database
|
|
986
982
|
*
|
|
987
|
-
* @example
|
|
983
|
+
* @example Standalone import for bundle-sensitive environments
|
|
988
984
|
* ```ts
|
|
989
985
|
* import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
|
|
990
986
|
*
|
|
991
987
|
* const builder = new PostgrestQueryBuilder(
|
|
992
988
|
* new URL('https://xyzcompany.supabase.co/rest/v1/users'),
|
|
993
|
-
* { headers: new Headers({ apikey: '
|
|
989
|
+
* { headers: new Headers({ apikey: 'your-publishable-key' }) }
|
|
994
990
|
* )
|
|
995
991
|
* ```
|
|
996
992
|
*/
|
|
@@ -1033,6 +1029,7 @@ var PostgrestBuilder = class {
|
|
|
1033
1029
|
* {@link https://docs.postgrest.org/en/stable/references/api/resource_representation.html#stripped-nulls}
|
|
1034
1030
|
*
|
|
1035
1031
|
* @category Database
|
|
1032
|
+
* @subcategory Using modifiers
|
|
1036
1033
|
*
|
|
1037
1034
|
* @example With `select()`
|
|
1038
1035
|
* ```ts
|
|
@@ -1134,7 +1131,7 @@ var PostgrestBuilder = class {
|
|
|
1134
1131
|
res$1 = await _fetch(_this.url.toString(), {
|
|
1135
1132
|
method: _this.method,
|
|
1136
1133
|
headers: requestHeaders,
|
|
1137
|
-
body: JSON.stringify(_this.body),
|
|
1134
|
+
body: JSON.stringify(_this.body, (_, value) => typeof value === "bigint" ? value.toString() : value),
|
|
1138
1135
|
signal: _this.signal
|
|
1139
1136
|
});
|
|
1140
1137
|
} catch (fetchError) {
|
|
@@ -1305,6 +1302,7 @@ ${cause.stack}`;
|
|
|
1305
1302
|
* @returns A PostgrestBuilder instance with the new type
|
|
1306
1303
|
*
|
|
1307
1304
|
* @category Database
|
|
1305
|
+
* @subcategory Using modifiers
|
|
1308
1306
|
*
|
|
1309
1307
|
* @example Complete Override type of successful response
|
|
1310
1308
|
* ```ts
|
|
@@ -1360,7 +1358,7 @@ ${cause.stack}`;
|
|
|
1360
1358
|
* let x: typeof data // CountryRowProperties & { status: "A" | "B" } | null
|
|
1361
1359
|
* ```
|
|
1362
1360
|
*
|
|
1363
|
-
* @example
|
|
1361
|
+
* @example Merge vs replace existing types
|
|
1364
1362
|
* ```typescript
|
|
1365
1363
|
* // Merge with existing types (default behavior)
|
|
1366
1364
|
* const query = supabase
|
|
@@ -1390,6 +1388,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
1390
1388
|
* @param columns - The columns to retrieve, separated by commas
|
|
1391
1389
|
*
|
|
1392
1390
|
* @category Database
|
|
1391
|
+
* @subcategory Using modifiers
|
|
1393
1392
|
*
|
|
1394
1393
|
* @example With `upsert()`
|
|
1395
1394
|
* ```ts
|
|
@@ -1454,6 +1453,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
1454
1453
|
* instead
|
|
1455
1454
|
*
|
|
1456
1455
|
* @category Database
|
|
1456
|
+
* @subcategory Using modifiers
|
|
1457
1457
|
*
|
|
1458
1458
|
* @example With `select()`
|
|
1459
1459
|
* ```ts
|
|
@@ -1640,6 +1640,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
1640
1640
|
* instead
|
|
1641
1641
|
*
|
|
1642
1642
|
* @category Database
|
|
1643
|
+
* @subcategory Using modifiers
|
|
1643
1644
|
*
|
|
1644
1645
|
* @example With `select()`
|
|
1645
1646
|
* ```ts
|
|
@@ -1749,6 +1750,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
1749
1750
|
* instead
|
|
1750
1751
|
*
|
|
1751
1752
|
* @category Database
|
|
1753
|
+
* @subcategory Using modifiers
|
|
1752
1754
|
*
|
|
1753
1755
|
* @example With `select()`
|
|
1754
1756
|
* ```ts
|
|
@@ -1800,6 +1802,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
1800
1802
|
* @param signal - The AbortSignal to use for the fetch request
|
|
1801
1803
|
*
|
|
1802
1804
|
* @category Database
|
|
1805
|
+
* @subcategory Using modifiers
|
|
1803
1806
|
*
|
|
1804
1807
|
* @remarks
|
|
1805
1808
|
* You can use this to set a timeout for the request.
|
|
@@ -1870,6 +1873,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
1870
1873
|
* returns an error.
|
|
1871
1874
|
*
|
|
1872
1875
|
* @category Database
|
|
1876
|
+
* @subcategory Using modifiers
|
|
1873
1877
|
*
|
|
1874
1878
|
* @example With `select()`
|
|
1875
1879
|
* ```ts
|
|
@@ -1915,6 +1919,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
1915
1919
|
* this returns an error.
|
|
1916
1920
|
*
|
|
1917
1921
|
* @category Database
|
|
1922
|
+
* @subcategory Using modifiers
|
|
1918
1923
|
*
|
|
1919
1924
|
* @example With `select()`
|
|
1920
1925
|
* ```ts
|
|
@@ -1954,6 +1959,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
1954
1959
|
* Return `data` as a string in CSV format.
|
|
1955
1960
|
*
|
|
1956
1961
|
* @category Database
|
|
1962
|
+
* @subcategory Using modifiers
|
|
1957
1963
|
*
|
|
1958
1964
|
* @exampleDescription Return data as CSV
|
|
1959
1965
|
* By default, the data is returned in JSON format, but can also be returned as Comma Separated Values.
|
|
@@ -2027,6 +2033,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
2027
2033
|
* or `"json"`
|
|
2028
2034
|
*
|
|
2029
2035
|
* @category Database
|
|
2036
|
+
* @subcategory Using modifiers
|
|
2030
2037
|
*
|
|
2031
2038
|
* @exampleDescription Get the execution plan
|
|
2032
2039
|
* By default, the data is returned in TEXT format, but can also be returned as JSON by using the `format` parameter.
|
|
@@ -2128,6 +2135,7 @@ var PostgrestTransformBuilder = class extends PostgrestBuilder {
|
|
|
2128
2135
|
* @deprecated Use overrideTypes<yourType, { merge: false }>() method at the end of your call chain instead
|
|
2129
2136
|
*
|
|
2130
2137
|
* @category Database
|
|
2138
|
+
* @subcategory Using modifiers
|
|
2131
2139
|
*
|
|
2132
2140
|
* @remarks
|
|
2133
2141
|
* - Deprecated: use overrideTypes method instead
|
|
@@ -2187,6 +2195,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2187
2195
|
* @param value - The value to filter with
|
|
2188
2196
|
*
|
|
2189
2197
|
* @category Database
|
|
2198
|
+
* @subcategory Using filters
|
|
2190
2199
|
*
|
|
2191
2200
|
* @example With `select()`
|
|
2192
2201
|
* ```ts
|
|
@@ -2230,10 +2239,14 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2230
2239
|
/**
|
|
2231
2240
|
* Match only rows where `column` is not equal to `value`.
|
|
2232
2241
|
*
|
|
2242
|
+
* This filter does not include rows where `column` is `NULL`. To match null
|
|
2243
|
+
* values, use `.is(column, null)` instead.
|
|
2244
|
+
*
|
|
2233
2245
|
* @param column - The column to filter on
|
|
2234
2246
|
* @param value - The value to filter with
|
|
2235
2247
|
*
|
|
2236
2248
|
* @category Database
|
|
2249
|
+
* @subcategory Using filters
|
|
2237
2250
|
*
|
|
2238
2251
|
* @example With `select()`
|
|
2239
2252
|
* ```ts
|
|
@@ -2285,6 +2298,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2285
2298
|
* @param value - The value to filter with
|
|
2286
2299
|
*
|
|
2287
2300
|
* @category Database
|
|
2301
|
+
* @subcategory Using filters
|
|
2288
2302
|
*
|
|
2289
2303
|
* @exampleDescription With `select()`
|
|
2290
2304
|
* When using [reserved words](https://www.postgresql.org/docs/current/sql-keywords-appendix.html) for column names you need
|
|
@@ -2336,6 +2350,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2336
2350
|
* @param value - The value to filter with
|
|
2337
2351
|
*
|
|
2338
2352
|
* @category Database
|
|
2353
|
+
* @subcategory Using filters
|
|
2339
2354
|
*
|
|
2340
2355
|
* @example With `select()`
|
|
2341
2356
|
* ```ts
|
|
@@ -2387,6 +2402,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2387
2402
|
* @param value - The value to filter with
|
|
2388
2403
|
*
|
|
2389
2404
|
* @category Database
|
|
2405
|
+
* @subcategory Using filters
|
|
2390
2406
|
*
|
|
2391
2407
|
* @example With `select()`
|
|
2392
2408
|
* ```ts
|
|
@@ -2434,6 +2450,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2434
2450
|
* @param value - The value to filter with
|
|
2435
2451
|
*
|
|
2436
2452
|
* @category Database
|
|
2453
|
+
* @subcategory Using filters
|
|
2437
2454
|
*
|
|
2438
2455
|
* @example With `select()`
|
|
2439
2456
|
* ```ts
|
|
@@ -2485,6 +2502,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2485
2502
|
* @param pattern - The pattern to match with
|
|
2486
2503
|
*
|
|
2487
2504
|
* @category Database
|
|
2505
|
+
* @subcategory Using filters
|
|
2488
2506
|
*
|
|
2489
2507
|
* @example With `select()`
|
|
2490
2508
|
* ```ts
|
|
@@ -2532,6 +2550,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2532
2550
|
* @param patterns - The patterns to match with
|
|
2533
2551
|
*
|
|
2534
2552
|
* @category Database
|
|
2553
|
+
* @subcategory Using filters
|
|
2535
2554
|
*/
|
|
2536
2555
|
likeAllOf(column, patterns) {
|
|
2537
2556
|
this.url.searchParams.append(column, `like(all).{${patterns.join(",")}}`);
|
|
@@ -2544,6 +2563,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2544
2563
|
* @param patterns - The patterns to match with
|
|
2545
2564
|
*
|
|
2546
2565
|
* @category Database
|
|
2566
|
+
* @subcategory Using filters
|
|
2547
2567
|
*/
|
|
2548
2568
|
likeAnyOf(column, patterns) {
|
|
2549
2569
|
this.url.searchParams.append(column, `like(any).{${patterns.join(",")}}`);
|
|
@@ -2556,6 +2576,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2556
2576
|
* @param pattern - The pattern to match with
|
|
2557
2577
|
*
|
|
2558
2578
|
* @category Database
|
|
2579
|
+
* @subcategory Using filters
|
|
2559
2580
|
*
|
|
2560
2581
|
* @example With `select()`
|
|
2561
2582
|
* ```ts
|
|
@@ -2603,6 +2624,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2603
2624
|
* @param patterns - The patterns to match with
|
|
2604
2625
|
*
|
|
2605
2626
|
* @category Database
|
|
2627
|
+
* @subcategory Using filters
|
|
2606
2628
|
*/
|
|
2607
2629
|
ilikeAllOf(column, patterns) {
|
|
2608
2630
|
this.url.searchParams.append(column, `ilike(all).{${patterns.join(",")}}`);
|
|
@@ -2615,6 +2637,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2615
2637
|
* @param patterns - The patterns to match with
|
|
2616
2638
|
*
|
|
2617
2639
|
* @category Database
|
|
2640
|
+
* @subcategory Using filters
|
|
2618
2641
|
*/
|
|
2619
2642
|
ilikeAnyOf(column, patterns) {
|
|
2620
2643
|
this.url.searchParams.append(column, `ilike(any).{${patterns.join(",")}}`);
|
|
@@ -2655,6 +2678,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2655
2678
|
* @param value - The value to filter with
|
|
2656
2679
|
*
|
|
2657
2680
|
* @category Database
|
|
2681
|
+
* @subcategory Using filters
|
|
2658
2682
|
*
|
|
2659
2683
|
* @exampleDescription Checking for nullness, true or false
|
|
2660
2684
|
* Using the `eq()` filter doesn't work when filtering for `null`.
|
|
@@ -2720,6 +2744,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2720
2744
|
* @param values - The values array to filter with
|
|
2721
2745
|
*
|
|
2722
2746
|
* @category Database
|
|
2747
|
+
* @subcategory Using filters
|
|
2723
2748
|
*
|
|
2724
2749
|
* @example With `select()`
|
|
2725
2750
|
* ```ts
|
|
@@ -2790,6 +2815,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2790
2815
|
* @param value - The jsonb, array, or range value to filter with
|
|
2791
2816
|
*
|
|
2792
2817
|
* @category Database
|
|
2818
|
+
* @subcategory Using filters
|
|
2793
2819
|
*
|
|
2794
2820
|
* @example On array columns
|
|
2795
2821
|
* ```ts
|
|
@@ -2924,6 +2950,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
2924
2950
|
* @param value - The jsonb, array, or range value to filter with
|
|
2925
2951
|
*
|
|
2926
2952
|
* @category Database
|
|
2953
|
+
* @subcategory Using filters
|
|
2927
2954
|
*
|
|
2928
2955
|
* @example On array columns
|
|
2929
2956
|
* ```ts
|
|
@@ -3059,6 +3086,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
3059
3086
|
* @param range - The range to filter with
|
|
3060
3087
|
*
|
|
3061
3088
|
* @category Database
|
|
3089
|
+
* @subcategory Using filters
|
|
3062
3090
|
*
|
|
3063
3091
|
* @exampleDescription With `select()`
|
|
3064
3092
|
* Postgres supports a number of [range
|
|
@@ -3119,6 +3147,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
3119
3147
|
* @param range - The range to filter with
|
|
3120
3148
|
*
|
|
3121
3149
|
* @category Database
|
|
3150
|
+
* @subcategory Using filters
|
|
3122
3151
|
*
|
|
3123
3152
|
* @exampleDescription With `select()`
|
|
3124
3153
|
* Postgres supports a number of [range
|
|
@@ -3178,6 +3207,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
3178
3207
|
* @param range - The range to filter with
|
|
3179
3208
|
*
|
|
3180
3209
|
* @category Database
|
|
3210
|
+
* @subcategory Using filters
|
|
3181
3211
|
*
|
|
3182
3212
|
* @exampleDescription With `select()`
|
|
3183
3213
|
* Postgres supports a number of [range
|
|
@@ -3237,6 +3267,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
3237
3267
|
* @param range - The range to filter with
|
|
3238
3268
|
*
|
|
3239
3269
|
* @category Database
|
|
3270
|
+
* @subcategory Using filters
|
|
3240
3271
|
*
|
|
3241
3272
|
* @exampleDescription With `select()`
|
|
3242
3273
|
* Postgres supports a number of [range
|
|
@@ -3297,6 +3328,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
3297
3328
|
* @param range - The range to filter with
|
|
3298
3329
|
*
|
|
3299
3330
|
* @category Database
|
|
3331
|
+
* @subcategory Using filters
|
|
3300
3332
|
*
|
|
3301
3333
|
* @exampleDescription With `select()`
|
|
3302
3334
|
* Postgres supports a number of [range
|
|
@@ -3355,6 +3387,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
3355
3387
|
* @param value - The array or range value to filter with
|
|
3356
3388
|
*
|
|
3357
3389
|
* @category Database
|
|
3390
|
+
* @subcategory Using filters
|
|
3358
3391
|
*
|
|
3359
3392
|
* @example On array columns
|
|
3360
3393
|
* ```ts
|
|
@@ -3454,6 +3487,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
3454
3487
|
* @param options.type - Change how the `query` text is interpreted
|
|
3455
3488
|
*
|
|
3456
3489
|
* @category Database
|
|
3490
|
+
* @subcategory Using filters
|
|
3457
3491
|
*
|
|
3458
3492
|
* @remarks
|
|
3459
3493
|
* - For more information, see [Postgres full text search](/docs/guides/database/full-text-search).
|
|
@@ -3563,6 +3597,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
3563
3597
|
* to their filter values
|
|
3564
3598
|
*
|
|
3565
3599
|
* @category Database
|
|
3600
|
+
* @subcategory Using filters
|
|
3566
3601
|
*
|
|
3567
3602
|
* @example With `select()`
|
|
3568
3603
|
* ```ts
|
|
@@ -3618,6 +3653,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
3618
3653
|
* @param value - The value to filter with, following PostgREST syntax
|
|
3619
3654
|
*
|
|
3620
3655
|
* @category Database
|
|
3656
|
+
* @subcategory Using filters
|
|
3621
3657
|
*
|
|
3622
3658
|
* @remarks
|
|
3623
3659
|
* not() expects you to use the raw PostgREST syntax for the filter values.
|
|
@@ -3682,6 +3718,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
3682
3718
|
* @param options.foreignTable - Deprecated, use `referencedTable` instead
|
|
3683
3719
|
*
|
|
3684
3720
|
* @category Database
|
|
3721
|
+
* @subcategory Using filters
|
|
3685
3722
|
*
|
|
3686
3723
|
* @remarks
|
|
3687
3724
|
* or() expects you to use the raw PostgREST syntax for the filter names and values.
|
|
@@ -3835,6 +3872,7 @@ var PostgrestFilterBuilder = class extends PostgrestTransformBuilder {
|
|
|
3835
3872
|
* @param value - The value to filter with, following PostgREST syntax
|
|
3836
3873
|
*
|
|
3837
3874
|
* @category Database
|
|
3875
|
+
* @subcategory Using filters
|
|
3838
3876
|
*
|
|
3839
3877
|
* @remarks
|
|
3840
3878
|
* filter() expects you to use the raw PostgREST syntax for the filter values.
|
|
@@ -3952,13 +3990,21 @@ var PostgrestQueryBuilder = class {
|
|
|
3952
3990
|
* @param options.urlLengthLimit - Maximum URL length before warning
|
|
3953
3991
|
* @param options.retry - Enable automatic retries for transient errors (default: true)
|
|
3954
3992
|
*
|
|
3955
|
-
* @example
|
|
3993
|
+
* @example Using supabase-js (recommended)
|
|
3994
|
+
* ```ts
|
|
3995
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
3996
|
+
*
|
|
3997
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
3998
|
+
* const { data, error } = await supabase.from('users').select('*')
|
|
3999
|
+
* ```
|
|
4000
|
+
*
|
|
4001
|
+
* @example Standalone import for bundle-sensitive environments
|
|
3956
4002
|
* ```ts
|
|
3957
4003
|
* import { PostgrestQueryBuilder } from '@supabase/postgrest-js'
|
|
3958
4004
|
*
|
|
3959
4005
|
* const query = new PostgrestQueryBuilder(
|
|
3960
4006
|
* new URL('https://xyzcompany.supabase.co/rest/v1/users'),
|
|
3961
|
-
* { headers: { apikey: '
|
|
4007
|
+
* { headers: { apikey: 'your-publishable-key' }, retry: true }
|
|
3962
4008
|
* )
|
|
3963
4009
|
* ```
|
|
3964
4010
|
*/
|
|
@@ -5504,15 +5550,12 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
5504
5550
|
* When enabled, idempotent requests (GET, HEAD, OPTIONS) that fail with network
|
|
5505
5551
|
* errors or HTTP 503/520 responses will be automatically retried up to 3 times
|
|
5506
5552
|
* with exponential backoff (1s, 2s, 4s). Defaults to `true`.
|
|
5507
|
-
* @example
|
|
5553
|
+
* @example Using supabase-js (recommended)
|
|
5508
5554
|
* ```ts
|
|
5509
|
-
* import {
|
|
5555
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
5510
5556
|
*
|
|
5511
|
-
* const
|
|
5512
|
-
*
|
|
5513
|
-
* schema: 'public',
|
|
5514
|
-
* timeout: 30000, // 30 second timeout
|
|
5515
|
-
* })
|
|
5557
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
5558
|
+
* const { data, error } = await supabase.from('profiles').select('*')
|
|
5516
5559
|
* ```
|
|
5517
5560
|
*
|
|
5518
5561
|
* @category Database
|
|
@@ -5521,25 +5564,14 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
5521
5564
|
* - A `timeout` option (in milliseconds) can be set to automatically abort requests that take too long.
|
|
5522
5565
|
* - A `urlLengthLimit` option (default: 8000) can be set to control when URL length warnings are included in error messages for aborted requests.
|
|
5523
5566
|
*
|
|
5524
|
-
* @example
|
|
5525
|
-
* ```ts
|
|
5526
|
-
* import { PostgrestClient } from '@supabase/postgrest-js'
|
|
5527
|
-
*
|
|
5528
|
-
* const postgrest = new PostgrestClient('https://xyzcompany.supabase.co/rest/v1', {
|
|
5529
|
-
* headers: { apikey: 'public-anon-key' },
|
|
5530
|
-
* schema: 'public',
|
|
5531
|
-
* })
|
|
5532
|
-
* ```
|
|
5533
|
-
*
|
|
5534
|
-
* @example With timeout
|
|
5567
|
+
* @example Standalone import for bundle-sensitive environments
|
|
5535
5568
|
* ```ts
|
|
5536
5569
|
* import { PostgrestClient } from '@supabase/postgrest-js'
|
|
5537
5570
|
*
|
|
5538
5571
|
* const postgrest = new PostgrestClient('https://xyzcompany.supabase.co/rest/v1', {
|
|
5539
|
-
* headers: { apikey: '
|
|
5572
|
+
* headers: { apikey: 'your-publishable-key' },
|
|
5540
5573
|
* schema: 'public',
|
|
5541
5574
|
* timeout: 30000, // 30 second timeout
|
|
5542
|
-
* retry: false, // Disable automatic retries
|
|
5543
5575
|
* })
|
|
5544
5576
|
* ```
|
|
5545
5577
|
*/
|
|
@@ -5808,7 +5840,7 @@ var PostgrestClient = class PostgrestClient2 {
|
|
|
5808
5840
|
}
|
|
5809
5841
|
};
|
|
5810
5842
|
|
|
5811
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
5843
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/lib/websocket-factory.js
|
|
5812
5844
|
var WebSocketFactory = class {
|
|
5813
5845
|
/**
|
|
5814
5846
|
* Static-only utility – prevent instantiation.
|
|
@@ -5818,22 +5850,24 @@ var WebSocketFactory = class {
|
|
|
5818
5850
|
static detectEnvironment() {
|
|
5819
5851
|
var _a;
|
|
5820
5852
|
if (typeof WebSocket !== "undefined") {
|
|
5821
|
-
return { type: "native",
|
|
5853
|
+
return { type: "native", wsConstructor: WebSocket };
|
|
5822
5854
|
}
|
|
5823
|
-
|
|
5824
|
-
|
|
5855
|
+
const gt = globalThis;
|
|
5856
|
+
if (typeof globalThis !== "undefined" && typeof gt.WebSocket !== "undefined") {
|
|
5857
|
+
return { type: "native", wsConstructor: gt.WebSocket };
|
|
5825
5858
|
}
|
|
5826
|
-
|
|
5827
|
-
|
|
5859
|
+
const gl = typeof global !== "undefined" ? global : void 0;
|
|
5860
|
+
if (gl && typeof gl.WebSocket !== "undefined") {
|
|
5861
|
+
return { type: "native", wsConstructor: gl.WebSocket };
|
|
5828
5862
|
}
|
|
5829
|
-
if (typeof globalThis !== "undefined" && typeof
|
|
5863
|
+
if (typeof globalThis !== "undefined" && typeof gt.WebSocketPair !== "undefined" && typeof globalThis.WebSocket === "undefined") {
|
|
5830
5864
|
return {
|
|
5831
5865
|
type: "cloudflare",
|
|
5832
5866
|
error: "Cloudflare Workers detected. WebSocket clients are not supported in Cloudflare Workers.",
|
|
5833
5867
|
workaround: "Use Cloudflare Workers WebSocket API for server-side WebSocket handling, or deploy to a different runtime."
|
|
5834
5868
|
};
|
|
5835
5869
|
}
|
|
5836
|
-
if (typeof globalThis !== "undefined" &&
|
|
5870
|
+
if (typeof globalThis !== "undefined" && gt.EdgeRuntime || typeof navigator !== "undefined" && ((_a = navigator.userAgent) === null || _a === void 0 ? void 0 : _a.includes("Vercel-Edge"))) {
|
|
5837
5871
|
return {
|
|
5838
5872
|
type: "unsupported",
|
|
5839
5873
|
error: "Edge runtime detected (Vercel Edge/Netlify Edge). WebSockets are not supported in edge functions.",
|
|
@@ -5848,7 +5882,7 @@ var WebSocketFactory = class {
|
|
|
5848
5882
|
const nodeVersion = parseInt(versionString.replace(/^v/, "").split(".")[0]);
|
|
5849
5883
|
if (nodeVersion >= 22) {
|
|
5850
5884
|
if (typeof globalThis.WebSocket !== "undefined") {
|
|
5851
|
-
return { type: "native",
|
|
5885
|
+
return { type: "native", wsConstructor: globalThis.WebSocket };
|
|
5852
5886
|
}
|
|
5853
5887
|
return {
|
|
5854
5888
|
type: "unsupported",
|
|
@@ -5886,8 +5920,8 @@ var WebSocketFactory = class {
|
|
|
5886
5920
|
*/
|
|
5887
5921
|
static getWebSocketConstructor() {
|
|
5888
5922
|
const env = this.detectEnvironment();
|
|
5889
|
-
if (env.
|
|
5890
|
-
return env.
|
|
5923
|
+
if (env.wsConstructor) {
|
|
5924
|
+
return env.wsConstructor;
|
|
5891
5925
|
}
|
|
5892
5926
|
let errorMessage = env.error || "WebSocket not supported in this environment.";
|
|
5893
5927
|
if (env.workaround) {
|
|
@@ -5921,10 +5955,10 @@ Suggested solution: ${env.workaround}`;
|
|
|
5921
5955
|
};
|
|
5922
5956
|
var websocket_factory_default = WebSocketFactory;
|
|
5923
5957
|
|
|
5924
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
5925
|
-
var version = "2.
|
|
5958
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/lib/version.js
|
|
5959
|
+
var version = "2.106.1";
|
|
5926
5960
|
|
|
5927
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
5961
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/lib/constants.js
|
|
5928
5962
|
var DEFAULT_VERSION = `realtime-js/${version}`;
|
|
5929
5963
|
var VSN_1_0_0 = "1.0.0";
|
|
5930
5964
|
var VSN_2_0_0 = "2.0.0";
|
|
@@ -5953,7 +5987,7 @@ var CONNECTION_STATE = {
|
|
|
5953
5987
|
closed: "closed"
|
|
5954
5988
|
};
|
|
5955
5989
|
|
|
5956
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
5990
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/lib/serializer.js
|
|
5957
5991
|
var Serializer = class {
|
|
5958
5992
|
constructor(allowedMetadataKeys) {
|
|
5959
5993
|
this.HEADER_LENGTH = 1;
|
|
@@ -6093,7 +6127,7 @@ var Serializer = class {
|
|
|
6093
6127
|
}
|
|
6094
6128
|
};
|
|
6095
6129
|
|
|
6096
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
6130
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/lib/transformers.js
|
|
6097
6131
|
var PostgresTypes;
|
|
6098
6132
|
(function(PostgresTypes2) {
|
|
6099
6133
|
PostgresTypes2["abstime"] = "abstime";
|
|
@@ -6256,7 +6290,7 @@ var httpEndpointURL = (socketUrl) => {
|
|
|
6256
6290
|
return wsUrl.href;
|
|
6257
6291
|
};
|
|
6258
6292
|
|
|
6259
|
-
// ../../node_modules/.pnpm/@supabase+phoenix@0.4.
|
|
6293
|
+
// ../../node_modules/.pnpm/@supabase+phoenix@0.4.2/node_modules/@supabase/phoenix/priv/static/phoenix.mjs
|
|
6260
6294
|
var closure = (value) => {
|
|
6261
6295
|
if (typeof value === "function") {
|
|
6262
6296
|
return (
|
|
@@ -7380,7 +7414,12 @@ var Socket = class {
|
|
|
7380
7414
|
this.primaryPassedHealthCheck = false;
|
|
7381
7415
|
this.longPollFallbackMs = opts.longPollFallbackMs;
|
|
7382
7416
|
this.fallbackTimer = null;
|
|
7383
|
-
|
|
7417
|
+
let envSessionStorage = null;
|
|
7418
|
+
try {
|
|
7419
|
+
envSessionStorage = global2 && global2.sessionStorage;
|
|
7420
|
+
} catch {
|
|
7421
|
+
}
|
|
7422
|
+
this.sessionStore = opts.sessionStorage || envSessionStorage;
|
|
7384
7423
|
this.establishedConnections = 0;
|
|
7385
7424
|
this.defaultEncoder = serializer_default.encode.bind(serializer_default);
|
|
7386
7425
|
this.defaultDecoder = serializer_default.decode.bind(serializer_default);
|
|
@@ -7760,7 +7799,7 @@ var Socket = class {
|
|
|
7760
7799
|
} catch (e) {
|
|
7761
7800
|
this.log("error", "error in heartbeat callback", e);
|
|
7762
7801
|
}
|
|
7763
|
-
this.triggerChanError();
|
|
7802
|
+
this.triggerChanError(new Error("heartbeat timeout"));
|
|
7764
7803
|
this.closeWasClean = false;
|
|
7765
7804
|
this.teardown(() => this.reconnectTimer.scheduleTimeout(), WS_CLOSE_NORMAL, "heartbeat timeout");
|
|
7766
7805
|
}
|
|
@@ -7825,7 +7864,7 @@ var Socket = class {
|
|
|
7825
7864
|
if (this.conn) this.conn.onclose = () => {
|
|
7826
7865
|
};
|
|
7827
7866
|
if (this.hasLogger()) this.log("transport", "close", event);
|
|
7828
|
-
this.triggerChanError();
|
|
7867
|
+
this.triggerChanError(event);
|
|
7829
7868
|
this.clearHeartbeats();
|
|
7830
7869
|
if (!this.closeWasClean) {
|
|
7831
7870
|
this.reconnectTimer.scheduleTimeout();
|
|
@@ -7837,21 +7876,22 @@ var Socket = class {
|
|
|
7837
7876
|
* @param {Event} error
|
|
7838
7877
|
*/
|
|
7839
7878
|
onConnError(error) {
|
|
7840
|
-
if (this.hasLogger()) this.log("transport", error);
|
|
7879
|
+
if (this.hasLogger()) this.log("transport", "error", error);
|
|
7841
7880
|
let transportBefore = this.transport;
|
|
7842
7881
|
let establishedBefore = this.establishedConnections;
|
|
7843
7882
|
this.triggerStateCallbacks("error", error, transportBefore, establishedBefore);
|
|
7844
7883
|
if (transportBefore === this.transport || establishedBefore > 0) {
|
|
7845
|
-
this.triggerChanError();
|
|
7884
|
+
this.triggerChanError(error);
|
|
7846
7885
|
}
|
|
7847
7886
|
}
|
|
7848
7887
|
/**
|
|
7849
7888
|
* @private
|
|
7889
|
+
* @param {unknown} [reason] underlying close/error event forwarded to channel error listeners
|
|
7850
7890
|
*/
|
|
7851
|
-
triggerChanError() {
|
|
7891
|
+
triggerChanError(reason) {
|
|
7852
7892
|
this.channels.forEach((channel) => {
|
|
7853
7893
|
if (!(channel.isErrored() || channel.isLeaving() || channel.isClosed())) {
|
|
7854
|
-
channel.trigger(CHANNEL_EVENTS2.error);
|
|
7894
|
+
channel.trigger(CHANNEL_EVENTS2.error, reason);
|
|
7855
7895
|
}
|
|
7856
7896
|
});
|
|
7857
7897
|
}
|
|
@@ -8025,7 +8065,7 @@ var Socket = class {
|
|
|
8025
8065
|
}
|
|
8026
8066
|
};
|
|
8027
8067
|
|
|
8028
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
8068
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/phoenix/presenceAdapter.js
|
|
8029
8069
|
var PresenceAdapter = class _PresenceAdapter {
|
|
8030
8070
|
constructor(channel, opts) {
|
|
8031
8071
|
const phoenixOptions = phoenixPresenceOptions(opts);
|
|
@@ -8115,7 +8155,7 @@ function parseCurrentPresences(currentPresences) {
|
|
|
8115
8155
|
return (currentPresences === null || currentPresences === void 0 ? void 0 : currentPresences.metas) ? transformState(currentPresences) : [];
|
|
8116
8156
|
}
|
|
8117
8157
|
|
|
8118
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
8158
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/RealtimePresence.js
|
|
8119
8159
|
var REALTIME_PRESENCE_LISTEN_EVENTS;
|
|
8120
8160
|
(function(REALTIME_PRESENCE_LISTEN_EVENTS2) {
|
|
8121
8161
|
REALTIME_PRESENCE_LISTEN_EVENTS2["SYNC"] = "sync";
|
|
@@ -8149,7 +8189,26 @@ var RealtimePresence = class {
|
|
|
8149
8189
|
}
|
|
8150
8190
|
};
|
|
8151
8191
|
|
|
8152
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
8192
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/lib/normalizeChannelError.js
|
|
8193
|
+
function normalizeChannelError(reason) {
|
|
8194
|
+
if (reason instanceof Error) {
|
|
8195
|
+
return reason;
|
|
8196
|
+
}
|
|
8197
|
+
if (typeof reason === "string") {
|
|
8198
|
+
return new Error(reason);
|
|
8199
|
+
}
|
|
8200
|
+
if (reason && typeof reason === "object") {
|
|
8201
|
+
const obj = reason;
|
|
8202
|
+
if (typeof obj.code === "number") {
|
|
8203
|
+
const detail = typeof obj.reason === "string" && obj.reason ? ` (${obj.reason})` : "";
|
|
8204
|
+
return new Error(`socket closed: ${obj.code}${detail}`, { cause: reason });
|
|
8205
|
+
}
|
|
8206
|
+
return new Error("channel error: transport failure", { cause: reason });
|
|
8207
|
+
}
|
|
8208
|
+
return new Error("channel error: connection lost");
|
|
8209
|
+
}
|
|
8210
|
+
|
|
8211
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/phoenix/channelAdapter.js
|
|
8153
8212
|
var ChannelAdapter = class {
|
|
8154
8213
|
constructor(socket, topic, params) {
|
|
8155
8214
|
const phoenixParams = phoenixChannelParams(params);
|
|
@@ -8197,7 +8256,7 @@ var ChannelAdapter = class {
|
|
|
8197
8256
|
try {
|
|
8198
8257
|
push = this.channel.push(event, payload, timeout);
|
|
8199
8258
|
} catch (error) {
|
|
8200
|
-
throw `tried to push '${event}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events
|
|
8259
|
+
throw new Error(`tried to push '${event}' to '${this.channel.topic}' before joining. Use channel.subscribe() before pushing events`);
|
|
8201
8260
|
}
|
|
8202
8261
|
if (this.channel.pushBuffer.length > MAX_PUSH_BUFFER_SIZE) {
|
|
8203
8262
|
const removedPush = this.channel.pushBuffer.shift();
|
|
@@ -8248,7 +8307,7 @@ function phoenixChannelParams(options) {
|
|
|
8248
8307
|
};
|
|
8249
8308
|
}
|
|
8250
8309
|
|
|
8251
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
8310
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/RealtimeChannel.js
|
|
8252
8311
|
var REALTIME_POSTGRES_CHANGES_LISTEN_EVENT;
|
|
8253
8312
|
(function(REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2) {
|
|
8254
8313
|
REALTIME_POSTGRES_CHANGES_LISTEN_EVENT2["ALL"] = "*";
|
|
@@ -8298,12 +8357,23 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
8298
8357
|
*
|
|
8299
8358
|
* @category Realtime
|
|
8300
8359
|
*
|
|
8301
|
-
* @example
|
|
8360
|
+
* @example Using supabase-js (recommended)
|
|
8361
|
+
* ```ts
|
|
8362
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
8363
|
+
*
|
|
8364
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
8365
|
+
* const channel = supabase.channel('room1')
|
|
8366
|
+
* channel
|
|
8367
|
+
* .on('broadcast', { event: 'cursor-pos' }, (payload) => console.log(payload))
|
|
8368
|
+
* .subscribe()
|
|
8369
|
+
* ```
|
|
8370
|
+
*
|
|
8371
|
+
* @example Standalone import for bundle-sensitive environments
|
|
8302
8372
|
* ```ts
|
|
8303
8373
|
* import RealtimeClient from '@supabase/realtime-js'
|
|
8304
8374
|
*
|
|
8305
8375
|
* const client = new RealtimeClient('https://xyzcompany.supabase.co/realtime/v1', {
|
|
8306
|
-
* params: { apikey: '
|
|
8376
|
+
* params: { apikey: 'your-publishable-key' },
|
|
8307
8377
|
* })
|
|
8308
8378
|
* const channel = new RealtimeChannel('realtime:public:messages', { config: {} }, client)
|
|
8309
8379
|
* ```
|
|
@@ -8329,7 +8399,7 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
8329
8399
|
this.broadcastEndpointURL = httpEndpointURL(this.socket.socketAdapter.endPointURL());
|
|
8330
8400
|
this.private = this.params.config.private || false;
|
|
8331
8401
|
if (!this.private && ((_b = (_a = this.params.config) === null || _a === void 0 ? void 0 : _a.broadcast) === null || _b === void 0 ? void 0 : _b.replay)) {
|
|
8332
|
-
throw `tried to use replay on public channel '${this.topic}'. It must be a private channel
|
|
8402
|
+
throw new Error(`tried to use replay on public channel '${this.topic}'. It must be a private channel.`);
|
|
8333
8403
|
}
|
|
8334
8404
|
}
|
|
8335
8405
|
/**
|
|
@@ -8356,7 +8426,7 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
8356
8426
|
accessTokenPayload.access_token = this.socket.accessTokenValue;
|
|
8357
8427
|
}
|
|
8358
8428
|
this._onError((reason) => {
|
|
8359
|
-
callback === null || callback === void 0 ? void 0 : callback(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, reason);
|
|
8429
|
+
callback === null || callback === void 0 ? void 0 : callback(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, normalizeChannelError(reason));
|
|
8360
8430
|
});
|
|
8361
8431
|
this._onClose(() => callback === null || callback === void 0 ? void 0 : callback(REALTIME_SUBSCRIBE_STATES.CLOSED));
|
|
8362
8432
|
this.updateJoinPayload(Object.assign({ config }, accessTokenPayload));
|
|
@@ -8372,7 +8442,8 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
8372
8442
|
this._updatePostgresBindings(postgres_changes2, callback);
|
|
8373
8443
|
}).receive("error", (error) => {
|
|
8374
8444
|
this.state = CHANNEL_STATES.errored;
|
|
8375
|
-
|
|
8445
|
+
const message = Object.values(error).join(", ") || "error";
|
|
8446
|
+
callback === null || callback === void 0 ? void 0 : callback(REALTIME_SUBSCRIBE_STATES.CHANNEL_ERROR, new Error(message, { cause: error }));
|
|
8376
8447
|
}).receive("timeout", () => {
|
|
8377
8448
|
callback === null || callback === void 0 ? void 0 : callback(REALTIME_SUBSCRIBE_STATES.TIMED_OUT);
|
|
8378
8449
|
});
|
|
@@ -8621,7 +8692,7 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
8621
8692
|
async httpSend(event, payload, opts = {}) {
|
|
8622
8693
|
var _a;
|
|
8623
8694
|
if (payload === void 0 || payload === null) {
|
|
8624
|
-
return Promise.reject("Payload is required for httpSend()");
|
|
8695
|
+
return Promise.reject(new Error("Payload is required for httpSend()"));
|
|
8625
8696
|
}
|
|
8626
8697
|
const headers = {
|
|
8627
8698
|
apikey: this.socket.apiKey ? this.socket.apiKey : "",
|
|
@@ -8670,6 +8741,8 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
8670
8741
|
* @remarks
|
|
8671
8742
|
* - When using REST you don't need to subscribe to the channel
|
|
8672
8743
|
* - REST calls are only available from 2.37.0 onwards
|
|
8744
|
+
* - If you create a channel only to send a REST broadcast, remove it from
|
|
8745
|
+
* the client when the send completes
|
|
8673
8746
|
*
|
|
8674
8747
|
* @example Send a message via websocket
|
|
8675
8748
|
* ```js
|
|
@@ -8693,9 +8766,13 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
8693
8766
|
*
|
|
8694
8767
|
* @example Send a message via REST
|
|
8695
8768
|
* ```js
|
|
8696
|
-
* supabase
|
|
8697
|
-
*
|
|
8698
|
-
*
|
|
8769
|
+
* const channel = supabase.channel('room1')
|
|
8770
|
+
*
|
|
8771
|
+
* try {
|
|
8772
|
+
* await channel.httpSend('cursor-pos', { x: Math.random(), y: Math.random() })
|
|
8773
|
+
* } finally {
|
|
8774
|
+
* await supabase.removeChannel(channel)
|
|
8775
|
+
* }
|
|
8699
8776
|
* ```
|
|
8700
8777
|
*/
|
|
8701
8778
|
async send(args, opts = {}) {
|
|
@@ -8729,7 +8806,7 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
8729
8806
|
await ((_b = response.body) === null || _b === void 0 ? void 0 : _b.cancel());
|
|
8730
8807
|
return response.ok ? "ok" : "error";
|
|
8731
8808
|
} catch (error) {
|
|
8732
|
-
if (error.name === "AbortError") {
|
|
8809
|
+
if (error instanceof Error && error.name === "AbortError") {
|
|
8733
8810
|
return "timed out";
|
|
8734
8811
|
} else {
|
|
8735
8812
|
return "error";
|
|
@@ -8911,7 +8988,7 @@ var RealtimeChannel = class _RealtimeChannel {
|
|
|
8911
8988
|
}
|
|
8912
8989
|
};
|
|
8913
8990
|
|
|
8914
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
8991
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/phoenix/socketAdapter.js
|
|
8915
8992
|
var SocketAdapter = class {
|
|
8916
8993
|
constructor(endPoint, options) {
|
|
8917
8994
|
this.socket = new Socket(endPoint, options);
|
|
@@ -9020,7 +9097,7 @@ var SocketAdapter = class {
|
|
|
9020
9097
|
}
|
|
9021
9098
|
};
|
|
9022
9099
|
|
|
9023
|
-
// ../../node_modules/.pnpm/@supabase+realtime-js@2.
|
|
9100
|
+
// ../../node_modules/.pnpm/@supabase+realtime-js@2.106.1/node_modules/@supabase/realtime-js/dist/module/RealtimeClient.js
|
|
9024
9101
|
var CONNECTION_TIMEOUTS = {
|
|
9025
9102
|
HEARTBEAT_INTERVAL: 25e3,
|
|
9026
9103
|
RECONNECT_DELAY: 10,
|
|
@@ -9028,6 +9105,39 @@ var CONNECTION_TIMEOUTS = {
|
|
|
9028
9105
|
};
|
|
9029
9106
|
var RECONNECT_INTERVALS = [1e3, 2e3, 5e3, 1e4];
|
|
9030
9107
|
var DEFAULT_RECONNECT_FALLBACK = 1e4;
|
|
9108
|
+
function createMemorySessionStorage() {
|
|
9109
|
+
const store = /* @__PURE__ */ new Map();
|
|
9110
|
+
return {
|
|
9111
|
+
get length() {
|
|
9112
|
+
return store.size;
|
|
9113
|
+
},
|
|
9114
|
+
clear() {
|
|
9115
|
+
store.clear();
|
|
9116
|
+
},
|
|
9117
|
+
getItem(key) {
|
|
9118
|
+
return store.has(key) ? store.get(key) : null;
|
|
9119
|
+
},
|
|
9120
|
+
key(index) {
|
|
9121
|
+
var _a;
|
|
9122
|
+
return (_a = Array.from(store.keys())[index]) !== null && _a !== void 0 ? _a : null;
|
|
9123
|
+
},
|
|
9124
|
+
removeItem(key) {
|
|
9125
|
+
store.delete(key);
|
|
9126
|
+
},
|
|
9127
|
+
setItem(key, value) {
|
|
9128
|
+
store.set(key, String(value));
|
|
9129
|
+
}
|
|
9130
|
+
};
|
|
9131
|
+
}
|
|
9132
|
+
function resolveSessionStorage() {
|
|
9133
|
+
try {
|
|
9134
|
+
if (typeof globalThis !== "undefined" && globalThis.sessionStorage) {
|
|
9135
|
+
return globalThis.sessionStorage;
|
|
9136
|
+
}
|
|
9137
|
+
} catch (_a) {
|
|
9138
|
+
}
|
|
9139
|
+
return createMemorySessionStorage();
|
|
9140
|
+
}
|
|
9031
9141
|
var WORKER_SCRIPT = `
|
|
9032
9142
|
addEventListener("message", (e) => {
|
|
9033
9143
|
if (e.data.event === "start") {
|
|
@@ -9105,12 +9215,23 @@ var RealtimeClient = class {
|
|
|
9105
9215
|
*
|
|
9106
9216
|
* @category Realtime
|
|
9107
9217
|
*
|
|
9108
|
-
* @example
|
|
9218
|
+
* @example Using supabase-js (recommended)
|
|
9219
|
+
* ```ts
|
|
9220
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
9221
|
+
*
|
|
9222
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
9223
|
+
* const channel = supabase.channel('room1')
|
|
9224
|
+
* channel
|
|
9225
|
+
* .on('broadcast', { event: 'cursor-pos' }, (payload) => console.log(payload))
|
|
9226
|
+
* .subscribe()
|
|
9227
|
+
* ```
|
|
9228
|
+
*
|
|
9229
|
+
* @example Standalone import for bundle-sensitive environments
|
|
9109
9230
|
* ```ts
|
|
9110
9231
|
* import RealtimeClient from '@supabase/realtime-js'
|
|
9111
9232
|
*
|
|
9112
9233
|
* const client = new RealtimeClient('https://xyzcompany.supabase.co/realtime/v1', {
|
|
9113
|
-
* params: { apikey: '
|
|
9234
|
+
* params: { apikey: 'your-publishable-key' },
|
|
9114
9235
|
* })
|
|
9115
9236
|
* client.connect()
|
|
9116
9237
|
* ```
|
|
@@ -9130,6 +9251,8 @@ var RealtimeClient = class {
|
|
|
9130
9251
|
this._authPromise = null;
|
|
9131
9252
|
this._workerHeartbeatTimer = void 0;
|
|
9132
9253
|
this._pendingWorkerHeartbeatRef = null;
|
|
9254
|
+
this._pendingDisconnectTimer = null;
|
|
9255
|
+
this._disconnectOnEmptyChannelsAfterMs = 0;
|
|
9133
9256
|
this._resolveFetch = (customFetch) => {
|
|
9134
9257
|
if (customFetch) {
|
|
9135
9258
|
return (...args) => customFetch(...args);
|
|
@@ -9200,6 +9323,7 @@ Option 2: Install and provide the "ws" package:
|
|
|
9200
9323
|
* @category Realtime
|
|
9201
9324
|
*/
|
|
9202
9325
|
async disconnect(code, reason) {
|
|
9326
|
+
this._cancelPendingDisconnect();
|
|
9203
9327
|
if (this.isDisconnecting()) {
|
|
9204
9328
|
return "ok";
|
|
9205
9329
|
}
|
|
@@ -9227,9 +9351,6 @@ Option 2: Install and provide the "ws" package:
|
|
|
9227
9351
|
if (status === "ok") {
|
|
9228
9352
|
channel.teardown();
|
|
9229
9353
|
}
|
|
9230
|
-
if (this.channels.length === 0) {
|
|
9231
|
-
this.disconnect();
|
|
9232
|
-
}
|
|
9233
9354
|
return status;
|
|
9234
9355
|
}
|
|
9235
9356
|
/**
|
|
@@ -9244,7 +9365,7 @@ Option 2: Install and provide the "ws" package:
|
|
|
9244
9365
|
return result2;
|
|
9245
9366
|
});
|
|
9246
9367
|
const result = await Promise.all(promises);
|
|
9247
|
-
this.disconnect();
|
|
9368
|
+
await this.disconnect();
|
|
9248
9369
|
return result;
|
|
9249
9370
|
}
|
|
9250
9371
|
/**
|
|
@@ -9303,6 +9424,7 @@ Option 2: Install and provide the "ws" package:
|
|
|
9303
9424
|
const exists = this.getChannels().find((c) => c.topic === realtimeTopic);
|
|
9304
9425
|
if (!exists) {
|
|
9305
9426
|
const chan = new RealtimeChannel(`realtime:${topic}`, params, this);
|
|
9427
|
+
this._cancelPendingDisconnect();
|
|
9306
9428
|
this.channels.push(chan);
|
|
9307
9429
|
return chan;
|
|
9308
9430
|
} else {
|
|
@@ -9391,6 +9513,35 @@ Option 2: Install and provide the "ws" package:
|
|
|
9391
9513
|
*/
|
|
9392
9514
|
_remove(channel) {
|
|
9393
9515
|
this.channels = this.channels.filter((c) => c.topic !== channel.topic);
|
|
9516
|
+
if (this.channels.length === 0) {
|
|
9517
|
+
this.log("transport", "no channels remaining, scheduling disconnect");
|
|
9518
|
+
this._schedulePendingDisconnect();
|
|
9519
|
+
}
|
|
9520
|
+
}
|
|
9521
|
+
/** @internal */
|
|
9522
|
+
_schedulePendingDisconnect() {
|
|
9523
|
+
this._cancelPendingDisconnect();
|
|
9524
|
+
if (this._disconnectOnEmptyChannelsAfterMs === 0) {
|
|
9525
|
+
this.log("transport", "disconnecting immediately - no channels");
|
|
9526
|
+
this.disconnect();
|
|
9527
|
+
return;
|
|
9528
|
+
}
|
|
9529
|
+
this._pendingDisconnectTimer = setTimeout(() => {
|
|
9530
|
+
this._pendingDisconnectTimer = null;
|
|
9531
|
+
if (this.channels.length === 0) {
|
|
9532
|
+
this.log("transport", "deferred disconnect fired - no channels, disconnecting");
|
|
9533
|
+
this.disconnect();
|
|
9534
|
+
}
|
|
9535
|
+
}, this._disconnectOnEmptyChannelsAfterMs);
|
|
9536
|
+
this.log("transport", `deferred disconnect scheduled in ${this._disconnectOnEmptyChannelsAfterMs}ms`);
|
|
9537
|
+
}
|
|
9538
|
+
/** @internal */
|
|
9539
|
+
_cancelPendingDisconnect() {
|
|
9540
|
+
if (this._pendingDisconnectTimer !== null) {
|
|
9541
|
+
this.log("transport", "pending disconnect cancelled - channel activity detected");
|
|
9542
|
+
clearTimeout(this._pendingDisconnectTimer);
|
|
9543
|
+
this._pendingDisconnectTimer = null;
|
|
9544
|
+
}
|
|
9394
9545
|
}
|
|
9395
9546
|
/**
|
|
9396
9547
|
* Perform the actual auth operation
|
|
@@ -9541,22 +9692,24 @@ Option 2: Install and provide the "ws" package:
|
|
|
9541
9692
|
* @internal
|
|
9542
9693
|
*/
|
|
9543
9694
|
_initializeOptions(options) {
|
|
9544
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
9695
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
9545
9696
|
this.worker = (_a = options === null || options === void 0 ? void 0 : options.worker) !== null && _a !== void 0 ? _a : false;
|
|
9546
9697
|
this.accessToken = (_b = options === null || options === void 0 ? void 0 : options.accessToken) !== null && _b !== void 0 ? _b : null;
|
|
9547
9698
|
const result = {};
|
|
9548
9699
|
result.timeout = (_c = options === null || options === void 0 ? void 0 : options.timeout) !== null && _c !== void 0 ? _c : DEFAULT_TIMEOUT;
|
|
9549
9700
|
result.heartbeatIntervalMs = (_d = options === null || options === void 0 ? void 0 : options.heartbeatIntervalMs) !== null && _d !== void 0 ? _d : CONNECTION_TIMEOUTS.HEARTBEAT_INTERVAL;
|
|
9550
|
-
|
|
9701
|
+
this._disconnectOnEmptyChannelsAfterMs = (_e = options === null || options === void 0 ? void 0 : options.disconnectOnEmptyChannelsAfterMs) !== null && _e !== void 0 ? _e : 2 * ((_f = options === null || options === void 0 ? void 0 : options.heartbeatIntervalMs) !== null && _f !== void 0 ? _f : CONNECTION_TIMEOUTS.HEARTBEAT_INTERVAL);
|
|
9702
|
+
result.transport = (_g = options === null || options === void 0 ? void 0 : options.transport) !== null && _g !== void 0 ? _g : websocket_factory_default.getWebSocketConstructor();
|
|
9551
9703
|
result.params = options === null || options === void 0 ? void 0 : options.params;
|
|
9552
9704
|
result.logger = options === null || options === void 0 ? void 0 : options.logger;
|
|
9553
9705
|
result.heartbeatCallback = this._wrapHeartbeatCallback(options === null || options === void 0 ? void 0 : options.heartbeatCallback);
|
|
9554
|
-
result.
|
|
9706
|
+
result.sessionStorage = (_h = options === null || options === void 0 ? void 0 : options.sessionStorage) !== null && _h !== void 0 ? _h : resolveSessionStorage();
|
|
9707
|
+
result.reconnectAfterMs = (_j = options === null || options === void 0 ? void 0 : options.reconnectAfterMs) !== null && _j !== void 0 ? _j : ((tries) => {
|
|
9555
9708
|
return RECONNECT_INTERVALS[tries - 1] || DEFAULT_RECONNECT_FALLBACK;
|
|
9556
9709
|
});
|
|
9557
9710
|
let defaultEncode;
|
|
9558
9711
|
let defaultDecode;
|
|
9559
|
-
const vsn = (
|
|
9712
|
+
const vsn = (_k = options === null || options === void 0 ? void 0 : options.vsn) !== null && _k !== void 0 ? _k : DEFAULT_VSN;
|
|
9560
9713
|
switch (vsn) {
|
|
9561
9714
|
case VSN_1_0_0:
|
|
9562
9715
|
defaultEncode = (payload, callback) => {
|
|
@@ -9574,8 +9727,8 @@ Option 2: Install and provide the "ws" package:
|
|
|
9574
9727
|
throw new Error(`Unsupported serializer version: ${result.vsn}`);
|
|
9575
9728
|
}
|
|
9576
9729
|
result.vsn = vsn;
|
|
9577
|
-
result.encode = (
|
|
9578
|
-
result.decode = (
|
|
9730
|
+
result.encode = (_l = options === null || options === void 0 ? void 0 : options.encode) !== null && _l !== void 0 ? _l : defaultEncode;
|
|
9731
|
+
result.decode = (_m = options === null || options === void 0 ? void 0 : options.decode) !== null && _m !== void 0 ? _m : defaultDecode;
|
|
9579
9732
|
result.beforeReconnect = this._reconnectAuth.bind(this);
|
|
9580
9733
|
if ((options === null || options === void 0 ? void 0 : options.logLevel) || (options === null || options === void 0 ? void 0 : options.log_level)) {
|
|
9581
9734
|
this.logLevel = options.logLevel || options.log_level;
|
|
@@ -10132,7 +10285,58 @@ var IcebergRestCatalog = class {
|
|
|
10132
10285
|
}
|
|
10133
10286
|
};
|
|
10134
10287
|
|
|
10135
|
-
// ../../node_modules/.pnpm/@supabase+storage-js@2.
|
|
10288
|
+
// ../../node_modules/.pnpm/@supabase+storage-js@2.106.1/node_modules/@supabase/storage-js/dist/index.mjs
|
|
10289
|
+
function _typeof2(o) {
|
|
10290
|
+
"@babel/helpers - typeof";
|
|
10291
|
+
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
10292
|
+
return typeof o$1;
|
|
10293
|
+
} : function(o$1) {
|
|
10294
|
+
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
10295
|
+
}, _typeof2(o);
|
|
10296
|
+
}
|
|
10297
|
+
function toPrimitive2(t, r) {
|
|
10298
|
+
if ("object" != _typeof2(t) || !t) return t;
|
|
10299
|
+
var e = t[Symbol.toPrimitive];
|
|
10300
|
+
if (void 0 !== e) {
|
|
10301
|
+
var i = e.call(t, r || "default");
|
|
10302
|
+
if ("object" != _typeof2(i)) return i;
|
|
10303
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10304
|
+
}
|
|
10305
|
+
return ("string" === r ? String : Number)(t);
|
|
10306
|
+
}
|
|
10307
|
+
function toPropertyKey2(t) {
|
|
10308
|
+
var i = toPrimitive2(t, "string");
|
|
10309
|
+
return "symbol" == _typeof2(i) ? i : i + "";
|
|
10310
|
+
}
|
|
10311
|
+
function _defineProperty2(e, r, t) {
|
|
10312
|
+
return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
|
|
10313
|
+
value: t,
|
|
10314
|
+
enumerable: true,
|
|
10315
|
+
configurable: true,
|
|
10316
|
+
writable: true
|
|
10317
|
+
}) : e[r] = t, e;
|
|
10318
|
+
}
|
|
10319
|
+
function ownKeys2(e, r) {
|
|
10320
|
+
var t = Object.keys(e);
|
|
10321
|
+
if (Object.getOwnPropertySymbols) {
|
|
10322
|
+
var o = Object.getOwnPropertySymbols(e);
|
|
10323
|
+
r && (o = o.filter(function(r$1) {
|
|
10324
|
+
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
10325
|
+
})), t.push.apply(t, o);
|
|
10326
|
+
}
|
|
10327
|
+
return t;
|
|
10328
|
+
}
|
|
10329
|
+
function _objectSpread22(e) {
|
|
10330
|
+
for (var r = 1; r < arguments.length; r++) {
|
|
10331
|
+
var t = null != arguments[r] ? arguments[r] : {};
|
|
10332
|
+
r % 2 ? ownKeys2(Object(t), true).forEach(function(r$1) {
|
|
10333
|
+
_defineProperty2(e, r$1, t[r$1]);
|
|
10334
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r$1) {
|
|
10335
|
+
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
10336
|
+
});
|
|
10337
|
+
}
|
|
10338
|
+
return e;
|
|
10339
|
+
}
|
|
10136
10340
|
var StorageError = class extends Error {
|
|
10137
10341
|
constructor(message, namespace = "storage", status, statusCode) {
|
|
10138
10342
|
super(message);
|
|
@@ -10142,6 +10346,14 @@ var StorageError = class extends Error {
|
|
|
10142
10346
|
this.status = status;
|
|
10143
10347
|
this.statusCode = statusCode;
|
|
10144
10348
|
}
|
|
10349
|
+
toJSON() {
|
|
10350
|
+
return {
|
|
10351
|
+
name: this.name,
|
|
10352
|
+
message: this.message,
|
|
10353
|
+
status: this.status,
|
|
10354
|
+
statusCode: this.statusCode
|
|
10355
|
+
};
|
|
10356
|
+
}
|
|
10145
10357
|
};
|
|
10146
10358
|
function isStorageError(error) {
|
|
10147
10359
|
return typeof error === "object" && error !== null && "__isStorageError" in error;
|
|
@@ -10154,12 +10366,7 @@ var StorageApiError = class extends StorageError {
|
|
|
10154
10366
|
this.statusCode = statusCode;
|
|
10155
10367
|
}
|
|
10156
10368
|
toJSON() {
|
|
10157
|
-
return {
|
|
10158
|
-
name: this.name,
|
|
10159
|
-
message: this.message,
|
|
10160
|
-
status: this.status,
|
|
10161
|
-
statusCode: this.statusCode
|
|
10162
|
-
};
|
|
10369
|
+
return _objectSpread22({}, super.toJSON());
|
|
10163
10370
|
}
|
|
10164
10371
|
};
|
|
10165
10372
|
var StorageUnknownError = class extends StorageError {
|
|
@@ -10169,6 +10376,18 @@ var StorageUnknownError = class extends StorageError {
|
|
|
10169
10376
|
this.originalError = originalError;
|
|
10170
10377
|
}
|
|
10171
10378
|
};
|
|
10379
|
+
function setHeader(headers, name, value) {
|
|
10380
|
+
const result = _objectSpread22({}, headers);
|
|
10381
|
+
const nameLower = name.toLowerCase();
|
|
10382
|
+
for (const key of Object.keys(result)) if (key.toLowerCase() === nameLower) delete result[key];
|
|
10383
|
+
result[nameLower] = value;
|
|
10384
|
+
return result;
|
|
10385
|
+
}
|
|
10386
|
+
function normalizeHeaders(headers) {
|
|
10387
|
+
const result = {};
|
|
10388
|
+
for (const [key, value] of Object.entries(headers)) result[key.toLowerCase()] = value;
|
|
10389
|
+
return result;
|
|
10390
|
+
}
|
|
10172
10391
|
var resolveFetch2 = (customFetch) => {
|
|
10173
10392
|
if (customFetch) return (...args) => customFetch(...args);
|
|
10174
10393
|
return (...args) => fetch(...args);
|
|
@@ -10195,65 +10414,24 @@ var isValidBucketName = (bucketName) => {
|
|
|
10195
10414
|
if (bucketName.includes("/") || bucketName.includes("\\")) return false;
|
|
10196
10415
|
return /^[\w!.\*'() &$@=;:+,?-]+$/.test(bucketName);
|
|
10197
10416
|
};
|
|
10198
|
-
function _typeof2(o) {
|
|
10199
|
-
"@babel/helpers - typeof";
|
|
10200
|
-
return _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
10201
|
-
return typeof o$1;
|
|
10202
|
-
} : function(o$1) {
|
|
10203
|
-
return o$1 && "function" == typeof Symbol && o$1.constructor === Symbol && o$1 !== Symbol.prototype ? "symbol" : typeof o$1;
|
|
10204
|
-
}, _typeof2(o);
|
|
10205
|
-
}
|
|
10206
|
-
function toPrimitive2(t, r) {
|
|
10207
|
-
if ("object" != _typeof2(t) || !t) return t;
|
|
10208
|
-
var e = t[Symbol.toPrimitive];
|
|
10209
|
-
if (void 0 !== e) {
|
|
10210
|
-
var i = e.call(t, r || "default");
|
|
10211
|
-
if ("object" != _typeof2(i)) return i;
|
|
10212
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
10213
|
-
}
|
|
10214
|
-
return ("string" === r ? String : Number)(t);
|
|
10215
|
-
}
|
|
10216
|
-
function toPropertyKey2(t) {
|
|
10217
|
-
var i = toPrimitive2(t, "string");
|
|
10218
|
-
return "symbol" == _typeof2(i) ? i : i + "";
|
|
10219
|
-
}
|
|
10220
|
-
function _defineProperty2(e, r, t) {
|
|
10221
|
-
return (r = toPropertyKey2(r)) in e ? Object.defineProperty(e, r, {
|
|
10222
|
-
value: t,
|
|
10223
|
-
enumerable: true,
|
|
10224
|
-
configurable: true,
|
|
10225
|
-
writable: true
|
|
10226
|
-
}) : e[r] = t, e;
|
|
10227
|
-
}
|
|
10228
|
-
function ownKeys2(e, r) {
|
|
10229
|
-
var t = Object.keys(e);
|
|
10230
|
-
if (Object.getOwnPropertySymbols) {
|
|
10231
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
10232
|
-
r && (o = o.filter(function(r$1) {
|
|
10233
|
-
return Object.getOwnPropertyDescriptor(e, r$1).enumerable;
|
|
10234
|
-
})), t.push.apply(t, o);
|
|
10235
|
-
}
|
|
10236
|
-
return t;
|
|
10237
|
-
}
|
|
10238
|
-
function _objectSpread22(e) {
|
|
10239
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
10240
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
10241
|
-
r % 2 ? ownKeys2(Object(t), true).forEach(function(r$1) {
|
|
10242
|
-
_defineProperty2(e, r$1, t[r$1]);
|
|
10243
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys2(Object(t)).forEach(function(r$1) {
|
|
10244
|
-
Object.defineProperty(e, r$1, Object.getOwnPropertyDescriptor(t, r$1));
|
|
10245
|
-
});
|
|
10246
|
-
}
|
|
10247
|
-
return e;
|
|
10248
|
-
}
|
|
10249
10417
|
var _getErrorMessage = (err) => {
|
|
10250
|
-
|
|
10251
|
-
|
|
10418
|
+
if (typeof err === "object" && err !== null) {
|
|
10419
|
+
const e = err;
|
|
10420
|
+
if (typeof e.msg === "string") return e.msg;
|
|
10421
|
+
if (typeof e.message === "string") return e.message;
|
|
10422
|
+
if (typeof e.error_description === "string") return e.error_description;
|
|
10423
|
+
if (typeof e.error === "string") return e.error;
|
|
10424
|
+
if (typeof e.error === "object" && e.error !== null) {
|
|
10425
|
+
const nested = e.error;
|
|
10426
|
+
if (typeof nested.message === "string") return nested.message;
|
|
10427
|
+
}
|
|
10428
|
+
}
|
|
10429
|
+
return JSON.stringify(err);
|
|
10252
10430
|
};
|
|
10253
10431
|
var handleError = async (error, reject, options, namespace) => {
|
|
10254
|
-
if (error !== null && typeof error === "object" && typeof error.json === "function") {
|
|
10432
|
+
if (error !== null && typeof error === "object" && "json" in error && typeof error.json === "function") {
|
|
10255
10433
|
const responseError = error;
|
|
10256
|
-
let status = parseInt(responseError.status, 10);
|
|
10434
|
+
let status = parseInt(String(responseError.status), 10);
|
|
10257
10435
|
if (!Number.isFinite(status)) status = 500;
|
|
10258
10436
|
responseError.json().then((err) => {
|
|
10259
10437
|
const statusCode = (err === null || err === void 0 ? void 0 : err.statusCode) || (err === null || err === void 0 ? void 0 : err.code) || status + "";
|
|
@@ -10275,18 +10453,12 @@ var _getRequestParams = (method, options, parameters, body) => {
|
|
|
10275
10453
|
const headers = (options === null || options === void 0 ? void 0 : options.headers) || {};
|
|
10276
10454
|
let contentType;
|
|
10277
10455
|
for (const [key, value] of Object.entries(headers)) if (key.toLowerCase() === "content-type") contentType = value;
|
|
10278
|
-
params.headers =
|
|
10456
|
+
params.headers = setHeader(headers, "Content-Type", (_contentType = contentType) !== null && _contentType !== void 0 ? _contentType : "application/json");
|
|
10279
10457
|
params.body = JSON.stringify(body);
|
|
10280
10458
|
} else params.body = body;
|
|
10281
10459
|
if (options === null || options === void 0 ? void 0 : options.duplex) params.duplex = options.duplex;
|
|
10282
10460
|
return _objectSpread22(_objectSpread22({}, params), parameters);
|
|
10283
10461
|
};
|
|
10284
|
-
function setRequestHeader(headers, name, value) {
|
|
10285
|
-
const nextHeaders = _objectSpread22({}, headers);
|
|
10286
|
-
for (const key of Object.keys(nextHeaders)) if (key.toLowerCase() === name.toLowerCase()) delete nextHeaders[key];
|
|
10287
|
-
nextHeaders[name] = value;
|
|
10288
|
-
return nextHeaders;
|
|
10289
|
-
}
|
|
10290
10462
|
async function _handleRequest(fetcher, method, url, options, parameters, body, namespace) {
|
|
10291
10463
|
return new Promise((resolve, reject) => {
|
|
10292
10464
|
fetcher(url, _getRequestParams(method, options, parameters, body)).then((result) => {
|
|
@@ -10334,7 +10506,7 @@ var BaseApiClient = class {
|
|
|
10334
10506
|
constructor(url, headers = {}, fetch$1, namespace = "storage") {
|
|
10335
10507
|
this.shouldThrowOnError = false;
|
|
10336
10508
|
this.url = url;
|
|
10337
|
-
this.headers =
|
|
10509
|
+
this.headers = normalizeHeaders(headers);
|
|
10338
10510
|
this.fetch = resolveFetch2(fetch$1);
|
|
10339
10511
|
this.namespace = namespace;
|
|
10340
10512
|
}
|
|
@@ -10357,7 +10529,7 @@ var BaseApiClient = class {
|
|
|
10357
10529
|
* @returns this - For method chaining
|
|
10358
10530
|
*/
|
|
10359
10531
|
setHeader(name, value) {
|
|
10360
|
-
this.headers =
|
|
10532
|
+
this.headers = setHeader(this.headers, name, value);
|
|
10361
10533
|
return this;
|
|
10362
10534
|
}
|
|
10363
10535
|
/**
|
|
@@ -10402,13 +10574,27 @@ var BaseApiClient = class {
|
|
|
10402
10574
|
}
|
|
10403
10575
|
}
|
|
10404
10576
|
};
|
|
10577
|
+
var _Symbol$toStringTag$1;
|
|
10578
|
+
_Symbol$toStringTag$1 = Symbol.toStringTag;
|
|
10405
10579
|
var StreamDownloadBuilder = class {
|
|
10406
10580
|
constructor(downloadFn, shouldThrowOnError) {
|
|
10407
10581
|
this.downloadFn = downloadFn;
|
|
10408
10582
|
this.shouldThrowOnError = shouldThrowOnError;
|
|
10583
|
+
this[_Symbol$toStringTag$1] = "StreamDownloadBuilder";
|
|
10584
|
+
this.promise = null;
|
|
10409
10585
|
}
|
|
10410
10586
|
then(onfulfilled, onrejected) {
|
|
10411
|
-
return this.
|
|
10587
|
+
return this.getPromise().then(onfulfilled, onrejected);
|
|
10588
|
+
}
|
|
10589
|
+
catch(onrejected) {
|
|
10590
|
+
return this.getPromise().catch(onrejected);
|
|
10591
|
+
}
|
|
10592
|
+
finally(onfinally) {
|
|
10593
|
+
return this.getPromise().finally(onfinally);
|
|
10594
|
+
}
|
|
10595
|
+
getPromise() {
|
|
10596
|
+
if (!this.promise) this.promise = this.execute();
|
|
10597
|
+
return this.promise;
|
|
10412
10598
|
}
|
|
10413
10599
|
async execute() {
|
|
10414
10600
|
var _this = this;
|
|
@@ -10517,7 +10703,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10517
10703
|
if (metadata) headers["x-metadata"] = _this.toBase64(_this.encodeMetadata(metadata));
|
|
10518
10704
|
if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
|
|
10519
10705
|
}
|
|
10520
|
-
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) headers =
|
|
10706
|
+
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value);
|
|
10521
10707
|
const cleanPath = _this._removeEmptyFolders(path);
|
|
10522
10708
|
const _path = _this._getFinalPath(cleanPath);
|
|
10523
10709
|
const data = await (method == "PUT" ? put : post)(_this.fetch, `${_this.url}/object/${_path}`, body, _objectSpread22({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}));
|
|
@@ -10531,7 +10717,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10531
10717
|
/**
|
|
10532
10718
|
* Uploads a file to an existing bucket.
|
|
10533
10719
|
*
|
|
10534
|
-
* @category
|
|
10720
|
+
* @category Storage
|
|
10721
|
+
* @subcategory File Buckets
|
|
10535
10722
|
* @param path The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
|
|
10536
10723
|
* @param fileBody The body of the file to be stored in the bucket.
|
|
10537
10724
|
* @param fileOptions Optional file upload options including cacheControl, contentType, upsert, and metadata.
|
|
@@ -10585,7 +10772,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10585
10772
|
/**
|
|
10586
10773
|
* Upload a file with a token generated from `createSignedUploadUrl`.
|
|
10587
10774
|
*
|
|
10588
|
-
* @category
|
|
10775
|
+
* @category Storage
|
|
10776
|
+
* @subcategory File Buckets
|
|
10589
10777
|
* @param path The file path, including the file name. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to upload.
|
|
10590
10778
|
* @param token The token generated from `createSignedUploadUrl`
|
|
10591
10779
|
* @param fileBody The body of the file to be stored in the bucket.
|
|
@@ -10628,22 +10816,28 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10628
10816
|
return _this3.handleOperation(async () => {
|
|
10629
10817
|
let body;
|
|
10630
10818
|
const options = _objectSpread22(_objectSpread22({}, DEFAULT_FILE_OPTIONS), fileOptions);
|
|
10631
|
-
|
|
10819
|
+
let headers = _objectSpread22(_objectSpread22({}, _this3.headers), { "x-upsert": String(options.upsert) });
|
|
10820
|
+
const metadata = options.metadata;
|
|
10632
10821
|
if (typeof Blob !== "undefined" && fileBody instanceof Blob) {
|
|
10633
10822
|
body = new FormData();
|
|
10634
10823
|
body.append("cacheControl", options.cacheControl);
|
|
10824
|
+
if (metadata) body.append("metadata", _this3.encodeMetadata(metadata));
|
|
10635
10825
|
body.append("", fileBody);
|
|
10636
10826
|
} else if (typeof FormData !== "undefined" && fileBody instanceof FormData) {
|
|
10637
10827
|
body = fileBody;
|
|
10638
|
-
body.append("cacheControl", options.cacheControl);
|
|
10828
|
+
if (!body.has("cacheControl")) body.append("cacheControl", options.cacheControl);
|
|
10829
|
+
if (metadata && !body.has("metadata")) body.append("metadata", _this3.encodeMetadata(metadata));
|
|
10639
10830
|
} else {
|
|
10640
10831
|
body = fileBody;
|
|
10641
10832
|
headers["cache-control"] = `max-age=${options.cacheControl}`;
|
|
10642
10833
|
headers["content-type"] = options.contentType;
|
|
10834
|
+
if (metadata) headers["x-metadata"] = _this3.toBase64(_this3.encodeMetadata(metadata));
|
|
10835
|
+
if ((typeof ReadableStream !== "undefined" && body instanceof ReadableStream || body && typeof body === "object" && "pipe" in body && typeof body.pipe === "function") && !options.duplex) options.duplex = "half";
|
|
10643
10836
|
}
|
|
10837
|
+
if (fileOptions === null || fileOptions === void 0 ? void 0 : fileOptions.headers) for (const [key, value] of Object.entries(fileOptions.headers)) headers = setHeader(headers, key, value);
|
|
10644
10838
|
return {
|
|
10645
10839
|
path: cleanPath,
|
|
10646
|
-
fullPath: (await put(_this3.fetch, url.toString(), body, { headers })).Key
|
|
10840
|
+
fullPath: (await put(_this3.fetch, url.toString(), body, _objectSpread22({ headers }, (options === null || options === void 0 ? void 0 : options.duplex) ? { duplex: options.duplex } : {}))).Key
|
|
10647
10841
|
};
|
|
10648
10842
|
});
|
|
10649
10843
|
}
|
|
@@ -10652,7 +10846,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10652
10846
|
* Signed upload URLs can be used to upload files to the bucket without further authentication.
|
|
10653
10847
|
* They are valid for 2 hours.
|
|
10654
10848
|
*
|
|
10655
|
-
* @category
|
|
10849
|
+
* @category Storage
|
|
10850
|
+
* @subcategory File Buckets
|
|
10656
10851
|
* @param path The file path, including the current file name. For example `folder/image.png`.
|
|
10657
10852
|
* @param options.upsert If set to true, allows the file to be overwritten if it already exists.
|
|
10658
10853
|
* @returns Promise with response containing signed upload URL, token, and path or error
|
|
@@ -10703,10 +10898,14 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10703
10898
|
/**
|
|
10704
10899
|
* Replaces an existing file at the specified path with a new one.
|
|
10705
10900
|
*
|
|
10706
|
-
* @category
|
|
10901
|
+
* @category Storage
|
|
10902
|
+
* @subcategory File Buckets
|
|
10707
10903
|
* @param path The relative file path. Should be of the format `folder/subfolder/filename.png`. The bucket must already exist before attempting to update.
|
|
10708
10904
|
* @param fileBody The body of the file to be stored in the bucket.
|
|
10709
|
-
* @param fileOptions Optional file upload options including cacheControl, contentType,
|
|
10905
|
+
* @param fileOptions Optional file upload options including cacheControl, contentType, and metadata.
|
|
10906
|
+
* **Note:** The `upsert` option has no effect here. `update()` always replaces the
|
|
10907
|
+
* file at the given path, so the `x-upsert` header is not sent. To control upsert
|
|
10908
|
+
* behavior, use `upload()` instead.
|
|
10710
10909
|
* @returns Promise with response containing file path, id, and fullPath or error
|
|
10711
10910
|
*
|
|
10712
10911
|
* @example Update file
|
|
@@ -10716,8 +10915,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10716
10915
|
* .storage
|
|
10717
10916
|
* .from('avatars')
|
|
10718
10917
|
* .update('public/avatar1.png', avatarFile, {
|
|
10719
|
-
* cacheControl: '3600'
|
|
10720
|
-
* upsert: true
|
|
10918
|
+
* cacheControl: '3600'
|
|
10721
10919
|
* })
|
|
10722
10920
|
* ```
|
|
10723
10921
|
*
|
|
@@ -10748,6 +10946,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10748
10946
|
* - RLS policy permissions required:
|
|
10749
10947
|
* - `buckets` table permissions: none
|
|
10750
10948
|
* - `objects` table permissions: `update` and `select`
|
|
10949
|
+
* - `update()` always replaces the file at the given path regardless of the `upsert` option.
|
|
10751
10950
|
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
10752
10951
|
* - For React Native, using either `Blob`, `File` or `FormData` does not work as intended. Update file using `ArrayBuffer` from base64 file data instead, see example below.
|
|
10753
10952
|
*/
|
|
@@ -10757,7 +10956,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10757
10956
|
/**
|
|
10758
10957
|
* Moves an existing file to a new path in the same bucket.
|
|
10759
10958
|
*
|
|
10760
|
-
* @category
|
|
10959
|
+
* @category Storage
|
|
10960
|
+
* @subcategory File Buckets
|
|
10761
10961
|
* @param fromPath The original file path, including the current file name. For example `folder/image.png`.
|
|
10762
10962
|
* @param toPath The new file path, including the new file name. For example `folder/image-new.png`.
|
|
10763
10963
|
* @param options The destination options.
|
|
@@ -10801,7 +11001,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10801
11001
|
/**
|
|
10802
11002
|
* Copies an existing file to a new path in the same bucket.
|
|
10803
11003
|
*
|
|
10804
|
-
* @category
|
|
11004
|
+
* @category Storage
|
|
11005
|
+
* @subcategory File Buckets
|
|
10805
11006
|
* @param fromPath The original file path, including the current file name. For example `folder/image.png`.
|
|
10806
11007
|
* @param toPath The new file path, including the new file name. For example `folder/image-copy.png`.
|
|
10807
11008
|
* @param options The destination options.
|
|
@@ -10845,7 +11046,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10845
11046
|
/**
|
|
10846
11047
|
* Creates a signed URL. Use a signed URL to share a file for a fixed amount of time.
|
|
10847
11048
|
*
|
|
10848
|
-
* @category
|
|
11049
|
+
* @category Storage
|
|
11050
|
+
* @subcategory File Buckets
|
|
10849
11051
|
* @param path The file path, including the current file name. For example `folder/image.png`.
|
|
10850
11052
|
* @param expiresIn The number of seconds until the signed URL expires. For example, `60` for a URL which is valid for one minute.
|
|
10851
11053
|
* @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
|
|
@@ -10910,14 +11112,14 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10910
11112
|
if (options === null || options === void 0 ? void 0 : options.download) query.set("download", options.download === true ? "" : options.download);
|
|
10911
11113
|
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
10912
11114
|
const queryString = query.toString();
|
|
10913
|
-
|
|
10914
|
-
return { signedUrl: encodeURI(`${_this8.url}${returnedPath}${queryString ? `&${queryString}` : ""}`) };
|
|
11115
|
+
return { signedUrl: encodeURI(`${_this8.url}${data.signedURL}${queryString ? `&${queryString}` : ""}`) };
|
|
10915
11116
|
});
|
|
10916
11117
|
}
|
|
10917
11118
|
/**
|
|
10918
11119
|
* Creates multiple signed URLs. Use a signed URL to share a file for a fixed amount of time.
|
|
10919
11120
|
*
|
|
10920
|
-
* @category
|
|
11121
|
+
* @category Storage
|
|
11122
|
+
* @subcategory File Buckets
|
|
10921
11123
|
* @param paths The file paths to be downloaded, including the current file names. For example `['folder/image.png', 'folder2/image2.png']`.
|
|
10922
11124
|
* @param expiresIn The number of seconds until the signed URLs expire. For example, `60` for URLs which are valid for one minute.
|
|
10923
11125
|
* @param options.download triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
|
|
@@ -10976,7 +11178,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
10976
11178
|
/**
|
|
10977
11179
|
* Downloads a file from a private bucket. For public buckets, make a request to the URL returned from `getPublicUrl` instead.
|
|
10978
11180
|
*
|
|
10979
|
-
* @category
|
|
11181
|
+
* @category Storage
|
|
11182
|
+
* @subcategory File Buckets
|
|
10980
11183
|
* @param path The full path and file name of the file to be downloaded. For example `folder/image.png`.
|
|
10981
11184
|
* @param options.transform Transform the asset before serving it to the client.
|
|
10982
11185
|
* @param options.cacheNonce Append a cache nonce parameter to the URL to invalidate the cache.
|
|
@@ -11039,7 +11242,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
11039
11242
|
* - Refer to the [Storage guide](/docs/guides/storage/security/access-control) on how access control works
|
|
11040
11243
|
*/
|
|
11041
11244
|
download(path, options, parameters) {
|
|
11042
|
-
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform)
|
|
11245
|
+
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0 ? "render/image/authenticated" : "object";
|
|
11043
11246
|
const query = new URLSearchParams();
|
|
11044
11247
|
if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
|
|
11045
11248
|
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
@@ -11057,7 +11260,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
11057
11260
|
* Returns detailed file metadata including size, content type, and timestamps.
|
|
11058
11261
|
* Note: The API returns `last_modified` field, not `updated_at`.
|
|
11059
11262
|
*
|
|
11060
|
-
* @category
|
|
11263
|
+
* @category Storage
|
|
11264
|
+
* @subcategory File Buckets
|
|
11061
11265
|
* @param path The file path, including the file name. For example `folder/image.png`.
|
|
11062
11266
|
* @returns Promise with response containing file metadata or error
|
|
11063
11267
|
*
|
|
@@ -11084,7 +11288,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
11084
11288
|
/**
|
|
11085
11289
|
* Checks the existence of a file.
|
|
11086
11290
|
*
|
|
11087
|
-
* @category
|
|
11291
|
+
* @category Storage
|
|
11292
|
+
* @subcategory File Buckets
|
|
11088
11293
|
* @param path The file path, including the file name. For example `folder/image.png`.
|
|
11089
11294
|
* @returns Promise with response containing boolean indicating file existence or error
|
|
11090
11295
|
*
|
|
@@ -11122,7 +11327,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
11122
11327
|
* A simple convenience function to get the URL for an asset in a public bucket. If you do not want to use this function, you can construct the public URL by concatenating the bucket URL with the path to the asset.
|
|
11123
11328
|
* This function does not verify if the bucket is public. If a public URL is created for a bucket which is not public, you will not be able to download the asset.
|
|
11124
11329
|
*
|
|
11125
|
-
* @category
|
|
11330
|
+
* @category Storage
|
|
11331
|
+
* @subcategory File Buckets
|
|
11126
11332
|
* @param path The path and name of the file to generate the public URL for. For example `folder/image.png`.
|
|
11127
11333
|
* @param options.download Triggers the file as a download if set to true. Set this parameter as the name of the file if you want to trigger the download with a different filename.
|
|
11128
11334
|
* @param options.transform Transform the asset before serving it to the client.
|
|
@@ -11183,7 +11389,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
11183
11389
|
if (options === null || options === void 0 ? void 0 : options.transform) this.applyTransformOptsToQuery(query, options.transform);
|
|
11184
11390
|
if ((options === null || options === void 0 ? void 0 : options.cacheNonce) != null) query.set("cacheNonce", String(options.cacheNonce));
|
|
11185
11391
|
const queryString = query.toString();
|
|
11186
|
-
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform)
|
|
11392
|
+
const renderPath = typeof (options === null || options === void 0 ? void 0 : options.transform) === "object" && options.transform !== null && Object.keys(options.transform).length > 0 ? "render/image" : "object";
|
|
11187
11393
|
return { data: { publicUrl: encodeURI(`${this.url}/${renderPath}/public/${_path}`) + (queryString ? `?${queryString}` : "") } };
|
|
11188
11394
|
}
|
|
11189
11395
|
/**
|
|
@@ -11192,7 +11398,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
11192
11398
|
* Returns an array of FileObject entries for the deleted files. Note that deprecated
|
|
11193
11399
|
* fields like `bucket_id` may or may not be present in the response - do not rely on them.
|
|
11194
11400
|
*
|
|
11195
|
-
* @category
|
|
11401
|
+
* @category Storage
|
|
11402
|
+
* @subcategory File Buckets
|
|
11196
11403
|
* @param paths An array of files to delete, including the path and file name. For example [`'folder/image.png'`].
|
|
11197
11404
|
* @returns Promise with response containing array of deleted file objects or error
|
|
11198
11405
|
*
|
|
@@ -11241,7 +11448,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
11241
11448
|
* Additionally, deprecated fields like `bucket_id`, `owner`, and `buckets` are NOT returned
|
|
11242
11449
|
* by this method.
|
|
11243
11450
|
*
|
|
11244
|
-
* @category
|
|
11451
|
+
* @category Storage
|
|
11452
|
+
* @subcategory File Buckets
|
|
11245
11453
|
* @param path The folder path.
|
|
11246
11454
|
* @param options Search options including limit (defaults to 100), offset, sortBy, and search
|
|
11247
11455
|
* @param parameters Optional fetch parameters including signal for cancellation
|
|
@@ -11330,7 +11538,8 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
11330
11538
|
*
|
|
11331
11539
|
* @experimental this method signature might change in the future
|
|
11332
11540
|
*
|
|
11333
|
-
* @category
|
|
11541
|
+
* @category Storage
|
|
11542
|
+
* @subcategory File Buckets
|
|
11334
11543
|
* @param options Search options including prefix, cursor for pagination, limit, with_delimiter
|
|
11335
11544
|
* @param parameters Optional fetch parameters including signal for cancellation
|
|
11336
11545
|
* @returns Promise with response containing folders/objects arrays with pagination info or error
|
|
@@ -11397,7 +11606,7 @@ var StorageFileApi = class extends BaseApiClient {
|
|
|
11397
11606
|
return query;
|
|
11398
11607
|
}
|
|
11399
11608
|
};
|
|
11400
|
-
var version2 = "2.
|
|
11609
|
+
var version2 = "2.106.1";
|
|
11401
11610
|
var DEFAULT_HEADERS = { "X-Client-Info": `storage-js/${version2}` };
|
|
11402
11611
|
var StorageBucketApi = class extends BaseApiClient {
|
|
11403
11612
|
constructor(url, headers = {}, fetch$1, opts) {
|
|
@@ -11412,7 +11621,8 @@ var StorageBucketApi = class extends BaseApiClient {
|
|
|
11412
11621
|
/**
|
|
11413
11622
|
* Retrieves the details of all Storage buckets within an existing project.
|
|
11414
11623
|
*
|
|
11415
|
-
* @category
|
|
11624
|
+
* @category Storage
|
|
11625
|
+
* @subcategory File Buckets
|
|
11416
11626
|
* @param options Query parameters for listing buckets
|
|
11417
11627
|
* @param options.limit Maximum number of buckets to return
|
|
11418
11628
|
* @param options.offset Number of buckets to skip
|
|
@@ -11457,7 +11667,8 @@ var StorageBucketApi = class extends BaseApiClient {
|
|
|
11457
11667
|
/**
|
|
11458
11668
|
* Retrieves the details of an existing Storage bucket.
|
|
11459
11669
|
*
|
|
11460
|
-
* @category
|
|
11670
|
+
* @category Storage
|
|
11671
|
+
* @subcategory File Buckets
|
|
11461
11672
|
* @param id The unique identifier of the bucket you would like to retrieve.
|
|
11462
11673
|
* @returns Promise with response containing bucket details or error
|
|
11463
11674
|
*
|
|
@@ -11502,7 +11713,8 @@ var StorageBucketApi = class extends BaseApiClient {
|
|
|
11502
11713
|
/**
|
|
11503
11714
|
* Creates a new Storage bucket
|
|
11504
11715
|
*
|
|
11505
|
-
* @category
|
|
11716
|
+
* @category Storage
|
|
11717
|
+
* @subcategory File Buckets
|
|
11506
11718
|
* @param id A unique identifier for the bucket you are creating.
|
|
11507
11719
|
* @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations. By default, buckets are private.
|
|
11508
11720
|
* @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
|
|
@@ -11558,7 +11770,8 @@ var StorageBucketApi = class extends BaseApiClient {
|
|
|
11558
11770
|
/**
|
|
11559
11771
|
* Updates a Storage bucket
|
|
11560
11772
|
*
|
|
11561
|
-
* @category
|
|
11773
|
+
* @category Storage
|
|
11774
|
+
* @subcategory File Buckets
|
|
11562
11775
|
* @param id A unique identifier for the bucket you are updating.
|
|
11563
11776
|
* @param options.public The visibility of the bucket. Public buckets don't require an authorization token to download objects, but still require a valid token for all other operations.
|
|
11564
11777
|
* @param options.fileSizeLimit specifies the max file size in bytes that can be uploaded to this bucket.
|
|
@@ -11611,7 +11824,8 @@ var StorageBucketApi = class extends BaseApiClient {
|
|
|
11611
11824
|
/**
|
|
11612
11825
|
* Removes all objects inside a single bucket.
|
|
11613
11826
|
*
|
|
11614
|
-
* @category
|
|
11827
|
+
* @category Storage
|
|
11828
|
+
* @subcategory File Buckets
|
|
11615
11829
|
* @param id The unique identifier of the bucket you would like to empty.
|
|
11616
11830
|
* @returns Promise with success message or error
|
|
11617
11831
|
*
|
|
@@ -11648,7 +11862,8 @@ var StorageBucketApi = class extends BaseApiClient {
|
|
|
11648
11862
|
* Deletes an existing bucket. A bucket can't be deleted with existing objects inside it.
|
|
11649
11863
|
* You must first `empty()` the bucket.
|
|
11650
11864
|
*
|
|
11651
|
-
* @category
|
|
11865
|
+
* @category Storage
|
|
11866
|
+
* @subcategory File Buckets
|
|
11652
11867
|
* @param id The unique identifier of the bucket you would like to delete.
|
|
11653
11868
|
* @returns Promise with success message or error
|
|
11654
11869
|
*
|
|
@@ -11701,13 +11916,24 @@ var StorageAnalyticsClient = class extends BaseApiClient {
|
|
|
11701
11916
|
*
|
|
11702
11917
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
11703
11918
|
*
|
|
11704
|
-
* @category
|
|
11919
|
+
* @category Storage
|
|
11920
|
+
* @subcategory Analytics Buckets
|
|
11705
11921
|
* @param url - The base URL for the storage API
|
|
11706
11922
|
* @param headers - HTTP headers to include in requests
|
|
11707
11923
|
* @param fetch - Optional custom fetch implementation
|
|
11708
11924
|
*
|
|
11709
|
-
* @example
|
|
11925
|
+
* @example Using supabase-js (recommended)
|
|
11926
|
+
* ```typescript
|
|
11927
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
11928
|
+
*
|
|
11929
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
11930
|
+
* const { data, error } = await supabase.storage.analytics.listBuckets()
|
|
11931
|
+
* ```
|
|
11932
|
+
*
|
|
11933
|
+
* @example Standalone import for bundle-sensitive environments
|
|
11710
11934
|
* ```typescript
|
|
11935
|
+
* import { StorageAnalyticsClient } from '@supabase/storage-js'
|
|
11936
|
+
*
|
|
11711
11937
|
* const client = new StorageAnalyticsClient(url, headers)
|
|
11712
11938
|
* ```
|
|
11713
11939
|
*/
|
|
@@ -11724,7 +11950,8 @@ var StorageAnalyticsClient = class extends BaseApiClient {
|
|
|
11724
11950
|
*
|
|
11725
11951
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
11726
11952
|
*
|
|
11727
|
-
* @category
|
|
11953
|
+
* @category Storage
|
|
11954
|
+
* @subcategory Analytics Buckets
|
|
11728
11955
|
* @param name A unique name for the bucket you are creating
|
|
11729
11956
|
* @returns Promise with response containing newly created analytics bucket or error
|
|
11730
11957
|
*
|
|
@@ -11768,7 +11995,8 @@ var StorageAnalyticsClient = class extends BaseApiClient {
|
|
|
11768
11995
|
*
|
|
11769
11996
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
11770
11997
|
*
|
|
11771
|
-
* @category
|
|
11998
|
+
* @category Storage
|
|
11999
|
+
* @subcategory Analytics Buckets
|
|
11772
12000
|
* @param options Query parameters for listing buckets
|
|
11773
12001
|
* @param options.limit Maximum number of buckets to return
|
|
11774
12002
|
* @param options.offset Number of buckets to skip
|
|
@@ -11833,7 +12061,8 @@ var StorageAnalyticsClient = class extends BaseApiClient {
|
|
|
11833
12061
|
*
|
|
11834
12062
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
11835
12063
|
*
|
|
11836
|
-
* @category
|
|
12064
|
+
* @category Storage
|
|
12065
|
+
* @subcategory Analytics Buckets
|
|
11837
12066
|
* @param bucketName The unique identifier of the bucket you would like to delete
|
|
11838
12067
|
* @returns Promise with response containing success message or error
|
|
11839
12068
|
*
|
|
@@ -11874,7 +12103,8 @@ var StorageAnalyticsClient = class extends BaseApiClient {
|
|
|
11874
12103
|
*
|
|
11875
12104
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
11876
12105
|
*
|
|
11877
|
-
* @category
|
|
12106
|
+
* @category Storage
|
|
12107
|
+
* @subcategory Analytics Buckets
|
|
11878
12108
|
* @param bucketName - The name of the analytics bucket (warehouse) to connect to
|
|
11879
12109
|
* @returns The wrapped Iceberg catalog client
|
|
11880
12110
|
* @throws {StorageError} If the bucket name is invalid
|
|
@@ -12157,13 +12387,24 @@ var StorageVectorsClient = class extends VectorBucketApi {
|
|
|
12157
12387
|
*
|
|
12158
12388
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12159
12389
|
*
|
|
12160
|
-
* @category
|
|
12390
|
+
* @category Storage
|
|
12391
|
+
* @subcategory Vector Buckets
|
|
12161
12392
|
* @param url - Base URL of the Storage Vectors REST API.
|
|
12162
12393
|
* @param options.headers - Optional headers (for example `Authorization`) applied to every request.
|
|
12163
12394
|
* @param options.fetch - Optional custom `fetch` implementation for non-browser runtimes.
|
|
12164
12395
|
*
|
|
12165
|
-
* @example
|
|
12396
|
+
* @example Using supabase-js (recommended)
|
|
12397
|
+
* ```typescript
|
|
12398
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
12399
|
+
*
|
|
12400
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
12401
|
+
* const bucket = supabase.storage.vectors.from('embeddings-prod')
|
|
12402
|
+
* ```
|
|
12403
|
+
*
|
|
12404
|
+
* @example Standalone import for bundle-sensitive environments
|
|
12166
12405
|
* ```typescript
|
|
12406
|
+
* import { StorageVectorsClient } from '@supabase/storage-js'
|
|
12407
|
+
*
|
|
12167
12408
|
* const client = new StorageVectorsClient(url, options)
|
|
12168
12409
|
* ```
|
|
12169
12410
|
*/
|
|
@@ -12179,7 +12420,8 @@ var StorageVectorsClient = class extends VectorBucketApi {
|
|
|
12179
12420
|
*
|
|
12180
12421
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12181
12422
|
*
|
|
12182
|
-
* @category
|
|
12423
|
+
* @category Storage
|
|
12424
|
+
* @subcategory Vector Buckets
|
|
12183
12425
|
* @param vectorBucketName - Name of the vector bucket
|
|
12184
12426
|
* @returns Bucket-scoped client with index and vector operations
|
|
12185
12427
|
*
|
|
@@ -12200,7 +12442,8 @@ var StorageVectorsClient = class extends VectorBucketApi {
|
|
|
12200
12442
|
*
|
|
12201
12443
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12202
12444
|
*
|
|
12203
|
-
* @category
|
|
12445
|
+
* @category Storage
|
|
12446
|
+
* @subcategory Vector Buckets
|
|
12204
12447
|
* @param vectorBucketName - Unique name for the vector bucket
|
|
12205
12448
|
* @returns Promise with empty response on success or error
|
|
12206
12449
|
*
|
|
@@ -12224,7 +12467,8 @@ var StorageVectorsClient = class extends VectorBucketApi {
|
|
|
12224
12467
|
*
|
|
12225
12468
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12226
12469
|
*
|
|
12227
|
-
* @category
|
|
12470
|
+
* @category Storage
|
|
12471
|
+
* @subcategory Vector Buckets
|
|
12228
12472
|
* @param vectorBucketName - Name of the vector bucket
|
|
12229
12473
|
* @returns Promise with bucket metadata or error
|
|
12230
12474
|
*
|
|
@@ -12250,7 +12494,8 @@ var StorageVectorsClient = class extends VectorBucketApi {
|
|
|
12250
12494
|
*
|
|
12251
12495
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12252
12496
|
*
|
|
12253
|
-
* @category
|
|
12497
|
+
* @category Storage
|
|
12498
|
+
* @subcategory Vector Buckets
|
|
12254
12499
|
* @param options - Optional filters (prefix, maxResults, nextToken)
|
|
12255
12500
|
* @returns Promise with list of buckets or error
|
|
12256
12501
|
*
|
|
@@ -12279,7 +12524,8 @@ var StorageVectorsClient = class extends VectorBucketApi {
|
|
|
12279
12524
|
*
|
|
12280
12525
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12281
12526
|
*
|
|
12282
|
-
* @category
|
|
12527
|
+
* @category Storage
|
|
12528
|
+
* @subcategory Vector Buckets
|
|
12283
12529
|
* @param vectorBucketName - Name of the vector bucket to delete
|
|
12284
12530
|
* @returns Promise with empty response on success or error
|
|
12285
12531
|
*
|
|
@@ -12304,7 +12550,8 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
12304
12550
|
*
|
|
12305
12551
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12306
12552
|
*
|
|
12307
|
-
* @category
|
|
12553
|
+
* @category Storage
|
|
12554
|
+
* @subcategory Vector Buckets
|
|
12308
12555
|
* @example Creating a vector bucket scope
|
|
12309
12556
|
* ```typescript
|
|
12310
12557
|
* const bucket = supabase.storage.vectors.from('embeddings-prod')
|
|
@@ -12323,7 +12570,8 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
12323
12570
|
*
|
|
12324
12571
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12325
12572
|
*
|
|
12326
|
-
* @category
|
|
12573
|
+
* @category Storage
|
|
12574
|
+
* @subcategory Vector Buckets
|
|
12327
12575
|
* @param options - Index configuration (vectorBucketName is automatically set)
|
|
12328
12576
|
* @returns Promise with empty response on success or error
|
|
12329
12577
|
*
|
|
@@ -12354,7 +12602,8 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
12354
12602
|
*
|
|
12355
12603
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12356
12604
|
*
|
|
12357
|
-
* @category
|
|
12605
|
+
* @category Storage
|
|
12606
|
+
* @subcategory Vector Buckets
|
|
12358
12607
|
* @param options - Listing options (vectorBucketName is automatically set)
|
|
12359
12608
|
* @returns Promise with response containing indexes array and pagination token or error
|
|
12360
12609
|
*
|
|
@@ -12377,7 +12626,8 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
12377
12626
|
*
|
|
12378
12627
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12379
12628
|
*
|
|
12380
|
-
* @category
|
|
12629
|
+
* @category Storage
|
|
12630
|
+
* @subcategory Vector Buckets
|
|
12381
12631
|
* @param indexName - Name of the index to retrieve
|
|
12382
12632
|
* @returns Promise with index metadata or error
|
|
12383
12633
|
*
|
|
@@ -12401,7 +12651,8 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
12401
12651
|
*
|
|
12402
12652
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12403
12653
|
*
|
|
12404
|
-
* @category
|
|
12654
|
+
* @category Storage
|
|
12655
|
+
* @subcategory Vector Buckets
|
|
12405
12656
|
* @param indexName - Name of the index to delete
|
|
12406
12657
|
* @returns Promise with empty response on success or error
|
|
12407
12658
|
*
|
|
@@ -12424,7 +12675,8 @@ var VectorBucketScope = class extends VectorIndexApi {
|
|
|
12424
12675
|
*
|
|
12425
12676
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12426
12677
|
*
|
|
12427
|
-
* @category
|
|
12678
|
+
* @category Storage
|
|
12679
|
+
* @subcategory Vector Buckets
|
|
12428
12680
|
* @param indexName - Name of the index
|
|
12429
12681
|
* @returns Index-scoped client with vector data operations
|
|
12430
12682
|
*
|
|
@@ -12459,7 +12711,8 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
12459
12711
|
*
|
|
12460
12712
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12461
12713
|
*
|
|
12462
|
-
* @category
|
|
12714
|
+
* @category Storage
|
|
12715
|
+
* @subcategory Vector Buckets
|
|
12463
12716
|
* @example Creating a vector index scope
|
|
12464
12717
|
* ```typescript
|
|
12465
12718
|
* const index = supabase.storage.vectors.from('embeddings-prod').index('documents-openai')
|
|
@@ -12479,7 +12732,8 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
12479
12732
|
*
|
|
12480
12733
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12481
12734
|
*
|
|
12482
|
-
* @category
|
|
12735
|
+
* @category Storage
|
|
12736
|
+
* @subcategory Vector Buckets
|
|
12483
12737
|
* @param options - Vector insertion options (bucket and index names automatically set)
|
|
12484
12738
|
* @returns Promise with empty response on success or error
|
|
12485
12739
|
*
|
|
@@ -12513,7 +12767,8 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
12513
12767
|
*
|
|
12514
12768
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12515
12769
|
*
|
|
12516
|
-
* @category
|
|
12770
|
+
* @category Storage
|
|
12771
|
+
* @subcategory Vector Buckets
|
|
12517
12772
|
* @param options - Vector retrieval options (bucket and index names automatically set)
|
|
12518
12773
|
* @returns Promise with response containing vectors array or error
|
|
12519
12774
|
*
|
|
@@ -12542,7 +12797,8 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
12542
12797
|
*
|
|
12543
12798
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12544
12799
|
*
|
|
12545
|
-
* @category
|
|
12800
|
+
* @category Storage
|
|
12801
|
+
* @subcategory Vector Buckets
|
|
12546
12802
|
* @param options - Listing options (bucket and index names automatically set)
|
|
12547
12803
|
* @returns Promise with response containing vectors array and pagination token or error
|
|
12548
12804
|
*
|
|
@@ -12571,7 +12827,8 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
12571
12827
|
*
|
|
12572
12828
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12573
12829
|
*
|
|
12574
|
-
* @category
|
|
12830
|
+
* @category Storage
|
|
12831
|
+
* @subcategory Vector Buckets
|
|
12575
12832
|
* @param options - Query options (bucket and index names automatically set)
|
|
12576
12833
|
* @returns Promise with response containing matches array of similar vectors ordered by distance or error
|
|
12577
12834
|
*
|
|
@@ -12603,7 +12860,8 @@ var VectorIndexScope = class extends VectorDataApi {
|
|
|
12603
12860
|
*
|
|
12604
12861
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12605
12862
|
*
|
|
12606
|
-
* @category
|
|
12863
|
+
* @category Storage
|
|
12864
|
+
* @subcategory Vector Buckets
|
|
12607
12865
|
* @param options - Deletion options (bucket and index names automatically set)
|
|
12608
12866
|
* @returns Promise with empty response on success or error
|
|
12609
12867
|
*
|
|
@@ -12627,13 +12885,23 @@ var StorageClient = class extends StorageBucketApi {
|
|
|
12627
12885
|
/**
|
|
12628
12886
|
* Creates a client for Storage buckets, files, analytics, and vectors.
|
|
12629
12887
|
*
|
|
12630
|
-
* @category
|
|
12631
|
-
* @
|
|
12888
|
+
* @category Storage
|
|
12889
|
+
* @subcategory File Buckets
|
|
12890
|
+
*
|
|
12891
|
+
* @example Using supabase-js (recommended)
|
|
12892
|
+
* ```ts
|
|
12893
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
12894
|
+
*
|
|
12895
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
12896
|
+
* const avatars = supabase.storage.from('avatars')
|
|
12897
|
+
* ```
|
|
12898
|
+
*
|
|
12899
|
+
* @example Standalone import for bundle-sensitive environments
|
|
12632
12900
|
* ```ts
|
|
12633
12901
|
* import { StorageClient } from '@supabase/storage-js'
|
|
12634
12902
|
*
|
|
12635
12903
|
* const storage = new StorageClient('https://xyzcompany.supabase.co/storage/v1', {
|
|
12636
|
-
* apikey: '
|
|
12904
|
+
* apikey: 'your-publishable-key',
|
|
12637
12905
|
* })
|
|
12638
12906
|
* const avatars = storage.from('avatars')
|
|
12639
12907
|
* ```
|
|
@@ -12644,7 +12912,9 @@ var StorageClient = class extends StorageBucketApi {
|
|
|
12644
12912
|
/**
|
|
12645
12913
|
* Perform file operation in a bucket.
|
|
12646
12914
|
*
|
|
12647
|
-
* @category
|
|
12915
|
+
* @category Storage
|
|
12916
|
+
* @subcategory File Buckets
|
|
12917
|
+
*
|
|
12648
12918
|
* @param id The bucket id to operate on.
|
|
12649
12919
|
*
|
|
12650
12920
|
* @example Accessing a bucket
|
|
@@ -12663,7 +12933,9 @@ var StorageClient = class extends StorageBucketApi {
|
|
|
12663
12933
|
*
|
|
12664
12934
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12665
12935
|
*
|
|
12666
|
-
* @category
|
|
12936
|
+
* @category Storage
|
|
12937
|
+
* @subcategory Vector Buckets
|
|
12938
|
+
*
|
|
12667
12939
|
* @returns A StorageVectorsClient instance configured with the current storage settings.
|
|
12668
12940
|
*/
|
|
12669
12941
|
get vectors() {
|
|
@@ -12680,7 +12952,9 @@ var StorageClient = class extends StorageBucketApi {
|
|
|
12680
12952
|
*
|
|
12681
12953
|
* **Public alpha:** This API is part of a public alpha release and may not be available to your account type.
|
|
12682
12954
|
*
|
|
12683
|
-
* @category
|
|
12955
|
+
* @category Storage
|
|
12956
|
+
* @subcategory Analytics Buckets
|
|
12957
|
+
*
|
|
12684
12958
|
* @returns A StorageAnalyticsClient instance configured with the current storage settings.
|
|
12685
12959
|
*/
|
|
12686
12960
|
get analytics() {
|
|
@@ -12688,10 +12962,10 @@ var StorageClient = class extends StorageBucketApi {
|
|
|
12688
12962
|
}
|
|
12689
12963
|
};
|
|
12690
12964
|
|
|
12691
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
12692
|
-
var version3 = "2.
|
|
12965
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/version.js
|
|
12966
|
+
var version3 = "2.106.1";
|
|
12693
12967
|
|
|
12694
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
12968
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/constants.js
|
|
12695
12969
|
var AUTO_REFRESH_TICK_DURATION_MS = 30 * 1e3;
|
|
12696
12970
|
var AUTO_REFRESH_TICK_THRESHOLD = 3;
|
|
12697
12971
|
var EXPIRY_MARGIN_MS = AUTO_REFRESH_TICK_THRESHOLD * AUTO_REFRESH_TICK_DURATION_MS;
|
|
@@ -12708,7 +12982,7 @@ var API_VERSIONS = {
|
|
|
12708
12982
|
var BASE64URL_REGEX = /^([a-z0-9_-]{4})*($|[a-z0-9_-]{3}$|[a-z0-9_-]{2}$)$/i;
|
|
12709
12983
|
var JWKS_TTL = 10 * 60 * 1e3;
|
|
12710
12984
|
|
|
12711
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
12985
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/errors.js
|
|
12712
12986
|
var AuthError = class extends Error {
|
|
12713
12987
|
constructor(message, status, code) {
|
|
12714
12988
|
super(message);
|
|
@@ -12717,8 +12991,16 @@ var AuthError = class extends Error {
|
|
|
12717
12991
|
this.status = status;
|
|
12718
12992
|
this.code = code;
|
|
12719
12993
|
}
|
|
12720
|
-
|
|
12721
|
-
|
|
12994
|
+
toJSON() {
|
|
12995
|
+
return {
|
|
12996
|
+
name: this.name,
|
|
12997
|
+
message: this.message,
|
|
12998
|
+
status: this.status,
|
|
12999
|
+
code: this.code
|
|
13000
|
+
};
|
|
13001
|
+
}
|
|
13002
|
+
};
|
|
13003
|
+
function isAuthError(error) {
|
|
12722
13004
|
return typeof error === "object" && error !== null && "__isAuthError" in error;
|
|
12723
13005
|
}
|
|
12724
13006
|
var AuthApiError = class extends AuthError {
|
|
@@ -12771,12 +13053,7 @@ var AuthImplicitGrantRedirectError = class extends CustomAuthError {
|
|
|
12771
13053
|
this.details = details;
|
|
12772
13054
|
}
|
|
12773
13055
|
toJSON() {
|
|
12774
|
-
return {
|
|
12775
|
-
name: this.name,
|
|
12776
|
-
message: this.message,
|
|
12777
|
-
status: this.status,
|
|
12778
|
-
details: this.details
|
|
12779
|
-
};
|
|
13056
|
+
return Object.assign(Object.assign({}, super.toJSON()), { details: this.details });
|
|
12780
13057
|
}
|
|
12781
13058
|
};
|
|
12782
13059
|
function isAuthImplicitGrantRedirectError(error) {
|
|
@@ -12789,12 +13066,7 @@ var AuthPKCEGrantCodeExchangeError = class extends CustomAuthError {
|
|
|
12789
13066
|
this.details = details;
|
|
12790
13067
|
}
|
|
12791
13068
|
toJSON() {
|
|
12792
|
-
return {
|
|
12793
|
-
name: this.name,
|
|
12794
|
-
message: this.message,
|
|
12795
|
-
status: this.status,
|
|
12796
|
-
details: this.details
|
|
12797
|
-
};
|
|
13069
|
+
return Object.assign(Object.assign({}, super.toJSON()), { details: this.details });
|
|
12798
13070
|
}
|
|
12799
13071
|
};
|
|
12800
13072
|
var AuthPKCECodeVerifierMissingError = class extends CustomAuthError {
|
|
@@ -12818,6 +13090,9 @@ var AuthWeakPasswordError = class extends CustomAuthError {
|
|
|
12818
13090
|
super(message, "AuthWeakPasswordError", status, "weak_password");
|
|
12819
13091
|
this.reasons = reasons;
|
|
12820
13092
|
}
|
|
13093
|
+
toJSON() {
|
|
13094
|
+
return Object.assign(Object.assign({}, super.toJSON()), { reasons: this.reasons });
|
|
13095
|
+
}
|
|
12821
13096
|
};
|
|
12822
13097
|
function isAuthWeakPasswordError(error) {
|
|
12823
13098
|
return isAuthError(error) && error.name === "AuthWeakPasswordError";
|
|
@@ -12828,7 +13103,7 @@ var AuthInvalidJwtError = class extends CustomAuthError {
|
|
|
12828
13103
|
}
|
|
12829
13104
|
};
|
|
12830
13105
|
|
|
12831
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
13106
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/base64url.js
|
|
12832
13107
|
var TO_BASE64URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_".split("");
|
|
12833
13108
|
var IGNORE_BASE64URL = " \n\r=".split("");
|
|
12834
13109
|
var FROM_BASE64URL = (() => {
|
|
@@ -12990,7 +13265,7 @@ function bytesToBase64URL(bytes) {
|
|
|
12990
13265
|
return result.join("");
|
|
12991
13266
|
}
|
|
12992
13267
|
|
|
12993
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
13268
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/helpers.js
|
|
12994
13269
|
function expiresAt(expiresIn) {
|
|
12995
13270
|
const timeNow = Math.round(Date.now() / 1e3);
|
|
12996
13271
|
return timeNow + expiresIn;
|
|
@@ -13038,7 +13313,7 @@ function parseParametersFromURL(href) {
|
|
|
13038
13313
|
hashSearchParams.forEach((value, key) => {
|
|
13039
13314
|
result[key] = value;
|
|
13040
13315
|
});
|
|
13041
|
-
} catch (
|
|
13316
|
+
} catch (_e) {
|
|
13042
13317
|
}
|
|
13043
13318
|
}
|
|
13044
13319
|
url.searchParams.forEach((value, key) => {
|
|
@@ -13066,7 +13341,7 @@ var getItemAsync = async (storage, key) => {
|
|
|
13066
13341
|
try {
|
|
13067
13342
|
return JSON.parse(value);
|
|
13068
13343
|
} catch (_a) {
|
|
13069
|
-
return
|
|
13344
|
+
return null;
|
|
13070
13345
|
}
|
|
13071
13346
|
};
|
|
13072
13347
|
var removeItemAsync = async (storage, key) => {
|
|
@@ -13170,7 +13445,7 @@ async function getCodeChallengeAndMethod(storage, storageKey, isPasswordRecovery
|
|
|
13170
13445
|
const codeVerifier = generatePKCEVerifier();
|
|
13171
13446
|
let storedCodeVerifier = codeVerifier;
|
|
13172
13447
|
if (isPasswordRecovery) {
|
|
13173
|
-
storedCodeVerifier += "/
|
|
13448
|
+
storedCodeVerifier += "/recovery";
|
|
13174
13449
|
}
|
|
13175
13450
|
await setItemAsync(storage, `${storageKey}-code-verifier`, storedCodeVerifier);
|
|
13176
13451
|
const codeChallenge = await generatePKCEChallenge(codeVerifier);
|
|
@@ -13189,7 +13464,7 @@ function parseResponseAPIVersion(response) {
|
|
|
13189
13464
|
try {
|
|
13190
13465
|
const date = /* @__PURE__ */ new Date(`${apiVersion}T00:00:00.0Z`);
|
|
13191
13466
|
return date;
|
|
13192
|
-
} catch (
|
|
13467
|
+
} catch (_e) {
|
|
13193
13468
|
return null;
|
|
13194
13469
|
}
|
|
13195
13470
|
}
|
|
@@ -13225,6 +13500,11 @@ function validateUUID(str) {
|
|
|
13225
13500
|
throw new Error("@supabase/auth-js: Expected parameter to be UUID but is not");
|
|
13226
13501
|
}
|
|
13227
13502
|
}
|
|
13503
|
+
function assertPasskeyExperimentalEnabled(experimental) {
|
|
13504
|
+
if (!experimental.passkey) {
|
|
13505
|
+
throw new Error("@supabase/auth-js: the passkey API is experimental and disabled by default. Enable it by passing `auth: { experimental: { passkey: true } }` to createClient (or to the GoTrueClient constructor).");
|
|
13506
|
+
}
|
|
13507
|
+
}
|
|
13228
13508
|
function userNotAvailableProxy() {
|
|
13229
13509
|
const proxyTarget = {};
|
|
13230
13510
|
return new Proxy(proxyTarget, {
|
|
@@ -13272,9 +13552,22 @@ function deepClone(obj) {
|
|
|
13272
13552
|
return JSON.parse(JSON.stringify(obj));
|
|
13273
13553
|
}
|
|
13274
13554
|
|
|
13275
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
13276
|
-
var _getErrorMessage2 = (err) =>
|
|
13277
|
-
|
|
13555
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/fetch.js
|
|
13556
|
+
var _getErrorMessage2 = (err) => {
|
|
13557
|
+
if (typeof err === "object" && err !== null) {
|
|
13558
|
+
const e = err;
|
|
13559
|
+
if (typeof e.msg === "string")
|
|
13560
|
+
return e.msg;
|
|
13561
|
+
if (typeof e.message === "string")
|
|
13562
|
+
return e.message;
|
|
13563
|
+
if (typeof e.error_description === "string")
|
|
13564
|
+
return e.error_description;
|
|
13565
|
+
if (typeof e.error === "string")
|
|
13566
|
+
return e.error;
|
|
13567
|
+
}
|
|
13568
|
+
return JSON.stringify(err);
|
|
13569
|
+
};
|
|
13570
|
+
var NETWORK_ERROR_CODES = [502, 503, 504, 520, 521, 522, 523, 524, 530];
|
|
13278
13571
|
async function handleError2(error) {
|
|
13279
13572
|
var _a;
|
|
13280
13573
|
if (!looksLikeFetchResponse(error)) {
|
|
@@ -13366,7 +13659,7 @@ function _sessionResponse(data) {
|
|
|
13366
13659
|
session.expires_at = expiresAt(data.expires_in);
|
|
13367
13660
|
}
|
|
13368
13661
|
}
|
|
13369
|
-
const user = (_a = data.user) !== null && _a !== void 0 ? _a :
|
|
13662
|
+
const user = (_a = data.user) !== null && _a !== void 0 ? _a : null;
|
|
13370
13663
|
return { data: { session, user }, error: null };
|
|
13371
13664
|
}
|
|
13372
13665
|
function _sessionResponsePassword(data) {
|
|
@@ -13406,31 +13699,46 @@ function _noResolveJsonResponse(data) {
|
|
|
13406
13699
|
return data;
|
|
13407
13700
|
}
|
|
13408
13701
|
function hasSession(data) {
|
|
13409
|
-
return data.access_token && data.refresh_token && data.expires_in;
|
|
13702
|
+
return !!data.access_token && !!data.refresh_token && !!data.expires_in;
|
|
13410
13703
|
}
|
|
13411
13704
|
|
|
13412
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
13705
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/types.js
|
|
13413
13706
|
var SIGN_OUT_SCOPES = ["global", "local", "others"];
|
|
13414
13707
|
|
|
13415
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
13708
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/GoTrueAdminApi.js
|
|
13416
13709
|
var GoTrueAdminApi = class {
|
|
13710
|
+
_encodePathSegment(segment) {
|
|
13711
|
+
if (segment === "." || segment === "..") {
|
|
13712
|
+
throw new AuthError("Invalid path segment");
|
|
13713
|
+
}
|
|
13714
|
+
return encodeURIComponent(segment);
|
|
13715
|
+
}
|
|
13417
13716
|
/**
|
|
13418
13717
|
* Creates an admin API client that can be used to manage users and OAuth clients.
|
|
13419
13718
|
*
|
|
13420
|
-
* @example
|
|
13719
|
+
* @example Using supabase-js (recommended)
|
|
13720
|
+
* ```ts
|
|
13721
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
13722
|
+
*
|
|
13723
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-secret-key')
|
|
13724
|
+
* const { data, error } = await supabase.auth.admin.listUsers()
|
|
13725
|
+
* ```
|
|
13726
|
+
*
|
|
13727
|
+
* @example Standalone import for bundle-sensitive environments
|
|
13421
13728
|
* ```ts
|
|
13422
13729
|
* import { GoTrueAdminApi } from '@supabase/auth-js'
|
|
13423
13730
|
*
|
|
13424
13731
|
* const admin = new GoTrueAdminApi({
|
|
13425
13732
|
* url: 'https://xyzcompany.supabase.co/auth/v1',
|
|
13426
|
-
* headers: { Authorization: `Bearer ${process.env.
|
|
13733
|
+
* headers: { Authorization: `Bearer ${process.env.SUPABASE_SECRET_KEY}` },
|
|
13427
13734
|
* })
|
|
13428
13735
|
* ```
|
|
13429
13736
|
*/
|
|
13430
|
-
constructor({ url = "", headers = {}, fetch: fetch2 }) {
|
|
13737
|
+
constructor({ url = "", headers = {}, fetch: fetch2, experimental }) {
|
|
13431
13738
|
this.url = url;
|
|
13432
13739
|
this.headers = headers;
|
|
13433
13740
|
this.fetch = resolveFetch3(fetch2);
|
|
13741
|
+
this.experimental = experimental !== null && experimental !== void 0 ? experimental : {};
|
|
13434
13742
|
this.mfa = {
|
|
13435
13743
|
listFactors: this._listFactors.bind(this),
|
|
13436
13744
|
deleteFactor: this._deleteFactor.bind(this)
|
|
@@ -13450,6 +13758,10 @@ var GoTrueAdminApi = class {
|
|
|
13450
13758
|
updateProvider: this._updateCustomProvider.bind(this),
|
|
13451
13759
|
deleteProvider: this._deleteCustomProvider.bind(this)
|
|
13452
13760
|
};
|
|
13761
|
+
this.passkey = {
|
|
13762
|
+
listPasskeys: this._adminListPasskeys.bind(this),
|
|
13763
|
+
deletePasskey: this._adminDeletePasskey.bind(this)
|
|
13764
|
+
};
|
|
13453
13765
|
}
|
|
13454
13766
|
/**
|
|
13455
13767
|
* Removes a logged-in session.
|
|
@@ -13457,6 +13769,7 @@ var GoTrueAdminApi = class {
|
|
|
13457
13769
|
* @param scope The logout sope.
|
|
13458
13770
|
*
|
|
13459
13771
|
* @category Auth
|
|
13772
|
+
* @subcategory Auth Admin
|
|
13460
13773
|
*/
|
|
13461
13774
|
async signOut(jwt, scope = SIGN_OUT_SCOPES[0]) {
|
|
13462
13775
|
if (SIGN_OUT_SCOPES.indexOf(scope) < 0) {
|
|
@@ -13482,6 +13795,7 @@ var GoTrueAdminApi = class {
|
|
|
13482
13795
|
* @param options Additional options to be included when inviting.
|
|
13483
13796
|
*
|
|
13484
13797
|
* @category Auth
|
|
13798
|
+
* @subcategory Auth Admin
|
|
13485
13799
|
*
|
|
13486
13800
|
* @remarks
|
|
13487
13801
|
* - Sends an invite link to the user's email address.
|
|
@@ -13562,6 +13876,7 @@ var GoTrueAdminApi = class {
|
|
|
13562
13876
|
* @param options.redirectTo The redirect url which should be appended to the generated link
|
|
13563
13877
|
*
|
|
13564
13878
|
* @category Auth
|
|
13879
|
+
* @subcategory Auth Admin
|
|
13565
13880
|
*
|
|
13566
13881
|
* @remarks
|
|
13567
13882
|
* - The following types can be passed into `generateLink()`: `signup`, `magiclink`, `invite`, `recovery`, `email_change_current`, `email_change_new`, `phone_change`.
|
|
@@ -13703,6 +14018,7 @@ var GoTrueAdminApi = class {
|
|
|
13703
14018
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
13704
14019
|
*
|
|
13705
14020
|
* @category Auth
|
|
14021
|
+
* @subcategory Auth Admin
|
|
13706
14022
|
*
|
|
13707
14023
|
* @remarks
|
|
13708
14024
|
* - To confirm the user's email address or phone number, set `email_confirm` or `phone_confirm` to true. Both arguments default to false.
|
|
@@ -13798,6 +14114,7 @@ var GoTrueAdminApi = class {
|
|
|
13798
14114
|
* @param params An object which supports `page` and `perPage` as numbers, to alter the paginated results.
|
|
13799
14115
|
*
|
|
13800
14116
|
* @category Auth
|
|
14117
|
+
* @subcategory Auth Admin
|
|
13801
14118
|
*
|
|
13802
14119
|
* @remarks
|
|
13803
14120
|
* - Defaults to return 50 users per page.
|
|
@@ -13857,6 +14174,7 @@ var GoTrueAdminApi = class {
|
|
|
13857
14174
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
13858
14175
|
*
|
|
13859
14176
|
* @category Auth
|
|
14177
|
+
* @subcategory Auth Admin
|
|
13860
14178
|
*
|
|
13861
14179
|
* @remarks
|
|
13862
14180
|
* - Fetches the user object from the database based on the user's id.
|
|
@@ -13957,6 +14275,7 @@ var GoTrueAdminApi = class {
|
|
|
13957
14275
|
* @see {@link GoTrueClient.updateUser} for client-side user updates (triggers listeners automatically)
|
|
13958
14276
|
*
|
|
13959
14277
|
* @category Auth
|
|
14278
|
+
* @subcategory Auth Admin
|
|
13960
14279
|
*
|
|
13961
14280
|
* @example Updates a user's email
|
|
13962
14281
|
* ```js
|
|
@@ -14092,6 +14411,7 @@ var GoTrueAdminApi = class {
|
|
|
14092
14411
|
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
14093
14412
|
*
|
|
14094
14413
|
* @category Auth
|
|
14414
|
+
* @subcategory Auth Admin
|
|
14095
14415
|
*
|
|
14096
14416
|
* @remarks
|
|
14097
14417
|
* - The `deleteUser()` method requires the user's ID, which maps to the `auth.users.id` column.
|
|
@@ -14232,7 +14552,8 @@ var GoTrueAdminApi = class {
|
|
|
14232
14552
|
*/
|
|
14233
14553
|
async _getOAuthClient(clientId) {
|
|
14234
14554
|
try {
|
|
14235
|
-
|
|
14555
|
+
const encodedClientId = this._encodePathSegment(clientId);
|
|
14556
|
+
return await _request(this.fetch, "GET", `${this.url}/admin/oauth/clients/${encodedClientId}`, {
|
|
14236
14557
|
headers: this.headers,
|
|
14237
14558
|
xform: (client) => {
|
|
14238
14559
|
return { data: client, error: null };
|
|
@@ -14253,7 +14574,8 @@ var GoTrueAdminApi = class {
|
|
|
14253
14574
|
*/
|
|
14254
14575
|
async _updateOAuthClient(clientId, params) {
|
|
14255
14576
|
try {
|
|
14256
|
-
|
|
14577
|
+
const encodedClientId = this._encodePathSegment(clientId);
|
|
14578
|
+
return await _request(this.fetch, "PUT", `${this.url}/admin/oauth/clients/${encodedClientId}`, {
|
|
14257
14579
|
body: params,
|
|
14258
14580
|
headers: this.headers,
|
|
14259
14581
|
xform: (client) => {
|
|
@@ -14275,7 +14597,8 @@ var GoTrueAdminApi = class {
|
|
|
14275
14597
|
*/
|
|
14276
14598
|
async _deleteOAuthClient(clientId) {
|
|
14277
14599
|
try {
|
|
14278
|
-
|
|
14600
|
+
const encodedClientId = this._encodePathSegment(clientId);
|
|
14601
|
+
await _request(this.fetch, "DELETE", `${this.url}/admin/oauth/clients/${encodedClientId}`, {
|
|
14279
14602
|
headers: this.headers,
|
|
14280
14603
|
noResolveJson: true
|
|
14281
14604
|
});
|
|
@@ -14295,7 +14618,8 @@ var GoTrueAdminApi = class {
|
|
|
14295
14618
|
*/
|
|
14296
14619
|
async _regenerateOAuthClientSecret(clientId) {
|
|
14297
14620
|
try {
|
|
14298
|
-
|
|
14621
|
+
const encodedClientId = this._encodePathSegment(clientId);
|
|
14622
|
+
return await _request(this.fetch, "POST", `${this.url}/admin/oauth/clients/${encodedClientId}/regenerate_secret`, {
|
|
14299
14623
|
headers: this.headers,
|
|
14300
14624
|
xform: (client) => {
|
|
14301
14625
|
return { data: client, error: null };
|
|
@@ -14368,7 +14692,8 @@ var GoTrueAdminApi = class {
|
|
|
14368
14692
|
*/
|
|
14369
14693
|
async _getCustomProvider(identifier) {
|
|
14370
14694
|
try {
|
|
14371
|
-
|
|
14695
|
+
const encodedIdentifier = this._encodePathSegment(identifier);
|
|
14696
|
+
return await _request(this.fetch, "GET", `${this.url}/admin/custom-providers/${encodedIdentifier}`, {
|
|
14372
14697
|
headers: this.headers,
|
|
14373
14698
|
xform: (provider) => {
|
|
14374
14699
|
return { data: provider, error: null };
|
|
@@ -14393,7 +14718,8 @@ var GoTrueAdminApi = class {
|
|
|
14393
14718
|
*/
|
|
14394
14719
|
async _updateCustomProvider(identifier, params) {
|
|
14395
14720
|
try {
|
|
14396
|
-
|
|
14721
|
+
const encodedIdentifier = this._encodePathSegment(identifier);
|
|
14722
|
+
return await _request(this.fetch, "PUT", `${this.url}/admin/custom-providers/${encodedIdentifier}`, {
|
|
14397
14723
|
body: params,
|
|
14398
14724
|
headers: this.headers,
|
|
14399
14725
|
xform: (provider) => {
|
|
@@ -14414,7 +14740,8 @@ var GoTrueAdminApi = class {
|
|
|
14414
14740
|
*/
|
|
14415
14741
|
async _deleteCustomProvider(identifier) {
|
|
14416
14742
|
try {
|
|
14417
|
-
|
|
14743
|
+
const encodedIdentifier = this._encodePathSegment(identifier);
|
|
14744
|
+
await _request(this.fetch, "DELETE", `${this.url}/admin/custom-providers/${encodedIdentifier}`, {
|
|
14418
14745
|
headers: this.headers,
|
|
14419
14746
|
noResolveJson: true
|
|
14420
14747
|
});
|
|
@@ -14426,9 +14753,49 @@ var GoTrueAdminApi = class {
|
|
|
14426
14753
|
throw error;
|
|
14427
14754
|
}
|
|
14428
14755
|
}
|
|
14756
|
+
/**
|
|
14757
|
+
* Lists all passkeys for a user.
|
|
14758
|
+
*
|
|
14759
|
+
* This function should only be called on a server. Never expose your secret key in the browser.
|
|
14760
|
+
*
|
|
14761
|
+
* Requires `auth.experimental.passkey: true`.
|
|
14762
|
+
*/
|
|
14763
|
+
async _adminListPasskeys(params) {
|
|
14764
|
+
assertPasskeyExperimentalEnabled(this.experimental);
|
|
14765
|
+
validateUUID(params.userId);
|
|
14766
|
+
try {
|
|
14767
|
+
return await _request(this.fetch, "GET", `${this.url}/admin/users/${params.userId}/passkeys`, { headers: this.headers, xform: (data) => ({ data, error: null }) });
|
|
14768
|
+
} catch (error) {
|
|
14769
|
+
if (isAuthError(error)) {
|
|
14770
|
+
return { data: null, error };
|
|
14771
|
+
}
|
|
14772
|
+
throw error;
|
|
14773
|
+
}
|
|
14774
|
+
}
|
|
14775
|
+
/**
|
|
14776
|
+
* Deletes a user's passkey.
|
|
14777
|
+
*
|
|
14778
|
+
* This function should only be called on a server. Never expose your secret key in the browser.
|
|
14779
|
+
*
|
|
14780
|
+
* Requires `auth.experimental.passkey: true`.
|
|
14781
|
+
*/
|
|
14782
|
+
async _adminDeletePasskey(params) {
|
|
14783
|
+
assertPasskeyExperimentalEnabled(this.experimental);
|
|
14784
|
+
validateUUID(params.userId);
|
|
14785
|
+
validateUUID(params.passkeyId);
|
|
14786
|
+
try {
|
|
14787
|
+
await _request(this.fetch, "DELETE", `${this.url}/admin/users/${params.userId}/passkeys/${params.passkeyId}`, { headers: this.headers, noResolveJson: true });
|
|
14788
|
+
return { data: null, error: null };
|
|
14789
|
+
} catch (error) {
|
|
14790
|
+
if (isAuthError(error)) {
|
|
14791
|
+
return { data: null, error };
|
|
14792
|
+
}
|
|
14793
|
+
throw error;
|
|
14794
|
+
}
|
|
14795
|
+
}
|
|
14429
14796
|
};
|
|
14430
14797
|
|
|
14431
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
14798
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/local-storage.js
|
|
14432
14799
|
function memoryLocalStorageAdapter(store = {}) {
|
|
14433
14800
|
return {
|
|
14434
14801
|
getItem: (key) => {
|
|
@@ -14443,7 +14810,7 @@ function memoryLocalStorageAdapter(store = {}) {
|
|
|
14443
14810
|
};
|
|
14444
14811
|
}
|
|
14445
14812
|
|
|
14446
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
14813
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/locks.js
|
|
14447
14814
|
var internals = {
|
|
14448
14815
|
/**
|
|
14449
14816
|
* @experimental
|
|
@@ -14520,7 +14887,7 @@ async function navigatorLock(name, acquireTimeout, fn) {
|
|
|
14520
14887
|
if (acquireTimeout > 0) {
|
|
14521
14888
|
clearTimeout(acquireTimeoutTimer);
|
|
14522
14889
|
}
|
|
14523
|
-
if (
|
|
14890
|
+
if (e !== null && typeof e === "object" && "name" in e && e.name === "AbortError" && acquireTimeout > 0) {
|
|
14524
14891
|
if (abortController.signal.aborted) {
|
|
14525
14892
|
if (internals.debug) {
|
|
14526
14893
|
console.log("@supabase/gotrue-js: navigatorLock: acquire timeout, recovering by stealing lock", name);
|
|
@@ -14585,7 +14952,7 @@ async function processLock(name, acquireTimeout, fn) {
|
|
|
14585
14952
|
if (timeoutId !== null) {
|
|
14586
14953
|
clearTimeout(timeoutId);
|
|
14587
14954
|
}
|
|
14588
|
-
if (e
|
|
14955
|
+
if (e instanceof LockAcquireTimeoutError) {
|
|
14589
14956
|
throw e;
|
|
14590
14957
|
}
|
|
14591
14958
|
}
|
|
@@ -14595,7 +14962,7 @@ async function processLock(name, acquireTimeout, fn) {
|
|
|
14595
14962
|
try {
|
|
14596
14963
|
return await currentOperation;
|
|
14597
14964
|
} catch (e) {
|
|
14598
|
-
if (e
|
|
14965
|
+
if (e instanceof LockAcquireTimeoutError) {
|
|
14599
14966
|
try {
|
|
14600
14967
|
await previousOperation;
|
|
14601
14968
|
} catch (prevError) {
|
|
@@ -14608,7 +14975,7 @@ async function processLock(name, acquireTimeout, fn) {
|
|
|
14608
14975
|
return await currentOperation;
|
|
14609
14976
|
}
|
|
14610
14977
|
|
|
14611
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
14978
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/polyfills.js
|
|
14612
14979
|
function polyfillGlobalThis() {
|
|
14613
14980
|
if (typeof globalThis === "object")
|
|
14614
14981
|
return;
|
|
@@ -14628,7 +14995,7 @@ function polyfillGlobalThis() {
|
|
|
14628
14995
|
}
|
|
14629
14996
|
}
|
|
14630
14997
|
|
|
14631
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
14998
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/web3/ethereum.js
|
|
14632
14999
|
function getAddress(address) {
|
|
14633
15000
|
if (!/^0x[a-fA-F0-9]{40}$/.test(address)) {
|
|
14634
15001
|
throw new Error(`@supabase/auth-js: Address "${address}" is invalid.`);
|
|
@@ -14696,7 +15063,7 @@ Request ID: ${requestId}`;
|
|
|
14696
15063
|
${suffix}`;
|
|
14697
15064
|
}
|
|
14698
15065
|
|
|
14699
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
15066
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.errors.js
|
|
14700
15067
|
var WebAuthnError = class extends Error {
|
|
14701
15068
|
constructor({ message, code, cause, name }) {
|
|
14702
15069
|
var _a;
|
|
@@ -14705,6 +15072,13 @@ var WebAuthnError = class extends Error {
|
|
|
14705
15072
|
this.name = (_a = name !== null && name !== void 0 ? name : cause instanceof Error ? cause.name : void 0) !== null && _a !== void 0 ? _a : "Unknown Error";
|
|
14706
15073
|
this.code = code;
|
|
14707
15074
|
}
|
|
15075
|
+
toJSON() {
|
|
15076
|
+
return {
|
|
15077
|
+
name: this.name,
|
|
15078
|
+
message: this.message,
|
|
15079
|
+
code: this.code
|
|
15080
|
+
};
|
|
15081
|
+
}
|
|
14708
15082
|
};
|
|
14709
15083
|
var WebAuthnUnknownError = class extends WebAuthnError {
|
|
14710
15084
|
constructor(message, originalError) {
|
|
@@ -14864,7 +15238,7 @@ function identifyAuthenticationError({ error, options }) {
|
|
|
14864
15238
|
});
|
|
14865
15239
|
}
|
|
14866
15240
|
|
|
14867
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
15241
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/lib/webauthn.js
|
|
14868
15242
|
var WebAuthnAbortService = class {
|
|
14869
15243
|
/**
|
|
14870
15244
|
* Create an abort signal for a new WebAuthn operation.
|
|
@@ -15387,7 +15761,7 @@ var WebAuthnApi = class {
|
|
|
15387
15761
|
}
|
|
15388
15762
|
};
|
|
15389
15763
|
|
|
15390
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
15764
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/GoTrueClient.js
|
|
15391
15765
|
polyfillGlobalThis();
|
|
15392
15766
|
var DEFAULT_OPTIONS = {
|
|
15393
15767
|
url: GOTRUE_URL,
|
|
@@ -15402,7 +15776,8 @@ var DEFAULT_OPTIONS = {
|
|
|
15402
15776
|
throwOnError: false,
|
|
15403
15777
|
lockAcquireTimeout: 5e3,
|
|
15404
15778
|
// 5 seconds
|
|
15405
|
-
skipAutoInitialize: false
|
|
15779
|
+
skipAutoInitialize: false,
|
|
15780
|
+
experimental: {}
|
|
15406
15781
|
};
|
|
15407
15782
|
async function lockNoOp(name, acquireTimeout, fn) {
|
|
15408
15783
|
return await fn();
|
|
@@ -15429,19 +15804,27 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
15429
15804
|
/**
|
|
15430
15805
|
* Create a new client for use in the browser.
|
|
15431
15806
|
*
|
|
15432
|
-
* @example
|
|
15807
|
+
* @example Using supabase-js (recommended)
|
|
15808
|
+
* ```ts
|
|
15809
|
+
* import { createClient } from '@supabase/supabase-js'
|
|
15810
|
+
*
|
|
15811
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
15812
|
+
* const { data, error } = await supabase.auth.getUser()
|
|
15813
|
+
* ```
|
|
15814
|
+
*
|
|
15815
|
+
* @example Standalone import for bundle-sensitive environments
|
|
15433
15816
|
* ```ts
|
|
15434
15817
|
* import { GoTrueClient } from '@supabase/auth-js'
|
|
15435
15818
|
*
|
|
15436
15819
|
* const auth = new GoTrueClient({
|
|
15437
15820
|
* url: 'https://xyzcompany.supabase.co/auth/v1',
|
|
15438
|
-
* headers: { apikey: '
|
|
15821
|
+
* headers: { apikey: 'your-publishable-key' },
|
|
15439
15822
|
* storageKey: 'supabase-auth',
|
|
15440
15823
|
* })
|
|
15441
15824
|
* ```
|
|
15442
15825
|
*/
|
|
15443
15826
|
constructor(options) {
|
|
15444
|
-
var _a, _b, _c;
|
|
15827
|
+
var _a, _b, _c, _d;
|
|
15445
15828
|
this.userStorage = null;
|
|
15446
15829
|
this.memoryStorage = null;
|
|
15447
15830
|
this.stateChangeEmitters = /* @__PURE__ */ new Map();
|
|
@@ -15474,10 +15857,12 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
15474
15857
|
}
|
|
15475
15858
|
this.persistSession = settings.persistSession;
|
|
15476
15859
|
this.autoRefreshToken = settings.autoRefreshToken;
|
|
15860
|
+
this.experimental = (_b = settings.experimental) !== null && _b !== void 0 ? _b : {};
|
|
15477
15861
|
this.admin = new GoTrueAdminApi({
|
|
15478
15862
|
url: settings.url,
|
|
15479
15863
|
headers: settings.headers,
|
|
15480
|
-
fetch: settings.fetch
|
|
15864
|
+
fetch: settings.fetch,
|
|
15865
|
+
experimental: this.experimental
|
|
15481
15866
|
});
|
|
15482
15867
|
this.url = settings.url;
|
|
15483
15868
|
this.headers = settings.headers;
|
|
@@ -15490,7 +15875,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
15490
15875
|
this.lockAcquireTimeout = settings.lockAcquireTimeout;
|
|
15491
15876
|
if (settings.lock) {
|
|
15492
15877
|
this.lock = settings.lock;
|
|
15493
|
-
} else if (this.persistSession && isBrowser() && ((
|
|
15878
|
+
} else if (this.persistSession && isBrowser() && ((_c = globalThis === null || globalThis === void 0 ? void 0 : globalThis.navigator) === null || _c === void 0 ? void 0 : _c.locks)) {
|
|
15494
15879
|
this.lock = navigatorLock;
|
|
15495
15880
|
} else {
|
|
15496
15881
|
this.lock = lockNoOp;
|
|
@@ -15516,6 +15901,15 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
15516
15901
|
listGrants: this._listOAuthGrants.bind(this),
|
|
15517
15902
|
revokeGrant: this._revokeOAuthGrant.bind(this)
|
|
15518
15903
|
};
|
|
15904
|
+
this.passkey = {
|
|
15905
|
+
startRegistration: this._startPasskeyRegistration.bind(this),
|
|
15906
|
+
verifyRegistration: this._verifyPasskeyRegistration.bind(this),
|
|
15907
|
+
startAuthentication: this._startPasskeyAuthentication.bind(this),
|
|
15908
|
+
verifyAuthentication: this._verifyPasskeyAuthentication.bind(this),
|
|
15909
|
+
list: this._listPasskeys.bind(this),
|
|
15910
|
+
update: this._updatePasskey.bind(this),
|
|
15911
|
+
delete: this._deletePasskey.bind(this)
|
|
15912
|
+
};
|
|
15519
15913
|
if (this.persistSession) {
|
|
15520
15914
|
if (settings.storage) {
|
|
15521
15915
|
this.storage = settings.storage;
|
|
@@ -15540,7 +15934,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
15540
15934
|
} catch (e) {
|
|
15541
15935
|
console.error("Failed to create a new BroadcastChannel, multi-tab state changes will not be available", e);
|
|
15542
15936
|
}
|
|
15543
|
-
(
|
|
15937
|
+
(_d = this.broadcastChannel) === null || _d === void 0 ? void 0 : _d.addEventListener("message", async (event) => {
|
|
15544
15938
|
this._debug("received broadcast notification from other tab or client", event);
|
|
15545
15939
|
try {
|
|
15546
15940
|
await this._notifyAllSubscribers(event.data.event, event.data.session, false);
|
|
@@ -16527,7 +16921,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
16527
16921
|
}
|
|
16528
16922
|
}
|
|
16529
16923
|
async signInWithEthereum(credentials) {
|
|
16530
|
-
var _a, _b, _c, _d,
|
|
16924
|
+
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m;
|
|
16531
16925
|
let message;
|
|
16532
16926
|
let signature;
|
|
16533
16927
|
if ("message" in credentials) {
|
|
@@ -16576,11 +16970,11 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
16576
16970
|
version: "1",
|
|
16577
16971
|
chainId,
|
|
16578
16972
|
nonce: (_c = options === null || options === void 0 ? void 0 : options.signInWithEthereum) === null || _c === void 0 ? void 0 : _c.nonce,
|
|
16579
|
-
issuedAt: (
|
|
16580
|
-
expirationTime: (
|
|
16581
|
-
notBefore: (
|
|
16582
|
-
requestId: (
|
|
16583
|
-
resources: (
|
|
16973
|
+
issuedAt: (_f = (_d = options === null || options === void 0 ? void 0 : options.signInWithEthereum) === null || _d === void 0 ? void 0 : _d.issuedAt) !== null && _f !== void 0 ? _f : /* @__PURE__ */ new Date(),
|
|
16974
|
+
expirationTime: (_g = options === null || options === void 0 ? void 0 : options.signInWithEthereum) === null || _g === void 0 ? void 0 : _g.expirationTime,
|
|
16975
|
+
notBefore: (_h = options === null || options === void 0 ? void 0 : options.signInWithEthereum) === null || _h === void 0 ? void 0 : _h.notBefore,
|
|
16976
|
+
requestId: (_j = options === null || options === void 0 ? void 0 : options.signInWithEthereum) === null || _j === void 0 ? void 0 : _j.requestId,
|
|
16977
|
+
resources: (_k = options === null || options === void 0 ? void 0 : options.signInWithEthereum) === null || _k === void 0 ? void 0 : _k.resources
|
|
16584
16978
|
};
|
|
16585
16979
|
message = createSiweMessage(siweMessage);
|
|
16586
16980
|
signature = await resolvedWallet.request({
|
|
@@ -16595,7 +16989,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
16595
16989
|
chain: "ethereum",
|
|
16596
16990
|
message,
|
|
16597
16991
|
signature
|
|
16598
|
-
}, ((
|
|
16992
|
+
}, ((_l = credentials.options) === null || _l === void 0 ? void 0 : _l.captchaToken) ? { gotrue_meta_security: { captcha_token: (_m = credentials.options) === null || _m === void 0 ? void 0 : _m.captchaToken } } : null),
|
|
16599
16993
|
xform: _sessionResponse
|
|
16600
16994
|
});
|
|
16601
16995
|
if (error) {
|
|
@@ -16618,7 +17012,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
16618
17012
|
}
|
|
16619
17013
|
}
|
|
16620
17014
|
async signInWithSolana(credentials) {
|
|
16621
|
-
var _a, _b, _c, _d,
|
|
17015
|
+
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
16622
17016
|
let message;
|
|
16623
17017
|
let signature;
|
|
16624
17018
|
if ("message" in credentials) {
|
|
@@ -16676,11 +17070,11 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
16676
17070
|
`URI: ${url.href}`,
|
|
16677
17071
|
`Issued At: ${(_c = (_b = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _b === void 0 ? void 0 : _b.issuedAt) !== null && _c !== void 0 ? _c : (/* @__PURE__ */ new Date()).toISOString()}`,
|
|
16678
17072
|
...((_d = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _d === void 0 ? void 0 : _d.notBefore) ? [`Not Before: ${options.signInWithSolana.notBefore}`] : [],
|
|
16679
|
-
...((
|
|
16680
|
-
...((
|
|
16681
|
-
...((
|
|
16682
|
-
...((
|
|
16683
|
-
...((
|
|
17073
|
+
...((_f = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _f === void 0 ? void 0 : _f.expirationTime) ? [`Expiration Time: ${options.signInWithSolana.expirationTime}`] : [],
|
|
17074
|
+
...((_g = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _g === void 0 ? void 0 : _g.chainId) ? [`Chain ID: ${options.signInWithSolana.chainId}`] : [],
|
|
17075
|
+
...((_h = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _h === void 0 ? void 0 : _h.nonce) ? [`Nonce: ${options.signInWithSolana.nonce}`] : [],
|
|
17076
|
+
...((_j = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _j === void 0 ? void 0 : _j.requestId) ? [`Request ID: ${options.signInWithSolana.requestId}`] : [],
|
|
17077
|
+
...((_l = (_k = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _k === void 0 ? void 0 : _k.resources) === null || _l === void 0 ? void 0 : _l.length) ? [
|
|
16684
17078
|
"Resources",
|
|
16685
17079
|
...options.signInWithSolana.resources.map((resource) => `- ${resource}`)
|
|
16686
17080
|
] : []
|
|
@@ -16695,7 +17089,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
16695
17089
|
try {
|
|
16696
17090
|
const { data, error } = await _request(this.fetch, "POST", `${this.url}/token?grant_type=web3`, {
|
|
16697
17091
|
headers: this.headers,
|
|
16698
|
-
body: Object.assign({ chain: "solana", message, signature: bytesToBase64URL(signature) }, ((
|
|
17092
|
+
body: Object.assign({ chain: "solana", message, signature: bytesToBase64URL(signature) }, ((_m = credentials.options) === null || _m === void 0 ? void 0 : _m.captchaToken) ? { gotrue_meta_security: { captcha_token: (_o = credentials.options) === null || _o === void 0 ? void 0 : _o.captchaToken } } : null),
|
|
16699
17093
|
xform: _sessionResponse
|
|
16700
17094
|
});
|
|
16701
17095
|
if (error) {
|
|
@@ -16745,7 +17139,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
16745
17139
|
}
|
|
16746
17140
|
if (data.session) {
|
|
16747
17141
|
await this._saveSession(data.session);
|
|
16748
|
-
await this._notifyAllSubscribers("SIGNED_IN", data.session);
|
|
17142
|
+
await this._notifyAllSubscribers(redirectType === "recovery" ? "PASSWORD_RECOVERY" : "SIGNED_IN", data.session);
|
|
16749
17143
|
}
|
|
16750
17144
|
return this._returnResult({ data: Object.assign(Object.assign({}, data), { redirectType: redirectType !== null && redirectType !== void 0 ? redirectType : null }), error });
|
|
16751
17145
|
} catch (error) {
|
|
@@ -16945,7 +17339,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
16945
17339
|
* ```
|
|
16946
17340
|
*/
|
|
16947
17341
|
async signInWithOtp(credentials) {
|
|
16948
|
-
var _a, _b, _c, _d,
|
|
17342
|
+
var _a, _b, _c, _d, _f;
|
|
16949
17343
|
try {
|
|
16950
17344
|
if ("email" in credentials) {
|
|
16951
17345
|
const { email, options } = credentials;
|
|
@@ -16978,7 +17372,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
16978
17372
|
data: (_c = options === null || options === void 0 ? void 0 : options.data) !== null && _c !== void 0 ? _c : {},
|
|
16979
17373
|
create_user: (_d = options === null || options === void 0 ? void 0 : options.shouldCreateUser) !== null && _d !== void 0 ? _d : true,
|
|
16980
17374
|
gotrue_meta_security: { captcha_token: options === null || options === void 0 ? void 0 : options.captchaToken },
|
|
16981
|
-
channel: (
|
|
17375
|
+
channel: (_f = options === null || options === void 0 ? void 0 : options.channel) !== null && _f !== void 0 ? _f : "sms"
|
|
16982
17376
|
}
|
|
16983
17377
|
});
|
|
16984
17378
|
return this._returnResult({
|
|
@@ -17222,7 +17616,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
17222
17616
|
* ```
|
|
17223
17617
|
*/
|
|
17224
17618
|
async signInWithSSO(params) {
|
|
17225
|
-
var _a, _b, _c, _d,
|
|
17619
|
+
var _a, _b, _c, _d, _f;
|
|
17226
17620
|
try {
|
|
17227
17621
|
let codeChallenge = null;
|
|
17228
17622
|
let codeChallengeMethod = null;
|
|
@@ -17235,7 +17629,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
17235
17629
|
headers: this.headers,
|
|
17236
17630
|
xform: _ssoResponse
|
|
17237
17631
|
});
|
|
17238
|
-
if (((_d = result.data) === null || _d === void 0 ? void 0 : _d.url) && isBrowser() && !((
|
|
17632
|
+
if (((_d = result.data) === null || _d === void 0 ? void 0 : _d.url) && isBrowser() && !((_f = params.options) === null || _f === void 0 ? void 0 : _f.skipBrowserRedirect)) {
|
|
17239
17633
|
window.location.assign(result.data.url);
|
|
17240
17634
|
}
|
|
17241
17635
|
return this._returnResult(result);
|
|
@@ -17501,7 +17895,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
17501
17895
|
this.pendingInLock.push((async () => {
|
|
17502
17896
|
try {
|
|
17503
17897
|
await result;
|
|
17504
|
-
} catch (
|
|
17898
|
+
} catch (_e) {
|
|
17505
17899
|
}
|
|
17506
17900
|
})());
|
|
17507
17901
|
return result;
|
|
@@ -18228,6 +18622,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
18228
18622
|
* Gets the session data from a URL string
|
|
18229
18623
|
*/
|
|
18230
18624
|
async _getSessionFromURL(params, callbackUrlType) {
|
|
18625
|
+
var _a;
|
|
18231
18626
|
try {
|
|
18232
18627
|
if (!isBrowser())
|
|
18233
18628
|
throw new AuthImplicitGrantRedirectError("No browser detected.");
|
|
@@ -18260,7 +18655,10 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
18260
18655
|
const url = new URL(window.location.href);
|
|
18261
18656
|
url.searchParams.delete("code");
|
|
18262
18657
|
window.history.replaceState(window.history.state, "", url.toString());
|
|
18263
|
-
return {
|
|
18658
|
+
return {
|
|
18659
|
+
data: { session: data2.session, redirectType: (_a = data2.redirectType) !== null && _a !== void 0 ? _a : null },
|
|
18660
|
+
error: null
|
|
18661
|
+
};
|
|
18264
18662
|
}
|
|
18265
18663
|
const { provider_token, provider_refresh_token, access_token, refresh_token, expires_in, expires_at, token_type } = params;
|
|
18266
18664
|
if (!access_token || !expires_in || !refresh_token || !token_type) {
|
|
@@ -18333,24 +18731,35 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
18333
18731
|
*
|
|
18334
18732
|
* If using `others` scope, no `SIGNED_OUT` event is fired!
|
|
18335
18733
|
*
|
|
18734
|
+
* **Warning:** the default `scope` is `'global'`. This signs the user out of
|
|
18735
|
+
* **every device they are currently signed in on**, not just the current
|
|
18736
|
+
* tab/session. If you only want to sign the user out of the current session
|
|
18737
|
+
* (the behavior most other auth libraries default to), pass
|
|
18738
|
+
* `{ scope: 'local' }` explicitly.
|
|
18739
|
+
*
|
|
18336
18740
|
* @category Auth
|
|
18337
18741
|
*
|
|
18338
18742
|
* @remarks
|
|
18339
18743
|
* - In order to use the `signOut()` method, the user needs to be signed in first.
|
|
18340
|
-
* - By default, `signOut()` uses the global scope, which signs out
|
|
18744
|
+
* - By default, `signOut()` uses the **global** scope, which signs out the user
|
|
18745
|
+
* on every device they are signed in on (not just the current one). Pass
|
|
18746
|
+
* `{ scope: 'local' }` to only sign out the current session. This is
|
|
18747
|
+
* usually what apps want on a "Sign out" button, especially when users
|
|
18748
|
+
* sign in from multiple devices and do not expect signing out of one to
|
|
18749
|
+
* terminate the others.
|
|
18341
18750
|
* - Since Supabase Auth uses JWTs for authentication, the access token JWT will be valid until it's expired. When the user signs out, Supabase revokes the refresh token and deletes the JWT from the client-side. This does not revoke the JWT and it will still be valid until it expires.
|
|
18342
18751
|
*
|
|
18343
|
-
* @example Sign out (
|
|
18752
|
+
* @example Sign out of every device (global – default)
|
|
18344
18753
|
* ```js
|
|
18345
18754
|
* const { error } = await supabase.auth.signOut()
|
|
18346
18755
|
* ```
|
|
18347
18756
|
*
|
|
18348
|
-
* @example Sign out
|
|
18757
|
+
* @example Sign out only the current session (recommended for most apps)
|
|
18349
18758
|
* ```js
|
|
18350
18759
|
* const { error } = await supabase.auth.signOut({ scope: 'local' })
|
|
18351
18760
|
* ```
|
|
18352
18761
|
*
|
|
18353
|
-
* @example Sign out
|
|
18762
|
+
* @example Sign out of all other sessions, keep the current one
|
|
18354
18763
|
* ```js
|
|
18355
18764
|
* const { error } = await supabase.auth.signOut({ scope: 'others' })
|
|
18356
18765
|
* ```
|
|
@@ -18800,7 +19209,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
18800
19209
|
var _a;
|
|
18801
19210
|
try {
|
|
18802
19211
|
const { data, error } = await this._useSession(async (result) => {
|
|
18803
|
-
var _a2, _b, _c, _d,
|
|
19212
|
+
var _a2, _b, _c, _d, _f;
|
|
18804
19213
|
const { data: data2, error: error2 } = result;
|
|
18805
19214
|
if (error2)
|
|
18806
19215
|
throw error2;
|
|
@@ -18812,7 +19221,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
18812
19221
|
});
|
|
18813
19222
|
return await _request(this.fetch, "GET", url, {
|
|
18814
19223
|
headers: this.headers,
|
|
18815
|
-
jwt: (
|
|
19224
|
+
jwt: (_f = (_d = data2.session) === null || _d === void 0 ? void 0 : _d.access_token) !== null && _f !== void 0 ? _f : void 0
|
|
18816
19225
|
});
|
|
18817
19226
|
});
|
|
18818
19227
|
if (error)
|
|
@@ -19319,7 +19728,7 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
19319
19728
|
}
|
|
19320
19729
|
});
|
|
19321
19730
|
} catch (e) {
|
|
19322
|
-
if (e
|
|
19731
|
+
if (e instanceof LockAcquireTimeoutError) {
|
|
19323
19732
|
this._debug("auto refresh token tick lock not available");
|
|
19324
19733
|
} else {
|
|
19325
19734
|
throw e;
|
|
@@ -19928,20 +20337,334 @@ var GoTrueClient = class _GoTrueClient {
|
|
|
19928
20337
|
throw error;
|
|
19929
20338
|
}
|
|
19930
20339
|
}
|
|
20340
|
+
// --- Passkey Methods ---
|
|
20341
|
+
/**
|
|
20342
|
+
* Sign in with a passkey. Handles the full WebAuthn ceremony:
|
|
20343
|
+
* 1. Fetches authentication challenge from server
|
|
20344
|
+
* 2. Prompts user via navigator.credentials.get()
|
|
20345
|
+
* 3. Verifies credential with server and creates session
|
|
20346
|
+
*
|
|
20347
|
+
* Requires `auth.experimental.passkey: true`.
|
|
20348
|
+
*
|
|
20349
|
+
* @category Auth
|
|
20350
|
+
*/
|
|
20351
|
+
async signInWithPasskey(credentials) {
|
|
20352
|
+
var _a, _b, _c;
|
|
20353
|
+
assertPasskeyExperimentalEnabled(this.experimental);
|
|
20354
|
+
try {
|
|
20355
|
+
if (!browserSupportsWebAuthn()) {
|
|
20356
|
+
return this._returnResult({
|
|
20357
|
+
data: null,
|
|
20358
|
+
error: new AuthUnknownError("Browser does not support WebAuthn", null)
|
|
20359
|
+
});
|
|
20360
|
+
}
|
|
20361
|
+
const { data: options, error: optionsError } = await this._startPasskeyAuthentication({
|
|
20362
|
+
options: { captchaToken: (_a = credentials === null || credentials === void 0 ? void 0 : credentials.options) === null || _a === void 0 ? void 0 : _a.captchaToken }
|
|
20363
|
+
});
|
|
20364
|
+
if (optionsError || !options) {
|
|
20365
|
+
return this._returnResult({ data: null, error: optionsError });
|
|
20366
|
+
}
|
|
20367
|
+
const publicKeyOptions = deserializeCredentialRequestOptions(options.options);
|
|
20368
|
+
const signal = (_c = (_b = credentials === null || credentials === void 0 ? void 0 : credentials.options) === null || _b === void 0 ? void 0 : _b.signal) !== null && _c !== void 0 ? _c : webAuthnAbortService.createNewAbortSignal();
|
|
20369
|
+
const { data: credential, error: credentialError } = await getCredential({
|
|
20370
|
+
publicKey: publicKeyOptions,
|
|
20371
|
+
signal
|
|
20372
|
+
});
|
|
20373
|
+
if (credentialError || !credential) {
|
|
20374
|
+
return this._returnResult({
|
|
20375
|
+
data: null,
|
|
20376
|
+
error: credentialError !== null && credentialError !== void 0 ? credentialError : new AuthUnknownError("WebAuthn ceremony failed", null)
|
|
20377
|
+
});
|
|
20378
|
+
}
|
|
20379
|
+
const serialized = serializeCredentialRequestResponse(credential);
|
|
20380
|
+
return this._verifyPasskeyAuthentication({
|
|
20381
|
+
challengeId: options.challenge_id,
|
|
20382
|
+
credential: serialized
|
|
20383
|
+
});
|
|
20384
|
+
} catch (error) {
|
|
20385
|
+
if (isAuthError(error)) {
|
|
20386
|
+
return this._returnResult({ data: null, error });
|
|
20387
|
+
}
|
|
20388
|
+
throw error;
|
|
20389
|
+
}
|
|
20390
|
+
}
|
|
20391
|
+
/**
|
|
20392
|
+
* Register a passkey for the current authenticated user. Handles the full WebAuthn ceremony:
|
|
20393
|
+
* 1. Fetches registration challenge from server
|
|
20394
|
+
* 2. Prompts user via navigator.credentials.create()
|
|
20395
|
+
* 3. Verifies credential with server
|
|
20396
|
+
*
|
|
20397
|
+
* Requires an active session. Requires `auth.experimental.passkey: true`.
|
|
20398
|
+
*
|
|
20399
|
+
* @category Auth
|
|
20400
|
+
*/
|
|
20401
|
+
async registerPasskey(credentials) {
|
|
20402
|
+
var _a, _b;
|
|
20403
|
+
assertPasskeyExperimentalEnabled(this.experimental);
|
|
20404
|
+
try {
|
|
20405
|
+
if (!browserSupportsWebAuthn()) {
|
|
20406
|
+
return this._returnResult({
|
|
20407
|
+
data: null,
|
|
20408
|
+
error: new AuthUnknownError("Browser does not support WebAuthn", null)
|
|
20409
|
+
});
|
|
20410
|
+
}
|
|
20411
|
+
const { data: options, error: optionsError } = await this._startPasskeyRegistration();
|
|
20412
|
+
if (optionsError || !options) {
|
|
20413
|
+
return this._returnResult({ data: null, error: optionsError });
|
|
20414
|
+
}
|
|
20415
|
+
const publicKeyOptions = deserializeCredentialCreationOptions(options.options);
|
|
20416
|
+
const signal = (_b = (_a = credentials === null || credentials === void 0 ? void 0 : credentials.options) === null || _a === void 0 ? void 0 : _a.signal) !== null && _b !== void 0 ? _b : webAuthnAbortService.createNewAbortSignal();
|
|
20417
|
+
const { data: credential, error: credentialError } = await createCredential({
|
|
20418
|
+
publicKey: publicKeyOptions,
|
|
20419
|
+
signal
|
|
20420
|
+
});
|
|
20421
|
+
if (credentialError || !credential) {
|
|
20422
|
+
return this._returnResult({
|
|
20423
|
+
data: null,
|
|
20424
|
+
error: credentialError !== null && credentialError !== void 0 ? credentialError : new AuthUnknownError("WebAuthn ceremony failed", null)
|
|
20425
|
+
});
|
|
20426
|
+
}
|
|
20427
|
+
const serialized = serializeCredentialCreationResponse(credential);
|
|
20428
|
+
return this._verifyPasskeyRegistration({
|
|
20429
|
+
challengeId: options.challenge_id,
|
|
20430
|
+
credential: serialized
|
|
20431
|
+
});
|
|
20432
|
+
} catch (error) {
|
|
20433
|
+
if (isAuthError(error)) {
|
|
20434
|
+
return this._returnResult({ data: null, error });
|
|
20435
|
+
}
|
|
20436
|
+
throw error;
|
|
20437
|
+
}
|
|
20438
|
+
}
|
|
20439
|
+
/**
|
|
20440
|
+
* Start passkey registration for the current authenticated user.
|
|
20441
|
+
* Returns WebAuthn credential creation options to pass to navigator.credentials.create().
|
|
20442
|
+
*/
|
|
20443
|
+
async _startPasskeyRegistration() {
|
|
20444
|
+
assertPasskeyExperimentalEnabled(this.experimental);
|
|
20445
|
+
try {
|
|
20446
|
+
return await this._useSession(async (result) => {
|
|
20447
|
+
const { data: { session }, error: sessionError } = result;
|
|
20448
|
+
if (sessionError) {
|
|
20449
|
+
return this._returnResult({ data: null, error: sessionError });
|
|
20450
|
+
}
|
|
20451
|
+
if (!session) {
|
|
20452
|
+
return this._returnResult({ data: null, error: new AuthSessionMissingError() });
|
|
20453
|
+
}
|
|
20454
|
+
const { data, error } = await _request(this.fetch, "POST", `${this.url}/passkeys/registration/options`, {
|
|
20455
|
+
headers: this.headers,
|
|
20456
|
+
jwt: session.access_token,
|
|
20457
|
+
body: {}
|
|
20458
|
+
});
|
|
20459
|
+
if (error) {
|
|
20460
|
+
return this._returnResult({ data: null, error });
|
|
20461
|
+
}
|
|
20462
|
+
return this._returnResult({ data, error: null });
|
|
20463
|
+
});
|
|
20464
|
+
} catch (error) {
|
|
20465
|
+
if (isAuthError(error)) {
|
|
20466
|
+
return this._returnResult({ data: null, error });
|
|
20467
|
+
}
|
|
20468
|
+
throw error;
|
|
20469
|
+
}
|
|
20470
|
+
}
|
|
20471
|
+
/**
|
|
20472
|
+
* Verify passkey registration with the credential response.
|
|
20473
|
+
* The credentialResponse should be the serialized output of navigator.credentials.create().
|
|
20474
|
+
*/
|
|
20475
|
+
async _verifyPasskeyRegistration(params) {
|
|
20476
|
+
assertPasskeyExperimentalEnabled(this.experimental);
|
|
20477
|
+
try {
|
|
20478
|
+
return await this._useSession(async (result) => {
|
|
20479
|
+
const { data: { session }, error: sessionError } = result;
|
|
20480
|
+
if (sessionError) {
|
|
20481
|
+
return this._returnResult({ data: null, error: sessionError });
|
|
20482
|
+
}
|
|
20483
|
+
if (!session) {
|
|
20484
|
+
return this._returnResult({ data: null, error: new AuthSessionMissingError() });
|
|
20485
|
+
}
|
|
20486
|
+
const { data, error } = await _request(this.fetch, "POST", `${this.url}/passkeys/registration/verify`, {
|
|
20487
|
+
headers: this.headers,
|
|
20488
|
+
jwt: session.access_token,
|
|
20489
|
+
body: {
|
|
20490
|
+
challenge_id: params.challengeId,
|
|
20491
|
+
credential: params.credential
|
|
20492
|
+
}
|
|
20493
|
+
});
|
|
20494
|
+
if (error) {
|
|
20495
|
+
return this._returnResult({ data: null, error });
|
|
20496
|
+
}
|
|
20497
|
+
return this._returnResult({ data, error: null });
|
|
20498
|
+
});
|
|
20499
|
+
} catch (error) {
|
|
20500
|
+
if (isAuthError(error)) {
|
|
20501
|
+
return this._returnResult({ data: null, error });
|
|
20502
|
+
}
|
|
20503
|
+
throw error;
|
|
20504
|
+
}
|
|
20505
|
+
}
|
|
20506
|
+
/**
|
|
20507
|
+
* Start passkey authentication.
|
|
20508
|
+
* Returns WebAuthn credential request options to pass to navigator.credentials.get().
|
|
20509
|
+
*/
|
|
20510
|
+
async _startPasskeyAuthentication(params) {
|
|
20511
|
+
var _a;
|
|
20512
|
+
assertPasskeyExperimentalEnabled(this.experimental);
|
|
20513
|
+
try {
|
|
20514
|
+
const { data, error } = await _request(this.fetch, "POST", `${this.url}/passkeys/authentication/options`, {
|
|
20515
|
+
headers: this.headers,
|
|
20516
|
+
body: {
|
|
20517
|
+
gotrue_meta_security: { captcha_token: (_a = params === null || params === void 0 ? void 0 : params.options) === null || _a === void 0 ? void 0 : _a.captchaToken }
|
|
20518
|
+
}
|
|
20519
|
+
});
|
|
20520
|
+
if (error) {
|
|
20521
|
+
return this._returnResult({ data: null, error });
|
|
20522
|
+
}
|
|
20523
|
+
return this._returnResult({ data, error: null });
|
|
20524
|
+
} catch (error) {
|
|
20525
|
+
if (isAuthError(error)) {
|
|
20526
|
+
return this._returnResult({ data: null, error });
|
|
20527
|
+
}
|
|
20528
|
+
throw error;
|
|
20529
|
+
}
|
|
20530
|
+
}
|
|
20531
|
+
/**
|
|
20532
|
+
* Verify passkey authentication and create a session.
|
|
20533
|
+
* The credential should be the serialized output of navigator.credentials.get().
|
|
20534
|
+
*/
|
|
20535
|
+
async _verifyPasskeyAuthentication(params) {
|
|
20536
|
+
assertPasskeyExperimentalEnabled(this.experimental);
|
|
20537
|
+
try {
|
|
20538
|
+
const { data, error } = await _request(this.fetch, "POST", `${this.url}/passkeys/authentication/verify`, {
|
|
20539
|
+
headers: this.headers,
|
|
20540
|
+
body: {
|
|
20541
|
+
challenge_id: params.challengeId,
|
|
20542
|
+
credential: params.credential
|
|
20543
|
+
},
|
|
20544
|
+
xform: _sessionResponse
|
|
20545
|
+
});
|
|
20546
|
+
if (error) {
|
|
20547
|
+
return this._returnResult({ data: null, error });
|
|
20548
|
+
}
|
|
20549
|
+
if (data.session) {
|
|
20550
|
+
await this._saveSession(data.session);
|
|
20551
|
+
await this._notifyAllSubscribers("SIGNED_IN", data.session);
|
|
20552
|
+
}
|
|
20553
|
+
return this._returnResult({ data, error: null });
|
|
20554
|
+
} catch (error) {
|
|
20555
|
+
if (isAuthError(error)) {
|
|
20556
|
+
return this._returnResult({ data: null, error });
|
|
20557
|
+
}
|
|
20558
|
+
throw error;
|
|
20559
|
+
}
|
|
20560
|
+
}
|
|
20561
|
+
/**
|
|
20562
|
+
* List all passkeys for the current user.
|
|
20563
|
+
*/
|
|
20564
|
+
async _listPasskeys() {
|
|
20565
|
+
assertPasskeyExperimentalEnabled(this.experimental);
|
|
20566
|
+
try {
|
|
20567
|
+
return await this._useSession(async (result) => {
|
|
20568
|
+
const { data: { session }, error: sessionError } = result;
|
|
20569
|
+
if (sessionError) {
|
|
20570
|
+
return this._returnResult({ data: null, error: sessionError });
|
|
20571
|
+
}
|
|
20572
|
+
if (!session) {
|
|
20573
|
+
return this._returnResult({ data: null, error: new AuthSessionMissingError() });
|
|
20574
|
+
}
|
|
20575
|
+
const { data, error } = await _request(this.fetch, "GET", `${this.url}/passkeys`, {
|
|
20576
|
+
headers: this.headers,
|
|
20577
|
+
jwt: session.access_token,
|
|
20578
|
+
xform: (data2) => ({ data: data2, error: null })
|
|
20579
|
+
});
|
|
20580
|
+
if (error) {
|
|
20581
|
+
return this._returnResult({ data: null, error });
|
|
20582
|
+
}
|
|
20583
|
+
return this._returnResult({ data, error: null });
|
|
20584
|
+
});
|
|
20585
|
+
} catch (error) {
|
|
20586
|
+
if (isAuthError(error)) {
|
|
20587
|
+
return this._returnResult({ data: null, error });
|
|
20588
|
+
}
|
|
20589
|
+
throw error;
|
|
20590
|
+
}
|
|
20591
|
+
}
|
|
20592
|
+
/**
|
|
20593
|
+
* Update a passkey.
|
|
20594
|
+
*/
|
|
20595
|
+
async _updatePasskey(params) {
|
|
20596
|
+
assertPasskeyExperimentalEnabled(this.experimental);
|
|
20597
|
+
try {
|
|
20598
|
+
return await this._useSession(async (result) => {
|
|
20599
|
+
const { data: { session }, error: sessionError } = result;
|
|
20600
|
+
if (sessionError) {
|
|
20601
|
+
return this._returnResult({ data: null, error: sessionError });
|
|
20602
|
+
}
|
|
20603
|
+
if (!session) {
|
|
20604
|
+
return this._returnResult({ data: null, error: new AuthSessionMissingError() });
|
|
20605
|
+
}
|
|
20606
|
+
const { data, error } = await _request(this.fetch, "PATCH", `${this.url}/passkeys/${params.passkeyId}`, {
|
|
20607
|
+
headers: this.headers,
|
|
20608
|
+
jwt: session.access_token,
|
|
20609
|
+
body: { friendly_name: params.friendlyName }
|
|
20610
|
+
});
|
|
20611
|
+
if (error) {
|
|
20612
|
+
return this._returnResult({ data: null, error });
|
|
20613
|
+
}
|
|
20614
|
+
return this._returnResult({ data, error: null });
|
|
20615
|
+
});
|
|
20616
|
+
} catch (error) {
|
|
20617
|
+
if (isAuthError(error)) {
|
|
20618
|
+
return this._returnResult({ data: null, error });
|
|
20619
|
+
}
|
|
20620
|
+
throw error;
|
|
20621
|
+
}
|
|
20622
|
+
}
|
|
20623
|
+
/**
|
|
20624
|
+
* Delete a passkey.
|
|
20625
|
+
*/
|
|
20626
|
+
async _deletePasskey(params) {
|
|
20627
|
+
assertPasskeyExperimentalEnabled(this.experimental);
|
|
20628
|
+
try {
|
|
20629
|
+
return await this._useSession(async (result) => {
|
|
20630
|
+
const { data: { session }, error: sessionError } = result;
|
|
20631
|
+
if (sessionError) {
|
|
20632
|
+
return this._returnResult({ data: null, error: sessionError });
|
|
20633
|
+
}
|
|
20634
|
+
if (!session) {
|
|
20635
|
+
return this._returnResult({ data: null, error: new AuthSessionMissingError() });
|
|
20636
|
+
}
|
|
20637
|
+
const { error } = await _request(this.fetch, "DELETE", `${this.url}/passkeys/${params.passkeyId}`, {
|
|
20638
|
+
headers: this.headers,
|
|
20639
|
+
jwt: session.access_token,
|
|
20640
|
+
noResolveJson: true
|
|
20641
|
+
});
|
|
20642
|
+
if (error) {
|
|
20643
|
+
return this._returnResult({ data: null, error });
|
|
20644
|
+
}
|
|
20645
|
+
return this._returnResult({ data: null, error: null });
|
|
20646
|
+
});
|
|
20647
|
+
} catch (error) {
|
|
20648
|
+
if (isAuthError(error)) {
|
|
20649
|
+
return this._returnResult({ data: null, error });
|
|
20650
|
+
}
|
|
20651
|
+
throw error;
|
|
20652
|
+
}
|
|
20653
|
+
}
|
|
19931
20654
|
};
|
|
19932
20655
|
GoTrueClient.nextInstanceID = {};
|
|
19933
20656
|
var GoTrueClient_default = GoTrueClient;
|
|
19934
20657
|
|
|
19935
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
20658
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/AuthAdminApi.js
|
|
19936
20659
|
var AuthAdminApi = GoTrueAdminApi;
|
|
19937
20660
|
var AuthAdminApi_default = AuthAdminApi;
|
|
19938
20661
|
|
|
19939
|
-
// ../../node_modules/.pnpm/@supabase+auth-js@2.
|
|
20662
|
+
// ../../node_modules/.pnpm/@supabase+auth-js@2.106.1/node_modules/@supabase/auth-js/dist/module/AuthClient.js
|
|
19940
20663
|
var AuthClient = GoTrueClient_default;
|
|
19941
20664
|
var AuthClient_default = AuthClient;
|
|
19942
20665
|
|
|
19943
|
-
// ../../node_modules/.pnpm/@supabase+supabase-js@2.
|
|
19944
|
-
var version4 = "2.
|
|
20666
|
+
// ../../node_modules/.pnpm/@supabase+supabase-js@2.106.1/node_modules/@supabase/supabase-js/dist/index.mjs
|
|
20667
|
+
var version4 = "2.106.1";
|
|
19945
20668
|
var JS_ENV = "";
|
|
19946
20669
|
if (typeof Deno !== "undefined") JS_ENV = "deno";
|
|
19947
20670
|
else if (typeof document !== "undefined") JS_ENV = "web";
|
|
@@ -19957,6 +20680,127 @@ var DEFAULT_AUTH_OPTIONS = {
|
|
|
19957
20680
|
flowType: "implicit"
|
|
19958
20681
|
};
|
|
19959
20682
|
var DEFAULT_REALTIME_OPTIONS = {};
|
|
20683
|
+
var DEFAULT_TRACE_PROPAGATION_OPTIONS = {
|
|
20684
|
+
enabled: false,
|
|
20685
|
+
respectSamplingDecision: true
|
|
20686
|
+
};
|
|
20687
|
+
function __awaiter2(thisArg, _arguments, P, generator) {
|
|
20688
|
+
function adopt(value) {
|
|
20689
|
+
return value instanceof P ? value : new P(function(resolve) {
|
|
20690
|
+
resolve(value);
|
|
20691
|
+
});
|
|
20692
|
+
}
|
|
20693
|
+
return new (P || (P = Promise))(function(resolve, reject) {
|
|
20694
|
+
function fulfilled(value) {
|
|
20695
|
+
try {
|
|
20696
|
+
step(generator.next(value));
|
|
20697
|
+
} catch (e) {
|
|
20698
|
+
reject(e);
|
|
20699
|
+
}
|
|
20700
|
+
}
|
|
20701
|
+
function rejected(value) {
|
|
20702
|
+
try {
|
|
20703
|
+
step(generator["throw"](value));
|
|
20704
|
+
} catch (e) {
|
|
20705
|
+
reject(e);
|
|
20706
|
+
}
|
|
20707
|
+
}
|
|
20708
|
+
function step(result) {
|
|
20709
|
+
result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected);
|
|
20710
|
+
}
|
|
20711
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20712
|
+
});
|
|
20713
|
+
}
|
|
20714
|
+
var otelModulePromise = null;
|
|
20715
|
+
var OTEL_PKG = "@opentelemetry/api";
|
|
20716
|
+
function loadOtel() {
|
|
20717
|
+
if (otelModulePromise === null) otelModulePromise = import(
|
|
20718
|
+
/* webpackIgnore: true */
|
|
20719
|
+
/* turbopackIgnore: true */
|
|
20720
|
+
/* @vite-ignore */
|
|
20721
|
+
OTEL_PKG
|
|
20722
|
+
).catch(() => null);
|
|
20723
|
+
return otelModulePromise;
|
|
20724
|
+
}
|
|
20725
|
+
function extractTraceContext() {
|
|
20726
|
+
return __awaiter2(this, void 0, void 0, function* () {
|
|
20727
|
+
try {
|
|
20728
|
+
const otel = yield loadOtel();
|
|
20729
|
+
if (!otel || !otel.propagation || !otel.context) return null;
|
|
20730
|
+
const carrier = {};
|
|
20731
|
+
otel.propagation.inject(otel.context.active(), carrier);
|
|
20732
|
+
const traceparent = carrier["traceparent"];
|
|
20733
|
+
if (!traceparent) return null;
|
|
20734
|
+
return {
|
|
20735
|
+
traceparent,
|
|
20736
|
+
tracestate: carrier["tracestate"],
|
|
20737
|
+
baggage: carrier["baggage"]
|
|
20738
|
+
};
|
|
20739
|
+
} catch (_a) {
|
|
20740
|
+
return null;
|
|
20741
|
+
}
|
|
20742
|
+
});
|
|
20743
|
+
}
|
|
20744
|
+
function parseTraceParent(traceparent) {
|
|
20745
|
+
if (!traceparent || typeof traceparent !== "string") return null;
|
|
20746
|
+
const parts = traceparent.split("-");
|
|
20747
|
+
if (parts.length !== 4) return null;
|
|
20748
|
+
const [version$1, traceId, parentId, traceFlags] = parts;
|
|
20749
|
+
if (version$1.length !== 2 || traceId.length !== 32 || parentId.length !== 16 || traceFlags.length !== 2) return null;
|
|
20750
|
+
const hexRegex = /^[0-9a-f]+$/i;
|
|
20751
|
+
if (!hexRegex.test(version$1) || !hexRegex.test(traceId) || !hexRegex.test(parentId) || !hexRegex.test(traceFlags)) return null;
|
|
20752
|
+
if (traceId === "00000000000000000000000000000000" || parentId === "0000000000000000") return null;
|
|
20753
|
+
return {
|
|
20754
|
+
version: version$1,
|
|
20755
|
+
traceId,
|
|
20756
|
+
parentId,
|
|
20757
|
+
traceFlags,
|
|
20758
|
+
isSampled: (parseInt(traceFlags, 16) & 1) === 1
|
|
20759
|
+
};
|
|
20760
|
+
}
|
|
20761
|
+
function shouldPropagateToTarget(targetUrl, targets) {
|
|
20762
|
+
if (!targetUrl || !targets || targets.length === 0) return false;
|
|
20763
|
+
let url;
|
|
20764
|
+
if (targetUrl instanceof URL) url = targetUrl;
|
|
20765
|
+
else try {
|
|
20766
|
+
url = new URL(targetUrl);
|
|
20767
|
+
} catch (error) {
|
|
20768
|
+
return false;
|
|
20769
|
+
}
|
|
20770
|
+
for (const target of targets) try {
|
|
20771
|
+
if (typeof target === "string") {
|
|
20772
|
+
if (matchStringTarget(url.hostname, target)) return true;
|
|
20773
|
+
} else if (target instanceof RegExp) {
|
|
20774
|
+
if (target.test(url.hostname)) return true;
|
|
20775
|
+
} else if (typeof target === "function") {
|
|
20776
|
+
if (target(url)) return true;
|
|
20777
|
+
}
|
|
20778
|
+
} catch (error) {
|
|
20779
|
+
continue;
|
|
20780
|
+
}
|
|
20781
|
+
return false;
|
|
20782
|
+
}
|
|
20783
|
+
function matchStringTarget(hostname, target) {
|
|
20784
|
+
if (target === hostname) return true;
|
|
20785
|
+
if (target.startsWith("*.")) {
|
|
20786
|
+
const domain = target.slice(2);
|
|
20787
|
+
if (hostname.endsWith(domain)) {
|
|
20788
|
+
if (hostname === domain || hostname.endsWith("." + domain)) return true;
|
|
20789
|
+
}
|
|
20790
|
+
}
|
|
20791
|
+
return false;
|
|
20792
|
+
}
|
|
20793
|
+
function getDefaultPropagationTargets(supabaseUrl) {
|
|
20794
|
+
const targets = [];
|
|
20795
|
+
try {
|
|
20796
|
+
const url = new URL(supabaseUrl);
|
|
20797
|
+
targets.push(url.hostname);
|
|
20798
|
+
} catch (error) {
|
|
20799
|
+
}
|
|
20800
|
+
targets.push("*.supabase.co", "*.supabase.in");
|
|
20801
|
+
targets.push("localhost", "127.0.0.1", "[::1]");
|
|
20802
|
+
return targets;
|
|
20803
|
+
}
|
|
19960
20804
|
function _typeof3(o) {
|
|
19961
20805
|
"@babel/helpers - typeof";
|
|
19962
20806
|
return _typeof3 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o$1) {
|
|
@@ -20015,31 +20859,61 @@ var resolveFetch4 = (customFetch) => {
|
|
|
20015
20859
|
var resolveHeadersConstructor = () => {
|
|
20016
20860
|
return Headers;
|
|
20017
20861
|
};
|
|
20018
|
-
var fetchWithAuth = (supabaseKey, getAccessToken, customFetch) => {
|
|
20862
|
+
var fetchWithAuth = (supabaseKey, supabaseUrl, getAccessToken, customFetch, tracePropagationOptions) => {
|
|
20019
20863
|
const fetch$1 = resolveFetch4(customFetch);
|
|
20020
20864
|
const HeadersConstructor = resolveHeadersConstructor();
|
|
20865
|
+
const traceEnabled = (tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.enabled) === true;
|
|
20866
|
+
const respectSampling = (tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.respectSamplingDecision) !== false;
|
|
20867
|
+
const traceTargets = traceEnabled ? getDefaultPropagationTargets(supabaseUrl) : null;
|
|
20021
20868
|
return async (input, init) => {
|
|
20022
20869
|
var _await$getAccessToken;
|
|
20023
20870
|
const accessToken = (_await$getAccessToken = await getAccessToken()) !== null && _await$getAccessToken !== void 0 ? _await$getAccessToken : supabaseKey;
|
|
20024
20871
|
let headers = new HeadersConstructor(init === null || init === void 0 ? void 0 : init.headers);
|
|
20025
20872
|
if (!headers.has("apikey")) headers.set("apikey", supabaseKey);
|
|
20026
20873
|
if (!headers.has("Authorization")) headers.set("Authorization", `Bearer ${accessToken}`);
|
|
20874
|
+
if (traceTargets) {
|
|
20875
|
+
const traceHeaders = await getTraceHeaders(input, traceTargets, respectSampling);
|
|
20876
|
+
if (traceHeaders) {
|
|
20877
|
+
if (traceHeaders.traceparent && !headers.has("traceparent")) headers.set("traceparent", traceHeaders.traceparent);
|
|
20878
|
+
if (traceHeaders.tracestate && !headers.has("tracestate")) headers.set("tracestate", traceHeaders.tracestate);
|
|
20879
|
+
if (traceHeaders.baggage && !headers.has("baggage")) headers.set("baggage", traceHeaders.baggage);
|
|
20880
|
+
}
|
|
20881
|
+
}
|
|
20027
20882
|
return fetch$1(input, _objectSpread23(_objectSpread23({}, init), {}, { headers }));
|
|
20028
20883
|
};
|
|
20029
20884
|
};
|
|
20885
|
+
async function getTraceHeaders(input, targets, respectSampling) {
|
|
20886
|
+
if (!shouldPropagateToTarget(typeof input === "string" ? input : input instanceof URL ? input : input.url, targets)) return null;
|
|
20887
|
+
const traceContext = await extractTraceContext();
|
|
20888
|
+
if (!traceContext || !traceContext.traceparent) return null;
|
|
20889
|
+
if (respectSampling) {
|
|
20890
|
+
const parsed = parseTraceParent(traceContext.traceparent);
|
|
20891
|
+
if (parsed && !parsed.isSampled) return null;
|
|
20892
|
+
}
|
|
20893
|
+
return traceContext;
|
|
20894
|
+
}
|
|
20895
|
+
function normalizeTracePropagation(value) {
|
|
20896
|
+
return typeof value === "boolean" ? { enabled: value } : value;
|
|
20897
|
+
}
|
|
20030
20898
|
function ensureTrailingSlash(url) {
|
|
20031
20899
|
return url.endsWith("/") ? url : url + "/";
|
|
20032
20900
|
}
|
|
20033
20901
|
function applySettingDefaults(options, defaults) {
|
|
20034
|
-
var _DEFAULT_GLOBAL_OPTIO, _globalOptions$header;
|
|
20902
|
+
var _DEFAULT_GLOBAL_OPTIO, _globalOptions$header, _ref, _tracePropagationOpti, _ref2, _tracePropagationOpti2;
|
|
20035
20903
|
const { db: dbOptions, auth: authOptions, realtime: realtimeOptions, global: globalOptions } = options;
|
|
20036
20904
|
const { db: DEFAULT_DB_OPTIONS$1, auth: DEFAULT_AUTH_OPTIONS$1, realtime: DEFAULT_REALTIME_OPTIONS$1, global: DEFAULT_GLOBAL_OPTIONS$1 } = defaults;
|
|
20905
|
+
const tracePropagationOptions = normalizeTracePropagation(options.tracePropagation);
|
|
20906
|
+
const DEFAULT_TRACE_PROPAGATION_OPTIONS$1 = normalizeTracePropagation(defaults.tracePropagation);
|
|
20037
20907
|
const result = {
|
|
20038
20908
|
db: _objectSpread23(_objectSpread23({}, DEFAULT_DB_OPTIONS$1), dbOptions),
|
|
20039
20909
|
auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS$1), authOptions),
|
|
20040
20910
|
realtime: _objectSpread23(_objectSpread23({}, DEFAULT_REALTIME_OPTIONS$1), realtimeOptions),
|
|
20041
20911
|
storage: {},
|
|
20042
20912
|
global: _objectSpread23(_objectSpread23(_objectSpread23({}, DEFAULT_GLOBAL_OPTIONS$1), globalOptions), {}, { headers: _objectSpread23(_objectSpread23({}, (_DEFAULT_GLOBAL_OPTIO = DEFAULT_GLOBAL_OPTIONS$1 === null || DEFAULT_GLOBAL_OPTIONS$1 === void 0 ? void 0 : DEFAULT_GLOBAL_OPTIONS$1.headers) !== null && _DEFAULT_GLOBAL_OPTIO !== void 0 ? _DEFAULT_GLOBAL_OPTIO : {}), (_globalOptions$header = globalOptions === null || globalOptions === void 0 ? void 0 : globalOptions.headers) !== null && _globalOptions$header !== void 0 ? _globalOptions$header : {}) }),
|
|
20913
|
+
tracePropagation: {
|
|
20914
|
+
enabled: (_ref = (_tracePropagationOpti = tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.enabled) !== null && _tracePropagationOpti !== void 0 ? _tracePropagationOpti : DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === null || DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === void 0 ? void 0 : DEFAULT_TRACE_PROPAGATION_OPTIONS$1.enabled) !== null && _ref !== void 0 ? _ref : false,
|
|
20915
|
+
respectSamplingDecision: (_ref2 = (_tracePropagationOpti2 = tracePropagationOptions === null || tracePropagationOptions === void 0 ? void 0 : tracePropagationOptions.respectSamplingDecision) !== null && _tracePropagationOpti2 !== void 0 ? _tracePropagationOpti2 : DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === null || DEFAULT_TRACE_PROPAGATION_OPTIONS$1 === void 0 ? void 0 : DEFAULT_TRACE_PROPAGATION_OPTIONS$1.respectSamplingDecision) !== null && _ref2 !== void 0 ? _ref2 : true
|
|
20916
|
+
},
|
|
20043
20917
|
accessToken: async () => ""
|
|
20044
20918
|
};
|
|
20045
20919
|
if (options.accessToken) result.accessToken = options.accessToken;
|
|
@@ -20083,7 +20957,7 @@ var SupabaseClient = class {
|
|
|
20083
20957
|
* import { createClient } from '@supabase/supabase-js'
|
|
20084
20958
|
*
|
|
20085
20959
|
* // Create a single supabase client for interacting with your database
|
|
20086
|
-
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-
|
|
20960
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
20087
20961
|
* ```
|
|
20088
20962
|
*
|
|
20089
20963
|
* @example With a custom domain
|
|
@@ -20091,7 +20965,7 @@ var SupabaseClient = class {
|
|
|
20091
20965
|
* import { createClient } from '@supabase/supabase-js'
|
|
20092
20966
|
*
|
|
20093
20967
|
* // Use a custom domain as the supabase URL
|
|
20094
|
-
* const supabase = createClient('https://my-custom-domain.com', 'publishable-
|
|
20968
|
+
* const supabase = createClient('https://my-custom-domain.com', 'your-publishable-key')
|
|
20095
20969
|
* ```
|
|
20096
20970
|
*
|
|
20097
20971
|
* @example With additional parameters
|
|
@@ -20111,7 +20985,7 @@ var SupabaseClient = class {
|
|
|
20111
20985
|
* headers: { 'x-my-custom-header': 'my-app-name' },
|
|
20112
20986
|
* },
|
|
20113
20987
|
* }
|
|
20114
|
-
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-
|
|
20988
|
+
* const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", options)
|
|
20115
20989
|
* ```
|
|
20116
20990
|
*
|
|
20117
20991
|
* @exampleDescription With custom schemas
|
|
@@ -20124,7 +20998,7 @@ var SupabaseClient = class {
|
|
|
20124
20998
|
* ```js
|
|
20125
20999
|
* import { createClient } from '@supabase/supabase-js'
|
|
20126
21000
|
*
|
|
20127
|
-
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-
|
|
21001
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', {
|
|
20128
21002
|
* // Provide a custom schema. Defaults to "public".
|
|
20129
21003
|
* db: { schema: 'other_schema' }
|
|
20130
21004
|
* })
|
|
@@ -20139,7 +21013,7 @@ var SupabaseClient = class {
|
|
|
20139
21013
|
* ```js
|
|
20140
21014
|
* import { createClient } from '@supabase/supabase-js'
|
|
20141
21015
|
*
|
|
20142
|
-
* const supabase = createClient('https://xyzcompany.supabase.co', 'publishable-
|
|
21016
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key', {
|
|
20143
21017
|
* global: { fetch: fetch.bind(globalThis) }
|
|
20144
21018
|
* })
|
|
20145
21019
|
* ```
|
|
@@ -20153,7 +21027,7 @@ var SupabaseClient = class {
|
|
|
20153
21027
|
* import { createClient } from '@supabase/supabase-js'
|
|
20154
21028
|
* import AsyncStorage from "@react-native-async-storage/async-storage";
|
|
20155
21029
|
*
|
|
20156
|
-
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-
|
|
21030
|
+
* const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", {
|
|
20157
21031
|
* auth: {
|
|
20158
21032
|
* storage: AsyncStorage,
|
|
20159
21033
|
* autoRefreshToken: true,
|
|
@@ -20230,7 +21104,7 @@ var SupabaseClient = class {
|
|
|
20230
21104
|
* }
|
|
20231
21105
|
* }
|
|
20232
21106
|
*
|
|
20233
|
-
* const supabase = createClient("https://xyzcompany.supabase.co", "publishable-
|
|
21107
|
+
* const supabase = createClient("https://xyzcompany.supabase.co", "your-publishable-key", {
|
|
20234
21108
|
* auth: {
|
|
20235
21109
|
* storage: new LargeSecureStore(),
|
|
20236
21110
|
* autoRefreshToken: true,
|
|
@@ -20244,7 +21118,7 @@ var SupabaseClient = class {
|
|
|
20244
21118
|
* ```ts
|
|
20245
21119
|
* import { createClient } from '@supabase/supabase-js'
|
|
20246
21120
|
*
|
|
20247
|
-
* const supabase = createClient('https://xyzcompany.supabase.co', '
|
|
21121
|
+
* const supabase = createClient('https://xyzcompany.supabase.co', 'your-publishable-key')
|
|
20248
21122
|
*
|
|
20249
21123
|
* const { data } = await supabase.from('profiles').select('*')
|
|
20250
21124
|
* ```
|
|
@@ -20265,9 +21139,11 @@ var SupabaseClient = class {
|
|
|
20265
21139
|
db: DEFAULT_DB_OPTIONS,
|
|
20266
21140
|
realtime: DEFAULT_REALTIME_OPTIONS,
|
|
20267
21141
|
auth: _objectSpread23(_objectSpread23({}, DEFAULT_AUTH_OPTIONS), {}, { storageKey: defaultStorageKey }),
|
|
20268
|
-
global: DEFAULT_GLOBAL_OPTIONS
|
|
21142
|
+
global: DEFAULT_GLOBAL_OPTIONS,
|
|
21143
|
+
tracePropagation: DEFAULT_TRACE_PROPAGATION_OPTIONS
|
|
20269
21144
|
};
|
|
20270
21145
|
const settings = applySettingDefaults(options !== null && options !== void 0 ? options : {}, DEFAULTS);
|
|
21146
|
+
this.settings = settings;
|
|
20271
21147
|
this.storageKey = (_settings$auth$storag = settings.auth.storageKey) !== null && _settings$auth$storag !== void 0 ? _settings$auth$storag : "";
|
|
20272
21148
|
this.headers = (_settings$global$head = settings.global.headers) !== null && _settings$global$head !== void 0 ? _settings$global$head : {};
|
|
20273
21149
|
if (!settings.accessToken) {
|
|
@@ -20279,10 +21155,11 @@ var SupabaseClient = class {
|
|
|
20279
21155
|
throw new Error(`@supabase/supabase-js: Supabase Client is configured with the accessToken option, accessing supabase.auth.${String(prop)} is not possible`);
|
|
20280
21156
|
} });
|
|
20281
21157
|
}
|
|
20282
|
-
this.fetch = fetchWithAuth(supabaseKey, this._getAccessToken.bind(this), settings.global.fetch);
|
|
21158
|
+
this.fetch = fetchWithAuth(supabaseKey, supabaseUrl, this._getAccessToken.bind(this), settings.global.fetch, settings.tracePropagation);
|
|
20283
21159
|
this.realtime = this._initRealtimeClient(_objectSpread23({
|
|
20284
21160
|
headers: this.headers,
|
|
20285
|
-
accessToken: this._getAccessToken.bind(this)
|
|
21161
|
+
accessToken: this._getAccessToken.bind(this),
|
|
21162
|
+
fetch: this.fetch
|
|
20286
21163
|
}, settings.realtime));
|
|
20287
21164
|
if (this.accessToken) Promise.resolve(this.accessToken()).then((token) => this.realtime.setAuth(token)).catch((e) => console.warn("Failed to set initial Realtime auth token:", e));
|
|
20288
21165
|
this.rest = new PostgrestClient(new URL("rest/v1", baseUrl).href, {
|
|
@@ -20358,6 +21235,7 @@ var SupabaseClient = class {
|
|
|
20358
21235
|
* @param {string} name - The name of the Realtime channel.
|
|
20359
21236
|
* @param {Object} opts - The options to pass to the Realtime channel.
|
|
20360
21237
|
*
|
|
21238
|
+
* @category Realtime
|
|
20361
21239
|
*/
|
|
20362
21240
|
channel(name, opts = { config: {} }) {
|
|
20363
21241
|
return this.realtime.channel(name, opts);
|
|
@@ -20365,7 +21243,7 @@ var SupabaseClient = class {
|
|
|
20365
21243
|
/**
|
|
20366
21244
|
* Returns all Realtime channels.
|
|
20367
21245
|
*
|
|
20368
|
-
* @category
|
|
21246
|
+
* @category Realtime
|
|
20369
21247
|
*
|
|
20370
21248
|
* @example Get all channels
|
|
20371
21249
|
* ```js
|
|
@@ -20381,7 +21259,7 @@ var SupabaseClient = class {
|
|
|
20381
21259
|
* @param {RealtimeChannel} channel - The name of the Realtime channel.
|
|
20382
21260
|
*
|
|
20383
21261
|
*
|
|
20384
|
-
* @category
|
|
21262
|
+
* @category Realtime
|
|
20385
21263
|
*
|
|
20386
21264
|
* @remarks
|
|
20387
21265
|
* - Removing a channel is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.
|
|
@@ -20397,7 +21275,7 @@ var SupabaseClient = class {
|
|
|
20397
21275
|
/**
|
|
20398
21276
|
* Unsubscribes and removes all Realtime channels from Realtime client.
|
|
20399
21277
|
*
|
|
20400
|
-
* @category
|
|
21278
|
+
* @category Realtime
|
|
20401
21279
|
*
|
|
20402
21280
|
* @remarks
|
|
20403
21281
|
* - Removing channels is a great way to maintain the performance of your project's Realtime service as well as your database if you're listening to Postgres changes. Supabase will automatically handle cleanup 30 seconds after a client is disconnected, but unused channels may cause degradation as more clients are simultaneously subscribed.
|
|
@@ -20417,7 +21295,7 @@ var SupabaseClient = class {
|
|
|
20417
21295
|
const { data } = await _this.auth.getSession();
|
|
20418
21296
|
return (_data$session$access_ = (_data$session = data.session) === null || _data$session === void 0 ? void 0 : _data$session.access_token) !== null && _data$session$access_ !== void 0 ? _data$session$access_ : _this.supabaseKey;
|
|
20419
21297
|
}
|
|
20420
|
-
_initSupabaseAuthClient({ autoRefreshToken, persistSession, detectSessionInUrl, storage, userStorage, storageKey, flowType, lock, debug, throwOnError }, headers, fetch$1) {
|
|
21298
|
+
_initSupabaseAuthClient({ autoRefreshToken, persistSession, detectSessionInUrl, storage, userStorage, storageKey, flowType, lock, debug, throwOnError, experimental, lockAcquireTimeout, skipAutoInitialize }, headers, fetch$1) {
|
|
20421
21299
|
const authHeaders = {
|
|
20422
21300
|
Authorization: `Bearer ${this.supabaseKey}`,
|
|
20423
21301
|
apikey: `${this.supabaseKey}`
|
|
@@ -20435,7 +21313,10 @@ var SupabaseClient = class {
|
|
|
20435
21313
|
lock,
|
|
20436
21314
|
debug,
|
|
20437
21315
|
throwOnError,
|
|
21316
|
+
experimental,
|
|
20438
21317
|
fetch: fetch$1,
|
|
21318
|
+
lockAcquireTimeout,
|
|
21319
|
+
skipAutoInitialize,
|
|
20439
21320
|
hasCustomAuthorizationHeader: Object.keys(this.headers).some((key) => key.toLowerCase() === "authorization")
|
|
20440
21321
|
});
|
|
20441
21322
|
}
|
|
@@ -20522,4 +21403,4 @@ export {
|
|
|
20522
21403
|
SupabaseClient,
|
|
20523
21404
|
createClient
|
|
20524
21405
|
};
|
|
20525
|
-
//# sourceMappingURL=chunk-
|
|
21406
|
+
//# sourceMappingURL=chunk-3JGO32FA.js.map
|