@stackframe/stack 2.5.8 → 2.5.10
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/CHANGELOG.md +20 -0
- package/dist/components/credential-sign-in.d.mts +5 -0
- package/dist/components/credential-sign-in.d.ts +5 -0
- package/dist/components/{credential-sign-in-form.js → credential-sign-in.js} +8 -8
- package/dist/components/credential-sign-in.js.map +1 -0
- package/dist/components/credential-sign-up.d.mts +5 -0
- package/dist/components/credential-sign-up.d.ts +5 -0
- package/dist/components/{credential-sign-up-form.js → credential-sign-up.js} +8 -8
- package/dist/components/credential-sign-up.js.map +1 -0
- package/dist/components/elements/user-avatar.d.mts +1 -1
- package/dist/components/elements/user-avatar.d.ts +1 -1
- package/dist/components/magic-link-sign-in.d.mts +5 -0
- package/dist/components/magic-link-sign-in.d.ts +5 -0
- package/dist/components/{magic-link-sign-in-form.js → magic-link-sign-in.js} +8 -8
- package/dist/components/magic-link-sign-in.js.map +1 -0
- package/dist/components/message-cards/predefined-message-card.js +8 -8
- package/dist/components/message-cards/predefined-message-card.js.map +1 -1
- package/dist/components/selected-team-switcher.d.mts +1 -1
- package/dist/components/selected-team-switcher.d.ts +1 -1
- package/dist/components/user-button.js +3 -3
- package/dist/components/user-button.js.map +1 -1
- package/dist/components-page/account-settings.js +4 -4
- package/dist/components-page/account-settings.js.map +1 -1
- package/dist/components-page/auth-page.js +21 -8
- package/dist/components-page/auth-page.js.map +1 -1
- package/dist/components-page/stack-handler.d.mts +2 -2
- package/dist/components-page/stack-handler.d.ts +2 -2
- package/dist/components-page/stack-handler.js +8 -15
- package/dist/components-page/stack-handler.js.map +1 -1
- package/dist/esm/components/{credential-sign-in-form.js → credential-sign-in.js} +4 -4
- package/dist/esm/components/credential-sign-in.js.map +1 -0
- package/dist/esm/components/{credential-sign-up-form.js → credential-sign-up.js} +4 -4
- package/dist/esm/components/credential-sign-up.js.map +1 -0
- package/dist/esm/components/{magic-link-sign-in-form.js → magic-link-sign-in.js} +4 -4
- package/dist/esm/components/magic-link-sign-in.js.map +1 -0
- package/dist/esm/components/message-cards/predefined-message-card.js +8 -8
- package/dist/esm/components/message-cards/predefined-message-card.js.map +1 -1
- package/dist/esm/components/user-button.js +3 -3
- package/dist/esm/components/user-button.js.map +1 -1
- package/dist/esm/components-page/account-settings.js +4 -4
- package/dist/esm/components-page/account-settings.js.map +1 -1
- package/dist/esm/components-page/auth-page.js +21 -8
- package/dist/esm/components-page/auth-page.js.map +1 -1
- package/dist/esm/components-page/stack-handler.js +8 -15
- package/dist/esm/components-page/stack-handler.js.map +1 -1
- package/dist/esm/index.js +7 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/auth.js +3 -3
- package/dist/esm/lib/auth.js.map +1 -1
- package/dist/esm/lib/cookie.js +8 -6
- package/dist/esm/lib/cookie.js.map +1 -1
- package/dist/esm/lib/stack-app.js +143 -93
- package/dist/esm/lib/stack-app.js.map +1 -1
- package/dist/esm/providers/stack-provider-client.js +1 -3
- package/dist/esm/providers/stack-provider-client.js.map +1 -1
- package/dist/esm/utils/url.js +9 -1
- package/dist/esm/utils/url.js.map +1 -1
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +6 -8
- package/dist/index.js.map +1 -1
- package/dist/lib/auth.js +3 -3
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/cookie.js +6 -6
- package/dist/lib/cookie.js.map +1 -1
- package/dist/lib/hooks.d.mts +1 -1
- package/dist/lib/hooks.d.ts +1 -1
- package/dist/lib/stack-app.d.mts +59 -23
- package/dist/lib/stack-app.d.ts +59 -23
- package/dist/lib/stack-app.js +143 -93
- package/dist/lib/stack-app.js.map +1 -1
- package/dist/providers/stack-provider-client.d.mts +1 -1
- package/dist/providers/stack-provider-client.d.ts +1 -1
- package/dist/providers/stack-provider-client.js +1 -3
- package/dist/providers/stack-provider-client.js.map +1 -1
- package/dist/providers/stack-provider.d.mts +1 -1
- package/dist/providers/stack-provider.d.ts +1 -1
- package/dist/utils/url.js +9 -1
- package/dist/utils/url.js.map +1 -1
- package/package.json +6 -4
- package/dist/components/credential-sign-in-form.d.mts +0 -5
- package/dist/components/credential-sign-in-form.d.ts +0 -5
- package/dist/components/credential-sign-in-form.js.map +0 -1
- package/dist/components/credential-sign-up-form.d.mts +0 -5
- package/dist/components/credential-sign-up-form.d.ts +0 -5
- package/dist/components/credential-sign-up-form.js.map +0 -1
- package/dist/components/magic-link-sign-in-form.d.mts +0 -5
- package/dist/components/magic-link-sign-in-form.d.ts +0 -5
- package/dist/components/magic-link-sign-in-form.js.map +0 -1
- package/dist/esm/components/credential-sign-in-form.js.map +0 -1
- package/dist/esm/components/credential-sign-up-form.js.map +0 -1
- package/dist/esm/components/magic-link-sign-in-form.js.map +0 -1
package/dist/lib/stack-app.d.mts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { KnownErrors } from '@stackframe/stack-shared';
|
|
2
2
|
import { ProductionModeError } from '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
3
|
-
import { StandardProvider } from '@stackframe/stack-shared/dist/interface/clientInterface';
|
|
4
3
|
import { ApiKeysCrud } from '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
5
4
|
import { CurrentUserCrud } from '@stackframe/stack-shared/dist/interface/crud/current-user';
|
|
6
5
|
import { EmailTemplateType } from '@stackframe/stack-shared/dist/interface/crud/email-templates';
|
|
7
6
|
import { TeamPermissionDefinitionsCrud } from '@stackframe/stack-shared/dist/interface/crud/team-permissions';
|
|
8
7
|
import { InternalSession } from '@stackframe/stack-shared/dist/sessions';
|
|
9
8
|
import { ReadonlyJson } from '@stackframe/stack-shared/dist/utils/json';
|
|
9
|
+
import { ProviderType } from '@stackframe/stack-shared/dist/utils/oauth';
|
|
10
10
|
|
|
11
11
|
type RequestLike = {
|
|
12
12
|
headers: {
|
|
@@ -20,8 +20,8 @@ type TokenStoreInit<HasTokenStore extends boolean = boolean> = HasTokenStore ext
|
|
|
20
20
|
type HandlerUrls = {
|
|
21
21
|
handler: string;
|
|
22
22
|
signIn: string;
|
|
23
|
-
afterSignIn: string;
|
|
24
23
|
signUp: string;
|
|
24
|
+
afterSignIn: string;
|
|
25
25
|
afterSignUp: string;
|
|
26
26
|
signOut: string;
|
|
27
27
|
afterSignOut: string;
|
|
@@ -35,7 +35,7 @@ type HandlerUrls = {
|
|
|
35
35
|
error: string;
|
|
36
36
|
};
|
|
37
37
|
type OAuthScopesOnSignIn = {
|
|
38
|
-
[key in
|
|
38
|
+
[key in ProviderType]: string[];
|
|
39
39
|
};
|
|
40
40
|
type ProjectCurrentUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalUser : CurrentUser;
|
|
41
41
|
type ProjectCurrentServerUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalServerUser : CurrentServerUser;
|
|
@@ -150,10 +150,31 @@ type Auth = {
|
|
|
150
150
|
refreshToken: string | null;
|
|
151
151
|
}>;
|
|
152
152
|
};
|
|
153
|
-
|
|
153
|
+
/**
|
|
154
|
+
* ```
|
|
155
|
+
* +----------+-------------+-------------------+
|
|
156
|
+
* | \ | !Server | Server |
|
|
157
|
+
* +----------+-------------+-------------------+
|
|
158
|
+
* | !Session | User | ServerUser |
|
|
159
|
+
* | Session | CurrentUser | CurrentServerUser |
|
|
160
|
+
* +----------+-------------+-------------------+
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* The fields on each of these types are available iff:
|
|
164
|
+
* BaseUser: true
|
|
165
|
+
* Auth: Session
|
|
166
|
+
* ServerBaseUser: Server
|
|
167
|
+
* UserExtra: Session OR Server
|
|
168
|
+
*
|
|
169
|
+
* The types are defined as follows (in the typescript manner):
|
|
170
|
+
* User = BaseUser
|
|
171
|
+
* CurrentUser = BaseUser & Auth & UserExtra
|
|
172
|
+
* ServerUser = BaseUser & ServerBaseUser & UserExtra
|
|
173
|
+
* CurrentServerUser = BaseUser & ServerBaseUser & Auth & UserExtra
|
|
174
|
+
**/
|
|
175
|
+
type BaseUser = {
|
|
154
176
|
readonly id: string;
|
|
155
177
|
readonly displayName: string | null;
|
|
156
|
-
setDisplayName(displayName: string): Promise<void>;
|
|
157
178
|
/**
|
|
158
179
|
* The user's email address.
|
|
159
180
|
*
|
|
@@ -161,11 +182,9 @@ type User = {
|
|
|
161
182
|
*/
|
|
162
183
|
readonly primaryEmail: string | null;
|
|
163
184
|
readonly primaryEmailVerified: boolean;
|
|
164
|
-
sendVerificationEmail(): Promise<KnownErrors["EmailAlreadyVerified"] | void>;
|
|
165
185
|
readonly profileImageUrl: string | null;
|
|
166
186
|
readonly signedUpAt: Date;
|
|
167
187
|
readonly clientMetadata: any;
|
|
168
|
-
setClientMetadata(metadata: any): Promise<void>;
|
|
169
188
|
/**
|
|
170
189
|
* Whether the primary e-mail can be used for authentication.
|
|
171
190
|
*/
|
|
@@ -177,6 +196,16 @@ type User = {
|
|
|
177
196
|
readonly oauthProviders: readonly {
|
|
178
197
|
id: string;
|
|
179
198
|
}[];
|
|
199
|
+
/**
|
|
200
|
+
* A shorthand method to update multiple fields of the user at once.
|
|
201
|
+
*/
|
|
202
|
+
readonly selectedTeam: Team | null;
|
|
203
|
+
toClientJson(): CurrentUserCrud["Client"]["Read"];
|
|
204
|
+
};
|
|
205
|
+
type UserExtra = {
|
|
206
|
+
setDisplayName(displayName: string): Promise<void>;
|
|
207
|
+
sendVerificationEmail(): Promise<KnownErrors["EmailAlreadyVerified"] | void>;
|
|
208
|
+
setClientMetadata(metadata: any): Promise<void>;
|
|
180
209
|
updatePassword(options: {
|
|
181
210
|
oldPassword: string;
|
|
182
211
|
newPassword: string;
|
|
@@ -185,27 +214,25 @@ type User = {
|
|
|
185
214
|
* A shorthand method to update multiple fields of the user at once.
|
|
186
215
|
*/
|
|
187
216
|
update(update: UserUpdateOptions): Promise<void>;
|
|
188
|
-
|
|
189
|
-
readonly selectedTeam: Team | null;
|
|
190
|
-
setSelectedTeam(team: Team | null): Promise<void>;
|
|
191
|
-
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
192
|
-
getConnectedAccount(id: StandardProvider, options: {
|
|
217
|
+
getConnectedAccount(id: ProviderType, options: {
|
|
193
218
|
or: 'redirect';
|
|
194
219
|
scopes?: string[];
|
|
195
220
|
}): Promise<OAuthConnection>;
|
|
196
|
-
getConnectedAccount(id:
|
|
221
|
+
getConnectedAccount(id: ProviderType, options?: {
|
|
197
222
|
or?: 'redirect' | 'throw' | 'return-null';
|
|
198
223
|
scopes?: string[];
|
|
199
224
|
}): Promise<OAuthConnection | null>;
|
|
200
|
-
useConnectedAccount(id:
|
|
225
|
+
useConnectedAccount(id: ProviderType, options: {
|
|
201
226
|
or: 'redirect';
|
|
202
227
|
scopes?: string[];
|
|
203
228
|
}): OAuthConnection;
|
|
204
|
-
useConnectedAccount(id:
|
|
229
|
+
useConnectedAccount(id: ProviderType, options?: {
|
|
205
230
|
or?: 'redirect' | 'throw' | 'return-null';
|
|
206
231
|
scopes?: string[];
|
|
207
232
|
}): OAuthConnection | null;
|
|
208
|
-
|
|
233
|
+
hasPermission(scope: Team, permissionId: string): Promise<boolean>;
|
|
234
|
+
setSelectedTeam(team: Team | null): Promise<void>;
|
|
235
|
+
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
209
236
|
} & AsyncStoreProperty<"team", [id: string], Team | null, false> & AsyncStoreProperty<"teams", [], Team[], true> & AsyncStoreProperty<"permission", [scope: Team, permissionId: string, options?: {
|
|
210
237
|
recursive?: boolean;
|
|
211
238
|
}], TeamPermission | null, false> & AsyncStoreProperty<"permissions", [scope: Team, options?: {
|
|
@@ -216,18 +243,15 @@ type InternalUserExtra = {
|
|
|
216
243
|
displayName: string;
|
|
217
244
|
}): Promise<AdminProject>;
|
|
218
245
|
} & AsyncStoreProperty<"ownedProjects", [], AdminOwnedProject[], true>;
|
|
219
|
-
type
|
|
246
|
+
type User = BaseUser;
|
|
247
|
+
type CurrentUser = BaseUser & Auth & UserExtra;
|
|
220
248
|
type CurrentInternalUser = CurrentUser & InternalUserExtra;
|
|
221
249
|
type UserUpdateOptions = {
|
|
222
250
|
displayName?: string;
|
|
223
251
|
clientMetadata?: ReadonlyJson;
|
|
224
252
|
selectedTeamId?: string | null;
|
|
225
253
|
};
|
|
226
|
-
|
|
227
|
-
* A user including sensitive fields that should only be used on the server, never sent to the client
|
|
228
|
-
* (such as sensitive information and serverMetadata).
|
|
229
|
-
*/
|
|
230
|
-
type ServerUser = {
|
|
254
|
+
type ServerBaseUser = {
|
|
231
255
|
setPrimaryEmail(email: string, options?: {
|
|
232
256
|
verified?: boolean | undefined;
|
|
233
257
|
}): Promise<void>;
|
|
@@ -242,11 +266,22 @@ type ServerUser = {
|
|
|
242
266
|
grantPermission(scope: Team, permissionId: string): Promise<void>;
|
|
243
267
|
revokePermission(scope: Team, permissionId: string): Promise<void>;
|
|
244
268
|
hasPermission(scope: Team, permissionId: string): Promise<boolean>;
|
|
269
|
+
/**
|
|
270
|
+
* Creates a new session object with a refresh token for this user. Can be used to impersonate them.
|
|
271
|
+
*/
|
|
272
|
+
createSession(options?: {
|
|
273
|
+
expiresInMillis?: number;
|
|
274
|
+
}): Promise<Session>;
|
|
245
275
|
} & AsyncStoreProperty<"team", [id: string], ServerTeam | null, false> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & AsyncStoreProperty<"permission", [scope: Team, permissionId: string, options?: {
|
|
246
276
|
direct?: boolean;
|
|
247
277
|
}], AdminTeamPermission | null, false> & AsyncStoreProperty<"permissions", [scope: Team, options?: {
|
|
248
278
|
direct?: boolean;
|
|
249
|
-
}], AdminTeamPermission[], true
|
|
279
|
+
}], AdminTeamPermission[], true>;
|
|
280
|
+
/**
|
|
281
|
+
* A user including sensitive fields that should only be used on the server, never sent to the client
|
|
282
|
+
* (such as sensitive information and serverMetadata).
|
|
283
|
+
*/
|
|
284
|
+
type ServerUser = ServerBaseUser & BaseUser & UserExtra;
|
|
250
285
|
type CurrentServerUser = Auth & ServerUser;
|
|
251
286
|
type CurrentInternalServerUser = CurrentServerUser & InternalUserExtra;
|
|
252
287
|
type ServerUserUpdateOptions = {
|
|
@@ -327,6 +362,7 @@ type AdminOAuthProviderConfig = {
|
|
|
327
362
|
type: 'standard';
|
|
328
363
|
clientId: string;
|
|
329
364
|
clientSecret: string;
|
|
365
|
+
facebookConfigId?: string;
|
|
330
366
|
}) & OAuthProviderConfig;
|
|
331
367
|
type AdminProjectConfigUpdateOptions = {
|
|
332
368
|
domains?: {
|
package/dist/lib/stack-app.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { KnownErrors } from '@stackframe/stack-shared';
|
|
2
2
|
import { ProductionModeError } from '@stackframe/stack-shared/dist/helpers/production-mode';
|
|
3
|
-
import { StandardProvider } from '@stackframe/stack-shared/dist/interface/clientInterface';
|
|
4
3
|
import { ApiKeysCrud } from '@stackframe/stack-shared/dist/interface/crud/api-keys';
|
|
5
4
|
import { CurrentUserCrud } from '@stackframe/stack-shared/dist/interface/crud/current-user';
|
|
6
5
|
import { EmailTemplateType } from '@stackframe/stack-shared/dist/interface/crud/email-templates';
|
|
7
6
|
import { TeamPermissionDefinitionsCrud } from '@stackframe/stack-shared/dist/interface/crud/team-permissions';
|
|
8
7
|
import { InternalSession } from '@stackframe/stack-shared/dist/sessions';
|
|
9
8
|
import { ReadonlyJson } from '@stackframe/stack-shared/dist/utils/json';
|
|
9
|
+
import { ProviderType } from '@stackframe/stack-shared/dist/utils/oauth';
|
|
10
10
|
|
|
11
11
|
type RequestLike = {
|
|
12
12
|
headers: {
|
|
@@ -20,8 +20,8 @@ type TokenStoreInit<HasTokenStore extends boolean = boolean> = HasTokenStore ext
|
|
|
20
20
|
type HandlerUrls = {
|
|
21
21
|
handler: string;
|
|
22
22
|
signIn: string;
|
|
23
|
-
afterSignIn: string;
|
|
24
23
|
signUp: string;
|
|
24
|
+
afterSignIn: string;
|
|
25
25
|
afterSignUp: string;
|
|
26
26
|
signOut: string;
|
|
27
27
|
afterSignOut: string;
|
|
@@ -35,7 +35,7 @@ type HandlerUrls = {
|
|
|
35
35
|
error: string;
|
|
36
36
|
};
|
|
37
37
|
type OAuthScopesOnSignIn = {
|
|
38
|
-
[key in
|
|
38
|
+
[key in ProviderType]: string[];
|
|
39
39
|
};
|
|
40
40
|
type ProjectCurrentUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalUser : CurrentUser;
|
|
41
41
|
type ProjectCurrentServerUser<ProjectId> = ProjectId extends "internal" ? CurrentInternalServerUser : CurrentServerUser;
|
|
@@ -150,10 +150,31 @@ type Auth = {
|
|
|
150
150
|
refreshToken: string | null;
|
|
151
151
|
}>;
|
|
152
152
|
};
|
|
153
|
-
|
|
153
|
+
/**
|
|
154
|
+
* ```
|
|
155
|
+
* +----------+-------------+-------------------+
|
|
156
|
+
* | \ | !Server | Server |
|
|
157
|
+
* +----------+-------------+-------------------+
|
|
158
|
+
* | !Session | User | ServerUser |
|
|
159
|
+
* | Session | CurrentUser | CurrentServerUser |
|
|
160
|
+
* +----------+-------------+-------------------+
|
|
161
|
+
* ```
|
|
162
|
+
*
|
|
163
|
+
* The fields on each of these types are available iff:
|
|
164
|
+
* BaseUser: true
|
|
165
|
+
* Auth: Session
|
|
166
|
+
* ServerBaseUser: Server
|
|
167
|
+
* UserExtra: Session OR Server
|
|
168
|
+
*
|
|
169
|
+
* The types are defined as follows (in the typescript manner):
|
|
170
|
+
* User = BaseUser
|
|
171
|
+
* CurrentUser = BaseUser & Auth & UserExtra
|
|
172
|
+
* ServerUser = BaseUser & ServerBaseUser & UserExtra
|
|
173
|
+
* CurrentServerUser = BaseUser & ServerBaseUser & Auth & UserExtra
|
|
174
|
+
**/
|
|
175
|
+
type BaseUser = {
|
|
154
176
|
readonly id: string;
|
|
155
177
|
readonly displayName: string | null;
|
|
156
|
-
setDisplayName(displayName: string): Promise<void>;
|
|
157
178
|
/**
|
|
158
179
|
* The user's email address.
|
|
159
180
|
*
|
|
@@ -161,11 +182,9 @@ type User = {
|
|
|
161
182
|
*/
|
|
162
183
|
readonly primaryEmail: string | null;
|
|
163
184
|
readonly primaryEmailVerified: boolean;
|
|
164
|
-
sendVerificationEmail(): Promise<KnownErrors["EmailAlreadyVerified"] | void>;
|
|
165
185
|
readonly profileImageUrl: string | null;
|
|
166
186
|
readonly signedUpAt: Date;
|
|
167
187
|
readonly clientMetadata: any;
|
|
168
|
-
setClientMetadata(metadata: any): Promise<void>;
|
|
169
188
|
/**
|
|
170
189
|
* Whether the primary e-mail can be used for authentication.
|
|
171
190
|
*/
|
|
@@ -177,6 +196,16 @@ type User = {
|
|
|
177
196
|
readonly oauthProviders: readonly {
|
|
178
197
|
id: string;
|
|
179
198
|
}[];
|
|
199
|
+
/**
|
|
200
|
+
* A shorthand method to update multiple fields of the user at once.
|
|
201
|
+
*/
|
|
202
|
+
readonly selectedTeam: Team | null;
|
|
203
|
+
toClientJson(): CurrentUserCrud["Client"]["Read"];
|
|
204
|
+
};
|
|
205
|
+
type UserExtra = {
|
|
206
|
+
setDisplayName(displayName: string): Promise<void>;
|
|
207
|
+
sendVerificationEmail(): Promise<KnownErrors["EmailAlreadyVerified"] | void>;
|
|
208
|
+
setClientMetadata(metadata: any): Promise<void>;
|
|
180
209
|
updatePassword(options: {
|
|
181
210
|
oldPassword: string;
|
|
182
211
|
newPassword: string;
|
|
@@ -185,27 +214,25 @@ type User = {
|
|
|
185
214
|
* A shorthand method to update multiple fields of the user at once.
|
|
186
215
|
*/
|
|
187
216
|
update(update: UserUpdateOptions): Promise<void>;
|
|
188
|
-
|
|
189
|
-
readonly selectedTeam: Team | null;
|
|
190
|
-
setSelectedTeam(team: Team | null): Promise<void>;
|
|
191
|
-
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
192
|
-
getConnectedAccount(id: StandardProvider, options: {
|
|
217
|
+
getConnectedAccount(id: ProviderType, options: {
|
|
193
218
|
or: 'redirect';
|
|
194
219
|
scopes?: string[];
|
|
195
220
|
}): Promise<OAuthConnection>;
|
|
196
|
-
getConnectedAccount(id:
|
|
221
|
+
getConnectedAccount(id: ProviderType, options?: {
|
|
197
222
|
or?: 'redirect' | 'throw' | 'return-null';
|
|
198
223
|
scopes?: string[];
|
|
199
224
|
}): Promise<OAuthConnection | null>;
|
|
200
|
-
useConnectedAccount(id:
|
|
225
|
+
useConnectedAccount(id: ProviderType, options: {
|
|
201
226
|
or: 'redirect';
|
|
202
227
|
scopes?: string[];
|
|
203
228
|
}): OAuthConnection;
|
|
204
|
-
useConnectedAccount(id:
|
|
229
|
+
useConnectedAccount(id: ProviderType, options?: {
|
|
205
230
|
or?: 'redirect' | 'throw' | 'return-null';
|
|
206
231
|
scopes?: string[];
|
|
207
232
|
}): OAuthConnection | null;
|
|
208
|
-
|
|
233
|
+
hasPermission(scope: Team, permissionId: string): Promise<boolean>;
|
|
234
|
+
setSelectedTeam(team: Team | null): Promise<void>;
|
|
235
|
+
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
209
236
|
} & AsyncStoreProperty<"team", [id: string], Team | null, false> & AsyncStoreProperty<"teams", [], Team[], true> & AsyncStoreProperty<"permission", [scope: Team, permissionId: string, options?: {
|
|
210
237
|
recursive?: boolean;
|
|
211
238
|
}], TeamPermission | null, false> & AsyncStoreProperty<"permissions", [scope: Team, options?: {
|
|
@@ -216,18 +243,15 @@ type InternalUserExtra = {
|
|
|
216
243
|
displayName: string;
|
|
217
244
|
}): Promise<AdminProject>;
|
|
218
245
|
} & AsyncStoreProperty<"ownedProjects", [], AdminOwnedProject[], true>;
|
|
219
|
-
type
|
|
246
|
+
type User = BaseUser;
|
|
247
|
+
type CurrentUser = BaseUser & Auth & UserExtra;
|
|
220
248
|
type CurrentInternalUser = CurrentUser & InternalUserExtra;
|
|
221
249
|
type UserUpdateOptions = {
|
|
222
250
|
displayName?: string;
|
|
223
251
|
clientMetadata?: ReadonlyJson;
|
|
224
252
|
selectedTeamId?: string | null;
|
|
225
253
|
};
|
|
226
|
-
|
|
227
|
-
* A user including sensitive fields that should only be used on the server, never sent to the client
|
|
228
|
-
* (such as sensitive information and serverMetadata).
|
|
229
|
-
*/
|
|
230
|
-
type ServerUser = {
|
|
254
|
+
type ServerBaseUser = {
|
|
231
255
|
setPrimaryEmail(email: string, options?: {
|
|
232
256
|
verified?: boolean | undefined;
|
|
233
257
|
}): Promise<void>;
|
|
@@ -242,11 +266,22 @@ type ServerUser = {
|
|
|
242
266
|
grantPermission(scope: Team, permissionId: string): Promise<void>;
|
|
243
267
|
revokePermission(scope: Team, permissionId: string): Promise<void>;
|
|
244
268
|
hasPermission(scope: Team, permissionId: string): Promise<boolean>;
|
|
269
|
+
/**
|
|
270
|
+
* Creates a new session object with a refresh token for this user. Can be used to impersonate them.
|
|
271
|
+
*/
|
|
272
|
+
createSession(options?: {
|
|
273
|
+
expiresInMillis?: number;
|
|
274
|
+
}): Promise<Session>;
|
|
245
275
|
} & AsyncStoreProperty<"team", [id: string], ServerTeam | null, false> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & AsyncStoreProperty<"permission", [scope: Team, permissionId: string, options?: {
|
|
246
276
|
direct?: boolean;
|
|
247
277
|
}], AdminTeamPermission | null, false> & AsyncStoreProperty<"permissions", [scope: Team, options?: {
|
|
248
278
|
direct?: boolean;
|
|
249
|
-
}], AdminTeamPermission[], true
|
|
279
|
+
}], AdminTeamPermission[], true>;
|
|
280
|
+
/**
|
|
281
|
+
* A user including sensitive fields that should only be used on the server, never sent to the client
|
|
282
|
+
* (such as sensitive information and serverMetadata).
|
|
283
|
+
*/
|
|
284
|
+
type ServerUser = ServerBaseUser & BaseUser & UserExtra;
|
|
250
285
|
type CurrentServerUser = Auth & ServerUser;
|
|
251
286
|
type CurrentInternalServerUser = CurrentServerUser & InternalUserExtra;
|
|
252
287
|
type ServerUserUpdateOptions = {
|
|
@@ -327,6 +362,7 @@ type AdminOAuthProviderConfig = {
|
|
|
327
362
|
type: 'standard';
|
|
328
363
|
clientId: string;
|
|
329
364
|
clientSecret: string;
|
|
365
|
+
facebookConfigId?: string;
|
|
330
366
|
}) & OAuthProviderConfig;
|
|
331
367
|
type AdminProjectConfigUpdateOptions = {
|
|
332
368
|
domains?: {
|