@coffre/ui 0.14.4 → 0.15.0
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/chunks/{audit-sentence-JgJEwQEC.js → actions-log-DupYCEyV.js} +186 -21
- package/dist/chunks/actions-log-DupYCEyV.js.map +1 -0
- package/dist/chunks/{connected-apps-IJdunsu8.js → connected-apps-CGUQlFMx.js} +5 -5
- package/dist/chunks/{connected-apps-IJdunsu8.js.map → connected-apps-CGUQlFMx.js.map} +1 -1
- package/dist/chunks/{delete-place-dIVoK87I.js → delete-place-CswZ-meh.js} +5 -5
- package/dist/chunks/{delete-place-dIVoK87I.js.map → delete-place-CswZ-meh.js.map} +1 -1
- package/dist/chunks/{directory-BM8yoiJN.js → directory-DrswWQLT.js} +15 -15
- package/dist/chunks/directory-DrswWQLT.js.map +1 -0
- package/dist/chunks/environment-actions-8rL9Cw6X.js +576 -0
- package/dist/chunks/environment-actions-8rL9Cw6X.js.map +1 -0
- package/dist/chunks/{folders-D3A1NGpt.js → folders-A6sbR_PG.js} +3 -3
- package/dist/chunks/{folders-D3A1NGpt.js.map → folders-A6sbR_PG.js.map} +1 -1
- package/dist/chunks/{grants-CjVmOgb2.js → grants-C0cb2oii.js} +8 -8
- package/dist/chunks/grants-C0cb2oii.js.map +1 -0
- package/dist/chunks/{multi-combobox-B0JzP1QN.js → multi-combobox-B3SEv1gq.js} +3 -3
- package/dist/chunks/{multi-combobox-B0JzP1QN.js.map → multi-combobox-B3SEv1gq.js.map} +1 -1
- package/dist/chunks/{offboarding-DbozhPym.js → offboarding-C1jbG_dk.js} +72 -67
- package/dist/chunks/offboarding-C1jbG_dk.js.map +1 -0
- package/dist/chunks/{page-JTORvh-N.js → page-CfhC9Hp1.js} +11 -6
- package/dist/chunks/page-CfhC9Hp1.js.map +1 -0
- package/dist/chunks/{personal-tokens-zWZOzLIC.js → personal-tokens-xC9wulhg.js} +5 -5
- package/dist/chunks/{personal-tokens-zWZOzLIC.js.map → personal-tokens-xC9wulhg.js.map} +1 -1
- package/dist/chunks/{principal-DFBswTBr.js → principal-CI17XK13.js} +2 -2
- package/dist/chunks/{principal-DFBswTBr.js.map → principal-CI17XK13.js.map} +1 -1
- package/dist/chunks/{principal-page-jJ0RVFg8.js → principal-page-CdSeftGD.js} +17 -127
- package/dist/chunks/principal-page-CdSeftGD.js.map +1 -0
- package/dist/chunks/{project-page-BjwEoXfU.js → project-page-CHxjBE97.js} +3 -3
- package/dist/chunks/{project-page-BjwEoXfU.js.map → project-page-CHxjBE97.js.map} +1 -1
- package/dist/chunks/{queries-2jdgTwfZ.js → queries-D1JuimTu.js} +82 -26
- package/dist/chunks/queries-D1JuimTu.js.map +1 -0
- package/dist/chunks/{references-CRT2BsOS.js → references-D5llUGQL.js} +5 -5
- package/dist/chunks/{references-CRT2BsOS.js.map → references-D5llUGQL.js.map} +1 -1
- package/dist/chunks/{role-field-DswIpPqY.js → role-field-CoCv8wse.js} +5 -5
- package/dist/chunks/role-field-CoCv8wse.js.map +1 -0
- package/dist/chunks/{row-state-xtRGFnDc.js → row-state-CYH7kZHl.js} +3 -3
- package/dist/chunks/{row-state-xtRGFnDc.js.map → row-state-CYH7kZHl.js.map} +1 -1
- package/dist/chunks/{theme-Ck45wzWB.js → theme-rF44Wbmm.js} +3 -3
- package/dist/chunks/{theme-Ck45wzWB.js.map → theme-rF44Wbmm.js.map} +1 -1
- package/dist/chunks/{ui-D-blFWfx.js → ui-CGdORVzW.js} +2 -2
- package/dist/chunks/{ui-D-blFWfx.js.map → ui-CGdORVzW.js.map} +1 -1
- package/dist/chunks/{use-action-CXEFFjx5.js → use-action-BxrHTBZw.js} +3 -3
- package/dist/chunks/{use-action-CXEFFjx5.js.map → use-action-BxrHTBZw.js.map} +1 -1
- package/dist/chunks/{use-change-BC4xo02c.js → use-change-BorW2R6C.js} +4 -4
- package/dist/chunks/{use-change-BC4xo02c.js.map → use-change-BorW2R6C.js.map} +1 -1
- package/dist/chunks/{use-roles-DswiNxBk.js → use-roles-BZnJ9Cq0.js} +56 -13
- package/dist/chunks/use-roles-BZnJ9Cq0.js.map +1 -0
- package/dist/chunks/{use-shell-zpjE_MKh.js → use-shell-CPskgi1k.js} +3 -3
- package/dist/chunks/{use-shell-zpjE_MKh.js.map → use-shell-CPskgi1k.js.map} +1 -1
- package/dist/index.d.ts +46 -2
- package/dist/index.js +30 -11
- package/dist/index.js.map +1 -1
- package/dist/pages/account.js +11 -11
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/approval.js +2 -2
- package/dist/pages/audit.js +55 -21
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +2 -2
- package/dist/pages/environment.js +228 -389
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +3 -3
- package/dist/pages/oauth-authorize.js +2 -2
- package/dist/pages/project-access.js +11 -11
- package/dist/pages/project-environments.js +28 -359
- package/dist/pages/project-environments.js.map +1 -1
- package/dist/pages/project-settings.js +8 -8
- package/dist/pages/project.js +3 -3
- package/dist/pages/projects.js +8 -8
- package/dist/pages/service-account.js +11 -10
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +7 -6
- package/dist/pages/service-accounts.js.map +1 -1
- package/dist/pages/settings.d.ts +6 -1
- package/dist/pages/settings.js +284 -164
- package/dist/pages/settings.js.map +1 -1
- package/dist/pages/unregistered.js +2 -2
- package/dist/pages/user.js +7 -6
- package/dist/pages/user.js.map +1 -1
- package/dist/pages/users.js +7 -6
- package/dist/pages/users.js.map +1 -1
- package/package.json +3 -3
- package/src/components/actions-log.tsx +61 -8
- package/src/components/directory.tsx +5 -5
- package/src/components/environment-actions.tsx +508 -0
- package/src/components/grants.tsx +2 -2
- package/src/components/icons.tsx +2 -0
- package/src/components/offboarding.tsx +7 -0
- package/src/components/page.tsx +3 -2
- package/src/components/principal-page.tsx +1 -1
- package/src/components/protected.tsx +52 -39
- package/src/components/role-editor.tsx +99 -68
- package/src/components/role-field.tsx +1 -1
- package/src/lib/audit-sentences.ts +24 -19
- package/src/lib/queries.ts +85 -21
- package/src/lib/roles.ts +36 -10
- package/src/options.ts +19 -3
- package/src/pages/account.tsx +1 -1
- package/src/pages/audit.tsx +56 -16
- package/src/pages/environment.tsx +227 -352
- package/src/pages/project-environments.tsx +20 -322
- package/src/pages/service-accounts.tsx +1 -1
- package/src/pages/settings.tsx +129 -48
- package/src/pages/users.tsx +1 -1
- package/src/parity.ts +18 -11
- package/src/styles/globals.css +271 -89
- package/dist/chunks/audit-sentence-JgJEwQEC.js.map +0 -1
- package/dist/chunks/directory-BM8yoiJN.js.map +0 -1
- package/dist/chunks/grants-CjVmOgb2.js.map +0 -1
- package/dist/chunks/offboarding-DbozhPym.js.map +0 -1
- package/dist/chunks/page-JTORvh-N.js.map +0 -1
- package/dist/chunks/principal-page-jJ0RVFg8.js.map +0 -1
- package/dist/chunks/protected-y7KVhtHd.js +0 -77
- package/dist/chunks/protected-y7KVhtHd.js.map +0 -1
- package/dist/chunks/queries-2jdgTwfZ.js.map +0 -1
- package/dist/chunks/role-field-DswIpPqY.js.map +0 -1
- package/dist/chunks/use-roles-DswiNxBk.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { x as queries } from "./queries-
|
|
2
|
-
import { u as useCoffre } from "./page-
|
|
1
|
+
import { x as queries } from "./queries-D1JuimTu.js";
|
|
2
|
+
import { u as useCoffre } from "./page-CfhC9Hp1.js";
|
|
3
3
|
import { FIXED_ROLES, INSTANCE_ROLES, PERMISSIONS, PROJECT_ONLY_PERMISSIONS, ROLES, assignableToEnvironment } from "@coffre/core/access";
|
|
4
4
|
import { useQuery } from "@tanstack/react-query";
|
|
5
5
|
//#region src/lib/roles.ts
|
|
@@ -9,40 +9,48 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
9
9
|
* holds of it in a protected one. The policy is the vault's, read from
|
|
10
10
|
* `GET /api/roles`; until it is, the roles as they ship stand in.
|
|
11
11
|
*/
|
|
12
|
-
/** Every permission in words, in the catalogue's order,
|
|
12
|
+
/** Every permission in words, in the catalogue's order, what a short label leaves out, and its word on a role's card, under its row's. */
|
|
13
13
|
var PERMISSION_WORDS = {
|
|
14
14
|
"secret.read": {
|
|
15
15
|
label: "Read values",
|
|
16
|
-
verb: "read values"
|
|
16
|
+
verb: "read values",
|
|
17
|
+
short: "Read"
|
|
17
18
|
},
|
|
18
19
|
"secret.use": {
|
|
19
20
|
label: "Use values",
|
|
20
21
|
note: "placeholders, the proxy",
|
|
21
|
-
verb: "use values"
|
|
22
|
+
verb: "use values",
|
|
23
|
+
short: "Use"
|
|
22
24
|
},
|
|
23
25
|
"secret.write": {
|
|
24
26
|
label: "Write values",
|
|
25
|
-
verb: "write values"
|
|
27
|
+
verb: "write values",
|
|
28
|
+
short: "Write"
|
|
26
29
|
},
|
|
27
30
|
"secret.archive": {
|
|
28
31
|
label: "Retire values",
|
|
29
|
-
verb: "retire values"
|
|
32
|
+
verb: "retire values",
|
|
33
|
+
short: "Retire"
|
|
30
34
|
},
|
|
31
35
|
"audit.read": {
|
|
32
36
|
label: "Read the log",
|
|
33
|
-
verb: "read the log"
|
|
37
|
+
verb: "read the log",
|
|
38
|
+
short: "Read"
|
|
34
39
|
},
|
|
35
40
|
"environment.manage": {
|
|
36
41
|
label: "Manage environments",
|
|
37
|
-
verb: "manage environments"
|
|
42
|
+
verb: "manage environments",
|
|
43
|
+
short: "Environments"
|
|
38
44
|
},
|
|
39
45
|
"grant.manage": {
|
|
40
46
|
label: "Manage access",
|
|
41
|
-
verb: "manage access"
|
|
47
|
+
verb: "manage access",
|
|
48
|
+
short: "Access"
|
|
42
49
|
},
|
|
43
50
|
"project.manage": {
|
|
44
51
|
label: "Manage the project",
|
|
45
|
-
verb: "manage the project"
|
|
52
|
+
verb: "manage the project",
|
|
53
|
+
short: "Project"
|
|
46
54
|
}
|
|
47
55
|
};
|
|
48
56
|
/** The rows of a role's grid: secrets first, as a role is read, then the log, then what only a project holds. */
|
|
@@ -60,6 +68,41 @@ function projectWide(permission) {
|
|
|
60
68
|
return PROJECT_ONLY_PERMISSIONS.includes(permission);
|
|
61
69
|
}
|
|
62
70
|
/**
|
|
71
|
+
* A role card's rows, the grid's permissions in its order, each on every
|
|
72
|
+
* card, so that a permission sits in the same place on all of them:
|
|
73
|
+
*
|
|
74
|
+
* Values Read Use Write Retire
|
|
75
|
+
* Log Read
|
|
76
|
+
* Manage Environments Access Project
|
|
77
|
+
*/
|
|
78
|
+
var CARD_ROWS = [
|
|
79
|
+
{
|
|
80
|
+
name: "Values",
|
|
81
|
+
permissions: [
|
|
82
|
+
"secret.read",
|
|
83
|
+
"secret.use",
|
|
84
|
+
"secret.write",
|
|
85
|
+
"secret.archive"
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: "Log",
|
|
90
|
+
permissions: ["audit.read"]
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: "Manage",
|
|
94
|
+
permissions: [
|
|
95
|
+
"environment.manage",
|
|
96
|
+
"grant.manage",
|
|
97
|
+
"project.manage"
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
];
|
|
101
|
+
function reachOf(role, permission) {
|
|
102
|
+
if (!role.permissions.includes(permission)) return "nowhere";
|
|
103
|
+
return projectWide(permission) || role.protected.includes(permission) ? "everywhere" : "unprotected";
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
63
106
|
* One checkbox of the grid flipped, and the rules the vault holds a role to
|
|
64
107
|
* kept true by the boxes it takes along (`definitionProblem`):
|
|
65
108
|
*
|
|
@@ -219,6 +262,6 @@ function useRoles() {
|
|
|
219
262
|
return data?.ok === true ? data : SHIPPED_ROLES;
|
|
220
263
|
}
|
|
221
264
|
//#endregion
|
|
222
|
-
export {
|
|
265
|
+
export { columnInWords as a, ordered as c, reachOf as d, roleIdFrom as f, toggle as g, sameDefinition as h, PERMISSION_WORDS as i, projectWide as l, roleNameOf as m, CARD_ROWS as n, impactExamples as o, roleIdProblem as p, GRID_PERMISSIONS as r, impactInWords as s, useRoles as t, protectionInWords as u };
|
|
223
266
|
|
|
224
|
-
//# sourceMappingURL=use-roles-
|
|
267
|
+
//# sourceMappingURL=use-roles-BZnJ9Cq0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-roles-BZnJ9Cq0.js","names":[],"sources":["../../src/lib/roles.ts","../../src/lib/use-roles.ts"],"sourcesContent":["import type { ImpactLine, RolesView, RoleView } from '@coffre/client';\nimport {\n assignableToEnvironment,\n FIXED_ROLES,\n INSTANCE_ROLES,\n PERMISSIONS,\n PROJECT_ONLY_PERMISSIONS,\n ROLES,\n type Permission,\n type RoleDefinition,\n} from '@coffre/core/access';\n\n/**\n * The instance's roles as the pages offer and name them (docs/design/roles.md):\n * each in two columns, what it holds in an environment and what a person\n * holds of it in a protected one. The policy is the vault's, read from\n * `GET /api/roles`; until it is, the roles as they ship stand in.\n */\n\n/** Every permission in words, in the catalogue's order, what a short label leaves out, and its word on a role's card, under its row's. */\nexport const PERMISSION_WORDS: Record<Permission, { label: string; note?: string; verb: string; short: string }> = {\n 'secret.read': { label: 'Read values', verb: 'read values', short: 'Read' },\n 'secret.use': { label: 'Use values', note: 'placeholders, the proxy', verb: 'use values', short: 'Use' },\n 'secret.write': { label: 'Write values', verb: 'write values', short: 'Write' },\n 'secret.archive': { label: 'Retire values', verb: 'retire values', short: 'Retire' },\n 'audit.read': { label: 'Read the log', verb: 'read the log', short: 'Read' },\n 'environment.manage': { label: 'Manage environments', verb: 'manage environments', short: 'Environments' },\n 'grant.manage': { label: 'Manage access', verb: 'manage access', short: 'Access' },\n 'project.manage': { label: 'Manage the project', verb: 'manage the project', short: 'Project' },\n};\n\n/** The rows of a role's grid: secrets first, as a role is read, then the log, then what only a project holds. */\nexport const GRID_PERMISSIONS: readonly Permission[] = [\n 'secret.read',\n 'secret.use',\n 'secret.write',\n 'secret.archive',\n 'audit.read',\n 'environment.manage',\n 'grant.manage',\n 'project.manage',\n];\n\nexport function projectWide(permission: Permission): boolean {\n return PROJECT_ONLY_PERMISSIONS.includes(permission);\n}\n\n/**\n * A role card's rows, the grid's permissions in its order, each on every\n * card, so that a permission sits in the same place on all of them:\n *\n * Values Read Use Write Retire\n * Log Read\n * Manage Environments Access Project\n */\nexport const CARD_ROWS: readonly { name: string; permissions: readonly Permission[] }[] = [\n { name: 'Values', permissions: ['secret.read', 'secret.use', 'secret.write', 'secret.archive'] },\n { name: 'Log', permissions: ['audit.read'] },\n { name: 'Manage', permissions: ['environment.manage', 'grant.manage', 'project.manage'] },\n];\n\n/**\n * Where a role holds a permission: everywhere, only outside protected\n * environments (Developer's Read values), or nowhere. A project-wide one\n * held is held everywhere: a project is never protected.\n */\nexport type Reach = 'everywhere' | 'unprotected' | 'nowhere';\n\nexport function reachOf(role: Pick<RoleDefinition, 'permissions' | 'protected'>, permission: Permission): Reach {\n if (!role.permissions.includes(permission)) return 'nowhere';\n return projectWide(permission) || role.protected.includes(permission) ? 'everywhere' : 'unprotected';\n}\n\n/** A role's two columns, as the grid edits them. */\nexport type Columns = { permissions: Permission[]; protected: Permission[] };\nexport type Column = 'normal' | 'protected';\n\n/**\n * One checkbox of the grid flipped, and the rules the vault holds a role to\n * kept true by the boxes it takes along (`definitionProblem`):\n *\n * checking Read checks Use unchecking Use unchecks Read\n * checking a protected box checks its unchecking a normal box unchecks\n * normal one its protected one\n *\n * A project-wide permission has no protected box: flipping one is no change.\n */\nexport function toggle(columns: Pick<RoleDefinition, 'permissions' | 'protected'>, permission: Permission, column: Column, on: boolean): Columns {\n if (column === 'protected' && projectWide(permission)) return ordered(columns);\n const normal = new Set(columns.permissions);\n const guarded = new Set(columns.protected);\n // Reading takes using; giving up using gives up reading.\n const along: Permission[] = on ? (permission === 'secret.read' ? ['secret.use'] : []) : permission === 'secret.use' ? ['secret.read'] : [];\n for (const each of [permission, ...along]) {\n if (on) {\n normal.add(each);\n if (column === 'protected') guarded.add(each);\n } else {\n guarded.delete(each);\n if (column === 'normal') normal.delete(each);\n }\n }\n return ordered({ permissions: [...normal], protected: [...guarded] });\n}\n\n/** Each column in catalogue order, as the vault keeps it, so that comparing two says whether they differ. */\nexport function ordered(columns: Pick<RoleDefinition, 'permissions' | 'protected'>): Columns {\n return {\n permissions: PERMISSIONS.filter((permission) => columns.permissions.includes(permission)),\n protected: PERMISSIONS.filter((permission) => columns.protected.includes(permission)),\n };\n}\n\n/** Whether two definitions hold the same, named and described the same. */\nexport function sameDefinition(a: RoleDefinition, b: RoleDefinition): boolean {\n const [x, y] = [ordered(a), ordered(b)];\n return a.name.trim() === b.name.trim() && a.description === b.description\n && x.permissions.join() === y.permissions.join() && x.protected.join() === y.protected.join();\n}\n\n/** A column in words, for a role's row: \"read, use and write values\", or \"nothing\". */\nexport function columnInWords(permissions: readonly Permission[]): string {\n const values = ['secret.read', 'secret.use', 'secret.write', 'secret.archive'] as const;\n const held = values.filter((permission) => permissions.includes(permission));\n const verbs = { 'secret.read': 'read', 'secret.use': 'use', 'secret.write': 'write', 'secret.archive': 'retire' } as const;\n const parts = [\n ...(held.length === 0 ? [] : [`${list(held.map((permission) => verbs[permission]))} values`]),\n ...GRID_PERMISSIONS.filter((permission) => !(values as readonly string[]).includes(permission) && permissions.includes(permission)).map((permission) => PERMISSION_WORDS[permission].verb),\n ];\n return parts.length === 0 ? 'nothing' : list(parts);\n}\n\nfunction list(words: readonly string[]): string {\n return words.length <= 1 ? (words[0] ?? '') : `${words.slice(0, -1).join(', ')} and ${words.at(-1)}`;\n}\n\n/** A role's id, made from its name as it is typed: \"Release manager\" is `release-manager`. */\nexport function roleIdFrom(name: string): string {\n return name\n .toLowerCase()\n .normalize('NFKD')\n .replace(/[\\u0300-\\u036f]/g, '')\n .replace(/[^a-z0-9]+/g, '-')\n .replace(/^[^a-z]+/, '')\n .replace(/-+$/, '')\n .slice(0, 32)\n .replace(/-+$/, '');\n}\n\n/** What is wrong with a new role's id, or null: its shape, and not one the instance has. */\nexport function roleIdProblem(id: string, taken: readonly string[]): string | null {\n if (id === '') return 'A role needs an id.';\n if (!/^[a-z0-9-]+$/.test(id)) return 'An id is lowercase letters, digits and dashes.';\n if (!/^[a-z]/.test(id)) return 'An id starts with a letter.';\n if (id.length < 2 || id.length > 32) return 'An id is 2 to 32 characters.';\n if (taken.includes(id)) return `There is a role ${id} already.`;\n return null;\n}\n\n/** The roles as they ship: what the pages offer and name until the instance's are read, or where they cannot be. */\nexport const SHIPPED_ROLES: RolesView = {\n roles: Object.entries(ROLES).map(([id, definition]) => shippedView(id, definition, FIXED_ROLES.roles.includes(id), assignableToEnvironment(id))),\n instanceRoles: Object.entries(INSTANCE_ROLES).map(([id, definition]) =>\n shippedView(id, definition, (FIXED_ROLES.instanceRoles as readonly string[]).includes(id), false)),\n editable: false,\n};\n\nfunction shippedView(id: string, definition: RoleDefinition, fixed: boolean, assignable: boolean): RoleView {\n const shipped = { name: definition.name, description: definition.description, ...ordered(definition) };\n return { id, ...shipped, builtin: true, edited: false, fixed, default: shipped, assignableToEnvironment: assignable, grants: 0 };\n}\n\n/** A role's name by its id, as the instance defines it; one it does not know, as itself. */\nexport function roleNameOf(roles: readonly Pick<RoleView, 'id' | 'name'>[], id: string): string {\n return roles.find((role) => role.id === id)?.name ?? id;\n}\n\n/**\n * One line of a change's impact, in words, from the dry run's count:\n *\n * widens secret.read, protected, 6 people, 4 environments\n * 6 people can now read values in 4 protected environments\n * narrows secret.write, 2 people, 1 environment, [\"ada@… on market/dev\", …]\n * 2 people can no longer write values in market/dev\n *\n * One place is named, from its examples; more are counted.\n */\nexport function impactInWords(line: ImpactLine): string {\n const people = [\n line.people > 0 ? (line.people === 1 ? '1 person' : `${line.people} people`) : null,\n line.services > 0 ? (line.services === 1 ? '1 service account' : `${line.services} service accounts`) : null,\n ].filter((part) => part !== null).join(' and ');\n const can = line.change === 'widens' ? 'can now' : 'can no longer';\n const wide = projectWide(line.permission);\n const count = wide ? line.projects : line.environments;\n const only = count === 1 ? placeOf(line.examples[0]) : null;\n const where = only !== null\n ? `${wide ? 'on' : 'in'} ${only}${line.protected ? ', protected' : ''}`\n : `${wide ? 'on' : 'in'} ${count} ${line.protected ? 'protected ' : ''}${wide ? (count === 1 ? 'project' : 'projects') : count === 1 ? 'environment' : 'environments'}`;\n return `${people} ${can} ${PERMISSION_WORDS[line.permission].verb} ${where}`;\n}\n\n/** The place of an impact's example, `ada@acme.example on market/prod`: `market/prod`. */\nfunction placeOf(example: string | undefined): string | null {\n const at = example?.lastIndexOf(' on ') ?? -1;\n return example === undefined || at < 0 ? null : example.slice(at + ' on '.length);\n}\n\n/** Who an impact line reaches, for its note: `ada@acme.example on market/prod, bo@acme.example on market/prod`. */\nexport function impactExamples(line: ImpactLine): string | null {\n return line.examples.length === 0 ? null : `${line.examples.join(', ')}${line.people + line.services > line.examples.length ? ', …' : ''}`;\n}\n\n/**\n * What protecting an environment does, said by a role whose two columns\n * differ, Developer first: \"Developers use and write values, and read\n * none\". Null where no role's do, so protecting changes nothing.\n */\nexport function protectionInWords(roles: readonly Pick<RoleView, 'id' | 'name' | 'permissions' | 'protected'>[]): string | null {\n const differs = (role: Pick<RoleView, 'permissions' | 'protected'>) =>\n role.permissions.some((permission) => !projectWide(permission) && !role.protected.includes(permission));\n const role = roles.find((each) => each.id === 'developer' && differs(each)) ?? roles.find(differs);\n if (role === undefined) return null;\n const held = columnInWords(role.protected);\n const loses = role.permissions.includes('secret.read') && !role.protected.includes('secret.read') && role.protected.length > 0;\n return `${role.name}s ${held === 'nothing' ? 'hold nothing' : held}${loses ? ', and read none' : ''}`;\n}\n","import type { RolesView } from '@coffre/client';\nimport { useQuery } from '@tanstack/react-query';\n\nimport { useCoffre } from './coffre';\nimport { queries } from './queries';\nimport { SHIPPED_ROLES } from './roles';\n\n/**\n * The instance's roles, for a picker or a name: as an Owner edited and made\n * them once read, and as they ship until then, or where they cannot be read,\n * so a picker never waits for them. The server decides every grant: a role\n * shown here a moment stale is one it refuses, never one it gives.\n */\nexport function useRoles(): RolesView {\n const { data } = useQuery({ ...queries.roles(useCoffre()), placeholderData: { ok: true as const, ...SHIPPED_ROLES } });\n return data?.ok === true ? data : SHIPPED_ROLES;\n}\n"],"mappings":";;;;;;;;;;;;AAoBA,IAAa,mBAAsG;CACjH,eAAe;EAAE,OAAO;EAAe,MAAM;EAAe,OAAO;CAAO;CAC1E,cAAc;EAAE,OAAO;EAAc,MAAM;EAA2B,MAAM;EAAc,OAAO;CAAM;CACvG,gBAAgB;EAAE,OAAO;EAAgB,MAAM;EAAgB,OAAO;CAAQ;CAC9E,kBAAkB;EAAE,OAAO;EAAiB,MAAM;EAAiB,OAAO;CAAS;CACnF,cAAc;EAAE,OAAO;EAAgB,MAAM;EAAgB,OAAO;CAAO;CAC3E,sBAAsB;EAAE,OAAO;EAAuB,MAAM;EAAuB,OAAO;CAAe;CACzG,gBAAgB;EAAE,OAAO;EAAiB,MAAM;EAAiB,OAAO;CAAS;CACjF,kBAAkB;EAAE,OAAO;EAAsB,MAAM;EAAsB,OAAO;CAAU;AAChG;;AAGA,IAAa,mBAA0C;CACrD;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACF;AAEA,SAAgB,YAAY,YAAiC;CAC3D,OAAO,yBAAyB,SAAS,UAAU;AACrD;;;;;;;;;AAUA,IAAa,YAA6E;CACxF;EAAE,MAAM;EAAU,aAAa;GAAC;GAAe;GAAc;GAAgB;EAAgB;CAAE;CAC/F;EAAE,MAAM;EAAO,aAAa,CAAC,YAAY;CAAE;CAC3C;EAAE,MAAM;EAAU,aAAa;GAAC;GAAsB;GAAgB;EAAgB;CAAE;AAC1F;AASA,SAAgB,QAAQ,MAAyD,YAA+B;CAC9G,IAAI,CAAC,KAAK,YAAY,SAAS,UAAU,GAAG,OAAO;CACnD,OAAO,YAAY,UAAU,KAAK,KAAK,UAAU,SAAS,UAAU,IAAI,eAAe;AACzF;;;;;;;;;;;AAgBA,SAAgB,OAAO,SAA4D,YAAwB,QAAgB,IAAsB;CAC/I,IAAI,WAAW,eAAe,YAAY,U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,CAAC,KAAK,GAAG;AACvE;;AAGA,SAAS,QAAQ,SAA4C;CAC3D,MAAM,KAAK,SAAS,YAAY,MAAM,KAAK;CAC3C,OAAO,YAAY,KAAA,KAAa,KAAK,IAAI,OAAO,QAAQ,MAAM,KAAK,CAAa;AAClF;;AAGA,SAAgB,eAAe,MAAiC;CAC9D,OAAO,KAAK,SAAS,WAAW,IAAI,OAAO,GAAG,KAAK,SAAS,KAAK,IAAI,IAAI,KAAK,SAAS,KAAK,WAAW,KAAK,SAAS,SAAS,QAAQ;AACxI;;;;;;AAOA,SAAgB,kBAAkB,OAA8F;CAC9H,MAAM,WAAW,SACf,KAAK,YAAY,MAAM,eAAe,CAAC,YAAY,UAAU,KAAK,CAAC,KAAK,UAAU,SAAS,UAAU,CAAC;CACxG,MAAM,OAAO,MAAM,MAAM,SAAS,KAAK,OAAO,eAAe,QAAQ,IAAI,CAAC,KAAK,MAAM,KAAK,OAAO;CACjG,IAAI,SAAS,KAAA,GAAW,OAAO;CAC/B,MAAM,OAAO,cAAc,KAAK,SAAS;CACzC,MAAM,QAAQ,KAAK,YAAY,SAAS,aAAa,KAAK,CAAC,KAAK,UAAU,SAAS,aAAa,KAAK,KAAK,UAAU,SAAS;CAC7H,OAAO,GAAG,KAAK,KAAK,IAAI,SAAS,YAAY,iBAAiB,OAAO,QAAQ,oBAAoB;AACnG;;;;;;;;;ACrNA,SAAgB,WAAsB;CACpC,MAAM,EAAE,SAAS,SAAS;EAAE,GAAG,QAAQ,MAAM,UAAU,CAAC;EAAG,iBAAiB;GAAE,IAAI;GAAe,GAAG;EAAc;CAAE,CAAC;CACrH,OAAO,MAAM,OAAO,OAAO,OAAO;AACpC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as shellOf, x as queries } from "./queries-
|
|
2
|
-
import { u as useCoffre } from "./page-
|
|
1
|
+
import { C as shellOf, x as queries } from "./queries-D1JuimTu.js";
|
|
2
|
+
import { u as useCoffre } from "./page-CfhC9Hp1.js";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { useSuspenseQueries } from "@tanstack/react-query";
|
|
5
5
|
//#region src/lib/use-shell.ts
|
|
@@ -23,4 +23,4 @@ function useShell() {
|
|
|
23
23
|
//#endregion
|
|
24
24
|
export { useShell as t };
|
|
25
25
|
|
|
26
|
-
//# sourceMappingURL=use-shell-
|
|
26
|
+
//# sourceMappingURL=use-shell-CPskgi1k.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-shell-
|
|
1
|
+
{"version":3,"file":"use-shell-CPskgi1k.js","names":[],"sources":["../../src/lib/use-shell.ts"],"sourcesContent":["import { useSuspenseQueries } from '@tanstack/react-query';\nimport { useMemo } from 'react';\n\nimport { useCoffre } from './coffre';\nimport { queries, shellOf, type Shell } from './queries';\n\n/**\n * The shell as a component reads it: from the same queries the root loader\n * fetched, so it follows any change that refetches them.\n */\nexport function useShell(): Shell {\n const client = useCoffre();\n const [auth, me, projects] = useSuspenseQueries({\n queries: [queries.auth(client), queries.me(client), queries.projects(client)],\n });\n return useMemo(() => shellOf(auth.data, me.data, projects.data), [auth.data, me.data, projects.data]);\n}\n"],"mappings":";;;;;;;;;AAUA,SAAgB,WAAkB;CAChC,MAAM,SAAS,UAAU;CACzB,MAAM,CAAC,MAAM,IAAI,YAAY,mBAAmB,EAC9C,SAAS;EAAC,QAAQ,KAAK,MAAM;EAAG,QAAQ,GAAG,MAAM;EAAG,QAAQ,SAAS,MAAM;CAAC,EAC9E,CAAC;CACD,OAAO,cAAc,QAAQ,KAAK,MAAM,GAAG,MAAM,SAAS,IAAI,GAAG;EAAC,KAAK;EAAM,GAAG;EAAM,SAAS;CAAI,CAAC;AACtG"}
|
package/dist/index.d.ts
CHANGED
|
@@ -107,6 +107,14 @@ type AuditSearch = {
|
|
|
107
107
|
actorId?: string;
|
|
108
108
|
detail?: '1';
|
|
109
109
|
};
|
|
110
|
+
/** Settings' tabs past the first, General, by their `?tab=`. */
|
|
111
|
+
declare const SETTINGS_TABS: readonly ["roles", "keys"];
|
|
112
|
+
type SettingsTab = (typeof SETTINGS_TABS)[number];
|
|
113
|
+
/** Settings' search: its tab, and on Roles, `roles=global` for the global roles rather than the project roles. */
|
|
114
|
+
type SettingsSearch = {
|
|
115
|
+
tab?: SettingsTab;
|
|
116
|
+
roles?: 'global';
|
|
117
|
+
};
|
|
110
118
|
//#endregion
|
|
111
119
|
//#region src/lib/signin-errors.d.ts
|
|
112
120
|
type LoginSearch = {
|
|
@@ -327,6 +335,8 @@ export declare const audit: {
|
|
|
327
335
|
} & {
|
|
328
336
|
entries: {
|
|
329
337
|
seq: number;
|
|
338
|
+
log: "0.14" | "0.15";
|
|
339
|
+
forged?: true;
|
|
330
340
|
author: "app" | "vault";
|
|
331
341
|
occurredAt: string;
|
|
332
342
|
actorType: "service" | "system" | "user";
|
|
@@ -349,6 +359,7 @@ export declare const audit: {
|
|
|
349
359
|
requestId: string | null;
|
|
350
360
|
run: null | {
|
|
351
361
|
exchangeSeq: number;
|
|
362
|
+
log: "0.14" | "0.15";
|
|
352
363
|
claims: {
|
|
353
364
|
[key: string]: string | number;
|
|
354
365
|
};
|
|
@@ -362,10 +373,17 @@ export declare const audit: {
|
|
|
362
373
|
};
|
|
363
374
|
}[];
|
|
364
375
|
more: boolean;
|
|
376
|
+
next: string | null;
|
|
365
377
|
hidden?: {
|
|
366
378
|
action: string;
|
|
367
379
|
count: number;
|
|
368
380
|
}[];
|
|
381
|
+
reads?: {
|
|
382
|
+
through: string | null;
|
|
383
|
+
behind: boolean;
|
|
384
|
+
forged?: true;
|
|
385
|
+
};
|
|
386
|
+
readsOmitted?: "path" | "scope";
|
|
369
387
|
})>;
|
|
370
388
|
};
|
|
371
389
|
/** `/users`. */
|
|
@@ -377,6 +395,11 @@ export declare const users: {
|
|
|
377
395
|
} | ({
|
|
378
396
|
ok: true;
|
|
379
397
|
} & {
|
|
398
|
+
reads?: {
|
|
399
|
+
through: string | null;
|
|
400
|
+
behind: boolean;
|
|
401
|
+
forged?: true;
|
|
402
|
+
} | undefined;
|
|
380
403
|
principals: DirectoryPrincipal[];
|
|
381
404
|
removed: {
|
|
382
405
|
principalType: "service" | "user";
|
|
@@ -423,6 +446,11 @@ export declare const serviceAccounts: {
|
|
|
423
446
|
} | ({
|
|
424
447
|
ok: true;
|
|
425
448
|
} & {
|
|
449
|
+
reads?: {
|
|
450
|
+
through: string | null;
|
|
451
|
+
behind: boolean;
|
|
452
|
+
forged?: true;
|
|
453
|
+
} | undefined;
|
|
426
454
|
principals: DirectoryPrincipal[];
|
|
427
455
|
removed: {
|
|
428
456
|
principalType: "service" | "user";
|
|
@@ -460,9 +488,25 @@ export declare const serviceAccountActivity: {
|
|
|
460
488
|
account: string;
|
|
461
489
|
}>) => Promise<void>;
|
|
462
490
|
};
|
|
463
|
-
/**
|
|
491
|
+
/**
|
|
492
|
+
* `/settings`, its tabs by `?tab=`: General, then Roles, the project roles
|
|
493
|
+
* or with `roles=global` the global ones, and Keys. One route, so a
|
|
494
|
+
* deployment mounts no file per tab; each tab reads its own alone.
|
|
495
|
+
*/
|
|
464
496
|
export declare const settings: {
|
|
465
|
-
|
|
497
|
+
validateSearch: (search: Record<string, unknown>) => SettingsSearch;
|
|
498
|
+
loaderDeps: ({ search }: {
|
|
499
|
+
search: {
|
|
500
|
+
tab?: SettingsTab;
|
|
501
|
+
};
|
|
502
|
+
}) => {
|
|
503
|
+
tab: "keys" | "roles" | undefined;
|
|
504
|
+
};
|
|
505
|
+
loader: ({ context, deps }: Loader & {
|
|
506
|
+
deps: {
|
|
507
|
+
tab?: SettingsTab;
|
|
508
|
+
};
|
|
509
|
+
}) => Promise<void>;
|
|
466
510
|
};
|
|
467
511
|
/**
|
|
468
512
|
* `/account`, the layout of your own account's tabs: its header, Sign out,
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { E as tabOpens, M as isActiveAccessibleEnvironment, _ as loadShell, a as hasAppsTab, b as projectOf, d as loadEnvironment, f as loadMember, g as loadSettings, h as loadServiceDirectory, i as createQueryClient, l as loadAudit, m as loadProject, p as loadPrincipal, t as SETTINGS_TABS, u as loadDirectory, v as loadSignIn, x as queries } from "./chunks/queries-D1JuimTu.js";
|
|
2
2
|
import { t as useMounted } from "./chunks/mounted-jJmqqV_n.js";
|
|
3
|
-
import { _ as PreferencesContext, b as rememberTheme, d as Tip, o as MenuPopup, p as TooltipProvider, v as browserPreferences, x as usePreferences, y as rememberSidebar } from "./chunks/ui-
|
|
3
|
+
import { _ as PreferencesContext, b as rememberTheme, d as Tip, o as MenuPopup, p as TooltipProvider, v as browserPreferences, x as usePreferences, y as rememberSidebar } from "./chunks/ui-CGdORVzW.js";
|
|
4
4
|
import { a as administrationEntries, t as AdministrationItems } from "./chunks/affordances-Dtyha68j.js";
|
|
5
|
-
import { $ as
|
|
6
|
-
import { n as ThemeMenuItems, r as ThemeToggle } from "./chunks/theme-
|
|
7
|
-
import { n as LiveRegion } from "./chunks/row-state-
|
|
8
|
-
import { t as useShell } from "./chunks/use-shell-
|
|
5
|
+
import { $ as SignOut, B as Menu$1, E as Folder, F as Ledger, H as Moon, N as Key, P as Layers, R as Lock, V as Monitor, W as PanelLeft, X as Settings, Y as Search, _ as Check, ct as X, d as Tile, et as SlashCircle, k as GitHub, l as uiResult, m as AlertTriangle, n as ClosedDoor, ot as UserCog, s as memberRef, st as Users, tt as Sun, u as useCoffre, x as ChevronsUpDown, z as Mark } from "./chunks/page-CfhC9Hp1.js";
|
|
6
|
+
import { n as ThemeMenuItems, r as ThemeToggle } from "./chunks/theme-rF44Wbmm.js";
|
|
7
|
+
import { n as LiveRegion } from "./chunks/row-state-CYH7kZHl.js";
|
|
8
|
+
import { t as useShell } from "./chunks/use-shell-CPskgi1k.js";
|
|
9
9
|
import { t as loginSearch } from "./chunks/signin-errors-TlQmQe0t.js";
|
|
10
10
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
11
11
|
import { Link, Outlet, createRouter as createRouter$1, redirect, useNavigate, useRouter, useRouterState } from "@tanstack/react-router";
|
|
@@ -1167,11 +1167,30 @@ var serviceAccountActivity = { loader: async ({ context, params }) => {
|
|
|
1167
1167
|
params
|
|
1168
1168
|
});
|
|
1169
1169
|
} };
|
|
1170
|
-
/**
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1170
|
+
/**
|
|
1171
|
+
* `/settings`, its tabs by `?tab=`: General, then Roles, the project roles
|
|
1172
|
+
* or with `roles=global` the global ones, and Keys. One route, so a
|
|
1173
|
+
* deployment mounts no file per tab; each tab reads its own alone.
|
|
1174
|
+
*/
|
|
1175
|
+
var settings = {
|
|
1176
|
+
validateSearch: (search) => {
|
|
1177
|
+
if (search.tab === "instance-roles") return {
|
|
1178
|
+
tab: "roles",
|
|
1179
|
+
roles: "global"
|
|
1180
|
+
};
|
|
1181
|
+
const tab = SETTINGS_TABS.find((each) => each === search.tab);
|
|
1182
|
+
return {
|
|
1183
|
+
tab,
|
|
1184
|
+
roles: tab === "roles" && search.roles === "global" ? "global" : void 0
|
|
1185
|
+
};
|
|
1186
|
+
},
|
|
1187
|
+
loaderDeps: ({ search }) => ({ tab: search.tab }),
|
|
1188
|
+
loader: async ({ context, deps }) => {
|
|
1189
|
+
const { coffre, queryClient } = coffreOf(context);
|
|
1190
|
+
if (deps.tab === "keys" && !(await loadShell(queryClient, coffre)).capabilities.runsInstance) throw redirect({ to: "/settings" });
|
|
1191
|
+
return loadSettings(queryClient, coffre, deps.tab);
|
|
1192
|
+
}
|
|
1193
|
+
};
|
|
1175
1194
|
/**
|
|
1176
1195
|
* `/account`, the layout of your own account's tabs: its header, Sign out,
|
|
1177
1196
|
* and the tabs you may open. Each tab is a page under it that reads its own.
|