@coffre/ui 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/dist/chunks/audit-sentence-BhHmvQX_.js +660 -0
  2. package/dist/chunks/audit-sentence-BhHmvQX_.js.map +1 -0
  3. package/dist/chunks/connected-apps-CUOyEZXR.js +146 -0
  4. package/dist/chunks/connected-apps-CUOyEZXR.js.map +1 -0
  5. package/dist/chunks/delete-place-CRX7ntE8.js +206 -0
  6. package/dist/chunks/delete-place-CRX7ntE8.js.map +1 -0
  7. package/dist/chunks/{directory-CSjWWUQ1.js → directory-CxxrnGUL.js} +177 -60
  8. package/dist/chunks/directory-CxxrnGUL.js.map +1 -0
  9. package/dist/chunks/folders-DoBmCwOi.js +207 -0
  10. package/dist/chunks/folders-DoBmCwOi.js.map +1 -0
  11. package/dist/chunks/grants-CXcmhujY.js +669 -0
  12. package/dist/chunks/grants-CXcmhujY.js.map +1 -0
  13. package/dist/chunks/offboarding-6eAduCsM.js +305 -0
  14. package/dist/chunks/offboarding-6eAduCsM.js.map +1 -0
  15. package/dist/chunks/one-time-DXEl9hbg.js +35 -0
  16. package/dist/chunks/one-time-DXEl9hbg.js.map +1 -0
  17. package/dist/chunks/page-DvsgZ2Hd.js +391 -0
  18. package/dist/chunks/page-DvsgZ2Hd.js.map +1 -0
  19. package/dist/chunks/principal-BIN-xwZw.js +42 -0
  20. package/dist/chunks/principal-BIN-xwZw.js.map +1 -0
  21. package/dist/chunks/{principal-page-D_91OA0l.js → principal-page-B9R2zPlp.js} +259 -251
  22. package/dist/chunks/principal-page-B9R2zPlp.js.map +1 -0
  23. package/dist/chunks/project-page-SRCtRe2g.js +17 -0
  24. package/dist/chunks/project-page-SRCtRe2g.js.map +1 -0
  25. package/dist/chunks/{queries-CQ81o4so.js → queries-DVR_i3rA.js} +132 -30
  26. package/dist/chunks/queries-DVR_i3rA.js.map +1 -0
  27. package/dist/chunks/references-B6pLT1uQ.js +343 -0
  28. package/dist/chunks/references-B6pLT1uQ.js.map +1 -0
  29. package/dist/chunks/{row-state-0PsrEzOL.js → row-state-DOPUsjQK.js} +3 -3
  30. package/dist/chunks/{row-state-0PsrEzOL.js.map → row-state-DOPUsjQK.js.map} +1 -1
  31. package/dist/chunks/signin-errors--ykMFuqN.js +57 -0
  32. package/dist/chunks/signin-errors--ykMFuqN.js.map +1 -0
  33. package/dist/chunks/tabs-BmwKfUeK.js +22 -0
  34. package/dist/chunks/tabs-BmwKfUeK.js.map +1 -0
  35. package/dist/chunks/{theme-B2vQolVR.js → theme-DJuz-xLM.js} +3 -3
  36. package/dist/chunks/{theme-B2vQolVR.js.map → theme-DJuz-xLM.js.map} +1 -1
  37. package/dist/chunks/{ui-DixXLQvQ.js → ui-DJje3gST.js} +6 -3
  38. package/dist/chunks/ui-DJje3gST.js.map +1 -0
  39. package/dist/chunks/{use-change-c6CeLRin.js → use-change-CZdI2MJG.js} +75 -21
  40. package/dist/chunks/use-change-CZdI2MJG.js.map +1 -0
  41. package/dist/chunks/{use-shell-jxd7Tzd-.js → use-shell-rNKfGjdj.js} +3 -3
  42. package/dist/chunks/{use-shell-jxd7Tzd-.js.map → use-shell-rNKfGjdj.js.map} +1 -1
  43. package/dist/chunks/validation-D312_NLf.js +87 -0
  44. package/dist/chunks/validation-D312_NLf.js.map +1 -0
  45. package/dist/index.d.ts +385 -31
  46. package/dist/index.js +188 -102
  47. package/dist/index.js.map +1 -1
  48. package/dist/pages/account.d.ts +2 -2
  49. package/dist/pages/account.js +174 -135
  50. package/dist/pages/account.js.map +1 -1
  51. package/dist/pages/approval.d.ts +9 -0
  52. package/dist/pages/approval.js +207 -0
  53. package/dist/pages/approval.js.map +1 -0
  54. package/dist/pages/audit.js +17 -542
  55. package/dist/pages/audit.js.map +1 -1
  56. package/dist/pages/device-login.js +2 -3
  57. package/dist/pages/device-login.js.map +1 -1
  58. package/dist/pages/environment.js +647 -257
  59. package/dist/pages/environment.js.map +1 -1
  60. package/dist/pages/login.js +18 -7
  61. package/dist/pages/login.js.map +1 -1
  62. package/dist/pages/oauth-authorize.d.ts +10 -0
  63. package/dist/pages/oauth-authorize.js +249 -0
  64. package/dist/pages/oauth-authorize.js.map +1 -0
  65. package/dist/pages/project-access.d.ts +6 -0
  66. package/dist/pages/project-access.js +370 -0
  67. package/dist/pages/project-access.js.map +1 -0
  68. package/dist/pages/project-environments.d.ts +4 -0
  69. package/dist/pages/project-environments.js +593 -0
  70. package/dist/pages/project-environments.js.map +1 -0
  71. package/dist/pages/project-settings.d.ts +4 -0
  72. package/dist/pages/project-settings.js +242 -0
  73. package/dist/pages/project-settings.js.map +1 -0
  74. package/dist/pages/project.d.ts +10 -2
  75. package/dist/pages/project.js +57 -934
  76. package/dist/pages/project.js.map +1 -1
  77. package/dist/pages/projects.js +53 -21
  78. package/dist/pages/projects.js.map +1 -1
  79. package/dist/pages/service-account.d.ts +10 -0
  80. package/dist/pages/{token.js → service-account.js} +112 -54
  81. package/dist/pages/service-account.js.map +1 -0
  82. package/dist/pages/service-accounts.d.ts +3 -0
  83. package/dist/pages/service-accounts.js +38 -0
  84. package/dist/pages/service-accounts.js.map +1 -0
  85. package/dist/pages/settings.d.ts +1 -0
  86. package/dist/pages/settings.js +104 -42
  87. package/dist/pages/settings.js.map +1 -1
  88. package/dist/pages/unregistered.js +2 -3
  89. package/dist/pages/unregistered.js.map +1 -1
  90. package/dist/pages/user.d.ts +6 -1
  91. package/dist/pages/user.js +18 -6
  92. package/dist/pages/user.js.map +1 -1
  93. package/dist/pages/users.js +6 -10
  94. package/dist/pages/users.js.map +1 -1
  95. package/package.json +3 -3
  96. package/src/components/actions-log.tsx +117 -0
  97. package/src/components/audit-sentence.tsx +55 -0
  98. package/src/components/command-palette.tsx +4 -4
  99. package/src/components/connected-apps.tsx +138 -0
  100. package/src/components/delete-place.tsx +180 -0
  101. package/src/components/directory.tsx +266 -110
  102. package/src/components/every-project.tsx +287 -0
  103. package/src/components/expiry-field.tsx +42 -0
  104. package/src/components/folders.tsx +219 -0
  105. package/src/components/grants.tsx +11 -4
  106. package/src/components/icons.tsx +2 -0
  107. package/src/components/missing.tsx +110 -0
  108. package/src/components/offboarding.tsx +62 -34
  109. package/src/components/page.tsx +4 -1
  110. package/src/components/principal-page.tsx +154 -108
  111. package/src/components/principal-picker.tsx +5 -5
  112. package/src/components/principal.tsx +4 -4
  113. package/src/components/references.tsx +323 -0
  114. package/src/components/service-tokens.tsx +112 -93
  115. package/src/components/shell.tsx +11 -32
  116. package/src/components/tabs.tsx +18 -0
  117. package/src/components/trusted-workloads.tsx +97 -79
  118. package/src/components/ui.tsx +8 -1
  119. package/src/index.ts +13 -3
  120. package/src/layout.tsx +2 -2
  121. package/src/lib/access-plan.ts +2 -2
  122. package/src/lib/audit-sentences.ts +161 -77
  123. package/src/lib/changes.ts +77 -5
  124. package/src/lib/coffre.ts +3 -2
  125. package/src/lib/one-time.ts +32 -0
  126. package/src/lib/project-access.ts +11 -23
  127. package/src/lib/project-page.ts +14 -0
  128. package/src/lib/queries.ts +126 -32
  129. package/src/lib/search.ts +25 -0
  130. package/src/lib/signin-errors.ts +45 -1
  131. package/src/lib/validation.ts +14 -0
  132. package/src/options.ts +187 -42
  133. package/src/pages/account.tsx +176 -133
  134. package/src/pages/approval.tsx +197 -0
  135. package/src/pages/audit.tsx +9 -61
  136. package/src/pages/environment.tsx +585 -286
  137. package/src/pages/login.tsx +8 -2
  138. package/src/pages/oauth-authorize.tsx +233 -0
  139. package/src/pages/project-access.tsx +219 -0
  140. package/src/pages/project-environments.tsx +582 -0
  141. package/src/pages/project-settings.tsx +259 -0
  142. package/src/pages/project.tsx +52 -879
  143. package/src/pages/projects.tsx +55 -18
  144. package/src/pages/service-account.tsx +50 -0
  145. package/src/pages/{tokens.tsx → service-accounts.tsx} +9 -6
  146. package/src/pages/settings.tsx +62 -8
  147. package/src/pages/user.tsx +16 -4
  148. package/src/pages/users.tsx +2 -2
  149. package/src/parity.ts +160 -0
  150. package/src/register.ts +57 -10
  151. package/src/router.tsx +4 -0
  152. package/src/shared/models.ts +6 -2
  153. package/src/styles/globals.css +536 -31
  154. package/dist/chunks/directory-CSjWWUQ1.js.map +0 -1
  155. package/dist/chunks/grants-saMQagmG.js +0 -160
  156. package/dist/chunks/grants-saMQagmG.js.map +0 -1
  157. package/dist/chunks/icons-D-PfAfnH.js +0 -203
  158. package/dist/chunks/icons-D-PfAfnH.js.map +0 -1
  159. package/dist/chunks/offboarding-C6l30DZR.js +0 -263
  160. package/dist/chunks/offboarding-C6l30DZR.js.map +0 -1
  161. package/dist/chunks/page-C5HcNqf2.js +0 -190
  162. package/dist/chunks/page-C5HcNqf2.js.map +0 -1
  163. package/dist/chunks/principal-page-D_91OA0l.js.map +0 -1
  164. package/dist/chunks/queries-CQ81o4so.js.map +0 -1
  165. package/dist/chunks/signin-errors-BEFlVDbQ.js +0 -30
  166. package/dist/chunks/signin-errors-BEFlVDbQ.js.map +0 -1
  167. package/dist/chunks/ui-DixXLQvQ.js.map +0 -1
  168. package/dist/chunks/use-action-CWsg_YWU.js +0 -49
  169. package/dist/chunks/use-action-CWsg_YWU.js.map +0 -1
  170. package/dist/chunks/use-change-c6CeLRin.js.map +0 -1
  171. package/dist/chunks/validation-BQtqPe2V.js +0 -29
  172. package/dist/chunks/validation-BQtqPe2V.js.map +0 -1
  173. package/dist/pages/token.d.ts +0 -3
  174. package/dist/pages/token.js.map +0 -1
  175. package/dist/pages/tokens.d.ts +0 -3
  176. package/dist/pages/tokens.js +0 -39
  177. package/dist/pages/tokens.js.map +0 -1
  178. package/dist/project-BqIy8gYR.d.ts +0 -5
  179. package/src/lib/instance.ts +0 -13
  180. package/src/pages/token.tsx +0 -34
@@ -1,505 +1,12 @@
1
- import { c as Notice, f as Toggletip, i as EmptyState, l as Spinner, m as breakAfterUnderscores, u as Timestamp } from "../chunks/ui-DixXLQvQ.js";
2
- import { G as X, H as User, I as ShieldCheck, R as SlashCircle, _ as Info, b as Ledger, l as Clock, r as AlertTriangle, s as ChevronRight, t as Activity } from "../chunks/icons-D-PfAfnH.js";
3
- import { i as PageHeader, n as ClosedDoor, u as useCoffre } from "../chunks/page-C5HcNqf2.js";
4
- import { u as queries } from "../chunks/queries-CQ81o4so.js";
1
+ import { c as Notice, f as Toggletip, i as EmptyState, l as Spinner, u as Timestamp } from "../chunks/ui-DJje3gST.js";
2
+ import { J as ShieldCheck, M as Ledger, X as SlashCircle, f as Activity, i as PageHeader, it as X, k as Info, m as AlertTriangle, n as ClosedDoor, tt as User, u as useCoffre, x as Clock, y as ChevronRight } from "../chunks/page-DvsgZ2Hd.js";
3
+ import { p as queries } from "../chunks/queries-DVR_i3rA.js";
5
4
  import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
6
- import { Fragment, useState } from "react";
5
+ import { a as lines, i as describe, n as memberName, o as runLabel, r as decidedBy, s as who, t as Sentence } from "../chunks/audit-sentence-BhHmvQX_.js";
6
+ import { useState } from "react";
7
7
  import { Link } from "@tanstack/react-router";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
9
  import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
10
- //#region src/lib/audit-sentences.ts
11
- var text = (value) => typeof value === "string" && value !== "" ? value : null;
12
- var number = (value) => typeof value === "number" ? value : null;
13
- /** The entry's place, as deep as it goes. */
14
- function place({ project, environment, key }) {
15
- const path = [
16
- project,
17
- environment,
18
- key
19
- ].filter((part) => part !== null);
20
- return path.length === 0 ? ["coffre"] : [{ place: path.join("/") }];
21
- }
22
- function environmentOf({ project, environment }) {
23
- return place({
24
- project,
25
- environment,
26
- key: null
27
- });
28
- }
29
- /** The member an entry is about: its subject, or the principal a token entry names. */
30
- function subject(entry) {
31
- if (entry.subject !== null) return [{ member: entry.subject }];
32
- const id = text(entry.metadata.principalId);
33
- if (id === null) return ["someone"];
34
- return [{ member: `${entry.metadata.principalType === "service" ? "token" : "user"}:${id}` }];
35
- }
36
- function plural(count, one, many = `${one}s`) {
37
- return `${count} ${count === 1 ? one : many}`;
38
- }
39
- /** A batch reads as its environment and a count; one entry as its secret. */
40
- function secrets(facts) {
41
- if (facts.batch.length === 1) return place(facts.entry);
42
- return [
43
- ...environmentOf(facts.entry),
44
- facts.refused ? ", " : ": ",
45
- plural(facts.count, "secret")
46
- ];
47
- }
48
- /** " to acme/market", when the entry names where a sync pushes. */
49
- function toDestination(entry) {
50
- const where = text(entry.metadata.destination);
51
- return where === null ? "" : ` to ${where}`;
52
- }
53
- function destination(entry) {
54
- return text(entry.metadata.destination) ?? "its destination";
55
- }
56
- var READ_VERBS = {
57
- reveal: ["revealed", "reveal"],
58
- run: ["ran", "run"],
59
- compare: ["compared", "compare"],
60
- sync: ["read", "read"]
61
- };
62
- function readVerb({ entry }) {
63
- return READ_VERBS[text(entry.metadata.purpose) ?? "reveal"] ?? READ_VERBS.reveal;
64
- }
65
- var placeTemplates = (kind) => {
66
- const what = (facts) => [`${kind} `, ...kind === "project" ? place({
67
- ...facts.entry,
68
- environment: null,
69
- key: null
70
- }) : environmentOf(facts.entry)];
71
- return {
72
- [`${kind}.create`]: {
73
- did: "created",
74
- tried: "create",
75
- what
76
- },
77
- [`${kind}.update`]: {
78
- did: "changed",
79
- tried: "change",
80
- what
81
- },
82
- [`${kind}.archive`]: {
83
- did: "archived",
84
- tried: "archive",
85
- what
86
- },
87
- [`${kind}.restore`]: {
88
- did: "restored",
89
- tried: "restore",
90
- what
91
- }
92
- };
93
- };
94
- var TEMPLATES = {
95
- "secret.read": {
96
- did: (facts) => readVerb(facts)[0],
97
- tried: (facts) => readVerb(facts)[1],
98
- what: secrets
99
- },
100
- "secret.write": {
101
- did: ({ batch }) => {
102
- const firsts = batch.filter((entry) => entry.version === 1).length;
103
- return firsts === batch.length ? "added" : firsts === 0 ? "changed" : "wrote";
104
- },
105
- tried: "change",
106
- what: secrets,
107
- then: ({ entry, batch }) => batch.length > 1 || entry.version === null || entry.version === 1 ? [] : [`, now version ${entry.version}`]
108
- },
109
- "secret.restore": {
110
- did: "restored",
111
- tried: "restore",
112
- what: ({ entry }) => [...place(entry), ...number(entry.metadata.from) === null ? [] : [` to version ${number(entry.metadata.from)}`]],
113
- then: ({ entry }) => entry.version === null ? [] : [`, now ${entry.version}`]
114
- },
115
- "secret.rename": {
116
- did: "renamed",
117
- tried: "rename",
118
- what: ({ entry }) => [...place(entry), ...text(entry.metadata.nextKey) === null ? [] : [` to ${text(entry.metadata.nextKey)}`]]
119
- },
120
- "secret.archive": {
121
- did: "archived",
122
- tried: "archive",
123
- what: (facts) => place(facts.entry)
124
- },
125
- "secret.unarchive": {
126
- did: "brought back",
127
- tried: "bring back",
128
- what: (facts) => place(facts.entry)
129
- },
130
- ...placeTemplates("project"),
131
- ...placeTemplates("environment"),
132
- "access.grant": {
133
- did: "gave",
134
- tried: "give",
135
- what: ({ entry }) => [
136
- ...subject(entry),
137
- ` ${text(entry.metadata.role) ?? "a role"} on `,
138
- ...placeOnly(entry)
139
- ],
140
- then: ({ entry }) => [...text(entry.metadata.previousRole) === null ? [] : [`, was ${text(entry.metadata.previousRole)}`], ...text(entry.metadata.expiresAt) === null ? [] : [`, until ${text(entry.metadata.expiresAt).slice(0, 10)}`]]
141
- },
142
- "access.revoke": {
143
- did: "took",
144
- tried: "take",
145
- what: ({ entry }) => [
146
- ...text(entry.metadata.previousRole ?? entry.metadata.role) === null ? ["access to "] : [`${text(entry.metadata.previousRole ?? entry.metadata.role)} on `],
147
- ...placeOnly(entry),
148
- " from ",
149
- ...subject(entry)
150
- ]
151
- },
152
- "member.add": {
153
- did: "added",
154
- tried: "add",
155
- what: ({ entry }) => [...subject(entry), ...entry.metadata.rootAdmin === true ? [" as a root admin"] : entry.metadata.owner === true ? [" as an owner"] : []]
156
- },
157
- "member.remove": {
158
- did: "removed",
159
- tried: "remove",
160
- what: (facts) => subject(facts.entry),
161
- then: ({ entry }) => number(entry.metadata.revoked) === null ? [] : [`, who held ${plural(number(entry.metadata.revoked), "grant")}`]
162
- },
163
- "member.restore": {
164
- did: "brought back",
165
- tried: "bring back",
166
- what: (facts) => subject(facts.entry)
167
- },
168
- "member.owner": {
169
- did: ({ entry }) => entry.metadata.owner === false ? "took owner from" : "made",
170
- tried: ({ entry }) => entry.metadata.owner === false ? "take owner from" : "make",
171
- what: ({ entry }) => [...subject(entry), ...entry.metadata.owner === false ? [] : [" an owner"]]
172
- },
173
- "sync.create": {
174
- did: "set up a sync of",
175
- tried: "set up a sync of",
176
- what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
177
- },
178
- "sync.update": {
179
- did: ({ entry }) => entry.metadata.paused === true ? "paused the sync of" : entry.metadata.paused === false ? "resumed the sync of" : "changed the sync of",
180
- tried: "change the sync of",
181
- what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
182
- },
183
- "sync.delete": {
184
- did: "removed the sync of",
185
- tried: "remove the sync of",
186
- what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
187
- },
188
- "sync.push": {
189
- did: "pushed",
190
- tried: "push",
191
- what: (facts) => facts.batch.length === 1 ? [...place(facts.entry), ` to ${destination(facts.entry)}`] : [...environmentOf(facts.entry), ` to ${destination(facts.entry)}: ${plural(facts.count, "secret")}`]
192
- },
193
- "sync.remove": {
194
- did: "removed",
195
- tried: "remove",
196
- what: (facts) => facts.batch.length === 1 ? [...place(facts.entry), ` from ${destination(facts.entry)}`] : [
197
- plural(facts.count, "secret"),
198
- " of ",
199
- ...environmentOf(facts.entry),
200
- ` from ${destination(facts.entry)}`
201
- ]
202
- },
203
- "token.bind": {
204
- did: "trusted CI runs to sign in as",
205
- tried: "trust CI runs to sign in as",
206
- what: (facts) => subject(facts.entry)
207
- },
208
- "token.unbind": {
209
- did: "stopped trusting CI runs to sign in as",
210
- tried: "stop trusting CI runs to sign in as",
211
- what: (facts) => subject(facts.entry)
212
- },
213
- "vault.tampered": {
214
- did: "found",
215
- tried: "check",
216
- what: ({ entry }) => [...entry.subject === null ? ["an entry"] : [...subject(entry), "'s record"], ` tampered with: ${TAMPERING[entry.reason ?? ""] ?? "it fails its seal"}`]
217
- },
218
- "key.rotate": {
219
- did: "rotated its key",
220
- tried: "rotate its key",
221
- what: () => []
222
- },
223
- sign_in: {
224
- did: ({ entry }) => entry.metadata.kind === "cli" ? "signed in to the CLI" : "signed in",
225
- tried: "sign in",
226
- what: ({ entry }) => text(entry.metadata.provider) === null ? [] : [`with ${text(entry.metadata.provider)}`]
227
- },
228
- sign_out: {
229
- did: "signed out",
230
- tried: "sign out",
231
- what: () => []
232
- },
233
- "token.create": {
234
- did: "issued a token to",
235
- tried: "issue a token to",
236
- what: (facts) => subject(facts.entry)
237
- },
238
- "token.revoke": {
239
- did: "revoked a token of",
240
- tried: "revoke a token of",
241
- what: (facts) => subject(facts.entry)
242
- },
243
- "device.approve": {
244
- did: "approved a CLI sign-in",
245
- tried: "approve a CLI sign-in",
246
- what: () => []
247
- },
248
- "device.deny": {
249
- did: "turned down a CLI sign-in",
250
- tried: "turn down a CLI sign-in",
251
- what: () => []
252
- },
253
- "account.link": {
254
- did: "linked",
255
- tried: "link",
256
- what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? "sign-in"} account`]
257
- },
258
- "account.unlink": {
259
- did: "unlinked",
260
- tried: "unlink",
261
- what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? "sign-in"} account`]
262
- },
263
- "key.wrap": {
264
- did: "sealed the key of",
265
- tried: "seal the key of",
266
- what: (facts) => versioned(facts.entry)
267
- },
268
- "key.rewrap": {
269
- did: "resealed the key of",
270
- tried: "reseal the key of",
271
- what: (facts) => versioned(facts.entry)
272
- },
273
- "key.intent": {
274
- did: "asked KMS about",
275
- tried: "ask KMS about",
276
- what: (facts) => secrets(facts)
277
- },
278
- "key.check": {
279
- did: "recorded the check value of",
280
- tried: "check",
281
- what: ({ entry }) => [[
282
- "the",
283
- text(entry.metadata.kekProvider) === "local" ? null : text(entry.metadata.kekProvider),
284
- "vault key",
285
- text(entry.metadata.kekId)
286
- ].filter((word) => word !== null).join(" ")]
287
- },
288
- "sync.run": {
289
- did: "ran the sync of",
290
- tried: "run the sync of",
291
- what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
292
- },
293
- "audit.heartbeat": {
294
- did: "checked in",
295
- tried: "check in",
296
- what: () => []
297
- },
298
- "audit.checkpoint": {
299
- did: "signed the log",
300
- tried: "sign the log",
301
- what: ({ entry }) => number(entry.metadata.seq) === null ? [] : [`through entry ${number(entry.metadata.seq)}`]
302
- },
303
- "secret.list": {
304
- did: "listed",
305
- tried: "list",
306
- what: ({ entry }) => environmentOf(entry)
307
- },
308
- "secret.history": {
309
- did: "read the history of",
310
- tried: "read the history of",
311
- what: (facts) => place(facts.entry)
312
- },
313
- "secret.update": {
314
- did: "changed",
315
- tried: "change",
316
- what: (facts) => place(facts.entry)
317
- },
318
- "sync.list": {
319
- did: "listed the syncs of",
320
- tried: "list the syncs of",
321
- what: ({ entry }) => environmentOf(entry)
322
- }
323
- };
324
- function placeOnly(entry) {
325
- return place({
326
- ...entry,
327
- key: null
328
- });
329
- }
330
- function versioned(entry) {
331
- return [...place(entry), ...entry.version === null ? [] : [`, version ${entry.version}`]];
332
- }
333
- var TAMPERING = {
334
- mac: "it does not carry the vault's seal",
335
- stale: "an older copy was put back",
336
- forged_entry: "the vault did not write it"
337
- };
338
- /** Why something was refused, in words. Codes from the vault and the app. */
339
- var REASONS = {
340
- no_grant: "no grant",
341
- bulk_limit: "bulk limit",
342
- expired: "grant expired",
343
- removed: "removed from coffre",
344
- not_a_member: "not a member",
345
- not_registered: "not invited",
346
- tampered: "their record was tampered with",
347
- bad_claim: "the key did not match the secret",
348
- not_allowed: "not allowed",
349
- root_admin: "root admins are set by the deployment",
350
- unknown_environment: "no such environment",
351
- unknown_secret: "no such secret",
352
- unknown_project: "no such project",
353
- unusable_credential: "its token is not a secret they can read",
354
- duplicate_destination: "already synced from elsewhere",
355
- cannot_grant_sync: "cannot grant the sync its reads",
356
- kms_unavailable: "KMS did not answer",
357
- wrong_kek: "the vault's key is not the one that wrapped the data"
358
- };
359
- /** What a missing permission meant, from the app's `missing_<permission>`. */
360
- var MISSING = {
361
- secret_read: "no grant to read it",
362
- secret_write: "no grant to write",
363
- secret_archive: "no grant to archive",
364
- audit_read: "no grant to read the audit log",
365
- environment_manage: "no grant to manage environments",
366
- grant_manage: "no grant to manage access",
367
- project_manage: "no grant to manage the project"
368
- };
369
- function reasonInWords(reason) {
370
- if (reason === null) return "refused";
371
- if (reason.startsWith("missing_")) return MISSING[reason.slice(8)] ?? "no grant";
372
- return REASONS[reason] ?? reason.replace(/_/g, " ");
373
- }
374
- /** In a batch of mixed actions, the one the line is named for: a sync's push, not its reads. */
375
- var LEAD = [
376
- "sync.push",
377
- "sync.remove",
378
- "secret.write",
379
- "secret.read"
380
- ];
381
- function leadOf(batch) {
382
- for (const action of LEAD) {
383
- const found = batch.find((entry) => entry.action === action);
384
- if (found !== void 0) return found;
385
- }
386
- return batch[0];
387
- }
388
- /** What a line says: one entry, or a batch that shares an operation. */
389
- function describe(batch) {
390
- const entry = leadOf(batch);
391
- const same = batch.filter((other) => other.action === entry.action);
392
- const denied = same.filter((other) => other.decision === "deny");
393
- const refused = denied.length === same.length;
394
- const facts = {
395
- entry,
396
- batch: same,
397
- count: new Set(same.map((other) => `${other.project}/${other.environment}/${other.key}`)).size,
398
- refused
399
- };
400
- const template = TEMPLATES[entry.action];
401
- if (template === void 0) return {
402
- parts: [
403
- entry.action,
404
- " ",
405
- ...place(entry)
406
- ],
407
- refused
408
- };
409
- const say = (verb) => typeof verb === "string" ? verb : verb(facts);
410
- const what = template.what(facts);
411
- const gap = what.length === 0 ? [] : [" "];
412
- if (refused) {
413
- const reason = reasonInWords((denied[0] ?? entry).reason);
414
- return {
415
- parts: [
416
- "tried to ",
417
- say(template.tried),
418
- ...gap,
419
- ...what,
420
- `: ${reason}`
421
- ],
422
- refused
423
- };
424
- }
425
- const partly = denied.length === 0 ? [] : [`, ${denied.length} refused: ${reasonInWords(denied[0].reason)}`];
426
- return {
427
- parts: [
428
- say(template.did),
429
- ...gap,
430
- ...what,
431
- ...template.then?.(facts) ?? [],
432
- ...partly
433
- ],
434
- refused
435
- };
436
- }
437
- /**
438
- * Who acted, as a part: a member links to their page; a sync or coffre
439
- * itself is text. A sync is named for where it pushes, which any entry of
440
- * its batch may say.
441
- */
442
- function who(batch) {
443
- const entry = batch[0];
444
- if (entry.actorType === "user") return { member: `user:${entry.actorId}` };
445
- if (entry.actorType === "service") return { member: `token:${entry.actorId}` };
446
- if (entry.actorId.startsWith("sync:")) {
447
- const id = batch.map((other) => text(other.metadata.provider)).find((provider) => provider !== null);
448
- const provider = id === void 0 ? void 0 : PROVIDERS[id] ?? id;
449
- return provider === void 0 ? "a sync" : `sync to ${provider}`;
450
- }
451
- return SYSTEM[entry.actorId] ?? entry.actorId;
452
- }
453
- var PROVIDERS = {
454
- "github-actions": "GitHub",
455
- vercel: "Vercel",
456
- railway: "Railway",
457
- "cloudflare-workers": "Cloudflare"
458
- };
459
- var SYSTEM = {
460
- scheduler: "the scheduler",
461
- cron: "the scheduler",
462
- vault: "the vault",
463
- app: "coffre"
464
- };
465
- /** Which components wrote the line, the vault first: "vault", "app", "vault, app". */
466
- function decidedBy(batch) {
467
- return ["vault", "app"].filter((author) => batch.some((entry) => entry.author === author)).join(", ");
468
- }
469
- /**
470
- * Entries in the order the page shows them, newest first, each batch as one
471
- * line at its newest entry. The server leaves detail out unless asked.
472
- */
473
- function lines(entries) {
474
- const shown = [];
475
- const batches = /* @__PURE__ */ new Map();
476
- for (const entry of entries) {
477
- const batch = entry.operationId === null ? void 0 : batches.get(entry.operationId);
478
- if (batch !== void 0) {
479
- batch.push(entry);
480
- continue;
481
- }
482
- const fresh = [entry];
483
- if (entry.operationId !== null) batches.set(entry.operationId, fresh);
484
- shown.push(fresh);
485
- }
486
- return shown;
487
- }
488
- /**
489
- * The CI run an entry was written for, as its issuer stated it at the
490
- * exchange: `acme/api run 7001 at 3f2a9c1`, a GitLab pipeline, or the
491
- * token's subject. Null for an entry no trust binding's credential wrote.
492
- */
493
- function runLabel(run) {
494
- if (run === null) return null;
495
- const { claims } = run;
496
- const text = (name) => typeof claims[name] === "string" || typeof claims[name] === "number" ? String(claims[name]) : null;
497
- const at = text("sha") === null ? "" : ` at ${text("sha").slice(0, 7)}`;
498
- if (text("repository") !== null && text("run_id") !== null) return `${text("repository")} run ${text("run_id")}${at}`;
499
- if (text("project_path") !== null && text("pipeline_id") !== null) return `${text("project_path")} pipeline ${text("pipeline_id")}${at}`;
500
- return text("sub") === null ? "a CI run" : `CI run ${text("sub")}`;
501
- }
502
- //#endregion
503
10
  //#region src/pages/audit.tsx
504
11
  var Route = pageRoute();
505
12
  function AuditPage() {
@@ -577,7 +84,10 @@ function AuditPage() {
577
84
  decision: void 0,
578
85
  detail: search.detail
579
86
  },
580
- activeOptions: { exact: true },
87
+ activeOptions: {
88
+ exact: true,
89
+ includeSearch: false
90
+ },
581
91
  children: "All events"
582
92
  }), /* @__PURE__ */ jsxs(Link, {
583
93
  to: "/audit",
@@ -586,7 +96,10 @@ function AuditPage() {
586
96
  decision: "deny",
587
97
  detail: search.detail
588
98
  },
589
- activeOptions: { exact: true },
99
+ activeOptions: {
100
+ exact: true,
101
+ includeSearch: false
102
+ },
590
103
  children: [/* @__PURE__ */ jsx(SlashCircle, { size: 13 }), "Denials only"]
591
104
  })]
592
105
  }),
@@ -624,7 +137,7 @@ function AuditPage() {
624
137
  ]
625
138
  }),
626
139
  /* @__PURE__ */ jsx("section", {
627
- className: "card",
140
+ className: "card card-wide",
628
141
  "aria-label": "Audit entries",
629
142
  children: shown.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
630
143
  title: deniedOnly ? "No denials recorded" : "Nothing recorded yet",
@@ -693,7 +206,6 @@ function Line({ batch, filters, detail, breakAt }) {
693
206
  detail,
694
207
  breaks: breaksInside && !grouped,
695
208
  marked: breaksInside,
696
- batch,
697
209
  toggle: grouped ? /* @__PURE__ */ jsx("button", {
698
210
  type: "button",
699
211
  className: "batch-toggle",
@@ -718,8 +230,8 @@ function Line({ batch, filters, detail, breakAt }) {
718
230
  }, entry.seq);
719
231
  })] });
720
232
  }
721
- function Row({ entry, seq, parts, refused, decided, filters, detail, breaks, marked, toggle, child = false, batch }) {
722
- const actor = who(batch ?? [entry]);
233
+ function Row({ entry, seq, parts, refused, decided, filters, detail, breaks, marked, toggle, child = false }) {
234
+ const actor = who(entry);
723
235
  const classes = [
724
236
  refused && "is-denied",
725
237
  (breaks || marked) && "is-break",
@@ -798,43 +310,6 @@ function Row({ entry, seq, parts, refused, decided, filters, detail, breaks, mar
798
310
  ]
799
311
  });
800
312
  }
801
- /** A sentence, its people and places links to their pages. */
802
- function Sentence({ parts }) {
803
- return /* @__PURE__ */ jsx(Fragment$1, { children: parts.map((part, index) => /* @__PURE__ */ jsx(Fragment, { children: typeof part === "string" ? part : "place" in part ? /* @__PURE__ */ jsx(PlaceLink, { path: part.place }) : /* @__PURE__ */ jsx(MemberLink, { member: part.member }) }, index)) });
804
- }
805
- function PlaceLink({ path }) {
806
- const [project, environment] = path.split("/");
807
- const text = /* @__PURE__ */ jsx("span", {
808
- className: "mono",
809
- children: breakAfterUnderscores(path)
810
- });
811
- return environment === void 0 ? /* @__PURE__ */ jsx(Link, {
812
- to: "/projects/$project",
813
- params: { project },
814
- children: text
815
- }) : /* @__PURE__ */ jsx(Link, {
816
- to: "/projects/$project/$environment",
817
- params: {
818
- project,
819
- environment
820
- },
821
- children: text
822
- });
823
- }
824
- function MemberLink({ member }) {
825
- return member.startsWith("token:") ? /* @__PURE__ */ jsx(Link, {
826
- to: "/tokens/$token",
827
- params: { token: member.slice(6) },
828
- children: member
829
- }) : /* @__PURE__ */ jsx(Link, {
830
- to: "/users/$user",
831
- params: { user: memberName(member) },
832
- children: memberName(member)
833
- });
834
- }
835
- function memberName(member) {
836
- return member.startsWith("user:") ? member.slice(5) : member;
837
- }
838
313
  /** The entry the log breaks at, said in words as well as in red. */
839
314
  function BreakMark() {
840
315
  return /* @__PURE__ */ jsxs("span", {
@@ -907,7 +382,7 @@ function ChainStatus({ chain, onRetry }) {
907
382
  })
908
383
  }), /* @__PURE__ */ jsx(Toggletip, {
909
384
  align: "end",
910
- label: `Every entry through ${chain.through ?? 0} holds, under the app's key and the vault's.` + (chain.checkpoint === null ? " The vault has not signed the log yet." : ` The vault last signed it through entry ${chain.checkpoint.seq}, at ${chain.checkpoint.signedAt}.`),
385
+ label: `Every entry through ${chain.through ?? 0} holds, under the app's key and the vault's.` + (chain.checkpoint === null ? " Not checkpointed yet: the vault signs the log every few minutes." : ` The vault last signed it through entry ${chain.checkpoint.seq}, at ${chain.checkpoint.signedAt}.`),
911
386
  children: /* @__PURE__ */ jsxs("button", {
912
387
  type: "button",
913
388
  className: "chain-seal",