@krak-stack/auth 0.2.12 → 0.2.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/api.group.d.ts +4 -0
- package/dist/admin/schema.d.ts +3 -0
- package/dist/admin/schema.js +4 -1
- package/dist/api.d.ts +106 -92
- package/dist/auth/api.group.d.ts +46 -46
- package/dist/components/admin-organizations.d.ts +111 -1
- package/dist/components/admin-organizations.js +142 -26
- package/dist/components/admin-users.js +54 -78
- package/dist/components/associated-projects-notice.d.ts +6 -0
- package/dist/components/associated-projects-notice.js +24 -0
- package/dist/components/auth-atoms.d.ts +3 -3
- package/dist/components/auth-client-api.d.ts +55 -45
- package/dist/components/auth-forms.d.ts +1 -1
- package/dist/components/auth-forms.js +115 -33
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +1 -1
- package/dist/components/organization-switcher.d.ts +4 -0
- package/dist/components/organization-switcher.js +47 -41
- package/dist/components/scrollable-dialog.d.ts +13 -0
- package/dist/components/scrollable-dialog.js +12 -0
- package/dist/components/user-button.d.ts +4 -0
- package/dist/components/user-button.js +75 -69
- package/dist/extra/api.group.d.ts +6 -1
- package/dist/extra/api.group.js +14 -1
- package/dist/extra/schema.d.ts +12 -0
- package/dist/extra/schema.js +18 -0
- package/dist/server/actor.d.ts +2 -1
- package/dist/service.d.ts +102 -90
- package/package.json +3 -3
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DialogContent } from "@/components/ui/dialog";
|
|
3
|
+
import { Separator } from "@/components/ui/separator";
|
|
4
|
+
const widthClass = {
|
|
5
|
+
"2xl": "sm:max-w-2xl",
|
|
6
|
+
"3xl": "sm:max-w-3xl",
|
|
7
|
+
"4xl": "sm:max-w-4xl",
|
|
8
|
+
"6xl": "sm:max-w-6xl",
|
|
9
|
+
};
|
|
10
|
+
export const ScrollableDialogContent = ({ children, size, ...props }) => (_jsx(DialogContent, { className: `grid max-h-[85vh] min-w-0 grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden ${widthClass[size]}`, ...props, children: children }));
|
|
11
|
+
export const ScrollableDialogHeader = ({ children, className = "", ...props }) => (_jsxs("div", { className: `flex flex-col gap-6 pb-6 ${className}`, ...props, children: [children, _jsx(Separator, {})] }));
|
|
12
|
+
export const ScrollableDialogBody = ({ children, className = "", padding = "default", ...props }) => (_jsx("div", { className: "-mx-6 min-h-0 overflow-y-auto", ...props, children: _jsx("div", { className: `min-w-0 px-6 pt-1 ${padding === "form" ? "pb-6" : "pb-2"} ${className}`, children: children }) }));
|
|
@@ -96,6 +96,8 @@ declare const messages: {
|
|
|
96
96
|
readonly user_delete: "Delete";
|
|
97
97
|
readonly user_field_password: "Password";
|
|
98
98
|
readonly user_form_description: "Update the profile details associated with your account.";
|
|
99
|
+
readonly user_form_projects_summary: "Used by {count} projects.";
|
|
100
|
+
readonly user_form_projects_view: "View";
|
|
99
101
|
readonly user_form_name_label: "Name";
|
|
100
102
|
readonly user_form_title: "Account";
|
|
101
103
|
readonly user_form_update_error: "Unable to update your account.";
|
|
@@ -231,6 +233,8 @@ declare const messages: {
|
|
|
231
233
|
readonly user_delete: "Supprimer";
|
|
232
234
|
readonly user_field_password: "Mot de passe";
|
|
233
235
|
readonly user_form_description: "Mettez à jour les informations de profil associées à votre compte.";
|
|
236
|
+
readonly user_form_projects_summary: "Utilisé dans {count} projets.";
|
|
237
|
+
readonly user_form_projects_view: "Voir";
|
|
234
238
|
readonly user_form_name_label: "Nom";
|
|
235
239
|
readonly user_form_title: "Compte";
|
|
236
240
|
readonly user_form_update_error: "Impossible de mettre à jour votre compte.";
|
|
@@ -14,7 +14,7 @@ import { effectFormMessages, ImageField, SubmitButton, SubmitError, TextAreaFiel
|
|
|
14
14
|
import { Badge } from "@/components/ui/badge";
|
|
15
15
|
import { Button } from "@/components/ui/button";
|
|
16
16
|
import { CopyButton } from "@krak-stack/registry/copy-button";
|
|
17
|
-
import { Dialog,
|
|
17
|
+
import { Dialog, DialogFooter, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog";
|
|
18
18
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu";
|
|
19
19
|
import { Separator } from "@/components/ui/separator";
|
|
20
20
|
import { authClientApi, authHttpClient } from "./auth-client-api.js";
|
|
@@ -30,6 +30,8 @@ import { ExtraUploadedAsset } from "../extra/schema.js";
|
|
|
30
30
|
import { assetPath, assetUrl } from "./utils.js";
|
|
31
31
|
import { AdminOrganizationsTable } from "./admin-organizations.js";
|
|
32
32
|
import { AdminUsersTable } from "./admin-users.js";
|
|
33
|
+
import { ScrollableDialogBody, ScrollableDialogContent, ScrollableDialogHeader, } from "./scrollable-dialog.js";
|
|
34
|
+
import { AssociatedProjectsNotice } from "./associated-projects-notice.js";
|
|
33
35
|
import { ContactEmailsField, ContactPhonesField, ContactSocialsField, ContactWebsitesField, } from "./contact-fields.js";
|
|
34
36
|
import { decodeUserMetadata, ContactLocale, SocialPlatform, USER_CONTACT_LIMIT, UserMetadata, } from "../schema.js";
|
|
35
37
|
const messages = {
|
|
@@ -126,6 +128,8 @@ const messages = {
|
|
|
126
128
|
user_delete: "Delete",
|
|
127
129
|
user_field_password: "Password",
|
|
128
130
|
user_form_description: "Update the profile details associated with your account.",
|
|
131
|
+
user_form_projects_summary: "Used by {count} projects.",
|
|
132
|
+
user_form_projects_view: "View",
|
|
129
133
|
user_form_name_label: "Name",
|
|
130
134
|
user_form_title: "Account",
|
|
131
135
|
user_form_update_error: "Unable to update your account.",
|
|
@@ -261,6 +265,8 @@ const messages = {
|
|
|
261
265
|
user_delete: "Supprimer",
|
|
262
266
|
user_field_password: "Mot de passe",
|
|
263
267
|
user_form_description: "Mettez à jour les informations de profil associées à votre compte.",
|
|
268
|
+
user_form_projects_summary: "Utilisé dans {count} projets.",
|
|
269
|
+
user_form_projects_view: "Voir",
|
|
264
270
|
user_form_name_label: "Nom",
|
|
265
271
|
user_form_title: "Compte",
|
|
266
272
|
user_form_update_error: "Impossible de mettre à jour votre compte.",
|
|
@@ -553,7 +559,7 @@ export const UserButton = ({ baseUrl, signOutRedirect = "/", side = "bottom", de
|
|
|
553
559
|
: `${import.meta.env.VITE_SITE_URL}${signOutRedirect.startsWith("/") ? signOutRedirect : `/${signOutRedirect}`}`;
|
|
554
560
|
signOut({ baseUrl: resolvedBaseUrl, redirectUrl });
|
|
555
561
|
};
|
|
556
|
-
return (_jsxs(UserButtonMessagesContext.Provider, { value: m, children: [hideTrigger ? null : (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsxs(Button, { variant: "outline", size: "icon", className: "overflow-hidden", children: [displayImage ? (_jsx("img", { src: displayImage, alt: displayName || displayEmail, className: "size-full object-cover" })) : (_jsx(UserIcon, { className: "size-4.5" })), _jsx("span", { className: "sr-only", children: m.user_button_aria_label() })] }) }), _jsx(DropdownMenuContent, { className: "w-56 rounded-lg", side: side, align: "end", sideOffset: 4, children: _jsxs(DropdownMenuGroup, { children: [isImpersonating ? (_jsx("div", { className: "px-1 py-0.5", children: _jsx(Badge, { variant: "secondary", className: "text-xs font-normal", children: m.user_button_impersonating() }) })) : null, _jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: _jsx(AppBrand, { to: null, label: displayName || displayEmail, subtitle: displayName ? displayEmail : m.user_button_account(), icon: UserIcon, className: "px-1 py-1.5 text-left text-sm", ...(displayImage ? { imageSrc: displayImage } : {}) }) }), menuActions ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), menuActions] })) : null, _jsx(DropdownMenuSeparator, {}), canManageUserSettings ? (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { disabled: isPending, onClick: () => setSettingsDialog("account"), children: [_jsx(UserCircleIcon, {}), m.user_button_account()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("security"), children: [_jsx(ShieldCheck, {}), m.user_button_security()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("apiKeys"), children: [_jsx(KeyRound, {}), m.user_button_api_keys()] }), _jsx(DropdownMenuSeparator, {})] })) : null, (isAdmin && canUseAdminSettings) || isImpersonating ? (_jsxs(_Fragment, { children: [isAdmin && canUseAdminSettings ? (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("adminUsers"), children: [_jsx(Users, {}), m.user_button_admin_users()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("adminOrganizations"), children: [_jsx(Building2, {}), m.user_button_admin_organizations()] })] })) : null, isImpersonating ? (_jsxs(DropdownMenuItem, { disabled: isStoppingImpersonation, onClick: () => stopImpersonating({
|
|
562
|
+
return (_jsxs(UserButtonMessagesContext.Provider, { value: m, children: [hideTrigger ? null : (_jsxs(DropdownMenu, { children: [_jsx(DropdownMenuTrigger, { render: _jsxs(Button, { variant: "outline", size: "icon", className: "overflow-hidden", children: [displayImage ? (_jsx("img", { src: displayImage, alt: displayName || displayEmail, className: "size-full object-cover" })) : (_jsx(UserIcon, { className: "size-4.5" })), _jsx("span", { className: "sr-only", children: m.user_button_aria_label() })] }) }), _jsx(DropdownMenuContent, { className: "w-56 rounded-lg", side: side, align: "end", sideOffset: 4, children: _jsxs(DropdownMenuGroup, { children: [isImpersonating ? (_jsx("div", { className: "px-1 py-0.5", children: _jsx(Badge, { variant: "secondary", className: "text-xs font-normal", children: m.user_button_impersonating() }) })) : null, _jsx(DropdownMenuLabel, { className: "p-0 font-normal", children: _jsx(AppBrand, { to: null, label: displayName || displayEmail, subtitle: displayName ? displayEmail : m.user_button_account(), icon: UserIcon, className: "px-1 py-1.5 text-left text-sm", ...(displayImage ? { imageSrc: displayImage } : {}) }) }), _jsx("div", { className: "px-1 py-2", children: _jsx(AssociatedProjectsNotice, { baseUrl: resolvedBaseUrl, getSummary: (count) => m.user_form_projects_summary({ count }), viewLabel: m.user_form_projects_view() }) }), menuActions ? (_jsxs(_Fragment, { children: [_jsx(DropdownMenuSeparator, {}), menuActions] })) : null, _jsx(DropdownMenuSeparator, {}), canManageUserSettings ? (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { disabled: isPending, onClick: () => setSettingsDialog("account"), children: [_jsx(UserCircleIcon, {}), m.user_button_account()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("security"), children: [_jsx(ShieldCheck, {}), m.user_button_security()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("apiKeys"), children: [_jsx(KeyRound, {}), m.user_button_api_keys()] }), _jsx(DropdownMenuSeparator, {})] })) : null, (isAdmin && canUseAdminSettings) || isImpersonating ? (_jsxs(_Fragment, { children: [isAdmin && canUseAdminSettings ? (_jsxs(_Fragment, { children: [_jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("adminUsers"), children: [_jsx(Users, {}), m.user_button_admin_users()] }), _jsxs(DropdownMenuItem, { onClick: () => setSettingsDialog("adminOrganizations"), children: [_jsx(Building2, {}), m.user_button_admin_organizations()] })] })) : null, isImpersonating ? (_jsxs(DropdownMenuItem, { disabled: isStoppingImpersonation, onClick: () => stopImpersonating({
|
|
557
563
|
baseUrl: resolvedBaseUrl,
|
|
558
564
|
currentSiteHref,
|
|
559
565
|
refreshSession,
|
|
@@ -599,58 +605,58 @@ export const UserButton = ({ baseUrl, signOutRedirect = "/", side = "bottom", de
|
|
|
599
605
|
setManagingTwoFactor(false);
|
|
600
606
|
setRevokingAccount(null);
|
|
601
607
|
setSettingsDialog((current) => open ? "security" : current === "security" ? null : current);
|
|
602
|
-
}, children: _jsxs(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
608
|
+
}, children: _jsxs(ScrollableDialogContent, { size: "3xl", children: [_jsx(ScrollableDialogHeader, { children: _jsxs(DialogHeader, { className: "sm:flex-row sm:items-end sm:justify-between sm:gap-4", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-2", children: [_jsx(DialogTitle, { className: "text-2xl", children: changingPassword
|
|
609
|
+
? m.user_account_password_change_title()
|
|
610
|
+
: settingPassword
|
|
611
|
+
? m.user_account_password_set()
|
|
612
|
+
: revokingAccount
|
|
613
|
+
? m.user_account_revoke()
|
|
614
|
+
: managingTwoFactor
|
|
615
|
+
? m.user_two_factor_title()
|
|
616
|
+
: m.user_security_title() }), _jsx(DialogDescription, { children: changingPassword
|
|
617
|
+
? m.user_account_password_change_description()
|
|
618
|
+
: settingPassword
|
|
619
|
+
? m.user_account_password_description()
|
|
620
|
+
: revokingAccount
|
|
621
|
+
? m.user_account_revoke_description({
|
|
622
|
+
provider: providerName(revokingAccount.providerId, m),
|
|
623
|
+
})
|
|
624
|
+
: managingTwoFactor
|
|
625
|
+
? m.user_two_factor_description()
|
|
626
|
+
: m.user_security_description() })] }), changingPassword ||
|
|
627
|
+
settingPassword ||
|
|
628
|
+
revokingAccount ||
|
|
629
|
+
managingTwoFactor ? (_jsxs(Button, { className: "mt-2 w-fit sm:mt-0", type: "button", variant: "secondary", onClick: () => {
|
|
630
|
+
setChangingPassword(false);
|
|
631
|
+
setSettingPassword(false);
|
|
632
|
+
setTotpSetup(null);
|
|
633
|
+
setManagingTwoFactor(false);
|
|
634
|
+
setRevokingAccount(null);
|
|
635
|
+
}, children: [_jsx(ArrowLeft, {}), m.user_account_back()] })) : null] }) }), _jsx(ScrollableDialogBody, { children: changingPassword ? (_jsx(ChangePasswordForm, { baseUrl: resolvedBaseUrl })) : settingPassword ? (_jsx(SetPasswordForm, { baseUrl: resolvedBaseUrl, onSaved: async () => {
|
|
636
|
+
await accountCache.reload();
|
|
637
|
+
setSettingPassword(false);
|
|
638
|
+
} })) : revokingAccount ? (_jsx(RevokeAccountForm, { baseUrl: resolvedBaseUrl, account: revokingAccount, requirePassword: requiresPasswordForAccountRevoke(accountCache.accounts ?? []), onCancel: () => setRevokingAccount(null), onRevoked: async () => {
|
|
639
|
+
await accountCache.reload();
|
|
640
|
+
setRevokingAccount(null);
|
|
641
|
+
} })) : totpSetup ? (_jsx(VerifyTotpSetup, { baseUrl: resolvedBaseUrl, setup: totpSetup, onVerified: async () => {
|
|
642
|
+
await refreshSession();
|
|
643
|
+
setTotpSetup(null);
|
|
644
|
+
setManagingTwoFactor(false);
|
|
645
|
+
} })) : managingTwoFactor ? (_jsx(AccountSecuritySettings, { baseUrl: resolvedBaseUrl, accountCache: accountCache, onSetup: setTotpSetup })) : (_jsxs("div", { className: "flex flex-col gap-6", children: [_jsx(ConnectedAccounts, { onChangePassword: () => setChangingPassword(true), onSetupPassword: () => setSettingPassword(true), onRevokeAccount: setRevokingAccount, baseUrl: resolvedBaseUrl, accountCache: accountCache, googleEnabled: projectConfig?.authOptions.google ?? true, currentSiteHref: currentSiteHref, navigate: navigate }), _jsx(Separator, {}), _jsxs("section", { className: "flex flex-col gap-6", children: [_jsxs("div", { className: "flex flex-wrap items-start justify-between gap-3", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("h2", { className: "text-sm leading-none font-medium", children: m.user_two_factor_title() }), _jsx("p", { className: "text-muted-foreground text-xs", children: m.user_two_factor_description() })] }), _jsx(Badge, { variant: hasTwoFactorEnabled(session?.user)
|
|
646
|
+
? "default"
|
|
647
|
+
: "secondary", children: hasTwoFactorEnabled(session?.user)
|
|
648
|
+
? m.user_two_factor_enabled()
|
|
649
|
+
: m.user_two_factor_disabled() })] }), hasTwoFactorEnabled(session?.user) ? (_jsx(AccountSecuritySettings, { baseUrl: resolvedBaseUrl, accountCache: accountCache, onSetup: setTotpSetup })) : (_jsx(Button, { type: "button", className: "self-start", onClick: () => setManagingTwoFactor(true), children: m.user_two_factor_enable_submit() }))] })] })) })] }) }), _jsx(Dialog, { open: canManageUserSettings && settingsDialog === "apiKeys", onOpenChange: (open) => {
|
|
644
650
|
setSettingsDialog((current) => open ? "apiKeys" : current === "apiKeys" ? null : current);
|
|
645
|
-
}, children: _jsx(
|
|
651
|
+
}, children: _jsx(ScrollableDialogContent, { size: "4xl", children: _jsx(ApiKeyManager, { baseUrl: resolvedBaseUrl, active: settingsDialog === "apiKeys", permissionLabels: auth?.accessLabels ?? undefined, permissions: apiKeyPermissions ?? auth?.access?.apiKeyPermissions.user ?? {} }) }) }), isAdmin ? (_jsxs(_Fragment, { children: [_jsx(Dialog, { open: settingsDialog === "adminUsers", onOpenChange: (open) => {
|
|
646
652
|
setSettingsDialog((current) => open ? "adminUsers" : current === "adminUsers" ? null : current);
|
|
647
|
-
}, children: _jsxs(
|
|
653
|
+
}, children: _jsxs(ScrollableDialogContent, { size: "6xl", children: [_jsx(ScrollableDialogHeader, { children: _jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.user_button_admin_users() }), _jsx(DialogDescription, { children: m.user_button_admin_users_description() })] }) }), _jsx(ScrollableDialogBody, { children: _jsx(AdminUsersTable, {}) })] }) }), _jsx(Dialog, { open: settingsDialog === "adminOrganizations", onOpenChange: (open) => {
|
|
648
654
|
setSettingsDialog((current) => open
|
|
649
655
|
? "adminOrganizations"
|
|
650
656
|
: current === "adminOrganizations"
|
|
651
657
|
? null
|
|
652
658
|
: current);
|
|
653
|
-
}, children: _jsxs(
|
|
659
|
+
}, children: _jsxs(ScrollableDialogContent, { size: "6xl", children: [_jsx(ScrollableDialogHeader, { children: _jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.user_button_admin_organizations() }), _jsx(DialogDescription, { children: m.user_button_admin_organizations_description() })] }) }), _jsx(ScrollableDialogBody, { children: _jsx(AdminOrganizationsTable, {}) })] }) })] })) : null] }));
|
|
654
660
|
};
|
|
655
661
|
function ConnectedAccounts({ onSetupPassword, onRevokeAccount, onChangePassword, baseUrl, accountCache, googleEnabled, currentSiteHref, navigate, }) {
|
|
656
662
|
const m = useUserButtonMessages();
|
|
@@ -818,7 +824,7 @@ const UserForm = ({ defaultValues, error, onSubmit, }) => {
|
|
|
818
824
|
event.preventDefault();
|
|
819
825
|
event.stopPropagation();
|
|
820
826
|
submit();
|
|
821
|
-
}, children: _jsxs(
|
|
827
|
+
}, children: _jsxs(ScrollableDialogContent, { size: "3xl", children: [_jsx(ScrollableDialogHeader, { children: _jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.user_form_title() }), _jsx(DialogDescription, { children: m.user_form_description() })] }) }), _jsxs(ScrollableDialogBody, { className: "flex flex-col gap-4", padding: "form", children: [_jsxs("div", { className: "flex flex-col gap-1.5", children: [_jsx("h2", { className: "text-sm leading-none font-medium", children: m.user_profile_title() }), _jsx("p", { className: "text-muted-foreground text-sm", children: m.user_profile_description() })] }), _jsx(form.image, { label: m.user_profile_photo_upload_label(), size: {
|
|
822
828
|
width: 96,
|
|
823
829
|
height: 96,
|
|
824
830
|
suggestedWidth: 512,
|
|
@@ -988,26 +994,26 @@ function ApiKeyManager({ baseUrl, active, permissionLabels, permissions = {}, })
|
|
|
988
994
|
? cause.message
|
|
989
995
|
: m.user_api_key_delete_error()))))));
|
|
990
996
|
const deleteKey = useAtomSet(deleteKeyAction);
|
|
991
|
-
return (_jsxs(_Fragment, { children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: editingKey
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
997
|
+
return (_jsxs(_Fragment, { children: [_jsx(ScrollableDialogHeader, { children: _jsxs(DialogHeader, { className: "sm:flex-row sm:items-end sm:justify-between sm:gap-4", children: [_jsxs("div", { className: "flex min-w-0 flex-col gap-2", children: [_jsx(DialogTitle, { className: "text-2xl", children: editingKey
|
|
998
|
+
? m.user_api_key_edit_title()
|
|
999
|
+
: createdKey
|
|
1000
|
+
? m.user_api_key_created_title()
|
|
1001
|
+
: creating
|
|
1002
|
+
? m.user_api_key_create_title()
|
|
1003
|
+
: m.user_api_keys_title() }), _jsx(DialogDescription, { children: editingKey
|
|
1004
|
+
? m.user_api_key_edit_description()
|
|
1005
|
+
: createdKey
|
|
1006
|
+
? m.user_api_key_created_description()
|
|
1007
|
+
: creating
|
|
1008
|
+
? m.user_api_key_create_description()
|
|
1009
|
+
: m.user_api_keys_description() })] }), creating || editingKey ? (_jsxs(Button, { className: "mt-2 w-fit sm:mt-0", onClick: () => {
|
|
1010
|
+
setCreating(false);
|
|
1011
|
+
setCreatedKey(null);
|
|
1012
|
+
setEditingKey(null);
|
|
1013
|
+
}, type: "button", variant: "secondary", children: [_jsx(ArrowLeft, {}), m.user_api_key_back()] })) : (_jsxs(Button, { className: "mt-2 w-fit sm:mt-0", onClick: () => {
|
|
1014
|
+
setCreatedKey(null);
|
|
1015
|
+
setCreating(true);
|
|
1016
|
+
}, type: "button", children: [_jsx(Plus, {}), m.user_api_key_create_title()] }))] }) }), _jsxs(ScrollableDialogBody, { className: "flex min-w-0 flex-col gap-5", children: [creating && !createdKey ? (_jsx("section", { className: "w-full", children: _jsx(createForm.Initialize, { defaultValues: { name: "", referrers: "" }, children: _jsxs("form", { className: "flex flex-col gap-4", onSubmit: (event) => {
|
|
1011
1017
|
event.preventDefault();
|
|
1012
1018
|
event.stopPropagation();
|
|
1013
1019
|
submitCreateForm();
|
|
@@ -1017,7 +1023,7 @@ function ApiKeyManager({ baseUrl, active, permissionLabels, permissions = {}, })
|
|
|
1017
1023
|
})) }), _jsx(SubmitError, { result: createSubmitResult }), _jsx(SubmitButton, { form: createForm })] }) }) })) : null, creating && createdKey ? (_jsx("div", { className: "flex min-w-0 flex-col gap-3", children: _jsxs("div", { className: "bg-muted/50 flex min-w-0 items-center justify-between gap-3 rounded-md border px-3 py-2", children: [_jsx("code", { className: "block min-w-0 flex-1 overflow-x-auto text-sm whitespace-nowrap", children: createdKey }), _jsx(CopyButton, { className: "shrink-0", messages: {
|
|
1018
1024
|
copied: m.user_api_key_copied(),
|
|
1019
1025
|
copy: m.user_api_key_copy(),
|
|
1020
|
-
}, value: createdKey, variant: "ghost" })] }) })) : null, !creating && !editingKey && keysError ? (_jsx("p", { className: "text-destructive text-sm", children: keysError })) : null, !creating && !editingKey && error ? (_jsx("p", { className: "text-destructive text-sm", children: error })) : null, !creating && !editingKey ? (_jsx("div", { className: "max-w-full min-w-0
|
|
1026
|
+
}, value: createdKey, variant: "ghost" })] }) })) : null, !creating && !editingKey && keysError ? (_jsx("p", { className: "text-destructive text-sm", children: keysError })) : null, !creating && !editingKey && error ? (_jsx("p", { className: "text-destructive text-sm", children: error })) : null, !creating && !editingKey ? (_jsx("div", { className: "max-w-full min-w-0", children: _jsx(DataTable, { columnDefs: apiKeyColumns({ m }), rowData: keys, features: {
|
|
1021
1027
|
export: { baseName: m.user_api_keys_export_file_name() },
|
|
1022
1028
|
gallery: false,
|
|
1023
1029
|
rowActions: {
|
|
@@ -82,7 +82,12 @@ export declare const ExtraApiGroup: HttpApiGroup.HttpApiGroup<"authExtra", HttpA
|
|
|
82
82
|
readonly emailOtp: Schema.Boolean;
|
|
83
83
|
readonly google: Schema.Boolean;
|
|
84
84
|
}>;
|
|
85
|
-
}>>, Schema.toCodecJson<typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"
|
|
85
|
+
}>>, Schema.toCodecJson<typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"listAssociatedProjects", "GET", "/auth/associated-projects", never, Schema.toCodecStringTree<Schema.Struct<{
|
|
86
|
+
readonly organizationId: Schema.optional<Schema.String>;
|
|
87
|
+
}>>, never, never, Schema.toCodecJson<Schema.$Array<Schema.Struct<{
|
|
88
|
+
readonly id: Schema.String;
|
|
89
|
+
readonly name: Schema.String;
|
|
90
|
+
}>>>, Schema.toCodecJson<typeof HttpApiError.Unauthorized | typeof HttpApiError.Forbidden | typeof HttpApiError.InternalServerError>, never, never> | HttpApiEndpoint.HttpApiEndpoint<"setPassword", "POST", "/auth/set-password", never, never, Schema.toCodecJson<Schema.Struct<{
|
|
86
91
|
readonly newPassword: Schema.NonEmptyString;
|
|
87
92
|
}>>, never, Schema.toCodecJson<Schema.Struct<{
|
|
88
93
|
readonly ok: Schema.Boolean;
|
package/dist/extra/api.group.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from "effect";
|
|
2
2
|
import { OpenApi } from "effect/unstable/httpapi";
|
|
3
3
|
import { HttpApiEndpoint, HttpApiError, HttpApiGroup, } from "effect/unstable/httpapi";
|
|
4
|
-
import { ExtraBadRequest, ExtraCreateApiKeyPayload, ExtraCreateApiKeyResponse, ExtraImageUploadMultipartPayload, ExtraOkResponse, ExtraOrganizationPublicProfile, ExtraOrganizationPublicProfileQuery, ExtraProjectPublicConfig, ExtraProjectPublicConfigQuery, ExtraSetPasswordPayload, ExtraUpdateApiKeyPayload, ExtraUploadedAsset, ExtraVerifyApiKeyPayload, ExtraVerifyApiKeyResponse, ExtraVerifyPasswordPayload, } from "./schema.js";
|
|
4
|
+
import { ExtraBadRequest, ExtraAssociatedProjects, ExtraAssociatedProjectsQuery, ExtraCreateApiKeyPayload, ExtraCreateApiKeyResponse, ExtraImageUploadMultipartPayload, ExtraOkResponse, ExtraOrganizationPublicProfile, ExtraOrganizationPublicProfileQuery, ExtraProjectPublicConfig, ExtraProjectPublicConfigQuery, ExtraSetPasswordPayload, ExtraUpdateApiKeyPayload, ExtraUploadedAsset, ExtraVerifyApiKeyPayload, ExtraVerifyApiKeyResponse, ExtraVerifyPasswordPayload, } from "./schema.js";
|
|
5
5
|
export * from "./schema.js";
|
|
6
6
|
export const ExtraApiGroup = HttpApiGroup.make("authExtra")
|
|
7
7
|
.add(HttpApiEndpoint.get("getProjectPublicConfig", "/auth/project-config", {
|
|
@@ -12,6 +12,19 @@ export const ExtraApiGroup = HttpApiGroup.make("authExtra")
|
|
|
12
12
|
title: "Get project public config",
|
|
13
13
|
summary: "Get host-aware project white-label config",
|
|
14
14
|
description: "Returns resolved public branding and authentication options through the proxied auth API.",
|
|
15
|
+
})))
|
|
16
|
+
.add(HttpApiEndpoint.get("listAssociatedProjects", "/auth/associated-projects", {
|
|
17
|
+
query: ExtraAssociatedProjectsQuery.fields,
|
|
18
|
+
success: ExtraAssociatedProjects,
|
|
19
|
+
error: [
|
|
20
|
+
HttpApiError.Unauthorized,
|
|
21
|
+
HttpApiError.Forbidden,
|
|
22
|
+
HttpApiError.InternalServerError,
|
|
23
|
+
],
|
|
24
|
+
}).annotateMerge(OpenApi.annotations({
|
|
25
|
+
title: "List associated projects",
|
|
26
|
+
summary: "List projects affected by account or organization changes",
|
|
27
|
+
description: "Returns projects associated with the current user or with an organization the current user belongs to.",
|
|
15
28
|
})))
|
|
16
29
|
.add(HttpApiEndpoint.patch("updateApiKey", "/auth/api-key/:keyId", {
|
|
17
30
|
params: { keyId: Schema.NonEmptyString },
|
package/dist/extra/schema.d.ts
CHANGED
|
@@ -101,6 +101,17 @@ export declare const ExtraProjectPublicConfig: Schema.Struct<{
|
|
|
101
101
|
readonly google: Schema.Boolean;
|
|
102
102
|
}>;
|
|
103
103
|
}>;
|
|
104
|
+
export declare const ExtraAssociatedProjectsQuery: Schema.Struct<{
|
|
105
|
+
readonly organizationId: Schema.optional<Schema.String>;
|
|
106
|
+
}>;
|
|
107
|
+
export declare const ExtraAssociatedProject: Schema.Struct<{
|
|
108
|
+
readonly id: Schema.String;
|
|
109
|
+
readonly name: Schema.String;
|
|
110
|
+
}>;
|
|
111
|
+
export declare const ExtraAssociatedProjects: Schema.$Array<Schema.Struct<{
|
|
112
|
+
readonly id: Schema.String;
|
|
113
|
+
readonly name: Schema.String;
|
|
114
|
+
}>>;
|
|
104
115
|
export declare const ExtraOrganizationPublicProfileQuery: Schema.Struct<{
|
|
105
116
|
readonly organizationId: Schema.String;
|
|
106
117
|
readonly locale: Schema.optional<Schema.Union<readonly [Schema.Literal<"en">, Schema.Literal<"fr">]>>;
|
|
@@ -178,6 +189,7 @@ export type ExtraVerifyApiKeyPayload = typeof ExtraVerifyApiKeyPayload.Type;
|
|
|
178
189
|
export type ExtraVerifyApiKeyResponse = typeof ExtraVerifyApiKeyResponse.Type;
|
|
179
190
|
export type ExtraProjectPublicConfigQuery = typeof ExtraProjectPublicConfigQuery.Type;
|
|
180
191
|
export type ExtraProjectPublicConfig = typeof ExtraProjectPublicConfig.Type;
|
|
192
|
+
export type ExtraAssociatedProject = typeof ExtraAssociatedProject.Type;
|
|
181
193
|
export type ExtraOrganizationPublicProfileQuery = typeof ExtraOrganizationPublicProfileQuery.Type;
|
|
182
194
|
export type ExtraOrganizationPublicProfile = typeof ExtraOrganizationPublicProfile.Type;
|
|
183
195
|
export type ExtraOkResponse = typeof ExtraOkResponse.Type;
|
package/dist/extra/schema.js
CHANGED
|
@@ -220,6 +220,24 @@ export const ExtraProjectPublicConfig = Schema.Struct({
|
|
|
220
220
|
},
|
|
221
221
|
],
|
|
222
222
|
});
|
|
223
|
+
export const ExtraAssociatedProjectsQuery = Schema.Struct({
|
|
224
|
+
organizationId: Schema.optional(Schema.String),
|
|
225
|
+
}).annotate({
|
|
226
|
+
identifier: "ExtraAssociatedProjectsQuery",
|
|
227
|
+
title: "Associated projects query",
|
|
228
|
+
description: "Optionally scopes associated projects to an organization the current user belongs to.",
|
|
229
|
+
});
|
|
230
|
+
export const ExtraAssociatedProject = Schema.Struct({
|
|
231
|
+
id: Schema.String,
|
|
232
|
+
name: Schema.String,
|
|
233
|
+
}).annotate({
|
|
234
|
+
identifier: "ExtraAssociatedProject",
|
|
235
|
+
title: "Associated project",
|
|
236
|
+
});
|
|
237
|
+
export const ExtraAssociatedProjects = Schema.Array(ExtraAssociatedProject).annotate({
|
|
238
|
+
identifier: "ExtraAssociatedProjects",
|
|
239
|
+
title: "Associated projects",
|
|
240
|
+
});
|
|
223
241
|
export const ExtraOrganizationPublicProfileQuery = Schema.Struct({
|
|
224
242
|
organizationId: Schema.String,
|
|
225
243
|
locale: Schema.optional(OrganizationLocale),
|
package/dist/server/actor.d.ts
CHANGED
|
@@ -60,7 +60,7 @@ export type ActorConstraint = {
|
|
|
60
60
|
};
|
|
61
61
|
export declare function ActorRequired(): typeof AnyActorRequired;
|
|
62
62
|
export declare namespace ActorRequired {
|
|
63
|
-
|
|
63
|
+
export { actorRequiredLayer as layer };
|
|
64
64
|
}
|
|
65
65
|
export declare function ActorRequired(constraint: {
|
|
66
66
|
readonly type: "user";
|
|
@@ -76,4 +76,5 @@ export declare function ActorRequired(constraint: {
|
|
|
76
76
|
export declare function ActorRequired(constraint: {
|
|
77
77
|
readonly type: "apiKey";
|
|
78
78
|
}): typeof ApiKeyActorRequired;
|
|
79
|
+
declare const actorRequiredLayer: <Project extends string, Action extends string>(access: ProjectAccessDefinition<Project, Action>) => Layer.Layer<AnyActorRequired | ApiKeyActorRequired | OrganizationApiKeyActorRequired | UserActorRequired | UserApiKeyActorRequired, never, never>;
|
|
79
80
|
export {};
|