@tiny-server/identity 0.0.0-pre202605241751

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.
Files changed (81) hide show
  1. package/dist/AccountForm-B2UrGPa4.js +165 -0
  2. package/dist/AccountHeader-B4SMzQeC.js +31 -0
  3. package/dist/AccountSettingsMenuItem-BKBN0OZp.js +29 -0
  4. package/dist/CreatedUpdatedBadges-C4dgPWIl.js +42 -0
  5. package/dist/DeleteAccountForm-yrL29VdV.js +200 -0
  6. package/dist/IdentityErrorDetails-CJDjlYx0.js +142 -0
  7. package/dist/ManageAccountsMenuItem-BgTTH5S8.js +29 -0
  8. package/dist/ManageRolesMenuItem-DxMd-3i9.js +29 -0
  9. package/dist/RoleForm-DYxKoGmW.js +202 -0
  10. package/dist/RoleHeader-CoZg-xCl.js +67 -0
  11. package/dist/api/accounts.d.ts +112 -0
  12. package/dist/api/index.d.ts +5 -0
  13. package/dist/api/login.d.ts +26 -0
  14. package/dist/api/permissions.d.ts +13 -0
  15. package/dist/api/roles.d.ts +100 -0
  16. package/dist/api/status.d.ts +6 -0
  17. package/dist/components/CreatedUpdatedBadges.d.ts +10 -0
  18. package/dist/components/IdentityErrorDetails.d.ts +5 -0
  19. package/dist/components/account/AccountHeader.d.ts +5 -0
  20. package/dist/components/account/AccountOverviewCard.d.ts +8 -0
  21. package/dist/components/account/ChangePasswordCard.d.ts +4 -0
  22. package/dist/components/account/CreateAccountCard.d.ts +1 -0
  23. package/dist/components/account/DeleteAccountCard.d.ts +6 -0
  24. package/dist/components/account/ManageAccountCard.d.ts +15 -0
  25. package/dist/components/account/ManageAccountRolesCard.d.ts +5 -0
  26. package/dist/components/account/index.d.ts +7 -0
  27. package/dist/components/index.d.ts +5 -0
  28. package/dist/components/role/CreateRoleCard.d.ts +1 -0
  29. package/dist/components/role/DeleteRoleCard.d.ts +6 -0
  30. package/dist/components/role/ManageRoleCard.d.ts +6 -0
  31. package/dist/components/role/PermissionInput.d.ts +17 -0
  32. package/dist/components/role/RoleHeader.d.ts +5 -0
  33. package/dist/components/role/RoleOverviewCard.d.ts +5 -0
  34. package/dist/components/role/index.d.ts +5 -0
  35. package/dist/constants.d.ts +9 -0
  36. package/dist/createLucideIcon-DJ4QdTU4.js +74 -0
  37. package/dist/declarations.d.ts +10 -0
  38. package/dist/forms/AccountForm.d.ts +22 -0
  39. package/dist/forms/AccountRolesForm.d.ts +11 -0
  40. package/dist/forms/ChangePasswordForm.d.ts +15 -0
  41. package/dist/forms/DeleteAccountForm.d.ts +6 -0
  42. package/dist/forms/DeleteRoleForm.d.ts +6 -0
  43. package/dist/forms/LoginForm.d.ts +1 -0
  44. package/dist/forms/RegisterForm.d.ts +1 -0
  45. package/dist/forms/RoleForm.d.ts +13 -0
  46. package/dist/forms/index.d.ts +8 -0
  47. package/dist/i18n-ZQHvKu9t.js +5 -0
  48. package/dist/index.d.ts +3 -0
  49. package/dist/index.js +267 -0
  50. package/dist/key-CmPc9vYA.js +9 -0
  51. package/dist/login-DP7FSO-S.js +108 -0
  52. package/dist/manage.accounts-D8nzi0BV.js +60 -0
  53. package/dist/manage.accounts._id-CTAIEe0D.js +131 -0
  54. package/dist/manage.accounts.create-CJHdTi4B.js +29 -0
  55. package/dist/manage.roles-B_WYX8EH.js +68 -0
  56. package/dist/manage.roles._id-CRO5xYLO.js +108 -0
  57. package/dist/manage.roles.create-DDNPLNCK.js +29 -0
  58. package/dist/menu/AccountSettingsMenuItem.d.ts +3 -0
  59. package/dist/menu/ManageAccountsMenuItem.d.ts +3 -0
  60. package/dist/menu/ManageRolesMenuItem.d.ts +3 -0
  61. package/dist/module.d.ts +6 -0
  62. package/dist/plus-Bhxt0T43.js +8 -0
  63. package/dist/register-C4hB44_D.js +155 -0
  64. package/dist/routes/login.d.ts +1 -0
  65. package/dist/routes/manage.accounts.$id.d.ts +1 -0
  66. package/dist/routes/manage.accounts.create.d.ts +1 -0
  67. package/dist/routes/manage.accounts.d.ts +1 -0
  68. package/dist/routes/manage.roles.$id.d.ts +1 -0
  69. package/dist/routes/manage.roles.create.d.ts +1 -0
  70. package/dist/routes/manage.roles.d.ts +1 -0
  71. package/dist/routes/register.d.ts +1 -0
  72. package/dist/routes/settings.account.d.ts +1 -0
  73. package/dist/settings.account-DITieOTt.js +25 -0
  74. package/dist/triangle-alert-TOt7wYJV.js +21 -0
  75. package/dist/useCreateUpdateForm-DnWbYIo0.js +18 -0
  76. package/dist/user-BmPfMiSO.js +8 -0
  77. package/dist/utils/i18n.d.ts +2 -0
  78. package/dist/utils/index.d.ts +3 -0
  79. package/dist/utils/useCreateUpdateForm.d.ts +15 -0
  80. package/dist/utils/useValidators.d.ts +7 -0
  81. package/package.json +54 -0
@@ -0,0 +1,202 @@
1
+ import { jsx as i, jsxs as f } from "react/jsx-runtime";
2
+ import { usePermissions as P, readPermissionsQuery as k } from "@tiny-server/core";
3
+ import { InputWrapper as S, Stack as F, TextInput as R, Text as I, Checkbox as x, Textarea as v, ScrollArea as L, Button as T } from "@mantine/core";
4
+ import { Form as h } from "@tiny-server/design";
5
+ import { h as V, g as A, I as M, b as w, a as N } from "./IdentityErrorDetails-CJDjlYx0.js";
6
+ import { useSuspenseQuery as z, useMutation as g } from "@tanstack/react-query";
7
+ import { useDebouncedValue as U } from "@mantine/hooks";
8
+ import { useState as q, useMemo as E } from "react";
9
+ import { c as j } from "./createLucideIcon-DJ4QdTU4.js";
10
+ import { d as D } from "./i18n-ZQHvKu9t.js";
11
+ import { createRoleMutation as B, updateRoleMutation as Q } from "./index.js";
12
+ import { u as _ } from "./useCreateUpdateForm-DnWbYIo0.js";
13
+ const H = [
14
+ [
15
+ "path",
16
+ {
17
+ d: "M10 20a1 1 0 0 0 .553.895l2 1A1 1 0 0 0 14 21v-7a2 2 0 0 1 .517-1.341L21.74 4.67A1 1 0 0 0 21 3H3a1 1 0 0 0-.742 1.67l7.225 7.989A2 2 0 0 1 10 14z",
18
+ key: "sc7q7i"
19
+ }
20
+ ]
21
+ ], O = j("funnel", H), W = D("PermissionInput", {
22
+ en: {
23
+ filterPlaceholder: "Filter...",
24
+ noPermissions: "No permissions found."
25
+ }
26
+ });
27
+ function $({
28
+ disabled: t,
29
+ allPermissions: r,
30
+ permissions: e,
31
+ onPermissionsChange: l,
32
+ ...c
33
+ }) {
34
+ const d = W(), [p, o] = q(""), [n] = U(p, 250), a = E(() => [...r].sort(J).filter((m) => m.name.toLowerCase().includes(n.toLowerCase())), [r, n]);
35
+ return /* @__PURE__ */ i(S, { ...c, children: /* @__PURE__ */ f(F, { mt: "xs", gap: "xs", children: [
36
+ /* @__PURE__ */ i(
37
+ R,
38
+ {
39
+ maw: "20rem",
40
+ size: "sm",
41
+ leftSection: /* @__PURE__ */ i(O, { size: "1em" }),
42
+ placeholder: d("filterPlaceholder"),
43
+ value: p,
44
+ onChange: (m) => o(m.currentTarget.value)
45
+ }
46
+ ),
47
+ a.length === 0 && /* @__PURE__ */ i(I, { c: "dimmed", size: "xs", children: d("noPermissions") }),
48
+ a.map((m) => /* @__PURE__ */ i(
49
+ G,
50
+ {
51
+ allPermissions: r,
52
+ permission: m,
53
+ disabled: t,
54
+ permissions: e,
55
+ onPermissionsChange: l
56
+ },
57
+ m.name
58
+ ))
59
+ ] }) });
60
+ }
61
+ function G({ permission: t, disabled: r, permissions: e, onPermissionsChange: l }) {
62
+ const c = e.includes(t.name), d = t.allParents.some((o) => e.includes(o)), p = (o) => {
63
+ const n = o ? [...e, t.name] : e.filter((a) => a !== t.name);
64
+ l?.(n);
65
+ };
66
+ return /* @__PURE__ */ i(
67
+ x,
68
+ {
69
+ label: t.name,
70
+ checked: c,
71
+ indeterminate: !c && d,
72
+ variant: !c && d ? "outline" : "filled",
73
+ color: !c && d ? "gray" : void 0,
74
+ disabled: r,
75
+ onChange: (o) => p(o.currentTarget.checked)
76
+ }
77
+ );
78
+ }
79
+ function J(t, r) {
80
+ const e = t.name.split("."), l = r.name.split(".");
81
+ return e.length !== l.length ? e.length - l.length : t.name.localeCompare(r.name);
82
+ }
83
+ const K = D("RoleForm", {
84
+ en: {
85
+ name: {
86
+ label: "Role Name",
87
+ placeholder: "my-role",
88
+ description: "The role's unique, technical name."
89
+ },
90
+ description: {
91
+ label: "Description",
92
+ placeholder: "Enter a short description of this role's purpose.",
93
+ description: "A short description of this role's purpose."
94
+ },
95
+ isDefault: {
96
+ label: "Default role",
97
+ description: "Default roles are automatically assigned to newly created accounts."
98
+ },
99
+ permissions: {
100
+ label: "Assigned permissions",
101
+ description: "The permissions assigned to this role."
102
+ },
103
+ submitCreate: "Create role",
104
+ submitUpdate: "Save changes",
105
+ errorCreate: "Role creation failed.",
106
+ errorUpdate: "Role update failed."
107
+ }
108
+ });
109
+ function ce({ role: t, onSuccess: r }) {
110
+ const e = K(), l = P(), {
111
+ data: { data: c }
112
+ } = z(k()), d = g(B()), p = g(Q(t?.name ?? "")), o = t ? p : d, n = t?.isSystemRole || !l.includes("write.role.all"), a = o.isPending, m = V(), b = A(), s = _(
113
+ t,
114
+ () => ({
115
+ initialValues: {
116
+ name: "",
117
+ description: "",
118
+ isDefaultRole: !1,
119
+ permissions: []
120
+ },
121
+ validate: {
122
+ name: m,
123
+ description: b
124
+ }
125
+ }),
126
+ (u) => ({
127
+ initialValues: {
128
+ description: u.description,
129
+ isDefaultRole: u.isDefaultRole,
130
+ permissions: u.permissions
131
+ },
132
+ validate: {
133
+ description: b
134
+ }
135
+ })
136
+ ), y = (u) => {
137
+ o.mutate(u, {
138
+ onSuccess(C) {
139
+ s.resetDirty(), r?.(C.data);
140
+ }
141
+ });
142
+ };
143
+ return /* @__PURE__ */ f(h, { onSubmit: s.onSubmit(y), children: [
144
+ /* @__PURE__ */ f(h.Section, { children: [
145
+ o.error && /* @__PURE__ */ i(h.Alert, { kind: "error", title: e(s.kind === "create" ? "errorCreate" : "errorUpdate"), children: /* @__PURE__ */ i(M, { error: o.error }) }),
146
+ s.kind === "create" && /* @__PURE__ */ i(
147
+ R,
148
+ {
149
+ label: e("name.label"),
150
+ placeholder: e("name.placeholder"),
151
+ description: e("name.description"),
152
+ maxLength: w,
153
+ readOnly: n,
154
+ disabled: a,
155
+ required: !0,
156
+ autoFocus: !0,
157
+ ...s.getInputProps("name")
158
+ }
159
+ ),
160
+ /* @__PURE__ */ i(
161
+ v,
162
+ {
163
+ id: "description",
164
+ label: e("description.label"),
165
+ placeholder: e("description.placeholder"),
166
+ description: e("description.description"),
167
+ maxLength: N,
168
+ readOnly: n,
169
+ disabled: a,
170
+ minRows: 3,
171
+ autosize: !0,
172
+ ...s.getInputProps("description")
173
+ }
174
+ ),
175
+ /* @__PURE__ */ i(
176
+ x,
177
+ {
178
+ id: "isDefault",
179
+ label: e("isDefault.label"),
180
+ description: e("isDefault.description"),
181
+ disabled: n || a,
182
+ ...s.getInputProps("isDefaultRole", { type: "checkbox" })
183
+ }
184
+ ),
185
+ /* @__PURE__ */ i(L, { scrollbars: "x", type: "auto", children: /* @__PURE__ */ i(
186
+ $,
187
+ {
188
+ label: e("permissions.label"),
189
+ description: e("permissions.description"),
190
+ allPermissions: c,
191
+ permissions: s.values.permissions,
192
+ onPermissionsChange: (u) => s.setFieldValue("permissions", u),
193
+ disabled: n || a
194
+ }
195
+ ) })
196
+ ] }),
197
+ !n && /* @__PURE__ */ i(h.Footer, { children: /* @__PURE__ */ i(T, { type: "submit", loading: o.isPending, disabled: o.isPending || !s.isDirty(), children: e(s.kind === "create" ? "submitCreate" : "submitUpdate") }) })
198
+ ] });
199
+ }
200
+ export {
201
+ ce as R
202
+ };
@@ -0,0 +1,67 @@
1
+ import { jsx as e, jsxs as d } from "react/jsx-runtime";
2
+ import { Group as l, Tooltip as i, Badge as s, ThemeIcon as c } from "@mantine/core";
3
+ import { SectionCard as r } from "@tiny-server/design";
4
+ import { c as o } from "./createLucideIcon-DJ4QdTU4.js";
5
+ import { C as m } from "./CreatedUpdatedBadges-C4dgPWIl.js";
6
+ import { d as n } from "./i18n-ZQHvKu9t.js";
7
+ const h = [
8
+ [
9
+ "path",
10
+ {
11
+ d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
12
+ key: "oel41y"
13
+ }
14
+ ],
15
+ ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
16
+ ], y = o("shield-check", h);
17
+ const p = [
18
+ ["path", { d: "m10.929 14.467-.383.924", key: "hdyevy" }],
19
+ ["path", { d: "M10.929 8.923 10.546 8", key: "1nr44d" }],
20
+ ["path", { d: "M13.225 8.923 13.608 8", key: "aewley" }],
21
+ ["path", { d: "m13.607 15.391-.382-.924", key: "m37gf1" }],
22
+ ["path", { d: "m14.849 10.547.923-.383", key: "1d3c4q" }],
23
+ ["path", { d: "m14.849 12.843.923.383", key: "lmvhy3" }],
24
+ [
25
+ "path",
26
+ {
27
+ d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
28
+ key: "oel41y"
29
+ }
30
+ ],
31
+ ["path", { d: "m9.305 10.547-.923-.383", key: "1d13ox" }],
32
+ ["path", { d: "m9.305 12.843-.923.383", key: "7wxwh5" }],
33
+ ["circle", { cx: "12.077", cy: "11.695", r: "3", key: "fse9k8" }]
34
+ ], f = o("shield-cog", p);
35
+ const u = [
36
+ [
37
+ "path",
38
+ {
39
+ d: "M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",
40
+ key: "oel41y"
41
+ }
42
+ ]
43
+ ], k = o("shield", u), C = n("RoleHeader", {
44
+ en: {
45
+ systemTooltip: "System role. These are built-in roles which cannot be modified.",
46
+ default: "Default",
47
+ defaultTooltip: "Default roles are automatically assigned to newly created accounts."
48
+ }
49
+ });
50
+ function b({ role: t }) {
51
+ const a = C();
52
+ return /* @__PURE__ */ e(
53
+ r.Header,
54
+ {
55
+ illustration: /* @__PURE__ */ e(i, { label: a("systemTooltip"), disabled: !t.isSystemRole, children: /* @__PURE__ */ e(c, { size: "xl", radius: "xl", variant: "light", color: t.isSystemRole ? "red" : void 0, children: t.isSystemRole ? /* @__PURE__ */ e(f, { size: "1em" }) : /* @__PURE__ */ e(k, { size: "1em" }) }) }),
56
+ title: t.name,
57
+ titleProps: { size: "md", fw: "semibold" },
58
+ subTitle: /* @__PURE__ */ d(l, { wrap: "wrap", gap: "xs", children: [
59
+ t.isDefaultRole && /* @__PURE__ */ e(i, { label: a("defaultTooltip"), children: /* @__PURE__ */ e(s, { variant: "light", color: "gray", leftSection: /* @__PURE__ */ e(y, { size: "1em" }), children: a("default") }) }),
60
+ /* @__PURE__ */ e(m, { entity: t })
61
+ ] })
62
+ }
63
+ );
64
+ }
65
+ export {
66
+ b as R
67
+ };
@@ -0,0 +1,112 @@
1
+ import { ApiResult, EntityCreate, EntityUpdate, EntityRead, ListApiResult, PaginationApiResult, PaginationOptions, SortOptions } from '@tiny-server/core';
2
+ export type AccountSortBy = 'CreatedOn' | 'UpdatedOn' | 'UserName' | 'Email';
3
+ /**
4
+ * Represents a user account.
5
+ */
6
+ export interface AccountRead extends EntityRead {
7
+ /**
8
+ * The user's account name used for logging in.
9
+ */
10
+ userName: string;
11
+ /**
12
+ * The user's e-mail address.
13
+ */
14
+ email?: string | null;
15
+ }
16
+ /**
17
+ * Represents data for creating a user account.
18
+ */
19
+ export interface AccountCreate extends EntityCreate {
20
+ /**
21
+ * The user's account name used for logging in.
22
+ */
23
+ userName: string;
24
+ /**
25
+ * The user's e-mail address.
26
+ */
27
+ email?: string | null;
28
+ /**
29
+ * The user's password.
30
+ */
31
+ password: string;
32
+ }
33
+ /**
34
+ * Represents data for updating a user account.
35
+ */
36
+ export interface AccountUpdate extends EntityUpdate {
37
+ /**
38
+ * The user's e-mail address.
39
+ */
40
+ email?: string | null;
41
+ /**
42
+ * The user's password.
43
+ */
44
+ password?: string | null;
45
+ }
46
+ /**
47
+ * Represents data for updating an account password.
48
+ */
49
+ export interface PasswordUpdate {
50
+ /**
51
+ * The current password.
52
+ */
53
+ currentPassword?: string | null;
54
+ /**
55
+ * The new password.
56
+ */
57
+ newPassword: string;
58
+ }
59
+ export type ReadAccountOptions = PaginationOptions & SortOptions<AccountSortBy>;
60
+ /** `GET api/v1/accounts` */
61
+ export declare function readAccounts(options?: ReadAccountOptions): Promise<PaginationApiResult<AccountRead>>;
62
+ /** `GET api/v1/accounts/{id}` */
63
+ export declare function readAccount(id: string): Promise<ApiResult<AccountRead>>;
64
+ /** `POST api/v1/accounts` */
65
+ export declare function createAccount(accountCreate: AccountCreate): Promise<ApiResult<AccountRead>>;
66
+ /** `PUT api/v1/accounts/{id}` */
67
+ export declare function updateAccount(id: string, accountUpdate: AccountUpdate): Promise<ApiResult<AccountRead>>;
68
+ /** `DELETE api/v1/accounts/{id}` */
69
+ export declare function deleteAccount(id: string): Promise<null>;
70
+ /** `GET api/v1/accounts/{id}/roles` */
71
+ export declare function readAccountRoles(id: string): Promise<ListApiResult<string>>;
72
+ /** `PUT api/v1/accounts/{id}/roles` */
73
+ export declare function updateAccountRoles(id: string, roleNames: Array<string>): Promise<ListApiResult<string>>;
74
+ /** `PUT api/v1/accounts/{id}/password` */
75
+ export declare function updateAccountPassword(id: string, passwordUpdate: PasswordUpdate): Promise<null>;
76
+ /** {@link readAccounts} */
77
+ export declare function readAccountsQuery(options?: ReadAccountOptions): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<PaginationApiResult<AccountRead>, Error, PaginationApiResult<AccountRead>, readonly ["accounts", ReadAccountOptions | undefined]>, "queryFn"> & {
78
+ queryFn?: import('@tanstack/query-core').QueryFunction<PaginationApiResult<AccountRead>, readonly ["accounts", ReadAccountOptions | undefined], never> | undefined;
79
+ } & {
80
+ queryKey: readonly ["accounts", ReadAccountOptions | undefined] & {
81
+ [dataTagSymbol]: PaginationApiResult<AccountRead>;
82
+ [dataTagErrorSymbol]: Error;
83
+ };
84
+ };
85
+ /** {@link readAccount} */
86
+ export declare function readAccountQuery(id: string): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<ApiResult<AccountRead>, Error, ApiResult<AccountRead>, string[]>, "queryFn"> & {
87
+ queryFn?: import('@tanstack/query-core').QueryFunction<ApiResult<AccountRead>, string[], never> | undefined;
88
+ } & {
89
+ queryKey: string[] & {
90
+ [dataTagSymbol]: ApiResult<AccountRead>;
91
+ [dataTagErrorSymbol]: Error;
92
+ };
93
+ };
94
+ /** {@link readAccountRoles} */
95
+ export declare function readAccountRolesQuery(id: string): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<ListApiResult<string>, Error, ListApiResult<string>, string[]>, "queryFn"> & {
96
+ queryFn?: import('@tanstack/query-core').QueryFunction<ListApiResult<string>, string[], never> | undefined;
97
+ } & {
98
+ queryKey: string[] & {
99
+ [dataTagSymbol]: ListApiResult<string>;
100
+ [dataTagErrorSymbol]: Error;
101
+ };
102
+ };
103
+ /** {@link createAccount} */
104
+ export declare function createAccountMutation(): Omit<import('@tanstack/react-query').UseMutationOptions<ApiResult<AccountRead>, Error, AccountCreate, unknown>, "mutationKey">;
105
+ /** {@link updateAccount} */
106
+ export declare function updateAccountMutation(id: string): Omit<import('@tanstack/react-query').UseMutationOptions<ApiResult<AccountRead>, Error, AccountUpdate, unknown>, "mutationKey">;
107
+ /** {@link deleteAccount} */
108
+ export declare function deleteAccountMutation(): Omit<import('@tanstack/react-query').UseMutationOptions<null, Error, string, unknown>, "mutationKey">;
109
+ /** {@link updateAccountRoles} */
110
+ export declare function updateAccountRolesMutation(id: string): Omit<import('@tanstack/react-query').UseMutationOptions<ListApiResult<string>, Error, string[], unknown>, "mutationKey">;
111
+ /** {@link updateAccountPassword} */
112
+ export declare function updateAccountPasswordMutation(id: string): Omit<import('@tanstack/react-query').UseMutationOptions<null, Error, PasswordUpdate, unknown>, "mutationKey">;
@@ -0,0 +1,5 @@
1
+ export * from './accounts';
2
+ export * from './login';
3
+ export * from './permissions';
4
+ export * from './roles';
5
+ export * from './status';
@@ -0,0 +1,26 @@
1
+ import { ApiResult } from '@tiny-server/core';
2
+ /**
3
+ * Represents a login request.
4
+ */
5
+ export interface LoginCreate {
6
+ /**
7
+ * The user name to login with.
8
+ */
9
+ userName: string;
10
+ /**
11
+ * The password to login with.
12
+ */
13
+ password: string;
14
+ /**
15
+ * Whether to remain logged in across sessions.
16
+ */
17
+ stayLoggedIn: boolean;
18
+ }
19
+ /** `POST api/v1/auth/login` */
20
+ export declare function login(loginCreate: LoginCreate): Promise<ApiResult<null>>;
21
+ /** `POST api/v1/auth/logout` */
22
+ export declare function logout(): Promise<ApiResult<null>>;
23
+ /** {@link login} */
24
+ export declare function loginMutation(): Omit<import('@tanstack/react-query').UseMutationOptions<ApiResult<null>, Error, LoginCreate, unknown>, "mutationKey">;
25
+ /** {@link logout} */
26
+ export declare function logoutMutation(): Omit<import('@tanstack/react-query').UseMutationOptions<ApiResult<null>, Error, void, unknown>, "mutationKey">;
@@ -0,0 +1,13 @@
1
+ declare module '@tiny-server/core' {
2
+ interface PermissionsMap {
3
+ ['read.account.all']: '';
4
+ ['read.account.own']: '';
5
+ ['write.account.all']: '';
6
+ ['write.account.own']: '';
7
+ ['read.account.roles.all']: '';
8
+ ['write.account.roles.all']: '';
9
+ ['read.role.all']: '';
10
+ ['write.role.all']: '';
11
+ }
12
+ }
13
+ export {};
@@ -0,0 +1,100 @@
1
+ import { ApiResult, EntityCreate, EntityRead, EntityUpdate, PaginationApiResult, PaginationOptions, Permission, SortOptions } from '@tiny-server/core';
2
+ export type RoleSortBy = 'CreatedOn' | 'UpdatedOn' | 'Name' | 'IsSystemRole' | 'IsDefaultRole';
3
+ /**
4
+ * Represents a role.
5
+ */
6
+ export interface RoleRead extends EntityRead {
7
+ /**
8
+ * The role's name.
9
+ */
10
+ name: string;
11
+ /**
12
+ * A user provided description of the role.
13
+ */
14
+ description: string;
15
+ /**
16
+ * Whether the role is an immutable, system-created role.
17
+ */
18
+ isSystemRole: boolean;
19
+ /**
20
+ * Whether the role is automatically assigned to newly created accounts.
21
+ */
22
+ isDefaultRole: boolean;
23
+ /**
24
+ * The permissions assigned to the role.
25
+ */
26
+ permissions: Array<Permission>;
27
+ }
28
+ /**
29
+ * Represents data for creating a role.
30
+ */
31
+ export interface RoleCreate extends EntityCreate {
32
+ /**
33
+ * The role's name.
34
+ */
35
+ name: string;
36
+ /**
37
+ * A user provided description of the role.
38
+ */
39
+ description: string;
40
+ /**
41
+ * Whether the role is automatically assigned to newly created accounts.
42
+ */
43
+ isDefaultRole: boolean;
44
+ /**
45
+ * The permissions assigned to the role.
46
+ */
47
+ permissions: Array<Permission>;
48
+ }
49
+ /**
50
+ * Represents data for updating a role.
51
+ */
52
+ export interface RoleUpdate extends EntityUpdate {
53
+ /**
54
+ * A user provided description of the role.
55
+ */
56
+ description: string;
57
+ /**
58
+ * Whether the role is automatically assigned to newly created accounts.
59
+ */
60
+ isDefaultRole: boolean;
61
+ /**
62
+ * The permissions assigned to the role.
63
+ */
64
+ permissions: Array<Permission>;
65
+ }
66
+ export type ReadRoleOptions = PaginationOptions & SortOptions<RoleSortBy>;
67
+ /** `GET api/v1/roles` */
68
+ export declare function readRoles(options?: ReadRoleOptions): Promise<PaginationApiResult<RoleRead>>;
69
+ /** `GET api/v1/roles/{name}` */
70
+ export declare function readRole(name: string): Promise<ApiResult<RoleRead>>;
71
+ /** `POST api/v1/roles` */
72
+ export declare function createRole(roleCreate: RoleCreate): Promise<ApiResult<RoleRead>>;
73
+ /** `PUT api/v1/roles/{name}` */
74
+ export declare function updateRole(name: string, roleUpdate: RoleUpdate): Promise<ApiResult<RoleRead>>;
75
+ /** `DELETE api/v1/roles/{name}` */
76
+ export declare function deleteRole(name: string): Promise<null>;
77
+ /** {@link readRoles} */
78
+ export declare function readRolesQuery(options?: ReadRoleOptions): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<PaginationApiResult<RoleRead>, Error, PaginationApiResult<RoleRead>, (string | ReadRoleOptions | undefined)[]>, "queryFn"> & {
79
+ queryFn?: import('@tanstack/query-core').QueryFunction<PaginationApiResult<RoleRead>, (string | ReadRoleOptions | undefined)[], never> | undefined;
80
+ } & {
81
+ queryKey: (string | ReadRoleOptions | undefined)[] & {
82
+ [dataTagSymbol]: PaginationApiResult<RoleRead>;
83
+ [dataTagErrorSymbol]: Error;
84
+ };
85
+ };
86
+ /** {@link readRole} */
87
+ export declare function readRoleQuery(name: string): import('@tanstack/query-core').OmitKeyof<import('@tanstack/react-query').UseQueryOptions<ApiResult<RoleRead>, Error, ApiResult<RoleRead>, string[]>, "queryFn"> & {
88
+ queryFn?: import('@tanstack/query-core').QueryFunction<ApiResult<RoleRead>, string[], never> | undefined;
89
+ } & {
90
+ queryKey: string[] & {
91
+ [dataTagSymbol]: ApiResult<RoleRead>;
92
+ [dataTagErrorSymbol]: Error;
93
+ };
94
+ };
95
+ /** {@link createRole} */
96
+ export declare function createRoleMutation(): Omit<import('@tanstack/react-query').UseMutationOptions<ApiResult<RoleRead>, Error, RoleCreate, unknown>, "mutationKey">;
97
+ /** {@link updateRole} */
98
+ export declare function updateRoleMutation(name: string): Omit<import('@tanstack/react-query').UseMutationOptions<ApiResult<RoleRead>, Error, RoleUpdate, unknown>, "mutationKey">;
99
+ /** {@link deleteRole} */
100
+ export declare function deleteRoleMutation(): Omit<import('@tanstack/react-query').UseMutationOptions<null, Error, string, unknown>, "mutationKey">;
@@ -0,0 +1,6 @@
1
+ declare module '@tiny-server/core' {
2
+ interface StatusRead {
3
+ selfRegistrationEnabled: boolean;
4
+ }
5
+ }
6
+ export {};
@@ -0,0 +1,10 @@
1
+ import { EntityRead } from '@tiny-server/core';
2
+ export interface CreatedUpdatedBadgesProps {
3
+ entity: EntityRead;
4
+ }
5
+ /**
6
+ * Renders a "Created on" and "Updated on" badge for the given entity.
7
+ * Badges are rendered within a fragement.
8
+ * Layout must be handled by the parent.
9
+ */
10
+ export declare function CreatedUpdatedBadges({ entity }: CreatedUpdatedBadgesProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ export interface IdentityErrorDetailsProps {
2
+ error?: unknown;
3
+ defaultMessage?: string;
4
+ }
5
+ export declare function IdentityErrorDetails({ error, defaultMessage }: IdentityErrorDetailsProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,5 @@
1
+ import { AccountRead } from '../../api';
2
+ export interface AccountHeaderProps {
3
+ account: AccountRead;
4
+ }
5
+ export declare function AccountHeader({ account }: AccountHeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { AccountRead } from '../../api';
2
+ export interface AccountCardProps {
3
+ account: AccountRead;
4
+ }
5
+ /**
6
+ * A card which renders a basic overview of an account.
7
+ */
8
+ export declare const AccountOverviewCard: import('react').ComponentType<AccountCardProps>;
@@ -0,0 +1,4 @@
1
+ export interface ChangePasswordCardProps {
2
+ accountId: string;
3
+ }
4
+ export declare const ChangePasswordCard: import('react').ComponentType<ChangePasswordCardProps>;
@@ -0,0 +1 @@
1
+ export declare const CreateAccountCard: import('react').ComponentType<object>;
@@ -0,0 +1,6 @@
1
+ import { AccountRead } from '../../api';
2
+ export interface DeleteAccountCardProps {
3
+ account: AccountRead;
4
+ onSuccess?(): void;
5
+ }
6
+ export declare const DeleteAccountCard: import('react').ComponentType<DeleteAccountCardProps>;
@@ -0,0 +1,15 @@
1
+ import { AccountRead } from '../../api';
2
+ export interface ManageAccountCardProps {
3
+ account: AccountRead;
4
+ /**
5
+ * Whether the user name field should be hidden.
6
+ * @default false
7
+ */
8
+ hideIdField?: boolean;
9
+ /**
10
+ * Whether the ID field should be hidden.
11
+ * @default false
12
+ */
13
+ hideUserNameField?: boolean;
14
+ }
15
+ export declare const ManageAccountCard: import('react').ComponentType<ManageAccountCardProps>;
@@ -0,0 +1,5 @@
1
+ import { AccountRead } from '../../api';
2
+ export interface ManageAccountRolesCardProps {
3
+ account: AccountRead;
4
+ }
5
+ export declare const ManageAccountRolesCard: import('react').ComponentType<ManageAccountRolesCardProps>;
@@ -0,0 +1,7 @@
1
+ export * from './AccountHeader';
2
+ export * from './AccountOverviewCard';
3
+ export * from './ChangePasswordCard';
4
+ export * from './CreateAccountCard';
5
+ export * from './DeleteAccountCard';
6
+ export * from './ManageAccountCard';
7
+ export * from './ManageAccountRolesCard';
@@ -0,0 +1,5 @@
1
+ export * from './account';
2
+ export * from './role';
3
+ export * from './CreatedUpdatedBadges';
4
+ export * from './IdentityErrorDetails';
5
+ export * from '../forms/LoginForm';
@@ -0,0 +1 @@
1
+ export declare const CreateRoleCard: import('react').ComponentType<object>;
@@ -0,0 +1,6 @@
1
+ import { RoleRead } from '../../api';
2
+ export interface DeleteRoleCardProps {
3
+ role: RoleRead;
4
+ onSuccess?(): void;
5
+ }
6
+ export declare const DeleteRoleCard: import('react').ComponentType<DeleteRoleCardProps>;
@@ -0,0 +1,6 @@
1
+ import { RoleRead } from '../../api';
2
+ interface ManageRoleCardProps {
3
+ role: RoleRead;
4
+ }
5
+ export declare const ManageRoleCard: import('react').ComponentType<ManageRoleCardProps>;
6
+ export {};
@@ -0,0 +1,17 @@
1
+ import { InputWrapperProps } from '@mantine/core';
2
+ import { Permission, PermissionRead } from '@tiny-server/core';
3
+ interface PermissionInputBaseProps {
4
+ disabled?: boolean;
5
+ allPermissions: Array<PermissionRead>;
6
+ permissions: Array<Permission>;
7
+ onPermissionsChange?(value: Array<Permission>): void;
8
+ }
9
+ export interface PermissionInputProps extends PermissionInputBaseProps, Omit<InputWrapperProps, 'children'> {
10
+ }
11
+ /**
12
+ * Component for managing/toggling a set of permissions.
13
+ * Renders all given permissions and shows implicitly toggled permissions based on the
14
+ * permission hierarchy.
15
+ */
16
+ export declare function PermissionInput({ disabled, allPermissions, permissions, onPermissionsChange, ...rest }: PermissionInputProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};