@field-studio/sdk 0.1.1 → 0.1.2
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/node/identity.d.ts
CHANGED
|
@@ -8,8 +8,7 @@ export interface RoleDefinition {
|
|
|
8
8
|
}
|
|
9
9
|
export interface PublicUser {
|
|
10
10
|
id: string;
|
|
11
|
-
|
|
12
|
-
display_name: string;
|
|
11
|
+
email: string;
|
|
13
12
|
role: string;
|
|
14
13
|
status: string;
|
|
15
14
|
workspace_id: string;
|
|
@@ -58,7 +57,7 @@ export interface IdentityOperations {
|
|
|
58
57
|
result: null;
|
|
59
58
|
};
|
|
60
59
|
update_user: {
|
|
61
|
-
args: [userId: string, changes:
|
|
60
|
+
args: [userId: string, changes: Partial<Pick<PublicUser, "role" | "status">>, actor: string];
|
|
62
61
|
result: PublicUser;
|
|
63
62
|
};
|
|
64
63
|
check_health: {
|
|
@@ -122,7 +122,7 @@ export default function AuthShell({ children, brand = 'Field Studio', tagline =
|
|
|
122
122
|
openUserManagement: () => setView('users'),
|
|
123
123
|
logout,
|
|
124
124
|
};
|
|
125
|
-
return (_jsxs("div", { className: "authenticated-shell", children: [view === 'users' && (_jsxs("header", { className: "account-bar", children: [_jsx("span", { children: _jsx("strong", { children: session.user.
|
|
125
|
+
return (_jsxs("div", { className: "authenticated-shell", children: [view === 'users' && (_jsxs("header", { className: "account-bar", children: [_jsx("span", { children: _jsx("strong", { children: session.user.email }) }), _jsx("nav", { "aria-label": "Account actions", children: _jsx("button", { className: "button small", onClick: () => setView('app'), children: "Back to workspace" }) })] })), error && (_jsx("p", { className: "auth-error", role: "alert", children: error })), view === 'users' ? (_jsx(UserManager, { currentUserId: session.user.id, request: request, roleDataScope: roleDataScope })) : (_jsx(AuthContext.Provider, { value: handle, children: _jsx("div", { className: "private-application", children: children }, epoch) }))] }));
|
|
126
126
|
}
|
|
127
127
|
function Login({ brand, tagline, description, error, onRetry, }) {
|
|
128
128
|
return (_jsx("main", { className: "auth-page", children: _jsxs("section", { className: "auth-panel", children: [_jsxs("a", { className: "auth-brand", href: "/", children: [brand, " ", _jsx("span", { children: tagline })] }), _jsx("h1", { children: "Sign in to the workspace" }), _jsx("p", { className: "auth-description", children: description }), error && _jsx("p", { className: "auth-error", role: "alert", children: error }), _jsx("a", { className: "button primary auth-submit", href: "/auth/login", children: "Sign in with SSO" }), error && (_jsx("div", { className: "auth-links", children: _jsx("button", { type: "button", onClick: () => void onRetry(), children: "Reconnect" }) }))] }) }));
|
|
@@ -186,12 +186,10 @@ function UserManager({ currentUserId, request, roleDataScope, }) {
|
|
|
186
186
|
setBusy(false);
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
|
-
return (_jsxs("main", { className: "auth-settings user-management", children: [_jsx("h1", { children: "User management" }), _jsx("p", { children: "Manage roles and access for provisioned accounts." }), error && (_jsx("p", { className: "auth-error", role: "alert", children: error })), _jsxs("section", { className: "auth-user-section", children: [_jsx("div", { className: "user-list-header", children: _jsxs("h2", { children: ["Accounts", ' ', _jsxs("span", { className: "account-scope", children: [total.toLocaleString(), " users"] })] }) }), loading ? (_jsx("p", { role: "status", children: "Loading users\u2026" })) : !users.length ? (_jsx("p", { children: "No users yet" })) : (_jsx("div", { className: "auth-table-scroll", children: _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "
|
|
189
|
+
return (_jsxs("main", { className: "auth-settings user-management", children: [_jsx("h1", { children: "User management" }), _jsx("p", { children: "Manage roles and access for provisioned accounts." }), error && (_jsx("p", { className: "auth-error", role: "alert", children: error })), _jsxs("section", { className: "auth-user-section", children: [_jsx("div", { className: "user-list-header", children: _jsxs("h2", { children: ["Accounts", ' ', _jsxs("span", { className: "account-scope", children: [total.toLocaleString(), " users"] })] }) }), loading ? (_jsx("p", { role: "status", children: "Loading users\u2026" })) : !users.length ? (_jsx("p", { children: "No users yet" })) : (_jsx("div", { className: "auth-table-scroll", children: _jsxs("table", { children: [_jsx("thead", { children: _jsxs("tr", { children: [_jsx("th", { children: "Email" }), _jsx("th", { children: "Role" }), _jsx("th", { children: "Status" }), _jsx("th", { children: "Actions" })] }) }), _jsx("tbody", { children: users.map((user) => (_jsx(UserRow, { user: user, self: currentUserId === user.id, busy: busy, roles: roles ?? defaultRoles, onEdit: (changes) => action(async () => {
|
|
190
190
|
await request(`/api/admin/users/${user.id}`, 'PATCH', changes);
|
|
191
191
|
}) }, user.id))) })] }) })), _jsxs("div", { className: "user-pagination", children: [_jsx("button", { className: "button small", disabled: !page || busy, onClick: () => setPage((p) => p - 1), children: "Previous page" }), _jsxs("span", { children: ["Page ", page + 1] }), _jsx("button", { className: "button small", disabled: (page + 1) * 50 >= total || busy, onClick: () => setPage((p) => p + 1), children: "Next page" })] })] }), roles && _jsx(RoleManager, { roles: roles, reload: reloadRoles, request: request, dataScope: roleDataScope })] }));
|
|
192
192
|
}
|
|
193
193
|
function UserRow({ user, self, busy, roles, onEdit, }) {
|
|
194
|
-
|
|
195
|
-
useEffect(() => setName(user.display_name), [user.display_name]);
|
|
196
|
-
return (_jsxs("tr", { children: [_jsxs("td", { children: [user.username, self && ' (you)'] }), _jsx("td", { children: _jsxs("div", { className: "user-name-editor", children: [_jsx("input", { "aria-label": `${user.username}'s name`, value: name, onChange: (e) => setName(e.target.value) }), _jsx("button", { className: "button small", disabled: busy || !name.trim() || name === user.display_name, onClick: () => void onEdit({ display_name: name }), children: "Save name" })] }) }), _jsx("td", { children: _jsx(Select, { "aria-label": `${user.username}'s role`, disabled: busy || (user.role === 'admin' && !self), value: user.role, onChange: (e) => void onEdit({ role: e.target.value }), children: roles.map((role) => _jsx("option", { value: role.id, children: role.name }, role.id)) }) }), _jsx("td", { children: user.status === 'active' ? 'Enabled' : 'Disabled' }), _jsx("td", { children: _jsx("div", { className: "action-row user-actions", children: _jsx("button", { className: "button small", disabled: busy, onClick: () => void onEdit({ status: user.status === 'active' ? 'disabled' : 'active' }), children: user.status === 'active' ? 'Disable' : 'Enable' }) }) })] }));
|
|
194
|
+
return (_jsxs("tr", { children: [_jsxs("td", { children: [user.email, self && ' (you)'] }), _jsx("td", { children: _jsx(Select, { "aria-label": `${user.email}'s role`, disabled: busy || (user.role === 'admin' && !self), value: user.role, onChange: (e) => void onEdit({ role: e.target.value }), children: roles.map((role) => _jsx("option", { value: role.id, children: role.name }, role.id)) }) }), _jsx("td", { children: user.status === 'active' ? 'Enabled' : 'Disabled' }), _jsx("td", { children: _jsx("div", { className: "action-row user-actions", children: _jsx("button", { className: "button small", disabled: busy, onClick: () => void onEdit({ status: user.status === 'active' ? 'disabled' : 'active' }), children: user.status === 'active' ? 'Disable' : 'Enable' }) }) })] }));
|
|
197
195
|
}
|
package/dist/react/auth/auth.css
CHANGED
|
@@ -36,9 +36,6 @@
|
|
|
36
36
|
sidebar spans the full viewport instead of reserving a 46px bar. */
|
|
37
37
|
.private-application .sidebar { position: sticky; top: 0; height: 100dvh; grid-row: 1; }
|
|
38
38
|
|
|
39
|
-
.user-name-editor { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
|
|
40
|
-
.user-name-editor input { flex: 1 1 130px; }
|
|
41
|
-
.auth-settings .user-name-editor input { margin: 0; }
|
|
42
39
|
.user-actions { min-width: 168px; white-space: normal; }
|
|
43
40
|
.auth-settings .ui-select { width: 100%; min-width: 120px; }
|
|
44
41
|
.auth-settings .ui-select-trigger { min-height: 38px; }
|