@supabase/gotrue-js 3.0.0-next.17 → 3.0.0-next.19
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/main/GoTrueClient.js +24 -24
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/fetch.d.ts +27 -7
- package/dist/main/lib/fetch.d.ts.map +1 -1
- package/dist/main/lib/fetch.js +15 -2
- package/dist/main/lib/fetch.js.map +1 -1
- package/dist/main/lib/helpers.js +2 -2
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/locks.d.ts.map +1 -1
- package/dist/main/lib/locks.js +8 -3
- package/dist/main/lib/locks.js.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/module/GoTrueClient.js +24 -24
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/fetch.d.ts +27 -7
- package/dist/module/lib/fetch.d.ts.map +1 -1
- package/dist/module/lib/fetch.js +15 -2
- package/dist/module/lib/fetch.js.map +1 -1
- package/dist/module/lib/helpers.js +2 -2
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/locks.d.ts.map +1 -1
- package/dist/module/lib/locks.js +8 -3
- package/dist/module/lib/locks.js.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/dist/tsconfig.module.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/GoTrueClient.ts +7 -7
- package/src/lib/fetch.ts +52 -18
- package/src/lib/helpers.ts +3 -3
- package/src/lib/locks.ts +14 -7
- package/src/lib/version.ts +1 -1
|
@@ -1225,7 +1225,7 @@ class GoTrueClient {
|
|
|
1225
1225
|
}
|
|
1226
1226
|
}
|
|
1227
1227
|
async signInWithEthereum(credentials) {
|
|
1228
|
-
var _a, _b, _c, _d,
|
|
1228
|
+
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m;
|
|
1229
1229
|
// TODO: flatten type
|
|
1230
1230
|
let message;
|
|
1231
1231
|
let signature;
|
|
@@ -1285,11 +1285,11 @@ class GoTrueClient {
|
|
|
1285
1285
|
version: '1',
|
|
1286
1286
|
chainId: chainId,
|
|
1287
1287
|
nonce: (_c = options === null || options === void 0 ? void 0 : options.signInWithEthereum) === null || _c === void 0 ? void 0 : _c.nonce,
|
|
1288
|
-
issuedAt: (
|
|
1289
|
-
expirationTime: (
|
|
1290
|
-
notBefore: (
|
|
1291
|
-
requestId: (
|
|
1292
|
-
resources: (
|
|
1288
|
+
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 : new Date(),
|
|
1289
|
+
expirationTime: (_g = options === null || options === void 0 ? void 0 : options.signInWithEthereum) === null || _g === void 0 ? void 0 : _g.expirationTime,
|
|
1290
|
+
notBefore: (_h = options === null || options === void 0 ? void 0 : options.signInWithEthereum) === null || _h === void 0 ? void 0 : _h.notBefore,
|
|
1291
|
+
requestId: (_j = options === null || options === void 0 ? void 0 : options.signInWithEthereum) === null || _j === void 0 ? void 0 : _j.requestId,
|
|
1292
|
+
resources: (_k = options === null || options === void 0 ? void 0 : options.signInWithEthereum) === null || _k === void 0 ? void 0 : _k.resources,
|
|
1293
1293
|
};
|
|
1294
1294
|
message = (0, ethereum_1.createSiweMessage)(siweMessage);
|
|
1295
1295
|
// Sign message
|
|
@@ -1302,8 +1302,8 @@ class GoTrueClient {
|
|
|
1302
1302
|
const { data, error } = await (0, fetch_1._request)(this.fetch, 'POST', `${this.url}/token?grant_type=web3`, {
|
|
1303
1303
|
headers: this.headers,
|
|
1304
1304
|
body: Object.assign({ chain: 'ethereum', message,
|
|
1305
|
-
signature }, (((
|
|
1306
|
-
? { gotrue_meta_security: { captcha_token: (
|
|
1305
|
+
signature }, (((_l = credentials.options) === null || _l === void 0 ? void 0 : _l.captchaToken)
|
|
1306
|
+
? { gotrue_meta_security: { captcha_token: (_m = credentials.options) === null || _m === void 0 ? void 0 : _m.captchaToken } }
|
|
1307
1307
|
: null)),
|
|
1308
1308
|
xform: fetch_1._sessionResponse,
|
|
1309
1309
|
});
|
|
@@ -1328,7 +1328,7 @@ class GoTrueClient {
|
|
|
1328
1328
|
}
|
|
1329
1329
|
}
|
|
1330
1330
|
async signInWithSolana(credentials) {
|
|
1331
|
-
var _a, _b, _c, _d,
|
|
1331
|
+
var _a, _b, _c, _d, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
1332
1332
|
let message;
|
|
1333
1333
|
let signature;
|
|
1334
1334
|
if ('message' in credentials) {
|
|
@@ -1413,17 +1413,17 @@ class GoTrueClient {
|
|
|
1413
1413
|
...(((_d = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _d === void 0 ? void 0 : _d.notBefore)
|
|
1414
1414
|
? [`Not Before: ${options.signInWithSolana.notBefore}`]
|
|
1415
1415
|
: []),
|
|
1416
|
-
...(((
|
|
1416
|
+
...(((_f = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _f === void 0 ? void 0 : _f.expirationTime)
|
|
1417
1417
|
? [`Expiration Time: ${options.signInWithSolana.expirationTime}`]
|
|
1418
1418
|
: []),
|
|
1419
|
-
...(((
|
|
1419
|
+
...(((_g = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _g === void 0 ? void 0 : _g.chainId)
|
|
1420
1420
|
? [`Chain ID: ${options.signInWithSolana.chainId}`]
|
|
1421
1421
|
: []),
|
|
1422
|
-
...(((
|
|
1423
|
-
...(((
|
|
1422
|
+
...(((_h = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _h === void 0 ? void 0 : _h.nonce) ? [`Nonce: ${options.signInWithSolana.nonce}`] : []),
|
|
1423
|
+
...(((_j = options === null || options === void 0 ? void 0 : options.signInWithSolana) === null || _j === void 0 ? void 0 : _j.requestId)
|
|
1424
1424
|
? [`Request ID: ${options.signInWithSolana.requestId}`]
|
|
1425
1425
|
: []),
|
|
1426
|
-
...(((
|
|
1426
|
+
...(((_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)
|
|
1427
1427
|
? [
|
|
1428
1428
|
'Resources',
|
|
1429
1429
|
...options.signInWithSolana.resources.map((resource) => `- ${resource}`),
|
|
@@ -1440,8 +1440,8 @@ class GoTrueClient {
|
|
|
1440
1440
|
try {
|
|
1441
1441
|
const { data, error } = await (0, fetch_1._request)(this.fetch, 'POST', `${this.url}/token?grant_type=web3`, {
|
|
1442
1442
|
headers: this.headers,
|
|
1443
|
-
body: Object.assign({ chain: 'solana', message, signature: (0, base64url_1.bytesToBase64URL)(signature) }, (((
|
|
1444
|
-
? { gotrue_meta_security: { captcha_token: (
|
|
1443
|
+
body: Object.assign({ chain: 'solana', message, signature: (0, base64url_1.bytesToBase64URL)(signature) }, (((_m = credentials.options) === null || _m === void 0 ? void 0 : _m.captchaToken)
|
|
1444
|
+
? { gotrue_meta_security: { captcha_token: (_o = credentials.options) === null || _o === void 0 ? void 0 : _o.captchaToken } }
|
|
1445
1445
|
: null)),
|
|
1446
1446
|
xform: fetch_1._sessionResponse,
|
|
1447
1447
|
});
|
|
@@ -1696,7 +1696,7 @@ class GoTrueClient {
|
|
|
1696
1696
|
* ```
|
|
1697
1697
|
*/
|
|
1698
1698
|
async signInWithOtp(credentials) {
|
|
1699
|
-
var _a, _b, _c, _d,
|
|
1699
|
+
var _a, _b, _c, _d, _f;
|
|
1700
1700
|
try {
|
|
1701
1701
|
if ('email' in credentials) {
|
|
1702
1702
|
const { email, options } = credentials;
|
|
@@ -1729,7 +1729,7 @@ class GoTrueClient {
|
|
|
1729
1729
|
data: (_c = options === null || options === void 0 ? void 0 : options.data) !== null && _c !== void 0 ? _c : {},
|
|
1730
1730
|
create_user: (_d = options === null || options === void 0 ? void 0 : options.shouldCreateUser) !== null && _d !== void 0 ? _d : true,
|
|
1731
1731
|
gotrue_meta_security: { captcha_token: options === null || options === void 0 ? void 0 : options.captchaToken },
|
|
1732
|
-
channel: (
|
|
1732
|
+
channel: (_f = options === null || options === void 0 ? void 0 : options.channel) !== null && _f !== void 0 ? _f : 'sms',
|
|
1733
1733
|
},
|
|
1734
1734
|
});
|
|
1735
1735
|
return this._returnResult({
|
|
@@ -1975,7 +1975,7 @@ class GoTrueClient {
|
|
|
1975
1975
|
* ```
|
|
1976
1976
|
*/
|
|
1977
1977
|
async signInWithSSO(params) {
|
|
1978
|
-
var _a, _b, _c, _d,
|
|
1978
|
+
var _a, _b, _c, _d, _f;
|
|
1979
1979
|
try {
|
|
1980
1980
|
let codeChallenge = null;
|
|
1981
1981
|
let codeChallengeMethod = null;
|
|
@@ -1991,7 +1991,7 @@ class GoTrueClient {
|
|
|
1991
1991
|
xform: fetch_1._ssoResponse,
|
|
1992
1992
|
});
|
|
1993
1993
|
// Automatically redirect in browser unless skipBrowserRedirect is true
|
|
1994
|
-
if (((_d = result.data) === null || _d === void 0 ? void 0 : _d.url) && (0, helpers_1.isBrowser)() && !((
|
|
1994
|
+
if (((_d = result.data) === null || _d === void 0 ? void 0 : _d.url) && (0, helpers_1.isBrowser)() && !((_f = params.options) === null || _f === void 0 ? void 0 : _f.skipBrowserRedirect)) {
|
|
1995
1995
|
window.location.assign(result.data.url);
|
|
1996
1996
|
}
|
|
1997
1997
|
return this._returnResult(result);
|
|
@@ -2264,7 +2264,7 @@ class GoTrueClient {
|
|
|
2264
2264
|
try {
|
|
2265
2265
|
await result;
|
|
2266
2266
|
}
|
|
2267
|
-
catch (
|
|
2267
|
+
catch (_e) {
|
|
2268
2268
|
// we just care if it finished
|
|
2269
2269
|
}
|
|
2270
2270
|
})());
|
|
@@ -3622,7 +3622,7 @@ class GoTrueClient {
|
|
|
3622
3622
|
var _a;
|
|
3623
3623
|
try {
|
|
3624
3624
|
const { data, error } = await this._useSession(async (result) => {
|
|
3625
|
-
var _a, _b, _c, _d,
|
|
3625
|
+
var _a, _b, _c, _d, _f;
|
|
3626
3626
|
const { data, error } = result;
|
|
3627
3627
|
if (error)
|
|
3628
3628
|
throw error;
|
|
@@ -3634,7 +3634,7 @@ class GoTrueClient {
|
|
|
3634
3634
|
});
|
|
3635
3635
|
return await (0, fetch_1._request)(this.fetch, 'GET', url, {
|
|
3636
3636
|
headers: this.headers,
|
|
3637
|
-
jwt: (
|
|
3637
|
+
jwt: (_f = (_d = data.session) === null || _d === void 0 ? void 0 : _d.access_token) !== null && _f !== void 0 ? _f : undefined,
|
|
3638
3638
|
});
|
|
3639
3639
|
});
|
|
3640
3640
|
if (error)
|
|
@@ -4217,7 +4217,7 @@ class GoTrueClient {
|
|
|
4217
4217
|
});
|
|
4218
4218
|
}
|
|
4219
4219
|
catch (e) {
|
|
4220
|
-
if (e
|
|
4220
|
+
if (e instanceof locks_1.LockAcquireTimeoutError) {
|
|
4221
4221
|
this._debug('auto refresh token tick lock not available');
|
|
4222
4222
|
}
|
|
4223
4223
|
else {
|