@krak-stack/auth 0.1.60 → 0.1.61
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/access.d.ts +28 -8
- package/dist/access.js +6 -3
- package/dist/components/api-key-edit-form.d.ts +3 -1
- package/dist/components/api-key-edit-form.js +6 -7
- package/dist/components/api-key-permissions.d.ts +10 -0
- package/dist/components/api-key-permissions.js +45 -0
- package/dist/components/auth-provider.d.ts +4 -2
- package/dist/components/auth-provider.js +3 -1
- package/dist/components/index.d.ts +4 -2
- package/dist/components/index.js +2 -1
- package/dist/components/organization-switcher.js +6 -6
- package/dist/components/project-access-matrix.d.ts +28 -0
- package/dist/components/project-access-matrix.js +92 -0
- package/dist/components/user-button.js +5 -6
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/package.json +5 -1
package/dist/access.d.ts
CHANGED
|
@@ -63,9 +63,11 @@ export type ProjectAccessDefinition<Project extends string = string, Action exte
|
|
|
63
63
|
}) => ReadonlySet<ProjectPermission<Project, Action>>;
|
|
64
64
|
readonly decodeGrant: (input: unknown) => Effect.Effect<ReadonlySet<ProjectPermission<Project, Action>>, Schema.SchemaError>;
|
|
65
65
|
readonly encodeGrant: (actions: ReadonlyArray<Action>) => ApiKeyPermissionGrant;
|
|
66
|
-
readonly
|
|
67
|
-
|
|
68
|
-
|
|
66
|
+
readonly apiKeyPermissions: {
|
|
67
|
+
readonly user: ApiKeyPermissionGrant;
|
|
68
|
+
readonly organization: ApiKeyPermissionGrant;
|
|
69
|
+
readonly service: ApiKeyPermissionGrant;
|
|
70
|
+
};
|
|
69
71
|
readonly actorForUser: (input: {
|
|
70
72
|
readonly userId: string;
|
|
71
73
|
readonly organizationId: string | null;
|
|
@@ -77,12 +79,26 @@ export type ProjectAccessDefinition<Project extends string = string, Action exte
|
|
|
77
79
|
readonly grant: ApiKeyPermissionGrant | null | undefined;
|
|
78
80
|
}) => CurrentActor;
|
|
79
81
|
};
|
|
80
|
-
export type ProjectAccessCatalog =
|
|
82
|
+
export type ProjectAccessCatalog = Pick<ProjectAccessDefinition, "project" | "roles" | "apiKeyPermissions">;
|
|
83
|
+
export type ProjectAccessLabelCatalog = {
|
|
81
84
|
readonly project: string;
|
|
82
|
-
readonly roles: Readonly<Record<string,
|
|
83
|
-
readonly
|
|
84
|
-
|
|
85
|
-
|
|
85
|
+
readonly roles: Readonly<Record<string, string | undefined>>;
|
|
86
|
+
readonly permissions: Readonly<Record<string, {
|
|
87
|
+
readonly label: string;
|
|
88
|
+
readonly actions: Readonly<Record<string, string>>;
|
|
89
|
+
}>>;
|
|
90
|
+
};
|
|
91
|
+
type PermissionResource<Action extends string> = Action extends `${infer Resource}:${string}` ? Resource : Action;
|
|
92
|
+
type PermissionAction<Action extends string, Resource extends string> = Action extends `${Resource}:${infer Value}` ? Value : never;
|
|
93
|
+
export type ProjectAccessLabels<Action extends string = string, Role extends string = string> = {
|
|
94
|
+
readonly project: string;
|
|
95
|
+
readonly roles: Readonly<Partial<Record<Role, string>>>;
|
|
96
|
+
readonly permissions: {
|
|
97
|
+
readonly [Resource in PermissionResource<Action>]: {
|
|
98
|
+
readonly label: string;
|
|
99
|
+
readonly actions: Readonly<Record<PermissionAction<Action, Resource>, string>>;
|
|
100
|
+
};
|
|
101
|
+
};
|
|
86
102
|
};
|
|
87
103
|
export type ProjectAccessConfig<Project extends string, Permissions extends ReadonlyArray<string>> = {
|
|
88
104
|
readonly project: Project;
|
|
@@ -95,4 +111,8 @@ export type ProjectAccessConfig<Project extends string, Permissions extends Read
|
|
|
95
111
|
};
|
|
96
112
|
};
|
|
97
113
|
export declare const defineProjectAccess: <const Project extends string, const Permissions extends ReadonlyArray<string>>(config: ProjectAccessConfig<Project, Permissions>) => ProjectAccessDefinition<Project, Permissions[number]>;
|
|
114
|
+
export declare const defineProjectAccessLabels: <const Action extends string, const Role extends string>(_access: {
|
|
115
|
+
readonly actions: ReadonlyArray<Action>;
|
|
116
|
+
readonly roles: Readonly<Record<Role, ReadonlyArray<Action> | undefined>>;
|
|
117
|
+
}, labels: ProjectAccessLabels<Action, Role>) => ProjectAccessLabels<Action, Role>;
|
|
98
118
|
export {};
|
package/dist/access.js
CHANGED
|
@@ -107,10 +107,13 @@ export const defineProjectAccess = (config) => {
|
|
|
107
107
|
permissionsForUserKey: ({ grant, roles }) => intersection(intersection(permissionsForRoles(roles), permissionsForActions(userApiKeyActions)), permissionsForGrant(grant)),
|
|
108
108
|
decodeGrant: (input) => Schema.decodeUnknownEffect(ApiKeyPermissionGrant)(input).pipe(Effect.map(permissionsForGrant)),
|
|
109
109
|
encodeGrant,
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
apiKeyPermissions: {
|
|
111
|
+
user: encodeGrant(userApiKeyActions),
|
|
112
|
+
organization: encodeGrant(organizationApiKeyActions),
|
|
113
|
+
service: encodeGrant(serviceApiKeyActions),
|
|
114
|
+
},
|
|
113
115
|
actorForUser,
|
|
114
116
|
actorForApiKey,
|
|
115
117
|
};
|
|
116
118
|
};
|
|
119
|
+
export const defineProjectAccessLabels = (_access, labels) => labels;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ApiKey } from "@better-auth/api-key/client";
|
|
2
|
+
import type { ProjectAccessLabelCatalog } from "../access";
|
|
2
3
|
type ApiKeySummary = Omit<ApiKey, "key">;
|
|
3
4
|
export type ApiKeyEditMessages = {
|
|
4
5
|
enabled: string;
|
|
@@ -11,11 +12,12 @@ export type ApiKeyEditMessages = {
|
|
|
11
12
|
permissionsDescription: string;
|
|
12
13
|
updateError: string;
|
|
13
14
|
};
|
|
14
|
-
export declare const ApiKeyEditForm: ({ configId, keyData, messages, permissions, onSaved, }: {
|
|
15
|
+
export declare const ApiKeyEditForm: ({ configId, keyData, messages, permissions, permissionLabels, onSaved, }: {
|
|
15
16
|
configId: "organization" | "user";
|
|
16
17
|
keyData: ApiKeySummary;
|
|
17
18
|
messages: ApiKeyEditMessages;
|
|
18
19
|
permissions: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
20
|
+
permissionLabels?: ProjectAccessLabelCatalog | undefined;
|
|
19
21
|
onSaved: () => void;
|
|
20
22
|
}) => import("react").JSX.Element;
|
|
21
23
|
export {};
|
|
@@ -4,16 +4,15 @@ import { FormBuilder, FormReact } from "@lucas-barake/effect-form-react";
|
|
|
4
4
|
import { Effect, Schema } from "effect";
|
|
5
5
|
import { useRef, useState } from "react";
|
|
6
6
|
import { CheckboxField, SubmitButton, SubmitError, TextAreaField, TextField, } from "@/components/ui/effect-form";
|
|
7
|
-
import { Checkbox } from "@/components/ui/checkbox";
|
|
8
|
-
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel, FieldLegend, FieldSet, } from "@/components/ui/field";
|
|
9
7
|
import { parseApiKeyReferrers, updateApiKey } from "./api-key";
|
|
8
|
+
import { ApiKeyPermissions } from "./api-key-permissions";
|
|
10
9
|
import { apiKeyReferrers } from "./api-key-referrers";
|
|
11
10
|
import { ExtraApiKeyPermissions } from "../extra/schema";
|
|
12
11
|
const editApiKeyFormBuilder = FormBuilder.empty
|
|
13
12
|
.addField("name", Schema.NonEmptyString)
|
|
14
13
|
.addField("enabled", Schema.Boolean)
|
|
15
14
|
.addField("referrers", Schema.String);
|
|
16
|
-
export const ApiKeyEditForm = ({ configId, keyData, messages, permissions, onSaved, }) => {
|
|
15
|
+
export const ApiKeyEditForm = ({ configId, keyData, messages, permissions, permissionLabels, onSaved, }) => {
|
|
17
16
|
const permissionOptions = Object.entries(permissions).flatMap(([project, actions]) => actions.map((action) => ({
|
|
18
17
|
id: `${project}:${action}`,
|
|
19
18
|
project,
|
|
@@ -77,8 +76,8 @@ export const ApiKeyEditForm = ({ configId, keyData, messages, permissions, onSav
|
|
|
77
76
|
event.preventDefault();
|
|
78
77
|
event.stopPropagation();
|
|
79
78
|
submit();
|
|
80
|
-
}, children: [_jsx(form.name, { label: messages.name, required: true }), _jsx(form.enabled, { label: messages.enabled }), _jsx(form.referrers, { label: messages.referrers, description: messages.referrersDescription, placeholder: messages.referrersPlaceholder, rows: 3 }),
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
79
|
+
}, children: [_jsx(form.name, { label: messages.name, required: true }), _jsx(form.enabled, { label: messages.enabled }), _jsx(form.referrers, { label: messages.referrers, description: messages.referrersDescription, placeholder: messages.referrersPlaceholder, rows: 3 }), _jsx(ApiKeyPermissions, { description: messages.permissionsDescription, idPrefix: "edit", permissions: permissions, labels: permissionLabels, selected: selectedPermissions, title: messages.permissions, onChange: (id, checked) => setSelectedPermissions((current) => ({
|
|
80
|
+
...current,
|
|
81
|
+
[id]: checked,
|
|
82
|
+
})) }), _jsx(SubmitError, { result: submitResult }), _jsx(SubmitButton, { form: form })] }) }) }));
|
|
84
83
|
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ProjectAccessLabelCatalog } from "../access";
|
|
2
|
+
export declare const ApiKeyPermissions: ({ description, idPrefix, permissions, labels, selected, title, onChange, }: {
|
|
3
|
+
description: string;
|
|
4
|
+
idPrefix: string;
|
|
5
|
+
permissions: Readonly<Record<string, ReadonlyArray<string>>>;
|
|
6
|
+
labels?: ProjectAccessLabelCatalog | undefined;
|
|
7
|
+
selected: Readonly<Record<string, boolean>>;
|
|
8
|
+
title: string;
|
|
9
|
+
onChange: (id: string, checked: boolean) => void;
|
|
10
|
+
}) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronDown } from "lucide-react";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { Checkbox } from "@/components/ui/checkbox";
|
|
5
|
+
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible";
|
|
6
|
+
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel, FieldLegend, FieldSet, } from "@/components/ui/field";
|
|
7
|
+
export const ApiKeyPermissions = ({ description, idPrefix, permissions, labels, selected, title, onChange, }) => {
|
|
8
|
+
const groups = Object.entries(permissions).reduce((groups, [permissionResource, permissionActions]) => {
|
|
9
|
+
for (const permissionAction of permissionActions) {
|
|
10
|
+
const separator = permissionAction.indexOf(":");
|
|
11
|
+
const resource = separator === -1
|
|
12
|
+
? permissionResource
|
|
13
|
+
: permissionAction.slice(0, separator);
|
|
14
|
+
const label = separator === -1
|
|
15
|
+
? permissionAction
|
|
16
|
+
: permissionAction.slice(separator + 1);
|
|
17
|
+
const group = groups.find((item) => item.resource === resource);
|
|
18
|
+
const permissionLabels = labels?.permissions[resource];
|
|
19
|
+
const action = {
|
|
20
|
+
id: `${permissionResource}:${permissionAction}`,
|
|
21
|
+
label: permissionLabels?.actions[label] ?? label,
|
|
22
|
+
};
|
|
23
|
+
if (group)
|
|
24
|
+
group.actions.push(action);
|
|
25
|
+
else
|
|
26
|
+
groups.push({
|
|
27
|
+
resource,
|
|
28
|
+
label: permissionLabels?.label ?? resource,
|
|
29
|
+
actions: [action],
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return groups;
|
|
33
|
+
}, []);
|
|
34
|
+
if (groups.length === 0)
|
|
35
|
+
return null;
|
|
36
|
+
return (_jsxs(FieldSet, { className: "gap-3", children: [_jsx(FieldLegend, { className: "mb-0", children: title }), _jsx(FieldDescription, { children: description }), _jsx("div", { className: "overflow-hidden rounded-lg border", children: groups.map(({ resource, label, actions }, index) => (_jsx(PermissionGroup, { actions: actions, className: index > 0 ? "border-t" : "", idPrefix: idPrefix, resourceLabel: label, selected: selected, onChange: onChange }, resource))) })] }));
|
|
37
|
+
};
|
|
38
|
+
const PermissionGroup = ({ actions, className, idPrefix, resourceLabel, selected, onChange, }) => {
|
|
39
|
+
const selectedCount = actions.filter((action) => selected[action.id]).length;
|
|
40
|
+
const [open, setOpen] = useState(selectedCount > 0);
|
|
41
|
+
return (_jsxs(Collapsible, { className: className, open: open, onOpenChange: setOpen, children: [_jsxs(CollapsibleTrigger, { className: "hover:bg-muted/50 focus-visible:ring-ring flex w-full items-center gap-3 px-4 py-3 text-left outline-none focus-visible:ring-2 focus-visible:ring-inset", children: [_jsx("span", { className: "min-w-0 flex-1 truncate text-sm font-medium", children: resourceLabel }), _jsxs("span", { className: "text-muted-foreground text-xs tabular-nums", children: [selectedCount, "/", actions.length] }), _jsx(ChevronDown, { "aria-hidden": "true", className: `text-muted-foreground size-4 shrink-0 transition-transform ${open ? "rotate-180" : ""}` })] }), _jsx(CollapsibleContent, { className: "border-t px-4 py-3", children: _jsx(FieldGroup, { "data-slot": "checkbox-group", className: "grid gap-3 sm:grid-cols-2", children: actions.map((action) => {
|
|
42
|
+
const inputId = `${idPrefix}-${action.id}`;
|
|
43
|
+
return (_jsxs(Field, { orientation: "horizontal", children: [_jsx(Checkbox, { id: inputId, checked: selected[action.id] ?? false, onCheckedChange: (checked) => onChange(action.id, checked) }), _jsx(FieldContent, { children: _jsx(FieldLabel, { htmlFor: inputId, children: action.label }) })] }, action.id));
|
|
44
|
+
}) }) })] }));
|
|
45
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type AuthUiClient } from "./auth-client";
|
|
3
3
|
import type { ExtraProjectPublicConfig } from "../extra/schema";
|
|
4
|
-
import type { ProjectAccessCatalog } from "../access";
|
|
4
|
+
import type { ProjectAccessCatalog, ProjectAccessLabelCatalog } from "../access";
|
|
5
5
|
export type KrakstackAuthLocale = "en" | "fr";
|
|
6
6
|
export type KrakstackAuthProviderProps = {
|
|
7
7
|
children: ReactNode;
|
|
@@ -10,6 +10,7 @@ export type KrakstackAuthProviderProps = {
|
|
|
10
10
|
projectId?: string | null | undefined;
|
|
11
11
|
authClient?: AuthUiClient | undefined;
|
|
12
12
|
access?: ProjectAccessCatalog | undefined;
|
|
13
|
+
accessLabels?: ProjectAccessLabelCatalog | undefined;
|
|
13
14
|
};
|
|
14
15
|
export type KrakstackAuthContextValue = {
|
|
15
16
|
locale: KrakstackAuthLocale;
|
|
@@ -18,10 +19,11 @@ export type KrakstackAuthContextValue = {
|
|
|
18
19
|
authClient: AuthUiClient;
|
|
19
20
|
projectConfig: ExtraProjectPublicConfig | null;
|
|
20
21
|
access: ProjectAccessCatalog | null;
|
|
22
|
+
accessLabels: ProjectAccessLabelCatalog | null;
|
|
21
23
|
authRefreshVersion: number;
|
|
22
24
|
refreshAuth: () => void;
|
|
23
25
|
};
|
|
24
|
-
export declare function KrakstackAuthProvider({ children, locale, baseUrl, projectId, authClient, access, }: KrakstackAuthProviderProps): import("react").JSX.Element;
|
|
26
|
+
export declare function KrakstackAuthProvider({ children, locale, baseUrl, projectId, authClient, access, accessLabels, }: KrakstackAuthProviderProps): import("react").JSX.Element;
|
|
25
27
|
export declare const useKrakstackAuth: () => KrakstackAuthContextValue | null;
|
|
26
28
|
export declare const useAuthClient: () => AuthUiClient;
|
|
27
29
|
export declare const useKrakstackAuthProjectConfig: () => import("effect/Schema").Struct.ReadonlySide<{
|
|
@@ -68,7 +68,7 @@ const useProjectConfig = (baseUrl, providedProjectId) => {
|
|
|
68
68
|
}), { suspendOnWaiting: true });
|
|
69
69
|
return result.value;
|
|
70
70
|
};
|
|
71
|
-
export function KrakstackAuthProvider({ children, locale = "en", baseUrl, projectId, authClient, access, }) {
|
|
71
|
+
export function KrakstackAuthProvider({ children, locale = "en", baseUrl, projectId, authClient, access, accessLabels, }) {
|
|
72
72
|
const searchString = useRouterState({
|
|
73
73
|
select: (state) => state.location.searchStr,
|
|
74
74
|
});
|
|
@@ -89,6 +89,7 @@ export function KrakstackAuthProvider({ children, locale = "en", baseUrl, projec
|
|
|
89
89
|
projectId: resolvedProjectId,
|
|
90
90
|
projectConfig,
|
|
91
91
|
access: access ?? null,
|
|
92
|
+
accessLabels: accessLabels ?? null,
|
|
92
93
|
authRefreshVersion,
|
|
93
94
|
refreshAuth,
|
|
94
95
|
}), [
|
|
@@ -98,6 +99,7 @@ export function KrakstackAuthProvider({ children, locale = "en", baseUrl, projec
|
|
|
98
99
|
resolvedProjectId,
|
|
99
100
|
projectConfig,
|
|
100
101
|
access,
|
|
102
|
+
accessLabels,
|
|
101
103
|
authRefreshVersion,
|
|
102
104
|
refreshAuth,
|
|
103
105
|
]);
|
|
@@ -3,14 +3,16 @@ export { createAuthUiClient } from "./auth-client";
|
|
|
3
3
|
export { OrganizationSwitcher } from "./organization-switcher";
|
|
4
4
|
export { MemberRequired } from "./member-required";
|
|
5
5
|
export { HasPermission, useHasPermission } from "./has-permission";
|
|
6
|
+
export { ProjectAccessMatrix } from "./project-access-matrix";
|
|
6
7
|
export { ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, } from "./auth-forms";
|
|
7
8
|
export { UserButton } from "./user-button";
|
|
8
9
|
export { AdminOrganizationsTable } from "./admin-organizations";
|
|
9
10
|
export { AdminOrganizationForm } from "./admin-organization-form";
|
|
10
11
|
export { AdminUsersTable, useAdminUsersTotal } from "./admin-users";
|
|
11
12
|
export { assetUrl } from "./utils";
|
|
12
|
-
export { ApiKeyPermissionGrant, CurrentActor, Forbidden, all, actorUserId, any, defineProjectAccess, permission, policy, withPolicy, } from "../access";
|
|
13
|
-
export type { ApiKeyOwner, ApiKeyActor, Actor, Policy, ProjectAccessConfig, ProjectAccessCatalog, ProjectAccessDefinition, UserActor, } from "../access";
|
|
13
|
+
export { ApiKeyPermissionGrant, CurrentActor, Forbidden, all, actorUserId, any, defineProjectAccess, defineProjectAccessLabels, permission, policy, withPolicy, } from "../access";
|
|
14
|
+
export type { ApiKeyOwner, ApiKeyActor, Actor, Policy, ProjectAccessConfig, ProjectAccessCatalog, ProjectAccessLabelCatalog, ProjectAccessDefinition, ProjectAccessLabels, UserActor, } from "../access";
|
|
15
|
+
export type { ProjectAccessMatrixAccess, ProjectAccessMatrixMessages, } from "./project-access-matrix";
|
|
14
16
|
export type { KrakstackAuthContextValue, KrakstackAuthLocale, KrakstackAuthProviderProps, } from "./auth-provider";
|
|
15
17
|
export type { OrganizationSwitcherDialog, OrganizationSwitcherFeatures, OrganizationSwitcherProps, } from "./organization-switcher";
|
|
16
18
|
export type { UserButtonDialog } from "./user-button";
|
package/dist/components/index.js
CHANGED
|
@@ -3,10 +3,11 @@ export { createAuthUiClient } from "./auth-client";
|
|
|
3
3
|
export { OrganizationSwitcher } from "./organization-switcher";
|
|
4
4
|
export { MemberRequired } from "./member-required";
|
|
5
5
|
export { HasPermission, useHasPermission } from "./has-permission";
|
|
6
|
+
export { ProjectAccessMatrix } from "./project-access-matrix";
|
|
6
7
|
export { ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, } from "./auth-forms";
|
|
7
8
|
export { UserButton } from "./user-button";
|
|
8
9
|
export { AdminOrganizationsTable } from "./admin-organizations";
|
|
9
10
|
export { AdminOrganizationForm } from "./admin-organization-form";
|
|
10
11
|
export { AdminUsersTable, useAdminUsersTotal } from "./admin-users";
|
|
11
12
|
export { assetUrl } from "./utils";
|
|
12
|
-
export { ApiKeyPermissionGrant, CurrentActor, Forbidden, all, actorUserId, any, defineProjectAccess, permission, policy, withPolicy, } from "../access";
|
|
13
|
+
export { ApiKeyPermissionGrant, CurrentActor, Forbidden, all, actorUserId, any, defineProjectAccess, defineProjectAccessLabels, permission, policy, withPolicy, } from "../access";
|
|
@@ -15,7 +15,6 @@ import { Field, FieldLabel, FieldSet } from "@/components/ui/field";
|
|
|
15
15
|
import { Input } from "@/components/ui/input";
|
|
16
16
|
import { Badge } from "@/components/ui/badge";
|
|
17
17
|
import { Button } from "@/components/ui/button";
|
|
18
|
-
import { Checkbox } from "@/components/ui/checkbox";
|
|
19
18
|
import { CopyButton } from "@/components/ui/copy-button";
|
|
20
19
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog";
|
|
21
20
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu";
|
|
@@ -27,6 +26,7 @@ import { authClientApi } from "./auth-client-api";
|
|
|
27
26
|
import { useKrakstackAuth } from "./auth-provider";
|
|
28
27
|
import { createApiKey, parseApiKeyReferrers } from "./api-key";
|
|
29
28
|
import { ApiKeyEditForm } from "./api-key-edit-form";
|
|
29
|
+
import { ApiKeyPermissions } from "./api-key-permissions";
|
|
30
30
|
import { ApiKeyRateLimit, apiKeyUsagePercent } from "./api-key-rate-limit";
|
|
31
31
|
import { ApiKeyReferrers } from "./api-key-referrers";
|
|
32
32
|
import { useOpenedOnce } from "./hooks";
|
|
@@ -954,8 +954,8 @@ export function OrganizationSwitcher({ authClient: providedAuthClient, baseUrl,
|
|
|
954
954
|
onChange?.(null);
|
|
955
955
|
} })) : null }) }), _jsx(Dialog, { open: dialog === "apiKeys" && canManageApiKeys, onOpenChange: (open) => {
|
|
956
956
|
setDialog((current) => open ? "apiKeys" : current === "apiKeys" ? null : current);
|
|
957
|
-
}, children: _jsx(DialogContent, { className: "max-h-[85vh] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl", children: activeOrganization.data ? (_jsx(OrganizationApiKeyManager, { authClient: authClient, organization: activeOrganization.data, active: dialog === "apiKeys" && canManageApiKeys, permissions: apiKeyPermissions ??
|
|
958
|
-
auth?.access?.
|
|
957
|
+
}, children: _jsx(DialogContent, { className: "max-h-[85vh] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl", children: activeOrganization.data ? (_jsx(OrganizationApiKeyManager, { authClient: authClient, organization: activeOrganization.data, active: dialog === "apiKeys" && canManageApiKeys, permissionLabels: auth?.accessLabels ?? undefined, permissions: apiKeyPermissions ??
|
|
958
|
+
auth?.access?.apiKeyPermissions.organization ??
|
|
959
959
|
{} })) : null }) }), _jsx(Dialog, { open: dialog === "invitations" && canViewOrganizationInvitations, onOpenChange: (open) => {
|
|
960
960
|
setDialog((current) => open ? "invitations" : current === "invitations" ? null : current);
|
|
961
961
|
}, children: _jsxs(DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-4xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.organization_user_invitations_title() }), _jsx(DialogDescription, { children: m.organization_user_invitations_description() })] }), _jsx(Separator, {}), _jsx(UserInvitationsManager, { authClient: authClient, baseUrl: baseUrl, invitations: userInvitations, loading: loadingUserInvitations, error: userInvitationsError, ...(activeOrganization.data
|
|
@@ -1490,7 +1490,7 @@ const invitationRowActions = ({ m, cancellingInvitationId, onCancel, }) => [
|
|
|
1490
1490
|
onClick: onCancel,
|
|
1491
1491
|
},
|
|
1492
1492
|
];
|
|
1493
|
-
function OrganizationApiKeyManager({ authClient, organization, active, permissions, }) {
|
|
1493
|
+
function OrganizationApiKeyManager({ authClient, organization, active, permissionLabels, permissions, }) {
|
|
1494
1494
|
const m = useOrganizationMessages();
|
|
1495
1495
|
const hasOpened = useOpenedOnce(active);
|
|
1496
1496
|
const keysAtom = hasOpened
|
|
@@ -1587,7 +1587,7 @@ function OrganizationApiKeyManager({ authClient, organization, active, permissio
|
|
|
1587
1587
|
event.preventDefault();
|
|
1588
1588
|
event.stopPropagation();
|
|
1589
1589
|
submitApiKey();
|
|
1590
|
-
}, children: [_jsx(createForm.name, { label: m.user_api_key_name(), required: true }), _jsx(createForm.referrers, { label: m.user_api_key_referrers(), description: m.user_api_key_referrers_description(), placeholder: m.user_api_key_referrers_placeholder(), rows: 3 }),
|
|
1590
|
+
}, children: [_jsx(createForm.name, { label: m.user_api_key_name(), required: true }), _jsx(createForm.referrers, { label: m.user_api_key_referrers(), description: m.user_api_key_referrers_description(), placeholder: m.user_api_key_referrers_placeholder(), rows: 3 }), _jsx(ApiKeyPermissions, { description: m.user_api_key_permissions_description(), idPrefix: "organization-create", permissions: permissions, labels: permissionLabels, selected: selectedPermissions, title: m.user_api_key_permissions(), onChange: togglePermission }), _jsx(SubmitError, { result: createResult }), _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: {
|
|
1591
1591
|
copied: m.user_api_key_copied(),
|
|
1592
1592
|
copy: m.user_api_key_copy(),
|
|
1593
1593
|
}, 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 overflow-x-hidden", children: _jsx(DataTable, { columns: apiKeyColumns({ m }), data: keys, features: {
|
|
@@ -1603,7 +1603,7 @@ function OrganizationApiKeyManager({ authClient, organization, active, permissio
|
|
|
1603
1603
|
}, searchState: "local", state: {
|
|
1604
1604
|
empty: loading ? m.user_loading() : m.table_empty(),
|
|
1605
1605
|
loading,
|
|
1606
|
-
} }) })) : null, editingKey ? (_jsx(ApiKeyEditForm, { configId: "organization", keyData: editingKey, permissions: permissions, messages: {
|
|
1606
|
+
} }) })) : null, editingKey ? (_jsx(ApiKeyEditForm, { configId: "organization", keyData: editingKey, permissions: permissions, permissionLabels: permissionLabels, messages: {
|
|
1607
1607
|
enabled: m.user_api_key_enabled(),
|
|
1608
1608
|
name: m.user_api_key_name(),
|
|
1609
1609
|
referrers: m.user_api_key_referrers(),
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { ProjectAccessLabels } from "../access";
|
|
2
|
+
export type ProjectAccessMatrixAccess<Action extends string = string> = {
|
|
3
|
+
readonly actions: ReadonlyArray<Action>;
|
|
4
|
+
readonly apiKeys: {
|
|
5
|
+
readonly user: ReadonlyArray<Action>;
|
|
6
|
+
readonly organization: ReadonlyArray<Action>;
|
|
7
|
+
readonly service: ReadonlyArray<Action>;
|
|
8
|
+
};
|
|
9
|
+
readonly project: string;
|
|
10
|
+
readonly roles: Readonly<Record<string, ReadonlyArray<Action> | undefined>>;
|
|
11
|
+
};
|
|
12
|
+
export type ProjectAccessMatrixMessages = {
|
|
13
|
+
action: string;
|
|
14
|
+
allowed: string;
|
|
15
|
+
apiKeyPermissions: string;
|
|
16
|
+
denied: string;
|
|
17
|
+
organizationKey: string;
|
|
18
|
+
resource: string;
|
|
19
|
+
rolePermissions: string;
|
|
20
|
+
serviceKey: string;
|
|
21
|
+
userKey: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const ProjectAccessMatrix: <Action extends string, Role extends string>({ access, labels, locale, messages: messageOverrides, }: {
|
|
24
|
+
access: ProjectAccessMatrixAccess<Action>;
|
|
25
|
+
labels?: ProjectAccessLabels<Action, Role>;
|
|
26
|
+
locale?: string;
|
|
27
|
+
messages?: Partial<ProjectAccessMatrixMessages>;
|
|
28
|
+
}) => import("react").JSX.Element;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Check, Minus } from "lucide-react";
|
|
3
|
+
const messages = {
|
|
4
|
+
en: {
|
|
5
|
+
action: "Action",
|
|
6
|
+
allowed: "Allowed",
|
|
7
|
+
apiKeyPermissions: "API-key assignable permissions",
|
|
8
|
+
denied: "Not allowed",
|
|
9
|
+
organizationKey: "Organization key",
|
|
10
|
+
resource: "Resource",
|
|
11
|
+
rolePermissions: "Role grants",
|
|
12
|
+
serviceKey: "Service key",
|
|
13
|
+
userKey: "User key",
|
|
14
|
+
},
|
|
15
|
+
fr: {
|
|
16
|
+
action: "Action",
|
|
17
|
+
allowed: "Autorisé",
|
|
18
|
+
apiKeyPermissions: "Autorisations attribuables aux clés API",
|
|
19
|
+
denied: "Non autorisé",
|
|
20
|
+
organizationKey: "Clé d’organisation",
|
|
21
|
+
resource: "Ressource",
|
|
22
|
+
rolePermissions: "Droits des rôles",
|
|
23
|
+
serviceKey: "Clé de service",
|
|
24
|
+
userKey: "Clé utilisateur",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export const ProjectAccessMatrix = ({ access, labels, locale = "en", messages: messageOverrides, }) => {
|
|
28
|
+
const language = locale === "fr" ? "fr" : "en";
|
|
29
|
+
const text = { ...messages[language], ...messageOverrides };
|
|
30
|
+
const roleLabel = (id) => {
|
|
31
|
+
const label = Object.entries(labels?.roles ?? {}).find(([role]) => role === id)?.[1];
|
|
32
|
+
return typeof label === "string" ? label : capitalizeFirst(id);
|
|
33
|
+
};
|
|
34
|
+
const roleColumns = Object.entries(access.roles).map(([id, permissions]) => ({
|
|
35
|
+
id,
|
|
36
|
+
label: roleLabel(id),
|
|
37
|
+
permissions: permissions ?? [],
|
|
38
|
+
}));
|
|
39
|
+
const keyColumns = [
|
|
40
|
+
{
|
|
41
|
+
id: "user",
|
|
42
|
+
label: text.userKey,
|
|
43
|
+
permissions: access.apiKeys.user,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "organization",
|
|
47
|
+
label: text.organizationKey,
|
|
48
|
+
permissions: access.apiKeys.organization,
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
id: "service",
|
|
52
|
+
label: text.serviceKey,
|
|
53
|
+
permissions: access.apiKeys.service,
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
return (_jsxs("div", { className: "space-y-8", children: [_jsx(PermissionTable, { access: access, columns: roleColumns, labels: labels, text: text, title: text.rolePermissions }), _jsx(PermissionTable, { access: access, columns: keyColumns, labels: labels, text: text, title: text.apiKeyPermissions })] }));
|
|
57
|
+
};
|
|
58
|
+
const PermissionTable = ({ access, columns, labels, text, title, }) => (_jsxs("section", { className: "space-y-3", children: [_jsx("h3", { className: "text-lg font-semibold", children: title }), _jsx("div", { className: "overflow-x-auto rounded-lg border", children: _jsxs("table", { className: "w-full min-w-max border-collapse text-sm", children: [_jsx("thead", { className: "bg-muted/50", children: _jsxs("tr", { children: [_jsx("th", { className: "px-4 py-3 text-left font-medium", scope: "col", children: text.resource }), _jsx("th", { className: "px-4 py-3 text-left font-medium", scope: "col", children: text.action }), columns.map((column) => (_jsx("th", { className: "px-4 py-3 text-center font-medium", scope: "col", children: column.label }, column.id)))] }) }), _jsx("tbody", { children: access.actions.map((permission) => {
|
|
59
|
+
const { action, resource } = splitPermission(permission);
|
|
60
|
+
return (_jsxs("tr", { className: "border-t", children: [_jsxs("th", { className: "px-4 py-3 text-left font-normal", scope: "row", children: [_jsx("span", { children: permissionLabels(labels, resource, action).resource }), _jsx("code", { className: "text-muted-foreground ml-2 text-xs", children: resource })] }), _jsxs("td", { className: "px-4 py-3", children: [_jsx("span", { children: permissionLabels(labels, resource, action).action }), _jsx("code", { className: "text-muted-foreground ml-2 text-xs", children: action })] }), columns.map((column) => (_jsx(PermissionCell, { allowed: column.permissions.includes(permission), messages: text }, column.id)))] }, permission));
|
|
61
|
+
}) })] }) })] }));
|
|
62
|
+
const PermissionCell = ({ allowed, messages, }) => (_jsxs("td", { className: "px-4 py-3 text-center", children: [_jsx("span", { className: "sr-only", children: allowed ? messages.allowed : messages.denied }), allowed ? (_jsx(Check, { "aria-hidden": "true", className: "mx-auto size-4 text-emerald-600 dark:text-emerald-400" })) : (_jsx(Minus, { "aria-hidden": "true", className: "text-muted-foreground/60 mx-auto size-4" }))] }));
|
|
63
|
+
const splitPermission = (permission) => {
|
|
64
|
+
const separator = permission.indexOf(":");
|
|
65
|
+
return separator === -1
|
|
66
|
+
? { resource: permission, action: permission }
|
|
67
|
+
: {
|
|
68
|
+
resource: permission.slice(0, separator),
|
|
69
|
+
action: permission.slice(separator + 1),
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
const capitalizeFirst = (value) => value.charAt(0).toUpperCase() + value.slice(1);
|
|
73
|
+
const permissionLabels = (labels, resource, action) => {
|
|
74
|
+
const group = Reflect.get(labels?.permissions ?? {}, resource);
|
|
75
|
+
if (typeof group !== "object" || group === null) {
|
|
76
|
+
return {
|
|
77
|
+
resource: capitalizeFirst(resource),
|
|
78
|
+
action: capitalizeFirst(action),
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
const resourceLabel = Reflect.get(group, "label");
|
|
82
|
+
const actions = Reflect.get(group, "actions");
|
|
83
|
+
const actionLabel = typeof actions === "object" && actions !== null
|
|
84
|
+
? Reflect.get(actions, action)
|
|
85
|
+
: undefined;
|
|
86
|
+
return {
|
|
87
|
+
resource: typeof resourceLabel === "string"
|
|
88
|
+
? resourceLabel
|
|
89
|
+
: capitalizeFirst(resource),
|
|
90
|
+
action: typeof actionLabel === "string" ? actionLabel : capitalizeFirst(action),
|
|
91
|
+
};
|
|
92
|
+
};
|
|
@@ -13,16 +13,15 @@ import { AppBrand } from "@/components/ui/app-brand";
|
|
|
13
13
|
import { effectFormMessages, ImageField, SubmitButton, SubmitError, TextAreaField, TextField, } from "@/components/ui/effect-form";
|
|
14
14
|
import { Badge } from "@/components/ui/badge";
|
|
15
15
|
import { Button } from "@/components/ui/button";
|
|
16
|
-
import { Checkbox } from "@/components/ui/checkbox";
|
|
17
16
|
import { CopyButton } from "@/components/ui/copy-button";
|
|
18
17
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "@/components/ui/dialog";
|
|
19
|
-
import { Field, FieldContent, FieldDescription, FieldGroup, FieldLabel, FieldLegend, FieldSet, } from "@/components/ui/field";
|
|
20
18
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuTrigger, } from "@/components/ui/dropdown-menu";
|
|
21
19
|
import { Separator } from "@/components/ui/separator";
|
|
22
20
|
import { authClientApi } from "./auth-client-api";
|
|
23
21
|
import { useKrakstackAuth } from "./auth-provider";
|
|
24
22
|
import { createApiKey, parseApiKeyReferrers } from "./api-key";
|
|
25
23
|
import { ApiKeyEditForm } from "./api-key-edit-form";
|
|
24
|
+
import { ApiKeyPermissions } from "./api-key-permissions";
|
|
26
25
|
import { ApiKeyRateLimit, apiKeyUsagePercent } from "./api-key-rate-limit";
|
|
27
26
|
import { ApiKeyReferrers } from "./api-key-referrers";
|
|
28
27
|
import { useOpenedOnce } from "./hooks";
|
|
@@ -434,7 +433,7 @@ export const UserButton = ({ authClient: providedAuthClient, baseUrl, signOutRed
|
|
|
434
433
|
setSettingsDialog((current) => open ? "security" : current === "security" ? null : current);
|
|
435
434
|
}, children: _jsxs(DialogContent, { className: "max-h-[85vh] overflow-y-auto sm:max-w-3xl", children: [_jsxs(DialogHeader, { children: [_jsx(DialogTitle, { className: "text-2xl", children: m.user_security_title() }), _jsx(DialogDescription, { children: m.user_security_description() })] }), _jsx(Separator, {}), _jsxs("div", { className: "flex flex-col gap-6", children: [_jsx(PasswordSettings, { authClient: authClient, baseUrl: baseUrl, accountCache: accountCache }), _jsx(Separator, {}), _jsx(AccountSecuritySettings, { authClient: authClient, accountCache: accountCache })] })] }) }), _jsx(Dialog, { open: canManageUserSettings && settingsDialog === "apiKeys", onOpenChange: (open) => {
|
|
436
435
|
setSettingsDialog((current) => open ? "apiKeys" : current === "apiKeys" ? null : current);
|
|
437
|
-
}, children: _jsx(DialogContent, { className: "max-h-[85vh] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl", children: _jsx(ApiKeyManager, { authClient: authClient, active: settingsDialog === "apiKeys", permissions: apiKeyPermissions ?? auth?.access?.
|
|
436
|
+
}, children: _jsx(DialogContent, { className: "max-h-[85vh] min-w-0 overflow-x-hidden overflow-y-auto sm:max-w-3xl", children: _jsx(ApiKeyManager, { authClient: authClient, active: settingsDialog === "apiKeys", permissionLabels: auth?.accessLabels ?? undefined, permissions: apiKeyPermissions ?? auth?.access?.apiKeyPermissions.user ?? {} }) }) }), isAdmin ? (_jsxs(_Fragment, { children: [_jsx(Dialog, { open: settingsDialog === "adminUsers", onOpenChange: (open) => {
|
|
438
437
|
setSettingsDialog((current) => open ? "adminUsers" : current === "adminUsers" ? null : current);
|
|
439
438
|
}, children: _jsxs(DialogContent, { className: "flex h-[85vh] flex-col overflow-y-auto sm:max-w-6xl", 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(Separator, {}), _jsx("div", { className: "min-h-0 flex-1", children: _jsx(AdminUsersTable, {}) })] }) }), _jsx(Dialog, { open: settingsDialog === "adminOrganizations", onOpenChange: (open) => {
|
|
440
439
|
setSettingsDialog((current) => open
|
|
@@ -753,7 +752,7 @@ function DisableTotpForm({ authClient, requirePassword, onDisabled, }) {
|
|
|
753
752
|
submit();
|
|
754
753
|
}, children: [requirePassword ? (_jsx(form.password, { label: m.user_field_password(), type: "password", autoComplete: "current-password", required: true })) : null, _jsx(SubmitError, { result: submitResult }), requirePassword ? (_jsx(SubmitButton, { form: form })) : (_jsxs(Button, { type: "button", disabled: submitResult.waiting, onClick: () => submit(), children: [submitResult.waiting ? (_jsx(Loader2, { "data-icon": "inline-start", className: "animate-spin" })) : null, effectFormMessages().submit] }))] }) }));
|
|
755
754
|
}
|
|
756
|
-
function ApiKeyManager({ authClient, active, permissions = {}, }) {
|
|
755
|
+
function ApiKeyManager({ authClient, active, permissionLabels, permissions = {}, }) {
|
|
757
756
|
const m = useUserButtonMessages();
|
|
758
757
|
const hasOpened = useOpenedOnce(active);
|
|
759
758
|
const keysAtom = hasOpened ? userApiKeysAtom(authClient) : emptyApiKeysAtom;
|
|
@@ -842,7 +841,7 @@ function ApiKeyManager({ authClient, active, permissions = {}, }) {
|
|
|
842
841
|
event.preventDefault();
|
|
843
842
|
event.stopPropagation();
|
|
844
843
|
submitCreateForm();
|
|
845
|
-
}, children: [_jsx(createForm.name, { label: m.user_api_key_name(), required: true }), _jsx(createForm.referrers, { label: m.user_api_key_referrers(), description: m.user_api_key_referrers_description(), placeholder: m.user_api_key_referrers_placeholder(), rows: 3 }),
|
|
844
|
+
}, children: [_jsx(createForm.name, { label: m.user_api_key_name(), required: true }), _jsx(createForm.referrers, { label: m.user_api_key_referrers(), description: m.user_api_key_referrers_description(), placeholder: m.user_api_key_referrers_placeholder(), rows: 3 }), _jsx(ApiKeyPermissions, { description: m.user_api_key_permissions_description(), idPrefix: "user-create", permissions: permissions, labels: permissionLabels, selected: selectedPermissions, title: m.user_api_key_permissions(), onChange: togglePermission }), _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: {
|
|
846
845
|
copied: m.user_api_key_copied(),
|
|
847
846
|
copy: m.user_api_key_copy(),
|
|
848
847
|
}, 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 overflow-x-hidden", children: _jsx(DataTable, { columns: apiKeyColumns({ m }), data: keys, features: {
|
|
@@ -858,7 +857,7 @@ function ApiKeyManager({ authClient, active, permissions = {}, }) {
|
|
|
858
857
|
}, searchState: "local", state: {
|
|
859
858
|
empty: loading ? m.user_loading() : m.table_empty(),
|
|
860
859
|
loading,
|
|
861
|
-
} }) })) : null, editingKey ? (_jsx(ApiKeyEditForm, { configId: "user", keyData: editingKey, permissions: permissions, messages: {
|
|
860
|
+
} }) })) : null, editingKey ? (_jsx(ApiKeyEditForm, { configId: "user", keyData: editingKey, permissions: permissions, permissionLabels: permissionLabels, messages: {
|
|
862
861
|
enabled: m.user_api_key_enabled(),
|
|
863
862
|
name: m.user_api_key_name(),
|
|
864
863
|
referrers: m.user_api_key_referrers(),
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { AuthClientApi, AuthServiceApi } from "./api";
|
|
|
5
5
|
export { AuthService, type AuthServiceLayerOptions } from "./service";
|
|
6
6
|
export { AuthClientConfig } from "./config";
|
|
7
7
|
export { proxyAuthRequest } from "./server/proxy";
|
|
8
|
-
export { OrganizationSwitcher, MemberRequired, KrakstackAuthProvider, ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, type AuthUiClient, type MemberRequiredMessages, type MemberRequiredProps, type KrakstackAuthContextValue, type KrakstackAuthLocale, type KrakstackAuthProviderProps, type OrganizationSwitcherDialog, type OrganizationSwitcherFeatures, type OrganizationSwitcherProps, type UserButtonDialog, useAuthClient, useAdminUsersTotal, } from "./components";
|
|
8
|
+
export { OrganizationSwitcher, MemberRequired, ProjectAccessMatrix, KrakstackAuthProvider, ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, type AuthUiClient, type MemberRequiredMessages, type MemberRequiredProps, type ProjectAccessMatrixAccess, type ProjectAccessMatrixMessages, type ProjectAccessLabels, type ProjectAccessLabelCatalog, type KrakstackAuthContextValue, type KrakstackAuthLocale, type KrakstackAuthProviderProps, type OrganizationSwitcherDialog, type OrganizationSwitcherFeatures, type OrganizationSwitcherProps, type UserButtonDialog, useAuthClient, useAdminUsersTotal, } from "./components";
|
|
9
9
|
export * as BetterAuth from "./better-auth/api.group";
|
|
10
10
|
export * as Extra from "./extra/api.group";
|
|
11
11
|
export * as Server from "./server";
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ export { AuthClientApi, AuthServiceApi } from "./api";
|
|
|
5
5
|
export { AuthService } from "./service";
|
|
6
6
|
export { AuthClientConfig } from "./config";
|
|
7
7
|
export { proxyAuthRequest } from "./server/proxy";
|
|
8
|
-
export { OrganizationSwitcher, MemberRequired, KrakstackAuthProvider, ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, useAuthClient, useAdminUsersTotal, } from "./components";
|
|
8
|
+
export { OrganizationSwitcher, MemberRequired, ProjectAccessMatrix, KrakstackAuthProvider, ResetPassword, Signin, Signup, TwoFactor, VerifyEmail, AdminOrganizationForm, AdminOrganizationsTable, AdminUsersTable, UserButton, assetUrl, createAuthUiClient, useAuthClient, useAdminUsersTotal, } from "./components";
|
|
9
9
|
export * as BetterAuth from "./better-auth/api.group";
|
|
10
10
|
export * as Extra from "./extra/api.group";
|
|
11
11
|
export * as Server from "./server";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@krak-stack/auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.61",
|
|
4
4
|
"description": "Effect HttpApi clients and schemas for KrakStack Auth.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"files": [
|
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
"types": "./dist/access.d.ts",
|
|
39
39
|
"default": "./dist/access.js"
|
|
40
40
|
},
|
|
41
|
+
"./access/matrix": {
|
|
42
|
+
"types": "./dist/components/project-access-matrix.d.ts",
|
|
43
|
+
"default": "./dist/components/project-access-matrix.js"
|
|
44
|
+
},
|
|
41
45
|
"./components": {
|
|
42
46
|
"types": "./dist/components/index.d.ts",
|
|
43
47
|
"default": "./dist/components/index.js"
|