@supabase/gotrue-js 2.2.4 → 2.3.1
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/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/main/GoTrueAdminApi.js.map +1 -1
- package/dist/main/GoTrueClient.d.ts +21 -1
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +47 -2
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/lib/errors.d.ts +1 -0
- package/dist/main/lib/errors.d.ts.map +1 -1
- package/dist/main/lib/errors.js +5 -1
- package/dist/main/lib/errors.js.map +1 -1
- package/dist/main/lib/fetch.d.ts +2 -1
- package/dist/main/lib/fetch.d.ts.map +1 -1
- package/dist/main/lib/fetch.js +8 -4
- package/dist/main/lib/fetch.js.map +1 -1
- package/dist/main/lib/types.d.ts +24 -0
- package/dist/main/lib/types.d.ts.map +1 -1
- package/dist/main/lib/version.d.ts +1 -1
- package/dist/main/lib/version.js +1 -1
- package/dist/module/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/module/GoTrueAdminApi.js.map +1 -1
- package/dist/module/GoTrueClient.d.ts +21 -1
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +49 -4
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/lib/errors.d.ts +1 -0
- package/dist/module/lib/errors.d.ts.map +1 -1
- package/dist/module/lib/errors.js +3 -0
- package/dist/module/lib/errors.js.map +1 -1
- package/dist/module/lib/fetch.d.ts +2 -1
- package/dist/module/lib/fetch.d.ts.map +1 -1
- package/dist/module/lib/fetch.js +6 -3
- package/dist/module/lib/fetch.js.map +1 -1
- package/dist/module/lib/types.d.ts +24 -0
- package/dist/module/lib/types.d.ts.map +1 -1
- package/dist/module/lib/version.d.ts +1 -1
- package/dist/module/lib/version.js +1 -1
- package/package.json +1 -1
- package/src/GoTrueAdminApi.ts +0 -1
- package/src/GoTrueClient.ts +55 -2
- package/src/lib/errors.ts +4 -0
- package/src/lib/fetch.ts +6 -1
- package/src/lib/types.ts +31 -0
- package/src/lib/version.ts +1 -1
package/src/lib/fetch.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { expiresAt, looksLikeFetchResponse } from './helpers'
|
|
2
2
|
import {
|
|
3
3
|
AuthResponse,
|
|
4
|
+
SSOResponse,
|
|
4
5
|
GenerateLinkProperties,
|
|
5
6
|
GenerateLinkResponse,
|
|
6
7
|
User,
|
|
@@ -81,7 +82,7 @@ export async function _request(
|
|
|
81
82
|
url: string,
|
|
82
83
|
options?: GotrueRequestOptions
|
|
83
84
|
) {
|
|
84
|
-
const headers = options?.headers
|
|
85
|
+
const headers = { ...options?.headers }
|
|
85
86
|
if (options?.jwt) {
|
|
86
87
|
headers['Authorization'] = `Bearer ${options.jwt}`
|
|
87
88
|
}
|
|
@@ -136,6 +137,10 @@ export function _userResponse(data: any): UserResponse {
|
|
|
136
137
|
return { data: { user }, error: null }
|
|
137
138
|
}
|
|
138
139
|
|
|
140
|
+
export function _ssoResponse(data: any): SSOResponse {
|
|
141
|
+
return { data, error: null }
|
|
142
|
+
}
|
|
143
|
+
|
|
139
144
|
export function _generateLinkResponse(data: any): GenerateLinkResponse {
|
|
140
145
|
const { action_link, email_otp, hashed_token, redirect_to, verification_type, ...rest } = data
|
|
141
146
|
|
package/src/lib/types.ts
CHANGED
|
@@ -85,6 +85,19 @@ export type OAuthResponse =
|
|
|
85
85
|
error: AuthError
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
export type SSOResponse =
|
|
89
|
+
| {
|
|
90
|
+
data: {
|
|
91
|
+
/** URL to take the user to (in a browser) to complete SSO. */
|
|
92
|
+
url: string
|
|
93
|
+
}
|
|
94
|
+
error: null
|
|
95
|
+
}
|
|
96
|
+
| {
|
|
97
|
+
data: null
|
|
98
|
+
error: AuthError
|
|
99
|
+
}
|
|
100
|
+
|
|
88
101
|
export type UserResponse =
|
|
89
102
|
| {
|
|
90
103
|
data: {
|
|
@@ -466,6 +479,24 @@ export interface VerifyEmailOtpParams {
|
|
|
466
479
|
export type MobileOtpType = 'sms' | 'phone_change'
|
|
467
480
|
export type EmailOtpType = 'signup' | 'invite' | 'magiclink' | 'recovery' | 'email_change'
|
|
468
481
|
|
|
482
|
+
export type SignInWithSSO = {
|
|
483
|
+
options?: {
|
|
484
|
+
/** A URL to send the user to after they have signed-in. */
|
|
485
|
+
redirectTo?: string
|
|
486
|
+
/** Verification token received when the user completes the captcha on the site. */
|
|
487
|
+
captchaToken?: string
|
|
488
|
+
}
|
|
489
|
+
} & (
|
|
490
|
+
| {
|
|
491
|
+
/** UUID of the SSO provider to invoke single-sign on to. */
|
|
492
|
+
providerId: string
|
|
493
|
+
}
|
|
494
|
+
| {
|
|
495
|
+
/** Domain name of the organization for which to invoke single-sign on. */
|
|
496
|
+
domain: string
|
|
497
|
+
}
|
|
498
|
+
)
|
|
499
|
+
|
|
469
500
|
export type GenerateSignupLinkParams = {
|
|
470
501
|
type: 'signup'
|
|
471
502
|
email: string
|
package/src/lib/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '2.
|
|
2
|
+
export const version = '2.3.1'
|