@coffre/ui 0.1.8 → 0.1.10

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 (72) hide show
  1. package/dist/client/_coffre/assets/{account-J194gi6l.js → account-B48wuSF8.js} +1 -1
  2. package/dist/client/_coffre/assets/{account-C3rBPdu6.js → account-BkNyIDT7.js} +2 -2
  3. package/dist/client/_coffre/assets/{audit-CdCJ1U8E.js → audit-BvwKYb-5.js} +2 -2
  4. package/dist/client/_coffre/assets/audit-D02H-zxS.js +1 -0
  5. package/dist/client/_coffre/assets/{auth.device--rDR2F8w.js → auth.device-BP5FY0K1.js} +1 -1
  6. package/dist/client/_coffre/assets/{auth.device-viDUwZRT.js → auth.device-DYOONgFF.js} +2 -2
  7. package/dist/client/_coffre/assets/{coffre-CXkp3Efg.js → coffre-BBp7cKVa.js} +1 -1
  8. package/dist/client/_coffre/assets/{directory-PEjdb8PS.js → directory-Bu0EIxqI.js} +1 -1
  9. package/dist/client/_coffre/assets/{grants-4mSkXPU4.js → grants-DavcwofW.js} +1 -1
  10. package/dist/client/_coffre/assets/{index-DoJkcH-T.js → index-CDPlq5rM.js} +1 -1
  11. package/dist/client/_coffre/assets/{offboarding-DQ-56W0H.js → offboarding-DWsE2FSa.js} +1 -1
  12. package/dist/client/_coffre/assets/{principal-page-DjH1cUyz.js → principal-page-Bp_iwuSd.js} +1 -1
  13. package/dist/client/_coffre/assets/{projects._project._environment-CLUpTvi-.js → projects._project._environment-BMeX_B8l.js} +2 -2
  14. package/dist/client/_coffre/assets/{projects._project._environment-BZnNvENc.js → projects._project._environment-CT0A-hIU.js} +1 -1
  15. package/dist/client/_coffre/assets/{projects._project.index-CWXRo307.js → projects._project.index-C_xYOGLT.js} +2 -2
  16. package/dist/client/_coffre/assets/{projects._project.index-Dzgf95zv.js → projects._project.index-Chcf-cUd.js} +1 -1
  17. package/dist/client/_coffre/assets/{projects.index-BG8W91BX.js → projects.index-CfOtb1X5.js} +2 -2
  18. package/dist/client/_coffre/assets/projects.index-DSjOhLDh.js +1 -0
  19. package/dist/client/_coffre/assets/{settings-CNIY0--5.js → settings-BC9cUJNK.js} +1 -1
  20. package/dist/client/_coffre/assets/{settings-EimGqlQL.js → settings-Bkj_E21y.js} +2 -2
  21. package/dist/client/_coffre/assets/{tokens._token-CkU4dCwo.js → tokens._token-BA0KqvaW.js} +1 -1
  22. package/dist/client/_coffre/assets/tokens._token-Dh9jLOkm.js +2 -0
  23. package/dist/client/_coffre/assets/tokens.index-BgAMWkHT.js +2 -0
  24. package/dist/client/_coffre/assets/{tokens.index-DtiWrKVq.js → tokens.index-CHueIAv1.js} +1 -1
  25. package/dist/client/_coffre/assets/{use-action-CUvWPRTx.js → use-action-l__xZDYY.js} +1 -1
  26. package/dist/client/_coffre/assets/{users._user-CImGVpYj.js → users._user-Dwqa0gv5.js} +1 -1
  27. package/dist/client/_coffre/assets/users._user-xJAb3T6Y.js +2 -0
  28. package/dist/client/_coffre/assets/users.index-BJoF-L37.js +2 -0
  29. package/dist/client/_coffre/assets/{users.index-B-7o0KBD.js → users.index-YUjtbTGy.js} +1 -1
  30. package/dist/server/.vite/manifest.json +114 -114
  31. package/dist/server/_coffre/assets/{_tanstack-start-manifest_v-C2PEUeJL.js → _tanstack-start-manifest_v-BKg2AlPu.js} +33 -33
  32. package/dist/server/_coffre/assets/{account-CZgVVZTf.js → account-CUQYGCYh.js} +4 -4
  33. package/dist/server/_coffre/assets/{account-D7-ZAE2T.js → account-DMlUoBxQ.js} +2 -2
  34. package/dist/server/_coffre/assets/{audit-CnfDYD-u.js → audit-CCdSLmvK.js} +3 -110
  35. package/dist/server/_coffre/assets/{audit-Bb9Er3nm.js → audit-CThXn2v7.js} +2 -2
  36. package/dist/server/_coffre/assets/{auth.device-CMR3csAI.js → auth.device-BoFM1jcf.js} +2 -2
  37. package/dist/server/_coffre/assets/{auth.device-w9N3FlNk.js → auth.device-C05u5ROO.js} +2 -2
  38. package/dist/server/_coffre/assets/{coffre-DMs96kfX.js → coffre-C2ANsTAz.js} +2 -1
  39. package/dist/server/_coffre/assets/{directory-Dr5X9TB5.js → directory-GsnYkse0.js} +2 -2
  40. package/dist/server/_coffre/assets/{grants-C6UmWE8b.js → grants-B6k4Fu9z.js} +2 -2
  41. package/dist/server/_coffre/assets/{offboarding-DY5MarpG.js → offboarding-8yMa7ViM.js} +1 -1
  42. package/dist/server/_coffre/assets/{principal-page-SdG8_zcu.js → principal-page-B8zPcS2b.js} +5 -5
  43. package/dist/server/_coffre/assets/{projects._project._environment-CUS0VFUe.js → projects._project._environment-BZ5Z80V8.js} +3 -3
  44. package/dist/server/_coffre/assets/{projects._project._environment-BQIrmE3r.js → projects._project._environment-DdIOc7wx.js} +2 -2
  45. package/dist/server/_coffre/assets/{projects._project.index-D1NxvBtZ.js → projects._project.index-CuEAUwGn.js} +5 -5
  46. package/dist/server/_coffre/assets/{projects._project.index-BjNdR4KC.js → projects._project.index-DvbcU1kh.js} +2 -2
  47. package/dist/server/_coffre/assets/{projects.index-BQDuuh6t.js → projects.index-5HI0wOuG.js} +11 -5
  48. package/dist/server/_coffre/assets/{projects.index-ha7jO4nC.js → projects.index-uiomWX_l.js} +2 -2
  49. package/dist/server/_coffre/assets/{router-BimLwejs.js → router-CQDoql8s.js} +13 -13
  50. package/dist/server/_coffre/assets/{settings-Cy__khNA.js → settings-4oRyDizv.js} +2 -2
  51. package/dist/server/_coffre/assets/{settings-HOErM3pd.js → settings-BVz78wjP.js} +1 -1
  52. package/dist/server/_coffre/assets/{tokens._token-CmpmtfB_.js → tokens._token-CF_deAwq.js} +3 -3
  53. package/dist/server/_coffre/assets/{tokens._token-BZUArbzi.js → tokens._token-CWs3Mtki.js} +4 -4
  54. package/dist/server/_coffre/assets/{tokens.index-BReCgoV9.js → tokens.index-Ck0LN7aC.js} +3 -3
  55. package/dist/server/_coffre/assets/{tokens.index-B5-4dD4C.js → tokens.index-DF_07KEe.js} +2 -2
  56. package/dist/server/_coffre/assets/{use-action-DQUmeH-5.js → use-action-DwEmf58L.js} +1 -1
  57. package/dist/server/_coffre/assets/{users._user-DHTNhQ9o.js → users._user-CMwj-VI9.js} +2 -2
  58. package/dist/server/_coffre/assets/{users._user-BKdSQhIg.js → users._user-DUzwkSKT.js} +2 -2
  59. package/dist/server/_coffre/assets/{users.index-dMn0tlmc.js → users.index-BbuweTwH.js} +2 -2
  60. package/dist/server/_coffre/assets/{users.index-Cfo3ODpX.js → users.index-fWHv6A30.js} +3 -3
  61. package/dist/server/index.js +2 -2
  62. package/package.json +3 -3
  63. package/src/lib/audit-sentences.ts +0 -31
  64. package/src/lib/coffre.ts +3 -2
  65. package/src/routes/audit.tsx +2 -23
  66. package/src/routes/projects.index.tsx +12 -4
  67. package/dist/client/_coffre/assets/audit-EWPPhR7U.js +0 -1
  68. package/dist/client/_coffre/assets/projects.index-N_kCFBMq.js +0 -1
  69. package/dist/client/_coffre/assets/tokens._token-Df2R8TF_.js +0 -2
  70. package/dist/client/_coffre/assets/tokens.index-CSf5Mlz8.js +0 -2
  71. package/dist/client/_coffre/assets/users._user-D0JK911L.js +0 -2
  72. package/dist/client/_coffre/assets/users.index-BoFWF3mF.js +0 -2
@@ -1,10 +1,10 @@
1
1
  import { C as require_react, E as __toESM, o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
2
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
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-DMs96kfX.js";
5
- import { r as toast, t as useAction } from "./use-action-DQUmeH-5.js";
6
- import { t as PrincipalPage } from "./principal-page-SdG8_zcu.js";
7
- import { t as Route } from "./tokens._token-CmpmtfB_.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";
8
8
  //#region src/components/service-tokens.tsx
9
9
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
10
10
  var import_jsx_runtime = require_jsx_runtime();
@@ -1,8 +1,8 @@
1
1
  import { o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
2
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-Dr5X9TB5.js";
4
- import { t as Route } from "./tokens.index-B5-4dD4C.js";
5
- import { n as RemovedList } from "./offboarding-DY5MarpG.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";
6
6
  //#region src/routes/tokens.index.tsx?tsr-split=component
7
7
  var import_jsx_runtime = require_jsx_runtime();
8
8
  function TokensPage() {
@@ -1,7 +1,7 @@
1
1
  import { C as lazyRouteComponent, w as createFileRoute } from "./ui-D_slKpSF.js";
2
- import { o as loadDirectory } from "./directory-Dr5X9TB5.js";
2
+ import { o as loadDirectory } from "./directory-GsnYkse0.js";
3
3
  //#region src/routes/tokens.index.tsx
4
- var $$splitComponentImporter = () => import("./tokens.index-BReCgoV9.js");
4
+ var $$splitComponentImporter = () => import("./tokens.index-Ck0LN7aC.js");
5
5
  var Route = createFileRoute("/tokens/")({
6
6
  loader: async ({ context: { client }, parentMatchPromise }) => loadDirectory(client, (await parentMatchPromise).loaderData?.capabilities.canManageGrants ?? false),
7
7
  component: lazyRouteComponent($$splitComponentImporter, "component")
@@ -1,6 +1,6 @@
1
1
  import { C as require_react, E as __toESM, i as useRouter } from "./useStore-DWGPqzXR.js";
2
2
  import { t as require_react_dom } from "./react-dom-qCTiwGGR.js";
3
- import { n as failureMessage } from "./coffre-DMs96kfX.js";
3
+ import { n as failureMessage } from "./coffre-C2ANsTAz.js";
4
4
  //#region ../../node_modules/.pnpm/sonner@2.0.7_react-dom@19.2.7_react@19.2.7__react@19.2.7/node_modules/sonner/dist/index.mjs
5
5
  var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
6
6
  var import_react_dom = /* @__PURE__ */ __toESM(require_react_dom(), 1);
@@ -1,6 +1,6 @@
1
1
  import { o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
2
- import { t as PrincipalPage } from "./principal-page-SdG8_zcu.js";
3
- import { t as Route } from "./users._user-BKdSQhIg.js";
2
+ import { t as PrincipalPage } from "./principal-page-B8zPcS2b.js";
3
+ import { t as Route } from "./users._user-DUzwkSKT.js";
4
4
  //#region src/routes/users.$user.tsx?tsr-split=component
5
5
  var import_jsx_runtime = require_jsx_runtime();
6
6
  function UserPage() {
@@ -1,7 +1,7 @@
1
1
  import { C as lazyRouteComponent, w as createFileRoute } from "./ui-D_slKpSF.js";
2
- import { n as loadPrincipalPage } from "./principal-page-SdG8_zcu.js";
2
+ import { n as loadPrincipalPage } from "./principal-page-B8zPcS2b.js";
3
3
  //#region src/routes/users.$user.tsx
4
- var $$splitComponentImporter = () => import("./users._user-DHTNhQ9o.js");
4
+ var $$splitComponentImporter = () => import("./users._user-CMwj-VI9.js");
5
5
  var Route = createFileRoute("/users/$user")({
6
6
  loader: async ({ context: { client }, params, parentMatchPromise }) => loadPrincipalPage(client, "user", params.user, (await parentMatchPromise).loaderData),
7
7
  component: lazyRouteComponent($$splitComponentImporter, "component")
@@ -1,7 +1,7 @@
1
1
  import { C as lazyRouteComponent, w as createFileRoute } from "./ui-D_slKpSF.js";
2
- import { o as loadDirectory } from "./directory-Dr5X9TB5.js";
2
+ import { o as loadDirectory } from "./directory-GsnYkse0.js";
3
3
  //#region src/routes/users.index.tsx
4
- var $$splitComponentImporter = () => import("./users.index-Cfo3ODpX.js");
4
+ var $$splitComponentImporter = () => import("./users.index-fWHv6A30.js");
5
5
  var Route = createFileRoute("/users/")({
6
6
  loader: async ({ context: { client }, parentMatchPromise }) => loadDirectory(client, (await parentMatchPromise).loaderData?.capabilities.canManageGrants ?? false),
7
7
  component: lazyRouteComponent($$splitComponentImporter, "component")
@@ -1,8 +1,8 @@
1
1
  import { o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
2
2
  import { Q as Users, i as PageHeader, n as ClosedDoor } from "./page-BdnhpwvH.js";
3
- import { n as DirectoryTable, t as AddPrincipal } from "./directory-Dr5X9TB5.js";
4
- import { n as RemovedList } from "./offboarding-DY5MarpG.js";
5
- import { t as Route } from "./users.index-dMn0tlmc.js";
3
+ import { n as DirectoryTable, t as AddPrincipal } from "./directory-GsnYkse0.js";
4
+ import { n as RemovedList } from "./offboarding-8yMa7ViM.js";
5
+ import { t as Route } from "./users.index-BbuweTwH.js";
6
6
  //#region src/routes/users.index.tsx?tsr-split=component
7
7
  var import_jsx_runtime = require_jsx_runtime();
8
8
  function UsersPage() {
@@ -12380,7 +12380,7 @@ var HEADERS = { TSS_SHELL: "X-TSS_SHELL" };
12380
12380
  * the dev styles URL for route-scoped CSS collection.
12381
12381
  */
12382
12382
  async function getStartManifest(matchedRoutes) {
12383
- const { tsrStartManifest } = await import("./_coffre/assets/_tanstack-start-manifest_v-C2PEUeJL.js");
12383
+ const { tsrStartManifest } = await import("./_coffre/assets/_tanstack-start-manifest_v-BKg2AlPu.js");
12384
12384
  const startManifest = tsrStartManifest();
12385
12385
  let routes = startManifest.routes;
12386
12386
  routes[rootRouteId];
@@ -13507,7 +13507,7 @@ var getBaseManifest = getProdBaseManifest;
13507
13507
  var createEarlyHintsForRequest = createEarlyHintsCollector;
13508
13508
  async function loadEntries() {
13509
13509
  const [routerEntry, startEntry, pluginAdapters] = await Promise.all([
13510
- import("./_coffre/assets/router-BimLwejs.js"),
13510
+ import("./_coffre/assets/router-CQDoql8s.js"),
13511
13511
  import("./_coffre/assets/start-DR3rN0St.js"),
13512
13512
  import("./_coffre/assets/empty-plugin-adapters-Cq4--YW-.js")
13513
13513
  ]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffre/ui",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "coffre's pages: a prebuilt TanStack Start handler and its static files.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  "./package.json": "./package.json"
29
29
  },
30
30
  "dependencies": {
31
- "@coffre/client": "0.1.8"
31
+ "@coffre/client": "0.1.10"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@cloudflare/vite-plugin": "1.50.0",
@@ -51,7 +51,7 @@
51
51
  "typescript": "5.9.3",
52
52
  "vite": "8.1.5",
53
53
  "wrangler": "4.118.0",
54
- "@coffre/core": "0.1.8"
54
+ "@coffre/core": "0.1.10"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "vite build && rm dist/server/wrangler.json && tsdown && node ../../scripts/check-client-bundle.mjs",
@@ -428,37 +428,6 @@ export function lines<T extends AuditEntry>(entries: T[]): T[][] {
428
428
  return shown;
429
429
  }
430
430
 
431
- /** What a kind of hidden entry is called, by action or its prefix. */
432
- const HIDDEN_KINDS: [prefix: string, one: string, many: string][] = [
433
- ['key.', 'key operation', 'key operations'],
434
- ['sign_in', 'sign-in', 'sign-ins'],
435
- ['sign_out', 'sign-out', 'sign-outs'],
436
- ['token.', 'token change', 'token changes'],
437
- ['device.', 'CLI sign-in approval', 'CLI sign-in approvals'],
438
- ['account.', 'account link', 'account links'],
439
- ['sync.run', 'sync run', 'sync runs'],
440
- ['audit.heartbeat', 'heartbeat', 'heartbeats'],
441
- ['audit.checkpoint', 'checkpoint', 'checkpoints'],
442
- ];
443
-
444
- /**
445
- * "2 key operations, 3 sign-ins and 12 heartbeats": the detail the server
446
- * left out of the page, as it counts it, by action.
447
- */
448
- export function hiddenInWords(hidden: { action: string; count: number }[]): string | null {
449
- const counts = new Map<string, { one: string; many: string; count: number }>();
450
- for (const { action, count } of hidden) {
451
- if (count === 0) continue;
452
- const [, one, many] = HIDDEN_KINDS.find(([prefix]) => action.startsWith(prefix)) ?? [action, action, action];
453
- const kind = counts.get(one) ?? { one, many, count: 0 };
454
- kind.count += count;
455
- counts.set(one, kind);
456
- }
457
- const phrases = [...counts.values()].map(({ one, many, count }) => `${count} ${count === 1 ? one : many}`);
458
- if (phrases.length === 0) return null;
459
- return phrases.length === 1 ? phrases[0]! : `${phrases.slice(0, -1).join(', ')} and ${phrases.at(-1)}`;
460
- }
461
-
462
431
  /** A sentence as text. */
463
432
  export function plain(parts: Part[]): string {
464
433
  return parts
package/src/lib/coffre.ts CHANGED
@@ -13,7 +13,8 @@ export function useCoffre(): CoffreClient {
13
13
  /** A refusal the page words itself, shown as it is. */
14
14
  export class Refusal extends Error {}
15
15
 
16
- type Failure = { ok: false; error: string };
16
+ /** A call that failed: what to say, and whether signing in again would help, which it does only for an ended session. */
17
+ type Failure = { ok: false; error: string; signedOut: boolean };
17
18
 
18
19
  /** The HTTP status of an API error; undefined when the request never got an answer. */
19
20
  export function statusOf(error: unknown): number | undefined {
@@ -37,7 +38,7 @@ export function failureMessage(error: unknown): string {
37
38
  }
38
39
 
39
40
  export function uiFailure(error: unknown): Failure {
40
- return { ok: false, error: failureMessage(error) };
41
+ return { ok: false, error: failureMessage(error), signedOut: statusOf(error) === 401 };
41
42
  }
42
43
 
43
44
  /** A loader's answer: what it read, or what to say instead. */
@@ -5,7 +5,6 @@ import { statusOf, uiResult } from '../lib/coffre';
5
5
  import {
6
6
  decidedBy,
7
7
  describe,
8
- hiddenInWords,
9
8
  lines,
10
9
  who,
11
10
  type Part,
@@ -111,7 +110,6 @@ function AuditPage() {
111
110
  const broken = chain.integrity === 'broken' ? chain : null;
112
111
  const breakAt = broken?.failedAtSeq ?? null;
113
112
  const shown = lines(result.entries);
114
- const hiddenText = detail ? null : hiddenInWords(result.hidden ?? []);
115
113
  const filters = { decision, actorId };
116
114
 
117
115
  return (
@@ -137,13 +135,7 @@ function AuditPage() {
137
135
  ; <code>coffre audit</code> lists them all.
138
136
  </>
139
137
  ) : (
140
- <>
141
- : it may be detail,{' '}
142
- <Link to="/audit" search={{ ...filters, detail: '1' }}>
143
- shown on request
144
- </Link>
145
- .
146
- </>
138
+ ': it may be detail, which Show detail lists.'
147
139
  )}
148
140
  </>
149
141
  )}
@@ -151,11 +143,6 @@ function AuditPage() {
151
143
  </div>
152
144
  )}
153
145
 
154
- <p className="section-desc">
155
- Everything done in coffre, one line per action, refusals included, and who decided it: the
156
- app, or the vault, which holds the keys and the access.
157
- </p>
158
-
159
146
  <div className="toolbar">
160
147
  <nav className="segmented" aria-label="Filter by decision">
161
148
  {/* `exact` compares the whole search, not a subset of it: otherwise
@@ -244,14 +231,6 @@ function AuditPage() {
244
231
  )}
245
232
  </section>
246
233
 
247
- {hiddenText !== null && (
248
- <p className="hint section-foot">
249
- Hidden: {hiddenText}.{' '}
250
- <Link to="/audit" search={{ ...filters, detail: '1' }}>
251
- Show detail
252
- </Link>
253
- </p>
254
- )}
255
234
  </>
256
235
  );
257
236
  }
@@ -537,7 +516,7 @@ function ChainStatus({ chain }: { chain: ChainResult }) {
537
516
  >
538
517
  <button type="button" className="chain-seal">
539
518
  <ShieldCheck size={14} />
540
- {chain.through === null ? 'Verified' : `Verified through ${chain.through}`}
519
+ Verified
541
520
  </button>
542
521
  </Toggletip>
543
522
  </div>
@@ -1,6 +1,6 @@
1
1
  import type { CoffreClient } from '@coffre/client';
2
2
  import { useState } from 'react';
3
- import { createFileRoute, Link } from '@tanstack/react-router';
3
+ import { createFileRoute, Link, useRouter } from '@tanstack/react-router';
4
4
  import { toast } from 'sonner';
5
5
  import { deriveUiCapabilities } from '../lib/capabilities';
6
6
  import { Refusal, uiResult, useCoffre } from '../lib/coffre';
@@ -66,6 +66,7 @@ async function countSecrets(
66
66
 
67
67
  function ProjectsPage() {
68
68
  const { result, secrets } = Route.useLoaderData();
69
+ const router = useRouter();
69
70
 
70
71
  if (!result.ok) {
71
72
  return (
@@ -73,9 +74,16 @@ function ProjectsPage() {
73
74
  icon={<AlertTriangle size={18} />}
74
75
  title="Projects could not be listed"
75
76
  actions={
76
- <Link className="btn" to="/login">
77
- Sign in again
78
- </Link>
77
+ result.signedOut ? (
78
+ <Link className="btn" to="/login">
79
+ Sign in again
80
+ </Link>
81
+ ) : (
82
+ // An outage, not a sign-out: signing in again would not help, and asking again might.
83
+ <button type="button" className="btn" onClick={() => void router.invalidate()}>
84
+ Try again
85
+ </button>
86
+ )
79
87
  }
80
88
  >
81
89
  {result.error}
@@ -1 +0,0 @@
1
- import{$ as e,H as t,Ot as n,S as r,T as i,Tt as a,W as o,X as s,c,ct as l,f as u,i as d,m as f,n as p,o as m}from"./page-DbSS7pYH.js";import{D as h,a as g,c as _,f as v,m as y,u as b}from"./preload-helper-DduCCcmc.js";import{t as x}from"./audit-CdCJ1U8E.js";var S=n(a()),C=e=>typeof e==`string`&&e!==``?e:null,w=e=>typeof e==`number`?e:null;function T({project:e,environment:t,key:n}){let r=[e,t,n].filter(e=>e!==null);return r.length===0?[`coffre`]:[{place:r.join(`/`)}]}function E({project:e,environment:t}){return T({project:e,environment:t,key:null})}function D(e){if(e.subject!==null)return[{member:e.subject}];let t=C(e.metadata.principalId);return t===null?[`someone`]:[{member:`${e.metadata.principalType===`service`?`token`:`user`}:${t}`}]}function O(e,t,n=`${t}s`){return`${e} ${e===1?t:n}`}function k(e){return e.batch.length===1?T(e.entry):[...E(e.entry),e.refused?`, `:`: `,O(e.count,`secret`)]}function A(e){let t=C(e.metadata.destination);return t===null?``:` to ${t}`}function j(e){return C(e.metadata.destination)??`its destination`}var M={reveal:[`revealed`,`reveal`],run:[`ran`,`run`],compare:[`compared`,`compare`],sync:[`read`,`read`]};function N({entry:e}){return M[C(e.metadata.purpose)??`reveal`]??M.reveal}var P=e=>{let t=t=>[`${e} `,...e===`project`?T({...t.entry,environment:null,key:null}):E(t.entry)];return{[`${e}.create`]:{did:`created`,tried:`create`,what:t},[`${e}.update`]:{did:`changed`,tried:`change`,what:t},[`${e}.archive`]:{did:`archived`,tried:`archive`,what:t},[`${e}.restore`]:{did:`restored`,tried:`restore`,what:t}}},F={"secret.read":{did:e=>N(e)[0],tried:e=>N(e)[1],what:k},"secret.write":{did:({batch:e})=>{let t=e.filter(e=>e.version===1).length;return t===e.length?`added`:t===0?`changed`:`wrote`},tried:`change`,what:k,then:({entry:e,batch:t})=>t.length>1||e.version===null||e.version===1?[]:[`, now version ${e.version}`]},"secret.restore":{did:`restored`,tried:`restore`,what:({entry:e})=>[...T(e),...w(e.metadata.from)===null?[]:[` to version ${w(e.metadata.from)}`]],then:({entry:e})=>e.version===null?[]:[`, now ${e.version}`]},"secret.rename":{did:`renamed`,tried:`rename`,what:({entry:e})=>[...T(e),...C(e.metadata.nextKey)===null?[]:[` to ${C(e.metadata.nextKey)}`]]},"secret.archive":{did:`archived`,tried:`archive`,what:e=>T(e.entry)},"secret.unarchive":{did:`brought back`,tried:`bring back`,what:e=>T(e.entry)},...P(`project`),...P(`environment`),"access.grant":{did:`gave`,tried:`give`,what:({entry:e})=>[...D(e),` ${C(e.metadata.role)??`a role`} on `,...I(e)],then:({entry:e})=>[...C(e.metadata.previousRole)===null?[]:[`, was ${C(e.metadata.previousRole)}`],...C(e.metadata.expiresAt)===null?[]:[`, until ${C(e.metadata.expiresAt).slice(0,10)}`]]},"access.revoke":{did:`took`,tried:`take`,what:({entry:e})=>[...C(e.metadata.previousRole??e.metadata.role)===null?[`access to `]:[`${C(e.metadata.previousRole??e.metadata.role)} on `],...I(e),` from `,...D(e)]},"member.add":{did:`added`,tried:`add`,what:({entry:e})=>[...D(e),...e.metadata.rootAdmin===!0?[` as a root admin`]:e.metadata.owner===!0?[` as an owner`]:[]]},"member.remove":{did:`removed`,tried:`remove`,what:e=>D(e.entry),then:({entry:e})=>w(e.metadata.revoked)===null?[]:[`, who held ${O(w(e.metadata.revoked),`grant`)}`]},"member.restore":{did:`brought back`,tried:`bring back`,what:e=>D(e.entry)},"member.owner":{did:({entry:e})=>e.metadata.owner===!1?`took owner from`:`made`,tried:({entry:e})=>e.metadata.owner===!1?`take owner from`:`make`,what:({entry:e})=>[...D(e),...e.metadata.owner===!1?[]:[` an owner`]]},"sync.create":{did:`set up a sync of`,tried:`set up a sync of`,what:({entry:e})=>[...E(e),A(e)]},"sync.update":{did:({entry:e})=>e.metadata.paused===!0?`paused the sync of`:e.metadata.paused===!1?`resumed the sync of`:`changed the sync of`,tried:`change the sync of`,what:({entry:e})=>[...E(e),A(e)]},"sync.delete":{did:`removed the sync of`,tried:`remove the sync of`,what:({entry:e})=>[...E(e),A(e)]},"sync.push":{did:`pushed`,tried:`push`,what:e=>e.batch.length===1?[...T(e.entry),` to ${j(e.entry)}`]:[...E(e.entry),` to ${j(e.entry)}: ${O(e.count,`secret`)}`]},"sync.remove":{did:`removed`,tried:`remove`,what:e=>e.batch.length===1?[...T(e.entry),` from ${j(e.entry)}`]:[O(e.count,`secret`),` of `,...E(e.entry),` from ${j(e.entry)}`]},"vault.tampered":{did:`found`,tried:`check`,what:({entry:e})=>[...e.subject===null?[`an entry`]:[...D(e),`'s record`],` tampered with: ${R[e.reason??``]??`it fails its seal`}`]},"key.rotate":{did:`rotated its key`,tried:`rotate its key`,what:()=>[]},sign_in:{did:({entry:e})=>e.metadata.kind===`cli`?`signed in to the CLI`:`signed in`,tried:`sign in`,what:({entry:e})=>C(e.metadata.provider)===null?[]:[`with ${C(e.metadata.provider)}`]},sign_out:{did:`signed out`,tried:`sign out`,what:()=>[]},"token.create":{did:`issued a token to`,tried:`issue a token to`,what:e=>D(e.entry)},"token.revoke":{did:`revoked a token of`,tried:`revoke a token of`,what:e=>D(e.entry)},"device.approve":{did:`approved a CLI sign-in`,tried:`approve a CLI sign-in`,what:()=>[]},"device.deny":{did:`turned down a CLI sign-in`,tried:`turn down a CLI sign-in`,what:()=>[]},"account.link":{did:`linked`,tried:`link`,what:({entry:e})=>[`a ${C(e.metadata.provider)??`sign-in`} account`]},"account.unlink":{did:`unlinked`,tried:`unlink`,what:({entry:e})=>[`a ${C(e.metadata.provider)??`sign-in`} account`]},"key.wrap":{did:`sealed the key of`,tried:`seal the key of`,what:e=>L(e.entry)},"key.rewrap":{did:`resealed the key of`,tried:`reseal the key of`,what:e=>L(e.entry)},"key.intent":{did:`asked KMS about`,tried:`ask KMS about`,what:e=>k(e)},"key.check":{did:`recorded the check value of`,tried:`check`,what:({entry:e})=>[[`the`,C(e.metadata.kekProvider)===`local`?null:C(e.metadata.kekProvider),`vault key`,C(e.metadata.kekId)].filter(e=>e!==null).join(` `)]},"sync.run":{did:`ran the sync of`,tried:`run the sync of`,what:({entry:e})=>[...E(e),A(e)]},"audit.heartbeat":{did:`checked in`,tried:`check in`,what:()=>[]},"audit.checkpoint":{did:`signed the log`,tried:`sign the log`,what:({entry:e})=>w(e.metadata.seq)===null?[]:[`through entry ${w(e.metadata.seq)}`]},"secret.list":{did:`listed`,tried:`list`,what:({entry:e})=>E(e)},"secret.history":{did:`read the history of`,tried:`read the history of`,what:e=>T(e.entry)},"secret.update":{did:`changed`,tried:`change`,what:e=>T(e.entry)},"sync.list":{did:`listed the syncs of`,tried:`list the syncs of`,what:({entry:e})=>E(e)}};function I(e){return T({...e,key:null})}function L(e){return[...T(e),...e.version===null?[]:[`, version ${e.version}`]]}var R={mac:`it does not carry the vault's seal`,stale:`an older copy was put back`,forged_entry:`the vault did not write it`},z={no_grant:`no grant`,bulk_limit:`bulk limit`,expired:`grant expired`,removed:`removed from coffre`,not_a_member:`not a member`,not_registered:`not invited`,tampered:`their record was tampered with`,bad_claim:`the key did not match the secret`,not_allowed:`not allowed`,root_admin:`root admins are set by the deployment`,unknown_environment:`no such environment`,unknown_secret:`no such secret`,unknown_project:`no such project`,unusable_credential:`its token is not a secret they can read`,duplicate_destination:`already synced from elsewhere`,cannot_grant_sync:`cannot grant the sync its reads`,kms_unavailable:`KMS did not answer`,wrong_kek:`the vault's key is not the one that wrapped the data`},B={secret_read:`no grant to read it`,secret_write:`no grant to write`,secret_archive:`no grant to archive`,audit_read:`no grant to read the audit log`,environment_manage:`no grant to manage environments`,grant_manage:`no grant to manage access`,project_manage:`no grant to manage the project`};function V(e){return e===null?`refused`:e.startsWith(`missing_`)?B[e.slice(8)]??`no grant`:z[e]??e.replace(/_/g,` `)}var ee=[`sync.push`,`sync.remove`,`secret.write`,`secret.read`];function te(e){for(let t of ee){let n=e.find(e=>e.action===t);if(n!==void 0)return n}return e[0]}function H(e){let t=te(e),n=e.filter(e=>e.action===t.action),r=n.filter(e=>e.decision===`deny`),i=r.length===n.length,a={entry:t,batch:n,count:new Set(n.map(e=>`${e.project}/${e.environment}/${e.key}`)).size,refused:i},o=F[t.action];if(o===void 0)return{parts:[t.action,` `,...T(t)],refused:i};let s=e=>typeof e==`string`?e:e(a),c=o.what(a),l=c.length===0?[]:[` `];if(i){let e=V((r[0]??t).reason);return{parts:[`tried to `,s(o.tried),...l,...c,`: ${e}`],refused:i}}let u=r.length===0?[]:[`, ${r.length} refused: ${V(r[0].reason)}`];return{parts:[s(o.did),...l,...c,...o.then?.(a)??[],...u],refused:i}}function U(e){let t=e[0];if(t.actorType===`user`)return{member:`user:${t.actorId}`};if(t.actorType===`service`)return{member:`token:${t.actorId}`};if(t.actorId.startsWith(`sync:`)){let t=e.map(e=>C(e.metadata.provider)).find(e=>e!==null),n=t===void 0?void 0:W[t]??t;return n===void 0?`a sync`:`sync to ${n}`}return G[t.actorId]??t.actorId}var W={"github-actions":`GitHub`,vercel:`Vercel`,railway:`Railway`,"cloudflare-workers":`Cloudflare`},G={scheduler:`the scheduler`,cron:`the scheduler`,vault:`the vault`,app:`coffre`};function K(e){return[`vault`,`app`].filter(t=>e.some(e=>e.author===t)).join(`, `)}function q(e){let t=[],n=new Map;for(let r of e){let e=r.operationId===null?void 0:n.get(r.operationId);if(e!==void 0){e.push(r);continue}let i=[r];r.operationId!==null&&n.set(r.operationId,i),t.push(i)}return t}var J=[[`key.`,`key operation`,`key operations`],[`sign_in`,`sign-in`,`sign-ins`],[`sign_out`,`sign-out`,`sign-outs`],[`token.`,`token change`,`token changes`],[`device.`,`CLI sign-in approval`,`CLI sign-in approvals`],[`account.`,`account link`,`account links`],[`sync.run`,`sync run`,`sync runs`],[`audit.heartbeat`,`heartbeat`,`heartbeats`],[`audit.checkpoint`,`checkpoint`,`checkpoints`]];function Y(e){let t=new Map;for(let{action:n,count:r}of e){if(r===0)continue;let[,e,i]=J.find(([e])=>n.startsWith(e))??[n,n,n],a=t.get(e)??{one:e,many:i,count:0};a.count+=r,t.set(e,a)}let n=[...t.values()].map(({one:e,many:t,count:n})=>`${n} ${n===1?e:t}`);return n.length===0?null:n.length===1?n[0]:`${n.slice(0,-1).join(`, `)} and ${n.at(-1)}`}var X=l();function Z(){let{entries:n,chain:r}=x.useLoaderData(),a=x.useSearch(),{decision:c,actorId:l}=a,u=a.detail===`1`,v=c===`deny`;if(!n.ok)return(0,X.jsx)(p,{icon:(0,X.jsx)(i,{size:18}),label:`Audit`,title:`The audit log is closed to you`,children:n.error});let y=r.integrity===`broken`?r:null,b=y?.failedAtSeq??null,S=q(n.entries),C=u?null:Y(n.hidden??[]),w={decision:c,actorId:l};return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(d,{title:`Audit`,actions:(0,X.jsx)(se,{chain:r})}),y!==null&&(0,X.jsx)(`div`,{style:{marginBottom:`1.25rem`},children:(0,X.jsxs)(_,{tone:`bad`,children:[(0,X.jsx)(`strong`,{children:`Treat this as an incident.`}),` `,y.failedAtSeq===null?`The log does not verify, found by the ${y.author}'s check: ${y.reason}.`:`The log breaks at entry ${y.failedAtSeq}, found by the ${y.author}'s check: ${y.reason}.`,` `,y.through!==null&&`Every entry through ${y.through} holds. `,`Something with direct access to the database has changed what it records`,y.failedAtSeq===null?``:`, and nothing from entry ${y.failedAtSeq} on can be relied on`,` until that is explained.`,b!==null&&!n.entries.some(e=>e.seq===b)&&(0,X.jsxs)(X.Fragment,{children:[` `,`Entry `,b,` is not among the entries below`,u?(0,X.jsxs)(X.Fragment,{children:[`; `,(0,X.jsx)(`code`,{children:`coffre audit`}),` lists them all.`]}):(0,X.jsxs)(X.Fragment,{children:[`: it may be detail,`,` `,(0,X.jsx)(h,{to:`/audit`,search:{...w,detail:`1`},children:`shown on request`}),`.`]})]})]})}),(0,X.jsx)(`p`,{className:`section-desc`,children:`Everything done in coffre, one line per action, refusals included, and who decided it: the app, or the vault, which holds the keys and the access.`}),(0,X.jsxs)(`div`,{className:`toolbar`,children:[(0,X.jsxs)(`nav`,{className:`segmented`,"aria-label":`Filter by decision`,children:[(0,X.jsx)(h,{to:`/audit`,search:{...w,decision:void 0,detail:a.detail},activeOptions:{exact:!0},children:`All events`}),(0,X.jsxs)(h,{to:`/audit`,search:{...w,decision:`deny`,detail:a.detail},activeOptions:{exact:!0},children:[(0,X.jsx)(o,{size:13}),`Denials only`]})]}),l!==void 0&&(0,X.jsxs)(h,{className:`filter-chip`,to:`/audit`,search:{...w,actorId:void 0,detail:a.detail},"aria-label":`Stop filtering by ${l}`,children:[`Actor `,(0,X.jsx)(`span`,{className:`mono`,children:l}),(0,X.jsx)(e,{size:13})]}),(0,X.jsxs)(h,{className:`detail-toggle`,to:`/audit`,search:{...w,detail:u?void 0:`1`},"aria-pressed":u,children:[(0,X.jsx)(`span`,{className:`switch`,"aria-hidden":`true`}),`Show detail`]})]}),(0,X.jsx)(`section`,{className:`card`,"aria-label":`Audit entries`,children:S.length===0?(0,X.jsx)(g,{title:v?`No denials recorded`:`Nothing recorded yet`,children:v?`Every decision reaches this log, refusals included. An empty page means nobody has been turned away.`:`The log fills as people read and write secrets and change who has access.`}):(0,X.jsx)(`div`,{className:`dt-wrap`,children:(0,X.jsxs)(`table`,{className:`dt audit events stacks`,children:[(0,X.jsx)(`thead`,{children:(0,X.jsxs)(`tr`,{children:[(0,X.jsx)(`th`,{className:`n`,title:`Sequence number in the log`,children:`#`}),(0,X.jsx)(`th`,{className:`col-shrink`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(f,{size:14}),`When (UTC)`]})}),(0,X.jsx)(`th`,{className:`col-shrink`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(s,{size:14}),`Who`]})}),(0,X.jsx)(`th`,{children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(m,{size:14}),`What they did`]})}),(0,X.jsx)(`th`,{className:`col-shrink`,children:(0,X.jsxs)(`span`,{className:`th`,children:[(0,X.jsx)(t,{size:14}),`Decided by`]})})]})}),(0,X.jsx)(`tbody`,{children:S.map(e=>(0,X.jsx)(ne,{batch:e,filters:w,detail:a.detail,breakAt:b},e[0].seq))})]})})}),C!==null&&(0,X.jsxs)(`p`,{className:`hint section-foot`,children:[`Hidden: `,C,`.`,` `,(0,X.jsx)(h,{to:`/audit`,search:{...w,detail:`1`},children:`Show detail`})]})]})}function ne({batch:e,filters:t,detail:n,breakAt:r}){let i=r!==null&&e.some(e=>e.seq===r),[a,o]=(0,S.useState)(i),s=e[0],c=H(e),l=e.map(e=>e.seq),d=e.length>1;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Q,{entry:s,seq:d?`${Math.min(...l)}–${Math.max(...l)}`:String(s.seq),parts:c.parts,refused:c.refused,decided:K(e),filters:t,detail:n,breaks:i&&!d,marked:i,batch:e,toggle:d?(0,X.jsx)(`button`,{type:`button`,className:`batch-toggle`,"aria-expanded":a,"aria-label":a?`Hide each entry`:`Show each of ${e.length} entries`,onClick:()=>o(!a),children:(0,X.jsx)(u,{size:14})}):void 0}),d&&a&&e.map(e=>{let i=H([e]);return(0,X.jsx)(Q,{entry:e,seq:String(e.seq),parts:i.parts,refused:i.refused,decided:K([e]),filters:t,detail:n,breaks:e.seq===r,marked:!1,child:!0},e.seq)})]})}function Q({entry:e,seq:t,parts:n,refused:r,decided:i,filters:a,detail:s,breaks:l,marked:u,toggle:d,child:f=!1,batch:p}){let m=U(p??[e]),g=[r&&`is-denied`,(l||u)&&`is-break`,f&&`is-child`,e.detail&&`is-detail`,e.action===`vault.tampered`&&`is-tampered`].filter(Boolean);return(0,X.jsxs)(`tr`,{className:g.length===0?void 0:g.join(` `),children:[(0,X.jsx)(`td`,{className:`n`,"data-label":`Sequence`,children:t}),(0,X.jsx)(`td`,{className:`nowrap cell-mono`,"data-label":`When (UTC)`,children:(0,X.jsx)(b,{iso:e.occurredAt,precise:!0})}),(0,X.jsx)(`td`,{"data-label":`Who`,children:(0,X.jsx)(`span`,{className:`actor`,children:typeof m==`string`?(0,X.jsx)(h,{to:`/audit`,search:{...a,actorId:e.actorId,detail:s},children:m}):(0,X.jsx)(h,{to:`/audit`,search:{...a,actorId:e.actorId,detail:s},children:$(m.member)})})}),(0,X.jsx)(`td`,{className:`cell-sentence`,"data-label":`What they did`,children:(0,X.jsxs)(`span`,{className:`sentence`,children:[d,e.action===`vault.tampered`&&(0,X.jsx)(c,{size:13}),(0,X.jsx)(re,{parts:n}),l&&(0,X.jsx)(oe,{})]})}),(0,X.jsx)(`td`,{className:`nowrap`,"data-label":`Decided by`,children:(0,X.jsxs)(`span`,{className:r?`decided decided-refused`:`decided`,children:[r&&(0,X.jsx)(o,{size:13}),i,r&&`, refused`]})})]})}function re({parts:e}){return(0,X.jsx)(X.Fragment,{children:e.map((e,t)=>(0,X.jsx)(S.Fragment,{children:typeof e==`string`?e:`place`in e?(0,X.jsx)(ie,{path:e.place}):(0,X.jsx)(ae,{member:e.member})},t))})}function ie({path:e}){let[t,n]=e.split(`/`),r=(0,X.jsx)(`span`,{className:`mono`,children:y(e)});return n===void 0?(0,X.jsx)(h,{to:`/projects/$project`,params:{project:t},children:r}):(0,X.jsx)(h,{to:`/projects/$project/$environment`,params:{project:t,environment:n},children:r})}function ae({member:e}){return e.startsWith(`token:`)?(0,X.jsx)(h,{to:`/tokens/$token`,params:{token:e.slice(6)},children:e}):(0,X.jsx)(h,{to:`/users/$user`,params:{user:$(e)},children:$(e)})}function $(e){return e.startsWith(`user:`)?e.slice(5):e}function oe(){return(0,X.jsxs)(`span`,{className:`break-mark`,children:[(0,X.jsx)(c,{size:11}),`breaks here`]})}function se({chain:e}){return e.integrity===`owners-only`?(0,X.jsx)(v,{align:`end`,label:`Owners and root admins see whether the log is intact. Checking it means recomputing every entry, and you read only your projects' part of it.`,children:(0,X.jsxs)(`button`,{type:`button`,className:`chain-note`,children:[(0,X.jsx)(r,{size:14}),`Verified by owners`]})}):e.integrity===`unknown`?(0,X.jsx)(v,{align:`end`,label:`coffre could not check the log: ${e.problem}. The entries below loaded, but whether they are intact is unknown until it can. Reload to try again.`,children:(0,X.jsxs)(`button`,{type:`button`,className:`chain-flag chain-flag-warn`,children:[(0,X.jsx)(c,{size:14}),`Log not verified`]})}):e.integrity===`broken`?(0,X.jsxs)(`span`,{className:`chain-flag chain-flag-bad`,role:`status`,children:[(0,X.jsx)(c,{size:14}),e.failedAtSeq===null?`Log does not verify`:`Log broken at ${e.failedAtSeq}`]}):(0,X.jsxs)(`div`,{className:`chain`,children:[e.pending>0&&(0,X.jsx)(v,{align:`end`,label:`Keys released through KMS whose outcome the vault has not logged yet. Each settles within seconds, or is logged as failed.`,children:(0,X.jsxs)(`button`,{type:`button`,className:`chain-note`,role:`status`,children:[e.pending,` key operation`,e.pending===1?``:`s`,` in flight`]})}),(0,X.jsx)(v,{align:`end`,label:`Every entry through ${e.through??0} holds, under the app's key and the vault's.`+(e.checkpoint===null?` The vault has not signed the log yet.`:` The vault last signed it through entry ${e.checkpoint.seq}, at ${e.checkpoint.signedAt}.`),children:(0,X.jsxs)(`button`,{type:`button`,className:`chain-seal`,children:[(0,X.jsx)(t,{size:14}),e.through===null?`Verified`:`Verified through ${e.through}`]})})]})}export{Z as component};
@@ -1 +0,0 @@
1
- import{L as e,Ot as t,Tt as n,a as r,b as i,c as a,ct as o,i as s,n as c,v as l,w as u}from"./page-DbSS7pYH.js";import{D as d,a as f,l as p,o as m,s as h}from"./preload-helper-DduCCcmc.js";import{s as g,t as _}from"./coffre-CXkp3Efg.js";import{r as v,t as y}from"./use-action-CUvWPRTx.js";import{n as b,r as x}from"./affordances-CmoY-8Xf.js";import{n as S}from"./project-environments-CfIH5kFM.js";import{t as C}from"./projects.index-BG8W91BX.js";import{n as w}from"./validation-9Cl_XS-l.js";var T=t(n()),E=o();function D(){let{result:e,secrets:t}=C.useLoaderData();if(!e.ok)return(0,E.jsx)(c,{icon:(0,E.jsx)(a,{size:18}),title:`Projects could not be listed`,actions:(0,E.jsx)(d,{className:`btn`,to:`/login`,children:`Sign in again`}),children:e.error});let n=e.projects.filter(e=>e.archivedAt===null),r=e.projects.filter(e=>e.archivedAt!==null);return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsx)(s,{title:`Projects`,actions:(0,E.jsx)(x,{capabilities:e.capabilities,children:(0,E.jsx)(A,{})})}),n.length===0?(0,E.jsx)(`div`,{className:`card`,children:(0,E.jsx)(f,{title:`Nothing here for you yet`,children:(0,E.jsx)(b,{capabilities:e.capabilities,hasArchivedProjects:r.length>0})})}):(0,E.jsx)(`section`,{className:`card`,"aria-label":`Projects`,children:(0,E.jsx)(O,{projects:n,secrets:t})}),r.length>0&&(0,E.jsxs)(`section`,{"aria-labelledby":`archived-projects`,children:[(0,E.jsx)(`h2`,{className:`section-title`,id:`archived-projects`,children:`Archived`}),(0,E.jsx)(`div`,{className:`card`,children:(0,E.jsx)(O,{projects:r,secrets:t})})]})]})}function O({projects:e,secrets:t}){return(0,E.jsx)(`div`,{className:`dt-wrap`,children:(0,E.jsxs)(`table`,{className:`dt projects stacks`,children:[(0,E.jsx)(`thead`,{children:(0,E.jsxs)(`tr`,{children:[(0,E.jsx)(`th`,{className:`n`,children:`#`}),(0,E.jsx)(`th`,{className:`col-project`,children:(0,E.jsxs)(`span`,{className:`th`,children:[(0,E.jsx)(l,{size:14}),`Project`]})}),(0,E.jsx)(`th`,{children:(0,E.jsxs)(`span`,{className:`th`,children:[(0,E.jsx)(u,{size:14}),`Environments`]})}),(0,E.jsx)(`th`,{className:`col-shrink col-secrets`,children:(0,E.jsxs)(`span`,{className:`th`,children:[(0,E.jsx)(i,{size:14}),`Secrets`]})})]})}),(0,E.jsx)(`tbody`,{children:e.map((e,n)=>(0,E.jsx)(k,{number:n+1,project:e,secrets:t[e.slug]??null},e.slug))})]})})}function k({number:e,project:t,secrets:n}){let i=t.archivedAt!==null,a=t.environments.filter(e=>e.details===null||e.details.archivedAt===null);return(0,E.jsxs)(`tr`,{className:`row-link`,children:[(0,E.jsx)(`td`,{className:`n`,children:e}),(0,E.jsx)(`td`,{className:`col-project`,children:(0,E.jsxs)(`span`,{className:`cell-project`,children:[(0,E.jsx)(r,{name:t.slug}),(0,E.jsxs)(`span`,{className:`cell-stack`,children:[(0,E.jsx)(d,{className:`cell-link stretch`,to:`/projects/$project`,params:{project:t.slug},children:t.name}),(0,E.jsx)(`small`,{className:`mono`,children:t.slug})]})]})}),(0,E.jsx)(`td`,{className:`col-envs`,"data-label":`Environments`,children:i||a.length===0?(0,E.jsx)(`span`,{className:`cell-muted`,children:a.length===0?`No environments yet`:`${a.length} environment${a.length===1?``:`s`}`}):(0,E.jsx)(`span`,{className:`env-links`,"aria-label":`Environments in ${t.slug}`,children:a.map(e=>S(e)?(0,E.jsxs)(d,{className:`env-link`,to:`/projects/$project/$environment`,params:{project:t.slug,environment:e.slug},children:[e.slug,(0,E.jsx)(`span`,{className:`count`,children:e.details.secretCount})]},e.slug):(0,E.jsx)(`span`,{className:`env-link`,title:`You can see this environment exists, but not open it`,children:e.slug},e.slug))})}),(0,E.jsx)(`td`,{className:`col-secrets num nowrap`,children:n!==null&&!i?(0,E.jsxs)(E.Fragment,{children:[n,(0,E.jsxs)(`span`,{className:`narrow-only`,children:[` secret`,n===1?``:`s`]})]}):(0,E.jsx)(`span`,{className:`cell-muted wide-only`,children:`—`})})]})}function A(){let[t,n]=(0,T.useState)(``),[r,i]=(0,T.useState)(``),[a,o]=(0,T.useState)(!1),s=g(),{pending:c,error:l,setError:u,run:d}=y(),f=t===``?null:w(t);function b(){o(!1),u(null)}return(0,E.jsxs)(E.Fragment,{children:[(0,E.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o(!0),children:[(0,E.jsx)(e,{size:14}),`New project`]}),(0,E.jsx)(h,{open:a,onOpenChange:e=>e?o(!0):b(),title:`New project`,description:`A project holds environments, and access is granted on it or on one of its environments. You become its owner.`,children:(0,E.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),d(async()=>{let{created:e}=await s.projects.create(t,{name:r});if(!e)throw new _(`A project named "${t}" already exists.`)},()=>{v.success(`Project ${t} created`),n(``),i(``),o(!1)})},children:[(0,E.jsxs)(`label`,{className:`field`,children:[(0,E.jsx)(`span`,{className:`label`,children:`Slug`}),(0,E.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:`market`,value:t,"aria-invalid":f!==null,"aria-describedby":`new-project-slug-hint`,onChange:e=>n(e.target.value)}),(0,E.jsx)(`span`,{className:`hint${f===null?``:` edit-note-error`}`,id:`new-project-slug-hint`,children:f??`Used in paths, as in market/prod. Renaming it later is safe.`})]}),(0,E.jsxs)(`label`,{className:`field`,children:[(0,E.jsx)(`span`,{className:`label`,children:`Display name`}),(0,E.jsx)(`input`,{className:`input`,placeholder:`Market data platform`,value:r,onChange:e=>i(e.target.value)})]}),(0,E.jsx)(m,{error:l}),(0,E.jsxs)(`div`,{className:`dialog-actions`,children:[(0,E.jsx)(`button`,{className:`btn`,type:`button`,onClick:b,children:`Cancel`}),(0,E.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:c||t===``||f!==null||r.trim()===``,children:[c&&(0,E.jsx)(p,{}),`Create project`]})]})]})})]})}export{D as component};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/tokens._token-CkU4dCwo.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-CXkp3Efg.js","_coffre/assets/use-action-CUvWPRTx.js","_coffre/assets/principal-page-DjH1cUyz.js","_coffre/assets/directory-PEjdb8PS.js","_coffre/assets/grants-4mSkXPU4.js","_coffre/assets/offboarding-DQ-56W0H.js"])))=>i.map(i=>d[i]);
2
- import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r,r as i}from"./coffre-CXkp3Efg.js";import{n as a}from"./principal-page-DjH1cUyz.js";var o=e(`/tokens/$token`)({loader:async({context:{client:e},params:t,parentMatchPromise:n})=>{let o=(await n).loaderData,[s,c]=await Promise.all([a(e,`service`,t.token,o),o?.capabilities.canManageGrants&&o.auth.signin!==null?r(()=>e.tokens.list(i(`service`,t.token))):Promise.resolve(null)]);return{page:s,credentials:c}},component:n(()=>t(()=>import(`./tokens._token-CkU4dCwo.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`)});export{o as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/tokens.index-DtiWrKVq.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/directory-PEjdb8PS.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-CXkp3Efg.js","_coffre/assets/use-action-CUvWPRTx.js","_coffre/assets/offboarding-DQ-56W0H.js"])))=>i.map(i=>d[i]);
2
- import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r}from"./directory-PEjdb8PS.js";var i=e(`/tokens/`)({loader:async({context:{client:e},parentMatchPromise:t})=>r(e,(await t).loaderData?.capabilities.canManageGrants??!1),component:n(()=>t(()=>import(`./tokens.index-DtiWrKVq.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{i as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/users._user-CImGVpYj.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/principal-page-DjH1cUyz.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-CXkp3Efg.js","_coffre/assets/use-action-CUvWPRTx.js","_coffre/assets/directory-PEjdb8PS.js","_coffre/assets/grants-4mSkXPU4.js","_coffre/assets/offboarding-DQ-56W0H.js"])))=>i.map(i=>d[i]);
2
- import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{n as r}from"./principal-page-DjH1cUyz.js";var i=e(`/users/$user`)({loader:async({context:{client:e},params:t,parentMatchPromise:n})=>r(e,`user`,t.user,(await n).loaderData),component:n(()=>t(()=>import(`./users._user-CImGVpYj.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8])),`component`)});export{i as t};
@@ -1,2 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/users.index-B-7o0KBD.js","_coffre/assets/page-DbSS7pYH.js","_coffre/assets/directory-PEjdb8PS.js","_coffre/assets/preload-helper-DduCCcmc.js","_coffre/assets/coffre-CXkp3Efg.js","_coffre/assets/use-action-CUvWPRTx.js","_coffre/assets/offboarding-DQ-56W0H.js"])))=>i.map(i=>d[i]);
2
- import{T as e,t,w as n}from"./preload-helper-DduCCcmc.js";import{o as r}from"./directory-PEjdb8PS.js";var i=e(`/users/`)({loader:async({context:{client:e},parentMatchPromise:t})=>r(e,(await t).loaderData?.capabilities.canManageGrants??!1),component:n(()=>t(()=>import(`./users.index-B-7o0KBD.js`),__vite__mapDeps([0,1,2,3,4,5,6])),`component`)});export{i as t};