@stackframe/stack 2.7.30 → 2.8.2
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 +31 -0
- package/dist/components-page/account-settings.js +3 -3
- package/dist/components-page/account-settings.js.map +1 -1
- package/dist/components-page/oauth-callback.js +31 -13
- package/dist/components-page/oauth-callback.js.map +1 -1
- package/dist/esm/components-page/account-settings.js +3 -3
- package/dist/esm/components-page/account-settings.js.map +1 -1
- package/dist/esm/components-page/oauth-callback.js +31 -13
- package/dist/esm/components-page/oauth-callback.js.map +1 -1
- package/dist/esm/generated/global-css.js +1 -1
- package/dist/esm/generated/global-css.js.map +1 -1
- package/dist/esm/lib/auth.js +6 -6
- package/dist/esm/lib/auth.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js +33 -6
- package/dist/esm/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js +76 -39
- package/dist/esm/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/common.js +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/common.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/implementations/server-app-impl.js +66 -25
- package/dist/esm/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -1
- package/dist/esm/lib/stack-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/esm/lib/stack-app/index.js.map +1 -1
- package/dist/esm/lib/stack-app/permissions/index.js +16 -0
- package/dist/esm/lib/stack-app/permissions/index.js.map +1 -1
- package/dist/esm/lib/stack-app/projects/index.js +1 -0
- package/dist/esm/lib/stack-app/projects/index.js.map +1 -1
- package/dist/esm/lib/stack-app/users/index.js.map +1 -1
- package/dist/esm/providers/theme-provider.js +2 -2
- package/dist/esm/providers/theme-provider.js.map +1 -1
- package/dist/esm/utils/url.js +2 -2
- package/dist/esm/utils/url.js.map +1 -1
- package/dist/generated/global-css.js +1 -1
- package/dist/generated/global-css.js.map +1 -1
- package/dist/index.d.mts +63 -3
- package/dist/index.d.ts +63 -3
- package/dist/lib/auth.js +6 -6
- package/dist/lib/auth.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/admin-app-impl.js +32 -5
- package/dist/lib/stack-app/apps/implementations/admin-app-impl.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/client-app-impl.js +76 -39
- package/dist/lib/stack-app/apps/implementations/client-app-impl.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/common.js +1 -1
- package/dist/lib/stack-app/apps/implementations/common.js.map +1 -1
- package/dist/lib/stack-app/apps/implementations/server-app-impl.js +66 -25
- package/dist/lib/stack-app/apps/implementations/server-app-impl.js.map +1 -1
- package/dist/lib/stack-app/apps/interfaces/admin-app.js.map +1 -1
- package/dist/lib/stack-app/index.js.map +1 -1
- package/dist/lib/stack-app/permissions/index.js +18 -0
- package/dist/lib/stack-app/permissions/index.js.map +1 -1
- package/dist/lib/stack-app/project-configs/index.js.map +1 -1
- package/dist/lib/stack-app/projects/index.js +1 -0
- package/dist/lib/stack-app/projects/index.js.map +1 -1
- package/dist/lib/stack-app/users/index.js.map +1 -1
- package/dist/providers/theme-provider.js +2 -2
- package/dist/providers/theme-provider.js.map +1 -1
- package/dist/utils/url.js +2 -2
- package/dist/utils/url.js.map +1 -1
- package/package.json +5 -5
package/dist/index.d.mts
CHANGED
|
@@ -135,13 +135,30 @@ type AdminTeamPermissionDefinition = {
|
|
|
135
135
|
id: string;
|
|
136
136
|
description?: string;
|
|
137
137
|
containedPermissionIds: string[];
|
|
138
|
+
isDefaultUserPermission?: boolean;
|
|
138
139
|
};
|
|
139
140
|
type AdminTeamPermissionDefinitionCreateOptions = {
|
|
140
141
|
id: string;
|
|
141
142
|
description?: string;
|
|
142
143
|
containedPermissionIds: string[];
|
|
144
|
+
isDefaultUserPermission?: boolean;
|
|
143
145
|
};
|
|
144
146
|
type AdminTeamPermissionDefinitionUpdateOptions = Partial<AdminTeamPermissionDefinitionCreateOptions>;
|
|
147
|
+
type ProjectPermission = {
|
|
148
|
+
id: string;
|
|
149
|
+
};
|
|
150
|
+
type AdminProjectPermission = ProjectPermission;
|
|
151
|
+
type AdminProjectPermissionDefinition = {
|
|
152
|
+
id: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
containedPermissionIds: string[];
|
|
155
|
+
};
|
|
156
|
+
type AdminProjectPermissionDefinitionCreateOptions = {
|
|
157
|
+
id: string;
|
|
158
|
+
description?: string;
|
|
159
|
+
containedPermissionIds: string[];
|
|
160
|
+
};
|
|
161
|
+
type AdminProjectPermissionDefinitionUpdateOptions = Partial<AdminProjectPermissionDefinitionCreateOptions>;
|
|
145
162
|
|
|
146
163
|
type Connection = {
|
|
147
164
|
id: string;
|
|
@@ -320,6 +337,7 @@ type BaseUser = {
|
|
|
320
337
|
readonly otpAuthEnabled: boolean;
|
|
321
338
|
readonly passkeyAuthEnabled: boolean;
|
|
322
339
|
readonly isMultiFactorRequired: boolean;
|
|
340
|
+
readonly isAnonymous: boolean;
|
|
323
341
|
toClientJson(): CurrentUserCrud["Client"]["Read"];
|
|
324
342
|
/**
|
|
325
343
|
* @deprecated, use contact channel's usedForAuth instead
|
|
@@ -369,6 +387,23 @@ type UserExtra = {
|
|
|
369
387
|
scopes?: string[];
|
|
370
388
|
}): OAuthConnection | null;
|
|
371
389
|
hasPermission(scope: Team, permissionId: string): Promise<boolean>;
|
|
390
|
+
hasPermission(permissionId: string): Promise<boolean>;
|
|
391
|
+
getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>;
|
|
392
|
+
getPermission(permissionId: string): Promise<TeamPermission | null>;
|
|
393
|
+
listPermissions(scope: Team, options?: {
|
|
394
|
+
recursive?: boolean;
|
|
395
|
+
}): Promise<TeamPermission[]>;
|
|
396
|
+
listPermissions(options?: {
|
|
397
|
+
recursive?: boolean;
|
|
398
|
+
}): Promise<TeamPermission[]>;
|
|
399
|
+
usePermissions(scope: Team, options?: {
|
|
400
|
+
recursive?: boolean;
|
|
401
|
+
}): TeamPermission[];
|
|
402
|
+
usePermissions(options?: {
|
|
403
|
+
recursive?: boolean;
|
|
404
|
+
}): TeamPermission[];
|
|
405
|
+
usePermission(scope: Team, permissionId: string): TeamPermission | null;
|
|
406
|
+
usePermission(permissionId: string): TeamPermission | null;
|
|
372
407
|
readonly selectedTeam: Team | null;
|
|
373
408
|
setSelectedTeam(team: Team | null): Promise<void>;
|
|
374
409
|
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
@@ -424,6 +459,24 @@ type ServerBaseUser = {
|
|
|
424
459
|
update(user: ServerUserUpdateOptions): Promise<void>;
|
|
425
460
|
grantPermission(scope: Team, permissionId: string): Promise<void>;
|
|
426
461
|
revokePermission(scope: Team, permissionId: string): Promise<void>;
|
|
462
|
+
getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>;
|
|
463
|
+
getPermission(permissionId: string): Promise<TeamPermission | null>;
|
|
464
|
+
hasPermission(scope: Team, permissionId: string): Promise<boolean>;
|
|
465
|
+
hasPermission(permissionId: string): Promise<boolean>;
|
|
466
|
+
listPermissions(scope: Team, options?: {
|
|
467
|
+
recursive?: boolean;
|
|
468
|
+
}): Promise<TeamPermission[]>;
|
|
469
|
+
listPermissions(options?: {
|
|
470
|
+
recursive?: boolean;
|
|
471
|
+
}): Promise<TeamPermission[]>;
|
|
472
|
+
usePermissions(scope: Team, options?: {
|
|
473
|
+
recursive?: boolean;
|
|
474
|
+
}): TeamPermission[];
|
|
475
|
+
usePermissions(options?: {
|
|
476
|
+
recursive?: boolean;
|
|
477
|
+
}): TeamPermission[];
|
|
478
|
+
usePermission(scope: Team, permissionId: string): TeamPermission | null;
|
|
479
|
+
usePermission(permissionId: string): TeamPermission | null;
|
|
427
480
|
/**
|
|
428
481
|
* Creates a new session object with a refresh token for this user. Can be used to impersonate them.
|
|
429
482
|
*/
|
|
@@ -597,7 +650,7 @@ type StackAdminAppConstructor = {
|
|
|
597
650
|
new <HasTokenStore extends boolean, ProjectId extends string>(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>): StackAdminApp<HasTokenStore, ProjectId>;
|
|
598
651
|
new (options: StackAdminAppConstructorOptions<boolean, string>): StackAdminApp<boolean, string>;
|
|
599
652
|
};
|
|
600
|
-
type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (AsyncStoreProperty<"project", [], AdminProject, false> & AsyncStoreProperty<"apiKeys", [], ApiKey[], true> & AsyncStoreProperty<"teamPermissionDefinitions", [], AdminTeamPermissionDefinition[], true> & {
|
|
653
|
+
type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (AsyncStoreProperty<"project", [], AdminProject, false> & AsyncStoreProperty<"apiKeys", [], ApiKey[], true> & AsyncStoreProperty<"teamPermissionDefinitions", [], AdminTeamPermissionDefinition[], true> & AsyncStoreProperty<"projectPermissionDefinitions", [], AdminProjectPermissionDefinition[], true> & {
|
|
601
654
|
useEmailTemplates(): AdminEmailTemplate[];
|
|
602
655
|
listEmailTemplates(): Promise<AdminEmailTemplate[]>;
|
|
603
656
|
updateEmailTemplate(type: EmailTemplateType, data: AdminEmailTemplateUpdateOptions): Promise<void>;
|
|
@@ -606,6 +659,9 @@ type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends st
|
|
|
606
659
|
createTeamPermissionDefinition(data: AdminTeamPermissionDefinitionCreateOptions): Promise<AdminTeamPermission>;
|
|
607
660
|
updateTeamPermissionDefinition(permissionId: string, data: AdminTeamPermissionDefinitionUpdateOptions): Promise<void>;
|
|
608
661
|
deleteTeamPermissionDefinition(permissionId: string): Promise<void>;
|
|
662
|
+
createProjectPermissionDefinition(data: AdminProjectPermissionDefinitionCreateOptions): Promise<AdminProjectPermission>;
|
|
663
|
+
updateProjectPermissionDefinition(permissionId: string, data: AdminProjectPermissionDefinitionUpdateOptions): Promise<void>;
|
|
664
|
+
deleteProjectPermissionDefinition(permissionId: string): Promise<void>;
|
|
609
665
|
useSvixToken(): string;
|
|
610
666
|
sendTestEmail(options: {
|
|
611
667
|
recipientEmail: string;
|
|
@@ -644,6 +700,7 @@ type AdminProjectConfig = {
|
|
|
644
700
|
readonly createTeamOnSignUp: boolean;
|
|
645
701
|
readonly teamCreatorDefaultPermissions: AdminTeamPermission[];
|
|
646
702
|
readonly teamMemberDefaultPermissions: AdminTeamPermission[];
|
|
703
|
+
readonly userDefaultPermissions: AdminTeamPermission[];
|
|
647
704
|
readonly oauthAccountMergeStrategy: 'link_method' | 'raise_error' | 'allow_duplicates';
|
|
648
705
|
};
|
|
649
706
|
type AdminEmailConfig = ({
|
|
@@ -694,6 +751,9 @@ type AdminProjectConfigUpdateOptions = {
|
|
|
694
751
|
teamMemberDefaultPermissions?: {
|
|
695
752
|
id: string;
|
|
696
753
|
}[];
|
|
754
|
+
userDefaultPermissions?: {
|
|
755
|
+
id: string;
|
|
756
|
+
}[];
|
|
697
757
|
oauthAccountMergeStrategy?: 'link_method' | 'raise_error' | 'allow_duplicates';
|
|
698
758
|
};
|
|
699
759
|
|
|
@@ -863,7 +923,7 @@ declare function MagicLinkCallback(props: {
|
|
|
863
923
|
fullPage?: boolean;
|
|
864
924
|
}): react_jsx_runtime.JSX.Element;
|
|
865
925
|
|
|
866
|
-
declare function OAuthCallback(
|
|
926
|
+
declare function OAuthCallback({ fullPage }: {
|
|
867
927
|
fullPage?: boolean;
|
|
868
928
|
}): react_jsx_runtime.JSX.Element;
|
|
869
929
|
|
|
@@ -1099,4 +1159,4 @@ type UserButtonProps = {
|
|
|
1099
1159
|
};
|
|
1100
1160
|
declare function UserButton(props: UserButtonProps): react_jsx_runtime.JSX.Element;
|
|
1101
1161
|
|
|
1102
|
-
export { AccountSettings, type AdminDomainConfig, type AdminEmailConfig, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type ApiKey, type ApiKeyBase, type ApiKeyBaseCrudRead, type ApiKeyCreateOptions, type ApiKeyFirstView, type Auth, AuthPage, type Connection, type ContactChannel, CredentialSignIn, CredentialSignUp, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, EmailVerification, ForgotPassword, type GetUserOptions$1 as GetUserOptions, type HandlerUrls, MagicLinkSignIn, MessageCard, OAuthButton, OAuthButtonGroup, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, PasswordReset, type Project, type ProjectConfig, SelectedTeamSwitcher, type ServerContactChannel, type ServerListUsersOptions, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, type Session, SignIn, SignUp, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, NextStackHandler as StackHandler, NextStackProvider as StackProvider, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, StackTheme, type Team, type TeamCreateOptions, type TeamInvitation$1 as TeamInvitation, type TeamMemberProfile, type
|
|
1162
|
+
export { AccountSettings, type AdminDomainConfig, type AdminEmailConfig, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectPermission, type AdminProjectPermissionDefinition, type AdminProjectPermissionDefinitionCreateOptions, type AdminProjectPermissionDefinitionUpdateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type ApiKey, type ApiKeyBase, type ApiKeyBaseCrudRead, type ApiKeyCreateOptions, type ApiKeyFirstView, type Auth, AuthPage, type Connection, type ContactChannel, CredentialSignIn, CredentialSignUp, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, EmailVerification, ForgotPassword, type GetUserOptions$1 as GetUserOptions, type HandlerUrls, MagicLinkSignIn, MessageCard, OAuthButton, OAuthButtonGroup, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, PasswordReset, type Project, type ProjectConfig, SelectedTeamSwitcher, type ServerContactChannel, type ServerListUsersOptions, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, type Session, SignIn, SignUp, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, NextStackHandler as StackHandler, NextStackProvider as StackProvider, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, StackTheme, type Team, type TeamCreateOptions, type TeamInvitation$1 as TeamInvitation, type TeamMemberProfile, type TeamUpdateOptions, type TeamUser, type User, UserAvatar, UserButton, stackAppInternalsSymbol, useStackApp, useUser };
|
package/dist/index.d.ts
CHANGED
|
@@ -135,13 +135,30 @@ type AdminTeamPermissionDefinition = {
|
|
|
135
135
|
id: string;
|
|
136
136
|
description?: string;
|
|
137
137
|
containedPermissionIds: string[];
|
|
138
|
+
isDefaultUserPermission?: boolean;
|
|
138
139
|
};
|
|
139
140
|
type AdminTeamPermissionDefinitionCreateOptions = {
|
|
140
141
|
id: string;
|
|
141
142
|
description?: string;
|
|
142
143
|
containedPermissionIds: string[];
|
|
144
|
+
isDefaultUserPermission?: boolean;
|
|
143
145
|
};
|
|
144
146
|
type AdminTeamPermissionDefinitionUpdateOptions = Partial<AdminTeamPermissionDefinitionCreateOptions>;
|
|
147
|
+
type ProjectPermission = {
|
|
148
|
+
id: string;
|
|
149
|
+
};
|
|
150
|
+
type AdminProjectPermission = ProjectPermission;
|
|
151
|
+
type AdminProjectPermissionDefinition = {
|
|
152
|
+
id: string;
|
|
153
|
+
description?: string;
|
|
154
|
+
containedPermissionIds: string[];
|
|
155
|
+
};
|
|
156
|
+
type AdminProjectPermissionDefinitionCreateOptions = {
|
|
157
|
+
id: string;
|
|
158
|
+
description?: string;
|
|
159
|
+
containedPermissionIds: string[];
|
|
160
|
+
};
|
|
161
|
+
type AdminProjectPermissionDefinitionUpdateOptions = Partial<AdminProjectPermissionDefinitionCreateOptions>;
|
|
145
162
|
|
|
146
163
|
type Connection = {
|
|
147
164
|
id: string;
|
|
@@ -320,6 +337,7 @@ type BaseUser = {
|
|
|
320
337
|
readonly otpAuthEnabled: boolean;
|
|
321
338
|
readonly passkeyAuthEnabled: boolean;
|
|
322
339
|
readonly isMultiFactorRequired: boolean;
|
|
340
|
+
readonly isAnonymous: boolean;
|
|
323
341
|
toClientJson(): CurrentUserCrud["Client"]["Read"];
|
|
324
342
|
/**
|
|
325
343
|
* @deprecated, use contact channel's usedForAuth instead
|
|
@@ -369,6 +387,23 @@ type UserExtra = {
|
|
|
369
387
|
scopes?: string[];
|
|
370
388
|
}): OAuthConnection | null;
|
|
371
389
|
hasPermission(scope: Team, permissionId: string): Promise<boolean>;
|
|
390
|
+
hasPermission(permissionId: string): Promise<boolean>;
|
|
391
|
+
getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>;
|
|
392
|
+
getPermission(permissionId: string): Promise<TeamPermission | null>;
|
|
393
|
+
listPermissions(scope: Team, options?: {
|
|
394
|
+
recursive?: boolean;
|
|
395
|
+
}): Promise<TeamPermission[]>;
|
|
396
|
+
listPermissions(options?: {
|
|
397
|
+
recursive?: boolean;
|
|
398
|
+
}): Promise<TeamPermission[]>;
|
|
399
|
+
usePermissions(scope: Team, options?: {
|
|
400
|
+
recursive?: boolean;
|
|
401
|
+
}): TeamPermission[];
|
|
402
|
+
usePermissions(options?: {
|
|
403
|
+
recursive?: boolean;
|
|
404
|
+
}): TeamPermission[];
|
|
405
|
+
usePermission(scope: Team, permissionId: string): TeamPermission | null;
|
|
406
|
+
usePermission(permissionId: string): TeamPermission | null;
|
|
372
407
|
readonly selectedTeam: Team | null;
|
|
373
408
|
setSelectedTeam(team: Team | null): Promise<void>;
|
|
374
409
|
createTeam(data: TeamCreateOptions): Promise<Team>;
|
|
@@ -424,6 +459,24 @@ type ServerBaseUser = {
|
|
|
424
459
|
update(user: ServerUserUpdateOptions): Promise<void>;
|
|
425
460
|
grantPermission(scope: Team, permissionId: string): Promise<void>;
|
|
426
461
|
revokePermission(scope: Team, permissionId: string): Promise<void>;
|
|
462
|
+
getPermission(scope: Team, permissionId: string): Promise<TeamPermission | null>;
|
|
463
|
+
getPermission(permissionId: string): Promise<TeamPermission | null>;
|
|
464
|
+
hasPermission(scope: Team, permissionId: string): Promise<boolean>;
|
|
465
|
+
hasPermission(permissionId: string): Promise<boolean>;
|
|
466
|
+
listPermissions(scope: Team, options?: {
|
|
467
|
+
recursive?: boolean;
|
|
468
|
+
}): Promise<TeamPermission[]>;
|
|
469
|
+
listPermissions(options?: {
|
|
470
|
+
recursive?: boolean;
|
|
471
|
+
}): Promise<TeamPermission[]>;
|
|
472
|
+
usePermissions(scope: Team, options?: {
|
|
473
|
+
recursive?: boolean;
|
|
474
|
+
}): TeamPermission[];
|
|
475
|
+
usePermissions(options?: {
|
|
476
|
+
recursive?: boolean;
|
|
477
|
+
}): TeamPermission[];
|
|
478
|
+
usePermission(scope: Team, permissionId: string): TeamPermission | null;
|
|
479
|
+
usePermission(permissionId: string): TeamPermission | null;
|
|
427
480
|
/**
|
|
428
481
|
* Creates a new session object with a refresh token for this user. Can be used to impersonate them.
|
|
429
482
|
*/
|
|
@@ -597,7 +650,7 @@ type StackAdminAppConstructor = {
|
|
|
597
650
|
new <HasTokenStore extends boolean, ProjectId extends string>(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>): StackAdminApp<HasTokenStore, ProjectId>;
|
|
598
651
|
new (options: StackAdminAppConstructorOptions<boolean, string>): StackAdminApp<boolean, string>;
|
|
599
652
|
};
|
|
600
|
-
type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (AsyncStoreProperty<"project", [], AdminProject, false> & AsyncStoreProperty<"apiKeys", [], ApiKey[], true> & AsyncStoreProperty<"teamPermissionDefinitions", [], AdminTeamPermissionDefinition[], true> & {
|
|
653
|
+
type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends string = string> = (AsyncStoreProperty<"project", [], AdminProject, false> & AsyncStoreProperty<"apiKeys", [], ApiKey[], true> & AsyncStoreProperty<"teamPermissionDefinitions", [], AdminTeamPermissionDefinition[], true> & AsyncStoreProperty<"projectPermissionDefinitions", [], AdminProjectPermissionDefinition[], true> & {
|
|
601
654
|
useEmailTemplates(): AdminEmailTemplate[];
|
|
602
655
|
listEmailTemplates(): Promise<AdminEmailTemplate[]>;
|
|
603
656
|
updateEmailTemplate(type: EmailTemplateType, data: AdminEmailTemplateUpdateOptions): Promise<void>;
|
|
@@ -606,6 +659,9 @@ type StackAdminApp<HasTokenStore extends boolean = boolean, ProjectId extends st
|
|
|
606
659
|
createTeamPermissionDefinition(data: AdminTeamPermissionDefinitionCreateOptions): Promise<AdminTeamPermission>;
|
|
607
660
|
updateTeamPermissionDefinition(permissionId: string, data: AdminTeamPermissionDefinitionUpdateOptions): Promise<void>;
|
|
608
661
|
deleteTeamPermissionDefinition(permissionId: string): Promise<void>;
|
|
662
|
+
createProjectPermissionDefinition(data: AdminProjectPermissionDefinitionCreateOptions): Promise<AdminProjectPermission>;
|
|
663
|
+
updateProjectPermissionDefinition(permissionId: string, data: AdminProjectPermissionDefinitionUpdateOptions): Promise<void>;
|
|
664
|
+
deleteProjectPermissionDefinition(permissionId: string): Promise<void>;
|
|
609
665
|
useSvixToken(): string;
|
|
610
666
|
sendTestEmail(options: {
|
|
611
667
|
recipientEmail: string;
|
|
@@ -644,6 +700,7 @@ type AdminProjectConfig = {
|
|
|
644
700
|
readonly createTeamOnSignUp: boolean;
|
|
645
701
|
readonly teamCreatorDefaultPermissions: AdminTeamPermission[];
|
|
646
702
|
readonly teamMemberDefaultPermissions: AdminTeamPermission[];
|
|
703
|
+
readonly userDefaultPermissions: AdminTeamPermission[];
|
|
647
704
|
readonly oauthAccountMergeStrategy: 'link_method' | 'raise_error' | 'allow_duplicates';
|
|
648
705
|
};
|
|
649
706
|
type AdminEmailConfig = ({
|
|
@@ -694,6 +751,9 @@ type AdminProjectConfigUpdateOptions = {
|
|
|
694
751
|
teamMemberDefaultPermissions?: {
|
|
695
752
|
id: string;
|
|
696
753
|
}[];
|
|
754
|
+
userDefaultPermissions?: {
|
|
755
|
+
id: string;
|
|
756
|
+
}[];
|
|
697
757
|
oauthAccountMergeStrategy?: 'link_method' | 'raise_error' | 'allow_duplicates';
|
|
698
758
|
};
|
|
699
759
|
|
|
@@ -863,7 +923,7 @@ declare function MagicLinkCallback(props: {
|
|
|
863
923
|
fullPage?: boolean;
|
|
864
924
|
}): react_jsx_runtime.JSX.Element;
|
|
865
925
|
|
|
866
|
-
declare function OAuthCallback(
|
|
926
|
+
declare function OAuthCallback({ fullPage }: {
|
|
867
927
|
fullPage?: boolean;
|
|
868
928
|
}): react_jsx_runtime.JSX.Element;
|
|
869
929
|
|
|
@@ -1099,4 +1159,4 @@ type UserButtonProps = {
|
|
|
1099
1159
|
};
|
|
1100
1160
|
declare function UserButton(props: UserButtonProps): react_jsx_runtime.JSX.Element;
|
|
1101
1161
|
|
|
1102
|
-
export { AccountSettings, type AdminDomainConfig, type AdminEmailConfig, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type ApiKey, type ApiKeyBase, type ApiKeyBaseCrudRead, type ApiKeyCreateOptions, type ApiKeyFirstView, type Auth, AuthPage, type Connection, type ContactChannel, CredentialSignIn, CredentialSignUp, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, EmailVerification, ForgotPassword, type GetUserOptions$1 as GetUserOptions, type HandlerUrls, MagicLinkSignIn, MessageCard, OAuthButton, OAuthButtonGroup, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, PasswordReset, type Project, type ProjectConfig, SelectedTeamSwitcher, type ServerContactChannel, type ServerListUsersOptions, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, type Session, SignIn, SignUp, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, NextStackHandler as StackHandler, NextStackProvider as StackProvider, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, StackTheme, type Team, type TeamCreateOptions, type TeamInvitation$1 as TeamInvitation, type TeamMemberProfile, type
|
|
1162
|
+
export { AccountSettings, type AdminDomainConfig, type AdminEmailConfig, type AdminOAuthProviderConfig, type AdminOwnedProject, type AdminProject, type AdminProjectConfig, type AdminProjectConfigUpdateOptions, type AdminProjectCreateOptions, type AdminProjectPermission, type AdminProjectPermissionDefinition, type AdminProjectPermissionDefinitionCreateOptions, type AdminProjectPermissionDefinitionUpdateOptions, type AdminProjectUpdateOptions, type AdminSentEmail, type AdminTeamPermission, type AdminTeamPermissionDefinition, type AdminTeamPermissionDefinitionCreateOptions, type AdminTeamPermissionDefinitionUpdateOptions, type ApiKey, type ApiKeyBase, type ApiKeyBaseCrudRead, type ApiKeyCreateOptions, type ApiKeyFirstView, type Auth, AuthPage, type Connection, type ContactChannel, CredentialSignIn, CredentialSignUp, type CurrentInternalServerUser, type CurrentInternalUser, type CurrentServerUser, type CurrentUser, type EditableTeamMemberProfile, EmailVerification, ForgotPassword, type GetUserOptions$1 as GetUserOptions, type HandlerUrls, MagicLinkSignIn, MessageCard, OAuthButton, OAuthButtonGroup, type OAuthConnection, type OAuthProviderConfig, type OAuthScopesOnSignIn, PasswordReset, type Project, type ProjectConfig, SelectedTeamSwitcher, type ServerContactChannel, type ServerListUsersOptions, type ServerTeam, type ServerTeamCreateOptions, type ServerTeamMemberProfile, type ServerTeamUpdateOptions, type ServerTeamUser, type ServerUser, type Session, SignIn, SignUp, StackAdminApp, type StackAdminAppConstructor, type StackAdminAppConstructorOptions, StackClientApp, type StackClientAppConstructor, type StackClientAppConstructorOptions, type StackClientAppJson, NextStackHandler as StackHandler, NextStackProvider as StackProvider, StackServerApp, type StackServerAppConstructor, type StackServerAppConstructorOptions, StackTheme, type Team, type TeamCreateOptions, type TeamInvitation$1 as TeamInvitation, type TeamMemberProfile, type TeamUpdateOptions, type TeamUser, type User, UserAvatar, UserButton, stackAppInternalsSymbol, useStackApp, useUser };
|
package/dist/lib/auth.js
CHANGED
|
@@ -36,8 +36,8 @@ async function signInWithOAuth(iface, options) {
|
|
|
36
36
|
const { codeChallenge, state } = await (0, import_cookie.saveVerifierAndState)();
|
|
37
37
|
const location = await iface.getOAuthUrl({
|
|
38
38
|
provider: options.provider,
|
|
39
|
-
redirectUrl: (0, import_url.constructRedirectUrl)(options.redirectUrl),
|
|
40
|
-
errorRedirectUrl: (0, import_url.constructRedirectUrl)(options.errorRedirectUrl),
|
|
39
|
+
redirectUrl: (0, import_url.constructRedirectUrl)(options.redirectUrl, "redirectUrl"),
|
|
40
|
+
errorRedirectUrl: (0, import_url.constructRedirectUrl)(options.errorRedirectUrl, "errorRedirectUrl"),
|
|
41
41
|
codeChallenge,
|
|
42
42
|
state,
|
|
43
43
|
type: "authenticate",
|
|
@@ -50,9 +50,9 @@ async function addNewOAuthProviderOrScope(iface, options, session) {
|
|
|
50
50
|
const { codeChallenge, state } = await (0, import_cookie.saveVerifierAndState)();
|
|
51
51
|
const location = await iface.getOAuthUrl({
|
|
52
52
|
provider: options.provider,
|
|
53
|
-
redirectUrl: (0, import_url.constructRedirectUrl)(options.redirectUrl),
|
|
54
|
-
errorRedirectUrl: (0, import_url.constructRedirectUrl)(options.errorRedirectUrl),
|
|
55
|
-
afterCallbackRedirectUrl: (0, import_url.constructRedirectUrl)(window.location.href),
|
|
53
|
+
redirectUrl: (0, import_url.constructRedirectUrl)(options.redirectUrl, "redirectUrl"),
|
|
54
|
+
errorRedirectUrl: (0, import_url.constructRedirectUrl)(options.errorRedirectUrl, "errorRedirectUrl"),
|
|
55
|
+
afterCallbackRedirectUrl: (0, import_url.constructRedirectUrl)(window.location.href, "afterCallbackRedirectUrl"),
|
|
56
56
|
codeChallenge,
|
|
57
57
|
state,
|
|
58
58
|
type: "link",
|
|
@@ -105,7 +105,7 @@ async function callOAuthCallback(iface, redirectUrl) {
|
|
|
105
105
|
try {
|
|
106
106
|
return import_results.Result.ok(await iface.callOAuthCallback({
|
|
107
107
|
oauthParams: consumed.originalUrl.searchParams,
|
|
108
|
-
redirectUri: (0, import_url.constructRedirectUrl)(redirectUrl),
|
|
108
|
+
redirectUri: (0, import_url.constructRedirectUrl)(redirectUrl, "redirectUri"),
|
|
109
109
|
codeVerifier: consumed.codeVerifier,
|
|
110
110
|
state: consumed.state
|
|
111
111
|
}));
|
package/dist/lib/auth.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/lib/auth.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { KnownError, StackClientInterface } from \"@stackframe/stack-shared\";\nimport { InternalSession } from \"@stackframe/stack-shared/dist/sessions\";\nimport { StackAssertionError, throwErr } from \"@stackframe/stack-shared/dist/utils/errors\";\nimport { neverResolve } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { Result } from \"@stackframe/stack-shared/dist/utils/results\";\nimport { deindent } from \"@stackframe/stack-shared/dist/utils/strings\";\nimport { constructRedirectUrl } from \"../utils/url\";\nimport { consumeVerifierAndStateCookie, saveVerifierAndState } from \"./cookie\";\n\nexport async function signInWithOAuth(\n iface: StackClientInterface,\n options: {\n provider: string,\n redirectUrl: string,\n errorRedirectUrl: string,\n providerScope?: string,\n }\n) {\n const { codeChallenge, state } = await saveVerifierAndState();\n const location = await iface.getOAuthUrl({\n provider: options.provider,\n redirectUrl: constructRedirectUrl(options.redirectUrl),\n errorRedirectUrl: constructRedirectUrl(options.errorRedirectUrl),\n codeChallenge,\n state,\n type: \"authenticate\",\n providerScope: options.providerScope,\n });\n window.location.assign(location);\n await neverResolve();\n}\n\nexport async function addNewOAuthProviderOrScope(\n iface: StackClientInterface,\n options: {\n provider: string,\n redirectUrl: string,\n errorRedirectUrl: string,\n providerScope?: string,\n },\n session: InternalSession,\n) {\n const { codeChallenge, state } = await saveVerifierAndState();\n const location = await iface.getOAuthUrl({\n provider: options.provider,\n redirectUrl: constructRedirectUrl(options.redirectUrl),\n errorRedirectUrl: constructRedirectUrl(options.errorRedirectUrl),\n afterCallbackRedirectUrl: constructRedirectUrl(window.location.href),\n codeChallenge,\n state,\n type: \"link\",\n session,\n providerScope: options.providerScope,\n });\n window.location.assign(location);\n await neverResolve();\n}\n\n/**\n * Checks if the current URL has the query parameters for an OAuth callback, and if so, removes them.\n *\n * Must be synchronous for the logic in callOAuthCallback to work without race conditions.\n */\nfunction consumeOAuthCallbackQueryParams() {\n const requiredParams = [\"code\", \"state\"];\n const originalUrl = new URL(window.location.href);\n for (const param of requiredParams) {\n if (!originalUrl.searchParams.has(param)) {\n console.warn(new Error(`Missing required query parameter on OAuth callback: ${param}. Maybe you opened or reloaded the oauth-callback page from your history?`));\n return null;\n }\n }\n\n const expectedState = originalUrl.searchParams.get(\"state\") ?? throwErr(\"This should never happen; isn't state required above?\");\n const cookieResult = consumeVerifierAndStateCookie(expectedState);\n\n if (!cookieResult) {\n // If the state can't be found in the cookies, then the callback wasn't meant for us.\n // Maybe the website uses another OAuth library?\n console.warn(deindent`\n Stack found an outer OAuth callback state in the query parameters, but not in cookies.\n \n This could have multiple reasons:\n - The cookie expired, because the OAuth flow took too long.\n - The user's browser deleted the cookie, either manually or because of a very strict cookie policy.\n - The cookie was already consumed by this page, and the user already logged in.\n - You are using another OAuth client library with the same callback URL as Stack.\n - The user opened the OAuth callback page from their history.\n\n Either way, it is probably safe to ignore this warning unless you are debugging an OAuth issue.\n `);\n return null;\n }\n\n\n const newUrl = new URL(originalUrl);\n for (const param of requiredParams) {\n newUrl.searchParams.delete(param);\n }\n\n // let's get rid of the authorization code in the history as we\n // don't redirect to `redirectUrl` if there's a validation error\n // (as the redirectUrl might be malicious!).\n //\n // We use history.replaceState instead of location.assign(...) to\n // prevent an unnecessary reload\n window.history.replaceState({}, \"\", newUrl.toString());\n\n return {\n originalUrl,\n codeVerifier: cookieResult.codeVerifier,\n state: expectedState,\n };\n}\n\nexport async function callOAuthCallback(\n iface: StackClientInterface,\n redirectUrl: string,\n) {\n // note: this part of the function (until the return) needs\n // to be synchronous, to prevent race conditions when\n // callOAuthCallback is called multiple times in parallel\n const consumed = consumeOAuthCallbackQueryParams();\n if (!consumed) return Result.ok(undefined);\n\n // the rest can be asynchronous (we now know that we are the\n // intended recipient of the callback, and the only instance\n // of callOAuthCallback that's running)\n try {\n return Result.ok(await iface.callOAuthCallback({\n oauthParams: consumed.originalUrl.searchParams,\n redirectUri: constructRedirectUrl(redirectUrl),\n codeVerifier: consumed.codeVerifier,\n state: consumed.state,\n }));\n } catch (e) {\n if (e instanceof KnownError) {\n throw e;\n }\n throw new StackAssertionError(\"Error signing in during OAuth callback. Please try again.\", { cause: e });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,0BAAiD;AAEjD,oBAA8C;AAC9C,sBAA6B;AAC7B,qBAAuB;AACvB,qBAAyB;AACzB,iBAAqC;AACrC,oBAAoE;AAEpE,eAAsB,gBACpB,OACA,SAMA;AACA,QAAM,EAAE,eAAe,MAAM,IAAI,UAAM,oCAAqB;AAC5D,QAAM,WAAW,MAAM,MAAM,YAAY;AAAA,IACvC,UAAU,QAAQ;AAAA,IAClB,iBAAa,iCAAqB,QAAQ,
|
|
1
|
+
{"version":3,"sources":["../../src/lib/auth.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { KnownError, StackClientInterface } from \"@stackframe/stack-shared\";\nimport { InternalSession } from \"@stackframe/stack-shared/dist/sessions\";\nimport { StackAssertionError, throwErr } from \"@stackframe/stack-shared/dist/utils/errors\";\nimport { neverResolve } from \"@stackframe/stack-shared/dist/utils/promises\";\nimport { Result } from \"@stackframe/stack-shared/dist/utils/results\";\nimport { deindent } from \"@stackframe/stack-shared/dist/utils/strings\";\nimport { constructRedirectUrl } from \"../utils/url\";\nimport { consumeVerifierAndStateCookie, saveVerifierAndState } from \"./cookie\";\n\nexport async function signInWithOAuth(\n iface: StackClientInterface,\n options: {\n provider: string,\n redirectUrl: string,\n errorRedirectUrl: string,\n providerScope?: string,\n }\n) {\n const { codeChallenge, state } = await saveVerifierAndState();\n const location = await iface.getOAuthUrl({\n provider: options.provider,\n redirectUrl: constructRedirectUrl(options.redirectUrl, \"redirectUrl\"),\n errorRedirectUrl: constructRedirectUrl(options.errorRedirectUrl, \"errorRedirectUrl\"),\n codeChallenge,\n state,\n type: \"authenticate\",\n providerScope: options.providerScope,\n });\n window.location.assign(location);\n await neverResolve();\n}\n\nexport async function addNewOAuthProviderOrScope(\n iface: StackClientInterface,\n options: {\n provider: string,\n redirectUrl: string,\n errorRedirectUrl: string,\n providerScope?: string,\n },\n session: InternalSession,\n) {\n const { codeChallenge, state } = await saveVerifierAndState();\n const location = await iface.getOAuthUrl({\n provider: options.provider,\n redirectUrl: constructRedirectUrl(options.redirectUrl, \"redirectUrl\"),\n errorRedirectUrl: constructRedirectUrl(options.errorRedirectUrl, \"errorRedirectUrl\"),\n afterCallbackRedirectUrl: constructRedirectUrl(window.location.href, \"afterCallbackRedirectUrl\"),\n codeChallenge,\n state,\n type: \"link\",\n session,\n providerScope: options.providerScope,\n });\n window.location.assign(location);\n await neverResolve();\n}\n\n/**\n * Checks if the current URL has the query parameters for an OAuth callback, and if so, removes them.\n *\n * Must be synchronous for the logic in callOAuthCallback to work without race conditions.\n */\nfunction consumeOAuthCallbackQueryParams() {\n const requiredParams = [\"code\", \"state\"];\n const originalUrl = new URL(window.location.href);\n for (const param of requiredParams) {\n if (!originalUrl.searchParams.has(param)) {\n console.warn(new Error(`Missing required query parameter on OAuth callback: ${param}. Maybe you opened or reloaded the oauth-callback page from your history?`));\n return null;\n }\n }\n\n const expectedState = originalUrl.searchParams.get(\"state\") ?? throwErr(\"This should never happen; isn't state required above?\");\n const cookieResult = consumeVerifierAndStateCookie(expectedState);\n\n if (!cookieResult) {\n // If the state can't be found in the cookies, then the callback wasn't meant for us.\n // Maybe the website uses another OAuth library?\n console.warn(deindent`\n Stack found an outer OAuth callback state in the query parameters, but not in cookies.\n \n This could have multiple reasons:\n - The cookie expired, because the OAuth flow took too long.\n - The user's browser deleted the cookie, either manually or because of a very strict cookie policy.\n - The cookie was already consumed by this page, and the user already logged in.\n - You are using another OAuth client library with the same callback URL as Stack.\n - The user opened the OAuth callback page from their history.\n\n Either way, it is probably safe to ignore this warning unless you are debugging an OAuth issue.\n `);\n return null;\n }\n\n\n const newUrl = new URL(originalUrl);\n for (const param of requiredParams) {\n newUrl.searchParams.delete(param);\n }\n\n // let's get rid of the authorization code in the history as we\n // don't redirect to `redirectUrl` if there's a validation error\n // (as the redirectUrl might be malicious!).\n //\n // We use history.replaceState instead of location.assign(...) to\n // prevent an unnecessary reload\n window.history.replaceState({}, \"\", newUrl.toString());\n\n return {\n originalUrl,\n codeVerifier: cookieResult.codeVerifier,\n state: expectedState,\n };\n}\n\nexport async function callOAuthCallback(\n iface: StackClientInterface,\n redirectUrl: string,\n) {\n // note: this part of the function (until the return) needs\n // to be synchronous, to prevent race conditions when\n // callOAuthCallback is called multiple times in parallel\n const consumed = consumeOAuthCallbackQueryParams();\n if (!consumed) return Result.ok(undefined);\n\n // the rest can be asynchronous (we now know that we are the\n // intended recipient of the callback, and the only instance\n // of callOAuthCallback that's running)\n try {\n return Result.ok(await iface.callOAuthCallback({\n oauthParams: consumed.originalUrl.searchParams,\n redirectUri: constructRedirectUrl(redirectUrl, \"redirectUri\"),\n codeVerifier: consumed.codeVerifier,\n state: consumed.state,\n }));\n } catch (e) {\n if (e instanceof KnownError) {\n throw e;\n }\n throw new StackAssertionError(\"Error signing in during OAuth callback. Please try again.\", { cause: e });\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,0BAAiD;AAEjD,oBAA8C;AAC9C,sBAA6B;AAC7B,qBAAuB;AACvB,qBAAyB;AACzB,iBAAqC;AACrC,oBAAoE;AAEpE,eAAsB,gBACpB,OACA,SAMA;AACA,QAAM,EAAE,eAAe,MAAM,IAAI,UAAM,oCAAqB;AAC5D,QAAM,WAAW,MAAM,MAAM,YAAY;AAAA,IACvC,UAAU,QAAQ;AAAA,IAClB,iBAAa,iCAAqB,QAAQ,aAAa,aAAa;AAAA,IACpE,sBAAkB,iCAAqB,QAAQ,kBAAkB,kBAAkB;AAAA,IACnF;AAAA,IACA;AAAA,IACA,MAAM;AAAA,IACN,eAAe,QAAQ;AAAA,EACzB,CAAC;AACD,SAAO,SAAS,OAAO,QAAQ;AAC/B,YAAM,8BAAa;AACrB;AAEA,eAAsB,2BACpB,OACA,SAMA,SACA;AACA,QAAM,EAAE,eAAe,MAAM,IAAI,UAAM,oCAAqB;AAC5D,QAAM,WAAW,MAAM,MAAM,YAAY;AAAA,IACvC,UAAU,QAAQ;AAAA,IAClB,iBAAa,iCAAqB,QAAQ,aAAa,aAAa;AAAA,IACpE,sBAAkB,iCAAqB,QAAQ,kBAAkB,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c,SAAS;AAAA,MACvB,OAAO,SAAS;AAAA,IAClB,CAAC,CAAC;AAAA,EACJ,SAAS,GAAG;AACV,QAAI,aAAa,gCAAY;AAC3B,YAAM;AAAA,IACR;AACA,UAAM,IAAI,kCAAoB,6DAA6D,EAAE,OAAO,EAAE,CAAC;AAAA,EACzG;AACF;","names":[]}
|
|
@@ -71,7 +71,10 @@ var _StackAdminAppImplIncomplete = class extends import_server_app_impl._StackSe
|
|
|
71
71
|
return await this._interface.listEmailTemplates();
|
|
72
72
|
});
|
|
73
73
|
this._adminTeamPermissionDefinitionsCache = (0, import_common2.createCache)(async () => {
|
|
74
|
-
return await this._interface.
|
|
74
|
+
return await this._interface.listTeamPermissionDefinitions();
|
|
75
|
+
});
|
|
76
|
+
this._adminProjectPermissionDefinitionsCache = (0, import_common2.createCache)(async () => {
|
|
77
|
+
return await this._interface.listProjectPermissionDefinitions();
|
|
75
78
|
});
|
|
76
79
|
this._svixTokenCache = (0, import_common2.createCache)(async () => {
|
|
77
80
|
return await this._interface.getSvixToken();
|
|
@@ -142,7 +145,8 @@ var _StackAdminAppImplIncomplete = class extends import_server_app_impl._StackSe
|
|
|
142
145
|
})),
|
|
143
146
|
createTeamOnSignUp: data.config.create_team_on_sign_up,
|
|
144
147
|
teamCreatorDefaultPermissions: data.config.team_creator_default_permissions,
|
|
145
|
-
teamMemberDefaultPermissions: data.config.team_member_default_permissions
|
|
148
|
+
teamMemberDefaultPermissions: data.config.team_member_default_permissions,
|
|
149
|
+
userDefaultPermissions: data.config.user_default_permissions
|
|
146
150
|
},
|
|
147
151
|
async update(update) {
|
|
148
152
|
await app._interface.updateProject((0, import_projects.adminProjectUpdateOptionsToCrud)(update));
|
|
@@ -253,16 +257,16 @@ var _StackAdminAppImplIncomplete = class extends import_server_app_impl._StackSe
|
|
|
253
257
|
await this._adminEmailTemplatesCache.refresh([]);
|
|
254
258
|
}
|
|
255
259
|
async createTeamPermissionDefinition(data) {
|
|
256
|
-
const crud = await this._interface.
|
|
260
|
+
const crud = await this._interface.createTeamPermissionDefinition((0, import_permissions.adminTeamPermissionDefinitionCreateOptionsToCrud)(data));
|
|
257
261
|
await this._adminTeamPermissionDefinitionsCache.refresh([]);
|
|
258
262
|
return this._serverTeamPermissionDefinitionFromCrud(crud);
|
|
259
263
|
}
|
|
260
264
|
async updateTeamPermissionDefinition(permissionId, data) {
|
|
261
|
-
await this._interface.
|
|
265
|
+
await this._interface.updateTeamPermissionDefinition(permissionId, (0, import_permissions.adminTeamPermissionDefinitionUpdateOptionsToCrud)(data));
|
|
262
266
|
await this._adminTeamPermissionDefinitionsCache.refresh([]);
|
|
263
267
|
}
|
|
264
268
|
async deleteTeamPermissionDefinition(permissionId) {
|
|
265
|
-
await this._interface.
|
|
269
|
+
await this._interface.deleteTeamPermissionDefinition(permissionId);
|
|
266
270
|
await this._adminTeamPermissionDefinitionsCache.refresh([]);
|
|
267
271
|
}
|
|
268
272
|
async listTeamPermissionDefinitions() {
|
|
@@ -275,6 +279,29 @@ var _StackAdminAppImplIncomplete = class extends import_server_app_impl._StackSe
|
|
|
275
279
|
return crud.map((p) => this._serverTeamPermissionDefinitionFromCrud(p));
|
|
276
280
|
}, [crud]);
|
|
277
281
|
}
|
|
282
|
+
async createProjectPermissionDefinition(data) {
|
|
283
|
+
const crud = await this._interface.createProjectPermissionDefinition((0, import_permissions.adminProjectPermissionDefinitionCreateOptionsToCrud)(data));
|
|
284
|
+
await this._adminProjectPermissionDefinitionsCache.refresh([]);
|
|
285
|
+
return this._serverProjectPermissionDefinitionFromCrud(crud);
|
|
286
|
+
}
|
|
287
|
+
async updateProjectPermissionDefinition(permissionId, data) {
|
|
288
|
+
await this._interface.updateProjectPermissionDefinition(permissionId, (0, import_permissions.adminProjectPermissionDefinitionUpdateOptionsToCrud)(data));
|
|
289
|
+
await this._adminProjectPermissionDefinitionsCache.refresh([]);
|
|
290
|
+
}
|
|
291
|
+
async deleteProjectPermissionDefinition(permissionId) {
|
|
292
|
+
await this._interface.deleteProjectPermissionDefinition(permissionId);
|
|
293
|
+
await this._adminProjectPermissionDefinitionsCache.refresh([]);
|
|
294
|
+
}
|
|
295
|
+
async listProjectPermissionDefinitions() {
|
|
296
|
+
const crud = import_results.Result.orThrow(await this._adminProjectPermissionDefinitionsCache.getOrWait([], "write-only"));
|
|
297
|
+
return crud.map((p) => this._serverProjectPermissionDefinitionFromCrud(p));
|
|
298
|
+
}
|
|
299
|
+
useProjectPermissionDefinitions() {
|
|
300
|
+
const crud = (0, import_common3.useAsyncCache)(this._adminProjectPermissionDefinitionsCache, [], "useProjectPermissions()");
|
|
301
|
+
return (0, import_react.useMemo)(() => {
|
|
302
|
+
return crud.map((p) => this._serverProjectPermissionDefinitionFromCrud(p));
|
|
303
|
+
}, [crud]);
|
|
304
|
+
}
|
|
278
305
|
useSvixToken() {
|
|
279
306
|
const crud = (0, import_common3.useAsyncCache)(this._svixTokenCache, [], "useSvixToken()");
|
|
280
307
|
return crud.token;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../src/lib/stack-app/apps/implementations/admin-app-impl.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { StackAdminInterface } from \"@stackframe/stack-shared\";\nimport { getProductionModeErrors } from \"@stackframe/stack-shared/dist/helpers/production-mode\";\nimport { ApiKeyCreateCrudResponse } from \"@stackframe/stack-shared/dist/interface/adminInterface\";\nimport { ApiKeysCrud } from \"@stackframe/stack-shared/dist/interface/crud/api-keys\";\nimport { EmailTemplateCrud, EmailTemplateType } from \"@stackframe/stack-shared/dist/interface/crud/email-templates\";\nimport { InternalProjectsCrud } from \"@stackframe/stack-shared/dist/interface/crud/projects\";\nimport { StackAssertionError, throwErr } from \"@stackframe/stack-shared/dist/utils/errors\";\nimport { pick } from \"@stackframe/stack-shared/dist/utils/objects\";\nimport { Result } from \"@stackframe/stack-shared/dist/utils/results\";\nimport { useMemo } from \"react\"; // THIS_LINE_PLATFORM react-like\nimport { AdminSentEmail } from \"../..\";\nimport { ApiKey, ApiKeyBase, ApiKeyBaseCrudRead, ApiKeyCreateOptions, ApiKeyFirstView, apiKeyCreateOptionsToCrud } from \"../../api-keys\";\nimport { EmailConfig, stackAppInternalsSymbol } from \"../../common\";\nimport { AdminEmailTemplate, AdminEmailTemplateUpdateOptions, adminEmailTemplateUpdateOptionsToCrud } from \"../../email-templates\";\nimport { AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions, adminTeamPermissionDefinitionCreateOptionsToCrud, adminTeamPermissionDefinitionUpdateOptionsToCrud } from \"../../permissions\";\nimport { AdminOwnedProject, AdminProject, AdminProjectUpdateOptions, adminProjectUpdateOptionsToCrud } from \"../../projects\";\nimport { StackAdminApp, StackAdminAppConstructorOptions } from \"../interfaces/admin-app\";\nimport { clientVersion, createCache, getBaseUrl, getDefaultProjectId, getDefaultPublishableClientKey, getDefaultSecretServerKey, getDefaultSuperSecretAdminKey } from \"./common\";\nimport { _StackServerAppImplIncomplete } from \"./server-app-impl\";\n\nimport { useAsyncCache } from \"./common\";\n\nexport class _StackAdminAppImplIncomplete<HasTokenStore extends boolean, ProjectId extends string> extends _StackServerAppImplIncomplete<HasTokenStore, ProjectId> implements StackAdminApp<HasTokenStore, ProjectId>\n{\n declare protected _interface: StackAdminInterface;\n\n private readonly _adminProjectCache = createCache(async () => {\n return await this._interface.getProject();\n });\n private readonly _apiKeysCache = createCache(async () => {\n return await this._interface.listApiKeys();\n });\n private readonly _adminEmailTemplatesCache = createCache(async () => {\n return await this._interface.listEmailTemplates();\n });\n private readonly _adminTeamPermissionDefinitionsCache = createCache(async () => {\n return await this._interface.listPermissionDefinitions();\n });\n private readonly _svixTokenCache = createCache(async () => {\n return await this._interface.getSvixToken();\n });\n private readonly _metricsCache = createCache(async () => {\n return await this._interface.getMetrics();\n });\n\n constructor(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>) {\n super({\n interface: new StackAdminInterface({\n getBaseUrl: () => getBaseUrl(options.baseUrl),\n projectId: options.projectId ?? getDefaultProjectId(),\n extraRequestHeaders: options.extraRequestHeaders ?? {},\n clientVersion,\n ...\"projectOwnerSession\" in options ? {\n projectOwnerSession: options.projectOwnerSession,\n } : {\n publishableClientKey: options.publishableClientKey ?? getDefaultPublishableClientKey(),\n secretServerKey: options.secretServerKey ?? getDefaultSecretServerKey(),\n superSecretAdminKey: options.superSecretAdminKey ?? getDefaultSuperSecretAdminKey(),\n },\n }),\n baseUrl: options.baseUrl,\n extraRequestHeaders: options.extraRequestHeaders,\n projectId: options.projectId,\n tokenStore: options.tokenStore,\n urls: options.urls,\n oauthScopesOnSignIn: options.oauthScopesOnSignIn,\n redirectMethod: options.redirectMethod,\n });\n }\n\n _adminOwnedProjectFromCrud(data: InternalProjectsCrud['Admin']['Read'], onRefresh: () => Promise<void>): AdminOwnedProject {\n if (this._tokenStoreInit !== null) {\n throw new StackAssertionError(\"Owned apps must always have tokenStore === null — did you not create this project with app._createOwnedApp()?\");;\n }\n return {\n ...this._adminProjectFromCrud(data, onRefresh),\n app: this as StackAdminApp<false>,\n };\n }\n\n _adminProjectFromCrud(data: InternalProjectsCrud['Admin']['Read'], onRefresh: () => Promise<void>): AdminProject {\n if (data.id !== this.projectId) {\n throw new StackAssertionError(`The project ID of the provided project JSON (${data.id}) does not match the project ID of the app (${this.projectId})!`);\n }\n\n const app = this;\n return {\n id: data.id,\n displayName: data.display_name,\n description: data.description,\n createdAt: new Date(data.created_at_millis),\n userCount: data.user_count,\n isProductionMode: data.is_production_mode,\n config: {\n id: data.config.id,\n signUpEnabled: data.config.sign_up_enabled,\n credentialEnabled: data.config.credential_enabled,\n magicLinkEnabled: data.config.magic_link_enabled,\n passkeyEnabled: data.config.passkey_enabled,\n clientTeamCreationEnabled: data.config.client_team_creation_enabled,\n clientUserDeletionEnabled: data.config.client_user_deletion_enabled,\n allowLocalhost: data.config.allow_localhost,\n oauthAccountMergeStrategy: data.config.oauth_account_merge_strategy,\n oauthProviders: data.config.oauth_providers.map((p) => ((p.type === 'shared' ? {\n id: p.id,\n enabled: p.enabled,\n type: 'shared',\n } as const : {\n id: p.id,\n enabled: p.enabled,\n type: 'standard',\n clientId: p.client_id ?? throwErr(\"Client ID is missing\"),\n clientSecret: p.client_secret ?? throwErr(\"Client secret is missing\"),\n facebookConfigId: p.facebook_config_id,\n microsoftTenantId: p.microsoft_tenant_id,\n } as const))),\n emailConfig: data.config.email_config.type === 'shared' ? {\n type: 'shared'\n } : {\n type: 'standard',\n host: data.config.email_config.host ?? throwErr(\"Email host is missing\"),\n port: data.config.email_config.port ?? throwErr(\"Email port is missing\"),\n username: data.config.email_config.username ?? throwErr(\"Email username is missing\"),\n password: data.config.email_config.password ?? throwErr(\"Email password is missing\"),\n senderName: data.config.email_config.sender_name ?? throwErr(\"Email sender name is missing\"),\n senderEmail: data.config.email_config.sender_email ?? throwErr(\"Email sender email is missing\"),\n },\n domains: data.config.domains.map((d) => ({\n domain: d.domain,\n handlerPath: d.handler_path,\n })),\n createTeamOnSignUp: data.config.create_team_on_sign_up,\n teamCreatorDefaultPermissions: data.config.team_creator_default_permissions,\n teamMemberDefaultPermissions: data.config.team_member_default_permissions,\n },\n\n async update(update: AdminProjectUpdateOptions) {\n await app._interface.updateProject(adminProjectUpdateOptionsToCrud(update));\n await onRefresh();\n },\n async delete() {\n await app._interface.deleteProject();\n },\n async getProductionModeErrors() {\n return getProductionModeErrors(data);\n },\n useProductionModeErrors() {\n return getProductionModeErrors(data);\n },\n };\n }\n\n _adminEmailTemplateFromCrud(data: EmailTemplateCrud['Admin']['Read']): AdminEmailTemplate {\n return {\n type: data.type,\n subject: data.subject,\n content: data.content,\n isDefault: data.is_default,\n };\n }\n\n override async getProject(): Promise<AdminProject> {\n return this._adminProjectFromCrud(\n Result.orThrow(await this._adminProjectCache.getOrWait([], \"write-only\")),\n () => this._refreshProject()\n );\n }\n\n override useProject(): AdminProject {\n const crud = useAsyncCache(this._adminProjectCache, [], \"useProjectAdmin()\");\n return useMemo(() => this._adminProjectFromCrud(\n crud,\n () => this._refreshProject()\n ), [crud]);\n }\n\n protected _createApiKeyBaseFromCrud(data: ApiKeyBaseCrudRead): ApiKeyBase {\n const app = this;\n return {\n id: data.id,\n description: data.description,\n expiresAt: new Date(data.expires_at_millis),\n manuallyRevokedAt: data.manually_revoked_at_millis ? new Date(data.manually_revoked_at_millis) : null,\n createdAt: new Date(data.created_at_millis),\n isValid() {\n return this.whyInvalid() === null;\n },\n whyInvalid() {\n if (this.expiresAt.getTime() < Date.now()) return \"expired\";\n if (this.manuallyRevokedAt) return \"manually-revoked\";\n return null;\n },\n async revoke() {\n const res = await app._interface.revokeApiKeyById(data.id);\n await app._refreshApiKeys();\n return res;\n }\n };\n }\n\n protected _createApiKeyFromCrud(data: ApiKeysCrud[\"Admin\"][\"Read\"]): ApiKey {\n return {\n ...this._createApiKeyBaseFromCrud(data),\n publishableClientKey: data.publishable_client_key ? { lastFour: data.publishable_client_key.last_four } : null,\n secretServerKey: data.secret_server_key ? { lastFour: data.secret_server_key.last_four } : null,\n superSecretAdminKey: data.super_secret_admin_key ? { lastFour: data.super_secret_admin_key.last_four } : null,\n };\n }\n\n protected _createApiKeyFirstViewFromCrud(data: ApiKeyCreateCrudResponse): ApiKeyFirstView {\n return {\n ...this._createApiKeyBaseFromCrud(data),\n publishableClientKey: data.publishable_client_key,\n secretServerKey: data.secret_server_key,\n superSecretAdminKey: data.super_secret_admin_key,\n };\n }\n\n async listApiKeys(): Promise<ApiKey[]> {\n const crud = Result.orThrow(await this._apiKeysCache.getOrWait([], \"write-only\"));\n return crud.map((j) => this._createApiKeyFromCrud(j));\n }\n\n useApiKeys(): ApiKey[] {\n const crud = useAsyncCache(this._apiKeysCache, [], \"useApiKeys()\");\n return useMemo(() => {\n return crud.map((j) => this._createApiKeyFromCrud(j));\n }, [crud]);\n }\n\n async createApiKey(options: ApiKeyCreateOptions): Promise<ApiKeyFirstView> {\n const crud = await this._interface.createApiKey(apiKeyCreateOptionsToCrud(options));\n await this._refreshApiKeys();\n return this._createApiKeyFirstViewFromCrud(crud);\n }\n\n useEmailTemplates(): AdminEmailTemplate[] {\n const crud = useAsyncCache(this._adminEmailTemplatesCache, [], \"useEmailTemplates()\");\n return useMemo(() => {\n return crud.map((j) => this._adminEmailTemplateFromCrud(j));\n }, [crud]);\n }\n async listEmailTemplates(): Promise<AdminEmailTemplate[]> {\n const crud = Result.orThrow(await this._adminEmailTemplatesCache.getOrWait([], \"write-only\"));\n return crud.map((j) => this._adminEmailTemplateFromCrud(j));\n }\n\n async updateEmailTemplate(type: EmailTemplateType, data: AdminEmailTemplateUpdateOptions): Promise<void> {\n await this._interface.updateEmailTemplate(type, adminEmailTemplateUpdateOptionsToCrud(data));\n await this._adminEmailTemplatesCache.refresh([]);\n }\n\n async resetEmailTemplate(type: EmailTemplateType) {\n await this._interface.resetEmailTemplate(type);\n await this._adminEmailTemplatesCache.refresh([]);\n }\n\n async createTeamPermissionDefinition(data: AdminTeamPermissionDefinitionCreateOptions): Promise<AdminTeamPermission>{\n const crud = await this._interface.createPermissionDefinition(adminTeamPermissionDefinitionCreateOptionsToCrud(data));\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n return this._serverTeamPermissionDefinitionFromCrud(crud);\n }\n\n async updateTeamPermissionDefinition(permissionId: string, data: AdminTeamPermissionDefinitionUpdateOptions) {\n await this._interface.updatePermissionDefinition(permissionId, adminTeamPermissionDefinitionUpdateOptionsToCrud(data));\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n }\n\n async deleteTeamPermissionDefinition(permissionId: string): Promise<void> {\n await this._interface.deletePermissionDefinition(permissionId);\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n }\n\n async listTeamPermissionDefinitions(): Promise<AdminTeamPermissionDefinition[]> {\n const crud = Result.orThrow(await this._adminTeamPermissionDefinitionsCache.getOrWait([], \"write-only\"));\n return crud.map((p) => this._serverTeamPermissionDefinitionFromCrud(p));\n }\n\n useTeamPermissionDefinitions(): AdminTeamPermissionDefinition[] {\n const crud = useAsyncCache(this._adminTeamPermissionDefinitionsCache, [], \"usePermissions()\");\n return useMemo(() => {\n return crud.map((p) => this._serverTeamPermissionDefinitionFromCrud(p));\n }, [crud]);\n }\n useSvixToken(): string {\n const crud = useAsyncCache(this._svixTokenCache, [], \"useSvixToken()\");\n return crud.token;\n }\n\n protected override async _refreshProject() {\n await Promise.all([\n super._refreshProject(),\n this._adminProjectCache.refresh([]),\n ]);\n }\n\n protected async _refreshApiKeys() {\n await this._apiKeysCache.refresh([]);\n }\n\n get [stackAppInternalsSymbol]() {\n return {\n ...super[stackAppInternalsSymbol],\n useMetrics: (): any => {\n return useAsyncCache(this._metricsCache, [], \"useMetrics()\");\n }\n };\n }\n\n async sendTestEmail(options: {\n recipientEmail: string,\n emailConfig: EmailConfig,\n }): Promise<Result<undefined, { errorMessage: string }>> {\n const response = await this._interface.sendTestEmail({\n recipient_email: options.recipientEmail,\n email_config: {\n ...(pick(options.emailConfig, ['host', 'port', 'username', 'password'])),\n sender_email: options.emailConfig.senderEmail,\n sender_name: options.emailConfig.senderName,\n },\n });\n\n if (response.success) {\n return Result.ok(undefined);\n } else {\n return Result.error({ errorMessage: response.error_message ?? throwErr(\"Email test error not specified\") });\n }\n }\n\n async listSentEmails(): Promise<AdminSentEmail[]> {\n const response = await this._interface.listSentEmails();\n return response.items.map((email) => ({\n id: email.id,\n to: email.to ?? [],\n subject: email.subject,\n recipient: email.to?.[0] ?? \"\",\n sentAt: new Date(email.sent_at_millis),\n error: email.error,\n }));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,0BAAoC;AACpC,6BAAwC;AAKxC,oBAA8C;AAC9C,qBAAqB;AACrB,qBAAuB;AACvB,mBAAwB;AAExB,sBAAwH;AACxH,oBAAqD;AACrD,6BAA2G;AAC3G,yBAA+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AC,KAAK;AAAA,MAC5B,QAAQ,IAAI,KAAK,MAAM,cAAc;AAAA,MACrC,OAAO,MAAM;AAAA,IACf,EAAE;AAAA,EACJ;AACF;","names":["import_common"]}
|
|
1
|
+
{"version":3,"sources":["../../../../../src/lib/stack-app/apps/implementations/admin-app-impl.ts"],"sourcesContent":["\n//===========================================\n// THIS FILE IS AUTO-GENERATED FROM TEMPLATE. DO NOT EDIT IT DIRECTLY\n//===========================================\nimport { StackAdminInterface } from \"@stackframe/stack-shared\";\nimport { getProductionModeErrors } from \"@stackframe/stack-shared/dist/helpers/production-mode\";\nimport { ApiKeyCreateCrudResponse } from \"@stackframe/stack-shared/dist/interface/adminInterface\";\nimport { ApiKeysCrud } from \"@stackframe/stack-shared/dist/interface/crud/api-keys\";\nimport { EmailTemplateCrud, EmailTemplateType } from \"@stackframe/stack-shared/dist/interface/crud/email-templates\";\nimport { InternalProjectsCrud } from \"@stackframe/stack-shared/dist/interface/crud/projects\";\nimport { StackAssertionError, throwErr } from \"@stackframe/stack-shared/dist/utils/errors\";\nimport { pick } from \"@stackframe/stack-shared/dist/utils/objects\";\nimport { Result } from \"@stackframe/stack-shared/dist/utils/results\";\nimport { useMemo } from \"react\"; // THIS_LINE_PLATFORM react-like\nimport { AdminSentEmail } from \"../..\";\nimport { ApiKey, ApiKeyBase, ApiKeyBaseCrudRead, ApiKeyCreateOptions, ApiKeyFirstView, apiKeyCreateOptionsToCrud } from \"../../api-keys\";\nimport { EmailConfig, stackAppInternalsSymbol } from \"../../common\";\nimport { AdminEmailTemplate, AdminEmailTemplateUpdateOptions, adminEmailTemplateUpdateOptionsToCrud } from \"../../email-templates\";\nimport { AdminTeamPermission, AdminTeamPermissionDefinition, AdminTeamPermissionDefinitionCreateOptions, AdminTeamPermissionDefinitionUpdateOptions, AdminProjectPermission, AdminProjectPermissionDefinition, AdminProjectPermissionDefinitionCreateOptions, AdminProjectPermissionDefinitionUpdateOptions, adminTeamPermissionDefinitionCreateOptionsToCrud, adminTeamPermissionDefinitionUpdateOptionsToCrud, adminProjectPermissionDefinitionCreateOptionsToCrud, adminProjectPermissionDefinitionUpdateOptionsToCrud } from \"../../permissions\";\nimport { AdminOwnedProject, AdminProject, AdminProjectUpdateOptions, adminProjectUpdateOptionsToCrud } from \"../../projects\";\nimport { StackAdminApp, StackAdminAppConstructorOptions } from \"../interfaces/admin-app\";\nimport { clientVersion, createCache, getBaseUrl, getDefaultProjectId, getDefaultPublishableClientKey, getDefaultSecretServerKey, getDefaultSuperSecretAdminKey } from \"./common\";\nimport { _StackServerAppImplIncomplete } from \"./server-app-impl\";\n\nimport { useAsyncCache } from \"./common\";\n\nexport class _StackAdminAppImplIncomplete<HasTokenStore extends boolean, ProjectId extends string> extends _StackServerAppImplIncomplete<HasTokenStore, ProjectId> implements StackAdminApp<HasTokenStore, ProjectId>\n{\n declare protected _interface: StackAdminInterface;\n\n private readonly _adminProjectCache = createCache(async () => {\n return await this._interface.getProject();\n });\n private readonly _apiKeysCache = createCache(async () => {\n return await this._interface.listApiKeys();\n });\n private readonly _adminEmailTemplatesCache = createCache(async () => {\n return await this._interface.listEmailTemplates();\n });\n private readonly _adminTeamPermissionDefinitionsCache = createCache(async () => {\n return await this._interface.listTeamPermissionDefinitions();\n });\n private readonly _adminProjectPermissionDefinitionsCache = createCache(async () => {\n return await this._interface.listProjectPermissionDefinitions();\n });\n private readonly _svixTokenCache = createCache(async () => {\n return await this._interface.getSvixToken();\n });\n private readonly _metricsCache = createCache(async () => {\n return await this._interface.getMetrics();\n });\n\n constructor(options: StackAdminAppConstructorOptions<HasTokenStore, ProjectId>) {\n super({\n interface: new StackAdminInterface({\n getBaseUrl: () => getBaseUrl(options.baseUrl),\n projectId: options.projectId ?? getDefaultProjectId(),\n extraRequestHeaders: options.extraRequestHeaders ?? {},\n clientVersion,\n ...\"projectOwnerSession\" in options ? {\n projectOwnerSession: options.projectOwnerSession,\n } : {\n publishableClientKey: options.publishableClientKey ?? getDefaultPublishableClientKey(),\n secretServerKey: options.secretServerKey ?? getDefaultSecretServerKey(),\n superSecretAdminKey: options.superSecretAdminKey ?? getDefaultSuperSecretAdminKey(),\n },\n }),\n baseUrl: options.baseUrl,\n extraRequestHeaders: options.extraRequestHeaders,\n projectId: options.projectId,\n tokenStore: options.tokenStore,\n urls: options.urls,\n oauthScopesOnSignIn: options.oauthScopesOnSignIn,\n redirectMethod: options.redirectMethod,\n });\n }\n\n _adminOwnedProjectFromCrud(data: InternalProjectsCrud['Admin']['Read'], onRefresh: () => Promise<void>): AdminOwnedProject {\n if (this._tokenStoreInit !== null) {\n throw new StackAssertionError(\"Owned apps must always have tokenStore === null — did you not create this project with app._createOwnedApp()?\");;\n }\n return {\n ...this._adminProjectFromCrud(data, onRefresh),\n app: this as StackAdminApp<false>,\n };\n }\n\n _adminProjectFromCrud(data: InternalProjectsCrud['Admin']['Read'], onRefresh: () => Promise<void>): AdminProject {\n if (data.id !== this.projectId) {\n throw new StackAssertionError(`The project ID of the provided project JSON (${data.id}) does not match the project ID of the app (${this.projectId})!`);\n }\n\n const app = this;\n return {\n id: data.id,\n displayName: data.display_name,\n description: data.description,\n createdAt: new Date(data.created_at_millis),\n userCount: data.user_count,\n isProductionMode: data.is_production_mode,\n config: {\n id: data.config.id,\n signUpEnabled: data.config.sign_up_enabled,\n credentialEnabled: data.config.credential_enabled,\n magicLinkEnabled: data.config.magic_link_enabled,\n passkeyEnabled: data.config.passkey_enabled,\n clientTeamCreationEnabled: data.config.client_team_creation_enabled,\n clientUserDeletionEnabled: data.config.client_user_deletion_enabled,\n allowLocalhost: data.config.allow_localhost,\n oauthAccountMergeStrategy: data.config.oauth_account_merge_strategy,\n oauthProviders: data.config.oauth_providers.map((p) => ((p.type === 'shared' ? {\n id: p.id,\n enabled: p.enabled,\n type: 'shared',\n } as const : {\n id: p.id,\n enabled: p.enabled,\n type: 'standard',\n clientId: p.client_id ?? throwErr(\"Client ID is missing\"),\n clientSecret: p.client_secret ?? throwErr(\"Client secret is missing\"),\n facebookConfigId: p.facebook_config_id,\n microsoftTenantId: p.microsoft_tenant_id,\n } as const))),\n emailConfig: data.config.email_config.type === 'shared' ? {\n type: 'shared'\n } : {\n type: 'standard',\n host: data.config.email_config.host ?? throwErr(\"Email host is missing\"),\n port: data.config.email_config.port ?? throwErr(\"Email port is missing\"),\n username: data.config.email_config.username ?? throwErr(\"Email username is missing\"),\n password: data.config.email_config.password ?? throwErr(\"Email password is missing\"),\n senderName: data.config.email_config.sender_name ?? throwErr(\"Email sender name is missing\"),\n senderEmail: data.config.email_config.sender_email ?? throwErr(\"Email sender email is missing\"),\n },\n domains: data.config.domains.map((d) => ({\n domain: d.domain,\n handlerPath: d.handler_path,\n })),\n createTeamOnSignUp: data.config.create_team_on_sign_up,\n teamCreatorDefaultPermissions: data.config.team_creator_default_permissions,\n teamMemberDefaultPermissions: data.config.team_member_default_permissions,\n userDefaultPermissions: data.config.user_default_permissions,\n },\n\n async update(update: AdminProjectUpdateOptions) {\n await app._interface.updateProject(adminProjectUpdateOptionsToCrud(update));\n await onRefresh();\n },\n async delete() {\n await app._interface.deleteProject();\n },\n async getProductionModeErrors() {\n return getProductionModeErrors(data);\n },\n useProductionModeErrors() {\n return getProductionModeErrors(data);\n },\n };\n }\n\n _adminEmailTemplateFromCrud(data: EmailTemplateCrud['Admin']['Read']): AdminEmailTemplate {\n return {\n type: data.type,\n subject: data.subject,\n content: data.content,\n isDefault: data.is_default,\n };\n }\n\n override async getProject(): Promise<AdminProject> {\n return this._adminProjectFromCrud(\n Result.orThrow(await this._adminProjectCache.getOrWait([], \"write-only\")),\n () => this._refreshProject()\n );\n }\n\n override useProject(): AdminProject {\n const crud = useAsyncCache(this._adminProjectCache, [], \"useProjectAdmin()\");\n return useMemo(() => this._adminProjectFromCrud(\n crud,\n () => this._refreshProject()\n ), [crud]);\n }\n\n protected _createApiKeyBaseFromCrud(data: ApiKeyBaseCrudRead): ApiKeyBase {\n const app = this;\n return {\n id: data.id,\n description: data.description,\n expiresAt: new Date(data.expires_at_millis),\n manuallyRevokedAt: data.manually_revoked_at_millis ? new Date(data.manually_revoked_at_millis) : null,\n createdAt: new Date(data.created_at_millis),\n isValid() {\n return this.whyInvalid() === null;\n },\n whyInvalid() {\n if (this.expiresAt.getTime() < Date.now()) return \"expired\";\n if (this.manuallyRevokedAt) return \"manually-revoked\";\n return null;\n },\n async revoke() {\n const res = await app._interface.revokeApiKeyById(data.id);\n await app._refreshApiKeys();\n return res;\n }\n };\n }\n\n protected _createApiKeyFromCrud(data: ApiKeysCrud[\"Admin\"][\"Read\"]): ApiKey {\n return {\n ...this._createApiKeyBaseFromCrud(data),\n publishableClientKey: data.publishable_client_key ? { lastFour: data.publishable_client_key.last_four } : null,\n secretServerKey: data.secret_server_key ? { lastFour: data.secret_server_key.last_four } : null,\n superSecretAdminKey: data.super_secret_admin_key ? { lastFour: data.super_secret_admin_key.last_four } : null,\n };\n }\n\n protected _createApiKeyFirstViewFromCrud(data: ApiKeyCreateCrudResponse): ApiKeyFirstView {\n return {\n ...this._createApiKeyBaseFromCrud(data),\n publishableClientKey: data.publishable_client_key,\n secretServerKey: data.secret_server_key,\n superSecretAdminKey: data.super_secret_admin_key,\n };\n }\n\n async listApiKeys(): Promise<ApiKey[]> {\n const crud = Result.orThrow(await this._apiKeysCache.getOrWait([], \"write-only\"));\n return crud.map((j) => this._createApiKeyFromCrud(j));\n }\n\n useApiKeys(): ApiKey[] {\n const crud = useAsyncCache(this._apiKeysCache, [], \"useApiKeys()\");\n return useMemo(() => {\n return crud.map((j) => this._createApiKeyFromCrud(j));\n }, [crud]);\n }\n\n async createApiKey(options: ApiKeyCreateOptions): Promise<ApiKeyFirstView> {\n const crud = await this._interface.createApiKey(apiKeyCreateOptionsToCrud(options));\n await this._refreshApiKeys();\n return this._createApiKeyFirstViewFromCrud(crud);\n }\n\n useEmailTemplates(): AdminEmailTemplate[] {\n const crud = useAsyncCache(this._adminEmailTemplatesCache, [], \"useEmailTemplates()\");\n return useMemo(() => {\n return crud.map((j) => this._adminEmailTemplateFromCrud(j));\n }, [crud]);\n }\n async listEmailTemplates(): Promise<AdminEmailTemplate[]> {\n const crud = Result.orThrow(await this._adminEmailTemplatesCache.getOrWait([], \"write-only\"));\n return crud.map((j) => this._adminEmailTemplateFromCrud(j));\n }\n\n async updateEmailTemplate(type: EmailTemplateType, data: AdminEmailTemplateUpdateOptions): Promise<void> {\n await this._interface.updateEmailTemplate(type, adminEmailTemplateUpdateOptionsToCrud(data));\n await this._adminEmailTemplatesCache.refresh([]);\n }\n\n async resetEmailTemplate(type: EmailTemplateType) {\n await this._interface.resetEmailTemplate(type);\n await this._adminEmailTemplatesCache.refresh([]);\n }\n\n async createTeamPermissionDefinition(data: AdminTeamPermissionDefinitionCreateOptions): Promise<AdminTeamPermission>{\n const crud = await this._interface.createTeamPermissionDefinition(adminTeamPermissionDefinitionCreateOptionsToCrud(data));\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n return this._serverTeamPermissionDefinitionFromCrud(crud);\n }\n\n async updateTeamPermissionDefinition(permissionId: string, data: AdminTeamPermissionDefinitionUpdateOptions) {\n await this._interface.updateTeamPermissionDefinition(permissionId, adminTeamPermissionDefinitionUpdateOptionsToCrud(data));\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n }\n\n async deleteTeamPermissionDefinition(permissionId: string): Promise<void> {\n await this._interface.deleteTeamPermissionDefinition(permissionId);\n await this._adminTeamPermissionDefinitionsCache.refresh([]);\n }\n\n async listTeamPermissionDefinitions(): Promise<AdminTeamPermissionDefinition[]> {\n const crud = Result.orThrow(await this._adminTeamPermissionDefinitionsCache.getOrWait([], \"write-only\"));\n return crud.map((p) => this._serverTeamPermissionDefinitionFromCrud(p));\n }\n\n useTeamPermissionDefinitions(): AdminTeamPermissionDefinition[] {\n const crud = useAsyncCache(this._adminTeamPermissionDefinitionsCache, [], \"usePermissions()\");\n return useMemo(() => {\n return crud.map((p) => this._serverTeamPermissionDefinitionFromCrud(p));\n }, [crud]);\n }\n\n async createProjectPermissionDefinition(data: AdminProjectPermissionDefinitionCreateOptions): Promise<AdminProjectPermission> {\n const crud = await this._interface.createProjectPermissionDefinition(adminProjectPermissionDefinitionCreateOptionsToCrud(data));\n await this._adminProjectPermissionDefinitionsCache.refresh([]);\n return this._serverProjectPermissionDefinitionFromCrud(crud);\n }\n\n async updateProjectPermissionDefinition(permissionId: string, data: AdminProjectPermissionDefinitionUpdateOptions) {\n await this._interface.updateProjectPermissionDefinition(permissionId, adminProjectPermissionDefinitionUpdateOptionsToCrud(data));\n await this._adminProjectPermissionDefinitionsCache.refresh([]);\n }\n\n async deleteProjectPermissionDefinition(permissionId: string): Promise<void> {\n await this._interface.deleteProjectPermissionDefinition(permissionId);\n await this._adminProjectPermissionDefinitionsCache.refresh([]);\n }\n\n async listProjectPermissionDefinitions(): Promise<AdminProjectPermissionDefinition[]> {\n const crud = Result.orThrow(await this._adminProjectPermissionDefinitionsCache.getOrWait([], \"write-only\"));\n return crud.map((p) => this._serverProjectPermissionDefinitionFromCrud(p));\n }\n\n useProjectPermissionDefinitions(): AdminProjectPermissionDefinition[] {\n const crud = useAsyncCache(this._adminProjectPermissionDefinitionsCache, [], \"useProjectPermissions()\");\n return useMemo(() => {\n return crud.map((p) => this._serverProjectPermissionDefinitionFromCrud(p));\n }, [crud]);\n }\n useSvixToken(): string {\n const crud = useAsyncCache(this._svixTokenCache, [], \"useSvixToken()\");\n return crud.token;\n }\n\n protected override async _refreshProject() {\n await Promise.all([\n super._refreshProject(),\n this._adminProjectCache.refresh([]),\n ]);\n }\n\n protected async _refreshApiKeys() {\n await this._apiKeysCache.refresh([]);\n }\n\n get [stackAppInternalsSymbol]() {\n return {\n ...super[stackAppInternalsSymbol],\n useMetrics: (): any => {\n return useAsyncCache(this._metricsCache, [], \"useMetrics()\");\n }\n };\n }\n\n async sendTestEmail(options: {\n recipientEmail: string,\n emailConfig: EmailConfig,\n }): Promise<Result<undefined, { errorMessage: string }>> {\n const response = await this._interface.sendTestEmail({\n recipient_email: options.recipientEmail,\n email_config: {\n ...(pick(options.emailConfig, ['host', 'port', 'username', 'password'])),\n sender_email: options.emailConfig.senderEmail,\n sender_name: options.emailConfig.senderName,\n },\n });\n\n if (response.success) {\n return Result.ok(undefined);\n } else {\n return Result.error({ errorMessage: response.error_message ?? throwErr(\"Email test error not specified\") });\n }\n }\n\n async listSentEmails(): Promise<AdminSentEmail[]> {\n const response = await this._interface.listSentEmails();\n return response.items.map((email) => ({\n id: email.id,\n to: email.to ?? [],\n subject: email.subject,\n recipient: email.to?.[0] ?? \"\",\n sentAt: new Date(email.sent_at_millis),\n error: email.error,\n }));\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,0BAAoC;AACpC,6BAAwC;AAKxC,oBAA8C;AAC9C,qBAAqB;AACrB,qBAAuB;AACvB,mBAAwB;AAExB,sBAAwH;AACxH,oBAAqD;AACrD,6BAA2G;AAC3G,yBAAigB;AACjgB,sBAA4G;AAE5G,IAAAA,iBAAsK;AACtK,6BAA8C;AAE9C,IAAAA,iBAA8B;AAEvB,IAAM,+BAAN,cAAoG,qDAC3G;AAAA,EAyBE,YAAY,SAAoE;AAC9E,UAAM;AAAA,MACJ,WAAW,IAAI,wCAAoB;AAAA,QACjC,YAAY,UAAM,2BAAW,QAAQ,OAAO;AAAA,QAC5C,WAAW,QAAQ,iBAAa,oCAAoB;AAAA,QACpD,qBAAqB,QAAQ,uBAAuB,CAAC;AAAA,QACrD;AAAA,QACA,GAAG,yBAAyB,UAAU;AAAA,UACpC,qBAAqB,QAAQ;AAAA,QAC/B,IAAI;AAAA,UACF,sBAAsB,QAAQ,4BAAwB,+CAA+B;AAAA,UACrF,iBAAiB,QAAQ,uBAAmB,0CAA0B;AAAA,UACtE,qBAAqB,QAAQ,2BAAuB,8CAA8B;AAAA,QACpF;AAAA,MACF,CAAC;AAAA,MACD,SAAS,QAAQ;AAAA,MACjB,qBAAqB,QAAQ;AAAA,MAC7B,WAAW,QAAQ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