@coffre/ui 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (177) 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/delete-place-CRX7ntE8.js +206 -0
  4. package/dist/chunks/delete-place-CRX7ntE8.js.map +1 -0
  5. package/dist/chunks/{directory-CSjWWUQ1.js → directory-zr3ek7Mc.js} +175 -60
  6. package/dist/chunks/directory-zr3ek7Mc.js.map +1 -0
  7. package/dist/chunks/folders-DoBmCwOi.js +207 -0
  8. package/dist/chunks/folders-DoBmCwOi.js.map +1 -0
  9. package/dist/chunks/grants-Cw1FyGID.js +669 -0
  10. package/dist/chunks/grants-Cw1FyGID.js.map +1 -0
  11. package/dist/chunks/offboarding-CE6d7um1.js +305 -0
  12. package/dist/chunks/offboarding-CE6d7um1.js.map +1 -0
  13. package/dist/chunks/one-time-DXEl9hbg.js +35 -0
  14. package/dist/chunks/one-time-DXEl9hbg.js.map +1 -0
  15. package/dist/chunks/page-DvsgZ2Hd.js +391 -0
  16. package/dist/chunks/page-DvsgZ2Hd.js.map +1 -0
  17. package/dist/chunks/principal-BIN-xwZw.js +42 -0
  18. package/dist/chunks/principal-BIN-xwZw.js.map +1 -0
  19. package/dist/chunks/{principal-page-D_91OA0l.js → principal-page-DhjO76GH.js} +245 -251
  20. package/dist/chunks/principal-page-DhjO76GH.js.map +1 -0
  21. package/dist/chunks/project-page-SRCtRe2g.js +17 -0
  22. package/dist/chunks/project-page-SRCtRe2g.js.map +1 -0
  23. package/dist/chunks/{queries-CQ81o4so.js → queries-DVR_i3rA.js} +132 -30
  24. package/dist/chunks/queries-DVR_i3rA.js.map +1 -0
  25. package/dist/chunks/references-B6pLT1uQ.js +343 -0
  26. package/dist/chunks/references-B6pLT1uQ.js.map +1 -0
  27. package/dist/chunks/{row-state-0PsrEzOL.js → row-state-DOPUsjQK.js} +3 -3
  28. package/dist/chunks/{row-state-0PsrEzOL.js.map → row-state-DOPUsjQK.js.map} +1 -1
  29. package/dist/chunks/signin-errors--ykMFuqN.js +57 -0
  30. package/dist/chunks/signin-errors--ykMFuqN.js.map +1 -0
  31. package/dist/chunks/tabs-BmwKfUeK.js +22 -0
  32. package/dist/chunks/tabs-BmwKfUeK.js.map +1 -0
  33. package/dist/chunks/{theme-B2vQolVR.js → theme-DJuz-xLM.js} +3 -3
  34. package/dist/chunks/{theme-B2vQolVR.js.map → theme-DJuz-xLM.js.map} +1 -1
  35. package/dist/chunks/{ui-DixXLQvQ.js → ui-DJje3gST.js} +6 -3
  36. package/dist/chunks/ui-DJje3gST.js.map +1 -0
  37. package/dist/chunks/{use-change-c6CeLRin.js → use-change-DUiGO19U.js} +52 -21
  38. package/dist/chunks/use-change-DUiGO19U.js.map +1 -0
  39. package/dist/chunks/{use-shell-jxd7Tzd-.js → use-shell-rNKfGjdj.js} +3 -3
  40. package/dist/chunks/{use-shell-jxd7Tzd-.js.map → use-shell-rNKfGjdj.js.map} +1 -1
  41. package/dist/chunks/validation-D312_NLf.js +87 -0
  42. package/dist/chunks/validation-D312_NLf.js.map +1 -0
  43. package/dist/index.d.ts +361 -27
  44. package/dist/index.js +188 -98
  45. package/dist/index.js.map +1 -1
  46. package/dist/pages/account.d.ts +2 -2
  47. package/dist/pages/account.js +297 -135
  48. package/dist/pages/account.js.map +1 -1
  49. package/dist/pages/approval.d.ts +9 -0
  50. package/dist/pages/approval.js +207 -0
  51. package/dist/pages/approval.js.map +1 -0
  52. package/dist/pages/audit.js +17 -542
  53. package/dist/pages/audit.js.map +1 -1
  54. package/dist/pages/device-login.js +2 -3
  55. package/dist/pages/device-login.js.map +1 -1
  56. package/dist/pages/environment.js +647 -257
  57. package/dist/pages/environment.js.map +1 -1
  58. package/dist/pages/login.js +18 -7
  59. package/dist/pages/login.js.map +1 -1
  60. package/dist/pages/oauth-authorize.d.ts +10 -0
  61. package/dist/pages/oauth-authorize.js +249 -0
  62. package/dist/pages/oauth-authorize.js.map +1 -0
  63. package/dist/pages/project-access.d.ts +6 -0
  64. package/dist/pages/project-access.js +370 -0
  65. package/dist/pages/project-access.js.map +1 -0
  66. package/dist/pages/project-environments.d.ts +4 -0
  67. package/dist/pages/project-environments.js +593 -0
  68. package/dist/pages/project-environments.js.map +1 -0
  69. package/dist/pages/project-settings.d.ts +4 -0
  70. package/dist/pages/project-settings.js +242 -0
  71. package/dist/pages/project-settings.js.map +1 -0
  72. package/dist/pages/project.d.ts +10 -2
  73. package/dist/pages/project.js +57 -934
  74. package/dist/pages/project.js.map +1 -1
  75. package/dist/pages/projects.js +53 -21
  76. package/dist/pages/projects.js.map +1 -1
  77. package/dist/pages/service-account.d.ts +10 -0
  78. package/dist/pages/{token.js → service-account.js} +115 -56
  79. package/dist/pages/service-account.js.map +1 -0
  80. package/dist/pages/service-accounts.d.ts +3 -0
  81. package/dist/pages/service-accounts.js +38 -0
  82. package/dist/pages/service-accounts.js.map +1 -0
  83. package/dist/pages/settings.d.ts +1 -0
  84. package/dist/pages/settings.js +104 -42
  85. package/dist/pages/settings.js.map +1 -1
  86. package/dist/pages/unregistered.js +2 -3
  87. package/dist/pages/unregistered.js.map +1 -1
  88. package/dist/pages/user.d.ts +6 -1
  89. package/dist/pages/user.js +18 -6
  90. package/dist/pages/user.js.map +1 -1
  91. package/dist/pages/users.js +6 -10
  92. package/dist/pages/users.js.map +1 -1
  93. package/package.json +3 -3
  94. package/src/components/actions-log.tsx +117 -0
  95. package/src/components/audit-sentence.tsx +55 -0
  96. package/src/components/command-palette.tsx +4 -4
  97. package/src/components/delete-place.tsx +180 -0
  98. package/src/components/directory.tsx +259 -110
  99. package/src/components/every-project.tsx +287 -0
  100. package/src/components/expiry-field.tsx +42 -0
  101. package/src/components/folders.tsx +219 -0
  102. package/src/components/grants.tsx +11 -4
  103. package/src/components/icons.tsx +2 -0
  104. package/src/components/missing.tsx +110 -0
  105. package/src/components/offboarding.tsx +61 -33
  106. package/src/components/page.tsx +4 -1
  107. package/src/components/principal-page.tsx +136 -106
  108. package/src/components/principal-picker.tsx +5 -5
  109. package/src/components/principal.tsx +4 -4
  110. package/src/components/references.tsx +323 -0
  111. package/src/components/service-tokens.tsx +115 -95
  112. package/src/components/shell.tsx +11 -32
  113. package/src/components/tabs.tsx +18 -0
  114. package/src/components/trusted-workloads.tsx +97 -79
  115. package/src/components/ui.tsx +8 -1
  116. package/src/index.ts +13 -2
  117. package/src/layout.tsx +2 -2
  118. package/src/lib/access-plan.ts +2 -2
  119. package/src/lib/audit-sentences.ts +161 -77
  120. package/src/lib/changes.ts +56 -5
  121. package/src/lib/coffre.ts +3 -2
  122. package/src/lib/one-time.ts +32 -0
  123. package/src/lib/project-access.ts +11 -23
  124. package/src/lib/project-page.ts +14 -0
  125. package/src/lib/queries.ts +126 -32
  126. package/src/lib/search.ts +25 -0
  127. package/src/lib/signin-errors.ts +45 -1
  128. package/src/lib/validation.ts +14 -0
  129. package/src/options.ts +187 -35
  130. package/src/pages/account.tsx +274 -129
  131. package/src/pages/approval.tsx +197 -0
  132. package/src/pages/audit.tsx +9 -61
  133. package/src/pages/environment.tsx +585 -286
  134. package/src/pages/login.tsx +8 -2
  135. package/src/pages/oauth-authorize.tsx +233 -0
  136. package/src/pages/project-access.tsx +219 -0
  137. package/src/pages/project-environments.tsx +582 -0
  138. package/src/pages/project-settings.tsx +259 -0
  139. package/src/pages/project.tsx +52 -879
  140. package/src/pages/projects.tsx +55 -18
  141. package/src/pages/service-account.tsx +50 -0
  142. package/src/pages/{tokens.tsx → service-accounts.tsx} +9 -6
  143. package/src/pages/settings.tsx +62 -8
  144. package/src/pages/user.tsx +16 -4
  145. package/src/pages/users.tsx +2 -2
  146. package/src/parity.ts +160 -0
  147. package/src/register.ts +58 -9
  148. package/src/router.tsx +4 -0
  149. package/src/shared/models.ts +6 -2
  150. package/src/styles/globals.css +536 -31
  151. package/dist/chunks/directory-CSjWWUQ1.js.map +0 -1
  152. package/dist/chunks/grants-saMQagmG.js +0 -160
  153. package/dist/chunks/grants-saMQagmG.js.map +0 -1
  154. package/dist/chunks/icons-D-PfAfnH.js +0 -203
  155. package/dist/chunks/icons-D-PfAfnH.js.map +0 -1
  156. package/dist/chunks/offboarding-C6l30DZR.js +0 -263
  157. package/dist/chunks/offboarding-C6l30DZR.js.map +0 -1
  158. package/dist/chunks/page-C5HcNqf2.js +0 -190
  159. package/dist/chunks/page-C5HcNqf2.js.map +0 -1
  160. package/dist/chunks/principal-page-D_91OA0l.js.map +0 -1
  161. package/dist/chunks/queries-CQ81o4so.js.map +0 -1
  162. package/dist/chunks/signin-errors-BEFlVDbQ.js +0 -30
  163. package/dist/chunks/signin-errors-BEFlVDbQ.js.map +0 -1
  164. package/dist/chunks/ui-DixXLQvQ.js.map +0 -1
  165. package/dist/chunks/use-action-CWsg_YWU.js +0 -49
  166. package/dist/chunks/use-action-CWsg_YWU.js.map +0 -1
  167. package/dist/chunks/use-change-c6CeLRin.js.map +0 -1
  168. package/dist/chunks/validation-BQtqPe2V.js +0 -29
  169. package/dist/chunks/validation-BQtqPe2V.js.map +0 -1
  170. package/dist/pages/token.d.ts +0 -3
  171. package/dist/pages/token.js.map +0 -1
  172. package/dist/pages/tokens.d.ts +0 -3
  173. package/dist/pages/tokens.js +0 -39
  174. package/dist/pages/tokens.js.map +0 -1
  175. package/dist/project-BqIy8gYR.d.ts +0 -5
  176. package/src/lib/instance.ts +0 -13
  177. package/src/pages/token.tsx +0 -34
@@ -1,263 +0,0 @@
1
- import { c as Notice, i as EmptyState, u as Timestamp } from "./ui-DixXLQvQ.js";
2
- import { H as User, s as ChevronRight, v as Key } from "./icons-D-PfAfnH.js";
3
- import { t as Card } from "./page-C5HcNqf2.js";
4
- import { s as PrincipalLink } from "./directory-CSjWWUQ1.js";
5
- import { Link } from "@tanstack/react-router";
6
- import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
- //#region src/components/offboarding.tsx
8
- /**
9
- * The part of a user's or token's page that answers "if they left, what would
10
- * we have to change?". Owners only, and most useful once someone is removed:
11
- * everything that let them in is gone by then, but what they saw is not.
12
- */
13
- function PrincipalReportCards({ report }) {
14
- return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(SeenValues, {
15
- report,
16
- removed: report.status === "removed",
17
- person: report.principalType === "user"
18
- }), report.issuedTokens.length > 0 && /* @__PURE__ */ jsx(IssuedTokens, { report })] });
19
- }
20
- function RemovedNotice({ report }) {
21
- const person = report.principalType === "user";
22
- return /* @__PURE__ */ jsx("div", {
23
- className: "report-notice",
24
- children: /* @__PURE__ */ jsxs(Notice, { children: [
25
- "Removed",
26
- report.removedBy !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
27
- " ",
28
- "by ",
29
- /* @__PURE__ */ jsx("span", {
30
- className: "mono",
31
- children: report.removedBy
32
- })
33
- ] }),
34
- report.removedAt !== null && /* @__PURE__ */ jsxs(Fragment, { children: [
35
- " ",
36
- "on ",
37
- /* @__PURE__ */ jsx(Timestamp, { iso: report.removedAt })
38
- ] }),
39
- ".",
40
- " ",
41
- person ? "Their project access, sessions, CLI logins and linked sign-in accounts were revoked at the same time, so adding them again starts from nothing." : "Its project access and every token issued to it were revoked at the same time, so adding it again starts from nothing."
42
- ] })
43
- });
44
- }
45
- /**
46
- * The people or tokens removed from the directory, under the live ones.
47
- * Removal ends their access but not the work it leaves, so they stay one click
48
- * away until every value they saw has been rotated.
49
- */
50
- function RemovedList({ principalType, removed }) {
51
- const users = principalType === "user";
52
- const rows = removed.filter((principal) => principal.principalType === principalType);
53
- if (rows.length === 0) return null;
54
- return /* @__PURE__ */ jsxs(Fragment, { children: [
55
- /* @__PURE__ */ jsx("h2", {
56
- className: "section-title",
57
- children: "Removed"
58
- }),
59
- /* @__PURE__ */ jsx("section", {
60
- className: "card",
61
- "aria-label": users ? "Removed users" : "Removed tokens",
62
- children: /* @__PURE__ */ jsx("div", {
63
- className: "dt-wrap",
64
- children: /* @__PURE__ */ jsxs("table", {
65
- className: "dt directory stacks",
66
- children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
67
- /* @__PURE__ */ jsx("th", {
68
- className: "n",
69
- children: "#"
70
- }),
71
- /* @__PURE__ */ jsx("th", {
72
- className: "col-principal",
73
- children: /* @__PURE__ */ jsxs("span", {
74
- className: "th",
75
- children: [users ? /* @__PURE__ */ jsx(User, { size: 14 }) : /* @__PURE__ */ jsx(Key, { size: 14 }), users ? "Email" : "Name"]
76
- })
77
- }),
78
- /* @__PURE__ */ jsx("th", {
79
- className: "col-role",
80
- children: "Still to rotate"
81
- }),
82
- /* @__PURE__ */ jsx("th", {
83
- className: "col-actions",
84
- children: /* @__PURE__ */ jsx("span", {
85
- className: "visually-hidden",
86
- children: "Report"
87
- })
88
- })
89
- ] }) }), /* @__PURE__ */ jsx("tbody", { children: rows.map((principal, index) => /* @__PURE__ */ jsxs("tr", {
90
- className: "row-link",
91
- children: [
92
- /* @__PURE__ */ jsx("td", {
93
- className: "n",
94
- children: index + 1
95
- }),
96
- /* @__PURE__ */ jsx("td", {
97
- className: "col-lead",
98
- "data-label": users ? "Email" : "Name",
99
- children: /* @__PURE__ */ jsx(PrincipalLink, {
100
- type: principal.principalType,
101
- id: principal.principalId,
102
- stretch: true
103
- })
104
- }),
105
- /* @__PURE__ */ jsx("td", {
106
- className: "col-role",
107
- "data-label": "Still to rotate",
108
- children: principal.toRotate === 0 ? /* @__PURE__ */ jsx("span", {
109
- className: "cell-muted",
110
- children: "Nothing"
111
- }) : `${principal.toRotate} ${principal.toRotate === 1 ? "value" : "values"}`
112
- }),
113
- /* @__PURE__ */ jsx("td", {
114
- className: "col-actions col-open cell-muted",
115
- "aria-hidden": "true",
116
- children: /* @__PURE__ */ jsx(ChevronRight, { size: 16 })
117
- })
118
- ]
119
- }, principal.principalId)) })]
120
- })
121
- })
122
- }),
123
- /* @__PURE__ */ jsxs("p", {
124
- className: "hint section-foot",
125
- children: [
126
- users ? "They" : "These",
127
- " can no longer sign in. Each page lists the values",
128
- " ",
129
- users ? "they" : "it",
130
- " saw that nobody has changed since."
131
- ]
132
- })
133
- ] });
134
- }
135
- function SeenValues({ report, removed, person }) {
136
- const they = person ? "they" : "it";
137
- const description = removed ? `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.` : `Current values ${they} ${person ? "have" : "has"} read or written: the ones to rotate if ${they} ${person ? "leave" : "is retired"}. Saving a new version takes a value off.`;
138
- return /* @__PURE__ */ jsx(Card, {
139
- labelledBy: "seen-values",
140
- title: removed ? "Still to rotate" : "Values seen",
141
- description,
142
- actions: report.rotated > 0 && /* @__PURE__ */ jsxs("span", {
143
- className: "card-aside",
144
- children: [report.rotated, " already rotated"]
145
- }),
146
- children: report.exposed.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
147
- title: removed ? "Nothing left to rotate" : "No current values seen",
148
- children: report.rotated > 0 ? `Every value ${they} saw has had a new version since.` : `${person ? "They have" : "It has"} not read or written a value that is still current.`
149
- }) : /* @__PURE__ */ jsx("div", {
150
- className: "dt-wrap",
151
- children: /* @__PURE__ */ jsxs("table", {
152
- className: "dt report-values",
153
- children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
154
- /* @__PURE__ */ jsx("th", { children: "Secret" }),
155
- /* @__PURE__ */ jsx("th", {
156
- className: "col-shrink",
157
- children: "Version"
158
- }),
159
- /* @__PURE__ */ jsx("th", {
160
- className: "col-shrink",
161
- children: "Last seen"
162
- })
163
- ] }) }), /* @__PURE__ */ jsx("tbody", { children: report.exposed.map((secret) => /* @__PURE__ */ jsxs("tr", { children: [
164
- /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsxs(Link, {
165
- className: "cell-link mono",
166
- to: "/projects/$project/$environment",
167
- params: {
168
- project: secret.project,
169
- environment: secret.environment
170
- },
171
- search: { filter: secret.key },
172
- children: [/* @__PURE__ */ jsxs("span", {
173
- className: "report-path",
174
- children: [
175
- secret.project,
176
- "/",
177
- secret.environment,
178
- "/"
179
- ]
180
- }), secret.key]
181
- }) }),
182
- /* @__PURE__ */ jsxs("td", {
183
- className: "col-shrink cell-mono cell-muted",
184
- children: ["v", secret.version]
185
- }),
186
- /* @__PURE__ */ jsxs("td", {
187
- className: "col-shrink nowrap",
188
- children: [
189
- secret.how === "wrote" ? "Wrote" : "Read",
190
- " ",
191
- /* @__PURE__ */ jsx(Timestamp, {
192
- iso: secret.at,
193
- display: "relative"
194
- })
195
- ]
196
- })
197
- ] }, `${secret.project}/${secret.environment}/${secret.key}`)) })]
198
- })
199
- })
200
- });
201
- }
202
- function IssuedTokens({ report }) {
203
- return /* @__PURE__ */ jsx(Card, {
204
- labelledBy: "issued-tokens",
205
- title: "Tokens they issued",
206
- description: "Service tokens they created that still work. Each was shown to them once, when it was made; revoke any they may have kept a copy of.",
207
- children: /* @__PURE__ */ jsx("div", {
208
- className: "dt-wrap",
209
- children: /* @__PURE__ */ jsxs("table", {
210
- className: "dt report-tokens",
211
- children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
212
- /* @__PURE__ */ jsx("th", { children: "Token" }),
213
- /* @__PURE__ */ jsx("th", {
214
- className: "col-shrink",
215
- children: "Expires"
216
- }),
217
- /* @__PURE__ */ jsx("th", {
218
- className: "col-shrink col-hide-narrow",
219
- children: "Last used"
220
- })
221
- ] }) }), /* @__PURE__ */ jsx("tbody", { children: report.issuedTokens.map((token) => /* @__PURE__ */ jsxs("tr", { children: [
222
- /* @__PURE__ */ jsx("td", { children: /* @__PURE__ */ jsxs("span", {
223
- className: "cell-stack",
224
- children: [/* @__PURE__ */ jsx(Link, {
225
- className: "cell-link mono",
226
- to: "/tokens/$token",
227
- params: { token: token.service },
228
- children: token.service
229
- }), /* @__PURE__ */ jsxs("small", { children: [
230
- token.label ?? "No label",
231
- " · ",
232
- /* @__PURE__ */ jsx("span", {
233
- className: "mono",
234
- children: token.hint
235
- })
236
- ] })]
237
- }) }),
238
- /* @__PURE__ */ jsx("td", {
239
- className: "col-shrink nowrap",
240
- children: /* @__PURE__ */ jsx(Timestamp, {
241
- iso: token.expiresAt,
242
- display: "relative"
243
- })
244
- }),
245
- /* @__PURE__ */ jsx("td", {
246
- className: "col-shrink col-hide-narrow nowrap",
247
- children: token.lastUsedAt === null ? /* @__PURE__ */ jsx("span", {
248
- className: "cell-muted",
249
- children: "Never"
250
- }) : /* @__PURE__ */ jsx(Timestamp, {
251
- iso: token.lastUsedAt,
252
- display: "relative"
253
- })
254
- })
255
- ] }, token.id)) })]
256
- })
257
- })
258
- });
259
- }
260
- //#endregion
261
- export { RemovedList as n, RemovedNotice as r, PrincipalReportCards as t };
262
-
263
- //# sourceMappingURL=offboarding-C6l30DZR.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"offboarding-C6l30DZR.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 { ChevronRight, Key, User } from './icons';\n\n/**\n * The part of a user's or token's page that answers \"if they left, what would\n * we have to change?\". Owners only, and most useful once someone is removed:\n * everything that let them in is gone by then, but what they saw is not.\n */\nexport function PrincipalReportCards({ report }: { report: PrincipalReport }) {\n const removed = report.status === 'removed';\n const person = report.principalType === 'user';\n return (\n <>\n <SeenValues report={report} removed={removed} person={person} />\n {report.issuedTokens.length > 0 && <IssuedTokens 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 and linked sign-in accounts 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 tokens 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 tokens'}>\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\">Still to rotate</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=\"Still to rotate\">\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 <p className=\"hint section-foot\">\n {users ? 'They' : 'These'} can no longer sign in. Each page lists the values{' '}\n {users ? 'they' : 'it'} saw that nobody has changed since.\n </p>\n </>\n );\n}\n\nfunction SeenValues({\n report,\n removed,\n person,\n}: {\n report: PrincipalReport;\n removed: boolean;\n person: boolean;\n}) {\n const they = person ? 'they' : 'it';\n const description = removed\n ? `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 : `Current values ${they} ${person ? 'have' : 'has'} read or written: the ones to rotate if ${they} ${person ? 'leave' : 'is retired'}. Saving a new version takes a value off.`;\n\n return (\n <Card\n labelledBy=\"seen-values\"\n title={removed ? 'Still to rotate' : 'Values seen'}\n description={description}\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={removed ? 'Nothing left to rotate' : 'No current values seen'}>\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\nfunction IssuedTokens({ report }: { report: PrincipalReport }) {\n return (\n <Card\n labelledBy=\"issued-tokens\"\n title=\"Tokens they issued\"\n description=\"Service tokens they created 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=\"/tokens/$token\" params={{ token: token.service }}>\n {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":";;;;;;;;;;;;AAYA,SAAgB,qBAAqB,EAAE,UAAuC;CAG5E,OACE,qBAAA,UAAA,EAAA,UAAA,CACE,oBAAC,YAAD;EAAoB;EAAiB,SAJzB,OAAO,WAAW;EAIwB,QAH3C,OAAO,kBAAkB;CAG2B,CAAA,GAC9D,OAAO,aAAa,SAAS,KAAK,oBAAC,cAAD,EAAsB,OAAS,CAAA,CAClE,EAAA,CAAA;AAEN;AAEA,SAAgB,cAAc,EAAE,UAAuC;CACrE,MAAM,SAAS,OAAO,kBAAkB;CACxC,OACE,oBAAC,OAAD;EAAK,WAAU;YACb,qBAAC,QAAD,EAAA,UAAA;GAAQ;GAEL,OAAO,cAAc,QACpB,qBAAA,UAAA,EAAA,UAAA;IACG;IAAI;IAAG,oBAAC,QAAD;KAAM,WAAU;eAAQ,OAAO;IAAgB,CAAA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AAA;IACtD,EAAA,CAAA,EACC,CAAA,GACP,oBAAC,SAAD,EAAA,UACG,OAAO,aAAa,KAAK,UACxB,qBAAC,MAAD,EAAA,UAAA;KACE,oBAAC,MAAD,EAAA,UACE,qBAAC,QAAD;MAAM,WAAU;gBAAhB,CACE,oBAAC,MAAD;OAAM,WAAU;OAAiB,IAAG;OAAiB,QAAQ,EAAE,OAAO,MAAM,QAAQ;iBACjF,MAAM;MACH,CAAA,GACN,qBAAC,SAAD,EAAA,UAAA;OACG,MAAM,SAAS;OAAW;OAAG,oBAAC,QAAD;QAAM,WAAU;kBAAQ,MAAM;OAAW,CAAA;MAClE,EAAA,CAAA,CACH;QACJ,CAAA;KACJ,oBAAC,MAAD;MAAI,WAAU;gBACZ,oBAAC,WAAD;OAAW,KAAK,MAAM;OAAW,SAAQ;MAAY,CAAA;KACnD,CAAA;KACJ,oBAAC,MAAD;MAAI,WAAU;gBACX,MAAM,eAAe,OACpB,oBAAC,QAAD;OAAM,WAAU;iBAAa;MAAW,CAAA,IAExC,oBAAC,WAAD;OAAW,KAAK,MAAM;OAAY,SAAQ;MAAY,CAAA;KAEtD,CAAA;IACF,EAAA,GArBK,MAAM,EAqBX,CACL,EACI,CAAA,CACF;;EACJ,CAAA;CACD,CAAA;AAEV"}
@@ -1,190 +0,0 @@
1
- import { useRouter } from "@tanstack/react-router";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
- import { CoffreError } from "@coffre/client";
4
- //#region src/components/tile.tsx
5
- var HUES = [
6
- "blue",
7
- "green",
8
- "amber",
9
- "violet"
10
- ];
11
- /** The same name always lands on the same tint, on every screen (FNV-1a). */
12
- function tileHue(name) {
13
- let hash = 2166136261;
14
- for (const char of name) hash = Math.imul(hash ^ char.charCodeAt(0), 16777619) >>> 0;
15
- return HUES[hash % HUES.length];
16
- }
17
- /**
18
- * A letter on a tint, standing in for a project wherever its name appears.
19
- *
20
- * It is a recognition aid, not information: the name is always beside it, so
21
- * the tile is hidden from assistive technology.
22
- */
23
- function Tile({ name, size = "sm" }) {
24
- return /* @__PURE__ */ jsx("span", {
25
- className: `tile tile-${tileHue(name)}${size === "lg" ? " tile-lg" : ""}`,
26
- "aria-hidden": true,
27
- children: name.slice(0, 1)
28
- });
29
- }
30
- //#endregion
31
- //#region src/lib/coffre.ts
32
- /**
33
- * The API as whoever is looking at the page, with their permissions: what
34
- * coffre's pages call, and a deployment's own may too. In the browser this
35
- * is plain `fetch` to `/api`, carrying the session cookie; on the server,
36
- * the API in process. Components call it from event handlers; loaders read
37
- * the same client as `context.coffre`.
38
- */
39
- function useCoffre() {
40
- return useRouter().options.context.coffre;
41
- }
42
- /** A refusal the page words itself, shown as it is. */
43
- var Refusal = class extends Error {};
44
- /** The HTTP status of an API error; undefined when the request never got an answer. */
45
- function statusOf(error) {
46
- return error instanceof CoffreError ? error.status : void 0;
47
- }
48
- /** What to tell the person when a call fails. */
49
- function failureMessage(error) {
50
- if (error instanceof Refusal) return error.message;
51
- if (!(error instanceof CoffreError)) return "The request could not be sent. Nothing was changed.";
52
- if (error.status === 401) return "Your session has ended. Sign in again, then retry.";
53
- if (error.code === "cross_origin") return "coffre refused a change that did not come from this page. Reload, then retry.";
54
- if (error.status === 403) return "You hold no grant that covers this. Someone with grant.manage on the project can add one.";
55
- if (error.status === 404) return "Not found. It may have been renamed or archived.";
56
- if (error.status === 400 || error.status === 409) return error.message;
57
- return "coffre is unavailable. Nothing was read or written.";
58
- }
59
- function uiFailure(error) {
60
- return {
61
- ok: false,
62
- error: failureMessage(error),
63
- signedOut: statusOf(error) === 401
64
- };
65
- }
66
- /** A loader's answer: what it read, or what to say instead. */
67
- async function uiResult(operation) {
68
- try {
69
- return {
70
- ok: true,
71
- ...await operation()
72
- };
73
- } catch (error) {
74
- return uiFailure(error);
75
- }
76
- }
77
- /** How the API names a member: `user:ada@acme.example`, `token:ci-deploy`. */
78
- function memberRef(principalType, principalId) {
79
- return `${principalType === "user" ? "user" : "token"}:${principalId}`;
80
- }
81
- //#endregion
82
- //#region src/components/page.tsx
83
- /**
84
- * The head of every page: an optional project tile, the title with a muted
85
- * aside, one line of description or facts, and the page's own actions.
86
- *
87
- * Where you are is already in the top bar's path, so the head does not repeat
88
- * it; it says what this page is.
89
- */
90
- function PageHeader({ tile, lead, title, aside, description, meta, actions }) {
91
- return /* @__PURE__ */ jsxs("header", {
92
- className: "page-head",
93
- children: [/* @__PURE__ */ jsxs("div", {
94
- className: "page-head-text",
95
- children: [
96
- tile !== void 0 && /* @__PURE__ */ jsx(Tile, {
97
- name: tile,
98
- size: "lg"
99
- }),
100
- lead,
101
- /* @__PURE__ */ jsxs("div", {
102
- style: { minWidth: 0 },
103
- children: [
104
- /* @__PURE__ */ jsxs("h1", {
105
- className: "page-title",
106
- children: [/* @__PURE__ */ jsx("span", { children: title }), aside !== void 0 && aside !== null && /* @__PURE__ */ jsx("span", {
107
- className: "page-title-aside",
108
- children: aside
109
- })]
110
- }),
111
- description !== void 0 && /* @__PURE__ */ jsx("p", {
112
- className: "page-desc",
113
- children: description
114
- }),
115
- meta !== void 0 && /* @__PURE__ */ jsx("div", {
116
- className: "page-meta",
117
- children: meta
118
- })
119
- ]
120
- })
121
- ]
122
- }), actions !== void 0 && actions !== false && /* @__PURE__ */ jsx("div", {
123
- className: "page-actions",
124
- children: actions
125
- })]
126
- });
127
- }
128
- /** A bordered panel with a titled head; tables inside it run edge to edge. */
129
- function Card({ title, description, actions, children, labelledBy, tone }) {
130
- return /* @__PURE__ */ jsxs("section", {
131
- className: `card${tone === "danger" ? " card-danger" : ""}`,
132
- "aria-labelledby": labelledBy,
133
- children: [/* @__PURE__ */ jsxs("div", {
134
- className: "card-head",
135
- children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h2", {
136
- className: "card-title",
137
- id: labelledBy,
138
- children: title
139
- }), description !== void 0 && /* @__PURE__ */ jsx("p", {
140
- className: "card-desc",
141
- children: description
142
- })] }), actions]
143
- }), children]
144
- });
145
- }
146
- /** One labelled fact in a card's `dl.facts`. */
147
- function Fact({ label, children }) {
148
- return /* @__PURE__ */ jsxs("div", {
149
- className: "fact",
150
- children: [/* @__PURE__ */ jsx("dt", { children: label }), /* @__PURE__ */ jsx("dd", { children })]
151
- });
152
- }
153
- /**
154
- * A page that cannot be shown: no access, no such thing, or no session.
155
- *
156
- * It says which page, why in a sentence, and offers the one useful way out.
157
- */
158
- function ClosedDoor({ icon, label, title, children, actions }) {
159
- return /* @__PURE__ */ jsxs("div", {
160
- className: "closed",
161
- role: "status",
162
- children: [
163
- icon !== void 0 && /* @__PURE__ */ jsx("div", {
164
- className: "closed-icon",
165
- "aria-hidden": true,
166
- children: icon
167
- }),
168
- label !== void 0 && /* @__PURE__ */ jsx("p", {
169
- className: "closed-label",
170
- children: label
171
- }),
172
- /* @__PURE__ */ jsx("h1", {
173
- className: "closed-title",
174
- children: title
175
- }),
176
- /* @__PURE__ */ jsx("div", {
177
- className: "closed-body",
178
- children
179
- }),
180
- actions !== void 0 && /* @__PURE__ */ jsx("div", {
181
- className: "closed-actions",
182
- children: actions
183
- })
184
- ]
185
- });
186
- }
187
- //#endregion
188
- export { Refusal as a, statusOf as c, Tile as d, PageHeader as i, uiResult as l, ClosedDoor as n, failureMessage as o, Fact as r, memberRef as s, Card as t, useCoffre as u };
189
-
190
- //# sourceMappingURL=page-C5HcNqf2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"page-C5HcNqf2.js","names":[],"sources":["../../src/components/tile.tsx","../../src/lib/coffre.ts","../../src/components/page.tsx"],"sourcesContent":["const HUES = ['blue', 'green', 'amber', 'violet'] as const;\n\n/** The same name always lands on the same tint, on every screen (FNV-1a). */\nexport function tileHue(name: string): (typeof HUES)[number] {\n let hash = 0x811c9dc5;\n for (const char of name) hash = Math.imul(hash ^ char.charCodeAt(0), 0x01000193) >>> 0;\n return HUES[hash % HUES.length];\n}\n\n/**\n * A letter on a tint, standing in for a project wherever its name appears.\n *\n * It is a recognition aid, not information: the name is always beside it, so\n * the tile is hidden from assistive technology.\n */\nexport function Tile({ name, size = 'sm' }: { name: string; size?: 'sm' | 'lg' }) {\n return (\n <span className={`tile tile-${tileHue(name)}${size === 'lg' ? ' tile-lg' : ''}`} aria-hidden>\n {name.slice(0, 1)}\n </span>\n );\n}\n","import { CoffreError, type CoffreClient } from '@coffre/client';\nimport { useRouter } from '@tanstack/react-router';\n\nimport type { CoffreContext } from '../options';\n\n/**\n * The API as whoever is looking at the page, with their permissions: what\n * coffre's pages call, and a deployment's own may too. In the browser this\n * is plain `fetch` to `/api`, carrying the session cookie; on the server,\n * the API in process. Components call it from event handlers; loaders read\n * the same client as `context.coffre`.\n */\nexport function useCoffre(): CoffreClient {\n return (useRouter().options.context as CoffreContext).coffre;\n}\n\n/** A refusal the page words itself, shown as it is. */\nexport class Refusal extends Error {}\n\n/** A call that failed: what to say, and whether signing in again would help, which it does only for an ended session. */\ntype Failure = { ok: false; error: string; signedOut: boolean };\n\n/** The HTTP status of an API error; undefined when the request never got an answer. */\nexport function statusOf(error: unknown): number | undefined {\n return error instanceof CoffreError ? error.status : undefined;\n}\n\n/** What to tell the person when a call fails. */\nexport function failureMessage(error: unknown): string {\n if (error instanceof Refusal) return error.message;\n if (!(error instanceof CoffreError)) return 'The request could not be sent. Nothing was changed.';\n if (error.status === 401) return 'Your session has ended. Sign in again, then retry.';\n if (error.code === 'cross_origin') return 'coffre refused a change that did not come from this page. Reload, then retry.';\n if (error.status === 403) {\n return 'You hold no grant that covers this. Someone with grant.manage on the project can add one.';\n }\n if (error.status === 404) return 'Not found. It may have been renamed or archived.';\n // A 400 or 409 carries a sentence written for the person, such as which\n // field of a request is wrong. Anything unexpected stays generic.\n if (error.status === 400 || error.status === 409) return error.message;\n return 'coffre is unavailable. Nothing was read or written.';\n}\n\nexport function uiFailure(error: unknown): Failure {\n return { ok: false, error: failureMessage(error), signedOut: statusOf(error) === 401 };\n}\n\n/** A loader's answer: what it read, or what to say instead. */\nexport async function uiResult<T extends object>(\n operation: () => Promise<T>,\n): Promise<({ ok: true } & T) | Failure> {\n try {\n return { ok: true, ...(await operation()) };\n } catch (error) {\n return uiFailure(error);\n }\n}\n\n/** How the API names a member: `user:ada@acme.example`, `token:ci-deploy`. */\nexport function memberRef(principalType: 'user' | 'service', principalId: string): string {\n return `${principalType === 'user' ? 'user' : 'token'}:${principalId}`;\n}\n","import type { ReactNode } from 'react';\nimport { Tile } from './tile';\n\n/**\n * The head of every page: an optional project tile, the title with a muted\n * aside, one line of description or facts, and the page's own actions.\n *\n * Where you are is already in the top bar's path, so the head does not repeat\n * it; it says what this page is.\n */\nexport function PageHeader({\n tile,\n lead,\n title,\n aside,\n description,\n meta,\n actions,\n}: {\n tile?: string;\n /** Stands where the tile would, for pages that are not about a project. */\n lead?: ReactNode;\n title: ReactNode;\n aside?: ReactNode;\n description?: ReactNode;\n meta?: ReactNode;\n actions?: ReactNode;\n}) {\n return (\n <header className=\"page-head\">\n <div className=\"page-head-text\">\n {tile !== undefined && <Tile name={tile} size=\"lg\" />}\n {lead}\n <div style={{ minWidth: 0 }}>\n <h1 className=\"page-title\">\n <span>{title}</span>\n {aside !== undefined && aside !== null && (\n <span className=\"page-title-aside\">{aside}</span>\n )}\n </h1>\n {description !== undefined && <p className=\"page-desc\">{description}</p>}\n {meta !== undefined && <div className=\"page-meta\">{meta}</div>}\n </div>\n </div>\n {actions !== undefined && actions !== false && (\n <div className=\"page-actions\">{actions}</div>\n )}\n </header>\n );\n}\n\n/** A bordered panel with a titled head; tables inside it run edge to edge. */\nexport function Card({\n title,\n description,\n actions,\n children,\n labelledBy,\n tone,\n}: {\n title: ReactNode;\n description?: ReactNode;\n actions?: ReactNode;\n children: ReactNode;\n labelledBy: string;\n tone?: 'danger';\n}) {\n return (\n <section\n className={`card${tone === 'danger' ? ' card-danger' : ''}`}\n aria-labelledby={labelledBy}\n >\n <div className=\"card-head\">\n <div>\n <h2 className=\"card-title\" id={labelledBy}>\n {title}\n </h2>\n {description !== undefined && <p className=\"card-desc\">{description}</p>}\n </div>\n {actions}\n </div>\n {children}\n </section>\n );\n}\n\n/** One labelled fact in a card's `dl.facts`. */\nexport function Fact({ label, children }: { label: string; children: ReactNode }) {\n return (\n <div className=\"fact\">\n <dt>{label}</dt>\n <dd>{children}</dd>\n </div>\n );\n}\n\n/**\n * A page that cannot be shown: no access, no such thing, or no session.\n *\n * It says which page, why in a sentence, and offers the one useful way out.\n */\nexport function ClosedDoor({\n icon,\n label,\n title,\n children,\n actions,\n}: {\n icon?: ReactNode;\n label?: ReactNode;\n title: ReactNode;\n children: ReactNode;\n actions?: ReactNode;\n}) {\n return (\n <div className=\"closed\" role=\"status\">\n {icon !== undefined && (\n <div className=\"closed-icon\" aria-hidden>\n {icon}\n </div>\n )}\n {label !== undefined && <p className=\"closed-label\">{label}</p>}\n <h1 className=\"closed-title\">{title}</h1>\n <div className=\"closed-body\">{children}</div>\n {actions !== undefined && <div className=\"closed-actions\">{actions}</div>}\n </div>\n );\n}\n"],"mappings":";;;;AAAA,IAAM,OAAO;CAAC;CAAQ;CAAS;CAAS;AAAQ;;AAGhD,SAAgB,QAAQ,MAAqC;CAC3D,IAAI,OAAO;CACX,KAAK,MAAM,QAAQ,MAAM,OAAO,KAAK,KAAK,OAAO,KAAK,WAAW,CAAC,GAAG,QAAU,MAAM;CACrF,OAAO,KAAK,OAAO,KAAK;AAC1B;;;;;;;AAQA,SAAgB,KAAK,EAAE,MAAM,OAAO,QAA8C;CAChF,OACE,oBAAC,QAAD;EAAM,WAAW,aAAa,QAAQ,IAAI,IAAI,SAAS,OAAO,aAAa;EAAM,eAAA;YAC9E,KAAK,MAAM,GAAG,CAAC;CACZ,CAAA;AAEV;;;;;;;;;;ACTA,SAAgB,YAA0B;CACxC,OAAQ,UAAU,CAAC,CAAC,QAAQ,QAA0B;AACxD;;AAGA,IAAa,UAAb,cAA6B,MAAM,CAAC;;AAMpC,SAAgB,SAAS,OAAoC;CAC3D,OAAO,iBAAiB,cAAc,MAAM,SAAS,KAAA;AACvD;;AAGA,SA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C,OAAD;OAAK,WAAU;iBAAa;MAAU,CAAA;KAC1D;;GACF;MACJ,YAAY,KAAA,KAAa,YAAY,SACpC,oBAAC,OAAD;GAAK,WAAU;aAAgB;EAAa,CAAA,CAExC;;AAEZ;;AAGA,SAAgB,KAAK,EACnB,OACA,aACA,SACA,UACA,YACA,QAQC;CACD,OACE,qBAAC,WAAD;EACE,WAAW,OAAO,SAAS,WAAW,iBAAiB;EACvD,mBAAiB;YAFnB,CAIE,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,qBAAC,OAAD,EAAA,UAAA,CACE,oBAAC,MAAD;IAAI,WAAU;IAAa,IAAI;cAC5B;GACC,CAAA,GACH,gBAAgB,KAAA,KAAa,oBAAC,KAAD;IAAG,WAAU;cAAa;GAAe,CAAA,CACpE,EAAA,CAAA,GACJ,OACE;MACJ,QACM;;AAEb;;AAGA,SAAgB,KAAK,EAAE,OAAO,YAAoD;CAChF,OACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,MAAD,EAAA,UAAK,MAAU,CAAA,GACf,oBAAC,MAAD,EAAK,SAAa,CAAA,CACf;;AAET;;;;;;AAOA,SAAgB,WAAW,EACzB,MACA,OACA,OACA,UACA,WAOC;CACD,OACE,qBAAC,OAAD;EAAK,WAAU;EAAS,MAAK;YAA7B;GACG,SAAS,KAAA,KACR,oBAAC,OAAD;IAAK,WAAU;IAAc,eAAA;cAC1B;GACE,CAAA;GAEN,UAAU,KAAA,KAAa,oBAAC,KAAD;IAAG,WAAU;cAAgB;GAAS,CAAA;GAC9D,oBAAC,MAAD;IAAI,WAAU;cAAgB;GAAU,CAAA;GACxC,oBAAC,OAAD;IAAK,WAAU;IAAe;GAAc,CAAA;GAC3C,YAAY,KAAA,KAAa,oBAAC,OAAD;IAAK,WAAU;cAAkB;GAAa,CAAA;EACrE;;AAET"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"principal-page-D_91OA0l.js","names":[],"sources":["../../src/lib/access-plan.ts","../../src/components/principal-page.tsx"],"sourcesContent":["import type { AccessValue } from '@coffre/client';\nimport type { Role } from '@coffre/core/access';\n\nimport type { GrantRow } from '../shared/models';\n\n/** Read or write on one environment, and when it ends: an ISO instant, or null for never. */\nexport type EnvironmentAccess = { role: 'viewer' | 'developer'; expiresAt: string | null };\n\n/**\n * What one project is set to in a principal's access editor: nothing, owner,\n * read or write everywhere, or read or write per environment. Every grant the\n * plan asks for carries its own expiry.\n *\n * `custom` is for grants that do not fit that shape -- an auditor grant, or\n * read everywhere plus write on one environment. The editor shows them and\n * leaves them alone unless another setting is picked.\n */\nexport type AccessPlan = {\n level: 'none' | 'owner' | 'viewer' | 'developer' | 'env' | 'custom';\n /** When the project-wide level ends. */\n expiresAt: string | null;\n /** Environments without an entry get no access. */\n environments: Record<string, EnvironmentAccess>;\n};\n\nexport type HeldGrant = Pick<\n GrantRow,\n 'id' | 'role' | 'roleName' | 'environmentSlug' | 'expiresAt'\n>;\n\nexport type AccessChange =\n | { kind: 'create'; role: string; environmentSlug: string | null; expiresAt: string | null }\n | { kind: 'expiry'; grant: HeldGrant; expiresAt: string | null }\n | { kind: 'revoke'; grant: HeldGrant };\n\n/** An environment's access in a plan; slugs like `constructor` are not inherited. */\nexport function environmentAccess(plan: AccessPlan, slug: string): EnvironmentAccess | null {\n return Object.hasOwn(plan.environments, slug) ? plan.environments[slug] : null;\n}\n\n/**\n * Read what a principal holds on a project back into the editor's terms.\n * `environments` are the ones the editor can set: live, and not archived.\n */\nexport function planFromGrants(\n grants: readonly HeldGrant[],\n environments: readonly string[],\n): AccessPlan {\n if (grants.length === 0) return { level: 'none', expiresAt: null, environments: {} };\n\n const [only] = grants;\n if (\n grants.length === 1 &&\n only.environmentSlug === null &&\n (only.role === 'owner' || only.role === 'viewer' || only.role === 'developer')\n ) {\n return { level: only.role, expiresAt: only.expiresAt, environments: {} };\n }\n\n const perEnvironment: Record<string, EnvironmentAccess> = {};\n for (const grant of grants) {\n const slug = grant.environmentSlug;\n if (\n slug === null ||\n !environments.includes(slug) ||\n Object.hasOwn(perEnvironment, slug) ||\n (grant.role !== 'viewer' && grant.role !== 'developer')\n ) {\n return { level: 'custom', expiresAt: null, environments: {} };\n }\n perEnvironment[slug] = { role: grant.role, expiresAt: grant.expiresAt };\n }\n return { level: 'env', expiresAt: null, environments: perEnvironment };\n}\n\n/**\n * Switch a plan's level. Going from read or write everywhere to per\n * environment starts every environment at that level and expiry, so the\n * switch alone keeps the same reach.\n */\nexport function withLevel(\n plan: AccessPlan,\n level: AccessPlan['level'],\n environments: readonly string[],\n): AccessPlan {\n if (\n level === 'env' &&\n (plan.level === 'viewer' || plan.level === 'developer') &&\n Object.keys(plan.environments).length === 0\n ) {\n const access = { role: plan.level, expiresAt: plan.expiresAt };\n return {\n ...plan,\n level,\n environments: Object.fromEntries(environments.map((slug) => [slug, access])),\n };\n }\n return { ...plan, level };\n}\n\n/** Set one environment's access, or take it away with `null`. */\nexport function withEnvironment(\n plan: AccessPlan,\n slug: string,\n access: EnvironmentAccess | null,\n): AccessPlan {\n const environments = { ...plan.environments };\n if (access === null) delete environments[slug];\n else environments[slug] = access;\n return { ...plan, environments };\n}\n\nfunction grantsFor(\n plan: AccessPlan,\n): { role: string; environmentSlug: string | null; expiresAt: string | null }[] {\n switch (plan.level) {\n case 'none':\n case 'custom':\n return [];\n case 'owner':\n case 'viewer':\n case 'developer':\n return [{ role: plan.level, environmentSlug: null, expiresAt: plan.expiresAt }];\n case 'env':\n return Object.entries(plan.environments).map(([environmentSlug, access]) => ({\n environmentSlug,\n ...access,\n }));\n }\n}\n\n/** The server and the date field spell the same instant differently. */\nfunction sameExpiry(a: string | null, b: string | null): boolean {\n return a === b || (a !== null && b !== null && Date.parse(a) === Date.parse(b));\n}\n\n/**\n * The changes that take what is held to the plan: grants to create, grants\n * whose expiry moves, and grants to revoke, in that order. Asking for what is\n * already held yields nothing, so applying the same plan twice is a no-op.\n */\nexport function accessChanges(grants: readonly HeldGrant[], plan: AccessPlan): AccessChange[] {\n if (plan.level === 'custom') return [];\n\n const key = (grant: { role: string; environmentSlug: string | null }) =>\n `${grant.role}@${grant.environmentSlug ?? ''}`;\n const wanted = new Map(grantsFor(plan).map((grant) => [key(grant), grant]));\n const held = new Map(grants.map((grant) => [key(grant), grant]));\n\n const changes: AccessChange[] = [];\n for (const [id, grant] of wanted) {\n if (!held.has(id)) changes.push({ kind: 'create', ...grant });\n }\n for (const [id, grant] of held) {\n const want = wanted.get(id);\n if (want !== undefined && !sameExpiry(grant.expiresAt, want.expiresAt)) {\n changes.push({ kind: 'expiry', grant, expiresAt: want.expiresAt });\n }\n }\n for (const [id, grant] of held) {\n if (!wanted.has(id)) changes.push({ kind: 'revoke', grant });\n }\n return changes;\n}\n\n/**\n * The changes as the API's access patch for one project: each place it\n * touches, and the role to hold there until when, or `null` for none.\n *\n * { \"market\": null, \"market/dev\": { \"role\": \"developer\", \"until\": \"2026-12-31T23:59:59.000Z\" } }\n *\n * A place holds one role, so where a level changes, the revoke of the old\n * role and the create of the new land on the same place, and the new role\n * wins: the server replaces one with the other, never passing through none.\n */\nexport function accessPatch(project: string, changes: readonly AccessChange[]): Record<string, AccessValue> {\n const place = (environmentSlug: string | null) =>\n environmentSlug === null ? project : `${project}/${environmentSlug}`;\n const holding = (role: string, expiresAt: string | null): AccessValue =>\n expiresAt === null ? (role as Role) : { role: role as Role, until: expiresAt };\n\n const patch: Record<string, AccessValue> = {};\n for (const change of changes) {\n if (change.kind === 'revoke') patch[place(change.grant.environmentSlug)] = null;\n }\n for (const change of changes) {\n if (change.kind === 'expiry') patch[place(change.grant.environmentSlug)] = holding(change.grant.role, change.expiresAt);\n if (change.kind === 'create') patch[place(change.environmentSlug)] = holding(change.role, change.expiresAt);\n }\n return patch;\n}\n\n/** A date field's value as the instant access ends: the close of that day, UTC. */\nexport function expiryFromDate(date: string): string | null {\n return date === '' ? null : new Date(`${date}T23:59:59Z`).toISOString();\n}\n\n/** A date field's value for an expiry. Expiries are shown as UTC dates everywhere. */\nexport function dateFromExpiry(expiresAt: string | null): string {\n return expiresAt === null ? '' : expiresAt.slice(0, 10);\n}\n","import { useState } from 'react';\nimport { useSuspenseQueries, useSuspenseQuery } from '@tanstack/react-query';\nimport { Link } from '@tanstack/react-router';\nimport { useShell } from '../lib/use-shell';\nimport { toast } from 'sonner';\nimport { memberRef, useCoffre } from '../lib/coffre';\nimport { directoryList } from '../lib/changes';\nimport { affects, managedProjects, queries } from '../lib/queries';\nimport { useChangeStatus } from '../lib/use-change';\nimport { ItemFailure } from './row-state';\nimport { useAction } from '../lib/use-action';\nimport { projectAccessLabel } from '../lib/project-access';\nimport {\n accessChanges,\n accessPatch,\n dateFromExpiry,\n environmentAccess,\n expiryFromDate,\n planFromGrants,\n withEnvironment,\n withLevel,\n type AccessChange,\n type AccessPlan,\n} from '../lib/access-plan';\nimport type { DirectoryPrincipal, GrantRow, ProjectSummary } from '../shared/models';\nimport { ClosedDoor, PageHeader } from './page';\nimport { EmptyState, ErrorLine, Modal, Notice, Spinner } from './ui';\nimport { GrantRowView, GrantsTable } from './grants';\nimport { InstanceRole, KIND, PrincipalActions } from './directory';\nimport { PrincipalReportCards, RemovedNotice } from './offboarding';\nimport { PrincipalAvatar } from './principal';\nimport { Tile } from './tile';\nimport { Clock, Folder, Key, Pencil, Users, X } from './icons';\n\ntype PrincipalType = DirectoryPrincipal['principalType'];\n\ntype ProjectAccess = { project: ProjectSummary; grants: GrantRow[]; grantsError: string | null };\n\n/**\n * Everything one user's or token's page shows, from what `loadPrincipal`\n * read: who it is to the instance and what it has seen (owners only), and its\n * grants on every project where you manage access.\n */\nfunction usePrincipalPage(principalType: PrincipalType, principalId: string) {\n const client = useCoffre();\n const { projects, capabilities } = useShell();\n const managed = managedProjects(projects);\n const { data: report } = useSuspenseQuery(\n queries.report(client, memberRef(principalType, principalId), capabilities.canManageGrants),\n );\n const grants = useSuspenseQueries({\n queries: managed.map((project) => queries.grants(client, project.slug)),\n });\n const access: ProjectAccess[] = managed.map((project, index) => {\n const result = grants[index]!.data;\n return {\n project,\n grants: result.ok\n ? result.grants.filter(\n (grant) => grant.principalType === principalType && grant.principalId === principalId,\n )\n : [],\n grantsError: result.ok ? null : result.error,\n };\n });\n return { report, access };\n}\n\nexport function PrincipalPage({\n principalType,\n principalId,\n}: {\n principalType: PrincipalType;\n principalId: string;\n}) {\n const { instanceRole } = useShell();\n const { report, access } = usePrincipalPage(principalType, principalId);\n // A role change or removal made from this page's menu, refused.\n const { status, dismiss } = useChangeStatus(directoryList.queryKey);\n const change = status(memberRef(principalType, principalId));\n const kind = KIND[principalType];\n const people = principalType === 'user';\n const list = people ? '/users' : '/tokens';\n const found = report?.ok === true ? report.report : null;\n const removed = found?.status === 'removed';\n const entry =\n found !== null && !removed\n ? {\n principalType,\n principalId,\n instanceRole: found.instanceRole,\n isRootAdmin: found.isRootAdmin,\n tampered: found.status === 'tampered',\n }\n : undefined;\n\n // Owners get a report about anyone ever registered, removed or not, so a\n // miss there means there is no such user. Everyone else only reaches this\n // page through projects they manage.\n const unknown = report?.ok === true && found === null;\n if (unknown || (report === null && access.length === 0)) {\n return (\n <ClosedDoor\n icon={people ? <Users size={18} /> : <Key size={18} />}\n label={<span className=\"mono\">{principalId}</span>}\n title={people ? 'No such user for you' : 'No such token for you'}\n actions={\n <Link className=\"btn\" to={list}>\n All {people ? 'users' : 'tokens'}\n </Link>\n }\n >\n {report === null\n ? `A ${kind}'s page lists its access to the projects where you manage access, and you manage none.`\n : `No ${kind} by that name has ever been registered here.`}\n </ClosedDoor>\n );\n }\n\n const rows = access.flatMap(({ project, grants }) =>\n grants.map((grant) => ({ project, grant })),\n );\n const errors = access.filter((entry) => entry.grantsError !== null);\n // Grants to someone removed are refused until they are added back.\n const editable = removed\n ? []\n : access.filter(\n ({ project, grantsError }) => project.archivedAt === null && grantsError === null,\n );\n\n return (\n <>\n <PageHeader\n lead={<PrincipalAvatar type={principalType} id={principalId} size=\"lg\" />}\n title={principalId}\n meta={\n removed ? (\n <span className=\"tag tag-red\">Removed</span>\n ) : (\n entry?.principalType === 'user' && <InstanceRole principal={entry} />\n )\n }\n actions={\n (editable.length > 0 || entry !== undefined) && (\n <>\n {editable.length > 0 && (\n <EditAccess\n principalType={principalType}\n principalId={principalId}\n access={editable}\n />\n )}\n {entry !== undefined && (\n <PrincipalActions principal={entry} trigger=\"btn btn-icon\" />\n )}\n </>\n )\n }\n />\n\n {change.state === 'failed' && (\n <div className=\"report-notice\">\n <ItemFailure status={change} onDismiss={() => dismiss(change.mutationId)} />\n </div>\n )}\n {report?.ok === false && (\n <div className=\"report-notice\">\n <Notice tone=\"bad\">{report.error}</Notice>\n </div>\n )}\n {removed && found !== null && <RemovedNotice report={found} />}\n\n {/* Removal ends every grant, so there is no access left to show. */}\n {!removed && (\n <>\n <h2 className=\"section-title\">Project access</h2>\n\n {errors.map(({ project, grantsError }) => (\n <div key={project.slug} style={{ marginBottom: '0.75rem' }}>\n <Notice tone=\"bad\">\n <span className=\"mono\">{project.slug}</span>: {grantsError}\n </Notice>\n </div>\n ))}\n\n <section className=\"card\" aria-label=\"Project access\">\n {rows.length === 0 ? (\n <EmptyState title=\"No project access yet\">\n {editable.length > 0\n ? `Edit access gives this ${kind} access to several projects at once.`\n : `None of the projects where you manage access has a grant for this ${kind}.`}\n </EmptyState>\n ) : (\n <GrantsTable\n lead={\n <span className=\"th\">\n <Folder size={14} />\n Project\n </span>\n }\n >\n {rows.map(({ project, grant }, index) => (\n <GrantRowView\n key={grant.id}\n number={index + 1}\n project={project.slug}\n grant={grant}\n leadLabel=\"Project\"\n lead={\n <span className=\"cell-project\">\n <Tile name={project.slug} />\n <Link\n className=\"cell-link\"\n to=\"/projects/$project\"\n params={{ project: project.slug }}\n search={{ tab: people ? 'users' : 'tokens' }}\n >\n {project.name}\n </Link>\n {project.archivedAt !== null && <span className=\"tag tag-red\">archived</span>}\n </span>\n }\n />\n ))}\n </GrantsTable>\n )}\n </section>\n\n {/* A root admin manages every project, so nothing is out of view. */}\n {instanceRole !== 'root-admin' && (\n <p className=\"hint section-foot\">\n Only projects where you manage access are listed.\n </p>\n )}\n </>\n )}\n\n {found !== null && <PrincipalReportCards report={found} />}\n </>\n );\n}\n\n/**\n * One principal's access to every project you manage, edited in one place.\n *\n * Each project opens set to what the principal holds: a project-wide level,\n * or read or write per environment, each with its own expiry. Saving sends\n * only the difference, every project in one `access.set`: the server applies\n * all of it in one transaction, or none of it.\n */\nfunction EditAccess({\n principalType,\n principalId,\n access,\n}: {\n principalType: PrincipalType;\n principalId: string;\n access: ProjectAccess[];\n}) {\n const coffre = useCoffre();\n const [open, setOpen] = useState(false);\n const [edits, setEdits] = useState<Record<string, AccessPlan>>({});\n const { pending, error, setError, run } = useAction();\n const kind = KIND[principalType];\n\n const rows = access.map(({ project, grants }) => {\n const environments = project.environments\n .filter(\n (environment) => environment.details !== null && environment.details.archivedAt === null,\n )\n .map((environment) => environment.slug);\n const held = planFromGrants(grants, environments);\n const plan = Object.hasOwn(edits, project.slug) ? edits[project.slug] : held;\n return { project, grants, environments, held, plan, changes: accessChanges(grants, plan) };\n });\n const changed = rows.filter((row) => row.changes.length > 0);\n\n function close() {\n setOpen(false);\n setEdits({});\n setError(null);\n }\n\n return (\n <>\n <button className=\"btn btn-primary\" onClick={() => setOpen(true)}>\n <Pencil size={14} />\n Edit access\n </button>\n\n <Modal\n open={open}\n onOpenChange={(next) => (next ? setOpen(true) : close())}\n title={\n <>\n Edit access for <span className=\"mono\">{principalId}</span>\n </>\n }\n description={`Set what this ${kind} can reach on each project you manage, and until when. Saving applies only what you changed.`}\n wide\n >\n <form\n className=\"form\"\n onSubmit={(event) => {\n event.preventDefault();\n run(\n () =>\n coffre.access.set(\n memberRef(principalType, principalId),\n Object.assign({}, ...changed.map(({ project, changes }) => accessPatch(project.slug, changes))),\n ),\n {\n affects: changed.flatMap(({ project }) =>\n affects.access(project.slug, memberRef(principalType, principalId)),\n ),\n onSuccess: () => {\n toast.success(\n `Updated ${principalId}’s access on ${changed.length} project${changed.length === 1 ? '' : 's'}`,\n );\n close();\n },\n },\n );\n }}\n >\n <ul className=\"plan-list\">\n <li className=\"plan-head\" aria-hidden=\"true\">\n <span>Project</span>\n <span>Access</span>\n <span>Expires</span>\n </li>\n {rows.map(({ project, grants, environments, held, plan, changes }) => {\n const id = `plan-${project.slug}`;\n const edit = (next: AccessPlan) =>\n setEdits((current) => ({ ...current, [project.slug]: next }));\n return (\n <li\n key={project.slug}\n className={`plan-row${changes.length > 0 ? ' is-changed' : ''}`}\n >\n <label className=\"plan-project\" htmlFor={id}>\n <Tile name={project.slug} />\n <span className=\"plan-project-text\">\n <span className=\"plan-project-name\">{project.name}</span>\n {held.level === 'custom' && (\n <span className=\"plan-project-held\">\n Holds {grants.map((grant) => projectAccessLabel(grant)).join(', ')}\n </span>\n )}\n </span>\n </label>\n <select\n id={id}\n className=\"select select-sm\"\n value={plan.level}\n onChange={(event) =>\n edit(\n withLevel(plan, event.target.value as AccessPlan['level'], environments),\n )\n }\n >\n {held.level === 'custom' && <option value=\"custom\">Keep as is</option>}\n <option value=\"none\">No access</option>\n <option value=\"owner\">Owner</option>\n <option value=\"viewer\">Read: all</option>\n <option value=\"developer\">Write: all</option>\n {environments.length > 0 && <option value=\"env\">Per environment…</option>}\n </select>\n {(plan.level === 'owner' ||\n plan.level === 'viewer' ||\n plan.level === 'developer') && (\n <ExpiryField\n label={`${project.name} expires`}\n expiresAt={plan.expiresAt}\n onChange={(expiresAt) => edit({ ...plan, expiresAt })}\n />\n )}\n\n {plan.level === 'env' && (\n <ul className=\"plan-envs\" aria-label={`Environments of ${project.name}`}>\n {environments.map((slug) => {\n const current = environmentAccess(plan, slug);\n return (\n <li key={slug} className=\"plan-env\">\n <label className=\"mono\" htmlFor={`${id}-${slug}`}>\n {slug}\n </label>\n <select\n id={`${id}-${slug}`}\n className=\"select select-sm\"\n value={current?.role ?? ''}\n onChange={(event) => {\n const role = event.target.value;\n edit(\n withEnvironment(\n plan,\n slug,\n role === 'viewer' || role === 'developer'\n ? { role, expiresAt: current?.expiresAt ?? null }\n : null,\n ),\n );\n }}\n >\n <option value=\"\">No access</option>\n <option value=\"viewer\">Read</option>\n <option value=\"developer\">Write</option>\n </select>\n {current !== null && (\n <ExpiryField\n label={`${slug} of ${project.name} expires`}\n expiresAt={current.expiresAt}\n onChange={(expiresAt) =>\n edit(withEnvironment(plan, slug, { ...current, expiresAt }))\n }\n />\n )}\n </li>\n );\n })}\n </ul>\n )}\n\n {changes.length > 0 && (\n <ul className=\"plan-changes\" aria-label={`Changes to ${project.name}`}>\n {changes.map((change) => (\n <li\n key={\n change.kind === 'create'\n ? `+${change.role}@${change.environmentSlug ?? ''}`\n : change.grant.id\n }\n >\n <AccessChangeTag change={change} />\n </li>\n ))}\n </ul>\n )}\n </li>\n );\n })}\n </ul>\n\n <ErrorLine error={error} />\n\n <div className=\"dialog-actions\">\n <button className=\"btn\" type=\"button\" onClick={close}>\n Cancel\n </button>\n <button\n className=\"btn btn-primary\"\n type=\"submit\"\n disabled={pending || changed.length === 0}\n >\n {pending && <Spinner />}\n Save changes\n </button>\n </div>\n </form>\n </Modal>\n </>\n );\n}\n\n/**\n * When one grant ends, as a date: access lasts through that day, UTC. Blank\n * reads \"Never\" where the browser lets the empty field be restyled.\n */\nfunction ExpiryField({\n label,\n expiresAt,\n onChange,\n}: {\n label: string;\n expiresAt: string | null;\n onChange: (expiresAt: string | null) => void;\n}) {\n const date = dateFromExpiry(expiresAt);\n return (\n <span className={`expiry${date === '' ? ' is-never' : ''}`}>\n <input\n className=\"input select-sm\"\n type=\"date\"\n aria-label={label}\n min={new Date().toISOString().slice(0, 10)}\n value={date}\n onChange={(event) => onChange(expiryFromDate(event.target.value))}\n />\n <span className=\"expiry-never\" aria-hidden=\"true\">\n Never\n </span>\n <button\n className=\"btn btn-quiet btn-sm btn-icon\"\n type=\"button\"\n aria-label={`${label}: never`}\n title=\"Never expires\"\n onClick={() => onChange(null)}\n >\n <X size={12} />\n </button>\n </span>\n );\n}\n\nfunction AccessChangeTag({ change }: { change: AccessChange }) {\n const until = (expiresAt: string | null) =>\n expiresAt === null ? '' : ` until ${dateFromExpiry(expiresAt)}`;\n switch (change.kind) {\n case 'create':\n return (\n <span className=\"tag tag-green\">\n <span aria-hidden=\"true\">+</span>\n <span className=\"visually-hidden\">Adds</span>\n {projectAccessLabel({ ...change, roleName: change.role })}\n {until(change.expiresAt)}\n </span>\n );\n case 'expiry':\n return (\n <span className=\"tag tag-blue\">\n <Clock size={12} />\n <span className=\"visually-hidden\">Moves the expiry of</span>\n {projectAccessLabel(change.grant)}\n {change.expiresAt === null ? ', no expiry' : until(change.expiresAt)}\n </span>\n );\n case 'revoke':\n return (\n <span className=\"tag tag-red\">\n <span aria-hidden=\"true\">−</span>\n <span className=\"visually-hidden\">Removes</span>\n {projectAccessLabel(change.grant)}\n </span>\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAoCA,SAAgB,kBAAkB,MAAkB,MAAwC;CAC1F,OAAO,OAAO,OAAO,KAAK,cAAc,IAAI,IAAI,KAAK,aAAa,QAAQ;AAC5E;;;;;AAMA,SAAgB,eACd,QACA,cACY;CACZ,IAAI,OAAO,WAAW,GAAG,OAAO;EAAE,OAAO;EAAQ,WAAW;EAAM,cAAc,CAAC;CAAE;CAEnF,MAAM,CAAC,QAAQ;CACf,IACE,OAAO,WAAW,KAClB,KAAK,oBAAoB,SACxB,KAAK,SAAS,WAAW,KAAK,SAAS,YAAY,KAAK,SAAS,cAElE,OAAO;EAAE,OAAO,KAAK;EAAM,WAAW,KAAK;EAAW,cAAc,CAAC;CAAE;CAGzE,MAAM,iBAAoD,CAAC;CAC3D,KAAK,MAAM,SAAS,QAAQ;EAC1B,MAAM,OAAO,MAAM;EACnB,IACE,SAAS,QACT,CAAC,aAAa,SAAS,IAAI,KAC3B,OAAO,OAAO,gBAAgB,IAAI,KACjC,MAAM,SAAS,YAAY,MAAM,SAAS,aAE3C,OAAO;GAAE,OAAO;GAAU,WAAW;GAAM,cAAc,CAAC;EAAE;EAE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