@coffre/ui 0.14.7 → 0.16.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 (112) hide show
  1. package/dist/audit-sentences.d.ts +56 -0
  2. package/dist/audit-sentences.js +886 -0
  3. package/dist/audit-sentences.js.map +1 -0
  4. package/dist/chunks/audit-sentence-C8NnAdjF.js +48 -0
  5. package/dist/chunks/audit-sentence-C8NnAdjF.js.map +1 -0
  6. package/dist/chunks/{connected-apps-IJdunsu8.js → connected-apps-6sMSgQ9U.js} +5 -5
  7. package/dist/chunks/{connected-apps-IJdunsu8.js.map → connected-apps-6sMSgQ9U.js.map} +1 -1
  8. package/dist/chunks/{delete-place-dIVoK87I.js → delete-place-T469tSN9.js} +5 -5
  9. package/dist/chunks/{delete-place-dIVoK87I.js.map → delete-place-T469tSN9.js.map} +1 -1
  10. package/dist/chunks/{directory-BM8yoiJN.js → directory-B_gVf7UL.js} +13 -12
  11. package/dist/chunks/{directory-BM8yoiJN.js.map → directory-B_gVf7UL.js.map} +1 -1
  12. package/dist/chunks/{folders-D3A1NGpt.js → folders-CVYauIDz.js} +3 -3
  13. package/dist/chunks/{folders-D3A1NGpt.js.map → folders-CVYauIDz.js.map} +1 -1
  14. package/dist/chunks/{grants-CjVmOgb2.js → grants-Dn_EW2XW.js} +6 -6
  15. package/dist/chunks/{grants-CjVmOgb2.js.map → grants-Dn_EW2XW.js.map} +1 -1
  16. package/dist/chunks/{multi-combobox-B0JzP1QN.js → multi-combobox-fbBRzi9z.js} +3 -3
  17. package/dist/chunks/{multi-combobox-B0JzP1QN.js.map → multi-combobox-fbBRzi9z.js.map} +1 -1
  18. package/dist/chunks/{offboarding-DbozhPym.js → offboarding-CXM464J_.js} +19 -13
  19. package/dist/chunks/offboarding-CXM464J_.js.map +1 -0
  20. package/dist/chunks/{page-JTORvh-N.js → page-Cb0ZjGda.js} +2 -2
  21. package/dist/chunks/{page-JTORvh-N.js.map → page-Cb0ZjGda.js.map} +1 -1
  22. package/dist/chunks/{personal-tokens-zWZOzLIC.js → personal-tokens-CSHMlRHy.js} +7 -7
  23. package/dist/chunks/personal-tokens-CSHMlRHy.js.map +1 -0
  24. package/dist/chunks/{principal-DFBswTBr.js → principal-BKJxbAtE.js} +2 -2
  25. package/dist/chunks/{principal-DFBswTBr.js.map → principal-BKJxbAtE.js.map} +1 -1
  26. package/dist/chunks/{principal-page-jJ0RVFg8.js → principal-page-COPmTDVW.js} +20 -17
  27. package/dist/chunks/principal-page-COPmTDVW.js.map +1 -0
  28. package/dist/chunks/{project-page-BjwEoXfU.js → project-page-g5_n46Nz.js} +3 -3
  29. package/dist/chunks/{project-page-BjwEoXfU.js.map → project-page-g5_n46Nz.js.map} +1 -1
  30. package/dist/chunks/{protected-y7KVhtHd.js → protected-DEWeOrmI.js} +7 -7
  31. package/dist/chunks/{protected-y7KVhtHd.js.map → protected-DEWeOrmI.js.map} +1 -1
  32. package/dist/chunks/{queries-2jdgTwfZ.js → queries-D4_o-bz3.js} +11 -88
  33. package/dist/chunks/queries-D4_o-bz3.js.map +1 -0
  34. package/dist/chunks/{references-CRT2BsOS.js → references-wTh_DT0M.js} +27 -23
  35. package/dist/chunks/references-wTh_DT0M.js.map +1 -0
  36. package/dist/chunks/{role-field-DswIpPqY.js → role-field-BiP09qfN.js} +4 -4
  37. package/dist/chunks/{role-field-DswIpPqY.js.map → role-field-BiP09qfN.js.map} +1 -1
  38. package/dist/chunks/{row-state-xtRGFnDc.js → row-state-CYhtmUkc.js} +3 -3
  39. package/dist/chunks/{row-state-xtRGFnDc.js.map → row-state-CYhtmUkc.js.map} +1 -1
  40. package/dist/chunks/{signin-errors-TlQmQe0t.js → signin-errors-BMnox7XD.js} +5 -19
  41. package/dist/chunks/signin-errors-BMnox7XD.js.map +1 -0
  42. package/dist/chunks/{theme-Ck45wzWB.js → theme-imSolE1q.js} +3 -3
  43. package/dist/chunks/{theme-Ck45wzWB.js.map → theme-imSolE1q.js.map} +1 -1
  44. package/dist/chunks/{ui-D-blFWfx.js → ui-Q_Eczt7m.js} +7 -3
  45. package/dist/chunks/{ui-D-blFWfx.js.map → ui-Q_Eczt7m.js.map} +1 -1
  46. package/dist/chunks/{use-action-CXEFFjx5.js → use-action-BfnN-De2.js} +3 -3
  47. package/dist/chunks/{use-action-CXEFFjx5.js.map → use-action-BfnN-De2.js.map} +1 -1
  48. package/dist/chunks/{use-change-BC4xo02c.js → use-change-Cc0X4sF3.js} +6 -4
  49. package/dist/chunks/use-change-Cc0X4sF3.js.map +1 -0
  50. package/dist/chunks/{use-roles-DswiNxBk.js → use-roles-stcv2QFj.js} +3 -3
  51. package/dist/chunks/{use-roles-DswiNxBk.js.map → use-roles-stcv2QFj.js.map} +1 -1
  52. package/dist/chunks/{use-shell-zpjE_MKh.js → use-shell-DMhLa2sh.js} +3 -3
  53. package/dist/chunks/{use-shell-zpjE_MKh.js.map → use-shell-DMhLa2sh.js.map} +1 -1
  54. package/dist/index.d.ts +22 -10
  55. package/dist/index.js +7 -7
  56. package/dist/pages/account.js +11 -11
  57. package/dist/pages/approval.js +2 -2
  58. package/dist/pages/audit.js +163 -152
  59. package/dist/pages/audit.js.map +1 -1
  60. package/dist/pages/device-login.js +2 -2
  61. package/dist/pages/environment.js +67 -35
  62. package/dist/pages/environment.js.map +1 -1
  63. package/dist/pages/login.js +6 -15
  64. package/dist/pages/login.js.map +1 -1
  65. package/dist/pages/oauth-authorize.js +2 -2
  66. package/dist/pages/project-access.js +11 -11
  67. package/dist/pages/project-environments.js +12 -12
  68. package/dist/pages/project-settings.js +8 -8
  69. package/dist/pages/project.js +3 -3
  70. package/dist/pages/projects.js +8 -8
  71. package/dist/pages/service-account.js +19 -15
  72. package/dist/pages/service-account.js.map +1 -1
  73. package/dist/pages/service-accounts.js +5 -5
  74. package/dist/pages/settings.js +26 -37
  75. package/dist/pages/settings.js.map +1 -1
  76. package/dist/pages/unregistered.js +2 -2
  77. package/dist/pages/user.js +7 -7
  78. package/dist/pages/user.js.map +1 -1
  79. package/dist/pages/users.js +5 -5
  80. package/package.json +8 -3
  81. package/src/components/directory.tsx +5 -4
  82. package/src/components/offboarding.tsx +9 -9
  83. package/src/components/personal-tokens.tsx +5 -2
  84. package/src/components/principal-page.tsx +4 -3
  85. package/src/components/references.tsx +18 -7
  86. package/src/components/trusted-workloads.tsx +6 -5
  87. package/src/components/ui.tsx +5 -0
  88. package/src/lib/audit-proofs.ts +51 -0
  89. package/src/lib/audit-sentences.ts +473 -509
  90. package/src/lib/bindings.ts +6 -0
  91. package/src/lib/changes.ts +3 -1
  92. package/src/lib/coffre.ts +2 -2
  93. package/src/lib/queries.ts +9 -94
  94. package/src/lib/reveal.ts +32 -5
  95. package/src/lib/row-reads.ts +2 -2
  96. package/src/lib/signin-errors.ts +5 -33
  97. package/src/pages/audit.tsx +145 -182
  98. package/src/pages/environment.tsx +21 -20
  99. package/src/pages/login.tsx +2 -4
  100. package/src/pages/settings.tsx +6 -10
  101. package/src/pages/user.tsx +2 -2
  102. package/src/parity.ts +0 -2
  103. package/src/styles/globals.css +18 -2
  104. package/dist/chunks/audit-sentence-JgJEwQEC.js +0 -969
  105. package/dist/chunks/audit-sentence-JgJEwQEC.js.map +0 -1
  106. package/dist/chunks/offboarding-DbozhPym.js.map +0 -1
  107. package/dist/chunks/personal-tokens-zWZOzLIC.js.map +0 -1
  108. package/dist/chunks/principal-page-jJ0RVFg8.js.map +0 -1
  109. package/dist/chunks/queries-2jdgTwfZ.js.map +0 -1
  110. package/dist/chunks/references-CRT2BsOS.js.map +0 -1
  111. package/dist/chunks/signin-errors-TlQmQe0t.js.map +0 -1
  112. package/dist/chunks/use-change-BC4xo02c.js.map +0 -1
@@ -1,17 +1,17 @@
1
- import { A as isActiveAccessibleEnvironment, O as canRevealSecrets, o as keys, t as affects, x as queries } from "../chunks/queries-2jdgTwfZ.js";
2
- import { a as ErrorLine, c as Notice, d as Tip, g as createCopier, h as breakAfterUnderscores, i as EmptyState, l as Spinner, n as ConfirmDialog, o as MenuPopup, r as CopyButton, s as Modal, t as ConfirmButton, u as Timestamp } from "../chunks/ui-D-blFWfx.js";
1
+ import { D as isActiveAccessibleEnvironment, T as canRevealSecrets, i as keys, t as affects, y as queries } from "../chunks/queries-D4_o-bz3.js";
2
+ import { _ as createCopier, a as ErrorLine, c as Notice, d as Tip, h as breakAfterUnderscores, i as EmptyState, l as Spinner, n as ConfirmDialog, o as MenuPopup, r as CopyButton, s as Modal, t as ConfirmButton, u as Timestamp } from "../chunks/ui-Q_Eczt7m.js";
3
3
  import { i as SecretReadOnly } from "../chunks/affordances-Dtyha68j.js";
4
- import { $ as SlashCircle, A as History, D as Generate, E as Folder, G as Plus, H as MoreHorizontal, J as Search, L as Lock, M as Key, S as Clock, T as EyeOff, W as Pencil, Z as Shuffle, _ as Check, g as ArrowRight, h as Archive, i as PageHeader, k as Hash, n as ClosedDoor, nt as Trash, o as failureMessage, p as AlertCircle, q as RotateBack, rt as Upload, st as X, t as Card, tt as Terminal, u as useCoffre, w as Eye, x as ChevronsUpDown, y as ChevronDown } from "../chunks/page-JTORvh-N.js";
5
- import { a as rowClass, i as RowPending, r as RowFailure, t as ItemFailure } from "../chunks/row-state-xtRGFnDc.js";
6
- import { t as useShell } from "../chunks/use-shell-zpjE_MKh.js";
7
- import { A as restoreSecret, B as valueEdit, G as stricter, H as SENSITIVITIES, I as companionsOf, J as regenerateWaits, K as waitsForValue, L as hasSecretEditConflict, P as saveSecrets, R as madeSensitive, S as moveSecret, T as regenerateSecret, U as levelsIn, V as LEVELS, W as markable, Y as regeneratedKeys, _ as forkKey, a as UnsavedEdits, g as environmentId, i as changeOptions, k as restoreMissing, m as dismissMissing, n as useChangeStatus, q as liveGeneration, r as changeKey, s as archiveSecret, t as useChange, x as missingList, z as secretChangeFor } from "../chunks/use-change-BC4xo02c.js";
4
+ import { $ as SlashCircle, A as History, D as Generate, E as Folder, G as Plus, H as MoreHorizontal, J as Search, L as Lock, M as Key, S as Clock, T as EyeOff, W as Pencil, Z as Shuffle, _ as Check, g as ArrowRight, h as Archive, i as PageHeader, k as Hash, n as ClosedDoor, nt as Trash, o as failureMessage, p as AlertCircle, q as RotateBack, rt as Upload, st as X, t as Card, tt as Terminal, u as useCoffre, w as Eye, x as ChevronsUpDown, y as ChevronDown } from "../chunks/page-Cb0ZjGda.js";
5
+ import { a as rowClass, i as RowPending, r as RowFailure, t as ItemFailure } from "../chunks/row-state-CYhtmUkc.js";
6
+ import { t as useShell } from "../chunks/use-shell-DMhLa2sh.js";
7
+ import { A as restoreSecret, B as valueEdit, G as stricter, H as SENSITIVITIES, I as companionsOf, J as regenerateWaits, K as waitsForValue, L as hasSecretEditConflict, P as saveSecrets, R as madeSensitive, S as moveSecret, T as regenerateSecret, U as levelsIn, V as LEVELS, W as markable, Y as regeneratedKeys, _ as forkKey, a as UnsavedEdits, g as environmentId, i as changeOptions, k as restoreMissing, m as dismissMissing, n as useChangeStatus, q as liveGeneration, r as changeKey, s as archiveSecret, t as useChange, x as missingList, z as secretChangeFor } from "../chunks/use-change-Cc0X4sF3.js";
8
8
  import { i as secretKeyProblem, n as folderProblem } from "../chunks/validation-DiHIwZRA.js";
9
9
  import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
10
- import { t as useAction } from "../chunks/use-action-CXEFFjx5.js";
11
- import { t as Protection } from "../chunks/protected-y7KVhtHd.js";
12
- import { n as FolderRow, r as MoveToFolder, t as FolderMenu } from "../chunks/folders-D3A1NGpt.js";
13
- import { t as MultiCombobox } from "../chunks/multi-combobox-B0JzP1QN.js";
14
- import { i as ReferenceValue, n as LentReferences, o as archiveBlockers, r as MakeReference, t as ArchiveBlocked } from "../chunks/references-CRT2BsOS.js";
10
+ import { t as useAction } from "../chunks/use-action-BfnN-De2.js";
11
+ import { t as Protection } from "../chunks/protected-DEWeOrmI.js";
12
+ import { n as FolderRow, r as MoveToFolder, t as FolderMenu } from "../chunks/folders-CVYauIDz.js";
13
+ import { t as MultiCombobox } from "../chunks/multi-combobox-fbBRzi9z.js";
14
+ import { i as ReferenceValue, n as LentReferences, o as archiveBlockers, r as MakeReference, t as ArchiveBlocked } from "../chunks/references-wTh_DT0M.js";
15
15
  import { useEffect, useId, useReducer, useRef, useState } from "react";
16
16
  import { Link, useNavigate } from "@tanstack/react-router";
17
17
  import { toast } from "sonner";
@@ -23,7 +23,29 @@ import { DEFAULT_RECIPE, ENCODINGS, MAX_BYTES, MIN_BYTES, PAIRS, describeRecipe,
23
23
  import { parseDotenv } from "@coffre/core/dotenv";
24
24
  //#region src/lib/reveal.ts
25
25
  function revealIsCurrent(reveal, currentVersion, currentFrom) {
26
- return reveal !== null && reveal.version === currentVersion && reveal.from === currentFrom;
26
+ return reveal !== null && reveal.from !== null && reveal.version === currentVersion && reveal.from === currentFrom;
27
+ }
28
+ /**
29
+ * A value read for the row `row` was when asked, stamped with the version it
30
+ * opened. A read that opened another number than the row's has outrun the
31
+ * listing, or the listing it: `refetch` brings the listing up to date first,
32
+ * so that once the value shows, the row says its number too. If the listing
33
+ * has moved past it by then, the value hides, as it is no longer the value.
34
+ *
35
+ * It is stamped with the secret the read says it opened, never the row's:
36
+ * a read across a reset, an override or a repointed reference opened
37
+ * another secret, maybe at the very number the row shows by then, and
38
+ * hides rather than show that secret's value as this one's.
39
+ */
40
+ async function stampedRead(row, read, refetch) {
41
+ const { value, version, from } = await read();
42
+ if (version !== row.version || from !== row.from) await refetch();
43
+ return {
44
+ value,
45
+ version,
46
+ from,
47
+ at: Date.now()
48
+ };
27
49
  }
28
50
  //#endregion
29
51
  //#region src/lib/row-reads.ts
@@ -80,8 +102,8 @@ function revealToggleDisabled(state, shown) {
80
102
  * whose reason the row says. It always opens: writing a value takes no read
81
103
  * of the one it replaces.
82
104
  */
83
- async function valueToEdit(row, read) {
84
- if (row.value !== null) return row.value;
105
+ async function valueToEdit(row, read, listed) {
106
+ if (row.value !== null) return listed(row.value);
85
107
  return row.readable ? read() : null;
86
108
  }
87
109
  //#endregion
@@ -1773,6 +1795,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
1773
1795
  reveal: next
1774
1796
  });
1775
1797
  const coffre = useCoffre();
1798
+ const queryClient = useQueryClient();
1776
1799
  const [historyOpen, setHistoryOpen] = useState(false);
1777
1800
  const [moving, setMoving] = useState(false);
1778
1801
  const [referring, setReferring] = useState(false);
@@ -1792,7 +1815,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
1792
1815
  const sensitive = entry.sensitivity === "sensitive";
1793
1816
  const canRead = entry.readable;
1794
1817
  const readVersion = reference === null ? entry.version : reference.version;
1795
- const readFrom = `${inherited ? parent.from : "."}:${reference?.source ?? ""}`;
1818
+ const readFrom = entry.secret;
1796
1819
  const holderPath = `${project}/${environment}/${entry.key}`;
1797
1820
  const rowPlain = entry.value !== null;
1798
1821
  const rowLevel = entry.sensitivity;
@@ -1822,20 +1845,21 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
1822
1845
  if (!editing) setBase(null);
1823
1846
  }, [editing]);
1824
1847
  async function readValue({ show = true } = {}) {
1825
- if (shown !== null) return shown.value;
1848
+ if (shown !== null) return shown;
1826
1849
  dispatch({ type: "read-started" });
1827
1850
  try {
1828
- const value = await fetchValue();
1851
+ const read = await stampedRead({
1852
+ version: readVersion,
1853
+ from: readFrom
1854
+ }, fetchValue, () => queryClient.refetchQueries({ queryKey: keys.secrets({
1855
+ project,
1856
+ environment
1857
+ }) }));
1829
1858
  dispatch({
1830
1859
  type: "read-succeeded",
1831
- reveal: show ? {
1832
- value,
1833
- version: readVersion,
1834
- from: readFrom,
1835
- at: Date.now()
1836
- } : null
1860
+ reveal: show ? read : null
1837
1861
  });
1838
- return value;
1862
+ return read;
1839
1863
  } catch (failure) {
1840
1864
  dispatch({
1841
1865
  type: "read-failed",
@@ -1845,9 +1869,17 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
1845
1869
  }
1846
1870
  }
1847
1871
  async function fetchValue() {
1848
- if (entry.value !== null) return entry.value;
1849
- const { values } = await coffre.secrets.reveal(`${project}/${environment}/${entry.key}`);
1850
- return values[entry.key];
1872
+ if (entry.value !== null) return {
1873
+ value: entry.value,
1874
+ version: readVersion,
1875
+ from: readFrom
1876
+ };
1877
+ const { values, versions, secrets } = await coffre.secrets.reveal(`${project}/${environment}/${entry.key}`);
1878
+ return {
1879
+ value: values[entry.key],
1880
+ version: versions[entry.key],
1881
+ from: secrets[entry.key]
1882
+ };
1851
1883
  }
1852
1884
  function toggleReveal() {
1853
1885
  if (shown !== null) setReveal(null);
@@ -1857,7 +1889,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
1857
1889
  function copyValue() {
1858
1890
  dispatch({ type: "copy-started" });
1859
1891
  const read = { failed: false };
1860
- const text = shown !== null ? shown.value : fetchValue().catch((failure) => {
1892
+ const text = shown !== null ? shown.value : fetchValue().then(({ value }) => value, (failure) => {
1861
1893
  read.failed = true;
1862
1894
  read.failure = failure;
1863
1895
  throw failure;
@@ -1875,14 +1907,14 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
1875
1907
  async function startEdit({ name = false } = {}) {
1876
1908
  setFocusName(name);
1877
1909
  setOpening(entry.value === null && canRead);
1878
- const value = await valueToEdit(entry, () => readValue({ show: false }));
1879
- setOpening(false);
1880
- if (value !== null) setBase({
1881
- value,
1910
+ const value = await valueToEdit(entry, () => readValue({ show: false }), (listed) => ({
1911
+ value: listed,
1882
1912
  version: readVersion,
1883
1913
  from: readFrom,
1884
1914
  at: Date.now()
1885
- });
1915
+ }));
1916
+ setOpening(false);
1917
+ if (value !== null) setBase(value);
1886
1918
  setReveal(null);
1887
1919
  onEdit();
1888
1920
  }
@@ -2619,7 +2651,7 @@ function SortHeader({ className, by, sort, onSort, children }) {
2619
2651
  */
2620
2652
  function Written({ entry, rotateAfterDays }) {
2621
2653
  const { reference } = entry;
2622
- const made = reference === null ? void 0 : `Reference made by ${shownMember(reference.createdBy).replace(/^user:/, "")} on ${reference.createdAt.slice(0, 10)}`;
2654
+ const made = reference?.createdBy == null || reference.createdAt === null ? void 0 : `Reference made by ${shownMember(reference.createdBy).replace(/^user:/, "")} on ${reference.createdAt.slice(0, 10)}`;
2623
2655
  if (entry.updatedAt === null) return /* @__PURE__ */ jsx("span", {
2624
2656
  className: "cell-muted",
2625
2657
  title: made,
@@ -2637,7 +2669,7 @@ function Written({ entry, rotateAfterDays }) {
2637
2669
  children: by.split("@")[0]
2638
2670
  }) : /* @__PURE__ */ jsx("span", {
2639
2671
  className: "written-by cell-muted",
2640
- title: `Its source's current version. ${made}`,
2672
+ title: made === void 0 ? "Its source's current version" : `Its source's current version. ${made}`,
2641
2673
  children: "source"
2642
2674
  }),
2643
2675
  /* @__PURE__ */ jsx("span", {