@coffre/ui 0.1.10 → 0.1.12

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 (172) hide show
  1. package/dist/client/_coffre/assets/account-CyJDFhek.js +2 -0
  2. package/dist/client/_coffre/assets/account-DHSs5h2f.js +1 -0
  3. package/dist/client/_coffre/assets/affordances-BQD5B421.js +1 -0
  4. package/dist/client/_coffre/assets/audit-Bcyp_dU1.js +2 -0
  5. package/dist/client/_coffre/assets/audit-rMy9mU9Q.js +1 -0
  6. package/dist/client/_coffre/assets/auth.device-DuvaComb.js +1 -0
  7. package/dist/client/_coffre/assets/auth.device-yBt_sLZW.js +2 -0
  8. package/dist/client/_coffre/assets/directory-C4BMGC7-.js +1 -0
  9. package/dist/client/_coffre/assets/dist-BNkBTkxj.js +1 -0
  10. package/dist/client/_coffre/assets/globals-BJkzu6T5.css +1 -0
  11. package/dist/client/_coffre/assets/grants-CyDW25eX.js +1 -0
  12. package/dist/client/_coffre/assets/icons-BRl8DlXW.js +1 -0
  13. package/dist/client/_coffre/assets/index-CA1mtrIx.js +12 -0
  14. package/dist/client/_coffre/assets/link-CqlAJWBd.js +1 -0
  15. package/dist/client/_coffre/assets/login-B73b6bsJ.js +1 -0
  16. package/dist/client/_coffre/assets/login-BO1KAGPU.js +2 -0
  17. package/dist/client/_coffre/assets/offboarding--5vSKNHv.js +1 -0
  18. package/dist/client/_coffre/assets/page-Dngv8FMr.js +1 -0
  19. package/dist/client/_coffre/assets/preload-helper-DBha3tys.js +1 -0
  20. package/dist/client/_coffre/assets/principal-page-C4qDD-d8.js +1 -0
  21. package/dist/client/_coffre/assets/projects._project._environment-eBKxOZ0_.js +2 -0
  22. package/dist/client/_coffre/assets/projects._project._environment-or_AX6o5.js +3 -0
  23. package/dist/client/_coffre/assets/projects._project.index-DHdXfEh-.js +2 -0
  24. package/dist/client/_coffre/assets/projects._project.index-iynQgenH.js +1 -0
  25. package/dist/client/_coffre/assets/projects.index-CGW8mRil.js +1 -0
  26. package/dist/client/_coffre/assets/row-state-BlarvG7E.js +1 -0
  27. package/dist/client/_coffre/assets/settings-D-7RJIDf.js +1 -0
  28. package/dist/client/_coffre/assets/suspense-q_eJaZ18.js +1 -0
  29. package/dist/client/_coffre/assets/tokens._token-0u7midqA.js +2 -0
  30. package/dist/client/_coffre/assets/tokens._token-C53NqScg.js +1 -0
  31. package/dist/client/_coffre/assets/tokens.index-DBZTLnbi.js +1 -0
  32. package/dist/client/_coffre/assets/ui-BPWFJNz7.js +46 -0
  33. package/dist/client/_coffre/assets/unregistered-CLhgtwUt.js +1 -0
  34. package/dist/client/_coffre/assets/use-action-LULgF26O.js +1 -0
  35. package/dist/client/_coffre/assets/use-change-Bd6NZJj9.js +1 -0
  36. package/dist/client/_coffre/assets/use-shell-Dx92Huhb.js +1 -0
  37. package/dist/client/_coffre/assets/useQuery-BIIZz1CB.js +1 -0
  38. package/dist/client/_coffre/assets/useSuspenseQuery-tP9HFZ8w.js +1 -0
  39. package/dist/client/_coffre/assets/users._user-BXtaL8Ee.js +2 -0
  40. package/dist/client/_coffre/assets/users._user-CNYVkXaY.js +1 -0
  41. package/dist/client/_coffre/assets/users.index-Cs9tibIv.js +1 -0
  42. package/dist/server/.vite/manifest.json +342 -246
  43. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-T9tMsCwo.js +162 -0
  44. package/dist/server/_coffre/assets/{account-CUQYGCYh.js → account-BUhhOS5-.js} +150 -117
  45. package/dist/server/_coffre/assets/{account-DMlUoBxQ.js → account-B_h55GCs.js} +10 -24
  46. package/dist/server/_coffre/assets/{affordances-BNaXjMOb.js → affordances-CKANXDTG.js} +2 -22
  47. package/dist/server/_coffre/assets/{async-local-storage-C0cwgkEr.js → async-local-storage-C10uQtMM.js} +3 -2
  48. package/dist/server/_coffre/assets/{audit-CCdSLmvK.js → audit-B8Ck358-.js} +46 -16
  49. package/dist/server/_coffre/assets/audit-DFsXfeAQ.js +31 -0
  50. package/dist/server/_coffre/assets/{auth.device-BoFM1jcf.js → auth.device-BXf_JjT7.js} +5 -5
  51. package/dist/server/_coffre/assets/{auth.device-C05u5ROO.js → auth.device-cqjWACvB.js} +7 -5
  52. package/dist/server/_coffre/assets/{directory-GsnYkse0.js → directory-C9SfNgpM.js} +87 -112
  53. package/dist/server/_coffre/assets/{use-action-DwEmf58L.js → dist-CnnV3t2g.js} +3 -48
  54. package/dist/server/_coffre/assets/globals-BJkzu6T5.css +1 -0
  55. package/dist/server/_coffre/assets/grants--315KmXu.js +158 -0
  56. package/dist/server/_coffre/assets/{page-BdnhpwvH.js → icons-CWsTEfpn.js} +125 -436
  57. package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +480 -0
  58. package/dist/server/_coffre/assets/link-42ZWdjzZ.js +422 -0
  59. package/dist/server/_coffre/assets/{login-DUtCQju5.js → login-CQSkYW_D.js} +7 -5
  60. package/dist/server/_coffre/assets/{login-B2njIq_o.js → login-LBpXXfsQ.js} +2 -2
  61. package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +56 -0
  62. package/dist/server/_coffre/assets/{offboarding-8yMa7ViM.js → offboarding-CykelNis.js} +11 -79
  63. package/dist/server/_coffre/assets/page-BGeDoQO5.js +3531 -0
  64. package/dist/server/_coffre/assets/{principal-page-B8zPcS2b.js → principal-page-CRdoAQOq.js} +51 -42
  65. package/dist/server/_coffre/assets/{projects._project._environment-DdIOc7wx.js → projects._project._environment-BXU1Mee5.js} +4 -11
  66. package/dist/server/_coffre/assets/{projects._project._environment-BZ5Z80V8.js → projects._project._environment-BrDqn8kW.js} +129 -748
  67. package/dist/server/_coffre/assets/{projects._project.index-CuEAUwGn.js → projects._project.index-CAxBU4tY.js} +134 -96
  68. package/dist/server/_coffre/assets/{projects._project.index-DvbcU1kh.js → projects._project.index-CYyUVTCl.js} +5 -4
  69. package/dist/server/_coffre/assets/{projects.index-5HI0wOuG.js → projects.index-D6ZoDE_0.js} +57 -55
  70. package/dist/server/_coffre/assets/{react-dom-qCTiwGGR.js → react-dom-bBoJXlK2.js} +417 -51
  71. package/dist/server/_coffre/assets/{router-CQDoql8s.js → router-Bu2qtyqw.js} +376 -92
  72. package/dist/server/_coffre/assets/row-state-CAItu3n_.js +117 -0
  73. package/dist/server/_coffre/assets/{settings-BVz78wjP.js → settings-ByeF6hBa.js} +8 -6
  74. package/dist/server/_coffre/assets/suspense-beD01bb8.js +602 -0
  75. package/dist/server/_coffre/assets/tokens._token-CM01QPCq.js +10 -0
  76. package/dist/server/_coffre/assets/{tokens._token-CWs3Mtki.js → tokens._token-D2E4P3Qc.js} +97 -79
  77. package/dist/server/_coffre/assets/{tokens.index-Ck0LN7aC.js → tokens.index-Cmrgn3mU.js} +9 -6
  78. package/dist/server/_coffre/assets/{ui-D_slKpSF.js → ui-DvlGkmaH.js} +7 -836
  79. package/dist/server/_coffre/assets/{unregistered-Z17da4Rc.js → unregistered-DSArejP9.js} +5 -3
  80. package/dist/server/_coffre/assets/use-action-C2wz34kq.js +47 -0
  81. package/dist/server/_coffre/assets/use-change-CJpGSNIq.js +1212 -0
  82. package/dist/server/_coffre/assets/use-shell-C3iYcyP1.js +462 -0
  83. package/dist/server/_coffre/assets/useQuery-ChxaQ4Cb.js +8 -0
  84. package/dist/server/_coffre/assets/{useStore-DWGPqzXR.js → useRouter-CaUSUNsw.js} +1 -420
  85. package/dist/server/_coffre/assets/useSuspenseQuery-BjAmlGZl.js +117 -0
  86. package/dist/server/_coffre/assets/users._user-BVeR9fZP.js +10 -0
  87. package/dist/server/_coffre/assets/{users._user-CMwj-VI9.js → users._user-Cih2Etf4.js} +4 -5
  88. package/dist/server/_coffre/assets/{users.index-fWHv6A30.js → users.index-Bo2_a95G.js} +9 -6
  89. package/dist/server/index.js +6 -5
  90. package/package.json +5 -3
  91. package/src/components/directory.tsx +75 -104
  92. package/src/components/grants.tsx +60 -112
  93. package/src/components/icons.tsx +0 -34
  94. package/src/components/offboarding.tsx +1 -52
  95. package/src/components/principal-page.tsx +54 -67
  96. package/src/components/principal-picker.tsx +7 -16
  97. package/src/components/row-state.tsx +95 -0
  98. package/src/components/service-tokens.tsx +75 -64
  99. package/src/components/shell.tsx +1 -1
  100. package/src/lib/announce.ts +36 -0
  101. package/src/lib/changes.ts +498 -0
  102. package/src/lib/coffre.ts +1 -1
  103. package/src/lib/optimistic.ts +233 -0
  104. package/src/lib/queries.ts +385 -0
  105. package/src/lib/use-action.ts +20 -15
  106. package/src/lib/use-change.ts +42 -0
  107. package/src/lib/use-shell.ts +17 -0
  108. package/src/router.tsx +17 -9
  109. package/src/routes/__root.tsx +8 -38
  110. package/src/routes/account.tsx +163 -154
  111. package/src/routes/audit.tsx +51 -72
  112. package/src/routes/auth.device.tsx +4 -2
  113. package/src/routes/login.tsx +3 -2
  114. package/src/routes/projects.$project.$environment.tsx +223 -238
  115. package/src/routes/projects.$project.index.tsx +136 -118
  116. package/src/routes/projects.index.tsx +117 -145
  117. package/src/routes/settings.tsx +7 -7
  118. package/src/routes/tokens.$token.tsx +14 -17
  119. package/src/routes/tokens.index.tsx +8 -4
  120. package/src/routes/unregistered.tsx +3 -2
  121. package/src/routes/users.$user.tsx +4 -4
  122. package/src/routes/users.index.tsx +8 -4
  123. package/src/shared/models.ts +1 -5
  124. package/src/styles/globals.css +80 -50
  125. package/dist/client/_coffre/assets/account-B48wuSF8.js +0 -1
  126. package/dist/client/_coffre/assets/account-BkNyIDT7.js +0 -2
  127. package/dist/client/_coffre/assets/affordances-CmoY-8Xf.js +0 -1
  128. package/dist/client/_coffre/assets/audit-BvwKYb-5.js +0 -2
  129. package/dist/client/_coffre/assets/audit-D02H-zxS.js +0 -1
  130. package/dist/client/_coffre/assets/auth.device-BP5FY0K1.js +0 -1
  131. package/dist/client/_coffre/assets/auth.device-DYOONgFF.js +0 -2
  132. package/dist/client/_coffre/assets/coffre-BBp7cKVa.js +0 -1
  133. package/dist/client/_coffre/assets/directory-Bu0EIxqI.js +0 -1
  134. package/dist/client/_coffre/assets/globals-Bh2x1gBM.css +0 -1
  135. package/dist/client/_coffre/assets/grants-DavcwofW.js +0 -1
  136. package/dist/client/_coffre/assets/index-CDPlq5rM.js +0 -12
  137. package/dist/client/_coffre/assets/login-C-wTm_t1.js +0 -2
  138. package/dist/client/_coffre/assets/login-CLLv1om9.js +0 -1
  139. package/dist/client/_coffre/assets/offboarding-DWsE2FSa.js +0 -1
  140. package/dist/client/_coffre/assets/page-DbSS7pYH.js +0 -1
  141. package/dist/client/_coffre/assets/preload-helper-DduCCcmc.js +0 -46
  142. package/dist/client/_coffre/assets/principal-page-Bp_iwuSd.js +0 -1
  143. package/dist/client/_coffre/assets/projects._project._environment-BMeX_B8l.js +0 -2
  144. package/dist/client/_coffre/assets/projects._project._environment-CT0A-hIU.js +0 -3
  145. package/dist/client/_coffre/assets/projects._project.index-C_xYOGLT.js +0 -2
  146. package/dist/client/_coffre/assets/projects._project.index-Chcf-cUd.js +0 -1
  147. package/dist/client/_coffre/assets/projects.index-CfOtb1X5.js +0 -2
  148. package/dist/client/_coffre/assets/projects.index-DSjOhLDh.js +0 -1
  149. package/dist/client/_coffre/assets/settings-BC9cUJNK.js +0 -1
  150. package/dist/client/_coffre/assets/settings-Bkj_E21y.js +0 -2
  151. package/dist/client/_coffre/assets/tokens._token-BA0KqvaW.js +0 -1
  152. package/dist/client/_coffre/assets/tokens._token-Dh9jLOkm.js +0 -2
  153. package/dist/client/_coffre/assets/tokens.index-BgAMWkHT.js +0 -2
  154. package/dist/client/_coffre/assets/tokens.index-CHueIAv1.js +0 -1
  155. package/dist/client/_coffre/assets/unregistered-D5go1AfR.js +0 -1
  156. package/dist/client/_coffre/assets/use-action-l__xZDYY.js +0 -1
  157. package/dist/client/_coffre/assets/users._user-Dwqa0gv5.js +0 -1
  158. package/dist/client/_coffre/assets/users._user-xJAb3T6Y.js +0 -2
  159. package/dist/client/_coffre/assets/users.index-BJoF-L37.js +0 -2
  160. package/dist/client/_coffre/assets/users.index-YUjtbTGy.js +0 -1
  161. package/dist/server/_coffre/assets/_tanstack-start-manifest_v-BKg2AlPu.js +0 -133
  162. package/dist/server/_coffre/assets/audit-CThXn2v7.js +0 -74
  163. package/dist/server/_coffre/assets/coffre-C2ANsTAz.js +0 -281
  164. package/dist/server/_coffre/assets/globals-Bh2x1gBM.css +0 -1
  165. package/dist/server/_coffre/assets/grants-B6k4Fu9z.js +0 -243
  166. package/dist/server/_coffre/assets/projects.index-uiomWX_l.js +0 -54
  167. package/dist/server/_coffre/assets/settings-4oRyDizv.js +0 -18
  168. package/dist/server/_coffre/assets/tokens._token-CF_deAwq.js +0 -18
  169. package/dist/server/_coffre/assets/tokens.index-DF_07KEe.js +0 -10
  170. package/dist/server/_coffre/assets/users._user-DUzwkSKT.js +0 -10
  171. package/dist/server/_coffre/assets/users.index-BbuweTwH.js +0 -10
  172. package/src/components/syncs.tsx +0 -581
@@ -1,10 +1,14 @@
1
- import { C as require_react, E as __toESM, o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
2
- import { a as ErrorLine, c as Spinner, i as EmptyState, l as Timestamp, o as Modal, r as CopyButton, s as Notice, t as ConfirmButton } from "./ui-D_slKpSF.js";
3
- import { $ as X, C as Key, L as Plus, t as Card } from "./page-BdnhpwvH.js";
4
- import { r as memberRef, s as useCoffre } from "./coffre-C2ANsTAz.js";
5
- import { r as toast, t as useAction } from "./use-action-DwEmf58L.js";
6
- import { t as PrincipalPage } from "./principal-page-B8zPcS2b.js";
7
- import { t as Route } from "./tokens._token-CF_deAwq.js";
1
+ import { i as require_react, r as require_jsx_runtime, s as __toESM } from "./useRouter-CaUSUNsw.js";
2
+ import { C as useCoffre, b as memberRef, h as queries, o as affects, t as Card } from "./page-BGeDoQO5.js";
3
+ import { n as useChangeStatus, t as useChange, y as revokeCredential } from "./use-change-CJpGSNIq.js";
4
+ import { t as useShell } from "./use-shell-C3iYcyP1.js";
5
+ import { t as useSuspenseQuery } from "./useSuspenseQuery-BjAmlGZl.js";
6
+ import { a as ErrorLine, c as Spinner, i as EmptyState, l as Timestamp, o as Modal, r as CopyButton, s as Notice, t as ConfirmButton } from "./ui-DvlGkmaH.js";
7
+ import { A as Plus, W as X, v as Key } from "./icons-CWsTEfpn.js";
8
+ import { a as rowClass, i as RowPending, r as RowFailure } from "./row-state-CAItu3n_.js";
9
+ import { t as Route } from "./tokens._token-CM01QPCq.js";
10
+ import { t as useAction } from "./use-action-C2wz34kq.js";
11
+ import { t as PrincipalPage } from "./principal-page-CRdoAQOq.js";
8
12
  //#region src/components/service-tokens.tsx
9
13
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
10
14
  var import_jsx_runtime = require_jsx_runtime();
@@ -19,17 +23,15 @@ var LIFETIMES = [
19
23
  * one place, this dialog, for as long as it stays open: coffre keeps a hash.
20
24
  */
21
25
  function ServiceTokens({ serviceId, tokens }) {
22
- const coffre = useCoffre();
23
- const { pending, error, run } = useAction();
24
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Card, {
26
+ const change = revokeCredential(useCoffre(), serviceId);
27
+ const revoke = useChange(change);
28
+ const { status, dismiss } = useChangeStatus(change.list.queryKey);
29
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
25
30
  labelledBy: "service-tokens",
26
31
  title: "Credentials",
27
32
  description: "Bearer tokens this service presents to the API. Each is shown once, when it is issued; coffre keeps only a hash.",
28
33
  actions: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IssueToken, { serviceId }),
29
- children: [error !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
30
- className: "card-body",
31
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error })
32
- }), tokens.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, {
34
+ children: tokens.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, {
33
35
  title: "No live credentials",
34
36
  children: "Nothing can act as this service until a token is issued."
35
37
  }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
@@ -57,68 +59,77 @@ function ServiceTokens({ serviceId, tokens }) {
57
59
  children: "Actions"
58
60
  })
59
61
  })
60
- ] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: tokens.map((token) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
61
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
62
- className: "cell-account",
63
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: 15 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
64
- className: "cell-stack",
65
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: token.label ?? "Unlabelled" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
66
- className: "mono",
67
- children: token.hint
68
- })]
69
- })]
70
- }) }),
71
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
72
- className: "nowrap",
73
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
74
- className: "cell-stack",
75
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, { iso: token.createdAt }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: ["by ", token.createdBy] })]
76
- })
77
- }),
78
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
79
- className: "nowrap cell-muted",
80
- children: token.lastUsedAt === null ? "Never" : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
81
- className: "cell-stack",
82
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
83
- iso: token.lastUsedAt,
84
- display: "relative"
85
- }), token.lastUsedIp !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
86
- className: "mono",
87
- children: token.lastUsedIp
88
- })]
89
- })
90
- }),
91
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
92
- className: "nowrap cell-muted",
93
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
94
- iso: token.expiresAt,
95
- display: "relative"
96
- })
97
- }),
98
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
99
- className: "col-actions",
100
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfirmButton, {
101
- trigger: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
102
- className: "act",
103
- disabled: pending,
104
- children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { size: 13 }), "Revoke"]
62
+ ] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: tokens.map((token) => {
63
+ const state = status(token.id);
64
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
65
+ className: rowClass(state),
66
+ children: [
67
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
68
+ className: "cell-account",
69
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: 15 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
70
+ className: "cell-stack",
71
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: token.label ?? "Unlabelled" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
72
+ className: "mono",
73
+ children: token.hint
74
+ })]
75
+ })]
76
+ }) }),
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
78
+ className: "nowrap",
79
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
80
+ className: "cell-stack",
81
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, { iso: token.createdAt }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: ["by ", token.createdBy] })]
82
+ })
105
83
  }),
106
- title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
107
- "Revoke ",
108
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
109
- className: "mono",
110
- children: token.hint
111
- }),
112
- "?"
113
- ] }),
114
- body: "Whatever uses it is refused from its next request. Issue a new token first if the service should keep working.",
115
- confirmLabel: "Revoke token",
116
- onConfirm: () => run(() => coffre.tokens.revoke(memberRef("service", serviceId), token.id), () => toast.success("Token revoked"))
117
- })
118
- })
119
- ] }, token.id)) })]
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
85
+ className: "nowrap cell-muted",
86
+ children: token.lastUsedAt === null ? "Never" : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
87
+ className: "cell-stack",
88
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
89
+ iso: token.lastUsedAt,
90
+ display: "relative"
91
+ }), token.lastUsedIp !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
92
+ className: "mono",
93
+ children: token.lastUsedIp
94
+ })]
95
+ })
96
+ }),
97
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
98
+ className: "nowrap cell-muted",
99
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
100
+ iso: token.expiresAt,
101
+ display: "relative"
102
+ })
103
+ }),
104
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
105
+ className: "col-actions",
106
+ children: state.state === "pending" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowPending, { status: state }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfirmButton, {
107
+ trigger: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
108
+ className: "act",
109
+ children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { size: 13 }), "Revoke"]
110
+ }),
111
+ title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
112
+ "Revoke ",
113
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
114
+ className: "mono",
115
+ children: token.hint
116
+ }),
117
+ "?"
118
+ ] }),
119
+ body: "Whatever uses it is refused from its next request. Issue a new token first if the service should keep working.",
120
+ confirmLabel: "Revoke token",
121
+ onConfirm: () => revoke(token)
122
+ })
123
+ })
124
+ ]
125
+ }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowFailure, {
126
+ status: state,
127
+ columns: 5,
128
+ onDismiss: () => state.state === "failed" && dismiss(state.mutationId)
129
+ })] }, token.id);
130
+ }) })]
120
131
  })
121
- })]
132
+ })
122
133
  });
123
134
  }
124
135
  function IssueToken({ serviceId }) {
@@ -149,7 +160,10 @@ function IssueToken({ serviceId }) {
149
160
  run(() => coffre.tokens.issue(memberRef("service", serviceId), {
150
161
  label: label.trim() === "" ? null : label.trim(),
151
162
  expiresInDays: days
152
- }), (credential) => setIssued(credential));
163
+ }), {
164
+ affects: affects.credentials(memberRef("service", serviceId)),
165
+ onSuccess: (credential) => setIssued(credential)
166
+ });
153
167
  },
154
168
  children: [
155
169
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
@@ -253,12 +267,16 @@ function IssueToken({ serviceId }) {
253
267
  //#region src/routes/tokens.$token.tsx?tsr-split=component
254
268
  function TokenPage() {
255
269
  const { token } = Route.useParams();
256
- const { page, credentials } = Route.useLoaderData();
257
- const active = page.report?.ok === true && page.report.report?.status === "active";
270
+ const client = useCoffre();
271
+ const { auth, capabilities } = useShell();
272
+ const member = memberRef("service", token);
273
+ const owner = capabilities.canManageGrants;
274
+ const { data: report } = useSuspenseQuery(queries.report(client, member, owner));
275
+ const { data: credentials } = useSuspenseQuery(queries.credentials(client, member, owner && auth.signin !== null));
276
+ const active = report?.ok === true && report.report?.status === "active";
258
277
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrincipalPage, {
259
278
  principalType: "service",
260
- principalId: token,
261
- data: page
279
+ principalId: token
262
280
  }), active && credentials?.ok === true && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ServiceTokens, {
263
281
  serviceId: token,
264
282
  tokens: credentials.tokens
@@ -1,12 +1,15 @@
1
- import { o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
2
- import { C as Key, i as PageHeader, n as ClosedDoor } from "./page-BdnhpwvH.js";
3
- import { n as DirectoryTable, t as AddPrincipal } from "./directory-GsnYkse0.js";
4
- import { t as Route } from "./tokens.index-DF_07KEe.js";
5
- import { n as RemovedList } from "./offboarding-8yMa7ViM.js";
1
+ import { r as require_jsx_runtime } from "./useRouter-CaUSUNsw.js";
2
+ import { C as useCoffre, h as queries, i as PageHeader, n as ClosedDoor } from "./page-BGeDoQO5.js";
3
+ import { t as useShell } from "./use-shell-C3iYcyP1.js";
4
+ import { t as useSuspenseQuery } from "./useSuspenseQuery-BjAmlGZl.js";
5
+ import { v as Key } from "./icons-CWsTEfpn.js";
6
+ import { n as DirectoryTable, t as AddPrincipal } from "./directory-C9SfNgpM.js";
7
+ import { n as RemovedList } from "./offboarding-CykelNis.js";
6
8
  //#region src/routes/tokens.index.tsx?tsr-split=component
7
9
  var import_jsx_runtime = require_jsx_runtime();
8
10
  function TokensPage() {
9
- const result = Route.useLoaderData();
11
+ const { capabilities } = useShell();
12
+ const { data: result } = useSuspenseQuery(queries.directory(useCoffre(), capabilities.canManageGrants));
10
13
  if (!result.ok) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClosedDoor, {
11
14
  icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: 18 }),
12
15
  label: "Tokens",