@coffre/ui 0.8.2 → 0.10.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.
Files changed (92) hide show
  1. package/dist/chunks/{audit-sentence-C_wMpAqr.js → audit-sentence-Bjhg00cn.js} +73 -6
  2. package/dist/chunks/audit-sentence-Bjhg00cn.js.map +1 -0
  3. package/dist/chunks/{connected-apps-Bn5rEoV2.js → connected-apps-CZI7xxUq.js} +2 -2
  4. package/dist/chunks/{connected-apps-Bn5rEoV2.js.map → connected-apps-CZI7xxUq.js.map} +1 -1
  5. package/dist/chunks/{delete-place-CQCDHkne.js → delete-place-D3UQGl3b.js} +3 -3
  6. package/dist/chunks/{delete-place-CQCDHkne.js.map → delete-place-D3UQGl3b.js.map} +1 -1
  7. package/dist/chunks/{directory-BQNOdze_.js → directory-CyHmxYP-.js} +9 -7
  8. package/dist/chunks/directory-CyHmxYP-.js.map +1 -0
  9. package/dist/chunks/{grants-CJIBrkod.js → grants-CEIdNqJU.js} +4 -4
  10. package/dist/chunks/{grants-CJIBrkod.js.map → grants-CEIdNqJU.js.map} +1 -1
  11. package/dist/chunks/{offboarding-CrgwaetA.js → offboarding-CvGgTmHi.js} +2 -2
  12. package/dist/chunks/{offboarding-CrgwaetA.js.map → offboarding-CvGgTmHi.js.map} +1 -1
  13. package/dist/chunks/{personal-tokens-B8rkT-DI.js → personal-tokens-BX97oX4a.js} +2 -2
  14. package/dist/chunks/{personal-tokens-B8rkT-DI.js.map → personal-tokens-BX97oX4a.js.map} +1 -1
  15. package/dist/chunks/{principal-page-Cv5PheS9.js → principal-page-Bp2O8kIW.js} +92 -76
  16. package/dist/chunks/principal-page-Bp2O8kIW.js.map +1 -0
  17. package/dist/chunks/{project-page-BI--vjt3.js → project-page-CUXV4FDR.js} +2 -2
  18. package/dist/chunks/{project-page-BI--vjt3.js.map → project-page-CUXV4FDR.js.map} +1 -1
  19. package/dist/chunks/protected-YYW3U-Sq.js +22 -0
  20. package/dist/chunks/protected-YYW3U-Sq.js.map +1 -0
  21. package/dist/chunks/{queries-epz4MIuW.js → queries-DEOPOpsT.js} +27 -3
  22. package/dist/chunks/queries-DEOPOpsT.js.map +1 -0
  23. package/dist/chunks/{references-DImfw0cz.js → references-DsXkt064.js} +3 -3
  24. package/dist/chunks/{references-DImfw0cz.js.map → references-DsXkt064.js.map} +1 -1
  25. package/dist/chunks/{role-field-C1KhNaIR.js → role-field-CCUeZd1a.js} +8 -5
  26. package/dist/chunks/role-field-CCUeZd1a.js.map +1 -0
  27. package/dist/chunks/{use-action-BB-RcHo1.js → use-action-COW-XFw8.js} +2 -2
  28. package/dist/chunks/{use-action-BB-RcHo1.js.map → use-action-COW-XFw8.js.map} +1 -1
  29. package/dist/chunks/{use-change-CQyDpCqw.js → use-change-hfqE7baE.js} +231 -66
  30. package/dist/chunks/use-change-hfqE7baE.js.map +1 -0
  31. package/dist/chunks/use-roles-C_Tj5wBH.js +224 -0
  32. package/dist/chunks/use-roles-C_Tj5wBH.js.map +1 -0
  33. package/dist/chunks/{use-shell-C_NmvCt_.js → use-shell-DBLG80kk.js} +2 -2
  34. package/dist/chunks/{use-shell-C_NmvCt_.js.map → use-shell-DBLG80kk.js.map} +1 -1
  35. package/dist/index.d.ts +9 -3
  36. package/dist/index.js +25 -11
  37. package/dist/index.js.map +1 -1
  38. package/dist/pages/account.js +6 -6
  39. package/dist/pages/audit.js +2 -2
  40. package/dist/pages/environment.js +306 -96
  41. package/dist/pages/environment.js.map +1 -1
  42. package/dist/pages/login.js +1 -1
  43. package/dist/pages/project-access.js +78 -45
  44. package/dist/pages/project-access.js.map +1 -1
  45. package/dist/pages/project-environments.js +77 -28
  46. package/dist/pages/project-environments.js.map +1 -1
  47. package/dist/pages/project-settings.js +6 -6
  48. package/dist/pages/project.js +1 -1
  49. package/dist/pages/projects.js +23 -11
  50. package/dist/pages/projects.js.map +1 -1
  51. package/dist/pages/service-account.js +19 -12
  52. package/dist/pages/service-account.js.map +1 -1
  53. package/dist/pages/service-accounts.js +4 -4
  54. package/dist/pages/settings.js +580 -8
  55. package/dist/pages/settings.js.map +1 -1
  56. package/dist/pages/unregistered.js +1 -1
  57. package/dist/pages/user.js +5 -5
  58. package/dist/pages/users.js +4 -4
  59. package/package.json +3 -3
  60. package/src/components/directory.tsx +5 -2
  61. package/src/components/grants.tsx +1 -1
  62. package/src/components/principal-page.tsx +38 -23
  63. package/src/components/protected.tsx +17 -0
  64. package/src/components/role-editor.tsx +582 -0
  65. package/src/components/role-field.tsx +7 -3
  66. package/src/components/scope-picker.tsx +19 -9
  67. package/src/components/shell.tsx +7 -1
  68. package/src/lib/access-plan.ts +35 -36
  69. package/src/lib/audit-sentences.ts +75 -6
  70. package/src/lib/changes.ts +48 -6
  71. package/src/lib/project-access.ts +4 -78
  72. package/src/lib/queries.ts +16 -0
  73. package/src/lib/roles.ts +201 -0
  74. package/src/lib/row-reads.ts +12 -0
  75. package/src/lib/secret-edit-batch.ts +162 -26
  76. package/src/lib/sensitivity.ts +50 -0
  77. package/src/lib/service-setup.ts +20 -8
  78. package/src/lib/use-roles.ts +17 -0
  79. package/src/pages/environment.tsx +295 -61
  80. package/src/pages/project-access.tsx +49 -19
  81. package/src/pages/project-environments.tsx +62 -3
  82. package/src/pages/projects.tsx +3 -1
  83. package/src/pages/settings.tsx +2 -0
  84. package/src/parity.ts +41 -4
  85. package/src/shared/models.ts +2 -9
  86. package/src/styles/globals.css +329 -4
  87. package/dist/chunks/audit-sentence-C_wMpAqr.js.map +0 -1
  88. package/dist/chunks/directory-BQNOdze_.js.map +0 -1
  89. package/dist/chunks/principal-page-Cv5PheS9.js.map +0 -1
  90. package/dist/chunks/queries-epz4MIuW.js.map +0 -1
  91. package/dist/chunks/role-field-C1KhNaIR.js.map +0 -1
  92. package/dist/chunks/use-change-CQyDpCqw.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { useState, type ReactNode } from 'react';
1
+ import { useId, useState, type ReactNode } from 'react';
2
2
  import { useSuspenseQuery } from '@tanstack/react-query';
3
3
  import { useShell } from '../lib/use-shell';
4
4
  import { useCoffre } from '../lib/coffre';
@@ -12,7 +12,8 @@ import { GrantRowView, GrantsTable, RefusedGrants, useRefusedGrants } from '../c
12
12
  import { KIND } from '../components/directory';
13
13
  import { PrincipalLink } from '../components/principal';
14
14
  import { PrincipalPicker } from '../components/principal-picker';
15
- import { parseProjectAccess, projectAccessOptions } from '../lib/project-access';
15
+ import { roleNameOf } from '../lib/roles';
16
+ import { useRoles } from '../lib/use-roles';
16
17
  import { Key, Plus, User } from '../components/icons';
17
18
  import { pageRoute } from '../lib/page-route';
18
19
  import { useProject } from '../lib/project-page';
@@ -121,10 +122,18 @@ function NewGrant({
121
122
  const [principalId, setPrincipalId] = useState('');
122
123
  // A new service account, named in the picker: the grant makes it.
123
124
  const [admit, setAdmit] = useState(false);
124
- const [permission, setPermission] = useState('viewer:');
125
+ const [role, setRole] = useState('viewer');
126
+ // '' for the whole project, else an environment's slug.
127
+ const [where, setWhere] = useState('');
125
128
  const [expiresAt, setExpiresAt] = useState('');
126
129
  const grant = useChange(grantAccess(useCoffre(), project));
127
- const permissionOptions = projectAccessOptions(environments);
130
+ const { roles } = useRoles();
131
+ const hint = useId();
132
+ const chosen = roles.find((each) => each.id === role);
133
+ // Live environments only: an archived one serves nothing to grant.
134
+ const live = environments.filter((environment) => environment.details !== null && environment.details.archivedAt === null);
135
+ // A role that holds something project-wide is granted on the project alone.
136
+ const onProjectOnly = chosen !== undefined && !chosen.assignableToEnvironment;
128
137
  const kind = KIND[principalType];
129
138
  const service = principalType === 'service';
130
139
 
@@ -134,7 +143,8 @@ function NewGrant({
134
143
  setPrincipalId('');
135
144
  setAdmit(false);
136
145
  setExpiresAt('');
137
- setPermission('viewer:');
146
+ setRole('viewer');
147
+ setWhere('');
138
148
  }
139
149
 
140
150
  return (
@@ -153,20 +163,19 @@ function NewGrant({
153
163
  </>
154
164
  }
155
165
  wide
156
- description="Owners manage the whole project and its access. Read and write can cover every environment, or one."
166
+ description="A role on the whole project, or on one of its environments. Owners manage the whole project and its access."
157
167
  >
158
168
  <form
159
169
  className="form"
160
170
  onSubmit={(event) => {
161
171
  event.preventDefault();
162
- const access = parseProjectAccess(permission);
163
172
  // Shown in the list at once, marked as saving; the list says if the server refuses.
164
173
  grant({
165
174
  principalType,
166
175
  principalId: principalId.trim(),
167
- role: access.role,
168
- roleName: permissionOptions.find((option) => option.value === permission)?.label ?? access.role,
169
- environmentSlug: access.environmentSlug,
176
+ role,
177
+ roleName: roleNameOf(roles, role),
178
+ environmentSlug: onProjectOnly || where === '' ? null : where,
170
179
  expiresAt: expiresAt === '' ? null : new Date(`${expiresAt}T23:59:59Z`).toISOString(),
171
180
  admit,
172
181
  });
@@ -187,21 +196,35 @@ function NewGrant({
187
196
  />
188
197
 
189
198
  <div className="form-row">
190
- <label className="field" style={{ flexGrow: 2 }}>
191
- <span className="label">Permissions</span>
199
+ <label className="field">
200
+ <span className="label">Role</span>
201
+ <select className="select" value={role} onChange={(event) => setRole(event.target.value)}>
202
+ {roles.map((each) => (
203
+ <option key={each.id} value={each.id}>
204
+ {each.name}
205
+ </option>
206
+ ))}
207
+ </select>
208
+ </label>
209
+
210
+ <label className="field">
211
+ <span className="label">On</span>
192
212
  <select
193
213
  className="select"
194
- value={permission}
195
- onChange={(event) => setPermission(event.target.value)}
214
+ value={onProjectOnly ? '' : where}
215
+ disabled={onProjectOnly}
216
+ aria-describedby={hint}
217
+ onChange={(event) => setWhere(event.target.value)}
196
218
  >
197
- {permissionOptions.map((option) => (
198
- <option key={option.value} value={option.value}>
199
- {option.label}
219
+ <option value="">The whole project</option>
220
+ {live.map((environment) => (
221
+ <option key={environment.slug} value={environment.slug}>
222
+ {environment.slug}
223
+ {environment.protected ? ' (protected)' : ''}
200
224
  </option>
201
225
  ))}
202
226
  </select>
203
227
  </label>
204
-
205
228
  <label className="field">
206
229
  <span className="label">
207
230
  Expires <span className="hint">(optional)</span>
@@ -215,11 +238,18 @@ function NewGrant({
215
238
  </label>
216
239
  </div>
217
240
 
241
+ {chosen !== undefined && (
242
+ <p className="hint" id={hint}>
243
+ {chosen.description}
244
+ {onProjectOnly && ' It holds something project-wide, so it is granted on the whole project.'}
245
+ </p>
246
+ )}
247
+
218
248
  <div className="dialog-actions">
219
249
  <button className="btn" type="button" onClick={close}>
220
250
  Cancel
221
251
  </button>
222
- <button className="btn btn-primary" type="submit" disabled={principalId.trim() === ''}>
252
+ <button className="btn btn-primary" type="submit" disabled={principalId.trim() === '' || chosen === undefined}>
223
253
  {admit ? 'Create and grant access' : 'Grant access'}
224
254
  </button>
225
255
  </div>
@@ -6,7 +6,7 @@ import { useShell } from '../lib/use-shell';
6
6
  import { Menu } from '@base-ui/react/menu';
7
7
  import { toast } from 'sonner';
8
8
  import { useCoffre } from '../lib/coffre';
9
- import { archiveEnvironment, createEnvironment, environmentId, renameEnvironment } from '../lib/changes';
9
+ import { archiveEnvironment, createEnvironment, environmentId, protectEnvironment, renameEnvironment } from '../lib/changes';
10
10
  import { affects, keys, queries } from '../lib/queries';
11
11
  import { useChange, useChangeStatus } from '../lib/use-change';
12
12
  import { ItemFailure, RowPending, rowClass } from '../components/row-state';
@@ -19,7 +19,10 @@ import { Card } from '../components/page';
19
19
  import { useAction } from '../lib/use-action';
20
20
  import { DeletePlaceDialog } from '../components/delete-place';
21
21
  import { PrincipalAvatar } from '../components/principal';
22
- import { Archive, ChevronRight, MoreHorizontal, Pencil, Plus, RotateBack, Trash } from '../components/icons';
22
+ import { Archive, ChevronRight, Lock, MoreHorizontal, Pencil, Plus, RotateBack, Trash } from '../components/icons';
23
+ import { ProtectedTag } from '../components/protected';
24
+ import { protectionInWords } from '../lib/roles';
25
+ import { useRoles } from '../lib/use-roles';
23
26
  import { pageRoute } from '../lib/page-route';
24
27
  import { useProject } from '../lib/project-page';
25
28
  import type { projectEnvironments } from '../options';
@@ -108,6 +111,7 @@ function EnvironmentsPanel({
108
111
  project={project.slug}
109
112
  // Your personal config is nobody's source: its values are yours alone.
110
113
  sources={current.filter((environment) => isActiveAccessibleEnvironment(environment) && !environment.personal).map((environment) => environment.slug)}
114
+ guarded={current.filter((environment) => environment.protected).map((environment) => environment.slug)}
111
115
  />
112
116
  </div>
113
117
  )}
@@ -183,11 +187,15 @@ function EnvironmentCard({
183
187
  const [renaming, setRenaming] = useState(false);
184
188
  const [confirming, setConfirming] = useState(false);
185
189
  const [deleting, setDeleting] = useState(false);
190
+ // Protecting, or taking it off, waiting for its confirmation.
191
+ const [guarding, setGuarding] = useState(false);
186
192
  const { capabilities } = useShell();
193
+ const { roles } = useRoles();
187
194
  const [slug, setSlug] = useState(environment.slug);
188
195
  const coffre = useCoffre();
189
196
  const rename = useChange(renameEnvironment(coffre, project));
190
197
  const archive = useChange(archiveEnvironment(coffre, project));
198
+ const protect = useChange(protectEnvironment(coffre, project));
191
199
  // What archiving it would stop, asked once the dialog opens (D41); Archive waits for the answer.
192
200
  const place = `${project}/${environment.slug}`;
193
201
  const archiving = confirming && environment.details?.archivedAt == null;
@@ -204,6 +212,10 @@ function EnvironmentCard({
204
212
  const manageable = isAdmin && details !== null;
205
213
  // Deleting is for those who run the instance, and only once the environment is archived.
206
214
  const deletable = manageable && isArchived && capabilities.runsInstance;
215
+ // Whoever manages environments protects one; only an Owner of the whole instance takes it off.
216
+ const guarded = environment.protected;
217
+ const guardable = manageable && environment.personal !== true && (!guarded || capabilities.ownsInstance);
218
+ const protection = protectionInWords(roles);
207
219
  const slugError = slug === '' ? null : environmentSlugProblem(slug);
208
220
  const lastChange = useLastChange(project, environment.slug, opens);
209
221
  // A personal config is its owner's alone: no grant reaches it, so none is shown on its card.
@@ -228,6 +240,7 @@ function EnvironmentCard({
228
240
  ) : (
229
241
  <span className="env-card-name">{environment.slug}</span>
230
242
  )}
243
+ {guarded && <ProtectedTag />}
231
244
  {/* A fork: its keys are its parent's, but for those it sets or removes. An instance before 0.7 says nothing. */}
232
245
  {environment.personal === true
233
246
  ? <span className="tag tag-blue">yours alone</span>
@@ -301,6 +314,12 @@ function EnvironmentCard({
301
314
  <Pencil size={14} />
302
315
  Rename
303
316
  </Menu.Item>
317
+ {guardable && (
318
+ <Menu.Item className="menu-item" onClick={() => setGuarding(true)}>
319
+ <Lock size={14} />
320
+ {guarded ? 'Unprotect…' : 'Protect…'}
321
+ </Menu.Item>
322
+ )}
304
323
  <Menu.Separator className="menu-sep" />
305
324
  <Menu.Item
306
325
  className={`menu-item${isArchived ? '' : ' menu-item-danger'}`}
@@ -423,6 +442,32 @@ function EnvironmentCard({
423
442
  </>
424
443
  )}
425
444
 
445
+ {guardable && (
446
+ <ConfirmDialog
447
+ open={guarding}
448
+ onOpenChange={setGuarding}
449
+ title={
450
+ <>
451
+ {guarded ? 'Unprotect' : 'Protect'}{' '}
452
+ <span className="mono">
453
+ {project}/{environment.slug}
454
+ </span>
455
+ ?
456
+ </>
457
+ }
458
+ body={
459
+ guarded
460
+ ? 'People holding a role here get its full column again, as in any other environment. Service accounts are unaffected.'
461
+ : `People holding a role here get its protected column${protection === null ? ', which for now holds what the other does' : `: ${protection}`}. Service accounts are unaffected.${
462
+ capabilities.ownsInstance ? '' : ' Only an Owner of the whole instance takes protection off.'
463
+ }`
464
+ }
465
+ confirmLabel={guarded ? 'Unprotect' : 'Protect'}
466
+ destructive={guarded}
467
+ onConfirm={() => protect({ slug: environment.slug, protected: !guarded })}
468
+ />
469
+ )}
470
+
426
471
  {deletable && (
427
472
  <DeletePlaceDialog
428
473
  path={`${project}/${environment.slug}`}
@@ -499,7 +544,16 @@ function PersonalConfigs({ project }: { project: string }) {
499
544
  * folder, without history, or a reference to it. Copying is a read, and
500
545
  * logged as one; inheriting reads nothing until the fork is read.
501
546
  */
502
- function NewEnvironment({ project, sources }: { project: string; sources: string[] }) {
547
+ function NewEnvironment({
548
+ project,
549
+ sources,
550
+ guarded,
551
+ }: {
552
+ project: string;
553
+ sources: string[];
554
+ /** The protected ones: a fork of one is protected too. */
555
+ guarded: string[];
556
+ }) {
503
557
  const [open, setOpen] = useState(false);
504
558
  const [slug, setSlug] = useState('');
505
559
  // '' for empty, 'inherit:prod' for a fork that inherits, 'copy:prod' for a copy, 'ref:prod' for references to prod.
@@ -599,6 +653,11 @@ function NewEnvironment({ project, sources }: { project: string; sources: string
599
653
  ? `Each of ${from}'s keys, with its current value and folder, without history.`
600
654
  : `Each key follows ${from}'s until it gets a value of its own. Whoever can read ${slug === '' ? 'the new environment' : slug} will read ${from}'s values through them, even without access to ${from}.`}
601
655
  </span>
656
+ {from !== '' && guarded.includes(from) && (
657
+ <span className="hint">
658
+ <span className="mono">{from}</span> is protected, so the new environment is too, from its first moment.
659
+ </span>
660
+ )}
602
661
  {copied.length > 0 && (
603
662
  <span className="hint">
604
663
  Copied instead, since you read their source only through {from}: <span className="mono">{copied.join(', ')}</span>.
@@ -19,7 +19,7 @@ import { affects } from '../lib/queries';
19
19
  import { useAction } from '../lib/use-action';
20
20
  import { ClosedDoor, PageHeader } from '../components/page';
21
21
  import { Tile } from '../components/tile';
22
- import { AlertTriangle, Folder, Hash, Layers, Plus } from '../components/icons';
22
+ import { AlertTriangle, Folder, Hash, Layers, Lock, Plus } from '../components/icons';
23
23
  import {
24
24
  ProjectEmptyStateCopy,
25
25
  MakesProjectsOnly,
@@ -239,6 +239,7 @@ function ProjectRow({
239
239
  params={{ project: project.slug, environment: environment.slug }}
240
240
  >
241
241
  {environment.slug}
242
+ {environment.protected && <Lock size={11} className="env-link-lock" label="protected" />}
242
243
  <span className="count">{environment.details.secretCount}</span>
243
244
  </Link>
244
245
  ) : (
@@ -248,6 +249,7 @@ function ProjectRow({
248
249
  title="You can't open this environment"
249
250
  >
250
251
  {environment.slug}
252
+ {environment.protected && <Lock size={11} className="env-link-lock" label="protected" />}
251
253
  </span>
252
254
  ),
253
255
  )}
@@ -10,6 +10,7 @@ import { useAction } from '../lib/use-action';
10
10
  import { useShell } from '../lib/use-shell';
11
11
  import { Card, Fact, PageHeader } from '../components/page';
12
12
  import { ScopeField } from '../components/role-field';
13
+ import { RolesSettings } from '../components/role-editor';
13
14
  import { ErrorLine, Modal, Spinner, Toggletip } from '../components/ui';
14
15
  import { Info, Pencil } from '../components/icons';
15
16
 
@@ -71,6 +72,7 @@ export function SettingsPage() {
71
72
  </dl>
72
73
  </Card>
73
74
 
75
+ <RolesSettings />
74
76
  {settings?.ok === true && <ServiceSetup scope={settings.serviceAccounts} />}
75
77
  {keys?.ok === true && <Keys keys={keys} />}
76
78
  </>
package/src/parity.ts CHANGED
@@ -16,8 +16,12 @@ export type ClientCall = {
16
16
  : `${N}.${keyof CoffreClient[N] & string}`;
17
17
  }[keyof CoffreClient & string];
18
18
 
19
- /** Where a person does it: the control, in words, its file under `src/`, and the call it makes. */
20
- export type Affordance = { readonly does: string; readonly in: string; readonly call: ClientCall };
19
+ /**
20
+ * Where a person does it: the control, in words, its file under `src/`, and
21
+ * the call it makes; with `args`, what the test calls it with, where the
22
+ * stand-ins it uses for every other call would send another route.
23
+ */
24
+ export type Affordance = { readonly does: string; readonly in: string; readonly call: ClientCall; readonly args?: readonly unknown[] };
21
25
 
22
26
  export type Reach =
23
27
  | { readonly ui: readonly Affordance[] }
@@ -46,7 +50,10 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
46
50
  ui: [{ does: 'a project › Environments › Add environment, empty, inheriting, a copy or references', in: 'pages/project-environments.tsx', call: 'environments.create' }],
47
51
  },
48
52
  'PATCH /projects/:project/:environment': {
49
- ui: [{ does: "an environment's card › ⋯ › Rename, Archive…, Restore", in: 'pages/project-environments.tsx', call: 'environments.update' }],
53
+ ui: [
54
+ { does: "an environment's card › ⋯ › Rename, Archive…, Restore", in: 'pages/project-environments.tsx', call: 'environments.update' },
55
+ { does: "an environment's card › ⋯ › Protect…, and for an Owner of the whole instance Unprotect…", in: 'pages/project-environments.tsx', call: 'environments.protect' },
56
+ ],
50
57
  },
51
58
  'DELETE /projects/:project/:environment': {
52
59
  ui: [
@@ -74,6 +81,7 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
74
81
  ui: [
75
82
  { does: 'an environment › Add secret, Edit, then Save', in: 'pages/environment.tsx', call: 'secrets.set' },
76
83
  { does: 'an environment › Import .env, after its plan', in: 'pages/environment.tsx', call: 'secrets.set' },
84
+ { does: 'a secret › ⋯ › Who sees it, stricter: at once, its value kept', in: 'pages/environment.tsx', call: 'secrets.set' },
77
85
  ],
78
86
  },
79
87
  'PATCH /secrets/:project/:environment/:key': {
@@ -133,7 +141,7 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
133
141
  'DELETE /members/:member': { ui: [{ does: 'a user or service account › ⋯ › Remove…', in: 'components/directory.tsx', call: 'members.remove' }] },
134
142
  'GET /members/:member/tokens': { ui: [{ does: 'a service account › Sign-in › Bearer tokens', in: 'components/service-tokens.tsx', call: 'tokens.list' }] },
135
143
  'POST /members/:member/tokens': { ui: [{ does: 'a service account › Sign-in › Issue token', in: 'components/service-tokens.tsx', call: 'tokens.issue' }] },
136
- 'POST /handles': { not: "a handle is a stand-in for an app `coffre run` starts, which only the credential proxy takes: a page has no app to give one" },
144
+ 'POST /handles': { not: "a handle is the placeholder `coffre run` gives the app it starts, which only the credential proxy takes: a page has no app to give one" },
137
145
  'DELETE /members/:member/tokens/:id': { ui: [{ does: 'a bearer token › Revoke', in: 'components/service-tokens.tsx', call: 'tokens.revoke' }] },
138
146
  'GET /members/:member/bindings': { ui: [{ does: 'a service account › Sign-in › Sign in with OIDC', in: 'components/trusted-workloads.tsx', call: 'bindings.list' }] },
139
147
  'POST /members/:member/bindings': {
@@ -177,6 +185,35 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
177
185
  ],
178
186
  },
179
187
  'GET /audit/verification': { ui: [{ does: "Audit: the log's seal, verified on every visit", in: 'pages/audit.tsx', call: 'audit.verify' }] },
188
+ 'GET /roles': {
189
+ ui: [
190
+ { does: 'Settings › Roles and Instance roles; every grant picker, for the roles it offers', in: 'lib/queries.ts', call: 'roles.list' },
191
+ ],
192
+ },
193
+ 'PUT /roles/:role': {
194
+ ui: [
195
+ { does: 'Settings › Roles › Edit… › Save, or New role › Save, once the change is confirmed', in: 'components/role-editor.tsx', call: 'roles.set' },
196
+ { does: 'the same dialog: what saving would do to everyone it reaches, before it is confirmed', in: 'components/role-editor.tsx', call: 'roles.preview' },
197
+ ],
198
+ },
199
+ 'DELETE /roles/:role': {
200
+ ui: [
201
+ { does: 'Settings › Roles › Edit… › Reset to default, or a custom role’s Delete…', in: 'components/role-editor.tsx', call: 'roles.reset' },
202
+ { does: 'the same: what it would do, before it is confirmed', in: 'components/role-editor.tsx', call: 'roles.previewReset' },
203
+ ],
204
+ },
205
+ 'PUT /instance-roles/:role': {
206
+ ui: [
207
+ { does: 'Settings › Instance roles › Edit… › Save', in: 'components/role-editor.tsx', call: 'roles.set', args: ['developer', {}, { instance: true }] },
208
+ { does: 'the same dialog: what saving would do, before it is confirmed', in: 'components/role-editor.tsx', call: 'roles.preview', args: ['developer', {}, { instance: true }] },
209
+ ],
210
+ },
211
+ 'DELETE /instance-roles/:role': {
212
+ ui: [
213
+ { does: 'Settings › Instance roles › Edit… › Reset to default', in: 'components/role-editor.tsx', call: 'roles.reset', args: ['developer', { instance: true }] },
214
+ { does: 'the same: what it would do, before it is confirmed', in: 'components/role-editor.tsx', call: 'roles.previewReset', args: ['developer', { instance: true }] },
215
+ ],
216
+ },
180
217
  'GET /settings': { ui: [{ does: 'Settings › Service accounts: where people set them up', in: 'pages/settings.tsx', call: 'settings.get' }] },
181
218
  'PUT /settings': { ui: [{ does: 'Settings › Service accounts › Edit', in: 'pages/settings.tsx', call: 'settings.set' }] },
182
219
  'GET /audit/keys': { ui: [{ does: 'Settings › Keys: what the keys you keep are checked against', in: 'pages/settings.tsx', call: 'audit.keys' }] },
@@ -16,6 +16,8 @@ export type Me = ApiMe;
16
16
  export type SecretKey = ApiSecretKey;
17
17
  export type ProjectSummary = ApiProjectSummary;
18
18
  export type SecretVersion = ApiSecretVersion;
19
+ /** Who sees a key's value (`lib/sensitivity.ts`). */
20
+ export type Sensitivity = SecretVersion['sensitivity'];
19
21
 
20
22
  /** One member's role at one place in a project, as the project page lists them. */
21
23
  export type GrantRow = {
@@ -35,15 +37,6 @@ export type GrantRow = {
35
37
  expiresAt: string | null;
36
38
  };
37
39
 
38
- export type RoleRow = {
39
- slug: string;
40
- name: string;
41
- description: string;
42
- permissions: Permission[];
43
- /** False when the role contains a project-only permission. */
44
- assignableToEnvironment: boolean;
45
- };
46
-
47
40
  export type DirectoryPrincipal = Pick<Member, 'principalType' | 'principalId' | 'instanceRole' | 'scope'> &
48
41
  Partial<Pick<Member, 'tampered' | 'managed' | 'declared'>> & {
49
42
  /** Where it has access, when the list said; a member just added has none yet. */