@krak-stack/auth 0.1.71 → 0.2.1
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/README.md +4 -3
- package/dist/access.d.ts +5 -7
- package/dist/access.js +11 -7
- package/dist/admin/api.group.d.ts +53 -53
- package/dist/admin/api.group.js +15 -15
- package/dist/admin/schema.d.ts +18 -18
- package/dist/admin/schema.js +3 -3
- package/dist/api.d.ts +1995 -533
- package/dist/api.js +7 -7
- package/dist/auth/api.group.d.ts +793 -0
- package/dist/auth/api.group.js +241 -0
- package/dist/auth/schema.d.ts +808 -0
- package/dist/auth/schema.js +628 -0
- package/dist/components/admin-organization-form.d.ts +1 -1
- package/dist/components/admin-organization-form.js +17 -18
- package/dist/components/admin-organizations.d.ts +4 -5
- package/dist/components/admin-organizations.js +83 -73
- package/dist/components/admin-users.d.ts +5 -6
- package/dist/components/admin-users.js +160 -181
- package/dist/components/api-key-edit-form.d.ts +4 -3
- package/dist/components/api-key-edit-form.js +33 -27
- package/dist/components/api-key-permissions.d.ts +1 -1
- package/dist/components/api-key-rate-limit.d.ts +1 -1
- package/dist/components/api-key-referrers.d.ts +3 -2
- package/dist/components/api-key-referrers.js +2 -3
- package/dist/components/api-key.d.ts +0 -9
- package/dist/components/api-key.js +0 -39
- package/dist/components/auth-atoms.d.ts +178 -0
- package/dist/components/auth-atoms.js +46 -0
- package/dist/components/auth-client-api.d.ts +1371 -556
- package/dist/components/auth-client-api.js +22 -14
- package/dist/components/auth-forms.d.ts +1 -3
- package/dist/components/auth-forms.js +173 -195
- package/dist/components/auth-provider.d.ts +16 -20
- package/dist/components/auth-provider.js +56 -30
- package/dist/components/has-permission.js +1 -1
- package/dist/components/index.d.ts +19 -20
- package/dist/components/index.js +13 -13
- package/dist/components/member-required.d.ts +1 -3
- package/dist/components/member-required.js +102 -78
- package/dist/components/organization-switcher.d.ts +4 -6
- package/dist/components/organization-switcher.js +539 -390
- package/dist/components/project-access-matrix.d.ts +1 -1
- package/dist/components/project-access-matrix.js +9 -13
- package/dist/components/user-button.d.ts +5 -3
- package/dist/components/user-button.js +291 -336
- package/dist/components/utils.d.ts +3 -1
- package/dist/components/utils.js +4 -11
- package/dist/extra/api.group.d.ts +22 -22
- package/dist/extra/api.group.js +9 -9
- package/dist/extra/schema.d.ts +1 -2
- package/dist/extra/schema.js +2 -3
- package/dist/index.d.ts +11 -12
- package/dist/index.js +11 -12
- package/dist/query.d.ts +2 -2
- package/dist/query.js +5 -5
- package/dist/roles.d.ts +5 -4
- package/dist/roles.js +11 -7
- package/dist/schema.d.ts +1 -1
- package/dist/schema.js +26 -19
- package/dist/server/actor.d.ts +20 -22
- package/dist/server/actor.js +14 -17
- package/dist/server/api.group.d.ts +29 -29
- package/dist/server/api.group.js +14 -14
- package/dist/server/index.d.ts +14 -14
- package/dist/server/index.js +8 -8
- package/dist/server/middleware.d.ts +1 -1
- package/dist/server/middleware.js +1 -1
- package/dist/server/schema.js +1 -1
- package/dist/service.d.ts +1997 -583
- package/dist/service.js +23 -16
- package/package.json +10 -9
- package/dist/better-auth/api.group.d.ts +0 -62
- package/dist/better-auth/api.group.js +0 -39
- package/dist/better-auth/schema.d.ts +0 -72
- package/dist/better-auth/schema.js +0 -110
- package/dist/components/auth-client.d.ts +0 -50
- package/dist/components/auth-client.js +0 -46
|
@@ -25,9 +25,10 @@ const messages = {
|
|
|
25
25
|
export const ProjectAccessMatrix = ({ access, labels, locale = "en", messages: messageOverrides, }) => {
|
|
26
26
|
const language = locale === "fr" ? "fr" : "en";
|
|
27
27
|
const text = { ...messages[language], ...messageOverrides };
|
|
28
|
+
const roleLabels = labels?.roles ?? {};
|
|
28
29
|
const roleLabel = (id) => {
|
|
29
|
-
const label =
|
|
30
|
-
return
|
|
30
|
+
const label = roleLabels[id];
|
|
31
|
+
return label ?? capitalizeFirst(id);
|
|
31
32
|
};
|
|
32
33
|
const roleColumns = Object.entries(access.roles).map(([id, permissions]) => ({
|
|
33
34
|
id,
|
|
@@ -64,22 +65,17 @@ const splitPermission = (permission) => {
|
|
|
64
65
|
};
|
|
65
66
|
const capitalizeFirst = (value) => value.charAt(0).toUpperCase() + value.slice(1);
|
|
66
67
|
const permissionLabels = (labels, resource, action) => {
|
|
67
|
-
const
|
|
68
|
-
|
|
68
|
+
const permissionGroups = labels?.permissions ?? {};
|
|
69
|
+
const group = permissionGroups[resource];
|
|
70
|
+
if (!group) {
|
|
69
71
|
return {
|
|
70
72
|
resource: capitalizeFirst(resource),
|
|
71
73
|
action: capitalizeFirst(action),
|
|
72
74
|
};
|
|
73
75
|
}
|
|
74
|
-
const
|
|
75
|
-
const actions = Reflect.get(group, "actions");
|
|
76
|
-
const actionLabel = typeof actions === "object" && actions !== null
|
|
77
|
-
? Reflect.get(actions, action)
|
|
78
|
-
: undefined;
|
|
76
|
+
const actionLabel = group.actions[action];
|
|
79
77
|
return {
|
|
80
|
-
resource:
|
|
81
|
-
|
|
82
|
-
: capitalizeFirst(resource),
|
|
83
|
-
action: typeof actionLabel === "string" ? actionLabel : capitalizeFirst(action),
|
|
78
|
+
resource: group.label,
|
|
79
|
+
action: actionLabel ?? capitalizeFirst(action),
|
|
84
80
|
};
|
|
85
81
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { type ComponentProps, type ReactNode } from "react";
|
|
2
2
|
import { DropdownMenuContent } from "@/components/ui/dropdown-menu";
|
|
3
|
-
import type { AuthUiClient } from "./auth-client";
|
|
4
3
|
declare const messages: {
|
|
5
4
|
readonly en: {
|
|
6
5
|
readonly table_empty: "No results.";
|
|
@@ -79,8 +78,10 @@ declare const messages: {
|
|
|
79
78
|
readonly user_button_aria_label: "Open user menu";
|
|
80
79
|
readonly user_button_impersonating: "Impersonating";
|
|
81
80
|
readonly user_button_logout: "Log out";
|
|
81
|
+
readonly user_button_logout_error: "Could not log out. Try again.";
|
|
82
82
|
readonly user_button_security: "Security";
|
|
83
83
|
readonly user_button_stop_impersonating: "Stop impersonating";
|
|
84
|
+
readonly user_button_stop_impersonating_error: "Could not stop impersonating. Try again.";
|
|
84
85
|
readonly user_delete: "Delete";
|
|
85
86
|
readonly user_field_password: "Password";
|
|
86
87
|
readonly user_form_description: "Update the profile details associated with your account.";
|
|
@@ -186,8 +187,10 @@ declare const messages: {
|
|
|
186
187
|
readonly user_button_aria_label: "Ouvrir le menu utilisateur";
|
|
187
188
|
readonly user_button_impersonating: "Imitation";
|
|
188
189
|
readonly user_button_logout: "Se déconnecter";
|
|
190
|
+
readonly user_button_logout_error: "Impossible de se déconnecter. Réessayez.";
|
|
189
191
|
readonly user_button_security: "Sécurité";
|
|
190
192
|
readonly user_button_stop_impersonating: "Arrêter l'imitation";
|
|
193
|
+
readonly user_button_stop_impersonating_error: "Impossible d'arrêter l'imitation. Réessayez.";
|
|
191
194
|
readonly user_delete: "Supprimer";
|
|
192
195
|
readonly user_field_password: "Mot de passe";
|
|
193
196
|
readonly user_form_description: "Mettez à jour les informations de profil associées à votre compte.";
|
|
@@ -220,7 +223,6 @@ declare const messages: {
|
|
|
220
223
|
type UserButtonMessageKey = keyof (typeof messages)["en"];
|
|
221
224
|
export type UserButtonMessages = Partial<Record<UserButtonMessageKey, string>>;
|
|
222
225
|
export type UserButtonProps = {
|
|
223
|
-
authClient?: AuthUiClient;
|
|
224
226
|
baseUrl?: string | undefined;
|
|
225
227
|
signOutRedirect?: string;
|
|
226
228
|
side?: ComponentProps<typeof DropdownMenuContent>["side"];
|
|
@@ -234,5 +236,5 @@ export type UserButtonProps = {
|
|
|
234
236
|
onDialogChange?: (dialog: UserButtonDialog | null) => void;
|
|
235
237
|
};
|
|
236
238
|
export type UserButtonDialog = "account" | "security" | "apiKeys" | "adminUsers" | "adminOrganizations";
|
|
237
|
-
export declare const UserButton: ({
|
|
239
|
+
export declare const UserButton: ({ baseUrl, signOutRedirect, side, defaultDialog, hideTrigger, renderUnauthenticated, menuActions, apiKeyPermissions, messages, dialog: controlledDialog, onDialogChange, }: UserButtonProps) => import("react").JSX.Element;
|
|
238
240
|
export {};
|