@supabase/auth-js 2.106.1-beta.1 → 2.106.1-beta.3
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 +1 -0
- package/dist/main/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/main/GoTrueAdminApi.js +20 -7
- package/dist/main/GoTrueAdminApi.js.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 +1 -0
- package/dist/module/GoTrueAdminApi.d.ts.map +1 -1
- package/dist/module/GoTrueAdminApi.js +21 -8
- package/dist/module/GoTrueAdminApi.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/GoTrueAdminApi.ts +72 -32
- package/src/lib/version.ts +1 -1
package/package.json
CHANGED
package/src/GoTrueAdminApi.ts
CHANGED
|
@@ -65,6 +65,14 @@ export default class GoTrueAdminApi {
|
|
|
65
65
|
protected headers: {
|
|
66
66
|
[key: string]: string
|
|
67
67
|
}
|
|
68
|
+
|
|
69
|
+
private _encodePathSegment(segment: string): string {
|
|
70
|
+
if (segment === '.' || segment === '..') {
|
|
71
|
+
throw new AuthError('Invalid path segment')
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return encodeURIComponent(segment)
|
|
75
|
+
}
|
|
68
76
|
protected fetch: Fetch
|
|
69
77
|
protected experimental: ExperimentalFeatureFlags
|
|
70
78
|
|
|
@@ -982,12 +990,18 @@ export default class GoTrueAdminApi {
|
|
|
982
990
|
*/
|
|
983
991
|
private async _getOAuthClient(clientId: string): Promise<OAuthClientResponse> {
|
|
984
992
|
try {
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
}
|
|
990
|
-
|
|
993
|
+
const encodedClientId = this._encodePathSegment(clientId)
|
|
994
|
+
return await _request(
|
|
995
|
+
this.fetch,
|
|
996
|
+
'GET',
|
|
997
|
+
`${this.url}/admin/oauth/clients/${encodedClientId}`,
|
|
998
|
+
{
|
|
999
|
+
headers: this.headers,
|
|
1000
|
+
xform: (client: any) => {
|
|
1001
|
+
return { data: client, error: null }
|
|
1002
|
+
},
|
|
1003
|
+
}
|
|
1004
|
+
)
|
|
991
1005
|
} catch (error) {
|
|
992
1006
|
if (isAuthError(error)) {
|
|
993
1007
|
return { data: null, error }
|
|
@@ -1008,13 +1022,19 @@ export default class GoTrueAdminApi {
|
|
|
1008
1022
|
params: UpdateOAuthClientParams
|
|
1009
1023
|
): Promise<OAuthClientResponse> {
|
|
1010
1024
|
try {
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1025
|
+
const encodedClientId = this._encodePathSegment(clientId)
|
|
1026
|
+
return await _request(
|
|
1027
|
+
this.fetch,
|
|
1028
|
+
'PUT',
|
|
1029
|
+
`${this.url}/admin/oauth/clients/${encodedClientId}`,
|
|
1030
|
+
{
|
|
1031
|
+
body: params,
|
|
1032
|
+
headers: this.headers,
|
|
1033
|
+
xform: (client: any) => {
|
|
1034
|
+
return { data: client, error: null }
|
|
1035
|
+
},
|
|
1036
|
+
}
|
|
1037
|
+
)
|
|
1018
1038
|
} catch (error) {
|
|
1019
1039
|
if (isAuthError(error)) {
|
|
1020
1040
|
return { data: null, error }
|
|
@@ -1034,7 +1054,8 @@ export default class GoTrueAdminApi {
|
|
|
1034
1054
|
clientId: string
|
|
1035
1055
|
): Promise<{ data: null; error: AuthError | null }> {
|
|
1036
1056
|
try {
|
|
1037
|
-
|
|
1057
|
+
const encodedClientId = this._encodePathSegment(clientId)
|
|
1058
|
+
await _request(this.fetch, 'DELETE', `${this.url}/admin/oauth/clients/${encodedClientId}`, {
|
|
1038
1059
|
headers: this.headers,
|
|
1039
1060
|
noResolveJson: true,
|
|
1040
1061
|
})
|
|
@@ -1056,10 +1077,11 @@ export default class GoTrueAdminApi {
|
|
|
1056
1077
|
*/
|
|
1057
1078
|
private async _regenerateOAuthClientSecret(clientId: string): Promise<OAuthClientResponse> {
|
|
1058
1079
|
try {
|
|
1080
|
+
const encodedClientId = this._encodePathSegment(clientId)
|
|
1059
1081
|
return await _request(
|
|
1060
1082
|
this.fetch,
|
|
1061
1083
|
'POST',
|
|
1062
|
-
`${this.url}/admin/oauth/clients/${
|
|
1084
|
+
`${this.url}/admin/oauth/clients/${encodedClientId}/regenerate_secret`,
|
|
1063
1085
|
{
|
|
1064
1086
|
headers: this.headers,
|
|
1065
1087
|
xform: (client: any) => {
|
|
@@ -1141,12 +1163,18 @@ export default class GoTrueAdminApi {
|
|
|
1141
1163
|
*/
|
|
1142
1164
|
private async _getCustomProvider(identifier: string): Promise<CustomProviderResponse> {
|
|
1143
1165
|
try {
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
}
|
|
1149
|
-
|
|
1166
|
+
const encodedIdentifier = this._encodePathSegment(identifier)
|
|
1167
|
+
return await _request(
|
|
1168
|
+
this.fetch,
|
|
1169
|
+
'GET',
|
|
1170
|
+
`${this.url}/admin/custom-providers/${encodedIdentifier}`,
|
|
1171
|
+
{
|
|
1172
|
+
headers: this.headers,
|
|
1173
|
+
xform: (provider: any) => {
|
|
1174
|
+
return { data: provider, error: null }
|
|
1175
|
+
},
|
|
1176
|
+
}
|
|
1177
|
+
)
|
|
1150
1178
|
} catch (error) {
|
|
1151
1179
|
if (isAuthError(error)) {
|
|
1152
1180
|
return { data: null, error }
|
|
@@ -1170,13 +1198,19 @@ export default class GoTrueAdminApi {
|
|
|
1170
1198
|
params: UpdateCustomProviderParams
|
|
1171
1199
|
): Promise<CustomProviderResponse> {
|
|
1172
1200
|
try {
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1201
|
+
const encodedIdentifier = this._encodePathSegment(identifier)
|
|
1202
|
+
return await _request(
|
|
1203
|
+
this.fetch,
|
|
1204
|
+
'PUT',
|
|
1205
|
+
`${this.url}/admin/custom-providers/${encodedIdentifier}`,
|
|
1206
|
+
{
|
|
1207
|
+
body: params,
|
|
1208
|
+
headers: this.headers,
|
|
1209
|
+
xform: (provider: any) => {
|
|
1210
|
+
return { data: provider, error: null }
|
|
1211
|
+
},
|
|
1212
|
+
}
|
|
1213
|
+
)
|
|
1180
1214
|
} catch (error) {
|
|
1181
1215
|
if (isAuthError(error)) {
|
|
1182
1216
|
return { data: null, error }
|
|
@@ -1194,10 +1228,16 @@ export default class GoTrueAdminApi {
|
|
|
1194
1228
|
identifier: string
|
|
1195
1229
|
): Promise<{ data: null; error: AuthError | null }> {
|
|
1196
1230
|
try {
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1231
|
+
const encodedIdentifier = this._encodePathSegment(identifier)
|
|
1232
|
+
await _request(
|
|
1233
|
+
this.fetch,
|
|
1234
|
+
'DELETE',
|
|
1235
|
+
`${this.url}/admin/custom-providers/${encodedIdentifier}`,
|
|
1236
|
+
{
|
|
1237
|
+
headers: this.headers,
|
|
1238
|
+
noResolveJson: true,
|
|
1239
|
+
}
|
|
1240
|
+
)
|
|
1201
1241
|
return { data: null, error: null }
|
|
1202
1242
|
} catch (error) {
|
|
1203
1243
|
if (isAuthError(error)) {
|
package/src/lib/version.ts
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
// - Debugging and support (identifying which version is running)
|
|
5
5
|
// - Telemetry and logging (version reporting in errors/analytics)
|
|
6
6
|
// - Ensuring build artifacts match the published package version
|
|
7
|
-
export const version = '2.106.1-beta.
|
|
7
|
+
export const version = '2.106.1-beta.3'
|