@jini-ai/user-management 0.7.2 → 0.7.3-next.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/CHANGELOG.md +1 -7
- package/README.md +9 -5
- package/dist/admin/adapters/http.js +25 -20
- package/dist/admin/adapters/memory.js +164 -82
- package/dist/admin/auth.module.d.ts +2 -2
- package/dist/admin/auth.module.js +1 -1
- package/dist/admin/conformance/index.js +40 -18
- package/dist/admin/controllers/auth.controller.js +3 -1
- package/dist/admin/controllers/members.controller.js +56 -31
- package/dist/admin/controllers/roles.controller.d.ts +3 -3
- package/dist/admin/controllers/roles.controller.js +188 -122
- package/dist/admin/controllers/users.controller.js +151 -72
- package/dist/admin/members.module.d.ts +2 -2
- package/dist/admin/members.module.js +1 -1
- package/dist/admin/models.d.ts +1 -0
- package/dist/admin/ports.d.ts +3 -0
- package/dist/admin/react/components/DestructiveDialog.d.ts +1 -1
- package/dist/admin/react/components/DestructiveDialog.js +1 -1
- package/dist/admin/react/components/MemberRow.d.ts +3 -1
- package/dist/admin/react/components/MemberRow.js +2 -2
- package/dist/admin/react/components/MembersConfirmation.d.ts +4 -1
- package/dist/admin/react/components/MembersConfirmation.js +2 -2
- package/dist/admin/react/components/PermissionPanel.d.ts +4 -2
- package/dist/admin/react/components/PermissionPanel.js +2 -2
- package/dist/admin/react/components/PolicyRow.d.ts +4 -2
- package/dist/admin/react/components/PolicyRow.js +2 -2
- package/dist/admin/react/components/RoleRow.d.ts +4 -2
- package/dist/admin/react/components/RoleRow.js +2 -2
- package/dist/admin/react/components/UserRow.d.ts +3 -1
- package/dist/admin/react/components/UserRow.js +2 -2
- package/dist/admin/react/components/UsersConfirmation.d.ts +4 -1
- package/dist/admin/react/components/UsersConfirmation.js +2 -2
- package/dist/admin/react/hooks/AuthBinding.hooks.d.ts +1 -1
- package/dist/admin/react/hooks/AuthScope.hooks.d.ts +1 -1
- package/dist/admin/react/hooks/MembersBinding.hooks.d.ts +1 -1
- package/dist/admin/react/hooks/MembersScope.hooks.d.ts +1 -1
- package/dist/admin/react/hooks/PeopleController.hooks.js +6 -4
- package/dist/admin/react/hooks/RolesBinding.hooks.d.ts +1 -1
- package/dist/admin/react/hooks/RolesController.hooks.d.ts +4 -4
- package/dist/admin/react/hooks/RolesController.hooks.js +4 -3
- package/dist/admin/react/hooks/RolesPage.hooks.d.ts +8 -8
- package/dist/admin/react/hooks/RolesScope.hooks.d.ts +1 -1
- package/dist/admin/react/hooks/UsersBinding.hooks.d.ts +1 -1
- package/dist/admin/react/hooks/UsersScope.hooks.d.ts +1 -1
- package/dist/admin/react/index.d.ts +9 -9
- package/dist/admin/react/pages/LoginPage.d.ts +4 -1
- package/dist/admin/react/pages/LoginPage.js +2 -2
- package/dist/admin/react/pages/MembersPage.d.ts +4 -1
- package/dist/admin/react/pages/MembersPage.js +2 -2
- package/dist/admin/react/pages/RolesPage.d.ts +4 -1
- package/dist/admin/react/pages/RolesPage.js +2 -2
- package/dist/admin/react/pages/UsersPage.d.ts +4 -1
- package/dist/admin/react/pages/UsersPage.js +2 -2
- package/dist/admin/react/tabs/AuthTab.d.ts +4 -2
- package/dist/admin/react/tabs/AuthTab.js +2 -2
- package/dist/admin/react/tabs/MembersTab.d.ts +4 -2
- package/dist/admin/react/tabs/MembersTab.js +2 -2
- package/dist/admin/react/tabs/PoliciesTab.d.ts +4 -2
- package/dist/admin/react/tabs/PoliciesTab.js +2 -2
- package/dist/admin/react/tabs/RolesTab.d.ts +4 -2
- package/dist/admin/react/tabs/RolesTab.js +2 -2
- package/dist/admin/react/tabs/UsersTab.d.ts +3 -1
- package/dist/admin/react/tabs/UsersTab.js +2 -2
- package/dist/admin/roles.module.d.ts +2 -2
- package/dist/admin/roles.module.js +1 -1
- package/dist/admin/users.module.d.ts +4 -4
- package/dist/admin/users.module.js +1 -1
- package/dist/react/auth/Login.js +1 -1
- package/dist/react/auth/OwnerRecovery.hooks.d.ts +93 -0
- package/dist/react/auth/OwnerRecovery.hooks.js +105 -0
- package/dist/react/auth/Passkeys.d.ts +8 -3
- package/dist/react/auth/Passkeys.hooks.d.ts +38 -0
- package/dist/react/auth/Passkeys.hooks.js +72 -0
- package/dist/react/auth/Passkeys.js +6 -64
- package/dist/react/auth/TotpSettings.d.ts +5 -2
- package/dist/react/auth/TotpSettings.hooks.d.ts +41 -0
- package/dist/react/auth/TotpSettings.hooks.js +82 -0
- package/dist/react/auth/TotpSettings.js +10 -77
- package/dist/react/auth/hooks/use-login.hooks.d.ts +1 -1
- package/dist/react/auth/hooks/use-login.hooks.js +1 -0
- package/dist/react/errors.d.ts +1 -1
- package/dist/react/errors.js +1 -0
- package/dist/react/index.d.ts +6 -2
- package/dist/react/index.js +3 -1
- package/dist/react/kit.d.ts +91 -0
- package/dist/react/kit.js +63 -0
- package/dist/react/members/Members.d.ts +1 -1
- package/dist/react/members/Members.js +19 -5
- package/dist/react/members/hooks/use-members.hooks.d.ts +1 -1
- package/dist/react/members/hooks/use-members.hooks.js +49 -27
- package/dist/react/members/rules.d.ts +2 -2
- package/dist/react/members/rules.js +1 -0
- package/dist/react/ports.d.ts +2 -0
- package/dist/react/testing.js +47 -22
- package/dist/react/users/ChangeUsernameDialog.d.ts +2 -2
- package/dist/react/users/ChangeUsernameDialog.js +4 -3
- package/dist/react/users/UserRowParts.d.ts +3 -3
- package/dist/react/users/UserRowParts.js +2 -1
- package/dist/react/users/Users.d.ts +3 -3
- package/dist/react/users/Users.js +14 -27
- package/dist/react/users/UsersDialogs.d.ts +7 -0
- package/dist/react/users/UsersDialogs.js +64 -0
- package/dist/react/users/UsersTable.d.ts +118 -0
- package/dist/react/users/UsersTable.js +55 -0
- package/dist/react/users/hooks/use-change-username.hooks.d.ts +1 -1
- package/dist/react/users/hooks/use-change-username.hooks.js +2 -1
- package/dist/react/users/hooks/use-reset-password-fields.hooks.d.ts +8 -0
- package/dist/react/users/hooks/use-reset-password-fields.hooks.js +11 -0
- package/dist/react/users/hooks/use-users-form-state.hooks.d.ts +81 -0
- package/dist/react/users/hooks/use-users-form-state.hooks.js +68 -0
- package/dist/react/users/hooks/use-users-password.hooks.d.ts +24 -0
- package/dist/react/users/hooks/use-users-password.hooks.js +85 -0
- package/dist/react/users/hooks/use-users-roster.hooks.d.ts +42 -0
- package/dist/react/users/hooks/use-users-roster.hooks.js +133 -0
- package/dist/react/users/hooks/use-users-state.hooks.d.ts +102 -0
- package/dist/react/users/hooks/use-users-state.hooks.js +19 -0
- package/dist/react/users/hooks/use-users-status.hooks.d.ts +26 -0
- package/dist/react/users/hooks/use-users-status.hooks.js +97 -0
- package/dist/react/users/hooks/use-users.hooks.d.ts +13 -5
- package/dist/react/users/hooks/use-users.hooks.js +23 -503
- package/dist/react/users/hooks/users-controller.d.ts +14 -0
- package/dist/react/users/hooks/users-controller.js +29 -0
- package/dist/react/users/hooks/users-grant-actions.d.ts +26 -0
- package/dist/react/users/hooks/users-grant-actions.js +124 -0
- package/dist/react/users/rules.d.ts +5 -4
- package/dist/react/users/rules.js +3 -2
- package/dist/server/admin-crud-service.d.ts +2 -2
- package/dist/server/admin-crud-service.js +38 -71
- package/dist/server/agent-tool-input.d.ts +7 -3
- package/dist/server/agent-tool-input.js +47 -14
- package/dist/server/agent-tool-registrations.d.ts +5 -2
- package/dist/server/agent-tool-registrations.js +250 -199
- package/dist/server/agent-tools.d.ts +1 -1
- package/dist/server/auth-service.js +1 -1
- package/dist/server/grant-service.d.ts +8 -0
- package/dist/server/grant-service.js +24 -22
- package/dist/server/index.d.ts +1 -0
- package/dist/server/index.js +1 -0
- package/dist/server/link-policy.d.ts +23 -0
- package/dist/server/link-policy.js +30 -0
- package/dist/server/permission-migrations.d.ts +3 -3
- package/dist/server/repo.memory-transactions.js +24 -20
- package/dist/server/repo.memory.d.ts +21 -33
- package/dist/server/repo.memory.js +13 -34
- package/dist/server/seed.d.ts +3 -3
- package/dist/server/seed.js +10 -10
- package/dist/session-bootstrap/ensure.d.ts +13 -0
- package/dist/session-bootstrap/ensure.js +11 -0
- package/dist/session-bootstrap/index.d.ts +5 -0
- package/dist/session-bootstrap/index.js +4 -0
- package/dist/session-bootstrap/loopback.d.ts +14 -0
- package/dist/session-bootstrap/loopback.js +25 -0
- package/dist/session-bootstrap/read-initial.d.ts +25 -0
- package/dist/session-bootstrap/read-initial.js +27 -0
- package/package.json +20 -24
|
@@ -10,30 +10,58 @@ const initial = {
|
|
|
10
10
|
function snapshotUser(user) {
|
|
11
11
|
return Object.freeze({ ...user, roleIds: Object.freeze([...user.roleIds]), policyIds: Object.freeze([...user.policyIds]) });
|
|
12
12
|
}
|
|
13
|
-
|
|
14
|
-
* all caller-dependent actions closed. Each panel transition invalidates both success and error
|
|
15
|
-
* settlements, including close/reopen of the same row. Password resets do not refresh the table. */
|
|
16
|
-
export function createUsersController({ api, safety }, { permissions = [], openOwnPasswordReset = false, onOwnPasswordResetClosed, } = {}) {
|
|
13
|
+
function createUsersState({ api, safety }, permissions, options) {
|
|
17
14
|
const grants = Object.freeze([...permissions]);
|
|
18
15
|
const store = createControllerStore({ initial });
|
|
19
16
|
const set = (patch) => store.set({ patch });
|
|
20
17
|
const read = store.getSnapshot, call = store.call;
|
|
21
|
-
let listGeneration = 0, panelGeneration = 0, draftGeneration = 0, deepLinkAttempted = false, openedViaDeepLink = false;
|
|
22
|
-
let callerPromise = null;
|
|
23
18
|
const row = (principalId) => read({}).users?.find(u => u.principalId === principalId);
|
|
24
19
|
const report = (error, fallback) => describePeopleError({ error, fallback });
|
|
25
|
-
|
|
20
|
+
const generations = { listGeneration: 0, panelGeneration: 0, draftGeneration: 0, deepLinkAttempted: false, openedViaDeepLink: false };
|
|
21
|
+
const callerPromise = { current: null };
|
|
22
|
+
return { api, safety, grants, store, set, read, call, row, report, generations, callerPromise, ...options };
|
|
23
|
+
}
|
|
24
|
+
function createUserPanelWrites(api, call) {
|
|
25
|
+
/** Per-kind panel writes: the authority checked, the selection that must be present, the call,
|
|
26
|
+
* and the selection cleared on success (email keeps its field, but still notifies). */
|
|
27
|
+
const panelWrites = {
|
|
28
|
+
email: {
|
|
29
|
+
action: 'email', fallback: 'failed to update email', cleared: {}, missing: () => false,
|
|
30
|
+
write: (principalId, s) => api.updateUser({ principalId }, { ...call, email: s.editEmail })
|
|
31
|
+
},
|
|
32
|
+
role: {
|
|
33
|
+
action: 'grants', fallback: 'failed to assign role', cleared: { pendingRoleId: '' }, missing: s => !s.pendingRoleId,
|
|
34
|
+
write: (principalId, s) => api.assignRole({ principalId, roleId: s.pendingRoleId }, call)
|
|
35
|
+
},
|
|
36
|
+
policy: {
|
|
37
|
+
action: 'grants', fallback: 'failed to attach policy', cleared: { pendingPolicyId: '' }, missing: s => !s.pendingPolicyId,
|
|
38
|
+
write: (principalId, s) => api.attachPolicy({ principalId, policyId: s.pendingPolicyId }, call)
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
return panelWrites;
|
|
42
|
+
}
|
|
43
|
+
function createUserAuthority(ctx) {
|
|
44
|
+
const { safety, grants, store, read, row } = ctx;
|
|
45
|
+
return function allowed({ principalId, action }, _optional = {}) {
|
|
26
46
|
const user = row(principalId);
|
|
27
47
|
return store.active({}) && !!user && userActionAllowed({ user, action, permissions: grants, caller: read({}).caller, safety });
|
|
28
|
-
}
|
|
29
|
-
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
function createUserGate(ctx, deps) {
|
|
51
|
+
const { set, read } = ctx;
|
|
52
|
+
const { allowed } = deps;
|
|
53
|
+
return function gate(principalId, action) {
|
|
30
54
|
if (read({}).confirming || !allowed({ principalId, action })) {
|
|
31
55
|
set({ rowError: 'You do not have permission to do that.' });
|
|
32
56
|
return false;
|
|
33
57
|
}
|
|
34
58
|
return true;
|
|
35
|
-
}
|
|
36
|
-
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
function createUserDestructiveRequest(ctx, deps) {
|
|
62
|
+
const { set, read, row } = ctx;
|
|
63
|
+
const { gate } = deps;
|
|
64
|
+
return function requestDestructive({ principalId, kind }, _optional = {}) {
|
|
37
65
|
if (read({}).rowSavingId || !gate(principalId, kind))
|
|
38
66
|
return;
|
|
39
67
|
const user = row(principalId);
|
|
@@ -41,50 +69,65 @@ export function createUsersController({ api, safety }, { permissions = [], openO
|
|
|
41
69
|
pending: Object.freeze({ kind, user: snapshotUser(user) }), rowError: null, passwordError: null,
|
|
42
70
|
newPassword: '', confirmPassword: '', showNewPassword: false, showConfirmPassword: false
|
|
43
71
|
});
|
|
44
|
-
}
|
|
45
|
-
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function createUserDeepLink(ctx, deps) {
|
|
75
|
+
const { read, row, generations, openOwnPasswordReset } = ctx;
|
|
76
|
+
const { allowed, requestDestructive } = deps;
|
|
77
|
+
return function maybeDeepLink() {
|
|
46
78
|
const s = read({});
|
|
47
|
-
if (!openOwnPasswordReset || deepLinkAttempted || !s.users || !s.caller)
|
|
79
|
+
if (!openOwnPasswordReset || generations.deepLinkAttempted || !s.users || !s.caller)
|
|
48
80
|
return;
|
|
49
81
|
const own = row(s.caller.user.id);
|
|
50
82
|
if (!own)
|
|
51
83
|
return;
|
|
52
|
-
deepLinkAttempted = true;
|
|
84
|
+
generations.deepLinkAttempted = true;
|
|
53
85
|
if (allowed({ principalId: own.principalId, action: 'reset' })) {
|
|
54
86
|
requestDestructive({ principalId: own.principalId, kind: 'reset' });
|
|
55
|
-
openedViaDeepLink = true;
|
|
87
|
+
generations.openedViaDeepLink = true;
|
|
56
88
|
}
|
|
57
|
-
}
|
|
58
|
-
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function createUserDialogClose(ctx) {
|
|
92
|
+
const { set, generations, onOwnPasswordResetClosed } = ctx;
|
|
93
|
+
return function close() {
|
|
59
94
|
set({ pending: null, newPassword: '', confirmPassword: '', passwordError: null, showNewPassword: false, showConfirmPassword: false });
|
|
60
|
-
if (openedViaDeepLink) {
|
|
61
|
-
openedViaDeepLink = false;
|
|
95
|
+
if (generations.openedViaDeepLink) {
|
|
96
|
+
generations.openedViaDeepLink = false;
|
|
62
97
|
onOwnPasswordResetClosed?.({});
|
|
63
98
|
}
|
|
64
|
-
}
|
|
65
|
-
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
function createUserLoader(ctx, deps) {
|
|
102
|
+
const { api, store, set, call, report, generations } = ctx;
|
|
103
|
+
const { maybeDeepLink } = deps;
|
|
104
|
+
return async function load(_required, _optional = {}) {
|
|
66
105
|
if (!store.active({}))
|
|
67
106
|
return;
|
|
68
|
-
++listGeneration;
|
|
69
|
-
const generation = listGeneration;
|
|
107
|
+
++generations.listGeneration;
|
|
108
|
+
const generation = generations.listGeneration;
|
|
70
109
|
set({ error: null });
|
|
71
110
|
try {
|
|
72
111
|
const [u, r, p] = await Promise.all([api.listUsers({}, call), api.listRoles({}, call), api.listPolicies({}, call)]);
|
|
73
|
-
if (generation !== listGeneration || !store.active({}))
|
|
112
|
+
if (generation !== generations.listGeneration || !store.active({}))
|
|
74
113
|
return;
|
|
75
114
|
set({ users: Object.freeze(u.users.map(snapshotUser)), roles: Object.freeze(r.roles.map(r => Object.freeze({ ...r }))), policies: Object.freeze(p.policies.map(p => Object.freeze({ ...p }))) });
|
|
76
115
|
maybeDeepLink();
|
|
77
116
|
}
|
|
78
117
|
catch (error) {
|
|
79
|
-
if (generation === listGeneration)
|
|
118
|
+
if (generation === generations.listGeneration)
|
|
80
119
|
set({ error: report(error, 'failed to load users') });
|
|
81
120
|
}
|
|
82
|
-
}
|
|
83
|
-
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
function createUserCallerLoader(ctx, deps) {
|
|
124
|
+
const { api, store, set, call, callerPromise } = ctx;
|
|
125
|
+
const { maybeDeepLink } = deps;
|
|
126
|
+
return async function loadCaller(_required, _optional = {}) {
|
|
84
127
|
if (!store.active({}))
|
|
85
128
|
return;
|
|
86
|
-
if (!callerPromise)
|
|
87
|
-
callerPromise = (async () => {
|
|
129
|
+
if (!callerPromise.current)
|
|
130
|
+
callerPromise.current = (async () => {
|
|
88
131
|
try {
|
|
89
132
|
const caller = await api.me({}, call);
|
|
90
133
|
if (!store.active({}) || !caller.user || typeof caller.user.id !== 'string' || !caller.user.id)
|
|
@@ -98,18 +141,22 @@ export function createUsersController({ api, safety }, { permissions = [], openO
|
|
|
98
141
|
}
|
|
99
142
|
catch { /* Best-effort identity: unknown defaults to no affordance, including delete. */ }
|
|
100
143
|
})();
|
|
101
|
-
await callerPromise;
|
|
102
|
-
}
|
|
103
|
-
|
|
144
|
+
await callerPromise.current;
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function createUserCreator(ctx, deps) {
|
|
148
|
+
const { api, grants, store, set, read, call, report, generations } = ctx;
|
|
149
|
+
const { load } = deps;
|
|
150
|
+
return async function createUser(_required, _optional = {}) {
|
|
104
151
|
const s = read({});
|
|
105
152
|
if (!store.active({}) || s.saving || s.confirming || !hasAdminGrant({ permissions: grants, permission: 'user.manage' }))
|
|
106
153
|
return false;
|
|
107
|
-
const draft = draftGeneration;
|
|
154
|
+
const draft = generations.draftGeneration;
|
|
108
155
|
set({ saving: true, formError: null });
|
|
109
156
|
let created = false;
|
|
110
157
|
try {
|
|
111
158
|
await api.createUser({ username: s.username, password: s.password }, { ...call, ...(s.email ? { email: s.email } : {}) });
|
|
112
|
-
if (draft === draftGeneration)
|
|
159
|
+
if (draft === generations.draftGeneration)
|
|
113
160
|
set({ username: '', email: '', password: '', formOpen: false });
|
|
114
161
|
await load({});
|
|
115
162
|
created = store.active({});
|
|
@@ -121,59 +168,57 @@ export function createUsersController({ api, safety }, { permissions = [], openO
|
|
|
121
168
|
set({ saving: false });
|
|
122
169
|
}
|
|
123
170
|
return created;
|
|
124
|
-
}
|
|
125
|
-
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
function createUserPanelToggle(ctx) {
|
|
174
|
+
const { store, set, read, row, generations } = ctx;
|
|
175
|
+
return function toggleExpanded({ principalId }, _optional = {}) {
|
|
126
176
|
if (!store.active({}) || !row(principalId))
|
|
127
177
|
return;
|
|
128
|
-
++panelGeneration;
|
|
178
|
+
++generations.panelGeneration;
|
|
129
179
|
// A stale grant cannot clear a newer panel's selection or busy flag. Reset on switching.
|
|
130
180
|
set({ expandedId: read({}).expandedId === principalId ? null : principalId, editEmail: row(principalId).email ?? '', pendingRoleId: '', pendingPolicyId: '', grantError: null, grantSaving: false });
|
|
131
|
-
}
|
|
132
|
-
/** Per-kind panel writes: the authority checked, the selection that must be present, the call,
|
|
133
|
-
* and the selection cleared on success (email keeps its field, but still notifies). */
|
|
134
|
-
const panelWrites = {
|
|
135
|
-
email: {
|
|
136
|
-
action: 'email', fallback: 'failed to update email', cleared: {}, missing: () => false,
|
|
137
|
-
write: (principalId, s) => api.updateUser({ principalId }, { ...call, email: s.editEmail })
|
|
138
|
-
},
|
|
139
|
-
role: {
|
|
140
|
-
action: 'grants', fallback: 'failed to assign role', cleared: { pendingRoleId: '' }, missing: s => !s.pendingRoleId,
|
|
141
|
-
write: (principalId, s) => api.assignRole({ principalId, roleId: s.pendingRoleId }, call)
|
|
142
|
-
},
|
|
143
|
-
policy: {
|
|
144
|
-
action: 'grants', fallback: 'failed to attach policy', cleared: { pendingPolicyId: '' }, missing: s => !s.pendingPolicyId,
|
|
145
|
-
write: (principalId, s) => api.attachPolicy({ principalId, policyId: s.pendingPolicyId }, call)
|
|
146
|
-
},
|
|
147
181
|
};
|
|
182
|
+
}
|
|
183
|
+
function createUserPanelGuard(deps) {
|
|
184
|
+
const { gate } = deps;
|
|
148
185
|
/** Busy, expanded-row and authority checks run before the selection check, so only a refusal of authority reports. */
|
|
149
|
-
function panelSavable(s, principalId, panel) {
|
|
186
|
+
return function panelSavable(s, principalId, panel) {
|
|
150
187
|
return !s.grantSaving && s.expandedId === principalId && gate(principalId, panel.action) && !panel.missing(s);
|
|
151
|
-
}
|
|
152
|
-
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function createUserPanelSaver(ctx, deps) {
|
|
191
|
+
const { store, set, read, report, generations } = ctx;
|
|
192
|
+
const { panelSavable, load, panelWrites } = deps;
|
|
193
|
+
return async function savePanel({ principalId, kind }, _optional = {}) {
|
|
153
194
|
const s = read({}), panel = panelWrites[kind];
|
|
154
195
|
if (!panelSavable(s, principalId, panel))
|
|
155
196
|
return false;
|
|
156
|
-
const generation = panelGeneration, draft = draftGeneration;
|
|
197
|
+
const generation = generations.panelGeneration, draft = generations.draftGeneration;
|
|
157
198
|
set({ grantSaving: true, grantError: null });
|
|
158
199
|
let saved = false;
|
|
159
200
|
try {
|
|
160
201
|
await panel.write(principalId, s);
|
|
161
|
-
if (generation === panelGeneration && draft === draftGeneration)
|
|
202
|
+
if (generation === generations.panelGeneration && draft === generations.draftGeneration)
|
|
162
203
|
set(panel.cleared);
|
|
163
204
|
await load({});
|
|
164
205
|
saved = store.active({});
|
|
165
206
|
}
|
|
166
207
|
catch (error) {
|
|
167
|
-
if (generation === panelGeneration)
|
|
208
|
+
if (generation === generations.panelGeneration)
|
|
168
209
|
set({ grantError: report(error, panel.fallback) });
|
|
169
210
|
}
|
|
170
211
|
finally {
|
|
171
|
-
if (generation === panelGeneration)
|
|
212
|
+
if (generation === generations.panelGeneration)
|
|
172
213
|
set({ grantSaving: false });
|
|
173
214
|
}
|
|
174
215
|
return saved;
|
|
175
|
-
}
|
|
176
|
-
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function createUserEnabler(ctx, deps) {
|
|
219
|
+
const { api, store, set, read, call, report } = ctx;
|
|
220
|
+
const { gate, load } = deps;
|
|
221
|
+
return async function enableUser({ principalId }, _optional = {}) {
|
|
177
222
|
if (read({}).rowSavingId || !gate(principalId, 'enable'))
|
|
178
223
|
return false;
|
|
179
224
|
set({ rowSavingId: principalId, rowError: null });
|
|
@@ -191,17 +236,24 @@ export function createUsersController({ api, safety }, { permissions = [], openO
|
|
|
191
236
|
set({ rowSavingId: null });
|
|
192
237
|
}
|
|
193
238
|
return enabled;
|
|
194
|
-
}
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function createUserConfirmationGuard(deps) {
|
|
242
|
+
const { gate } = deps;
|
|
195
243
|
/** The pending target when it may be confirmed now; a reset also needs a matching, non-empty pair. */
|
|
196
|
-
function confirmable(s) {
|
|
244
|
+
return function confirmable(s) {
|
|
197
245
|
const target = s.pending;
|
|
198
246
|
if (!target || s.confirming || s.rowSavingId || !gate(target.user.principalId, target.kind))
|
|
199
247
|
return null;
|
|
200
248
|
if (target.kind === 'reset' && (!s.newPassword || s.newPassword !== s.confirmPassword))
|
|
201
249
|
return null;
|
|
202
250
|
return target;
|
|
203
|
-
}
|
|
204
|
-
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
function createUserDestroyer(ctx, deps) {
|
|
254
|
+
const { api, set, call } = ctx;
|
|
255
|
+
const { load } = deps;
|
|
256
|
+
return async function destroy(target, s) {
|
|
205
257
|
const principalId = target.user.principalId;
|
|
206
258
|
if (target.kind === 'reset') {
|
|
207
259
|
await api.resetUserPassword({ principalId, password: s.newPassword }, call);
|
|
@@ -213,8 +265,12 @@ export function createUsersController({ api, safety }, { permissions = [], openO
|
|
|
213
265
|
else
|
|
214
266
|
await api.deleteUser({ principalId }, call);
|
|
215
267
|
await load({});
|
|
216
|
-
}
|
|
217
|
-
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function createUserDestructiveConfirmation(ctx, deps) {
|
|
271
|
+
const { store, set, read, report } = ctx;
|
|
272
|
+
const { confirmable, destroy, close } = deps;
|
|
273
|
+
return async function confirmDestructive(_required, _optional = {}) {
|
|
218
274
|
const s = read({}), target = confirmable(s);
|
|
219
275
|
if (!target)
|
|
220
276
|
return false;
|
|
@@ -236,16 +292,39 @@ export function createUsersController({ api, safety }, { permissions = [], openO
|
|
|
236
292
|
set({ confirming: false });
|
|
237
293
|
}
|
|
238
294
|
return live;
|
|
239
|
-
}
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
/** Users, roles and policies refresh together. Only the caller read is best-effort: failure keeps
|
|
298
|
+
* all caller-dependent actions closed. Each panel transition invalidates both success and error
|
|
299
|
+
* settlements, including close/reopen of the same row. Password resets do not refresh the table. */
|
|
300
|
+
export function createUsersController({ api, safety }, { permissions = [], openOwnPasswordReset = false, onOwnPasswordResetClosed, } = {}) {
|
|
301
|
+
const ctx = createUsersState({ api, safety }, permissions, { openOwnPasswordReset, onOwnPasswordResetClosed });
|
|
302
|
+
const { store, set, read, generations } = ctx;
|
|
303
|
+
const allowed = createUserAuthority(ctx);
|
|
304
|
+
const gate = createUserGate(ctx, { allowed });
|
|
305
|
+
const requestDestructive = createUserDestructiveRequest(ctx, { gate });
|
|
306
|
+
const maybeDeepLink = createUserDeepLink(ctx, { allowed, requestDestructive });
|
|
307
|
+
const close = createUserDialogClose(ctx);
|
|
308
|
+
const load = createUserLoader(ctx, { maybeDeepLink });
|
|
309
|
+
const loadCaller = createUserCallerLoader(ctx, { maybeDeepLink });
|
|
310
|
+
const createUser = createUserCreator(ctx, { load });
|
|
311
|
+
const toggleExpanded = createUserPanelToggle(ctx);
|
|
312
|
+
const panelWrites = createUserPanelWrites(api, ctx.call);
|
|
313
|
+
const panelSavable = createUserPanelGuard({ gate });
|
|
314
|
+
const savePanel = createUserPanelSaver(ctx, { panelSavable, load, panelWrites });
|
|
315
|
+
const enableUser = createUserEnabler(ctx, { gate, load });
|
|
316
|
+
const confirmable = createUserConfirmationGuard({ gate });
|
|
317
|
+
const destroy = createUserDestroyer(ctx, { load });
|
|
318
|
+
const confirmDestructive = createUserDestructiveConfirmation(ctx, { confirmable, destroy, close });
|
|
240
319
|
return {
|
|
241
320
|
getSnapshot: store.getSnapshot, subscribe: store.subscribe, allowed,
|
|
242
321
|
load, loadCaller, createUser, toggleExpanded, savePanel, enableUser, requestDestructive, confirmDestructive,
|
|
243
322
|
cancelDestructive(_required, _optional = {}) { if (!read({}).confirming)
|
|
244
323
|
close(); },
|
|
245
324
|
setFormOpen({ open }, _optional = {}) { set({ formOpen: open }); },
|
|
246
|
-
setDraft({ patch }, _optional = {}) { ++draftGeneration; set(patch); },
|
|
325
|
+
setDraft({ patch }, _optional = {}) { ++generations.draftGeneration; set(patch); },
|
|
247
326
|
togglePasswordVisible({ field }, _optional = {}) { set(field === 'new' ? { showNewPassword: !read({}).showNewPassword } : { showConfirmPassword: !read({}).showConfirmPassword }); },
|
|
248
|
-
dispose(_required = {}, _optional = {}) { set({ password: '', newPassword: '', confirmPassword: '', pending: null }); store.dispose({}); ++listGeneration; ++panelGeneration; },
|
|
327
|
+
dispose(_required = {}, _optional = {}) { set({ password: '', newPassword: '', confirmPassword: '', pending: null }); store.dispose({}); ++generations.listGeneration; ++generations.panelGeneration; },
|
|
249
328
|
};
|
|
250
329
|
}
|
|
251
330
|
//# sourceMappingURL=users.controller.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { MembersApiPort } from './ports.js';
|
|
2
|
-
export declare const membersApiToken: import("@jini-ai/
|
|
2
|
+
export declare const membersApiToken: import("@jini-ai/core/contracts/admin-module").AdminPortToken<MembersApiPort, "jini.identity.membersApi">;
|
|
3
3
|
/** Reads remain server-authorized; grants gate mutation affordances, denied by default.
|
|
4
4
|
* Login is mounted by the signed-out host, before the authenticated shell. */
|
|
5
5
|
export declare const membersModule: {
|
|
6
6
|
readonly id: "members";
|
|
7
7
|
readonly requires: {
|
|
8
|
-
readonly membersApi: import("@jini-ai/
|
|
8
|
+
readonly membersApi: import("@jini-ai/core/contracts/admin-module").AdminPortToken<MembersApiPort, "jini.identity.membersApi">;
|
|
9
9
|
};
|
|
10
10
|
readonly provides: {};
|
|
11
11
|
readonly messages: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { adminPort, defineAdminModule } from '@jini-ai/
|
|
1
|
+
import { adminPort, defineAdminModule } from '@jini-ai/core/contracts/admin-module';
|
|
2
2
|
import { membersMessagesEn } from './messages.en.js';
|
|
3
3
|
export const membersApiToken = adminPort({ id: 'jini.identity.membersApi' });
|
|
4
4
|
/** Reads remain server-authorized; grants gate mutation affordances, denied by default.
|
package/dist/admin/models.d.ts
CHANGED
|
@@ -116,6 +116,7 @@ export interface MemberRowState {
|
|
|
116
116
|
export interface MembersState {
|
|
117
117
|
readonly members: readonly AdminMember[] | null;
|
|
118
118
|
readonly error: string | null;
|
|
119
|
+
readonly nextCursor: string | null;
|
|
119
120
|
readonly rows: Readonly<Record<string, MemberRowState>>;
|
|
120
121
|
readonly expandedId: string | null;
|
|
121
122
|
readonly detailById: Readonly<Record<string, AdminMember>>;
|
package/dist/admin/ports.d.ts
CHANGED
|
@@ -140,11 +140,14 @@ export interface UsersSafetyPort {
|
|
|
140
140
|
readonly seededOwnerPrincipalId: string | null;
|
|
141
141
|
}
|
|
142
142
|
export interface MembersApiPort {
|
|
143
|
+
/** Lists members in ID order. Pass nextCursor to continue, or afterId for the legacy form. */
|
|
143
144
|
listMembers(required: Record<string, never>, optional?: RolesCallOptions & {
|
|
144
145
|
afterId?: string;
|
|
145
146
|
limit?: number;
|
|
147
|
+
cursor?: string | null;
|
|
146
148
|
}): Promise<{
|
|
147
149
|
members: AdminMember[];
|
|
150
|
+
nextCursor: string | null;
|
|
148
151
|
}>;
|
|
149
152
|
getMember(required: {
|
|
150
153
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ConfirmDialogProps } from '@jini-ai/ui-kit/react';
|
|
2
2
|
/** Kept mounted on the shell: closing a row menu must not discard its pending confirmation.
|
|
3
3
|
* Both the frame and its controls are host-overridable through ui-kit. */
|
|
4
|
-
export declare function DestructiveDialog(props: ConfirmDialogProps
|
|
4
|
+
export declare function DestructiveDialog(props: ConfirmDialogProps): import("react").JSX.Element;
|
|
5
5
|
//# sourceMappingURL=DestructiveDialog.d.ts.map
|
|
@@ -2,5 +2,5 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { ConfirmDialog } from '@jini-ai/ui-kit/react';
|
|
3
3
|
/** Kept mounted on the shell: closing a row menu must not discard its pending confirmation.
|
|
4
4
|
* Both the frame and its controls are host-overridable through ui-kit. */
|
|
5
|
-
export function DestructiveDialog(props
|
|
5
|
+
export function DestructiveDialog(props) { return _jsx(ConfirmDialog, { ...props }); }
|
|
6
6
|
//# sourceMappingURL=DestructiveDialog.js.map
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AdminMember } from '../../models.js';
|
|
2
|
-
|
|
2
|
+
import { useMemberRow as useMemberRow_ } from '../hooks/MembersPage.hooks.js';
|
|
3
|
+
export declare function MemberRow({ member, useMemberRow }: {
|
|
3
4
|
member: AdminMember;
|
|
5
|
+
useMemberRow?: typeof useMemberRow_;
|
|
4
6
|
}): import("react").JSX.Element;
|
|
5
7
|
//# sourceMappingURL=MemberRow.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Badge, Button, Menu, Notice, Spinner } from '@jini-ai/ui-kit/react';
|
|
3
|
-
import { useMemberRow } from '../hooks/MembersPage.hooks.js';
|
|
3
|
+
import { useMemberRow as useMemberRow_ } from '../hooks/MembersPage.hooks.js';
|
|
4
4
|
/** The expanded detail cell: loading wins over an error, and an error over the loaded record. */
|
|
5
5
|
function MemberDetail({ v }) {
|
|
6
6
|
if (v.loading)
|
|
@@ -11,7 +11,7 @@ function MemberDetail({ v }) {
|
|
|
11
11
|
return null;
|
|
12
12
|
return _jsxs("dl", { children: [_jsx("dt", { children: "ID" }), _jsx("dd", { children: v.detail.id }), _jsx("dt", { children: "Email verified" }), _jsx("dd", { children: v.verified }), _jsx("dt", { children: "Updated" }), _jsx("dd", { children: v.detail.updatedAt }), _jsx("dt", { children: "Version" }), _jsx("dd", { children: v.detail.version })] });
|
|
13
13
|
}
|
|
14
|
-
export function MemberRow({ member }) {
|
|
14
|
+
export function MemberRow({ member, useMemberRow = useMemberRow_ }) {
|
|
15
15
|
const v = useMemberRow({ member });
|
|
16
16
|
return _jsxs(_Fragment, { children: [_jsxs("tr", { children: [_jsx("td", { children: _jsx(Button, { onPress: v.toggle, attrs: { 'aria-expanded': v.expanded }, children: member.email }) }), _jsx("td", { children: member.name ?? '—' }), _jsx("td", { children: _jsx(Badge, { children: member.status }) }), _jsx("td", { children: v.created }), _jsxs("td", { children: [v.items.length ? _jsx(Menu, { label: v.menuLabel, items: v.items }) : null, v.rs.error ? _jsx(Notice, { tone: "danger", children: v.rs.error }) : null, v.rs.notice ? _jsx(Notice, { children: v.rs.notice }) : null] })] }), v.expanded ? _jsx("tr", { children: _jsx("td", { colSpan: 5, children: _jsx(MemberDetail, { v: v }) }) }) : null] });
|
|
17
17
|
}
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { useMembersConfirmation as useMembersConfirmation_ } from '../hooks/MembersPage.hooks.js';
|
|
2
|
+
export declare function MembersConfirmation({ useMembersConfirmation }?: {
|
|
3
|
+
useMembersConfirmation?: typeof useMembersConfirmation_;
|
|
4
|
+
}): import("react").JSX.Element;
|
|
2
5
|
//# sourceMappingURL=MembersConfirmation.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { ConfirmDialog } from '@jini-ai/ui-kit/react';
|
|
3
|
-
import { useMembersConfirmation } from '../hooks/MembersPage.hooks.js';
|
|
4
|
-
export function MembersConfirmation(
|
|
3
|
+
import { useMembersConfirmation as useMembersConfirmation_ } from '../hooks/MembersPage.hooks.js';
|
|
4
|
+
export function MembersConfirmation({ useMembersConfirmation = useMembersConfirmation_ } = {}) {
|
|
5
5
|
const props = useMembersConfirmation({});
|
|
6
6
|
return _jsx(ConfirmDialog, { ...props });
|
|
7
7
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PolicyRecord } from '../../models.js';
|
|
2
|
-
|
|
2
|
+
import { usePermissionPanel as usePermissionPanel_ } from '../hooks/PermissionPanel.hooks.js';
|
|
3
|
+
export declare function PermissionPanel({ usePermissionPanel, ...props }: {
|
|
3
4
|
policy: PolicyRecord;
|
|
4
|
-
|
|
5
|
+
usePermissionPanel?: typeof usePermissionPanel_;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
5
7
|
//# sourceMappingURL=PermissionPanel.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, TextField, Spinner } from '@jini-ai/ui-kit/react';
|
|
3
|
-
import { usePermissionPanel } from '../hooks/PermissionPanel.hooks.js';
|
|
4
|
-
export function PermissionPanel(
|
|
3
|
+
import { usePermissionPanel as usePermissionPanel_ } from '../hooks/PermissionPanel.hooks.js';
|
|
4
|
+
export function PermissionPanel({ usePermissionPanel = usePermissionPanel_, ...props }) {
|
|
5
5
|
const v = usePermissionPanel(props);
|
|
6
6
|
const permissions = v.empty ? _jsx("p", { children: "No permissions yet." }) :
|
|
7
7
|
_jsx("ul", { children: v.rows.map(row => _jsxs("li", { children: [_jsx("code", { children: row.permission }), row.resourceType ? _jsxs("span", { children: [" (", row.resourceType, ")"] }) : null, v.editable ? _jsx(Button, { onPress: row.requestRemove, pending: row.pending, attrs: { 'aria-label': row.removeLabel }, children: "Remove" }) : null] }, row.id)) });
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { PolicyRecord } from '../../models.js';
|
|
2
|
-
|
|
2
|
+
import { usePolicyRow as usePolicyRow_ } from '../hooks/PoliciesTab.hooks.js';
|
|
3
|
+
export declare function PolicyRow({ usePolicyRow, ...props }: {
|
|
3
4
|
policy: PolicyRecord;
|
|
4
|
-
|
|
5
|
+
usePolicyRow?: typeof usePolicyRow_;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
5
7
|
//# sourceMappingURL=PolicyRow.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, TextField, Menu, Badge } from '@jini-ai/ui-kit/react';
|
|
3
|
-
import { usePolicyRow } from '../hooks/PoliciesTab.hooks.js';
|
|
3
|
+
import { usePolicyRow as usePolicyRow_ } from '../hooks/PoliciesTab.hooks.js';
|
|
4
4
|
import { PermissionPanel } from './PermissionPanel.js';
|
|
5
|
-
export function PolicyRow(
|
|
5
|
+
export function PolicyRow({ usePolicyRow = usePolicyRow_, ...props }) {
|
|
6
6
|
const v = usePolicyRow(props);
|
|
7
7
|
const editActions = v.editing ? _jsxs(_Fragment, { children: [_jsx(Button, { onPress: v.save, pending: v.pending, disabled: v.saveDisabled, children: "Save" }), _jsx(Button, { onPress: v.cancel, children: "Cancel" })] }) :
|
|
8
8
|
_jsx(Menu, { label: v.menuLabel, items: v.menu });
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { RoleRecord } from '../../models.js';
|
|
2
|
-
|
|
2
|
+
import { useRoleRow as useRoleRow_ } from '../hooks/RolesTab.hooks.js';
|
|
3
|
+
export declare function RoleRow({ useRoleRow, ...props }: {
|
|
3
4
|
role: RoleRecord;
|
|
4
|
-
|
|
5
|
+
useRoleRow?: typeof useRoleRow_;
|
|
6
|
+
}): import("react").JSX.Element;
|
|
5
7
|
//# sourceMappingURL=RoleRow.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button, TextField, Menu, Badge } from '@jini-ai/ui-kit/react';
|
|
3
|
-
import { useRoleRow } from '../hooks/RolesTab.hooks.js';
|
|
4
|
-
export function RoleRow(
|
|
3
|
+
import { useRoleRow as useRoleRow_ } from '../hooks/RolesTab.hooks.js';
|
|
4
|
+
export function RoleRow({ useRoleRow = useRoleRow_, ...props }) {
|
|
5
5
|
const v = useRoleRow(props);
|
|
6
6
|
const editActions = v.editing ? _jsxs(_Fragment, { children: [_jsx(Button, { onPress: v.save, pending: v.pending, disabled: v.saveDisabled, children: "Save" }), _jsx(Button, { onPress: v.cancel, children: "Cancel" })] }) :
|
|
7
7
|
_jsx(Menu, { label: v.menuLabel, items: v.menu });
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { AdminOperator } from '../../models.js';
|
|
2
|
-
|
|
2
|
+
import { useUserRow as useUserRow_ } from '../hooks/UsersTab.hooks.js';
|
|
3
|
+
export declare function UserRow({ user, useUserRow }: {
|
|
3
4
|
user: AdminOperator;
|
|
5
|
+
useUserRow?: typeof useUserRow_;
|
|
4
6
|
}, _optional?: Record<string, never>): import("react").JSX.Element;
|
|
5
7
|
//# sourceMappingURL=UserRow.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Badge, Menu, TextField, Select, Notice } from '@jini-ai/ui-kit/react';
|
|
3
|
-
import { useUserRow } from '../hooks/UsersTab.hooks.js';
|
|
4
|
-
export function UserRow({ user
|
|
3
|
+
import { useUserRow as useUserRow_ } from '../hooks/UsersTab.hooks.js';
|
|
4
|
+
export function UserRow({ user, useUserRow = useUserRow_ }, _optional) {
|
|
5
5
|
const v = useUserRow({ user });
|
|
6
6
|
return _jsxs(_Fragment, { children: [_jsxs("tr", { children: [_jsx("td", { children: v.canExpand ? _jsx(Button, { onPress: v.toggle, attrs: { 'aria-expanded': v.expanded }, children: user.username }) : user.username }), _jsx("td", { children: user.email ?? '—' }), _jsx("td", { children: _jsx(Badge, { children: user.status }) }), _jsx("td", { children: v.roles }), _jsx("td", { children: v.policies }), _jsx("td", { children: v.items.length ? _jsx(Menu, { label: v.menuLabel, items: v.items, disabled: v.s.confirming || v.s.rowSavingId !== null }) : null })] }), v.expanded ? _jsx("tr", { children: _jsxs("td", { colSpan: 6, children: [v.s.grantError ? _jsx(Notice, { tone: "danger", children: v.s.grantError }) : null, v.canEmail ? _jsxs(_Fragment, { children: [_jsx(TextField, { label: "Email", type: "email", value: v.s.editEmail, onValueChange: v.email }), _jsx(Button, { onPress: v.saveEmail, pending: v.s.grantSaving, children: "Save email" })] }) : null, v.canGrants ? _jsxs(_Fragment, { children: [_jsx(Select, { label: "Assign role", value: v.s.pendingRoleId, onValueChange: v.role, options: v.roleOptions }), _jsx(Button, { onPress: v.assignRole, disabled: !v.s.pendingRoleId, pending: v.s.grantSaving, children: "Assign" }), _jsx(Select, { label: "Attach policy", value: v.s.pendingPolicyId, onValueChange: v.policy, options: v.policyOptions }), _jsx(Button, { onPress: v.attachPolicy, disabled: !v.s.pendingPolicyId, pending: v.s.grantSaving, children: "Attach" })] }) : null] }) }) : null] });
|
|
7
7
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { useUsersConfirmation as useUsersConfirmation_ } from '../hooks/UsersTab.hooks.js';
|
|
1
2
|
/** Kept mounted independently of row menus. Confirmation and cancellation share ui-kit's guards. */
|
|
2
|
-
export declare function UsersConfirmation(
|
|
3
|
+
export declare function UsersConfirmation({ useUsersConfirmation }?: {
|
|
4
|
+
useUsersConfirmation?: typeof useUsersConfirmation_;
|
|
5
|
+
}): import("react").JSX.Element;
|
|
3
6
|
//# sourceMappingURL=UsersConfirmation.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { ConfirmDialog, Notice, SecretInput } from '@jini-ai/ui-kit/react';
|
|
3
3
|
import { useId } from 'react';
|
|
4
|
-
import { useUsersConfirmation, newPasswordAttrs } from '../hooks/UsersTab.hooks.js';
|
|
4
|
+
import { useUsersConfirmation as useUsersConfirmation_, newPasswordAttrs } from '../hooks/UsersTab.hooks.js';
|
|
5
5
|
/** Kept mounted independently of row menus. Confirmation and cancellation share ui-kit's guards. */
|
|
6
|
-
export function UsersConfirmation(
|
|
6
|
+
export function UsersConfirmation({ useUsersConfirmation = useUsersConfirmation_ } = {}) {
|
|
7
7
|
const v = useUsersConfirmation({});
|
|
8
8
|
const fieldId = useId();
|
|
9
9
|
return _jsx(ConfirmDialog, { ...v.confirm, body: _jsxs("div", { children: [_jsx("p", { children: v.s.pending?.user.username }), _jsx("p", { children: v.copy.body }), v.reset ? _jsxs(_Fragment, { children: [_jsx("label", { className: "jini-field-label", htmlFor: `${fieldId}-new`, children: "New password" }), _jsx(SecretInput, { id: `${fieldId}-new`, label: "New password", ...newPasswordAttrs, value: v.s.newPassword, onChange: event => v.newPassword({ value: event.target.value }), disabled: v.s.confirming, revealed: v.s.showNewPassword, onRevealedChange: v.toggleNew }), _jsx("label", { className: "jini-field-label", htmlFor: `${fieldId}-confirm`, children: "Confirm new password" }), _jsx(SecretInput, { id: `${fieldId}-confirm`, label: "Confirm new password", ...newPasswordAttrs, value: v.s.confirmPassword, onChange: event => v.confirmPassword({ value: event.target.value }), disabled: v.s.confirming, revealed: v.s.showConfirmPassword, onRevealedChange: v.toggleConfirm }), v.error ? _jsx(Notice, { tone: "danger", children: v.error }) : null] }) : null] }) });
|
|
@@ -2,7 +2,7 @@ import { type AuthScope } from './AuthScope.hooks.js';
|
|
|
2
2
|
export { useAuthScope } from './AuthScope.hooks.js';
|
|
3
3
|
export type { AuthScope, AuthPageProps } from './AuthScope.hooks.js';
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
5
|
-
import type { AdminInstance } from '@jini-ai/
|
|
5
|
+
import type { AdminInstance } from '@jini-ai/core/contracts/admin-module';
|
|
6
6
|
import { authModule } from '../../auth.module.js';
|
|
7
7
|
/** Descriptor identity must be the exact enriched object supplied to createAdmin. */
|
|
8
8
|
export declare function createAuthBinding({ module }: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentType, LazyExoticComponent } from 'react';
|
|
2
|
-
import type { AdminInstance } from '@jini-ai/
|
|
2
|
+
import type { AdminInstance } from '@jini-ai/core/contracts/admin-module';
|
|
3
3
|
import type { AuthApiPort } from '../../ports.js';
|
|
4
4
|
import type { AdminAccount } from '../../models.js';
|
|
5
5
|
export interface AuthScope {
|
|
@@ -2,7 +2,7 @@ import { type MembersScope } from './MembersScope.hooks.js';
|
|
|
2
2
|
export { useMembersScope } from './MembersScope.hooks.js';
|
|
3
3
|
export type { MembersScope, MembersPageProps } from './MembersScope.hooks.js';
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
5
|
-
import type { AdminInstance } from '@jini-ai/
|
|
5
|
+
import type { AdminInstance } from '@jini-ai/core/contracts/admin-module';
|
|
6
6
|
import { membersModule } from '../../members.module.js';
|
|
7
7
|
/** Descriptor identity must be the exact enriched object supplied to createAdmin. */
|
|
8
8
|
export declare function createMembersBinding({ module }: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ComponentType, LazyExoticComponent } from 'react';
|
|
2
|
-
import type { AdminInstance } from '@jini-ai/
|
|
2
|
+
import type { AdminInstance } from '@jini-ai/core/contracts/admin-module';
|
|
3
3
|
import type { MembersApiPort, MembersRefreshPort } from '../../ports.js';
|
|
4
4
|
export interface MembersScope {
|
|
5
5
|
readonly api: MembersApiPort;
|