@stackframe/stack 2.5.7 → 2.5.9
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 +139 -92
- 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 +58 -24
- package/dist/lib/stack-app.d.ts +58 -24
- package/dist/lib/stack-app.js +139 -92
- 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,11 +150,31 @@ type Auth = {
|
|
|
150
150
|
refreshToken: string | null;
|
|
151
151
|
}>;
|
|
152
152
|
};
|
|
153
|
-
|
|
154
|
-
|
|
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 = {
|
|
155
176
|
readonly id: string;
|
|
156
177
|
readonly displayName: string | null;
|
|
157
|
-
setDisplayName(displayName: string): Promise<void>;
|
|
158
178
|
/**
|
|
159
179
|
* The user's email address.
|
|
160
180
|
*
|
|
@@ -162,11 +182,9 @@ type User = {
|
|
|
162
182
|
*/
|
|
163
183
|
readonly primaryEmail: string | null;
|
|
164
184
|
readonly primaryEmailVerified: boolean;
|
|
165
|
-
sendVerificationEmail(): Promise<KnownErrors["EmailAlreadyVerified"] | void>;
|
|
166
185
|
readonly profileImageUrl: string | null;
|
|
167
186
|
readonly signedUpAt: Date;
|
|
168
187
|
readonly clientMetadata: any;
|
|
169
|
-
setClientMetadata(metadata: any): Promise<void>;
|
|
170
188
|
/**
|
|
171
189
|
* Whether the primary e-mail can be used for authentication.
|
|
172
190
|
*/
|
|
@@ -178,6 +196,16 @@ type User = {
|
|
|
178
196
|
readonly oauthProviders: readonly {
|
|
179
197
|
id: string;
|
|
180
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>;
|
|
181
209
|
updatePassword(options: {
|
|
182
210
|
oldPassword: string;
|
|
183
211
|
newPassword: string;
|
|
@@ -186,27 +214,25 @@ type User = {
|
|
|
186
214
|
* A shorthand method to update multiple fields of the user at once.
|
|
187
215
|
*/
|
|
188
216
|
update(update: UserUpdateOptions): Promise<void>;
|
|
189
|
-
|
|
190
|
-
readonly selectedTeam: Team | null;
|
|
191
|
-
setSelectedTeam(team: Team | null): Promise<void>;
|
|
192
|
-
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
193
|
-
getConnectedAccount(id: StandardProvider, options: {
|
|
217
|
+
getConnectedAccount(id: ProviderType, options: {
|
|
194
218
|
or: 'redirect';
|
|
195
219
|
scopes?: string[];
|
|
196
220
|
}): Promise<OAuthConnection>;
|
|
197
|
-
getConnectedAccount(id:
|
|
221
|
+
getConnectedAccount(id: ProviderType, options?: {
|
|
198
222
|
or?: 'redirect' | 'throw' | 'return-null';
|
|
199
223
|
scopes?: string[];
|
|
200
224
|
}): Promise<OAuthConnection | null>;
|
|
201
|
-
useConnectedAccount(id:
|
|
225
|
+
useConnectedAccount(id: ProviderType, options: {
|
|
202
226
|
or: 'redirect';
|
|
203
227
|
scopes?: string[];
|
|
204
228
|
}): OAuthConnection;
|
|
205
|
-
useConnectedAccount(id:
|
|
229
|
+
useConnectedAccount(id: ProviderType, options?: {
|
|
206
230
|
or?: 'redirect' | 'throw' | 'return-null';
|
|
207
231
|
scopes?: string[];
|
|
208
232
|
}): OAuthConnection | null;
|
|
209
|
-
|
|
233
|
+
hasPermission(scope: Team, permissionId: string): Promise<boolean>;
|
|
234
|
+
setSelectedTeam(team: Team | null): Promise<void>;
|
|
235
|
+
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
210
236
|
} & AsyncStoreProperty<"team", [id: string], Team | null, false> & AsyncStoreProperty<"teams", [], Team[], true> & AsyncStoreProperty<"permission", [scope: Team, permissionId: string, options?: {
|
|
211
237
|
recursive?: boolean;
|
|
212
238
|
}], TeamPermission | null, false> & AsyncStoreProperty<"permissions", [scope: Team, options?: {
|
|
@@ -217,18 +243,15 @@ type InternalUserExtra = {
|
|
|
217
243
|
displayName: string;
|
|
218
244
|
}): Promise<AdminProject>;
|
|
219
245
|
} & AsyncStoreProperty<"ownedProjects", [], AdminOwnedProject[], true>;
|
|
220
|
-
type
|
|
246
|
+
type User = BaseUser;
|
|
247
|
+
type CurrentUser = BaseUser & Auth & UserExtra;
|
|
221
248
|
type CurrentInternalUser = CurrentUser & InternalUserExtra;
|
|
222
249
|
type UserUpdateOptions = {
|
|
223
250
|
displayName?: string;
|
|
224
251
|
clientMetadata?: ReadonlyJson;
|
|
225
252
|
selectedTeamId?: string | null;
|
|
226
253
|
};
|
|
227
|
-
|
|
228
|
-
* A user including sensitive fields that should only be used on the server, never sent to the client
|
|
229
|
-
* (such as sensitive information and serverMetadata).
|
|
230
|
-
*/
|
|
231
|
-
type ServerUser = {
|
|
254
|
+
type ServerBaseUser = {
|
|
232
255
|
setPrimaryEmail(email: string, options?: {
|
|
233
256
|
verified?: boolean | undefined;
|
|
234
257
|
}): Promise<void>;
|
|
@@ -243,11 +266,22 @@ type ServerUser = {
|
|
|
243
266
|
grantPermission(scope: Team, permissionId: string): Promise<void>;
|
|
244
267
|
revokePermission(scope: Team, permissionId: string): Promise<void>;
|
|
245
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>;
|
|
246
275
|
} & AsyncStoreProperty<"team", [id: string], ServerTeam | null, false> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & AsyncStoreProperty<"permission", [scope: Team, permissionId: string, options?: {
|
|
247
276
|
direct?: boolean;
|
|
248
277
|
}], AdminTeamPermission | null, false> & AsyncStoreProperty<"permissions", [scope: Team, options?: {
|
|
249
278
|
direct?: boolean;
|
|
250
|
-
}], 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;
|
|
251
285
|
type CurrentServerUser = Auth & ServerUser;
|
|
252
286
|
type CurrentInternalServerUser = CurrentServerUser & InternalUserExtra;
|
|
253
287
|
type ServerUserUpdateOptions = {
|
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,11 +150,31 @@ type Auth = {
|
|
|
150
150
|
refreshToken: string | null;
|
|
151
151
|
}>;
|
|
152
152
|
};
|
|
153
|
-
|
|
154
|
-
|
|
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 = {
|
|
155
176
|
readonly id: string;
|
|
156
177
|
readonly displayName: string | null;
|
|
157
|
-
setDisplayName(displayName: string): Promise<void>;
|
|
158
178
|
/**
|
|
159
179
|
* The user's email address.
|
|
160
180
|
*
|
|
@@ -162,11 +182,9 @@ type User = {
|
|
|
162
182
|
*/
|
|
163
183
|
readonly primaryEmail: string | null;
|
|
164
184
|
readonly primaryEmailVerified: boolean;
|
|
165
|
-
sendVerificationEmail(): Promise<KnownErrors["EmailAlreadyVerified"] | void>;
|
|
166
185
|
readonly profileImageUrl: string | null;
|
|
167
186
|
readonly signedUpAt: Date;
|
|
168
187
|
readonly clientMetadata: any;
|
|
169
|
-
setClientMetadata(metadata: any): Promise<void>;
|
|
170
188
|
/**
|
|
171
189
|
* Whether the primary e-mail can be used for authentication.
|
|
172
190
|
*/
|
|
@@ -178,6 +196,16 @@ type User = {
|
|
|
178
196
|
readonly oauthProviders: readonly {
|
|
179
197
|
id: string;
|
|
180
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>;
|
|
181
209
|
updatePassword(options: {
|
|
182
210
|
oldPassword: string;
|
|
183
211
|
newPassword: string;
|
|
@@ -186,27 +214,25 @@ type User = {
|
|
|
186
214
|
* A shorthand method to update multiple fields of the user at once.
|
|
187
215
|
*/
|
|
188
216
|
update(update: UserUpdateOptions): Promise<void>;
|
|
189
|
-
|
|
190
|
-
readonly selectedTeam: Team | null;
|
|
191
|
-
setSelectedTeam(team: Team | null): Promise<void>;
|
|
192
|
-
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
193
|
-
getConnectedAccount(id: StandardProvider, options: {
|
|
217
|
+
getConnectedAccount(id: ProviderType, options: {
|
|
194
218
|
or: 'redirect';
|
|
195
219
|
scopes?: string[];
|
|
196
220
|
}): Promise<OAuthConnection>;
|
|
197
|
-
getConnectedAccount(id:
|
|
221
|
+
getConnectedAccount(id: ProviderType, options?: {
|
|
198
222
|
or?: 'redirect' | 'throw' | 'return-null';
|
|
199
223
|
scopes?: string[];
|
|
200
224
|
}): Promise<OAuthConnection | null>;
|
|
201
|
-
useConnectedAccount(id:
|
|
225
|
+
useConnectedAccount(id: ProviderType, options: {
|
|
202
226
|
or: 'redirect';
|
|
203
227
|
scopes?: string[];
|
|
204
228
|
}): OAuthConnection;
|
|
205
|
-
useConnectedAccount(id:
|
|
229
|
+
useConnectedAccount(id: ProviderType, options?: {
|
|
206
230
|
or?: 'redirect' | 'throw' | 'return-null';
|
|
207
231
|
scopes?: string[];
|
|
208
232
|
}): OAuthConnection | null;
|
|
209
|
-
|
|
233
|
+
hasPermission(scope: Team, permissionId: string): Promise<boolean>;
|
|
234
|
+
setSelectedTeam(team: Team | null): Promise<void>;
|
|
235
|
+
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
210
236
|
} & AsyncStoreProperty<"team", [id: string], Team | null, false> & AsyncStoreProperty<"teams", [], Team[], true> & AsyncStoreProperty<"permission", [scope: Team, permissionId: string, options?: {
|
|
211
237
|
recursive?: boolean;
|
|
212
238
|
}], TeamPermission | null, false> & AsyncStoreProperty<"permissions", [scope: Team, options?: {
|
|
@@ -217,18 +243,15 @@ type InternalUserExtra = {
|
|
|
217
243
|
displayName: string;
|
|
218
244
|
}): Promise<AdminProject>;
|
|
219
245
|
} & AsyncStoreProperty<"ownedProjects", [], AdminOwnedProject[], true>;
|
|
220
|
-
type
|
|
246
|
+
type User = BaseUser;
|
|
247
|
+
type CurrentUser = BaseUser & Auth & UserExtra;
|
|
221
248
|
type CurrentInternalUser = CurrentUser & InternalUserExtra;
|
|
222
249
|
type UserUpdateOptions = {
|
|
223
250
|
displayName?: string;
|
|
224
251
|
clientMetadata?: ReadonlyJson;
|
|
225
252
|
selectedTeamId?: string | null;
|
|
226
253
|
};
|
|
227
|
-
|
|
228
|
-
* A user including sensitive fields that should only be used on the server, never sent to the client
|
|
229
|
-
* (such as sensitive information and serverMetadata).
|
|
230
|
-
*/
|
|
231
|
-
type ServerUser = {
|
|
254
|
+
type ServerBaseUser = {
|
|
232
255
|
setPrimaryEmail(email: string, options?: {
|
|
233
256
|
verified?: boolean | undefined;
|
|
234
257
|
}): Promise<void>;
|
|
@@ -243,11 +266,22 @@ type ServerUser = {
|
|
|
243
266
|
grantPermission(scope: Team, permissionId: string): Promise<void>;
|
|
244
267
|
revokePermission(scope: Team, permissionId: string): Promise<void>;
|
|
245
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>;
|
|
246
275
|
} & AsyncStoreProperty<"team", [id: string], ServerTeam | null, false> & AsyncStoreProperty<"teams", [], ServerTeam[], true> & AsyncStoreProperty<"permission", [scope: Team, permissionId: string, options?: {
|
|
247
276
|
direct?: boolean;
|
|
248
277
|
}], AdminTeamPermission | null, false> & AsyncStoreProperty<"permissions", [scope: Team, options?: {
|
|
249
278
|
direct?: boolean;
|
|
250
|
-
}], 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;
|
|
251
285
|
type CurrentServerUser = Auth & ServerUser;
|
|
252
286
|
type CurrentInternalServerUser = CurrentServerUser & InternalUserExtra;
|
|
253
287
|
type ServerUserUpdateOptions = {
|