@coffre/ui 0.4.4 → 0.4.6

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 (85) hide show
  1. package/dist/chunks/{audit-sentence-BhHmvQX_.js → audit-sentence-DIztXvbU.js} +11 -2
  2. package/dist/chunks/audit-sentence-DIztXvbU.js.map +1 -0
  3. package/dist/chunks/{connected-apps-D8Df97-F.js → connected-apps-AZsX9Zvv.js} +2 -2
  4. package/dist/chunks/{connected-apps-D8Df97-F.js.map → connected-apps-AZsX9Zvv.js.map} +1 -1
  5. package/dist/chunks/{delete-place-LYN7z7xb.js → delete-place-D6LIZkg9.js} +4 -4
  6. package/dist/chunks/delete-place-D6LIZkg9.js.map +1 -0
  7. package/dist/chunks/{directory-v87HGjEn.js → directory-B6FuiCir.js} +5 -5
  8. package/dist/chunks/directory-B6FuiCir.js.map +1 -0
  9. package/dist/chunks/{folders-CbGU0xOz.js → folders-DvSqBhuu.js} +3 -3
  10. package/dist/chunks/folders-DvSqBhuu.js.map +1 -0
  11. package/dist/chunks/{offboarding-DdnmRV1f.js → offboarding-CLJaNTcD.js} +6 -6
  12. package/dist/chunks/offboarding-CLJaNTcD.js.map +1 -0
  13. package/dist/chunks/{principal-page-BubEO6-b.js → principal-page-1yMztIcc.js} +8 -8
  14. package/dist/chunks/principal-page-1yMztIcc.js.map +1 -0
  15. package/dist/chunks/{references-DPSYdWOk.js → references-DWDnXNoW.js} +3 -3
  16. package/dist/chunks/references-DWDnXNoW.js.map +1 -0
  17. package/dist/index.d.ts +5 -0
  18. package/dist/index.js +2 -2
  19. package/dist/index.js.map +1 -1
  20. package/dist/pages/account.js +8 -8
  21. package/dist/pages/account.js.map +1 -1
  22. package/dist/pages/approval.js +55 -23
  23. package/dist/pages/approval.js.map +1 -1
  24. package/dist/pages/audit.js +4 -4
  25. package/dist/pages/audit.js.map +1 -1
  26. package/dist/pages/device-login.js +5 -4
  27. package/dist/pages/device-login.js.map +1 -1
  28. package/dist/pages/environment.js +9 -13
  29. package/dist/pages/environment.js.map +1 -1
  30. package/dist/pages/login.js +3 -3
  31. package/dist/pages/login.js.map +1 -1
  32. package/dist/pages/oauth-authorize.js +9 -14
  33. package/dist/pages/oauth-authorize.js.map +1 -1
  34. package/dist/pages/project-access.js +2 -2
  35. package/dist/pages/project-environments.js +7 -7
  36. package/dist/pages/project-environments.js.map +1 -1
  37. package/dist/pages/project-settings.js +6 -6
  38. package/dist/pages/project-settings.js.map +1 -1
  39. package/dist/pages/project.js +1 -1
  40. package/dist/pages/project.js.map +1 -1
  41. package/dist/pages/projects.js +4 -4
  42. package/dist/pages/projects.js.map +1 -1
  43. package/dist/pages/service-account.js +5 -5
  44. package/dist/pages/service-account.js.map +1 -1
  45. package/dist/pages/service-accounts.js +2 -2
  46. package/dist/pages/settings.js +4 -4
  47. package/dist/pages/settings.js.map +1 -1
  48. package/dist/pages/unregistered.js +3 -3
  49. package/dist/pages/unregistered.js.map +1 -1
  50. package/dist/pages/user.js +1 -1
  51. package/dist/pages/users.js +2 -2
  52. package/package.json +3 -3
  53. package/src/components/connected-apps.tsx +1 -1
  54. package/src/components/delete-place.tsx +4 -5
  55. package/src/components/directory.tsx +5 -6
  56. package/src/components/folders.tsx +2 -2
  57. package/src/components/offboarding.tsx +5 -5
  58. package/src/components/principal-page.tsx +3 -3
  59. package/src/components/references.tsx +2 -2
  60. package/src/components/route-states.tsx +4 -5
  61. package/src/components/service-tokens.tsx +1 -1
  62. package/src/components/trusted-workloads.tsx +3 -3
  63. package/src/lib/approval.ts +23 -0
  64. package/src/lib/audit-sentences.ts +5 -0
  65. package/src/pages/account.tsx +7 -7
  66. package/src/pages/approval.tsx +21 -20
  67. package/src/pages/audit.tsx +3 -3
  68. package/src/pages/device-login.tsx +3 -5
  69. package/src/pages/environment.tsx +8 -15
  70. package/src/pages/login.tsx +5 -10
  71. package/src/pages/oauth-authorize.tsx +7 -11
  72. package/src/pages/project-environments.tsx +6 -6
  73. package/src/pages/project-settings.tsx +5 -7
  74. package/src/pages/project.tsx +2 -2
  75. package/src/pages/projects.tsx +3 -3
  76. package/src/pages/settings.tsx +4 -4
  77. package/src/pages/unregistered.tsx +3 -5
  78. package/src/styles/globals.css +12 -7
  79. package/dist/chunks/audit-sentence-BhHmvQX_.js.map +0 -1
  80. package/dist/chunks/delete-place-LYN7z7xb.js.map +0 -1
  81. package/dist/chunks/directory-v87HGjEn.js.map +0 -1
  82. package/dist/chunks/folders-CbGU0xOz.js.map +0 -1
  83. package/dist/chunks/offboarding-DdnmRV1f.js.map +0 -1
  84. package/dist/chunks/principal-page-BubEO6-b.js.map +0 -1
  85. package/dist/chunks/references-DPSYdWOk.js.map +0 -1
@@ -28,13 +28,8 @@ function CloudflareAccessRequired() {
28
28
  return (
29
29
  <ClosedDoor icon={<Lock size={18} />} label="Cloudflare Access" title="Open coffre through Access">
30
30
  <p>
31
- This instance has no sign-in of its own. Cloudflare Access authenticates you before
32
- a request ever reaches coffre, and this request arrived without an Access
33
- assertion.
34
- </p>
35
- <p>
36
- Use the Access-protected hostname. A request straight to the origin is refused by
37
- design.
31
+ Cloudflare Access signs you in to coffre, and this request did not come through it.
32
+ Open coffre at its Access-protected hostname.
38
33
  </p>
39
34
  </ClosedDoor>
40
35
  );
@@ -48,12 +43,12 @@ function CloudflareAuthenticationFailed() {
48
43
  title="Your identity could not be confirmed"
49
44
  >
50
45
  <p>
51
- Cloudflare Access forwarded an identity assertion, but coffre could not verify it.
52
- The Access session may have expired, or the identity verifier may be unavailable.
46
+ coffre could not verify the identity Cloudflare Access sent. Your Access session may
47
+ have expired.
53
48
  </p>
54
49
  <p>
55
50
  Reopen coffre through its Access-protected hostname. If this keeps happening, tell
56
- whoever operates coffre.
51
+ whoever runs coffre.
57
52
  </p>
58
53
  </ClosedDoor>
59
54
  );
@@ -54,7 +54,7 @@ export function OauthAuthorizePage() {
54
54
  </button>
55
55
  }
56
56
  >
57
- <p>{view.message}. Nothing was granted; the app is told why.</p>
57
+ <p>{view.message}. Nothing was granted.</p>
58
58
  </ClosedDoor>
59
59
  );
60
60
  }
@@ -129,9 +129,6 @@ function Approve({
129
129
  <h1 className="signin-title" id="consent-title">
130
130
  Connect {client.name} to coffre?
131
131
  </h1>
132
- <p className="signin-lede">
133
- Only if you just asked it to connect. It acts as you, and can never do more than you can.
134
- </p>
135
132
  </div>
136
133
 
137
134
  <div className="consent-client">
@@ -162,7 +159,7 @@ function Approve({
162
159
  </div>
163
160
  <div className="fact">
164
161
  <dt>For</dt>
165
- <dd>{view.days} days, or until you disconnect it on your account page</dd>
162
+ <dd>{view.days} days</dd>
166
163
  </div>
167
164
  </dl>
168
165
 
@@ -196,26 +193,25 @@ function Approve({
196
193
  <div className="consent-notices">
197
194
  {chosen.has('reveal') && (
198
195
  <Notice tone="bad">
199
- Values will be sent to {client.name}. They become part of the conversation: whoever can read
200
- that conversation, and wherever {client.name} stores it, has them.
196
+ Values will be sent to {client.name}, into the conversation. Anyone who can read that
197
+ conversation, wherever {client.name} stores it, has them.
201
198
  </Notice>
202
199
  )}
203
200
  {view.loopbackOnly && (
204
201
  <Notice tone="warn">
205
202
  The answer goes to a program on this computer, <span className="mono">{view.redirectHost}</span>.
206
- Any program running here could be it: approve only if you just started {client.name} yourself.
203
+ Any program running here could be it. Approve only if you just started {client.name} yourself.
207
204
  </Notice>
208
205
  )}
209
206
  {replaced > 0 && (
210
207
  <Notice tone="info">
211
- This replaces your earlier connection{replaced === 1 ? '' : 's'} of {client.name}, with fewer scopes: {replaced === 1 ? 'it ends' : 'they end'} once
212
- the app has this one.
208
+ This replaces your earlier connection{replaced === 1 ? '' : 's'} of {client.name}.
213
209
  </Notice>
214
210
  )}
215
211
  {kept > 0 && (
216
212
  <Notice tone="info">
217
213
  You have connected {client.name} {kept === 1 ? 'once' : `${kept} times`} already.
218
- This adds another connection; your account page lists them.
214
+ This adds another connection.
219
215
  </Notice>
220
216
  )}
221
217
  <ErrorLine error={error} />
@@ -397,13 +397,13 @@ function EnvironmentCard({
397
397
  body={
398
398
  secretCount === null ? (
399
399
  <>
400
- This changes whether the environment serves secrets to principals who have
401
- access. Values and history remain stored.
400
+ This changes whether the environment serves its secrets. Values and history
401
+ stay stored.
402
402
  </>
403
403
  ) : isArchived ? (
404
404
  <>
405
- The environment starts serving its {secretCount} secret
406
- {secretCount === 1 ? '' : 's'} again, to everyone who holds a grant on it.
405
+ It serves its {secretCount} secret{secretCount === 1 ? '' : 's'} again, to
406
+ everyone with a grant on it.
407
407
  </>
408
408
  ) : (
409
409
  <>
@@ -431,7 +431,7 @@ function EnvironmentCard({
431
431
  path={`${project}/${environment.slug}`}
432
432
  open={deleting}
433
433
  onOpenChange={setDeleting}
434
- onDeleted={() => toast.success(`${project}/${environment.slug} deleted, and its name is free`)}
434
+ onDeleted={() => toast.success(`${project}/${environment.slug} deleted`)}
435
435
  />
436
436
  )}
437
437
 
@@ -550,7 +550,7 @@ function NewEnvironment({ project, sources }: { project: string; sources: string
550
550
  {how === ''
551
551
  ? 'No secrets yet.'
552
552
  : how === 'copy'
553
- ? `Each of ${from}'s keys, with its current value and folder, without history. Copying reads them, in your name.`
553
+ ? `Each of ${from}'s keys, with its current value and folder, without history.`
554
554
  : `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}.`}
555
555
  </span>
556
556
  {copied.length > 0 && (
@@ -192,7 +192,7 @@ function DangerZone({ project }: { project: ProjectSummary }) {
192
192
  <div>
193
193
  <p className="card-row-title">Delete project</p>
194
194
  <p className="card-row-desc">
195
- Erases its values for good and frees its name; only names stay, for the audit log.
195
+ Erases its values for good and frees its name. The audit log keeps the names.
196
196
  </p>
197
197
  </div>
198
198
  <button className="btn btn-danger-outline" onClick={() => setDeleting(true)}>
@@ -207,7 +207,7 @@ function DangerZone({ project }: { project: ProjectSummary }) {
207
207
  open={deleting}
208
208
  onOpenChange={setDeleting}
209
209
  onDeleted={async () => {
210
- toast.success(`${project.slug} deleted, and its name is free`);
210
+ toast.success(`${project.slug} deleted`);
211
211
  await router.navigate({ to: '/projects' });
212
212
  }}
213
213
  />
@@ -224,15 +224,13 @@ function DangerZone({ project }: { project: ProjectSummary }) {
224
224
  body={
225
225
  isArchived ? (
226
226
  <>
227
- The project reappears in listings and its environments start serving reads
228
- again, for everyone who holds a grant on it.
227
+ Its environments serve reads again, to everyone with a grant on it.
229
228
  </>
230
229
  ) : (
231
230
  <>
232
231
  Every environment in <span className="mono">{project.slug}</span> stops serving
233
- reads, including to machine callers already running. Nothing is deleted: values,
234
- versions and the audit trail over them stay intact, and you can restore it here
235
- at any time.
232
+ reads, to machines already running too. Nothing is deleted, and you can restore it
233
+ here at any time.
236
234
  </>
237
235
  )
238
236
  }
@@ -57,8 +57,8 @@ export function ProjectLayout() {
57
57
  {found.archivedAt !== null && (
58
58
  <div style={{ marginBottom: '1.25rem' }}>
59
59
  <Notice tone="bad">
60
- <strong>This project is archived.</strong> Its environments serve no reads, to
61
- people or to machines, until it is restored.
60
+ <strong>This project is archived.</strong> Its environments serve no reads until it
61
+ is restored.
62
62
  </Notice>
63
63
  </div>
64
64
  )}
@@ -249,7 +249,7 @@ function ProjectRow({
249
249
  <span
250
250
  key={environment.slug}
251
251
  className="env-link"
252
- title="You can see this environment exists, but not open it"
252
+ title="You can't open this environment"
253
253
  >
254
254
  {environment.slug}
255
255
  </span>
@@ -303,7 +303,7 @@ function NewProject() {
303
303
  open={open}
304
304
  onOpenChange={(next) => (next ? setOpen(true) : close())}
305
305
  title="New project"
306
- description="A project holds environments, and access is granted on it or on one of its environments. You become its owner."
306
+ description="A project holds environments. You become its owner."
307
307
  >
308
308
  <form
309
309
  className="form"
@@ -330,7 +330,7 @@ function NewProject() {
330
330
  onChange={(event) => setSlug(event.target.value)}
331
331
  />
332
332
  <span className={`hint${slugError !== null ? ' edit-note-error' : ''}`} id="new-project-slug-hint">
333
- {slugError ?? 'Used in paths, as in market/prod. Renaming it later is safe.'}
333
+ {slugError ?? 'Used in paths, as in market/prod.'}
334
334
  </span>
335
335
  </label>
336
336
 
@@ -29,7 +29,7 @@ export function SettingsPage() {
29
29
  <Card
30
30
  labelledBy="instance"
31
31
  title="Instance"
32
- description="Set in the deployment's configuration, so shown here rather than edited."
32
+ description="Set in the deployment's configuration, not here."
33
33
  >
34
34
  <dl className="facts">
35
35
  <Fact label="Sign-in">
@@ -39,7 +39,7 @@ export function SettingsPage() {
39
39
  label={
40
40
  auth?.signin
41
41
  ? 'coffre’s own sign-in. Only invited members get in.'
42
- : 'coffre has no sign-in of its own: every request carries an Access assertion, verified at the origin.'
42
+ : 'Cloudflare Access signs people in, and coffre verifies each request.'
43
43
  }
44
44
  >
45
45
  <button type="button" className="fact-tip" aria-label="About sign-in">
@@ -94,8 +94,8 @@ function Keys({ keys }: { keys: RouteOutput<'GET /audit/keys'> }) {
94
94
  title="Keys"
95
95
  description={
96
96
  <>
97
- What the vault key and app key you keep are checked against. Check the keys themselves
98
- with <code>coffre verify keys</code>, which reads them on your machine and sends neither.
97
+ To check your vault key and app key against these, run <code>coffre verify keys</code>.
98
+ It reads them on your machine and sends neither.
99
99
  </>
100
100
  }
101
101
  >
@@ -22,10 +22,9 @@ export function UnregisteredPage() {
22
22
  (<span className="mono">{principal.id}</span>)
23
23
  </>
24
24
  )}{' '}
25
- was changed outside coffre, so its vault refuses it until someone looks. Nothing you
26
- held is available meanwhile.
25
+ was changed outside coffre, so the vault refuses it and you have no access.
27
26
  </p>
28
- <p>Ask a coffre owner to remove you under Users and add you again, which starts your access over.</p>
27
+ <p>To start over, ask a coffre owner to remove you under Users and add you again.</p>
29
28
  </ClosedDoor>
30
29
  );
31
30
  }
@@ -44,8 +43,7 @@ export function UnregisteredPage() {
44
43
  (<span className="mono">{principal.id}</span>)
45
44
  </>
46
45
  )}
47
- , but this coffre instance has not registered that identity. Until it does, no
48
- projects, secrets, audit entries or API operations are available to you.
46
+ , but coffre has not added you.
49
47
  </p>
50
48
  <p>
51
49
  Ask a coffre owner or root admin to add your Access email under Users.
@@ -2335,12 +2335,7 @@ a.crumb-link:hover {
2335
2335
  border-bottom: 0;
2336
2336
  }
2337
2337
 
2338
- .history-note {
2339
- padding: 0.5rem 0.875rem;
2340
- border-top: 1px solid var(--border);
2341
- color: var(--ink-3);
2342
- font-size: 0.75rem;
2343
- }
2338
+
2344
2339
 
2345
2340
  .history-body {
2346
2341
  padding: 0.75rem 0.875rem;
@@ -4206,7 +4201,17 @@ a.env-card-name:hover {
4206
4201
  padding-bottom: 1rem;
4207
4202
  }
4208
4203
 
4209
- /* The approval page: a value the person types, and a token shown once. */
4204
+ /* The approval page: what coffre says an ID is, a value the person types, and a token shown once. */
4205
+ .approval-note {
4206
+ color: var(--ink-2);
4207
+ font-size: 0.8125rem;
4208
+ }
4209
+
4210
+ .approval-warn {
4211
+ color: var(--amber);
4212
+ font-weight: 550;
4213
+ }
4214
+
4210
4215
  .approval-field {
4211
4216
  margin: 0 1.5rem 1rem;
4212
4217
  }
@@ -1 +0,0 @@
1
- {"version":3,"file":"audit-sentence-BhHmvQX_.js","names":[],"sources":["../../src/lib/audit-sentences.ts","../../src/components/audit-sentence.tsx"],"sourcesContent":["/**\n * The audit log in sentences: who did what, to what. One entry is one\n * human action, named for it (`secret.read`, `access.grant`, …); a batch of\n * them, one reveal of twelve secrets, shares an operation and reads as one\n * line, \"ran market/prod: 12 secrets\".\n *\n * A sentence is parts rather than a string, so the page can make the people\n * and places in it links. `plain` flattens it, for tests and titles.\n */\nimport { shownMember, type AuditEntryView } from '@coffre/client';\n\n/** What a sentence is made from: an entry of the log, as `GET /api/audit` gives it. */\nexport type AuditEntry = Pick<\n AuditEntryView,\n | 'seq'\n | 'author'\n | 'actorType'\n | 'actorId'\n | 'action'\n | 'decision'\n | 'reason'\n | 'detail'\n | 'subject'\n | 'project'\n | 'environment'\n | 'key'\n | 'version'\n | 'operationId'\n | 'metadata'\n>;\n\n/**\n * Text, a place (`market`, `market/prod`, `market/prod/KEY`), or a member,\n * as the log stores it (`user:…`, `token:…`): `shownMember` says it as people\n * read it, `service:…`, where it is shown.\n */\nexport type Part = string | { place: string } | { member: string };\n\nexport type Sentence = { parts: Part[]; refused: boolean };\n\n/** What one template needs: the line's leading entry, its batch, and how it was decided. */\ntype Facts = {\n entry: AuditEntry;\n /** Every entry of the batch, the lead included. */\n batch: AuditEntry[];\n /** Secrets the batch was about. */\n count: number;\n refused: boolean;\n};\n\ntype Template = {\n /** What they did: \"revealed\". */\n did: string | ((facts: Facts) => string);\n /** What they tried, after \"tried to\": \"reveal\". */\n tried: string | ((facts: Facts) => string);\n /** To what: \"market/prod/API_KEY\". */\n what: (facts: Facts) => Part[];\n /** Said only of what happened: \", now version 5\". */\n then?: (facts: Facts) => Part[];\n};\n\n// --- the pieces of a sentence ---------------------------------------------------\n\nconst text = (value: unknown): string | null => (typeof value === 'string' && value !== '' ? value : null);\nconst number = (value: unknown): number | null => (typeof value === 'number' ? value : null);\n\n/** The entry's place, as deep as it goes. */\nfunction place({ project, environment, key }: AuditEntry): Part[] {\n const path = [project, environment, key].filter((part): part is string => part !== null);\n return path.length === 0 ? ['coffre'] : [{ place: path.join('/') }];\n}\n\nfunction environmentOf({ project, environment }: AuditEntry): Part[] {\n return place({ project, environment, key: null } as AuditEntry);\n}\n\n/** The member an entry is about: its subject, or the principal a token entry names. */\nfunction subject(entry: AuditEntry): Part[] {\n if (entry.subject !== null) return [{ member: entry.subject }];\n const id = text(entry.metadata.principalId);\n if (id === null) return ['someone'];\n return [{ member: `${entry.metadata.principalType === 'service' ? 'token' : 'user'}:${id}` }];\n}\n\n/** An MCP client, by the name it connected under. */\nfunction app(entry: AuditEntry): Part[] {\n return [text(entry.metadata.clientName) ?? 'an app'];\n}\n\n/** A tool's call: its name, and what it named. */\nfunction tool(entry: AuditEntry): Part[] {\n const names = Array.isArray(entry.metadata.names) ? entry.metadata.names.filter((name): name is string => typeof name === 'string') : [];\n return [text(entry.metadata.tool) ?? 'a tool', ...(names.length === 0 ? [] : [` on ${names.join(', ')}`])];\n}\n\n/** The client a request came through, said after what it did: \"via Claude\". */\nfunction via(entry: AuditEntry): Part[] {\n const client = (entry.metadata.via as { clientName?: unknown } | undefined)?.clientName;\n return typeof client === 'string' ? [` via ${client}`] : [];\n}\n\n/** Why coffre itself ended a connection, said after it. */\nconst DISCONNECTED: Record<string, string> = {\n code_reused: ': its sign-in code was used twice',\n refresh_reused: ': a refresh token it had replaced was used again',\n revocation_endpoint: ', at its own request',\n superseded: ': a connection with more scopes replaced it',\n};\n\nfunction plural(count: number, one: string, many = `${one}s`): string {\n return `${count} ${count === 1 ? one : many}`;\n}\n\n/** A batch reads as its environment and a count; one entry as its secret. */\n/**\n * The secrets a read or write was about. A read through a reference is a\n * read of its source, \"market/prod/DATABASE_URL through\n * billing/prod/DATABASE_URL\"; a run that read some that way is a run of\n * the environment that holds them.\n */\nfunction secrets(facts: Facts): Part[] {\n const through = (entry: AuditEntry) => text((entry.metadata.via as { path?: unknown } | undefined)?.path);\n if (facts.batch.length === 1) {\n const held = through(facts.entry);\n return held === null ? place(facts.entry) : [...place(facts.entry), ' through ', { place: held }];\n }\n const own = facts.batch.find((entry) => through(entry) === null);\n const held = facts.batch.map(through).filter((path): path is string => path !== null);\n const where = own !== undefined ? environmentOf(own) : [{ place: held[0]!.split('/').slice(0, 2).join('/') }];\n return [\n ...where,\n facts.refused ? ', ' : ': ',\n plural(facts.count, 'secret'),\n ...(held.length === 0 ? [] : [`, ${held.length} through ${held.length === 1 ? 'a reference' : 'references'}`]),\n ];\n}\n\n/** \"market/prod/OLD\", or \"OLD and STALE in market/prod\" for an archive of several keys refused. */\nfunction archivedKeys(entry: AuditEntry): Part[] {\n const keys = Array.isArray(entry.metadata.keys) ? entry.metadata.keys.filter((key): key is string => text(key) !== null) : [];\n if (entry.key !== null || keys.length === 0) return place(entry);\n return [keys.length === 1 ? keys[0]! : `${keys.slice(0, -1).join(', ')} and ${keys.at(-1)!}`, ' in ', ...environmentOf(entry)];\n}\n\n/** \"SENTRY_DSN in market/dev\", or \"3 keys in market/dev\" for a Dismiss all. */\nfunction missingKeys(facts: Facts): Part[] {\n const key = text(facts.entry.metadata.key);\n return [facts.batch.length === 1 && key !== null ? key : plural(facts.count, 'key'), ' in ', ...environmentOf(facts.entry)];\n}\n\n/** \"billing/prod/DATABASE_URL a reference to market/prod/DATABASE_URL\", from either author's entry. */\nfunction referenceTo(entry: AuditEntry): Part[] {\n const holder = text(entry.metadata.subject);\n const key = text(entry.metadata.key);\n const source = text(entry.metadata.source) ?? text((entry.metadata.source as { path?: unknown } | undefined)?.path);\n return [\n ...(holder !== null ? [{ place: holder }] : key !== null ? place(entry) : environmentOf(entry)),\n ...(source === null ? [] : [' a reference to ', { place: source }]),\n ];\n}\n\nconst READ_VERBS: Record<string, [did: string, tried: string]> = {\n reveal: ['revealed', 'reveal'],\n run: ['ran', 'run'],\n compare: ['compared', 'compare'],\n copy: ['copied', 'copy'],\n};\n\nfunction readVerb({ entry }: Facts): [string, string] {\n return READ_VERBS[text(entry.metadata.purpose) ?? 'reveal'] ?? READ_VERBS.reveal!;\n}\n\nconst placeTemplates = (kind: 'project' | 'environment'): Record<string, Template> => {\n const what = (facts: Facts): Part[] => [`${kind} `, ...(kind === 'project' ? place({ ...facts.entry, environment: null, key: null }) : environmentOf(facts.entry))];\n return {\n [`${kind}.create`]: {\n did: 'created',\n tried: 'create',\n what,\n // A fork names the environment it copied.\n then: ({ entry }) => (text(entry.metadata.from) === null ? [] : [`, a fork of ${text(entry.metadata.from)}`]),\n },\n [`${kind}.update`]: { did: 'changed', tried: 'change', what },\n [`${kind}.archive`]: { did: 'archived', tried: 'archive', what },\n [`${kind}.restore`]: { did: 'restored', tried: 'restore', what },\n // Named by its tombstone from then on, `market~deleted-2026-10-05`, as every entry about it is.\n [`${kind}.delete`]: { did: 'deleted', tried: 'delete', what },\n };\n};\n\n// --- one template per action ----------------------------------------------------\n\nconst TEMPLATES: Record<string, Template> = {\n 'secret.read': {\n did: (facts) => readVerb(facts)[0],\n tried: (facts) => readVerb(facts)[1],\n what: secrets,\n },\n 'secret.write': {\n // New secrets are added, others changed; a batch of both is written.\n did: ({ batch }) => {\n const firsts = batch.filter((entry) => entry.version === 1).length;\n return firsts === batch.length ? 'added' : firsts === 0 ? 'changed' : 'wrote';\n },\n tried: 'change',\n what: secrets,\n then: ({ entry, batch }) =>\n batch.length > 1 || entry.version === null || entry.version === 1 ? [] : [`, now version ${entry.version}`],\n },\n 'secret.restore': {\n did: 'restored',\n tried: 'restore',\n what: ({ entry }) => [...place(entry), ...(number(entry.metadata.from) === null ? [] : [` to version ${number(entry.metadata.from)}`])],\n then: ({ entry }) => (entry.version === null ? [] : [`, now ${entry.version}`]),\n },\n 'secret.rename': {\n did: 'renamed',\n tried: 'rename',\n what: ({ entry }) => [...place(entry), ...(text(entry.metadata.nextKey) === null ? [] : [` to ${text(entry.metadata.nextKey)}`])],\n },\n 'secret.archive': { did: 'archived', tried: 'archive', what: ({ entry }) => archivedKeys(entry) },\n 'missing.dismiss': {\n did: 'dismissed',\n tried: 'dismiss',\n what: (facts) => missingKeys(facts),\n then: () => [' as not needed'],\n },\n 'missing.restore': { did: 'restored', tried: 'restore', what: (facts) => missingKeys(facts), then: () => [' to the missing keys'] },\n 'secret.reference': { did: 'made', tried: 'make', what: ({ entry }) => referenceTo(entry) },\n 'reference.create': { did: 'made', tried: 'make', what: ({ entry }) => referenceTo(entry) },\n 'reference.end': {\n did: ({ entry }) => (entry.metadata.reason === 'replaced' ? 'gave a value of its own to' : entry.metadata.reason === 'abandoned' ? 'abandoned' : 'broke'),\n tried: ({ entry }) => (entry.metadata.reason === 'replaced' ? 'replace' : entry.metadata.reason === 'abandoned' ? 'abandon' : 'break'),\n what: ({ entry }) => {\n const source = text((entry.metadata.source as { path?: unknown } | undefined)?.path);\n const holder = text(entry.metadata.subject);\n if (entry.metadata.reason === 'replaced') return [...(holder === null ? ['a reference'] : [{ place: holder }]), ...(source === null ? [] : [', no longer a reference to ', { place: source }])];\n return ['the reference ', ...(holder === null ? [] : [{ place: holder }]), ...(source === null ? [] : [' to ', { place: source }])];\n },\n then: ({ entry }) => (entry.metadata.reason === 'abandoned' ? [', which its write never stored'] : []),\n },\n 'secret.unarchive': { did: 'brought back', tried: 'bring back', what: (facts) => place(facts.entry) },\n 'secret.move': { did: 'moved', tried: 'move', what: (facts) => place(facts.entry), then: ({ entry }) => intoFolder(entry) },\n ...placeTemplates('project'),\n 'project.move': {\n did: 'moved',\n tried: 'move',\n what: ({ entry }) => ['project ', ...place({ ...entry, environment: null, key: null })],\n then: ({ entry }) => intoFolder(entry),\n },\n ...placeTemplates('environment'),\n 'environment.fork': {\n did: 'forked',\n tried: 'fork',\n what: ({ entry }) => [...environmentOf(entry), ...(text(entry.metadata.slug) === null ? [] : [` into ${text(entry.metadata.slug)}`])],\n },\n 'access.grant': {\n did: 'gave',\n tried: 'give',\n what: ({ entry }) => [...subject(entry), ` ${text(entry.metadata.role) ?? 'a role'} on `, ...placeOnly(entry)],\n then: ({ entry }) => [\n ...(text(entry.metadata.previousRole) === null ? [] : [`, was ${text(entry.metadata.previousRole)}`]),\n ...(text(entry.metadata.expiresAt) === null ? [] : [`, until ${text(entry.metadata.expiresAt)!.slice(0, 10)}`]),\n ],\n },\n 'access.revoke': {\n did: 'took',\n tried: 'take',\n what: ({ entry }) => [\n ...(text(entry.metadata.previousRole ?? entry.metadata.role) === null ? ['access to '] : [`${text(entry.metadata.previousRole ?? entry.metadata.role)} on `]),\n ...placeOnly(entry),\n ' from ',\n ...subject(entry),\n ],\n },\n 'member.add': {\n did: 'added',\n tried: 'add',\n what: ({ entry }) => [\n ...subject(entry),\n ...(entry.metadata.rootAdmin === true ? [' as a root admin'] : entry.metadata.owner === true ? [' as an owner'] : []),\n ],\n },\n 'member.remove': {\n did: 'removed',\n tried: 'remove',\n what: (facts) => subject(facts.entry),\n then: ({ entry }) => (number(entry.metadata.revoked) === null ? [] : [`, who held ${plural(number(entry.metadata.revoked)!, 'grant')}`]),\n },\n 'member.restore': { did: 'brought back', tried: 'bring back', what: (facts) => subject(facts.entry) },\n 'member.owner': {\n did: ({ entry }) => (entry.metadata.owner === false ? 'took owner from' : 'made'),\n tried: ({ entry }) => (entry.metadata.owner === false ? 'take owner from' : 'make'),\n what: ({ entry }) => [...subject(entry), ...(entry.metadata.owner === false ? [] : [' an owner'])],\n },\n // A binding trusts CI runs to sign in as a service; removing one is its tombstone.\n 'token.bind': {\n did: 'trusted CI runs to sign in as',\n tried: 'trust CI runs to sign in as',\n what: (facts) => subject(facts.entry),\n },\n 'token.unbind': {\n did: 'stopped trusting CI runs to sign in as',\n tried: 'stop trusting CI runs to sign in as',\n what: (facts) => subject(facts.entry),\n },\n 'vault.tampered': {\n did: 'found',\n tried: 'check',\n what: ({ entry }) => [\n ...(entry.subject === null ? ['an entry'] : [...subject(entry), \"'s record\"]),\n ` tampered with: ${TAMPERING[entry.reason ?? ''] ?? 'it fails its seal'}`,\n ],\n },\n 'key.rotate': { did: 'rotated its key', tried: 'rotate its key', what: () => [] },\n // An MCP client a person connected, such as Claude: named as the consent page showed it.\n 'mcp.connect': { did: 'connected', tried: 'connect', what: ({ entry }) => app(entry) },\n // A tool an MCP client called, by its name, and the places it named.\n 'mcp.call': { did: 'used', tried: 'use', what: ({ entry }) => tool(entry), then: ({ entry }) => via(entry) },\n // A person's decision, on coffre's page, on a change an MCP client asked for; the change's own entries follow, via the client.\n 'mcp.approve': { did: 'approved', tried: 'approve', what: ({ entry }) => tool(entry), then: ({ entry }) => [` for ${text(entry.metadata.clientName) ?? 'an app'}`] },\n 'mcp.deny': { did: 'turned down', tried: 'turn down', what: ({ entry }) => tool(entry), then: ({ entry }) => [` for ${text(entry.metadata.clientName) ?? 'an app'}`] },\n 'mcp.view': { did: 'opened an approval', tried: 'open an approval', what: () => [] },\n 'mcp.disconnect': {\n did: 'disconnected',\n tried: 'disconnect',\n what: ({ entry }) => [...app(entry), ...(entry.metadata.principalId === undefined ? [] : [' of ', ...subject(entry)])],\n then: ({ entry }) => [DISCONNECTED[text(entry.metadata.reason) ?? ''] ?? ''],\n },\n\n // Detail, hidden unless asked for.\n sign_in: {\n did: ({ entry }) => (entry.metadata.kind === 'cli' ? 'signed in to the CLI' : 'signed in'),\n tried: 'sign in',\n what: ({ entry }) => (text(entry.metadata.provider) === null ? [] : [`with ${text(entry.metadata.provider)}`]),\n },\n sign_out: { did: 'signed out', tried: 'sign out', what: () => [] },\n 'token.create': { did: 'issued a bearer token to', tried: 'issue a bearer token to', what: (facts) => subject(facts.entry) },\n 'token.revoke': { did: 'revoked a bearer token of', tried: 'revoke a bearer token of', what: (facts) => subject(facts.entry) },\n 'device.approve': { did: 'approved a CLI sign-in', tried: 'approve a CLI sign-in', what: () => [] },\n 'device.deny': { did: 'turned down a CLI sign-in', tried: 'turn down a CLI sign-in', what: () => [] },\n 'mcp.read': { did: 'used', tried: 'use', what: ({ entry }) => tool(entry), then: ({ entry }) => via(entry) },\n 'mcp.token': {\n did: ({ entry }) => (entry.metadata.grant === 'refresh_token' ? 'refreshed the tokens of' : 'gave its first tokens to'),\n tried: 'give tokens to',\n what: ({ entry }) => app(entry),\n },\n 'account.link': {\n did: 'linked',\n tried: 'link',\n what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? 'sign-in'} account`],\n },\n 'account.unlink': {\n did: 'unlinked',\n tried: 'unlink',\n what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? 'sign-in'} account`],\n },\n 'key.wrap': { did: 'sealed the key of', tried: 'seal the key of', what: (facts) => versioned(facts.entry) },\n 'key.rewrap': { did: 'resealed the key of', tried: 'reseal the key of', what: (facts) => versioned(facts.entry) },\n 'key.intent': { did: 'asked KMS about', tried: 'ask KMS about', what: (facts) => secrets(facts) },\n 'key.check': {\n did: 'recorded the check value of',\n tried: 'check',\n what: ({ entry }) => [['the', text(entry.metadata.kekProvider) === 'local' ? null : text(entry.metadata.kekProvider), 'vault key', text(entry.metadata.kekId)].filter((word) => word !== null).join(' ')],\n },\n 'audit.heartbeat': { did: 'checked in', tried: 'check in', what: () => [] },\n 'audit.checkpoint': {\n did: 'signed the log',\n tried: 'sign the log',\n what: ({ entry }) => (number(entry.metadata.seq) === null ? [] : [`through entry ${number(entry.metadata.seq)}`]),\n },\n\n // Only ever refused: a read of a list, which is not logged when allowed.\n 'secret.list': { did: 'listed', tried: 'list', what: ({ entry }) => environmentOf(entry) },\n 'secret.history': { did: 'read the history of', tried: 'read the history of', what: (facts) => place(facts.entry) },\n 'secret.update': { did: 'changed', tried: 'change', what: (facts) => place(facts.entry) },\n};\n\n/** \" to the folder stripe\", or \" out of its folder\". */\nfunction intoFolder(entry: AuditEntry): Part[] {\n const folder = text(entry.metadata.to);\n return [folder === null ? ' out of its folder' : ` to the folder ${folder}`];\n}\n\nfunction placeOnly(entry: AuditEntry): Part[] {\n // A grant on every project names no project: its place is a path in its payload, `*` or `*/dev`.\n const everywhere = entry.project === null ? text(entry.metadata.place) : null;\n if (everywhere !== null) return [everywhere === '*' ? 'every project' : `${everywhere.slice('*/'.length)} in every project`];\n return place({ ...entry, key: null });\n}\n\nfunction versioned(entry: AuditEntry): Part[] {\n return [...place(entry), ...(entry.version === null ? [] : [`, version ${entry.version}`])];\n}\n\nconst TAMPERING: Record<string, string> = {\n mac: \"it does not carry the vault's seal\",\n stale: 'an older copy was put back',\n forged_entry: 'the vault did not write it',\n};\n\n/** Why something was refused, in words. Codes from the vault and the app. */\nconst REASONS: Record<string, string> = {\n no_grant: 'no grant',\n bulk_limit: 'bulk limit',\n expired: 'grant expired',\n removed: 'removed from coffre',\n not_a_member: 'not a member',\n not_registered: 'not invited',\n tampered: 'their record was tampered with',\n bad_claim: 'the key did not match the secret',\n deleted: 'the place was deleted',\n not_allowed: 'not allowed',\n root_admin: 'root admins are set by the deployment',\n unknown_environment: 'no such environment',\n unknown_secret: 'no such secret',\n no_value: 'it holds no value',\n unknown_project: 'no such project',\n not_archived: 'it was not archived',\n referenced: 'references read it',\n kms_unavailable: 'KMS did not answer',\n wrong_kek: \"the vault's key is not the one that wrapped the data\",\n person_denied: 'they said no',\n too_many_connections: 'too many connected apps',\n unknown_connection: 'no such connected app',\n not_yours: \"it was someone else's\",\n too_many_approvals: 'too many changes waiting for approval',\n request_state: 'its retry did not match its call',\n changed: 'the change was not the one shown',\n};\n\n/** What a missing permission meant, from the app's `missing_<permission>`. */\nconst MISSING: Record<string, string> = {\n secret_read: 'no grant to read it',\n secret_write: 'no grant to write',\n secret_archive: 'no grant to archive',\n audit_read: 'no grant to read the audit log',\n environment_manage: 'no grant to manage environments',\n grant_manage: 'no grant to manage access',\n project_manage: 'no grant to manage the project',\n};\n\nexport function reasonInWords(reason: string | null): string {\n if (reason === null) return 'refused';\n if (reason.startsWith('missing_')) return MISSING[reason.slice('missing_'.length)] ?? 'no grant';\n return REASONS[reason] ?? reason.replace(/_/g, ' ');\n}\n\n// --- lines ----------------------------------------------------------------------\n\n/** In a batch of mixed actions, the one the line is named for: a write, not its reads. */\nconst LEAD = ['secret.write', 'secret.read'];\n\nexport function leadOf(batch: AuditEntry[]): AuditEntry {\n for (const action of LEAD) {\n const found = batch.find((entry) => entry.action === action);\n if (found !== undefined) return found;\n }\n return batch[0]!;\n}\n\n/** What a line says: one entry, or a batch that shares an operation. */\nexport function describe(batch: AuditEntry[]): Sentence {\n const entry = leadOf(batch);\n const same = batch.filter((other) => other.action === entry.action);\n const denied = same.filter((other) => other.decision === 'deny');\n const refused = denied.length === same.length;\n const facts: Facts = {\n entry,\n batch: same,\n count: new Set(same.map((other) => `${other.project}/${other.environment}/${other.key}`)).size,\n refused,\n };\n const template = TEMPLATES[entry.action];\n if (template === undefined) return { parts: [entry.action, ' ', ...place(entry)], refused };\n const say = (verb: Template['did']) => (typeof verb === 'string' ? verb : verb(facts));\n const what = template.what(facts);\n const gap = what.length === 0 ? [] : [' '];\n if (refused) {\n const reason = reasonInWords((denied[0] ?? entry).reason);\n return { parts: ['tried to ', say(template.tried), ...gap, ...what, `: ${reason}`], refused };\n }\n const partly = denied.length === 0 ? [] : [`, ${denied.length} refused: ${reasonInWords(denied[0]!.reason)}`];\n return { parts: [say(template.did), ...gap, ...what, ...(template.then?.(facts) ?? []), ...partly], refused };\n}\n\n/** Who acted, as a part: a member links to their page; coffre itself is text. */\nexport function who(entry: Pick<AuditEntry, 'actorType' | 'actorId'>): string | { member: string } {\n if (entry.actorType === 'user') return { member: `user:${entry.actorId}` };\n if (entry.actorType === 'service') return { member: `token:${entry.actorId}` };\n return SYSTEM[entry.actorId] ?? entry.actorId;\n}\n\nconst SYSTEM: Record<string, string> = {\n scheduler: 'the scheduler',\n cron: 'the scheduler',\n vault: 'the vault',\n app: 'coffre',\n};\n\n/** Which components wrote the line, the vault first: \"vault\", \"app\", \"vault, app\". */\nexport function decidedBy(batch: Pick<AuditEntry, 'author'>[]): string {\n return (['vault', 'app'] as const).filter((author) => batch.some((entry) => entry.author === author)).join(', ');\n}\n\n/**\n * Entries in the order the page shows them, newest first, each batch as one\n * line at its newest entry. The server leaves detail out unless asked.\n */\nexport function lines<T extends AuditEntry>(entries: T[]): T[][] {\n const shown: T[][] = [];\n const batches = new Map<string, T[]>();\n for (const entry of entries) {\n const batch = entry.operationId === null ? undefined : batches.get(entry.operationId);\n if (batch !== undefined) {\n batch.push(entry);\n continue;\n }\n const fresh = [entry];\n if (entry.operationId !== null) batches.set(entry.operationId, fresh);\n shown.push(fresh);\n }\n return shown;\n}\n\n/** A sentence as text. */\nexport function plain(parts: Part[]): string {\n return parts\n .map((part) =>\n typeof part === 'string' ? part : 'place' in part ? part.place : part.member.startsWith('user:') ? part.member.slice(5) : shownMember(part.member),\n )\n .join('');\n}\n\n/**\n * The CI run an entry was written for, as its issuer stated it at the\n * exchange: `acme/api run 7001 at 3f2a9c1`, a GitLab pipeline, or the\n * token's subject. Null for an entry no trust binding's credential wrote.\n */\nexport function runLabel(run: { claims: Record<string, string | number> } | null): string | null {\n if (run === null) return null;\n const { claims } = run;\n const text = (name: string) => (typeof claims[name] === 'string' || typeof claims[name] === 'number' ? String(claims[name]) : null);\n const at = text('sha') === null ? '' : ` at ${text('sha')!.slice(0, 7)}`;\n if (text('repository') !== null && text('run_id') !== null) return `${text('repository')} run ${text('run_id')}${at}`;\n if (text('project_path') !== null && text('pipeline_id') !== null) return `${text('project_path')} pipeline ${text('pipeline_id')}${at}`;\n return text('sub') === null ? 'a CI run' : `CI run ${text('sub')}`;\n}\n","import { serviceName, shownMember } from '@coffre/client';\nimport { Fragment } from 'react';\nimport { Link } from '@tanstack/react-router';\nimport type { Part } from '../lib/audit-sentences';\nimport { breakAfterUnderscores } from './ui';\n\n/** A sentence, its people and places links to their pages. */\nexport function Sentence({ parts }: { parts: Part[] }) {\n return (\n <>\n {parts.map((part, index) => (\n <Fragment key={index}>\n {typeof part === 'string' ? (\n part\n ) : 'place' in part ? (\n <PlaceLink path={part.place} />\n ) : (\n <MemberLink member={part.member} />\n )}\n </Fragment>\n ))}\n </>\n );\n}\n\nfunction PlaceLink({ path }: { path: string }) {\n const [project, environment] = path.split('/') as [string, string | undefined];\n const text = <span className=\"mono\">{breakAfterUnderscores(path)}</span>;\n return environment === undefined ? (\n <Link to=\"/projects/$project\" params={{ project }}>\n {text}\n </Link>\n ) : (\n <Link to=\"/projects/$project/$environment\" params={{ project, environment }}>\n {text}\n </Link>\n );\n}\n\n/** A member from the log, which keeps `token:<name>`, shown as people read it: `service:<name>`, to its page. */\nfunction MemberLink({ member }: { member: string }) {\n return member.startsWith('token:') ? (\n <Link to=\"/service-accounts/$account\" params={{ account: serviceName(member) }}>\n {shownMember(member)}\n </Link>\n ) : (\n <Link to=\"/users/$user\" params={{ user: memberName(member) }}>\n {memberName(member)}\n </Link>\n );\n}\n\nexport function memberName(member: string): string {\n return member.startsWith('user:') ? member.slice('user:'.length) : shownMember(member);\n}\n"],"mappings":";;;;;;AA+DA,IAAM,QAAQ,UAAmC,OAAO,UAAU,YAAY,UAAU,KAAK,QAAQ;AACrG,IAAM,UAAU,UAAmC,OAAO,UAAU,WAAW,QAAQ;;AAGv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AQ;GAAE;GAAS;EAAY;YACvE;CACG,CAAA;AAEV;;AAGA,SAAS,WAAW,EAAE,UAA8B;CAClD,OAAO,OAAO,WAAW,QAAQ,IAC/B,oBAAC,MAAD;EAAM,IAAG;EAA6B,QAAQ,EAAE,SAAS,YAAY,MAAM,EAAE;YAC1E,YAAY,MAAM;CACf,CAAA,IAEN,oBAAC,MAAD;EAAM,IAAG;EAAe,QAAQ,EAAE,MAAM,WAAW,MAAM,EAAE;YACxD,WAAW,MAAM;CACd,CAAA;AAEV;AAEA,SAAgB,WAAW,QAAwB;CACjD,OAAO,OAAO,WAAW,OAAO,IAAI,OAAO,MAAM,CAAc,IAAI,YAAY,MAAM;AACvF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"delete-place-LYN7z7xb.js","names":[],"sources":["../../src/components/delete-place.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { shownMember, type Deletion } from '@coffre/client';\n\nimport { useCoffre } from '../lib/coffre';\nimport { affects, queries } from '../lib/queries';\nimport { useAction } from '../lib/use-action';\nimport { Trash } from './icons';\nimport { ErrorLine, Modal, Notice, Spinner } from './ui';\n\n/**\n * Deleting an archived project or environment for good, `market` or\n * `market/prod`. The dialog first asks the server what the deletion would\n * take, then needs the place's path typed out before it deletes: nothing\n * brings it back, so the one click a slip can make is never enough.\n */\nexport function DeletePlaceDialog({\n path,\n open,\n onOpenChange,\n onDeleted,\n}: {\n path: string;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n onDeleted: (deletion: Deletion) => unknown;\n}) {\n const coffre = useCoffre();\n const plan = useQuery({ ...queries.deletion(coffre, path), enabled: open });\n const [typed, setTyped] = useState('');\n const { pending, error, setError, run } = useAction();\n const what = path.includes('/') ? 'environment' : 'project';\n\n useEffect(() => {\n if (!open) return;\n setTyped('');\n setError(null);\n }, [open, setError]);\n\n const deletion = plan.data?.ok === true ? plan.data.deletion : null;\n\n return (\n <Modal\n open={open}\n onOpenChange={onOpenChange}\n title={\n <>\n Delete <span className=\"mono\">{path}</span> for good?\n </>\n }\n >\n <div className=\"dialog-body\">\n {plan.data === undefined ? (\n <Spinner />\n ) : plan.data.ok ? (\n <DeletionSummary deletion={plan.data.deletion} what={what} />\n ) : (\n <ErrorLine error={plan.data.error} />\n )}\n </div>\n <div className=\"dialog-body\">\n <Notice tone=\"bad\">\n Nothing brings it back. Backups of the database taken before now still hold its\n encrypted values; only they, with the vault key, could restore them.\n </Notice>\n </div>\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n if (typed !== path || deletion === null) return;\n run(\n () => (what === 'project' ? coffre.projects.delete(path) : coffre.environments.delete(path)),\n {\n affects: affects.places(),\n onSuccess: (result) => {\n onOpenChange(false);\n return onDeleted(result.deletion);\n },\n },\n );\n }}\n >\n <label className=\"field\">\n <span className=\"label\">\n Type <span className=\"mono\">{path}</span> to confirm\n </span>\n <input\n className=\"input input-mono\"\n autoFocus\n spellCheck={false}\n autoComplete=\"off\"\n value={typed}\n onChange={(event) => setTyped(event.target.value)}\n />\n </label>\n <ErrorLine error={error} />\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={() => onOpenChange(false)}>\n Cancel\n </button>\n <button\n className=\"btn btn-danger\"\n type=\"submit\"\n disabled={typed !== path || deletion === null || pending}\n >\n {pending ? <Spinner /> : <Trash size={14} />}\n Delete {what}\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n\n/** What the deletion takes and what it keeps, in the server's numbers. */\nfunction DeletionSummary({ deletion, what }: { deletion: Deletion; what: 'project' | 'environment' }) {\n const count = (n: number, one: string) => `${n} ${one}${n === 1 ? '' : 's'}`;\n const environments = what === 'project' && deletion.environments.length > 0 ? (\n <>\n {' '}\n in <span className=\"mono\">{deletion.environments.join(', ')}</span>\n </>\n ) : null;\n return (\n <ul className=\"deletion-summary\">\n <li>\n <strong>Erased:</strong> the values of {count(deletion.versions, 'secret version')}\n {environments}, ciphertext and wrapped key both.\n </li>\n <li>\n <strong>Revoked:</strong> {count(deletion.grants.length, 'grant')}\n {deletion.grants.length > 0 && (\n <>\n {', '}\n {deletion.grants.map((grant, index) => (\n <span key={`${grant.member} ${grant.place}`}>\n {index > 0 && ', '}\n <span className=\"mono\">{shownMember(grant.member)}</span> on{' '}\n <span className=\"mono\">{grant.place}</span>\n </span>\n ))}\n </>\n )}\n .\n </li>\n {deletion.references.length > 0 && (\n <li>\n <strong>Ended:</strong> {count(deletion.references.length, 'reference')}, which read it from\n elsewhere or which it reads:{' '}\n {deletion.references.map((reference, index) => (\n <span key={`${reference.holder} ${reference.source}`}>\n {index > 0 && ', '}\n <span className=\"mono\">{reference.holder}</span> from{' '}\n <span className=\"mono\">{reference.source}</span>\n </span>\n ))}\n .\n </li>\n )}\n <li>\n <strong>Kept, names only:</strong> the {what} and its {count(deletion.keys, 'key')}, as{' '}\n <span className=\"mono\">{deletion.tombstone}</span>, so the audit log still reads. Its\n name is free to use again.\n </li>\n {deletion.stranded.length > 0 && (\n <li>\n <strong>Left with no access:</strong>{' '}\n {deletion.stranded.map((member, index) => (\n <span key={member}>\n {index > 0 && ', '}\n <span className=\"mono\">{shownMember(member)}</span>\n </span>\n ))}\n . Offboard them on the Users or Service accounts page if they are no longer needed.\n </li>\n )}\n </ul>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAgBA,SAAgB,kBAAkB,EAChC,MACA,MACA,cACA,aAMC;CACD,MAAM,SAAS,UAAU;CACzB,MAAM,OAAO,SAAS;EAAE,GAAG,QAAQ,SAAS,QAAQ,IAAI;EAAG,SAAS;CAAK,CAAC;CAC1E,MAAM,CAAC,OAAO,YAAY,SAAS,EAAE;CACrC,MAAM,EAAE,SAAS,OAAO,UAAU,QAAQ,UAAU;CACpD,MAAM,OAAO,KAAK,SAAS,GAAG,IAAI,gBAAgB;CAElD,gBAAgB;EACd,IAAI,CAAC,MAAM;EACX,SAAS,EAAE;EACX,SAAS,IAAI;CACf,GAAG,CAAC,MAAM,QAAQ,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AAA,CAAA;IACF;GAEA,EAAA,CAAA;GACH,SAAS,WAAW,SAAS,KAC5B,qBAAC,MAAD,EAAA,UAAA;IACE,oBAAC,UAAD,EAAA,UAAQ,SAAc,CAAA;IAAC;IAAE,MAAM,SAAS,WAAW,QAAQ,WAAW;IAAE;IAC3C;IAC5B,SAAS,WAAW,KAAK,WAAW,UACnC,qBAAC,QAAD,EAAA,UAAA;KACG,QAAQ,KAAK;KACd,oBAAC,QAAD;MAAM,WAAU;gBAAQ,UAAU;KAAa,CAAA;KAAC;KAAM;KACtD,oBAAC,QAAD;MAAM,WAAU;gBAAQ,UAAU;KAAa,CAAA;IAC3C,EAAA,GAJK,GAAG,UAAU,OAAO,GAAG,UAAU,QAItC,CACP;IAAE;GAED,EAAA,CAAA;GAEN,qBAAC,MAAD,EAAA,UAAA;IACE,oBAAC,UAAD,EAAA,UAAQ,oBAAyB,CAAA;IAAC;IAAM;IAAK;IAAU,MAAM,SAAS,MAAM,KAAK;IAAE;IAAK;IACxF,oBAAC,QAAD;KAAM,WAAU;eAAQ,SAAS;IAAgB,CAAA;IAAC;GAEhD,EAAA,CAAA;GACH,SAAS,SAAS,SAAS,KAC1B,qBAAC,MAAD,EAAA,UAAA;IACE,oBAAC,UAAD,EAAA,UAAQ,uBAA4B,CAAA;IAAE;IACrC,SAAS,SAAS,KAAK,QAAQ,UAC9B,qBAAC,QAAD,EAAA,UAAA,CACG,QAAQ,KAAK,MACd,oBAAC,QAAD;KAAM,WAAU;eAAQ,YAAY,MAAM;IAAQ,CAAA,CAC9C,EAAA,GAHK,MAGL,CACP;IAAE;GAED,EAAA,CAAA;EAEJ;;AAER"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"directory-v87HGjEn.js","names":[],"sources":["../../src/components/directory.tsx"],"sourcesContent":["import { Fragment, useState } from 'react';\nimport { useQuery } from '@tanstack/react-query';\nimport { Menu } from '@base-ui/react/menu';\nimport { changeRole, directoryList, invite, removeMember, type InviteVars } from '../lib/changes';\nimport { memberRef, useCoffre } from '../lib/coffre';\nimport { queries } from '../lib/queries';\nimport { useShell } from '../lib/use-shell';\nimport { useChange, useChangeStatus } from '../lib/use-change';\nimport type { DirectoryPrincipal } from '../shared/models';\nimport { RowFailure, RowPending, rowClass } from './row-state';\nimport { ConfirmDialog, EmptyState, MenuPopup, Modal, Spinner, Timestamp, Toggletip } from './ui';\nimport { PrincipalLink } from './principal';\nimport { Clock, Folder, GitHub, Key, Link, Lock, MoreHorizontal, Pencil, Plus, ShieldCheck, User, X } from './icons';\n\n/**\n * The instance directory, shared by the Users and Service accounts pages.\n *\n * Both are rows in the same table on the server (principals, typed user or\n * service); the pages split them because people and machines are looked after\n * differently, not because the model does.\n */\n\ntype PrincipalType = DirectoryPrincipal['principalType'];\n\n/** How the directory, and its changes, name someone to the API: `user:…`, `token:…` (shown `service:…`). */\nexport const memberOf = (principal: Pick<DirectoryPrincipal, 'principalType' | 'principalId'>) =>\n memberRef(principal.principalType, principal.principalId);\n\nexport const ROLE_LABEL: Record<DirectoryPrincipal['instanceRole'], string> = {\n 'root-admin': 'Root admin',\n owner: 'Owner',\n user: 'Member',\n};\n\n/** What each kind of principal is called in the interface. */\nexport const KIND: Record<PrincipalType, string> = {\n user: 'user',\n service: 'service account',\n};\n\nexport function DirectoryTable({\n principalType,\n principals,\n hasRemoved = false,\n}: {\n principalType: PrincipalType;\n principals: DirectoryPrincipal[];\n /** Whether some were removed, listed beneath, so an empty table is not \"yet\". */\n hasRemoved?: boolean;\n}) {\n const users = principalType === 'user';\n const columns = users ? 4 : 6;\n const { status, failedAdds, dismiss } = useChangeStatus(directoryList.queryKey);\n const refused = failedAdds<InviteVars>(principals.map(memberOf)).filter(\n ({ vars }) => vars.principalType === principalType,\n );\n return (\n <>\n <section className=\"card\" aria-label={users ? 'Users' : 'Service accounts'}>\n {principals.length === 0 && refused.length === 0 ? (\n <EmptyState\n title={\n hasRemoved\n ? `No active ${KIND[principalType]}s`\n : users\n ? 'Nobody is registered'\n : 'No service accounts yet'\n }\n >\n {hasRemoved ? `Add a ${KIND[principalType]}` : `Add the first ${KIND[principalType]}`} to let\n it through the door. Project access is a separate step, granted from each project's page.\n </EmptyState>\n ) : (\n <div className=\"dt-wrap\">\n <table className={`dt directory directory-${principalType} stacks${users ? '' : ' stacks-inline'}`}>\n <thead>\n <tr>\n <th className=\"n\">#</th>\n <th className=\"col-principal\">\n <span className=\"th\">\n {users ? <User size={14} /> : <Key size={14} />}\n {users ? 'Email' : 'Name'}\n </span>\n </th>\n {users ? (\n <th className=\"col-role\">\n <span className=\"th\">\n <ShieldCheck size={14} />\n Instance role\n </span>\n </th>\n ) : (\n <>\n <th className=\"col-signin\">\n <span className=\"th\">\n <Link size={14} />\n Signs in with\n </span>\n </th>\n <th className=\"col-access\">\n <span className=\"th\">\n <Folder size={14} />\n Access\n </span>\n </th>\n <th className=\"col-used\">\n <span className=\"th\">\n <Clock size={14} />\n Last used\n </span>\n </th>\n </>\n )}\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Actions</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {principals.map((principal, index) => {\n const state = status(memberOf(principal));\n return (\n <Fragment key={principal.principalId}>\n <tr className={`row-link ${rowClass(state)}`}>\n <td className=\"n\">{index + 1}</td>\n <td\n className=\"col-lead\"\n data-label={principal.principalType === 'user' ? 'Email' : 'Name'}\n >\n <PrincipalLink\n type={principal.principalType}\n id={principal.principalId}\n stretch\n />\n </td>\n {users ? (\n <td className=\"col-role\" data-label=\"Instance role\">\n <InstanceRole principal={principal} />\n </td>\n ) : (\n <ServiceCells principal={principal} />\n )}\n <td className=\"col-actions\">\n {state.state === 'pending' ? (\n <RowPending status={state} />\n ) : (\n <PrincipalActions principal={principal} />\n )}\n </td>\n </tr>\n <RowFailure\n status={state}\n columns={columns}\n onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}\n />\n </Fragment>\n );\n })}\n {refused.map(({ mutationId, vars, status: failed }) => (\n <RowFailure\n key={mutationId}\n status={failed}\n columns={columns}\n onDismiss={() => dismiss(mutationId)}\n >\n {vars.principalId} was not added.\n </RowFailure>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </section>\n <div className=\"table-actions\">\n <AddPrincipal principalType={principalType} />\n </div>\n </>\n );\n}\n\nconst PLATFORM: Record<string, string> = {\n github: 'GitHub',\n 'github-reusable': 'GitHub',\n 'github-reusable-organization': 'GitHub',\n gitlab: 'GitLab',\n custom: 'OIDC',\n};\n\n/**\n * What someone scanning service accounts wants of each: how it signs in, where\n * it reaches, and whether it is still in use. Access comes with the list; the\n * bindings and tokens are read per row, as its own page reads them.\n */\nfunction ServiceCells({ principal }: { principal: DirectoryPrincipal }) {\n const client = useCoffre();\n const { auth, capabilities, features } = useShell();\n const member = memberOf(principal);\n // As `loadServiceDirectory` read them, so these come from its cache.\n const allowed = capabilities.canManageGrants && auth.signin !== null;\n // Not suspended: an account added here is shown at once, its facts when they come.\n const { data: bindings } = useQuery(queries.bindings(client, member, capabilities.canManageGrants && features.workloads));\n const { data: credentials } = useQuery(queries.credentials(client, member, allowed));\n\n const platforms = new Map<string, number>();\n const bindingList = bindings?.ok === true ? bindings.bindings : [];\n for (const binding of bindingList) {\n const platform = PLATFORM[binding.profile] ?? 'OIDC';\n platforms.set(platform, (platforms.get(platform) ?? 0) + 1);\n }\n const now = Date.now();\n const tokenList = credentials?.ok === true ? credentials.tokens : [];\n const activeTokens = tokenList.filter((token) => new Date(token.expiresAt).getTime() > now).length;\n const lastUsed = [...bindingList, ...tokenList]\n .map((credential) => credential.lastUsedAt)\n .filter((at): at is string => at !== null)\n .sort()\n .at(-1);\n\n const places = [\n ...new Set(\n (principal.grants ?? []).map(({ project, environment }) =>\n environment === null ? project : `${project}/${environment}`,\n ),\n ),\n ];\n const projects = new Set((principal.grants ?? []).map((grant) => grant.project));\n const loaded = bindings !== undefined && credentials !== undefined;\n\n return (\n <>\n <td className=\"col-signin\" data-label=\"Signs in with\">\n {!loaded ? null : platforms.size === 0 && activeTokens === 0 ? (\n <span className=\"cell-muted\">Nothing yet</span>\n ) : (\n <span className=\"signin-list\">\n {[...platforms].map(([platform, count]) => (\n <span key={platform} className=\"signin-item\">\n {platform === 'GitHub' && <GitHub size={12} />}\n {platform}\n {count > 1 && ` ×${count}`}\n </span>\n ))}\n {activeTokens > 0 && (\n <span className=\"signin-item\">\n <Key size={12} />\n {activeTokens} token{activeTokens === 1 ? '' : 's'}\n </span>\n )}\n </span>\n )}\n </td>\n <td className=\"col-access\" data-label=\"Access\" title={places.join(', ')}>\n {places.length === 0 ? (\n <span className=\"cell-muted\">None</span>\n ) : places.length <= 2 ? (\n <span className=\"mono\">{places.join(', ')}</span>\n ) : (\n `${projects.size} project${projects.size === 1 ? '' : 's'}`\n )}\n </td>\n <td className=\"col-used cell-muted\" data-label=\"Last used\">\n {!loaded ? null : lastUsed === undefined ? 'Never' : <Timestamp iso={lastUsed} display=\"relative\" />}\n </td>\n </>\n );\n}\n\n/**\n * A user's instance role. Service accounts have none worth showing: every one is a\n * plain member. A root admin's role comes from the deployment, so its tag says\n * so on hover or tap instead of offering a menu that could not work.\n */\nexport function InstanceRole({ principal }: { principal: DirectoryPrincipal }) {\n if (principal.tampered === true) {\n return (\n <Toggletip\n label={\n <>\n Their record was changed outside coffre, so the vault refuses them\n everything. Remove them to start them over, then add them again.\n </>\n }\n >\n <button type=\"button\" className=\"tag tag-red tag-button\">\n <Lock size={11} />\n Integrity check failed\n </button>\n </Toggletip>\n );\n }\n if (principal.isRootAdmin) {\n return (\n <Toggletip\n label={\n <>\n Set by <code>rootAdmins</code> in the vault's configuration, so it\n cannot be changed or removed here.\n </>\n }\n >\n <button type=\"button\" className=\"tag tag-violet tag-button\">\n <Lock size={11} />\n Root admin\n </button>\n </Toggletip>\n );\n }\n return (\n <span className={`tag${principal.instanceRole === 'user' ? '' : ' tag-violet'}`}>\n {ROLE_LABEL[principal.instanceRole]}\n </span>\n );\n}\n\n/**\n * Change role and Remove, behind one menu. Root admins get none: the\n * deployment's configuration owns them.\n */\nexport function PrincipalActions({\n principal,\n trigger = 'act act-quiet act-menu',\n}: {\n principal: DirectoryPrincipal;\n /** The menu button's classes: a row action in tables, a button in a page head. */\n trigger?: string;\n}) {\n const [editing, setEditing] = useState(false);\n const [confirming, setConfirming] = useState(false);\n const [instanceRole, setInstanceRole] = useState<'user' | 'owner'>(\n principal.instanceRole === 'owner' ? 'owner' : 'user',\n );\n const coffre = useCoffre();\n const setRole = useChange(changeRole(coffre));\n const remove = useChange(removeMember(coffre));\n const { status } = useChangeStatus(directoryList.queryKey);\n const pending = status(memberOf(principal)).state === 'pending';\n const kind = KIND[principal.principalType];\n\n if (principal.isRootAdmin) return null;\n\n return (\n <>\n <Menu.Root>\n <Menu.Trigger\n className={trigger}\n aria-label={`Actions for ${principal.principalId}`}\n disabled={pending}\n >\n {pending ? <Spinner size={13} /> : <MoreHorizontal size={16} />}\n </Menu.Trigger>\n <MenuPopup align=\"end\">\n {principal.principalType === 'user' && (\n <>\n <Menu.Item\n className=\"menu-item\"\n onClick={() => {\n setInstanceRole(principal.instanceRole === 'owner' ? 'owner' : 'user');\n setEditing(true);\n }}\n >\n <Pencil size={14} />\n Change role\n </Menu.Item>\n <Menu.Separator className=\"menu-sep\" />\n </>\n )}\n <Menu.Item\n className=\"menu-item menu-item-danger\"\n onClick={() => setConfirming(true)}\n >\n <X size={14} />\n Remove {kind}…\n </Menu.Item>\n </MenuPopup>\n </Menu.Root>\n\n {principal.principalType === 'user' && (\n <Modal\n open={editing}\n onOpenChange={setEditing}\n title={\n <>\n Role of <span className=\"mono\">{principal.principalId}</span>\n </>\n }\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n // Shown in the list at once; the row says if the server refuses.\n setRole({ principalId: principal.principalId, owner: instanceRole === 'owner' });\n setEditing(false);\n }}\n >\n <RoleField value={instanceRole} onChange={setInstanceRole} />\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={() => setEditing(false)}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\">\n Save\n </button>\n </div>\n </form>\n </Modal>\n )}\n\n <ConfirmDialog\n open={confirming}\n onOpenChange={setConfirming}\n title={\n <>\n Remove <span className=\"mono\">{principal.principalId}</span>?\n </>\n }\n body={<RemovalPreview principal={principal} open={confirming} />}\n confirmLabel={`Remove ${kind}`}\n onConfirm={() => remove(principal)}\n />\n </>\n );\n}\n\nconst plural = (count: number, one: string) => `${count} ${one}${count === 1 ? '' : 's'}`;\n\n/**\n * What removing someone would do, read when its dialog opens, as `coffre\n * offboard` previews it before `--apply`: every way in it revokes, and what\n * they leave behind to rotate.\n */\nfunction RemovalPreview({ principal, open }: { principal: DirectoryPrincipal; open: boolean }) {\n const { capabilities, features } = useShell();\n const person = principal.principalType === 'user';\n const { data, isPending } = useQuery({\n ...queries.report(useCoffre(), memberOf(principal), capabilities.canManageGrants),\n enabled: open,\n });\n const report = data?.ok === true ? data.report : null;\n if (isPending) {\n return (\n <>\n <Spinner size={13} /> Reading what {person ? 'they hold' : 'it holds'}…\n </>\n );\n }\n if (report === null) {\n return person\n ? 'They are signed out everywhere, and their sign-in accounts and project access are revoked at once.'\n : 'Its bearer tokens and trust bindings stop working, and its project access is revoked at once.';\n }\n const { live } = report;\n // Named, as an app's name is what its person knows it by: \"2 connected apps (Claude, Cursor)\".\n const apps = `${plural(live.apps, 'connected app')}${report.apps.length > 0 ? ` (${report.apps.map((app) => app.name).join(', ')})` : ''}`;\n const revokes = person\n ? [\n plural(live.grants, 'grant'),\n plural(live.sessions, 'session'),\n plural(live.identities, 'linked sign-in account'),\n ...(features.mcp ? [apps] : []),\n ]\n : [plural(live.grants, 'grant'), plural(live.tokens, 'bearer token')];\n return (\n <>\n Removing revokes {revokes.join(', ')} at once\n {person ? '' : ', and its trust bindings, including for anything running as it now'}.{' '}\n {report.exposed.length === 0\n ? `No value ${person ? 'they' : 'it'} saw is still current.`\n : `${plural(report.exposed.length, 'value')} ${person ? 'they' : 'it'} saw ${report.exposed.length === 1 ? 'is' : 'are'} still current: ${person ? 'their' : 'its'} page lists them, to rotate.`}\n {report.issuedTokens.length > 0 &&\n ` ${plural(report.issuedTokens.length, 'bearer token')} ${person ? 'they' : 'it'} issued still ${report.issuedTokens.length === 1 ? 'works' : 'work'}.`}{' '}\n {person ? 'Their' : 'Its'} past actions stay in the audit log.\n </>\n );\n}\n\nexport function AddPrincipal({ principalType }: { principalType: PrincipalType }) {\n const [open, setOpen] = useState(false);\n const [principalId, setPrincipalId] = useState('');\n const [instanceRole, setInstanceRole] = useState<'user' | 'owner'>('user');\n const add = useChange(invite(useCoffre()));\n const kind = KIND[principalType];\n\n function close() {\n setOpen(false);\n setPrincipalId('');\n setInstanceRole('user');\n }\n\n return (\n <>\n <button className=\"btn btn-primary\" onClick={() => setOpen(true)}>\n <Plus size={14} />\n Add {kind}\n </button>\n\n <Modal\n open={open}\n onOpenChange={(next) => (next ? setOpen(true) : close())}\n title={`Add a ${kind}`}\n description={`This lets the ${kind} through the door and nothing more. Grant project access from its page or from each project's.`}\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n // Shown in the list at once; the list says if the server refuses.\n add({ principalType, principalId: principalId.trim(), owner: instanceRole === 'owner' });\n close();\n }}\n >\n <label className=\"field\">\n <span className=\"label\">\n {principalType === 'user' ? 'Cloudflare Access email' : 'Service account name'}\n </span>\n <input\n className=\"input input-mono\"\n autoFocus\n spellCheck={false}\n autoComplete=\"off\"\n value={principalId}\n placeholder={\n principalType === 'user' ? 'someone@acme.example' : 'ci-deploy'\n }\n onChange={(event) => setPrincipalId(event.target.value)}\n />\n </label>\n\n {principalType === 'user' && (\n <RoleField value={instanceRole} onChange={setInstanceRole} />\n )}\n\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={close}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\" disabled={principalId.trim() === ''}>\n Add {kind}\n </button>\n </div>\n </form>\n </Modal>\n </>\n );\n}\n\nfunction RoleField({\n value,\n onChange,\n}: {\n value: 'user' | 'owner';\n onChange: (value: 'user' | 'owner') => void;\n}) {\n return (\n <label className=\"field\">\n <span className=\"label\">Instance role</span>\n <select\n className=\"select\"\n value={value}\n onChange={(event) => onChange(event.target.value as 'user' | 'owner')}\n >\n <option value=\"user\">Member</option>\n <option value=\"owner\">Owner</option>\n </select>\n <span className=\"hint\">\n Owners manage users and service accounts, can create projects, and read the whole audit log.\n Neither role reads a secret without a project grant.\n </span>\n </label>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAyBA,IAAa,YAAY,cACvB,UAAU,UAAU,eAAe,UAAU,WAAW;AAE1D,IAAa,aAAiE;CAC5E,cAAc;CACd,OAAO;CACP,MAAM;AACR;;AAGA,IAAa,OAAsC;CACjD,MAAM;CACN,SAAS;AACX;AAEA,SAAgB,eAAe,EAC7B,eACA,YACA,aAAa,SAMZ;CACD,MAAM,QAAQ,kBAAkB;CAChC,MAAM,UAAU,QAAQ,IAAI;CAC5B,MAAM,EAAE,QAAQ,YAAY,YAAY,gBAAgB,cAAc,QAAQ;CAC9E,MAAM,UAAU,WAAuB,WAAW,IAAI,QAAQ,CAAC,CAAC,CAAC,QAC9D,EAAE,WAAW,KAAK,kBAAkB,aACvC;CACA,OACE,qBAAA,YAAA,EAAA,UAAA,CACE,oBAAC,WAAD;EAAS,WAAU;EAAO,cAAY,QAAQ,UAAU;YACrD,WAAW,WAAW,KAAK,QAAQ,WAAW,IAC7C,qBAAC,YAAD;GACE,OACE,aACI,aAAa,KAAK,eAAe,KACjC,QACE,yBACA;aANV,CASG,aAAa,SAAS,KAAK,mBAAmB,iBAAiB,KAAK,kBAAiB,mGAE5E;OAEZ,oBAAC,OAAD;GAAK,WAAU;aACb,qBAAC,SAAD;IAAO,WAAW,0BAA0B,cAAc,SAAS,QAAQ,KAAK;cAAhF,CACE,oBAAC,SAAD,EAAA,UACE,qBAAC,MAAD,EAAA,UAAA;KACE,oBAAC,MAAD;MAAI,WAAU;gBAAI;KAAK,CAA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,UAAD;MAAQ,WAAU;MAAM,MAAK;MAAS,SAAS;gBAAO;KAE9C,CAAA,GACR,qBAAC,UAAD;MAAQ,WAAU;MAAkB,MAAK;MAAS,UAAU,YAAY,KAAK,MAAM;gBAAnF,CAAuF,QAChF,IACC;OACL;;GACD;;CACD,CAAA,CACP,EAAA,CAAA;AAEN;AAEA,SAAS,UAAU,EACjB,OACA,YAIC;CACD,OACE,qBAAC,SAAD;EAAO,WAAU;YAAjB;GACE,oBAAC,QAAD;IAAM,WAAU;cAAQ;GAAmB,CAAA;GAC3C,qBAAC,UAAD;IACE,WAAU;IACH;IACP,WAAW,UAAU,SAAS,MAAM,OAAO,KAAyB;cAHtE,CAKE,oBAAC,UAAD;KAAQ,OAAM;eAAO;IAAc,CAAA,GACnC,oBAAC,UAAD;KAAQ,OAAM;eAAQ;IAAa,CAAA,CAC7B;;GACR,oBAAC,QAAD;IAAM,WAAU;cAAO;GAGjB,CAAA;EACD;;AAEX"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"folders-CbGU0xOz.js","names":[],"sources":["../../src/components/folders.tsx"],"sourcesContent":["import { useEffect, useId, useState, type ReactNode } from 'react';\nimport { Menu } from '@base-ui/react/menu';\n\nimport { folderProblem } from '../lib/validation';\nimport { Folder, MoreHorizontal, Pencil, X } from './icons';\nimport { ConfirmDialog, MenuPopup, Modal } from './ui';\n\n/**\n * A folder's heading row inside a table: the rows after it, up to the next\n * heading, are filed in it. Folders only arrange a list\n * (docs/design/environments.md).\n */\nexport function FolderRow({ folder, count, columns, actions }: { folder: string; count: number; columns: number; actions?: ReactNode }) {\n return (\n <tr className=\"folder-row\">\n <th colSpan={columns} scope=\"rowgroup\">\n <span className=\"folder-row-head\">\n <span className=\"th\">\n <Folder size={14} />\n {folder}\n <span className=\"count\">{count}</span>\n </span>\n {actions}\n </span>\n </th>\n </tr>\n );\n}\n\n/**\n * A folder heading's menu: rename it, which re-files everything in it, or\n * remove it, which takes everything out. A folder is only a label, so what\n * was in it stays where it is, and a rename onto a folder in use merges the\n * two.\n */\nexport function FolderMenu({\n folder,\n count,\n what,\n folders,\n onRename,\n onRemove,\n}: {\n folder: string;\n count: number;\n /** What it holds, as a sentence counts them: `project`, `key`. */\n what: string;\n /** The other folders in use beside it, offered as you type. */\n folders: readonly string[];\n onRename: (name: string) => void;\n onRemove: () => void;\n}) {\n const [renaming, setRenaming] = useState(false);\n const [removing, setRemoving] = useState(false);\n const [name, setName] = useState(folder);\n const listId = useId();\n useEffect(() => {\n if (renaming) setName(folder);\n }, [renaming, folder]);\n const problem = folderProblem(name);\n const merges = name !== folder && folders.includes(name);\n const items = `${count} ${what}${count === 1 ? '' : 's'}`;\n\n return (\n <>\n <Menu.Root>\n <Menu.Trigger className=\"act act-icon act-quiet folder-row-menu\" aria-label={`Actions for the folder ${folder}`}>\n <MoreHorizontal size={16} />\n </Menu.Trigger>\n <MenuPopup align=\"end\">\n <Menu.Item className=\"menu-item\" onClick={() => setRenaming(true)}>\n <Pencil size={14} />\n Rename folder…\n </Menu.Item>\n <Menu.Item className=\"menu-item menu-item-danger\" onClick={() => setRemoving(true)}>\n <X size={14} />\n Remove folder…\n </Menu.Item>\n </MenuPopup>\n </Menu.Root>\n\n <Modal\n open={renaming}\n onOpenChange={setRenaming}\n title={`Rename ${folder}`}\n description={`Its ${items} move with it. A folder only arranges the list: nothing else changes.`}\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n if (problem !== null || name === '' || name === folder) return;\n onRename(name);\n setRenaming(false);\n }}\n >\n <label className=\"field\">\n <span className=\"label\">Name</span>\n <input\n className=\"input\"\n autoFocus\n spellCheck={false}\n autoComplete=\"off\"\n list={listId}\n value={name}\n aria-invalid={problem !== null}\n onChange={(event) => setName(event.target.value)}\n />\n <datalist id={listId}>\n {folders.filter((each) => each !== folder).map((each) => (\n <option key={each} value={each} />\n ))}\n </datalist>\n <span className={`hint${problem !== null ? ' edit-note-error' : ''}`}>\n {problem ?? (merges ? `${name} is in use: the two become one folder.` : 'One level: no slash.')}\n </span>\n </label>\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={() => setRenaming(false)}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\" disabled={problem !== null || name === '' || name === folder}>\n {merges ? 'Merge' : 'Rename'}\n </button>\n </div>\n </form>\n </Modal>\n\n <ConfirmDialog\n open={removing}\n onOpenChange={setRemoving}\n title={`Remove the folder ${folder}?`}\n body={`Its ${items} stay where they are, in no folder. Nothing else changes.`}\n confirmLabel=\"Remove folder\"\n onConfirm={onRemove}\n />\n </>\n );\n}\n\n/**\n * Where to file something: a folder by name, one already in use or a new\n * one, or none. Asked in a dialog, since it is one field and one decision.\n */\nexport function MoveToFolder({\n open,\n onOpenChange,\n what,\n current,\n folders,\n onMove,\n}: {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** What moves, as the title names it: \"STRIPE_KEY\". */\n what: string;\n current: string | null;\n /** The folders in use beside it, offered as you type. */\n folders: readonly string[];\n onMove: (folder: string | null) => void;\n}) {\n const [name, setName] = useState(current ?? '');\n const listId = useId();\n useEffect(() => {\n if (open) setName(current ?? '');\n }, [open, current]);\n const problem = folderProblem(name);\n const folder = name === '' ? null : name;\n\n return (\n <Modal\n open={open}\n onOpenChange={onOpenChange}\n title={`Move ${what} to a folder`}\n description=\"A folder arranges the list. It changes nothing else: names, values and access stay as they are.\"\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n if (problem !== null) return;\n if (folder !== current) onMove(folder);\n onOpenChange(false);\n }}\n >\n <label className=\"field\">\n <span className=\"label\">Folder</span>\n <input\n className=\"input\"\n autoFocus\n spellCheck={false}\n autoComplete=\"off\"\n list={listId}\n placeholder=\"No folder\"\n value={name}\n aria-invalid={problem !== null}\n onChange={(event) => setName(event.target.value)}\n />\n <datalist id={listId}>\n {folders.map((each) => (\n <option key={each} value={each} />\n ))}\n </datalist>\n <span className={`hint${problem !== null ? ' edit-note-error' : ''}`}>\n {problem ?? 'Pick one in use, or name a new one. Empty for no folder.'}\n </span>\n </label>\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={() => onOpenChange(false)}>\n Cancel\n </button>\n <button className=\"btn btn-primary\" type=\"submit\" disabled={problem !== null || folder === current}>\n {folder === null && current !== null ? 'Take out of its folder' : 'Move'}\n </button>\n </div>\n </form>\n </Modal>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAYA,SAAgB,UAAU,EAAE,QAAQ,OAAO,SAAS,WAAoF;CACtI,OACE,oBAAC,MAAD;EAAI,WAAU;YACZ,oBAAC,MAAD;GAAI,SAAS;GAAS,OAAM;aAC1B,qBAAC,QAAD;IAAM,WAAU;cAAhB,CACE,qBAAC,QAAD;KAAM,WAAU;eAAhB;MACE,oBAAC,QAAD,EAAQ,MAAM,GAAK,CAAA;MAClB;MACD,oBAAC,QAAD;OAAM,WAAU;iBAAS;MAAY,CAAA;KACjC;QACL,OACG;;EACJ,CAAA;CACF,CAAA;AAER;;;;;;;AAQA,SAAgB,WAAW,EACzB,QACA,OACA,MACA,SACA,UACA,YAUC;CACD,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,UAAU,eAAe,SAAS,KAAK;CAC9C,MAAM,CAAC,MAAM,WAAW,SAAS,MAAM;CACvC,MAAM,SAAS,MAAM;CACrB,gBAAgB;EACd,IAAI,UAAU,QAAQ,MAAM;CAC9B,GAAG,CAAC,UAAU,MAAM,CAAC;CACrB,MAAM,UAAU,cAAc,IAAI;CAClC,MAAM,SAAS,SAAS,UAAU,QAAQ,SAAS,IAAI;CACvD,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,UAAU,IAAI,KAAK;CAEpD,OACE,qBAAA,YAAA,EAAA,UAAA;EACE,qBAAC,KAAK,MAAN,EAAA,UAAA,CACE,oBAAC,KAAK,SAAN;GAAc,WAAU;GAAyC,cAAY,0BAA0B;aACrG,oBAAC,gBAAD,EAAgB,MAAM,GAAK,CAAA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CAAA;IACD;OACP,qBAAC,OAAD;IAAK,WAAU;cAAf,CACE,oBAAC,UAAD;KAAQ,WAAU;KAAM,MAAK;KAAS,eAAe,aAAa,KAAK;eAAG;IAElE,CAAA,GACR,oBAAC,UAAD;KAAQ,WAAU;KAAkB,MAAK;KAAS,UAAU,YAAY,QAAQ,WAAW;eACxF,WAAW,QAAQ,YAAY,OAAO,2BAA2B;IAC5D,CAAA,CACL;KACD;;CACD,CAAA;AAEX"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"offboarding-DdnmRV1f.js","names":[],"sources":["../../src/components/offboarding.tsx"],"sourcesContent":["import { Link } from '@tanstack/react-router';\nimport type { PrincipalReport, RemovedPrincipal } from '../shared/models';\nimport { Card } from './page';\nimport { EmptyState, Notice, Timestamp } from './ui';\nimport { PrincipalLink } from './principal';\nimport { referenceProblem } from './references';\nimport { ChevronRight, Key, User } from './icons';\nimport { serviceName } from '@coffre/client';\n\n/**\n * The part of a user's or token's page that answers \"what do we change now\n * they have left?\". Owners only. Once someone is removed everything that let\n * them in is gone, but what they saw is not, nor tokens they issued.\n */\nexport function PrincipalReportCards({ report }: { report: PrincipalReport }) {\n const person = report.principalType === 'user';\n return (\n <>\n {report.status === 'removed' && <ConsiderRotating report={report} person={person} />}\n {report.issuedTokens.length > 0 && <IssuedTokens report={report} />}\n {report.references.length > 0 && <MadeReferences report={report} />}\n </>\n );\n}\n\nexport function RemovedNotice({ report }: { report: PrincipalReport }) {\n const person = report.principalType === 'user';\n return (\n <div className=\"report-notice\">\n <Notice>\n Removed\n {report.removedBy !== null && (\n <>\n {' '}by <span className=\"mono\">{report.removedBy}</span>\n </>\n )}\n {report.removedAt !== null && (\n <>\n {' '}on <Timestamp iso={report.removedAt} />\n </>\n )}\n .{' '}\n {person\n ? 'Their project access, sessions, CLI logins, linked sign-in accounts and connected apps were revoked at the same time, so adding them again starts from nothing.'\n : 'Its project access and every token issued to it were revoked at the same time, so adding it again starts from nothing.'}\n </Notice>\n </div>\n );\n}\n\n/**\n * The people or service accounts removed from the directory, under the live ones.\n * Removal ends their access but not the work it leaves, so they stay one click\n * away until every value they saw has been rotated.\n */\nexport function RemovedList({\n principalType,\n removed,\n}: {\n principalType: RemovedPrincipal['principalType'];\n removed: RemovedPrincipal[];\n}) {\n const users = principalType === 'user';\n const rows = removed.filter((principal) => principal.principalType === principalType);\n if (rows.length === 0) return null;\n return (\n <>\n <h2 className=\"section-title\">Removed</h2>\n <section className=\"card\" aria-label={users ? 'Removed users' : 'Removed service accounts'}>\n <div className=\"dt-wrap\">\n <table className=\"dt directory stacks\">\n <thead>\n <tr>\n <th className=\"n\">#</th>\n <th className=\"col-principal\">\n <span className=\"th\">\n {users ? <User size={14} /> : <Key size={14} />}\n {users ? 'Email' : 'Name'}\n </span>\n </th>\n <th className=\"col-role\">Consider rotating</th>\n <th className=\"col-actions\">\n <span className=\"visually-hidden\">Report</span>\n </th>\n </tr>\n </thead>\n <tbody>\n {rows.map((principal, index) => (\n <tr key={principal.principalId} className=\"row-link\">\n <td className=\"n\">{index + 1}</td>\n <td className=\"col-lead\" data-label={users ? 'Email' : 'Name'}>\n <PrincipalLink type={principal.principalType} id={principal.principalId} stretch />\n </td>\n <td className=\"col-role\" data-label=\"Consider rotating\">\n {principal.toRotate === 0 ? (\n <span className=\"cell-muted\">Nothing</span>\n ) : (\n `${principal.toRotate} ${principal.toRotate === 1 ? 'value' : 'values'}`\n )}\n </td>\n {/* The row opens the report; the chevron says it does. */}\n <td className=\"col-actions col-open cell-muted\" aria-hidden=\"true\">\n <ChevronRight size={16} />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </section>\n </>\n );\n}\n\n/** Values a removed member saw that nobody has changed since. */\nfunction ConsiderRotating({ report, person }: { report: PrincipalReport; person: boolean }) {\n const they = person ? 'they' : 'it';\n return (\n <Card\n labelledBy=\"seen-values\"\n title=\"Consider rotating\"\n description={`Values ${they} read or wrote that nobody has changed since, so ${they} may still hold them. Rotate each where it comes from, such as a new API key or database password, then save the new value here and it leaves this list.`}\n actions={\n report.rotated > 0 && (\n <span className=\"card-aside\">{report.rotated} already rotated</span>\n )\n }\n >\n {report.exposed.length === 0 ? (\n <EmptyState title=\"Nothing left to rotate\">\n {report.rotated > 0\n ? `Every value ${they} saw has had a new version since.`\n : `${person ? 'They have' : 'It has'} not read or written a value that is still current.`}\n </EmptyState>\n ) : (\n <div className=\"dt-wrap\">\n <table className=\"dt report-values\">\n <thead>\n <tr>\n <th>Secret</th>\n <th className=\"col-shrink\">Version</th>\n <th className=\"col-shrink\">Last seen</th>\n </tr>\n </thead>\n <tbody>\n {report.exposed.map((secret) => (\n <tr key={`${secret.project}/${secret.environment}/${secret.key}`}>\n <td>\n <Link\n className=\"cell-link mono\"\n to=\"/projects/$project/$environment\"\n params={{ project: secret.project, environment: secret.environment }}\n search={{ filter: secret.key }}\n >\n <span className=\"report-path\">\n {secret.project}/{secret.environment}/\n </span>\n {secret.key}\n </Link>\n </td>\n <td className=\"col-shrink cell-mono cell-muted\">v{secret.version}</td>\n <td className=\"col-shrink nowrap\">\n {secret.how === 'wrote' ? 'Wrote' : 'Read'}{' '}\n <Timestamp iso={secret.at} display=\"relative\" />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n )}\n </Card>\n );\n}\n\n/**\n * References they made, as the log names them: each belongs to the\n * environment that holds it, like a value, not to them (D46), so their\n * leaving ends none. Listed to review.\n */\nfunction MadeReferences({ report }: { report: PrincipalReport }) {\n return (\n <Card\n labelledBy=\"made-references\"\n title=\"References they made\"\n description=\"Each belongs to the environment that holds it, like a value, and stays when they leave: whoever reads that environment reads another secret through it. Review them; the source's access managers, or whoever writes where one is held, can break it.\"\n >\n <div className=\"dt-wrap\">\n <table className=\"dt stacks\">\n <thead>\n <tr>\n <th>Reference</th>\n <th>Reads</th>\n <th className=\"col-shrink\">Made</th>\n </tr>\n </thead>\n <tbody>\n {report.references.map((reference) => (\n <tr key={reference.id}>\n <td className=\"mono\" data-label=\"Reference\">{reference.holder}</td>\n <td data-label=\"Reads\">\n <span className=\"mono\">{reference.source}</span>\n {reference.state !== 'live' && <span className=\"cell-muted\"> · {referenceProblem(reference.state)}</span>}\n </td>\n <td className=\"col-shrink nowrap\" data-label=\"Made\">\n <Timestamp iso={reference.createdAt} display=\"relative\" />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </Card>\n );\n}\n\nfunction IssuedTokens({ report }: { report: PrincipalReport }) {\n return (\n <Card\n labelledBy=\"issued-tokens\"\n title=\"Bearer tokens they issued\"\n description=\"Bearer tokens they issued to service accounts that still work. Each was shown to them once, when it was made; revoke any they may have kept a copy of.\"\n >\n <div className=\"dt-wrap\">\n <table className=\"dt report-tokens\">\n <thead>\n <tr>\n <th>Token</th>\n <th className=\"col-shrink\">Expires</th>\n <th className=\"col-shrink col-hide-narrow\">Last used</th>\n </tr>\n </thead>\n <tbody>\n {report.issuedTokens.map((token) => (\n <tr key={token.id}>\n <td>\n <span className=\"cell-stack\">\n <Link className=\"cell-link mono\" to=\"/service-accounts/$account\" params={{ account: serviceName(token.service) }}>\n service:{serviceName(token.service)}\n </Link>\n <small>\n {token.label ?? 'No label'} · <span className=\"mono\">{token.hint}</span>\n </small>\n </span>\n </td>\n <td className=\"col-shrink nowrap\">\n <Timestamp iso={token.expiresAt} display=\"relative\" />\n </td>\n <td className=\"col-shrink col-hide-narrow nowrap\">\n {token.lastUsedAt === null ? (\n <span className=\"cell-muted\">Never</span>\n ) : (\n <Timestamp iso={token.lastUsedAt} display=\"relative\" />\n )}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n </div>\n </Card>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAcA,SAAgB,qBAAqB,EAAE,UAAuC;CAC5E,MAAM,SAAS,OAAO,kBAAkB;CACxC,OACE,qBAAA,UAAA,EAAA,UAAA;EACG,OAAO,WAAW,aAAa,oBAAC,kBAAD;GAA0B;GAAgB;EAAS,CAAA;EAClF,OAAO,aAAa,SAAS,KAAK,oBAA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