@supabase/gotrue-js 1.23.0-next.9 → 2.0.0-rc.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 +101 -0
- package/dist/main/GoTrueAdminApi.d.ts.map +1 -0
- package/dist/main/GoTrueAdminApi.js +213 -0
- package/dist/main/GoTrueAdminApi.js.map +1 -0
- package/dist/main/GoTrueClient.d.ts +76 -101
- package/dist/main/GoTrueClient.d.ts.map +1 -1
- package/dist/main/GoTrueClient.js +266 -237
- package/dist/main/GoTrueClient.js.map +1 -1
- package/dist/main/index.d.ts +3 -2
- package/dist/main/index.d.ts.map +1 -1
- package/dist/main/index.js +4 -3
- package/dist/main/index.js.map +1 -1
- package/dist/main/lib/constants.d.ts +0 -8
- package/dist/main/lib/constants.d.ts.map +1 -1
- package/dist/main/lib/constants.js +1 -9
- package/dist/main/lib/constants.js.map +1 -1
- package/dist/main/lib/errors.d.ts +3 -6
- package/dist/main/lib/errors.d.ts.map +1 -1
- package/dist/main/lib/errors.js +7 -13
- package/dist/main/lib/errors.js.map +1 -1
- package/dist/main/lib/fetch.d.ts +17 -4
- package/dist/main/lib/fetch.d.ts.map +1 -1
- package/dist/main/lib/fetch.js +57 -28
- package/dist/main/lib/fetch.js.map +1 -1
- package/dist/main/lib/helpers.d.ts +1 -2
- package/dist/main/lib/helpers.d.ts.map +1 -1
- package/dist/main/lib/helpers.js +1 -14
- package/dist/main/lib/helpers.js.map +1 -1
- package/dist/main/lib/types.d.ts +122 -61
- 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 +101 -0
- package/dist/module/GoTrueAdminApi.d.ts.map +1 -0
- package/dist/module/GoTrueAdminApi.js +210 -0
- package/dist/module/GoTrueAdminApi.js.map +1 -0
- package/dist/module/GoTrueClient.d.ts +76 -101
- package/dist/module/GoTrueClient.d.ts.map +1 -1
- package/dist/module/GoTrueClient.js +267 -238
- package/dist/module/GoTrueClient.js.map +1 -1
- package/dist/module/index.d.ts +3 -2
- package/dist/module/index.d.ts.map +1 -1
- package/dist/module/index.js +3 -2
- package/dist/module/index.js.map +1 -1
- package/dist/module/lib/constants.d.ts +0 -8
- package/dist/module/lib/constants.d.ts.map +1 -1
- package/dist/module/lib/constants.js +0 -8
- package/dist/module/lib/constants.js.map +1 -1
- package/dist/module/lib/errors.d.ts +3 -6
- package/dist/module/lib/errors.d.ts.map +1 -1
- package/dist/module/lib/errors.js +5 -10
- package/dist/module/lib/errors.js.map +1 -1
- package/dist/module/lib/fetch.d.ts +17 -4
- package/dist/module/lib/fetch.d.ts.map +1 -1
- package/dist/module/lib/fetch.js +54 -24
- package/dist/module/lib/fetch.js.map +1 -1
- package/dist/module/lib/helpers.d.ts +1 -2
- package/dist/module/lib/helpers.d.ts.map +1 -1
- package/dist/module/lib/helpers.js +0 -12
- package/dist/module/lib/helpers.js.map +1 -1
- package/dist/module/lib/types.d.ts +122 -61
- 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 +5 -4
- package/src/GoTrueAdminApi.ts +233 -0
- package/src/GoTrueClient.ts +344 -352
- package/src/index.ts +3 -2
- package/src/lib/constants.ts +0 -8
- package/src/lib/errors.ts +6 -12
- package/src/lib/fetch.ts +73 -40
- package/src/lib/helpers.ts +1 -13
- package/src/lib/types.ts +138 -66
- package/src/lib/version.ts +1 -1
- package/dist/main/GoTrueApi.d.ts +0 -405
- package/dist/main/GoTrueApi.d.ts.map +0 -1
- package/dist/main/GoTrueApi.js +0 -738
- package/dist/main/GoTrueApi.js.map +0 -1
- package/dist/main/lib/cookies.d.ts +0 -23
- package/dist/main/lib/cookies.d.ts.map +0 -1
- package/dist/main/lib/cookies.js +0 -140
- package/dist/main/lib/cookies.js.map +0 -1
- package/dist/module/GoTrueApi.d.ts +0 -405
- package/dist/module/GoTrueApi.d.ts.map +0 -1
- package/dist/module/GoTrueApi.js +0 -735
- package/dist/module/GoTrueApi.js.map +0 -1
- package/dist/module/lib/cookies.d.ts +0 -23
- package/dist/module/lib/cookies.d.ts.map +0 -1
- package/dist/module/lib/cookies.js +0 -133
- package/dist/module/lib/cookies.js.map +0 -1
- package/src/GoTrueApi.ts +0 -1066
- package/src/lib/cookies.ts +0 -183
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { Fetch } from './lib/fetch';
|
|
2
|
+
import { AdminUserAttributes, GenerateLinkType, Session, User, UserResponse } from './lib/types';
|
|
3
|
+
import { AuthError } from './lib/errors';
|
|
4
|
+
export default class GoTrueAdminApi {
|
|
5
|
+
protected url: string;
|
|
6
|
+
protected headers: {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
};
|
|
9
|
+
protected fetch: Fetch;
|
|
10
|
+
constructor({ url, headers, fetch, }: {
|
|
11
|
+
url: string;
|
|
12
|
+
headers?: {
|
|
13
|
+
[key: string]: string;
|
|
14
|
+
};
|
|
15
|
+
fetch?: Fetch;
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Removes a logged-in session.
|
|
19
|
+
* @param jwt A valid, logged-in JWT.
|
|
20
|
+
*/
|
|
21
|
+
signOut(jwt: string): Promise<{
|
|
22
|
+
error: AuthError | null;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Sends an invite link to an email address.
|
|
26
|
+
* @param email The email address of the user.
|
|
27
|
+
* @param options.redirectTo A URL or mobile address to send the user to after they are confirmed.
|
|
28
|
+
* @param options.data Optional user metadata
|
|
29
|
+
*/
|
|
30
|
+
inviteUserByEmail(email: string, options?: {
|
|
31
|
+
redirectTo?: string;
|
|
32
|
+
data?: object;
|
|
33
|
+
}): Promise<UserResponse>;
|
|
34
|
+
/**
|
|
35
|
+
* Generates links to be sent via email or other.
|
|
36
|
+
* @param email The user's email.
|
|
37
|
+
* @param options.password User password. For signup only.
|
|
38
|
+
* @param options.data Optional user metadata. For signup only.
|
|
39
|
+
* @param options.redirectTo The redirect url which should be appended to the generated link
|
|
40
|
+
*/
|
|
41
|
+
generateLink(type: GenerateLinkType, email: string, options?: {
|
|
42
|
+
password?: string;
|
|
43
|
+
data?: object;
|
|
44
|
+
redirectTo?: string;
|
|
45
|
+
}): Promise<{
|
|
46
|
+
data: User;
|
|
47
|
+
error: null;
|
|
48
|
+
} | {
|
|
49
|
+
data: Session;
|
|
50
|
+
error: null;
|
|
51
|
+
} | {
|
|
52
|
+
data: null;
|
|
53
|
+
error: AuthError;
|
|
54
|
+
}>;
|
|
55
|
+
/**
|
|
56
|
+
* Creates a new user.
|
|
57
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
58
|
+
*/
|
|
59
|
+
createUser(attributes: AdminUserAttributes): Promise<UserResponse>;
|
|
60
|
+
/**
|
|
61
|
+
* Get a list of users.
|
|
62
|
+
*
|
|
63
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
64
|
+
*/
|
|
65
|
+
listUsers(): Promise<{
|
|
66
|
+
data: {
|
|
67
|
+
users: User[];
|
|
68
|
+
};
|
|
69
|
+
error: null;
|
|
70
|
+
} | {
|
|
71
|
+
data: {
|
|
72
|
+
users: [];
|
|
73
|
+
};
|
|
74
|
+
error: AuthError;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Get user by id.
|
|
78
|
+
*
|
|
79
|
+
* @param uid The user's unique identifier
|
|
80
|
+
*
|
|
81
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
82
|
+
*/
|
|
83
|
+
getUserById(uid: string): Promise<UserResponse>;
|
|
84
|
+
/**
|
|
85
|
+
* Updates the user data.
|
|
86
|
+
*
|
|
87
|
+
* @param attributes The data you want to update.
|
|
88
|
+
*
|
|
89
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
90
|
+
*/
|
|
91
|
+
updateUserById(uid: string, attributes: AdminUserAttributes): Promise<UserResponse>;
|
|
92
|
+
/**
|
|
93
|
+
* Delete a user. Requires a `service_role` key.
|
|
94
|
+
*
|
|
95
|
+
* @param uid The user uid you want to remove.
|
|
96
|
+
*
|
|
97
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
98
|
+
*/
|
|
99
|
+
deleteUser(uid: string): Promise<UserResponse>;
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=GoTrueAdminApi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GoTrueAdminApi.d.ts","sourceRoot":"","sources":["../../src/GoTrueAdminApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAA2B,MAAM,aAAa,CAAA;AAE5D,OAAO,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAChG,OAAO,EAAE,SAAS,EAAe,MAAM,cAAc,CAAA;AAErD,MAAM,CAAC,OAAO,OAAO,cAAc;IACjC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAA;IACrB,SAAS,CAAC,OAAO,EAAE;QACjB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KACtB,CAAA;IACD,SAAS,CAAC,KAAK,EAAE,KAAK,CAAA;gBAEV,EACV,GAAQ,EACR,OAAY,EACZ,KAAK,GACN,EAAE;QACD,GAAG,EAAE,MAAM,CAAA;QACX,OAAO,CAAC,EAAE;YACR,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SACtB,CAAA;QACD,KAAK,CAAC,EAAE,KAAK,CAAA;KACd;IAMD;;;OAGG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAAA;KAAE,CAAC;IAiBhE;;;;;OAKG;IACG,iBAAiB,CACrB,KAAK,EAAE,MAAM,EACb,OAAO,GAAE;QACP,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&& this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const fetch_1 = require("./lib/fetch");
|
|
13
|
+
const helpers_1 = require("./lib/helpers");
|
|
14
|
+
const errors_1 = require("./lib/errors");
|
|
15
|
+
class GoTrueAdminApi {
|
|
16
|
+
constructor({ url = '', headers = {}, fetch, }) {
|
|
17
|
+
this.url = url;
|
|
18
|
+
this.headers = headers;
|
|
19
|
+
this.fetch = (0, helpers_1.resolveFetch)(fetch);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Removes a logged-in session.
|
|
23
|
+
* @param jwt A valid, logged-in JWT.
|
|
24
|
+
*/
|
|
25
|
+
signOut(jwt) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
try {
|
|
28
|
+
yield (0, fetch_1._request)(this.fetch, 'POST', `${this.url}/logout`, {
|
|
29
|
+
headers: this.headers,
|
|
30
|
+
jwt,
|
|
31
|
+
noResolveJson: true,
|
|
32
|
+
});
|
|
33
|
+
return { error: null };
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
if ((0, errors_1.isAuthError)(error)) {
|
|
37
|
+
return { error };
|
|
38
|
+
}
|
|
39
|
+
throw error;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Sends an invite link to an email address.
|
|
45
|
+
* @param email The email address of the user.
|
|
46
|
+
* @param options.redirectTo A URL or mobile address to send the user to after they are confirmed.
|
|
47
|
+
* @param options.data Optional user metadata
|
|
48
|
+
*/
|
|
49
|
+
inviteUserByEmail(email, options = {}) {
|
|
50
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
+
try {
|
|
52
|
+
return yield (0, fetch_1._request)(this.fetch, 'POST', `${this.url}/invite`, {
|
|
53
|
+
body: { email, data: options.data },
|
|
54
|
+
headers: this.headers,
|
|
55
|
+
redirectTo: options.redirectTo,
|
|
56
|
+
xform: fetch_1._userResponse,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
if ((0, errors_1.isAuthError)(error)) {
|
|
61
|
+
return { data: { user: null }, error };
|
|
62
|
+
}
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Generates links to be sent via email or other.
|
|
69
|
+
* @param email The user's email.
|
|
70
|
+
* @param options.password User password. For signup only.
|
|
71
|
+
* @param options.data Optional user metadata. For signup only.
|
|
72
|
+
* @param options.redirectTo The redirect url which should be appended to the generated link
|
|
73
|
+
*/
|
|
74
|
+
generateLink(type, email, options = {}) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
try {
|
|
77
|
+
return yield (0, fetch_1._request)(this.fetch, 'POST', `${this.url}/admin/generate_link`, {
|
|
78
|
+
body: {
|
|
79
|
+
type,
|
|
80
|
+
email,
|
|
81
|
+
password: options.password,
|
|
82
|
+
data: options.data,
|
|
83
|
+
redirect_to: options.redirectTo,
|
|
84
|
+
},
|
|
85
|
+
headers: this.headers,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
if ((0, errors_1.isAuthError)(error)) {
|
|
90
|
+
return { data: null, error };
|
|
91
|
+
}
|
|
92
|
+
throw error;
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
// User Admin API
|
|
97
|
+
/**
|
|
98
|
+
* Creates a new user.
|
|
99
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
100
|
+
*/
|
|
101
|
+
createUser(attributes) {
|
|
102
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
103
|
+
try {
|
|
104
|
+
return yield (0, fetch_1._request)(this.fetch, 'POST', `${this.url}/admin/users`, {
|
|
105
|
+
body: attributes,
|
|
106
|
+
headers: this.headers,
|
|
107
|
+
xform: fetch_1._userResponse,
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if ((0, errors_1.isAuthError)(error)) {
|
|
112
|
+
return { data: { user: null }, error };
|
|
113
|
+
}
|
|
114
|
+
throw error;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Get a list of users.
|
|
120
|
+
*
|
|
121
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
122
|
+
*/
|
|
123
|
+
listUsers() {
|
|
124
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
try {
|
|
126
|
+
const { data, error } = yield (0, fetch_1._request)(this.fetch, 'GET', `${this.url}/admin/users`, {
|
|
127
|
+
headers: this.headers,
|
|
128
|
+
});
|
|
129
|
+
if (error)
|
|
130
|
+
throw error;
|
|
131
|
+
return { data: Object.assign({}, data), error: null };
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
if ((0, errors_1.isAuthError)(error)) {
|
|
135
|
+
return { data: { users: [] }, error };
|
|
136
|
+
}
|
|
137
|
+
throw error;
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get user by id.
|
|
143
|
+
*
|
|
144
|
+
* @param uid The user's unique identifier
|
|
145
|
+
*
|
|
146
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
147
|
+
*/
|
|
148
|
+
getUserById(uid) {
|
|
149
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
150
|
+
try {
|
|
151
|
+
return yield (0, fetch_1._request)(this.fetch, 'GET', `${this.url}/admin/users/${uid}`, {
|
|
152
|
+
headers: this.headers,
|
|
153
|
+
xform: fetch_1._userResponse,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
catch (error) {
|
|
157
|
+
if ((0, errors_1.isAuthError)(error)) {
|
|
158
|
+
return { data: { user: null }, error };
|
|
159
|
+
}
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Updates the user data.
|
|
166
|
+
*
|
|
167
|
+
* @param attributes The data you want to update.
|
|
168
|
+
*
|
|
169
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
170
|
+
*/
|
|
171
|
+
updateUserById(uid, attributes) {
|
|
172
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
173
|
+
try {
|
|
174
|
+
return yield (0, fetch_1._request)(this.fetch, 'PUT', `${this.url}/admin/users/${uid}`, {
|
|
175
|
+
body: attributes,
|
|
176
|
+
headers: this.headers,
|
|
177
|
+
xform: fetch_1._userResponse,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
catch (error) {
|
|
181
|
+
if ((0, errors_1.isAuthError)(error)) {
|
|
182
|
+
return { data: { user: null }, error };
|
|
183
|
+
}
|
|
184
|
+
throw error;
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Delete a user. Requires a `service_role` key.
|
|
190
|
+
*
|
|
191
|
+
* @param uid The user uid you want to remove.
|
|
192
|
+
*
|
|
193
|
+
* This function should only be called on a server. Never expose your `service_role` key in the browser.
|
|
194
|
+
*/
|
|
195
|
+
deleteUser(uid) {
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
try {
|
|
198
|
+
return yield (0, fetch_1._request)(this.fetch, 'DELETE', `${this.url}/admin/users/${uid}`, {
|
|
199
|
+
headers: this.headers,
|
|
200
|
+
xform: fetch_1._userResponse,
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
catch (error) {
|
|
204
|
+
if ((0, errors_1.isAuthError)(error)) {
|
|
205
|
+
return { data: { user: null }, error };
|
|
206
|
+
}
|
|
207
|
+
throw error;
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
exports.default = GoTrueAdminApi;
|
|
213
|
+
//# sourceMappingURL=GoTrueAdminApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GoTrueAdminApi.js","sourceRoot":"","sources":["../../src/GoTrueAdminApi.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA4D;AAC5D,2CAA4C;AAE5C,yCAAqD;AAErD,MAAqB,cAAc;IAOjC,YAAY,EACV,GAAG,GAAG,EAAE,EACR,OAAO,GAAG,EAAE,EACZ,KAAK,GAON;QACC,IAAI,CAAC,GAAG,GAAG,GAAG,CAAA;QACd,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,KAAK,GAAG,IAAA,sBAAY,EAAC,KAAK,CAAC,CAAA;IAClC,CAAC;IAED;;;OAGG;IACG,OAAO,CAAC,GAAW;;YACvB,IAAI;gBACF,MAAM,IAAA,gBAAQ,EAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,SAAS,EAAE;oBACvD,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,GAAG;oBACH,aAAa,EAAE,IAAI;iBACpB,CAAC,CAAA;gBACF,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,CAAA;aACvB;YAAC,OAAO,KAAK,EAAE;gBACd,IAAI,IAAA,oBAAW,EAAC,KAAK,CAAC,EAAE;oBACtB,OAAO,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AC,KAAK,CAAC,EAAE;oBACtB,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAA;iBACvC;gBAED,MAAM,KAAK,CAAA;aACZ;QACH,CAAC;KAAA;CACF;AAnOD,iCAmOC"}
|
|
@@ -1,33 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Deferred } from './lib/helpers';
|
|
3
|
-
import { Fetch } from './lib/fetch';
|
|
1
|
+
import GoTrueAdminApi from './GoTrueAdminApi';
|
|
4
2
|
import { AuthError } from './lib/errors';
|
|
5
|
-
import
|
|
3
|
+
import { Fetch } from './lib/fetch';
|
|
4
|
+
import { Deferred } from './lib/helpers';
|
|
5
|
+
import type { AuthChangeEvent, AuthResponse, CallRefreshTokenResult, OAuthResponse, Session, SignInWithOAuthCredentials, SignInWithPasswordCredentials, SignInWithPasswordlessCredentials, SignUpWithPasswordCredentials, Subscription, SupportedStorage, UserAttributes, UserResponse, VerifyOtpParams } from './lib/types';
|
|
6
6
|
export default class GoTrueClient {
|
|
7
7
|
/**
|
|
8
|
-
* Namespace for the GoTrue
|
|
9
|
-
* These
|
|
8
|
+
* Namespace for the GoTrue admin methods.
|
|
9
|
+
* These methods should only be used in a trusted server-side environment.
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
admin: GoTrueAdminApi;
|
|
12
12
|
/**
|
|
13
|
-
* The storage key used to
|
|
13
|
+
* The storage key used to identify the values saved in localStorage
|
|
14
14
|
*/
|
|
15
15
|
protected storageKey: string;
|
|
16
16
|
/**
|
|
17
|
-
* The session object for the currently logged in user
|
|
17
|
+
* The session object for the currently logged in user. If null, it means there isn't a logged-in user.
|
|
18
18
|
* Only used if persistSession is false.
|
|
19
19
|
*/
|
|
20
20
|
protected inMemorySession: Session | null;
|
|
21
21
|
protected autoRefreshToken: boolean;
|
|
22
22
|
protected persistSession: boolean;
|
|
23
|
-
protected
|
|
23
|
+
protected storage: SupportedStorage;
|
|
24
24
|
protected stateChangeEmitters: Map<string, Subscription>;
|
|
25
25
|
protected refreshTokenTimer?: ReturnType<typeof setTimeout>;
|
|
26
26
|
protected networkRetries: number;
|
|
27
|
-
protected refreshingDeferred: Deferred<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
protected refreshingDeferred: Deferred<CallRefreshTokenResult> | null;
|
|
28
|
+
protected url: string;
|
|
29
|
+
protected headers: {
|
|
30
|
+
[key: string]: string;
|
|
31
|
+
};
|
|
32
|
+
protected fetch: Fetch;
|
|
31
33
|
/**
|
|
32
34
|
* Create a new client for use in the browser.
|
|
33
35
|
* @param options.url The URL of the GoTrue server.
|
|
@@ -38,7 +40,6 @@ export default class GoTrueClient {
|
|
|
38
40
|
* @param options.persistSession Set to "true" if you want to automatically save the user session into local storage. If set to false, session will just be saved in memory.
|
|
39
41
|
* @param options.localStorage Provide your own local storage implementation to use instead of the browser's local storage.
|
|
40
42
|
* @param options.multiTab Set to "false" if you want to disable multi-tab/window events.
|
|
41
|
-
* @param options.cookieOptions
|
|
42
43
|
* @param options.fetch A custom fetch implementation.
|
|
43
44
|
*/
|
|
44
45
|
constructor(options: {
|
|
@@ -50,136 +51,88 @@ export default class GoTrueClient {
|
|
|
50
51
|
detectSessionInUrl?: boolean;
|
|
51
52
|
autoRefreshToken?: boolean;
|
|
52
53
|
persistSession?: boolean;
|
|
53
|
-
|
|
54
|
+
storage?: SupportedStorage;
|
|
54
55
|
multiTab?: boolean;
|
|
55
|
-
cookieOptions?: CookieOptions;
|
|
56
56
|
fetch?: Fetch;
|
|
57
57
|
});
|
|
58
58
|
/**
|
|
59
59
|
* Creates a new user.
|
|
60
|
-
* @
|
|
61
|
-
* @
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
* @param redirectTo The redirect URL attached to the signup confirmation link. Does not redirect the user if it's a mobile signup.
|
|
65
|
-
* @param data Optional user metadata.
|
|
66
|
-
*/
|
|
67
|
-
signUp({ email, password, phone }: UserCredentials, options?: {
|
|
68
|
-
redirectTo?: string;
|
|
69
|
-
data?: object;
|
|
70
|
-
captchaToken?: string;
|
|
71
|
-
}): Promise<AuthResponse>;
|
|
60
|
+
* @returns A logged-in session if the server has "autoconfirm" ON
|
|
61
|
+
* @returns A user if the server has "autoconfirm" OFF
|
|
62
|
+
*/
|
|
63
|
+
signUp(credentials: SignUpWithPasswordCredentials): Promise<AuthResponse>;
|
|
72
64
|
/**
|
|
73
65
|
* Log in an existing user, or login via a third-party provider.
|
|
74
|
-
* @type SignInWithPasswordCredentials
|
|
75
|
-
* @param email The user's email address.
|
|
76
|
-
* @param phone The user's phone number.
|
|
77
|
-
* @param password The user's password.
|
|
78
|
-
* @param options Valid options for password sign-ins.
|
|
79
66
|
*/
|
|
80
67
|
signInWithPassword(credentials: SignInWithPasswordCredentials): Promise<AuthResponse>;
|
|
81
68
|
/**
|
|
82
69
|
* Log in an existing user via a third-party provider.
|
|
83
|
-
* @type SignInWithOAuthCredentials
|
|
84
|
-
* @param provider One of the providers supported by GoTrue.
|
|
85
|
-
* @param redirectTo A URL to send the user to after they are confirmed (OAuth logins only).
|
|
86
|
-
* @param scopes A space-separated list of scopes granted to the OAuth application.
|
|
87
|
-
* @param queryParams An object of query params
|
|
88
70
|
*/
|
|
89
71
|
signInWithOAuth(credentials: SignInWithOAuthCredentials): Promise<OAuthResponse>;
|
|
90
72
|
/**
|
|
91
73
|
* Passwordless method for logging in an existing user.
|
|
92
|
-
* @type SignInWithPasswordlessCredentials
|
|
93
|
-
* @param email The user's email address.
|
|
94
|
-
* @param phone The user's phone number.
|
|
95
|
-
* @param options Valid options for passwordless sign-ins.
|
|
96
74
|
*/
|
|
97
75
|
signInWithOtp(credentials: SignInWithPasswordlessCredentials): Promise<AuthResponse>;
|
|
98
76
|
/**
|
|
99
77
|
* Log in a user given a User supplied OTP received via mobile.
|
|
100
|
-
* @param
|
|
101
|
-
* @param
|
|
102
|
-
* @param token The user's password.
|
|
103
|
-
* @param type The user's verification type.
|
|
104
|
-
* @param redirectTo A URL or mobile address to send the user to after they are confirmed.
|
|
78
|
+
* @param options.redirectTo A URL to send the user to after they are confirmed.
|
|
79
|
+
* @param options.captchaToken Verification token received when the user completes the captcha on the site.
|
|
105
80
|
*/
|
|
106
|
-
|
|
81
|
+
verifyOtp(params: VerifyOtpParams, options?: {
|
|
107
82
|
redirectTo?: string;
|
|
83
|
+
captchaToken?: string;
|
|
108
84
|
}): Promise<AuthResponse>;
|
|
109
85
|
/**
|
|
110
86
|
* Returns the session data, refreshing it if necessary.
|
|
87
|
+
* If no session is detected, the session returned will be null.
|
|
111
88
|
*/
|
|
112
89
|
getSession(): Promise<{
|
|
113
|
-
|
|
90
|
+
data: {
|
|
91
|
+
session: Session;
|
|
92
|
+
};
|
|
114
93
|
error: null;
|
|
115
94
|
} | {
|
|
116
|
-
|
|
95
|
+
data: {
|
|
96
|
+
session: null;
|
|
97
|
+
};
|
|
117
98
|
error: AuthError;
|
|
118
99
|
} | {
|
|
119
|
-
|
|
100
|
+
data: {
|
|
101
|
+
session: null;
|
|
102
|
+
};
|
|
120
103
|
error: null;
|
|
121
104
|
}>;
|
|
122
105
|
/**
|
|
123
|
-
*
|
|
106
|
+
* Gets the current user details if there is an existing session.
|
|
107
|
+
* @param jwt Takes in an optional access token jwt. If no jwt is provided, getUser() will attempt to get the jwt from the current session.
|
|
124
108
|
*/
|
|
125
|
-
getUser(): Promise<
|
|
126
|
-
user: User;
|
|
127
|
-
error: null;
|
|
128
|
-
} | {
|
|
129
|
-
user: null;
|
|
130
|
-
error: AuthError;
|
|
131
|
-
} | {
|
|
132
|
-
user: null;
|
|
133
|
-
error: null;
|
|
134
|
-
}>;
|
|
109
|
+
getUser(jwt?: string): Promise<UserResponse>;
|
|
135
110
|
/**
|
|
136
111
|
* Updates user data, if there is a logged in user.
|
|
137
112
|
*/
|
|
138
|
-
|
|
139
|
-
user: User;
|
|
140
|
-
error: null;
|
|
141
|
-
} | {
|
|
142
|
-
user: null;
|
|
143
|
-
error: AuthError;
|
|
144
|
-
}>;
|
|
113
|
+
updateUser(attributes: UserAttributes): Promise<UserResponse>;
|
|
145
114
|
/**
|
|
146
|
-
* Sets the session data from refresh_token and returns current
|
|
147
|
-
* @param refresh_token
|
|
115
|
+
* Sets the session data from refresh_token and returns current session or an error if the refresh_token is invalid.
|
|
116
|
+
* @param refresh_token The refresh token returned by gotrue.
|
|
148
117
|
*/
|
|
149
|
-
setSession(refresh_token: string): Promise<
|
|
150
|
-
session: Session;
|
|
151
|
-
error: null;
|
|
152
|
-
} | {
|
|
153
|
-
session: null;
|
|
154
|
-
error: null;
|
|
155
|
-
} | {
|
|
156
|
-
session: null;
|
|
157
|
-
error: AuthError;
|
|
158
|
-
}>;
|
|
118
|
+
setSession(refresh_token: string): Promise<AuthResponse>;
|
|
159
119
|
/**
|
|
160
120
|
* Gets the session data from a URL string
|
|
161
|
-
* @param options.storeSession Optionally store the session in the browser
|
|
162
121
|
*/
|
|
163
|
-
|
|
164
|
-
storeSession?: boolean;
|
|
165
|
-
}): Promise<{
|
|
166
|
-
session: Session;
|
|
167
|
-
error: null;
|
|
168
|
-
} | {
|
|
169
|
-
session: null;
|
|
170
|
-
error: AuthError;
|
|
171
|
-
}>;
|
|
122
|
+
private _getSessionFromUrl;
|
|
172
123
|
/**
|
|
173
124
|
* Inside a browser context, `signOut()` will remove the logged in user from the browser session
|
|
174
125
|
* and log them out - removing all items from localstorage and then trigger a "SIGNED_OUT" event.
|
|
175
126
|
*
|
|
176
|
-
* For server-side management, you can revoke all refresh tokens for a user by passing a user's JWT through to `auth.api.signOut(JWT: string)`.
|
|
127
|
+
* For server-side management, you can revoke all refresh tokens for a user by passing a user's JWT through to `auth.api.signOut(JWT: string)`.
|
|
128
|
+
* There is no way to revoke a user's access token jwt until it expires. It is recommended to set a shorter expiry on the jwt for this reason.
|
|
177
129
|
*/
|
|
178
130
|
signOut(): Promise<{
|
|
179
131
|
error: AuthError | null;
|
|
180
132
|
}>;
|
|
181
133
|
/**
|
|
182
134
|
* Receive a notification every time an auth event happens.
|
|
135
|
+
* @param callback A callback function to be invoked when an auth event happens.
|
|
183
136
|
* @returns {Subscription} A subscription object which can be used to unsubscribe itself.
|
|
184
137
|
*/
|
|
185
138
|
onAuthStateChange(callback: (event: AuthChangeEvent, session: Session | null) => void): {
|
|
@@ -189,15 +142,29 @@ export default class GoTrueClient {
|
|
|
189
142
|
subscription: null;
|
|
190
143
|
error: AuthError;
|
|
191
144
|
};
|
|
192
|
-
private _handleEmailSignIn;
|
|
193
|
-
private _handlePhoneSignIn;
|
|
194
|
-
private _handleProviderSignIn;
|
|
195
|
-
private _handleOpenIDConnectSignIn;
|
|
196
145
|
/**
|
|
197
|
-
*
|
|
198
|
-
*
|
|
146
|
+
* Sends a reset request to an email address.
|
|
147
|
+
* @param email The email address of the user.
|
|
148
|
+
* @param options.redirectTo A URL to send the user to after they are confirmed.
|
|
149
|
+
* @param options.captchaToken Verification token received when the user completes the captcha on the site.
|
|
199
150
|
*/
|
|
200
|
-
|
|
151
|
+
resetPasswordForEmail(email: string, options?: {
|
|
152
|
+
redirectTo?: string;
|
|
153
|
+
captchaToken?: string;
|
|
154
|
+
}): Promise<{
|
|
155
|
+
data: {};
|
|
156
|
+
error: null;
|
|
157
|
+
} | {
|
|
158
|
+
data: null;
|
|
159
|
+
error: AuthError;
|
|
160
|
+
}>;
|
|
161
|
+
/**
|
|
162
|
+
* Generates a new JWT.
|
|
163
|
+
* @param refreshToken A valid refresh token that was returned on login.
|
|
164
|
+
*/
|
|
165
|
+
private _refreshAccessToken;
|
|
166
|
+
private _doesSessionExist;
|
|
167
|
+
private _handleProviderSignIn;
|
|
201
168
|
/**
|
|
202
169
|
* Recovers the session from LocalStorage and refreshes
|
|
203
170
|
* Note: this method is async to accommodate for AsyncStorage e.g. in React native.
|
|
@@ -214,9 +181,17 @@ export default class GoTrueClient {
|
|
|
214
181
|
private _removeSession;
|
|
215
182
|
/**
|
|
216
183
|
* Clear and re-create refresh token timer
|
|
217
|
-
* @param value time intervals in milliseconds
|
|
184
|
+
* @param value time intervals in milliseconds.
|
|
185
|
+
* @param session The current session.
|
|
218
186
|
*/
|
|
219
187
|
private _startAutoRefreshToken;
|
|
220
188
|
private _handleVisibilityChange;
|
|
189
|
+
/**
|
|
190
|
+
* Generates the relevant login URL for a third-party provider.
|
|
191
|
+
* @param options.redirectTo A URL or mobile address to send the user to after they are confirmed.
|
|
192
|
+
* @param options.scopes A space-separated list of scopes granted to the OAuth application.
|
|
193
|
+
* @param options.queryParams An object of key-value pairs containing query parameters granted to the OAuth application.
|
|
194
|
+
*/
|
|
195
|
+
private _getUrlForProvider;
|
|
221
196
|
}
|
|
222
197
|
//# sourceMappingURL=GoTrueClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GoTrueClient.d.ts","sourceRoot":"","sources":["../../src/GoTrueClient.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"GoTrueClient.d.ts","sourceRoot":"","sources":["../../src/GoTrueClient.ts"],"names":[],"mappings":"AAAA,OAAO,cAAc,MAAM,kBAAkB,CAAA;AAQ7C,OAAO,EAEL,SAAS,EAMV,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,KAAK,EAA6C,MAAM,aAAa,CAAA;AAC9E,OAAO,EACL,QAAQ,EAQT,MAAM,eAAe,CAAA;AAEtB,OAAO,KAAK,EACV,eAAe,EACf,YAAY,EACZ,sBAAsB,EACtB,aAAa,EAEb,OAAO,EACP,0BAA0B,EAC1B,6BAA6B,EAC7B,iCAAiC,EACjC,6BAA6B,EAC7B,YAAY,EACZ,gBAAgB,EAEhB,cAAc,EACd,YAAY,EACZ,eAAe,EAChB,MAAM,aAAa,CAAA;AAcpB,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B;;;OAGG;IACH,KAAK,EAAE,cAAc,CAAA;IACrB;;OAEG;IACH,SAAS,CAAC,UAAU,EAAE,MAAM,CAAA;IAE5B;;;OAGG;IACH,SAAS,CAA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