@coffre/ui 0.1.17 → 0.2.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.
- package/README.md +23 -3
- package/dist/{server/_coffre/assets/affordances-CKANXDTG.js → chunks/affordances-DAvsVz7u.js} +12 -7
- package/dist/chunks/affordances-DAvsVz7u.js.map +1 -0
- package/dist/chunks/directory-CSjWWUQ1.js +370 -0
- package/dist/chunks/directory-CSjWWUQ1.js.map +1 -0
- package/dist/{server/_coffre/assets/grants-DdKT11Ny.js → chunks/grants-saMQagmG.js} +41 -39
- package/dist/chunks/grants-saMQagmG.js.map +1 -0
- package/dist/chunks/icons-D-PfAfnH.js +203 -0
- package/dist/chunks/icons-D-PfAfnH.js.map +1 -0
- package/dist/chunks/mounted-jJmqqV_n.js +17 -0
- package/dist/chunks/mounted-jJmqqV_n.js.map +1 -0
- package/dist/{server/_coffre/assets/offboarding-CRz-K82H.js → chunks/offboarding-C6l30DZR.js} +70 -69
- package/dist/chunks/offboarding-C6l30DZR.js.map +1 -0
- package/dist/chunks/page-C5HcNqf2.js +190 -0
- package/dist/chunks/page-C5HcNqf2.js.map +1 -0
- package/dist/chunks/page-route-Drfw7lmn.js +20 -0
- package/dist/chunks/page-route-Drfw7lmn.js.map +1 -0
- package/dist/{server/_coffre/assets/principal-page-C-EFwJQw.js → chunks/principal-page-D_91OA0l.js} +105 -103
- package/dist/chunks/principal-page-D_91OA0l.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/project-environments-lEzFHUt4.js +2 -0
- package/dist/chunks/project-environments-lEzFHUt4.js.map +1 -0
- package/dist/chunks/queries-CQ81o4so.js +376 -0
- package/dist/chunks/queries-CQ81o4so.js.map +1 -0
- package/dist/{server/_coffre/assets/row-state-C2P57xT1.js → chunks/row-state-0PsrEzOL.js} +22 -21
- package/dist/chunks/row-state-0PsrEzOL.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/signin-errors-BEFlVDbQ.js +2 -0
- package/dist/chunks/signin-errors-BEFlVDbQ.js.map +1 -0
- package/dist/chunks/theme-B2vQolVR.js +86 -0
- package/dist/chunks/theme-B2vQolVR.js.map +1 -0
- package/dist/chunks/ui-DixXLQvQ.js +405 -0
- package/dist/chunks/ui-DixXLQvQ.js.map +1 -0
- package/dist/{server/_coffre/assets/use-action-B-xpvVRO.js → chunks/use-action-CWsg_YWU.js} +8 -6
- package/dist/chunks/use-action-CWsg_YWU.js.map +1 -0
- package/dist/{server/_coffre/assets/use-change-C8BCf3oU.js → chunks/use-change-c6CeLRin.js} +10 -474
- package/dist/chunks/use-change-c6CeLRin.js.map +1 -0
- package/dist/chunks/use-shell-jxd7Tzd-.js +26 -0
- package/dist/chunks/use-shell-jxd7Tzd-.js.map +1 -0
- package/dist/{server/_coffre/assets → chunks}/validation-BQtqPe2V.js +2 -0
- package/dist/chunks/validation-BQtqPe2V.js.map +1 -0
- package/dist/index.d.ts +386 -18
- package/dist/index.js +1147 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/account.d.ts +9 -0
- package/dist/pages/account.js +334 -0
- package/dist/pages/account.js.map +1 -0
- package/dist/pages/audit.d.ts +3 -0
- package/dist/{server/_coffre/assets/audit-qB9G2AQJ.js → pages/audit.js} +102 -100
- package/dist/pages/audit.js.map +1 -0
- package/dist/pages/device-login.d.ts +9 -0
- package/dist/pages/device-login.js +211 -0
- package/dist/pages/device-login.js.map +1 -0
- package/dist/pages/environment.d.ts +3 -0
- package/dist/{server/_coffre/assets/projects._project._environment-C6uybzeU.js → pages/environment.js} +323 -469
- package/dist/pages/environment.js.map +1 -0
- package/dist/pages/login.d.ts +10 -0
- package/dist/pages/login.js +104 -0
- package/dist/pages/login.js.map +1 -0
- package/dist/pages/project.d.ts +2 -0
- package/dist/{server/_coffre/assets/projects._project.index-3CXwkyTh.js → pages/project.js} +223 -225
- package/dist/pages/project.js.map +1 -0
- package/dist/pages/projects.d.ts +3 -0
- package/dist/{server/_coffre/assets/projects.index-iSoBpRFz.js → pages/projects.js} +83 -81
- package/dist/pages/projects.js.map +1 -0
- package/dist/pages/settings.d.ts +3 -0
- package/dist/{server/_coffre/assets/settings-BDQTF5XW.js → pages/settings.js} +20 -18
- package/dist/pages/settings.js.map +1 -0
- package/dist/pages/token.d.ts +3 -0
- package/dist/{server/_coffre/assets/tokens._token-CrBMpcbN.js → pages/token.js} +195 -265
- package/dist/pages/token.js.map +1 -0
- package/dist/pages/tokens.d.ts +3 -0
- package/dist/pages/tokens.js +39 -0
- package/dist/pages/tokens.js.map +1 -0
- package/dist/pages/unregistered.d.ts +8 -0
- package/dist/pages/unregistered.js +54 -0
- package/dist/pages/unregistered.js.map +1 -0
- package/dist/pages/user.d.ts +3 -0
- package/dist/pages/user.js +16 -0
- package/dist/pages/user.js.map +1 -0
- package/dist/pages/users.d.ts +3 -0
- package/dist/pages/users.js +39 -0
- package/dist/pages/users.js.map +1 -0
- package/dist/project-BqIy8gYR.d.ts +5 -0
- package/dist/vite.d.ts +16 -0
- package/dist/vite.js +52 -0
- package/package.json +36 -21
- package/src/assets/icon.svg +1 -0
- package/src/components/affordances.ts +10 -4
- package/src/components/command-palette.tsx +229 -203
- package/src/components/directory.tsx +34 -38
- package/src/components/principal.tsx +7 -3
- package/src/components/shell.tsx +89 -127
- package/src/components/theme.tsx +14 -81
- package/src/components/ui.tsx +97 -68
- package/src/index.ts +29 -0
- package/src/layout.tsx +113 -0
- package/src/lib/coffre.ts +8 -4
- package/src/lib/mounted.ts +13 -0
- package/src/lib/page-context.ts +31 -0
- package/src/lib/page-route.ts +22 -0
- package/src/lib/preferences.tsx +46 -0
- package/src/options.ts +240 -0
- package/src/{routes → pages}/account.tsx +7 -24
- package/src/{routes → pages}/audit.tsx +5 -16
- package/src/{routes/auth.device.tsx → pages/device-login.tsx} +8 -21
- package/src/{routes/projects.$project.$environment.tsx → pages/environment.tsx} +43 -52
- package/src/{routes → pages}/login.tsx +5 -16
- package/src/{routes/projects.$project.index.tsx → pages/project.tsx} +38 -50
- package/src/{routes/projects.index.tsx → pages/projects.tsx} +2 -7
- package/src/{routes → pages}/settings.tsx +3 -10
- package/src/{routes/tokens.$token.tsx → pages/token.tsx} +6 -7
- package/src/{routes/tokens.index.tsx → pages/tokens.tsx} +3 -8
- package/src/{routes → pages}/unregistered.tsx +1 -6
- package/src/pages/user.tsx +10 -0
- package/src/{routes/users.index.tsx → pages/users.tsx} +3 -8
- package/src/register.ts +55 -0
- package/src/router.tsx +31 -62
- package/src/styles/globals.css +104 -46
- package/src/vite.ts +78 -0
- package/dist/client/.assetsignore +0 -2
- package/dist/client/_coffre/assets/account-BoLGAxbD.js +0 -2
- package/dist/client/_coffre/assets/account-CnnuRTDB.js +0 -1
- package/dist/client/_coffre/assets/affordances-CEafRJcN.js +0 -1
- package/dist/client/_coffre/assets/audit-CHSvKLWX.js +0 -1
- package/dist/client/_coffre/assets/audit-Cn4hmS4u.js +0 -2
- package/dist/client/_coffre/assets/auth.device-Co5vrpaA.js +0 -2
- package/dist/client/_coffre/assets/auth.device-DAlqWacc.js +0 -1
- package/dist/client/_coffre/assets/directory-H8Eh3MnS.js +0 -1
- package/dist/client/_coffre/assets/dist-Braunv_x.js +0 -1
- package/dist/client/_coffre/assets/globals-CpMrgkV6.css +0 -1
- package/dist/client/_coffre/assets/grants-DPDxJXU1.js +0 -1
- package/dist/client/_coffre/assets/icons-Dc_-t0lp.js +0 -1
- package/dist/client/_coffre/assets/index-sUCIXRgJ.js +0 -12
- package/dist/client/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/client/_coffre/assets/link-DBINMwm6.js +0 -1
- package/dist/client/_coffre/assets/login-BZFYfL1Y.js +0 -1
- package/dist/client/_coffre/assets/login-CYCKWTOD.js +0 -2
- package/dist/client/_coffre/assets/offboarding-Bwpftp3g.js +0 -1
- package/dist/client/_coffre/assets/page-C_hnzdaR.js +0 -1
- package/dist/client/_coffre/assets/preload-helper-CLkO85Nq.js +0 -1
- package/dist/client/_coffre/assets/principal-page-DLho8TSJ.js +0 -1
- package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-DHRRvQw0.js +0 -3
- package/dist/client/_coffre/assets/projects._project._environment-TLI-RjBZ.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-BO-8FZIY.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-DGl921dP.js +0 -1
- package/dist/client/_coffre/assets/projects.index-BDn7Bhoo.js +0 -1
- package/dist/client/_coffre/assets/row-state-DJ-KLamZ.js +0 -1
- package/dist/client/_coffre/assets/settings-q9G1QvR_.js +0 -1
- package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +0 -1
- package/dist/client/_coffre/assets/suspense-O8sP0mEC.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-B_qczpT9.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-T-sqwMbz.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-CcXSZnAG.js +0 -1
- package/dist/client/_coffre/assets/ui-BXP2IqrW.js +0 -46
- package/dist/client/_coffre/assets/unregistered-D2JXJ90x.js +0 -1
- package/dist/client/_coffre/assets/use-action-BpzKWhgg.js +0 -1
- package/dist/client/_coffre/assets/use-change-CKj3Inq9.js +0 -1
- package/dist/client/_coffre/assets/use-shell-W0SusPkz.js +0 -1
- package/dist/client/_coffre/assets/useQuery-B-lxFSES.js +0 -1
- package/dist/client/_coffre/assets/useSuspenseQuery-BZ-nzHST.js +0 -1
- package/dist/client/_coffre/assets/users._user-Bb3BGYHl.js +0 -1
- package/dist/client/_coffre/assets/users._user-DXmvKrzE.js +0 -2
- package/dist/client/_coffre/assets/users.index-BvzP3qwW.js +0 -1
- package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +0 -1
- package/dist/server/.vite/manifest.json +0 -668
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-GsKnGGRy.js +0 -162
- package/dist/server/_coffre/assets/account-CV-a2IU2.js +0 -329
- package/dist/server/_coffre/assets/account-hk6wcIXU.js +0 -162
- package/dist/server/_coffre/assets/async-local-storage-C10uQtMM.js +0 -3108
- package/dist/server/_coffre/assets/audit-C1_Ej6YB.js +0 -31
- package/dist/server/_coffre/assets/auth.device-6JRrWbSV.js +0 -210
- package/dist/server/_coffre/assets/auth.device-CLoAxC2T.js +0 -29
- package/dist/server/_coffre/assets/directory-B-_rqsPx.js +0 -371
- package/dist/server/_coffre/assets/dist-CnnV3t2g.js +0 -908
- package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +0 -5
- package/dist/server/_coffre/assets/globals-CpMrgkV6.css +0 -1
- package/dist/server/_coffre/assets/icons-DOFT-eWB.js +0 -1704
- package/dist/server/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +0 -480
- package/dist/server/_coffre/assets/link-42ZWdjzZ.js +0 -422
- package/dist/server/_coffre/assets/login-DRKUKkaW.js +0 -22
- package/dist/server/_coffre/assets/login-DnwxVl4Y.js +0 -102
- package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +0 -56
- package/dist/server/_coffre/assets/page-D6n45dcK.js +0 -3561
- package/dist/server/_coffre/assets/projects._project._environment-CS8DdSMY.js +0 -48
- package/dist/server/_coffre/assets/projects._project.index-BGfcNpj0.js +0 -23
- package/dist/server/_coffre/assets/react-dom-bBoJXlK2.js +0 -1718
- package/dist/server/_coffre/assets/router-9BTgJhWG.js +0 -2322
- package/dist/server/_coffre/assets/start-DR3rN0St.js +0 -4
- package/dist/server/_coffre/assets/suspense-C-2QfDd2.js +0 -602
- package/dist/server/_coffre/assets/tokens._token-rY86Cjgp.js +0 -10
- package/dist/server/_coffre/assets/tokens.index-Bq5qDW9q.js +0 -37
- package/dist/server/_coffre/assets/ui-Cc0CGMtr.js +0 -14881
- package/dist/server/_coffre/assets/unregistered-D9ZKLOPJ.js +0 -53
- package/dist/server/_coffre/assets/use-shell-DwOzEi87.js +0 -462
- package/dist/server/_coffre/assets/useQuery-CTe86qFq.js +0 -8
- package/dist/server/_coffre/assets/useRouter-CaUSUNsw.js +0 -473
- package/dist/server/_coffre/assets/useSuspenseQuery-CSoHzrMb.js +0 -117
- package/dist/server/_coffre/assets/users._user-BmLKYeo_.js +0 -10
- package/dist/server/_coffre/assets/users._user-BmiHwQx3.js +0 -14
- package/dist/server/_coffre/assets/users.index-BiEax90r.js +0 -37
- package/dist/server/index.js +0 -13911
- package/src/assets/favicon-32.png +0 -0
- package/src/components/agentation.tsx +0 -34
- package/src/entry.ts +0 -19
- package/src/routeTree.gen.ts +0 -367
- package/src/routes/__root.tsx +0 -169
- package/src/routes/access.tsx +0 -11
- package/src/routes/index.tsx +0 -15
- package/src/routes/users.$user.tsx +0 -13
- package/src/types.ts +0 -21
|
@@ -1,172 +1,29 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import {
|
|
3
|
-
import { C as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { t as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
const seen = /* @__PURE__ */ new Set();
|
|
21
|
-
const lines = input.split(/\r\n|\n|\r/);
|
|
22
|
-
for (let index = 0; index < lines.length; index++) {
|
|
23
|
-
const lineNumber = index + 1;
|
|
24
|
-
const trimmed = lines[index].trim();
|
|
25
|
-
if (trimmed === "" || trimmed.startsWith("#")) continue;
|
|
26
|
-
const withoutExport = trimmed.startsWith("export ") ? trimmed.slice(7).trim() : trimmed;
|
|
27
|
-
const equals = withoutExport.indexOf("=");
|
|
28
|
-
if (equals === -1) {
|
|
29
|
-
problems.push({
|
|
30
|
-
line: lineNumber,
|
|
31
|
-
text: trimmed,
|
|
32
|
-
reason: "no \"=\" on this line"
|
|
33
|
-
});
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
const key = withoutExport.slice(0, equals).trim();
|
|
37
|
-
if (!KEY_RE.test(key)) {
|
|
38
|
-
problems.push({
|
|
39
|
-
line: lineNumber,
|
|
40
|
-
text: key,
|
|
41
|
-
reason: "key must match ^[A-Za-z_][A-Za-z0-9_]*$"
|
|
42
|
-
});
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
let rest = withoutExport.slice(equals + 1).trim();
|
|
46
|
-
let value;
|
|
47
|
-
if (rest.startsWith("\"")) {
|
|
48
|
-
const closing = findClosingQuote(rest, "\"");
|
|
49
|
-
if (closing === -1) {
|
|
50
|
-
problems.push({
|
|
51
|
-
line: lineNumber,
|
|
52
|
-
text: key,
|
|
53
|
-
reason: "unterminated double quote (multi-line values are not supported)"
|
|
54
|
-
});
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
value = unescapeDoubleQuoted(rest.slice(1, closing));
|
|
58
|
-
if (trailingIsSignificant(rest.slice(closing + 1))) {
|
|
59
|
-
problems.push({
|
|
60
|
-
line: lineNumber,
|
|
61
|
-
text: key,
|
|
62
|
-
reason: "unexpected text after the closing quote"
|
|
63
|
-
});
|
|
64
|
-
continue;
|
|
65
|
-
}
|
|
66
|
-
} else if (rest.startsWith("'")) {
|
|
67
|
-
const closing = rest.indexOf("'", 1);
|
|
68
|
-
if (closing === -1) {
|
|
69
|
-
problems.push({
|
|
70
|
-
line: lineNumber,
|
|
71
|
-
text: key,
|
|
72
|
-
reason: "unterminated single quote (multi-line values are not supported)"
|
|
73
|
-
});
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
value = rest.slice(1, closing);
|
|
77
|
-
if (trailingIsSignificant(rest.slice(closing + 1))) {
|
|
78
|
-
problems.push({
|
|
79
|
-
line: lineNumber,
|
|
80
|
-
text: key,
|
|
81
|
-
reason: "unexpected text after the closing quote"
|
|
82
|
-
});
|
|
83
|
-
continue;
|
|
84
|
-
}
|
|
85
|
-
} else {
|
|
86
|
-
const comment = rest.indexOf(" #");
|
|
87
|
-
if (comment !== -1) rest = rest.slice(0, comment);
|
|
88
|
-
value = rest.trim();
|
|
89
|
-
}
|
|
90
|
-
if (value.includes("\0")) {
|
|
91
|
-
problems.push({
|
|
92
|
-
line: lineNumber,
|
|
93
|
-
text: key,
|
|
94
|
-
reason: "value contains a NUL byte, which cannot be passed in an environment"
|
|
95
|
-
});
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
if (seen.has(key)) {
|
|
99
|
-
problems.push({
|
|
100
|
-
line: lineNumber,
|
|
101
|
-
text: key,
|
|
102
|
-
reason: "duplicate key in this file"
|
|
103
|
-
});
|
|
104
|
-
continue;
|
|
105
|
-
}
|
|
106
|
-
seen.add(key);
|
|
107
|
-
entries.push({
|
|
108
|
-
key,
|
|
109
|
-
value,
|
|
110
|
-
line: lineNumber
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
return {
|
|
114
|
-
entries,
|
|
115
|
-
problems
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
/** True when what follows a closing quote is neither whitespace nor a comment. */
|
|
119
|
-
function trailingIsSignificant(rest) {
|
|
120
|
-
const trimmed = rest.trim();
|
|
121
|
-
return trimmed !== "" && !trimmed.startsWith("#");
|
|
122
|
-
}
|
|
123
|
-
function findClosingQuote(text, quote) {
|
|
124
|
-
for (let index = 1; index < text.length; index++) {
|
|
125
|
-
if (text[index] === "\\") {
|
|
126
|
-
index++;
|
|
127
|
-
continue;
|
|
128
|
-
}
|
|
129
|
-
if (text[index] === quote) return index;
|
|
130
|
-
}
|
|
131
|
-
return -1;
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Expand escapes inside a double-quoted value.
|
|
135
|
-
*
|
|
136
|
-
* Deliberately minimal: only the escapes that are necessary. `\n` and `\r`
|
|
137
|
-
* because multi-line values (PEM keys) cannot otherwise be expressed on one
|
|
138
|
-
* line, and `\\` `\"` `\'` because quoting needs them.
|
|
139
|
-
*
|
|
140
|
-
* EVERYTHING ELSE IS PRESERVED VERBATIM, backslash included. The obvious
|
|
141
|
-
* implementation -- returning the character and dropping the backslash for
|
|
142
|
-
* unknown escapes -- silently mangles credentials: `"C:\path\to\file"` came
|
|
143
|
-
* out as `C:path<TAB>ofile`, and `"\d+\w"` as `d+w`. A secrets store that
|
|
144
|
-
* quietly rewrites what you gave it is worse than one that refuses.
|
|
145
|
-
*
|
|
146
|
-
* A value that should contain no interpretation at all belongs in single
|
|
147
|
-
* quotes, which are literal.
|
|
148
|
-
*/
|
|
149
|
-
function unescapeDoubleQuoted(text) {
|
|
150
|
-
return text.replace(/\\(.)/g, (match, character) => {
|
|
151
|
-
switch (character) {
|
|
152
|
-
case "n": return "\n";
|
|
153
|
-
case "r": return "\r";
|
|
154
|
-
case "\\":
|
|
155
|
-
case "\"":
|
|
156
|
-
case "'": return character;
|
|
157
|
-
default: return match;
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
//#endregion
|
|
1
|
+
import { a as ErrorLine, c as Notice, d as Tip, i as EmptyState, l as Spinner, m as breakAfterUnderscores, o as MenuPopup, r as CopyButton, s as Modal, t as ConfirmButton, u as Timestamp } from "../chunks/ui-DixXLQvQ.js";
|
|
2
|
+
import { i as SecretReadOnly } from "../chunks/affordances-DAvsVz7u.js";
|
|
3
|
+
import { A as Pencil, B as Terminal, C as Lock, G as X, N as RotateBack, O as MoreHorizontal, P as Search, V as Upload, d as Eye, f as EyeOff, g as History, h as Hash, i as Archive, j as Plus, l as Clock, n as AlertCircle, v as Key } from "../chunks/icons-D-PfAfnH.js";
|
|
4
|
+
import { i as PageHeader, n as ClosedDoor, o as failureMessage, t as Card, u as useCoffre } from "../chunks/page-C5HcNqf2.js";
|
|
5
|
+
import { a as rowClass, i as RowPending, r as RowFailure } from "../chunks/row-state-0PsrEzOL.js";
|
|
6
|
+
import { p as canRevealSecrets, r as keys, t as affects, u as queries } from "../chunks/queries-CQ81o4so.js";
|
|
7
|
+
import { t as useShell } from "../chunks/use-shell-jxd7Tzd-.js";
|
|
8
|
+
import { S as saveSecrets, T as secretChangeFor, a as archiveSecret, n as useChangeStatus, r as UnsavedEdits, t as useChange, w as hasSecretEditConflict, y as restoreSecret } from "../chunks/use-change-c6CeLRin.js";
|
|
9
|
+
import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
|
|
10
|
+
import { t as useAction } from "../chunks/use-action-CWsg_YWU.js";
|
|
11
|
+
import { t as secretKeyProblem } from "../chunks/validation-BQtqPe2V.js";
|
|
12
|
+
import { useEffect, useRef, useState } from "react";
|
|
13
|
+
import { Link } from "@tanstack/react-router";
|
|
14
|
+
import { toast } from "sonner";
|
|
15
|
+
import { Menu } from "@base-ui/react/menu";
|
|
16
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
import { useSuspenseQuery } from "@tanstack/react-query";
|
|
18
|
+
import { CoffreError, planImport } from "@coffre/client";
|
|
19
|
+
import { parseDotenv } from "@coffre/core/dotenv";
|
|
162
20
|
//#region src/lib/reveal.ts
|
|
163
|
-
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
164
21
|
function revealIsCurrent(reveal, currentVersion) {
|
|
165
22
|
return reveal !== null && reveal.version === currentVersion;
|
|
166
23
|
}
|
|
167
24
|
//#endregion
|
|
168
|
-
//#region src/
|
|
169
|
-
var
|
|
25
|
+
//#region src/pages/environment.tsx
|
|
26
|
+
var Route = pageRoute();
|
|
170
27
|
/**
|
|
171
28
|
* How long a revealed value stays on screen.
|
|
172
29
|
*
|
|
@@ -181,9 +38,9 @@ function EnvironmentPage() {
|
|
|
181
38
|
project,
|
|
182
39
|
environment
|
|
183
40
|
}));
|
|
184
|
-
if (!result.ok) return /* @__PURE__ */
|
|
185
|
-
icon: /* @__PURE__ */
|
|
186
|
-
label: /* @__PURE__ */
|
|
41
|
+
if (!result.ok) return /* @__PURE__ */ jsx(ClosedDoor, {
|
|
42
|
+
icon: /* @__PURE__ */ jsx(Lock, { size: 18 }),
|
|
43
|
+
label: /* @__PURE__ */ jsxs("span", {
|
|
187
44
|
className: "mono",
|
|
188
45
|
children: [
|
|
189
46
|
project,
|
|
@@ -192,7 +49,7 @@ function EnvironmentPage() {
|
|
|
192
49
|
]
|
|
193
50
|
}),
|
|
194
51
|
title: "This environment is closed to you",
|
|
195
|
-
actions: /* @__PURE__ */
|
|
52
|
+
actions: /* @__PURE__ */ jsxs(Link, {
|
|
196
53
|
className: "btn",
|
|
197
54
|
to: "/projects/$project",
|
|
198
55
|
params: { project },
|
|
@@ -200,7 +57,7 @@ function EnvironmentPage() {
|
|
|
200
57
|
}),
|
|
201
58
|
children: result.error
|
|
202
59
|
});
|
|
203
|
-
return /* @__PURE__ */
|
|
60
|
+
return /* @__PURE__ */ jsx(EnvironmentLedger, {
|
|
204
61
|
project,
|
|
205
62
|
environment,
|
|
206
63
|
permissions: result.permissions,
|
|
@@ -226,12 +83,12 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
226
83
|
project,
|
|
227
84
|
environment
|
|
228
85
|
}));
|
|
229
|
-
const [drafts, setDrafts] =
|
|
230
|
-
const [changes, setChanges] =
|
|
231
|
-
const [editing, setEditing] =
|
|
232
|
-
const [saveError, setSaveError] =
|
|
233
|
-
const [query, setQuery] =
|
|
234
|
-
const nextDraftId =
|
|
86
|
+
const [drafts, setDrafts] = useState([]);
|
|
87
|
+
const [changes, setChanges] = useState({});
|
|
88
|
+
const [editing, setEditing] = useState(() => /* @__PURE__ */ new Set());
|
|
89
|
+
const [saveError, setSaveError] = useState(null);
|
|
90
|
+
const [query, setQuery] = useState(Route.useSearch().filter ?? "");
|
|
91
|
+
const nextDraftId = useRef(0);
|
|
235
92
|
const canWrite = permissions.includes("secret.write");
|
|
236
93
|
const canArchive = permissions.includes("secret.archive");
|
|
237
94
|
const canReveal = canRevealSecrets(permissions);
|
|
@@ -331,9 +188,9 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
331
188
|
onClick: () => archive({ key })
|
|
332
189
|
} }) });
|
|
333
190
|
}
|
|
334
|
-
const saveRef =
|
|
191
|
+
const saveRef = useRef(saveChanges);
|
|
335
192
|
saveRef.current = saveChanges;
|
|
336
|
-
|
|
193
|
+
useEffect(() => {
|
|
337
194
|
if (pendingCount === 0) return;
|
|
338
195
|
function onKeyDown(event) {
|
|
339
196
|
if (event.key === "Enter" && (event.metaKey || event.ctrlKey)) {
|
|
@@ -371,37 +228,37 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
371
228
|
const needle = query.trim().toLowerCase();
|
|
372
229
|
const listed = needle === "" ? active : active.filter((entry) => entry.key.toLowerCase().includes(needle));
|
|
373
230
|
const columns = 6;
|
|
374
|
-
return /* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */
|
|
231
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
232
|
+
/* @__PURE__ */ jsx(PageHeader, {
|
|
376
233
|
tile: project,
|
|
377
234
|
title: environment,
|
|
378
|
-
aside: /* @__PURE__ */
|
|
235
|
+
aside: /* @__PURE__ */ jsx(EnvironmentName, {
|
|
379
236
|
project,
|
|
380
237
|
environment
|
|
381
238
|
}),
|
|
382
|
-
actions: /* @__PURE__ */
|
|
239
|
+
actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [canWrite && canReveal && /* @__PURE__ */ jsx(ImportEnv, {
|
|
383
240
|
project,
|
|
384
241
|
environment
|
|
385
|
-
}), canWrite && /* @__PURE__ */
|
|
242
|
+
}), canWrite && /* @__PURE__ */ jsxs("button", {
|
|
386
243
|
className: "btn btn-primary",
|
|
387
244
|
onClick: addDraft,
|
|
388
|
-
children: [/* @__PURE__ */
|
|
245
|
+
children: [/* @__PURE__ */ jsx(Plus, { size: 14 }), "New secret"]
|
|
389
246
|
})] })
|
|
390
247
|
}),
|
|
391
|
-
(active.length > 0 || drafts.length > 0) && /* @__PURE__ */
|
|
248
|
+
(active.length > 0 || drafts.length > 0) && /* @__PURE__ */ jsxs("div", {
|
|
392
249
|
className: "toolbar",
|
|
393
|
-
children: [/* @__PURE__ */
|
|
250
|
+
children: [/* @__PURE__ */ jsxs("label", {
|
|
394
251
|
className: "filter input-group",
|
|
395
252
|
children: [
|
|
396
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ jsx("span", {
|
|
397
254
|
className: "visually-hidden",
|
|
398
255
|
children: "Filter secrets by name"
|
|
399
256
|
}),
|
|
400
|
-
/* @__PURE__ */
|
|
257
|
+
/* @__PURE__ */ jsx(Search, {
|
|
401
258
|
size: 14,
|
|
402
259
|
className: "input-icon"
|
|
403
260
|
}),
|
|
404
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ jsx("input", {
|
|
405
262
|
className: "input",
|
|
406
263
|
type: "search",
|
|
407
264
|
placeholder: "Filter by name…",
|
|
@@ -411,21 +268,21 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
411
268
|
onChange: (event) => setQuery(event.target.value)
|
|
412
269
|
})
|
|
413
270
|
]
|
|
414
|
-
}), /* @__PURE__ */
|
|
271
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
415
272
|
className: "toolbar-meta",
|
|
416
|
-
children: /* @__PURE__ */
|
|
273
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
417
274
|
className: "th",
|
|
418
275
|
title: "Run a process with these secrets in its environment",
|
|
419
276
|
children: [
|
|
420
|
-
/* @__PURE__ */
|
|
421
|
-
/* @__PURE__ */
|
|
277
|
+
/* @__PURE__ */ jsx(Terminal, { size: 14 }),
|
|
278
|
+
/* @__PURE__ */ jsxs("code", { children: [
|
|
422
279
|
"coffre run ",
|
|
423
280
|
project,
|
|
424
281
|
"/",
|
|
425
282
|
environment,
|
|
426
283
|
" -- …"
|
|
427
284
|
] }),
|
|
428
|
-
/* @__PURE__ */
|
|
285
|
+
/* @__PURE__ */ jsx(CopyButton, {
|
|
429
286
|
value: `coffre run ${project}/${environment} -- `,
|
|
430
287
|
label: "Copy command"
|
|
431
288
|
})
|
|
@@ -433,70 +290,70 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
433
290
|
})
|
|
434
291
|
})]
|
|
435
292
|
}),
|
|
436
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ jsx("section", {
|
|
437
294
|
className: "card",
|
|
438
295
|
"aria-label": "Secrets",
|
|
439
|
-
children: active.length === 0 && drafts.length === 0 ? /* @__PURE__ */
|
|
296
|
+
children: active.length === 0 && drafts.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
440
297
|
title: "No secrets yet",
|
|
441
|
-
actions: canWrite ? /* @__PURE__ */
|
|
298
|
+
actions: canWrite ? /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
442
299
|
className: "btn btn-primary",
|
|
443
300
|
onClick: addDraft,
|
|
444
|
-
children: [/* @__PURE__ */
|
|
445
|
-
}), canReveal && /* @__PURE__ */
|
|
301
|
+
children: [/* @__PURE__ */ jsx(Plus, { size: 14 }), "New secret"]
|
|
302
|
+
}), canReveal && /* @__PURE__ */ jsx(ImportEnv, {
|
|
446
303
|
project,
|
|
447
304
|
environment
|
|
448
305
|
})] }) : void 0,
|
|
449
306
|
children: canWrite ? "Add them one by one, or import an existing .env file. Nothing is written until you save, or until you have seen the import plan." : "Nothing has been written to this environment, and adding the first secret needs secret.write."
|
|
450
|
-
}) : /* @__PURE__ */
|
|
307
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
451
308
|
className: "dt-wrap",
|
|
452
|
-
children: /* @__PURE__ */
|
|
309
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
453
310
|
className: "dt secrets stacks",
|
|
454
|
-
children: [/* @__PURE__ */
|
|
455
|
-
/* @__PURE__ */
|
|
311
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
312
|
+
/* @__PURE__ */ jsx("th", {
|
|
456
313
|
className: "n",
|
|
457
314
|
children: "#"
|
|
458
315
|
}),
|
|
459
|
-
/* @__PURE__ */
|
|
316
|
+
/* @__PURE__ */ jsx("th", {
|
|
460
317
|
className: "col-key",
|
|
461
|
-
children: /* @__PURE__ */
|
|
318
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
462
319
|
className: "th",
|
|
463
|
-
children: [/* @__PURE__ */
|
|
320
|
+
children: [/* @__PURE__ */ jsx(Key, { size: 14 }), "Key"]
|
|
464
321
|
})
|
|
465
322
|
}),
|
|
466
|
-
/* @__PURE__ */
|
|
323
|
+
/* @__PURE__ */ jsx("th", { children: /* @__PURE__ */ jsxs("span", {
|
|
467
324
|
className: "th",
|
|
468
325
|
children: [
|
|
469
|
-
/* @__PURE__ */
|
|
326
|
+
/* @__PURE__ */ jsx(Lock, { size: 14 }),
|
|
470
327
|
"Value",
|
|
471
|
-
!canReveal && /* @__PURE__ */
|
|
328
|
+
!canReveal && /* @__PURE__ */ jsx("span", {
|
|
472
329
|
className: "th-note",
|
|
473
330
|
children: "hidden from you"
|
|
474
331
|
})
|
|
475
332
|
]
|
|
476
333
|
}) }),
|
|
477
|
-
/* @__PURE__ */
|
|
334
|
+
/* @__PURE__ */ jsx("th", {
|
|
478
335
|
className: "col-version",
|
|
479
|
-
children: /* @__PURE__ */
|
|
336
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
480
337
|
className: "th",
|
|
481
|
-
children: [/* @__PURE__ */
|
|
338
|
+
children: [/* @__PURE__ */ jsx(Hash, { size: 14 }), "Version"]
|
|
482
339
|
})
|
|
483
340
|
}),
|
|
484
|
-
/* @__PURE__ */
|
|
341
|
+
/* @__PURE__ */ jsx("th", {
|
|
485
342
|
className: "col-written col-hide-narrow",
|
|
486
|
-
children: /* @__PURE__ */
|
|
343
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
487
344
|
className: "th",
|
|
488
|
-
children: [/* @__PURE__ */
|
|
345
|
+
children: [/* @__PURE__ */ jsx(Clock, { size: 14 }), "Last written"]
|
|
489
346
|
})
|
|
490
347
|
}),
|
|
491
|
-
/* @__PURE__ */
|
|
348
|
+
/* @__PURE__ */ jsx("th", {
|
|
492
349
|
className: "col-actions",
|
|
493
|
-
children: /* @__PURE__ */
|
|
350
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
494
351
|
className: "visually-hidden",
|
|
495
352
|
children: "Actions"
|
|
496
353
|
})
|
|
497
354
|
})
|
|
498
|
-
] }) }), /* @__PURE__ */
|
|
499
|
-
drafts.map((draft) => /* @__PURE__ */
|
|
355
|
+
] }) }), /* @__PURE__ */ jsxs("tbody", { children: [
|
|
356
|
+
drafts.map((draft) => /* @__PURE__ */ jsx(DraftRow, {
|
|
500
357
|
draft,
|
|
501
358
|
existingVersion: keys$1.find((entry) => entry.key === draft.key.trim())?.version ?? null,
|
|
502
359
|
disabled: false,
|
|
@@ -509,7 +366,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
509
366
|
listed.map((entry) => {
|
|
510
367
|
const change = secretChangeFor(changes, entry.key);
|
|
511
368
|
const state = status(entry.key);
|
|
512
|
-
return /* @__PURE__ */
|
|
369
|
+
return /* @__PURE__ */ jsx(SecretRow, {
|
|
513
370
|
number: active.indexOf(entry) + 1,
|
|
514
371
|
project,
|
|
515
372
|
environment,
|
|
@@ -546,7 +403,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
546
403
|
}
|
|
547
404
|
}, entry.key);
|
|
548
405
|
}),
|
|
549
|
-
listed.length === 0 && active.length > 0 && /* @__PURE__ */
|
|
406
|
+
listed.length === 0 && active.length > 0 && /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsxs("td", {
|
|
550
407
|
colSpan: columns,
|
|
551
408
|
className: "cell-muted",
|
|
552
409
|
style: { padding: "1rem" },
|
|
@@ -560,52 +417,52 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
560
417
|
})
|
|
561
418
|
})
|
|
562
419
|
}),
|
|
563
|
-
archived.length > 0 && /* @__PURE__ */
|
|
420
|
+
archived.length > 0 && /* @__PURE__ */ jsx(Card, {
|
|
564
421
|
labelledBy: "archived-secrets",
|
|
565
422
|
title: "Archived",
|
|
566
|
-
description: /* @__PURE__ */
|
|
423
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
567
424
|
"Retired, so no longer served or injected by ",
|
|
568
|
-
/* @__PURE__ */
|
|
425
|
+
/* @__PURE__ */ jsx("code", { children: "coffre run" }),
|
|
569
426
|
". Their history and audit trail are intact, and restoring is immediate."
|
|
570
427
|
] }),
|
|
571
|
-
children: /* @__PURE__ */
|
|
428
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
572
429
|
className: "dt-wrap",
|
|
573
|
-
children: /* @__PURE__ */
|
|
430
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
574
431
|
className: "dt secrets secrets-archived stacks",
|
|
575
|
-
children: [/* @__PURE__ */
|
|
576
|
-
/* @__PURE__ */
|
|
432
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
433
|
+
/* @__PURE__ */ jsx("th", {
|
|
577
434
|
className: "n",
|
|
578
435
|
children: "#"
|
|
579
436
|
}),
|
|
580
|
-
/* @__PURE__ */
|
|
437
|
+
/* @__PURE__ */ jsx("th", {
|
|
581
438
|
className: "col-key",
|
|
582
|
-
children: /* @__PURE__ */
|
|
439
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
583
440
|
className: "th",
|
|
584
|
-
children: [/* @__PURE__ */
|
|
441
|
+
children: [/* @__PURE__ */ jsx(Key, { size: 14 }), "Key"]
|
|
585
442
|
})
|
|
586
443
|
}),
|
|
587
|
-
/* @__PURE__ */
|
|
444
|
+
/* @__PURE__ */ jsx("th", {
|
|
588
445
|
className: "col-version",
|
|
589
|
-
children: /* @__PURE__ */
|
|
446
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
590
447
|
className: "th",
|
|
591
|
-
children: [/* @__PURE__ */
|
|
448
|
+
children: [/* @__PURE__ */ jsx(Hash, { size: 14 }), "Version"]
|
|
592
449
|
})
|
|
593
450
|
}),
|
|
594
|
-
/* @__PURE__ */
|
|
451
|
+
/* @__PURE__ */ jsx("th", {
|
|
595
452
|
className: "col-written col-hide-narrow",
|
|
596
|
-
children: /* @__PURE__ */
|
|
453
|
+
children: /* @__PURE__ */ jsxs("span", {
|
|
597
454
|
className: "th",
|
|
598
|
-
children: [/* @__PURE__ */
|
|
455
|
+
children: [/* @__PURE__ */ jsx(Clock, { size: 14 }), "Last written"]
|
|
599
456
|
})
|
|
600
457
|
}),
|
|
601
|
-
/* @__PURE__ */
|
|
458
|
+
/* @__PURE__ */ jsx("th", {
|
|
602
459
|
className: "col-actions",
|
|
603
|
-
children: /* @__PURE__ */
|
|
460
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
604
461
|
className: "visually-hidden",
|
|
605
462
|
children: "Actions"
|
|
606
463
|
})
|
|
607
464
|
})
|
|
608
|
-
] }) }), /* @__PURE__ */
|
|
465
|
+
] }) }), /* @__PURE__ */ jsx("tbody", { children: archived.map((entry, index) => /* @__PURE__ */ jsx(ArchivedRow, {
|
|
609
466
|
number: index + 1,
|
|
610
467
|
project,
|
|
611
468
|
environment,
|
|
@@ -619,17 +476,17 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
619
476
|
})
|
|
620
477
|
})
|
|
621
478
|
}),
|
|
622
|
-
pendingCount > 0 && /* @__PURE__ */
|
|
479
|
+
pendingCount > 0 && /* @__PURE__ */ jsx("div", {
|
|
623
480
|
className: "savebar",
|
|
624
481
|
role: "region",
|
|
625
482
|
"aria-label": "Unsaved changes",
|
|
626
|
-
children: /* @__PURE__ */
|
|
483
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
627
484
|
className: "savebar-inner",
|
|
628
485
|
children: [
|
|
629
|
-
/* @__PURE__ */
|
|
486
|
+
/* @__PURE__ */ jsxs("span", {
|
|
630
487
|
className: "savebar-count",
|
|
631
488
|
children: [
|
|
632
|
-
/* @__PURE__ */
|
|
489
|
+
/* @__PURE__ */ jsx("span", {
|
|
633
490
|
className: "dot",
|
|
634
491
|
"aria-hidden": true
|
|
635
492
|
}),
|
|
@@ -638,11 +495,11 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
638
495
|
pendingCount === 1 ? "" : "s"
|
|
639
496
|
]
|
|
640
497
|
}),
|
|
641
|
-
/* @__PURE__ */
|
|
498
|
+
/* @__PURE__ */ jsxs("span", {
|
|
642
499
|
className: "savebar-summary",
|
|
643
|
-
children: [pending.slice(0, 3).map((item, index) => /* @__PURE__ */
|
|
500
|
+
children: [pending.slice(0, 3).map((item, index) => /* @__PURE__ */ jsxs("span", { children: [
|
|
644
501
|
index > 0 && " · ",
|
|
645
|
-
/* @__PURE__ */
|
|
502
|
+
/* @__PURE__ */ jsx("span", {
|
|
646
503
|
className: "mono",
|
|
647
504
|
children: item.key
|
|
648
505
|
}),
|
|
@@ -650,13 +507,13 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
650
507
|
item.what
|
|
651
508
|
] }, `${item.key}:${index}`)), pending.length > 3 && ` · and ${pending.length - 3} more`]
|
|
652
509
|
}),
|
|
653
|
-
/* @__PURE__ */
|
|
510
|
+
/* @__PURE__ */ jsxs("div", {
|
|
654
511
|
className: "savebar-actions",
|
|
655
|
-
children: [/* @__PURE__ */
|
|
512
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
656
513
|
className: "btn btn-sm",
|
|
657
514
|
onClick: discardAll,
|
|
658
515
|
children: "Discard"
|
|
659
|
-
}), /* @__PURE__ */
|
|
516
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
660
517
|
className: "btn btn-sm btn-primary",
|
|
661
518
|
onClick: saveChanges,
|
|
662
519
|
disabled: !ready,
|
|
@@ -665,10 +522,10 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
665
522
|
children: ["Save ", pendingCount === 1 ? "change" : `${pendingCount} changes`]
|
|
666
523
|
})]
|
|
667
524
|
}),
|
|
668
|
-
(saveError ?? problem) !== null && /* @__PURE__ */
|
|
525
|
+
(saveError ?? problem) !== null && /* @__PURE__ */ jsxs("p", {
|
|
669
526
|
className: "savebar-error",
|
|
670
527
|
role: "alert",
|
|
671
|
-
children: [/* @__PURE__ */
|
|
528
|
+
children: [/* @__PURE__ */ jsx(AlertCircle, { size: 14 }), /* @__PURE__ */ jsx("span", { children: saveError ?? problem })]
|
|
672
529
|
})
|
|
673
530
|
]
|
|
674
531
|
})
|
|
@@ -679,7 +536,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1 })
|
|
|
679
536
|
function EnvironmentName({ project, environment }) {
|
|
680
537
|
const { projects } = useShell();
|
|
681
538
|
const name = projects.find((entry) => entry.slug === project)?.environments.find((entry) => entry.slug === environment)?.name;
|
|
682
|
-
return name === void 0 ? null : /* @__PURE__ */
|
|
539
|
+
return name === void 0 ? null : /* @__PURE__ */ jsx(Fragment$1, { children: name });
|
|
683
540
|
}
|
|
684
541
|
/**
|
|
685
542
|
* A text field whose contents are masked until asked, for secret values.
|
|
@@ -689,11 +546,11 @@ function EnvironmentName({ project, environment }) {
|
|
|
689
546
|
* save or fill them, and a secret being typed into coffre is neither.
|
|
690
547
|
*/
|
|
691
548
|
function MaskedInput({ masked, className = "", ...props }) {
|
|
692
|
-
const [cssMask, setCssMask] =
|
|
693
|
-
|
|
549
|
+
const [cssMask, setCssMask] = useState(false);
|
|
550
|
+
useEffect(() => {
|
|
694
551
|
setCssMask(typeof CSS !== "undefined" && CSS.supports("-webkit-text-security", "disc"));
|
|
695
552
|
}, []);
|
|
696
|
-
return /* @__PURE__ */
|
|
553
|
+
return /* @__PURE__ */ jsx("input", {
|
|
697
554
|
...props,
|
|
698
555
|
type: masked && !cssMask ? "password" : "text",
|
|
699
556
|
className: `${className}${masked && cssMask ? " is-masked" : ""}`,
|
|
@@ -705,10 +562,10 @@ function MaskedInput({ masked, className = "", ...props }) {
|
|
|
705
562
|
});
|
|
706
563
|
}
|
|
707
564
|
function ValueField({ label, value, onChange, placeholder, disabled, autoFocus, onEscape }) {
|
|
708
|
-
const [shown, setShown] =
|
|
709
|
-
return /* @__PURE__ */
|
|
565
|
+
const [shown, setShown] = useState(false);
|
|
566
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
710
567
|
className: "input-group",
|
|
711
|
-
children: [/* @__PURE__ */
|
|
568
|
+
children: [/* @__PURE__ */ jsx(MaskedInput, {
|
|
712
569
|
className: "input input-mono",
|
|
713
570
|
masked: !shown,
|
|
714
571
|
"aria-label": label,
|
|
@@ -720,19 +577,19 @@ function ValueField({ label, value, onChange, placeholder, disabled, autoFocus,
|
|
|
720
577
|
onKeyDown: (event) => {
|
|
721
578
|
if (event.key === "Escape" && onEscape !== void 0) onEscape();
|
|
722
579
|
}
|
|
723
|
-
}), /* @__PURE__ */
|
|
580
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
724
581
|
type: "button",
|
|
725
582
|
className: "btn btn-quiet btn-sm btn-icon input-addon",
|
|
726
583
|
"aria-label": shown ? "Mask the value" : "Show the value",
|
|
727
584
|
"aria-pressed": shown,
|
|
728
585
|
onClick: () => setShown((current) => !current),
|
|
729
|
-
children: shown ? /* @__PURE__ */
|
|
586
|
+
children: shown ? /* @__PURE__ */ jsx(EyeOff, { size: 14 }) : /* @__PURE__ */ jsx(Eye, { size: 14 })
|
|
730
587
|
})]
|
|
731
588
|
});
|
|
732
589
|
}
|
|
733
590
|
function useSecondsLeft(reveal) {
|
|
734
|
-
const [now, setNow] =
|
|
735
|
-
|
|
591
|
+
const [now, setNow] = useState(() => Date.now());
|
|
592
|
+
useEffect(() => {
|
|
736
593
|
if (reveal === null) return;
|
|
737
594
|
setNow(Date.now());
|
|
738
595
|
const tick = setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -742,24 +599,24 @@ function useSecondsLeft(reveal) {
|
|
|
742
599
|
return Math.max(0, Math.ceil(REVEAL_TTL_SECONDS - (now - reveal.at) / 1e3));
|
|
743
600
|
}
|
|
744
601
|
function SecretRow({ number, project, environment, entry, change, editing, canWrite, canArchive, canReveal, status, disabled, columns, onEdit, onPatch, onUndo, onMarkArchive }) {
|
|
745
|
-
const [reveal, setReveal] =
|
|
602
|
+
const [reveal, setReveal] = useState(null);
|
|
746
603
|
const coffre = useCoffre();
|
|
747
|
-
const [revealing, setRevealing] =
|
|
748
|
-
const [historyOpen, setHistoryOpen] =
|
|
749
|
-
const [error, setError] =
|
|
750
|
-
const [base, setBase] =
|
|
604
|
+
const [revealing, setRevealing] = useState(false);
|
|
605
|
+
const [historyOpen, setHistoryOpen] = useState(false);
|
|
606
|
+
const [error, setError] = useState(null);
|
|
607
|
+
const [base, setBase] = useState(null);
|
|
751
608
|
const shown = revealIsCurrent(reveal, entry.version) ? reveal : null;
|
|
752
|
-
|
|
609
|
+
useEffect(() => {
|
|
753
610
|
if (reveal !== null && !revealIsCurrent(reveal, entry.version)) setReveal(null);
|
|
754
611
|
}, [reveal, entry.version]);
|
|
755
|
-
|
|
612
|
+
useEffect(() => {
|
|
756
613
|
if (reveal === null) return;
|
|
757
614
|
const timer = setTimeout(() => setReveal(null), REVEAL_TTL_SECONDS * 1e3);
|
|
758
615
|
return () => clearTimeout(timer);
|
|
759
616
|
}, [reveal]);
|
|
760
617
|
const secondsLeft = useSecondsLeft(shown);
|
|
761
618
|
const editBase = editing && revealIsCurrent(base, entry.version) ? base : null;
|
|
762
|
-
|
|
619
|
+
useEffect(() => {
|
|
763
620
|
if (!editing) setBase(null);
|
|
764
621
|
}, [editing]);
|
|
765
622
|
async function readValue() {
|
|
@@ -792,20 +649,20 @@ function SecretRow({ number, project, environment, entry, change, editing, canWr
|
|
|
792
649
|
const keyProblem = editing ? secretKeyProblem(change.key.trim()) : null;
|
|
793
650
|
const state = leaving ? " is-leaving" : editing && (renamed || valueChanged) ? " is-changed" : shown !== null ? " is-revealed" : "";
|
|
794
651
|
const version = entry.version ?? 0;
|
|
795
|
-
return /* @__PURE__ */
|
|
796
|
-
/* @__PURE__ */
|
|
652
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
653
|
+
/* @__PURE__ */ jsxs("tr", {
|
|
797
654
|
className: `secret-row${state} ${rowClass(status)}`,
|
|
798
655
|
children: [
|
|
799
|
-
/* @__PURE__ */
|
|
656
|
+
/* @__PURE__ */ jsx("td", {
|
|
800
657
|
className: "n",
|
|
801
658
|
children: number
|
|
802
659
|
}),
|
|
803
|
-
/* @__PURE__ */
|
|
660
|
+
/* @__PURE__ */ jsx("td", {
|
|
804
661
|
className: "cell-key",
|
|
805
662
|
"data-label": "Key",
|
|
806
|
-
children: editing && canWrite ? /* @__PURE__ */
|
|
663
|
+
children: editing && canWrite ? /* @__PURE__ */ jsxs("div", {
|
|
807
664
|
className: "edit-stack",
|
|
808
|
-
children: [/* @__PURE__ */
|
|
665
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
809
666
|
className: "input input-mono",
|
|
810
667
|
"aria-label": `Name for ${entry.key}`,
|
|
811
668
|
"aria-invalid": keyProblem !== null,
|
|
@@ -817,26 +674,26 @@ function SecretRow({ number, project, environment, entry, change, editing, canWr
|
|
|
817
674
|
onKeyDown: (event) => {
|
|
818
675
|
if (event.key === "Escape") onUndo();
|
|
819
676
|
}
|
|
820
|
-
}), (keyProblem !== null || renamed) && /* @__PURE__ */
|
|
677
|
+
}), (keyProblem !== null || renamed) && /* @__PURE__ */ jsx("span", {
|
|
821
678
|
className: `edit-note${keyProblem !== null ? " edit-note-error" : ""}`,
|
|
822
|
-
children: keyProblem ?? /* @__PURE__ */
|
|
679
|
+
children: keyProblem ?? /* @__PURE__ */ jsxs(Fragment$1, { children: ["Renamed from ", /* @__PURE__ */ jsx("span", {
|
|
823
680
|
className: "mono",
|
|
824
681
|
children: entry.key
|
|
825
682
|
})] })
|
|
826
683
|
})]
|
|
827
|
-
}) : /* @__PURE__ */
|
|
684
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
828
685
|
className: "key-cell",
|
|
829
|
-
children: [/* @__PURE__ */
|
|
686
|
+
children: [/* @__PURE__ */ jsx("span", { children: breakAfterUnderscores(entry.key) }), leaving && /* @__PURE__ */ jsx("span", {
|
|
830
687
|
className: "tag tag-red",
|
|
831
688
|
children: "will be archived"
|
|
832
689
|
})]
|
|
833
690
|
})
|
|
834
691
|
}),
|
|
835
|
-
/* @__PURE__ */
|
|
692
|
+
/* @__PURE__ */ jsx("td", {
|
|
836
693
|
"data-label": "Value",
|
|
837
|
-
children: editing && canWrite ? /* @__PURE__ */
|
|
694
|
+
children: editing && canWrite ? /* @__PURE__ */ jsxs("div", {
|
|
838
695
|
className: "edit-stack",
|
|
839
|
-
children: [/* @__PURE__ */
|
|
696
|
+
children: [/* @__PURE__ */ jsx(ValueField, {
|
|
840
697
|
label: `New value for ${entry.key}`,
|
|
841
698
|
value: change.value ?? editBase?.value ?? "",
|
|
842
699
|
placeholder: "New value",
|
|
@@ -844,9 +701,9 @@ function SecretRow({ number, project, environment, entry, change, editing, canWr
|
|
|
844
701
|
autoFocus: true,
|
|
845
702
|
onChange: (value) => onPatch({ value: value === (editBase?.value ?? "") ? null : value }),
|
|
846
703
|
onEscape: onUndo
|
|
847
|
-
}), /* @__PURE__ */
|
|
704
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
848
705
|
className: "edit-note",
|
|
849
|
-
children: [/* @__PURE__ */
|
|
706
|
+
children: [/* @__PURE__ */ jsx("span", { children: valueChanged ? `Saving appends v${version + 1}; v${version} stays restorable.` : editBase !== null ? `This is v${version}. Change it to append v${version + 1}.` : `Nothing is decrypted to edit. Left empty, v${version} stays current.` }), canReveal && !valueChanged && editBase === null && /* @__PURE__ */ jsxs("button", {
|
|
850
707
|
type: "button",
|
|
851
708
|
className: "act",
|
|
852
709
|
disabled: revealing,
|
|
@@ -858,18 +715,18 @@ function SecretRow({ number, project, environment, entry, change, editing, canWr
|
|
|
858
715
|
at: Date.now()
|
|
859
716
|
});
|
|
860
717
|
},
|
|
861
|
-
children: [revealing && /* @__PURE__ */
|
|
718
|
+
children: [revealing && /* @__PURE__ */ jsx(Spinner, { size: 12 }), "Start from current value"]
|
|
862
719
|
})]
|
|
863
720
|
})]
|
|
864
|
-
}) : shown !== null && !leaving ? /* @__PURE__ */
|
|
721
|
+
}) : shown !== null && !leaving ? /* @__PURE__ */ jsxs("div", {
|
|
865
722
|
className: "revealed",
|
|
866
723
|
style: { ["--reveal-ttl"]: `${REVEAL_TTL_SECONDS}s` },
|
|
867
724
|
children: [
|
|
868
|
-
/* @__PURE__ */
|
|
725
|
+
/* @__PURE__ */ jsx("span", {
|
|
869
726
|
className: "revealed-value",
|
|
870
727
|
children: shown.value === "" ? "(empty)" : shown.value
|
|
871
728
|
}),
|
|
872
|
-
/* @__PURE__ */
|
|
729
|
+
/* @__PURE__ */ jsxs("span", {
|
|
873
730
|
className: "revealed-note",
|
|
874
731
|
children: [
|
|
875
732
|
"Hides in ",
|
|
@@ -877,82 +734,82 @@ function SecretRow({ number, project, environment, entry, change, editing, canWr
|
|
|
877
734
|
"s"
|
|
878
735
|
]
|
|
879
736
|
}),
|
|
880
|
-
/* @__PURE__ */
|
|
737
|
+
/* @__PURE__ */ jsx("span", {
|
|
881
738
|
className: "revealed-meter",
|
|
882
739
|
"aria-hidden": true
|
|
883
740
|
})
|
|
884
741
|
]
|
|
885
|
-
}) : /* @__PURE__ */
|
|
742
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
886
743
|
className: "mask",
|
|
887
744
|
"aria-label": "Hidden",
|
|
888
745
|
children: "••••••••••••"
|
|
889
746
|
})
|
|
890
747
|
}),
|
|
891
|
-
/* @__PURE__ */
|
|
748
|
+
/* @__PURE__ */ jsx("td", {
|
|
892
749
|
className: "col-version",
|
|
893
750
|
"data-label": "Version",
|
|
894
|
-
children: editing && valueChanged ? /* @__PURE__ */
|
|
751
|
+
children: editing && valueChanged ? /* @__PURE__ */ jsxs("span", {
|
|
895
752
|
className: "version-shift",
|
|
896
753
|
children: [
|
|
897
754
|
"v",
|
|
898
755
|
version,
|
|
899
756
|
" → ",
|
|
900
|
-
/* @__PURE__ */
|
|
757
|
+
/* @__PURE__ */ jsxs("b", { children: ["v", version + 1] })
|
|
901
758
|
]
|
|
902
|
-
}) : /* @__PURE__ */
|
|
759
|
+
}) : /* @__PURE__ */ jsx("span", {
|
|
903
760
|
className: "version-shift",
|
|
904
761
|
children: entry.version === null ? "—" : `v${entry.version}`
|
|
905
762
|
})
|
|
906
763
|
}),
|
|
907
|
-
/* @__PURE__ */
|
|
764
|
+
/* @__PURE__ */ jsx("td", {
|
|
908
765
|
className: "col-written col-hide-narrow",
|
|
909
766
|
"data-label": "Last written",
|
|
910
|
-
children: /* @__PURE__ */
|
|
767
|
+
children: /* @__PURE__ */ jsx(Written, { entry })
|
|
911
768
|
}),
|
|
912
|
-
/* @__PURE__ */
|
|
769
|
+
/* @__PURE__ */ jsx("td", {
|
|
913
770
|
className: "col-actions",
|
|
914
|
-
children: status.state === "pending" ? /* @__PURE__ */
|
|
771
|
+
children: status.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status }) : /* @__PURE__ */ jsx("div", {
|
|
915
772
|
className: "acts",
|
|
916
|
-
children: leaving ? /* @__PURE__ */
|
|
773
|
+
children: leaving ? /* @__PURE__ */ jsx(Tip, {
|
|
917
774
|
label: "Keep",
|
|
918
|
-
children: /* @__PURE__ */
|
|
775
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
919
776
|
className: "act act-icon act-quiet",
|
|
920
777
|
onClick: onUndo,
|
|
921
778
|
disabled,
|
|
922
779
|
"aria-label": `Keep ${entry.key}`,
|
|
923
|
-
children: /* @__PURE__ */
|
|
780
|
+
children: /* @__PURE__ */ jsx(RotateBack, { size: 14 })
|
|
924
781
|
})
|
|
925
|
-
}) : editing ? /* @__PURE__ */
|
|
782
|
+
}) : editing ? /* @__PURE__ */ jsx(Tip, {
|
|
926
783
|
label: renamed || valueChanged ? "Undo changes" : "Cancel",
|
|
927
|
-
children: /* @__PURE__ */
|
|
784
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
928
785
|
className: "act act-icon act-quiet",
|
|
929
786
|
onClick: onUndo,
|
|
930
787
|
disabled,
|
|
931
788
|
"aria-label": `${renamed || valueChanged ? "Undo changes to" : "Stop editing"} ${entry.key}`,
|
|
932
|
-
children: renamed || valueChanged ? /* @__PURE__ */
|
|
789
|
+
children: renamed || valueChanged ? /* @__PURE__ */ jsx(RotateBack, { size: 14 }) : /* @__PURE__ */ jsx(X, { size: 15 })
|
|
933
790
|
})
|
|
934
|
-
}) : /* @__PURE__ */
|
|
935
|
-
shown !== null && /* @__PURE__ */
|
|
791
|
+
}) : /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
792
|
+
shown !== null && /* @__PURE__ */ jsx(CopyButton, {
|
|
936
793
|
variant: "act",
|
|
937
794
|
value: shown.value,
|
|
938
795
|
label: `Copy ${entry.key}`
|
|
939
796
|
}),
|
|
940
|
-
/* @__PURE__ */
|
|
797
|
+
/* @__PURE__ */ jsx(SecretReadOnly, {
|
|
941
798
|
canReveal,
|
|
942
|
-
children: /* @__PURE__ */
|
|
799
|
+
children: /* @__PURE__ */ jsx(Tip, {
|
|
943
800
|
label: shown === null ? "Reveal" : "Hide",
|
|
944
|
-
children: /* @__PURE__ */
|
|
801
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
945
802
|
className: "act act-icon act-accent",
|
|
946
803
|
onClick: toggleReveal,
|
|
947
804
|
disabled: revealing,
|
|
948
805
|
"aria-label": `${shown === null ? "Reveal" : "Hide"} ${entry.key}`,
|
|
949
|
-
children: revealing ? /* @__PURE__ */
|
|
806
|
+
children: revealing ? /* @__PURE__ */ jsx(Spinner, { size: 13 }) : shown === null ? /* @__PURE__ */ jsx(Eye, { size: 15 }) : /* @__PURE__ */ jsx(EyeOff, { size: 15 })
|
|
950
807
|
})
|
|
951
808
|
})
|
|
952
809
|
}),
|
|
953
|
-
canWrite && /* @__PURE__ */
|
|
810
|
+
canWrite && /* @__PURE__ */ jsx(Tip, {
|
|
954
811
|
label: "Edit",
|
|
955
|
-
children: /* @__PURE__ */
|
|
812
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
956
813
|
className: "act act-icon",
|
|
957
814
|
onClick: () => {
|
|
958
815
|
if (shown !== null) setBase(shown);
|
|
@@ -961,54 +818,49 @@ function SecretRow({ number, project, environment, entry, change, editing, canWr
|
|
|
961
818
|
},
|
|
962
819
|
disabled,
|
|
963
820
|
"aria-label": `Edit ${entry.key}`,
|
|
964
|
-
children: /* @__PURE__ */
|
|
821
|
+
children: /* @__PURE__ */ jsx(Pencil, { size: 14 })
|
|
965
822
|
})
|
|
966
823
|
}),
|
|
967
|
-
(canReveal || canArchive) && /* @__PURE__ */
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MoreHorizontal, { size: 16 })
|
|
974
|
-
})
|
|
975
|
-
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(dropdown_menu_exports.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(dropdown_menu_exports.Content, {
|
|
976
|
-
className: "menu",
|
|
977
|
-
sideOffset: 6,
|
|
824
|
+
(canReveal || canArchive) && /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
825
|
+
className: "act act-icon act-quiet",
|
|
826
|
+
"aria-label": `More for ${entry.key}`,
|
|
827
|
+
disabled,
|
|
828
|
+
children: /* @__PURE__ */ jsx(MoreHorizontal, { size: 16 })
|
|
829
|
+
}), /* @__PURE__ */ jsxs(MenuPopup, {
|
|
978
830
|
align: "end",
|
|
979
|
-
children: [/* @__PURE__ */
|
|
831
|
+
children: [/* @__PURE__ */ jsx(SecretReadOnly, {
|
|
980
832
|
canReveal,
|
|
981
|
-
children: /* @__PURE__ */
|
|
833
|
+
children: /* @__PURE__ */ jsxs(Menu.Item, {
|
|
982
834
|
className: "menu-item",
|
|
983
|
-
|
|
984
|
-
children: [/* @__PURE__ */
|
|
835
|
+
onClick: () => setHistoryOpen((open) => !open),
|
|
836
|
+
children: [/* @__PURE__ */ jsx(History, { size: 14 }), historyOpen ? "Hide history" : "Version history"]
|
|
985
837
|
})
|
|
986
|
-
}), canArchive && /* @__PURE__ */
|
|
838
|
+
}), canArchive && /* @__PURE__ */ jsxs(Fragment$1, { children: [canReveal && /* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" }), /* @__PURE__ */ jsxs(Menu.Item, {
|
|
987
839
|
className: "menu-item menu-item-danger",
|
|
988
|
-
|
|
840
|
+
onClick: () => {
|
|
989
841
|
setReveal(null);
|
|
990
842
|
onMarkArchive();
|
|
991
843
|
},
|
|
992
844
|
children: [
|
|
993
|
-
/* @__PURE__ */
|
|
845
|
+
/* @__PURE__ */ jsx(Archive, { size: 14 }),
|
|
994
846
|
"Archive",
|
|
995
|
-
/* @__PURE__ */
|
|
847
|
+
/* @__PURE__ */ jsx("span", {
|
|
996
848
|
className: "menu-hint",
|
|
997
849
|
children: "on save"
|
|
998
850
|
})
|
|
999
851
|
]
|
|
1000
852
|
})] })]
|
|
1001
|
-
})
|
|
853
|
+
})] })
|
|
1002
854
|
] })
|
|
1003
855
|
})
|
|
1004
856
|
})
|
|
1005
857
|
]
|
|
1006
858
|
}),
|
|
1007
|
-
historyOpen && canReveal && /* @__PURE__ */
|
|
859
|
+
historyOpen && canReveal && /* @__PURE__ */ jsx("tr", {
|
|
1008
860
|
className: "detail-row",
|
|
1009
|
-
children: /* @__PURE__ */
|
|
861
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
1010
862
|
colSpan: columns,
|
|
1011
|
-
children: /* @__PURE__ */
|
|
863
|
+
children: /* @__PURE__ */ jsx(VersionHistory, {
|
|
1012
864
|
project,
|
|
1013
865
|
environment,
|
|
1014
866
|
secretKey: entry.key,
|
|
@@ -1019,11 +871,11 @@ function SecretRow({ number, project, environment, entry, change, editing, canWr
|
|
|
1019
871
|
})
|
|
1020
872
|
})
|
|
1021
873
|
}),
|
|
1022
|
-
error !== null && /* @__PURE__ */
|
|
874
|
+
error !== null && /* @__PURE__ */ jsx("tr", {
|
|
1023
875
|
className: "row-error",
|
|
1024
|
-
children: /* @__PURE__ */
|
|
876
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
1025
877
|
colSpan: columns,
|
|
1026
|
-
children: /* @__PURE__ */
|
|
878
|
+
children: /* @__PURE__ */ jsx(ErrorLine, { error })
|
|
1027
879
|
})
|
|
1028
880
|
})
|
|
1029
881
|
] });
|
|
@@ -1034,24 +886,24 @@ function SecretRow({ number, project, environment, entry, change, editing, canWr
|
|
|
1034
886
|
* the exact time are a hover away.
|
|
1035
887
|
*/
|
|
1036
888
|
function Written({ entry }) {
|
|
1037
|
-
if (entry.updatedBy === null && entry.updatedAt === null) return /* @__PURE__ */
|
|
889
|
+
if (entry.updatedBy === null && entry.updatedAt === null) return /* @__PURE__ */ jsx("span", {
|
|
1038
890
|
className: "cell-muted",
|
|
1039
891
|
children: "—"
|
|
1040
892
|
});
|
|
1041
893
|
const by = entry.updatedBy ?? "unknown";
|
|
1042
|
-
return /* @__PURE__ */
|
|
894
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
1043
895
|
className: "written",
|
|
1044
|
-
children: [/* @__PURE__ */
|
|
896
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1045
897
|
className: "written-by",
|
|
1046
898
|
title: by,
|
|
1047
899
|
children: by.split("@")[0]
|
|
1048
|
-
}), entry.updatedAt !== null && /* @__PURE__ */
|
|
900
|
+
}), entry.updatedAt !== null && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("span", {
|
|
1049
901
|
className: "cell-muted",
|
|
1050
902
|
"aria-hidden": true,
|
|
1051
903
|
children: "·"
|
|
1052
|
-
}), /* @__PURE__ */
|
|
904
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
1053
905
|
className: "cell-muted",
|
|
1054
|
-
children: /* @__PURE__ */
|
|
906
|
+
children: /* @__PURE__ */ jsx(Timestamp, {
|
|
1055
907
|
iso: entry.updatedAt,
|
|
1056
908
|
display: "relative"
|
|
1057
909
|
})
|
|
@@ -1066,24 +918,24 @@ function Written({ entry }) {
|
|
|
1066
918
|
* in place accepts as many as you want to queue.
|
|
1067
919
|
*/
|
|
1068
920
|
function DraftRow({ draft, existingVersion, disabled, onChange, onRemove }) {
|
|
1069
|
-
const [touched, setTouched] =
|
|
921
|
+
const [touched, setTouched] = useState(false);
|
|
1070
922
|
const trimmed = draft.key.trim();
|
|
1071
923
|
const keyProblem = trimmed === "" ? touched ? "Give it a name." : null : secretKeyProblem(trimmed);
|
|
1072
924
|
const isNewVersion = trimmed !== "" && existingVersion !== null;
|
|
1073
|
-
return /* @__PURE__ */
|
|
925
|
+
return /* @__PURE__ */ jsxs("tr", {
|
|
1074
926
|
className: "secret-row is-draft",
|
|
1075
927
|
children: [
|
|
1076
|
-
/* @__PURE__ */
|
|
928
|
+
/* @__PURE__ */ jsx("td", {
|
|
1077
929
|
className: "n",
|
|
1078
930
|
"aria-label": "New",
|
|
1079
931
|
children: "+"
|
|
1080
932
|
}),
|
|
1081
|
-
/* @__PURE__ */
|
|
933
|
+
/* @__PURE__ */ jsx("td", {
|
|
1082
934
|
className: "cell-key",
|
|
1083
935
|
"data-label": "New secret",
|
|
1084
|
-
children: /* @__PURE__ */
|
|
936
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1085
937
|
className: "edit-stack",
|
|
1086
|
-
children: [/* @__PURE__ */
|
|
938
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
1087
939
|
className: "input input-mono",
|
|
1088
940
|
autoFocus: true,
|
|
1089
941
|
"aria-label": "Name of the new secret",
|
|
@@ -1098,17 +950,17 @@ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove }) {
|
|
|
1098
950
|
onKeyDown: (event) => {
|
|
1099
951
|
if (event.key === "Escape") onRemove();
|
|
1100
952
|
}
|
|
1101
|
-
}), (keyProblem !== null || isNewVersion) && /* @__PURE__ */
|
|
953
|
+
}), (keyProblem !== null || isNewVersion) && /* @__PURE__ */ jsx("span", {
|
|
1102
954
|
className: `edit-note${keyProblem !== null ? " edit-note-error" : ""}`,
|
|
1103
955
|
children: keyProblem ?? "This name already exists here. Saving appends a new version to it rather than creating a second secret."
|
|
1104
956
|
})]
|
|
1105
957
|
})
|
|
1106
958
|
}),
|
|
1107
|
-
/* @__PURE__ */
|
|
959
|
+
/* @__PURE__ */ jsx("td", {
|
|
1108
960
|
"data-label": "Value",
|
|
1109
|
-
children: /* @__PURE__ */
|
|
961
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1110
962
|
className: "edit-stack",
|
|
1111
|
-
children: /* @__PURE__ */
|
|
963
|
+
children: /* @__PURE__ */ jsx(ValueField, {
|
|
1112
964
|
label: `Value for ${trimmed === "" ? "the new secret" : trimmed}`,
|
|
1113
965
|
value: draft.value,
|
|
1114
966
|
placeholder: "Value",
|
|
@@ -1118,38 +970,38 @@ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove }) {
|
|
|
1118
970
|
})
|
|
1119
971
|
})
|
|
1120
972
|
}),
|
|
1121
|
-
/* @__PURE__ */
|
|
973
|
+
/* @__PURE__ */ jsx("td", {
|
|
1122
974
|
className: "col-version",
|
|
1123
975
|
"data-label": "Version",
|
|
1124
|
-
children: /* @__PURE__ */
|
|
976
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1125
977
|
className: "version-shift",
|
|
1126
|
-
children: isNewVersion ? /* @__PURE__ */
|
|
978
|
+
children: isNewVersion ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1127
979
|
"v",
|
|
1128
980
|
existingVersion,
|
|
1129
981
|
" → ",
|
|
1130
|
-
/* @__PURE__ */
|
|
1131
|
-
] }) : /* @__PURE__ */
|
|
982
|
+
/* @__PURE__ */ jsxs("b", { children: ["v", existingVersion + 1] })
|
|
983
|
+
] }) : /* @__PURE__ */ jsx("b", { children: "new" })
|
|
1132
984
|
})
|
|
1133
985
|
}),
|
|
1134
|
-
/* @__PURE__ */
|
|
986
|
+
/* @__PURE__ */ jsx("td", {
|
|
1135
987
|
className: "col-written col-hide-narrow",
|
|
1136
|
-
children: /* @__PURE__ */
|
|
988
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1137
989
|
className: "cell-muted",
|
|
1138
990
|
children: "—"
|
|
1139
991
|
})
|
|
1140
992
|
}),
|
|
1141
|
-
/* @__PURE__ */
|
|
993
|
+
/* @__PURE__ */ jsx("td", {
|
|
1142
994
|
className: "col-actions",
|
|
1143
|
-
children: /* @__PURE__ */
|
|
995
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
1144
996
|
className: "acts",
|
|
1145
|
-
children: /* @__PURE__ */
|
|
997
|
+
children: /* @__PURE__ */ jsx(Tip, {
|
|
1146
998
|
label: "Remove",
|
|
1147
|
-
children: /* @__PURE__ */
|
|
999
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
1148
1000
|
className: "act act-icon act-quiet",
|
|
1149
1001
|
onClick: onRemove,
|
|
1150
1002
|
disabled,
|
|
1151
1003
|
"aria-label": trimmed === "" ? "Remove this new secret" : `Remove new secret ${trimmed}`,
|
|
1152
|
-
children: /* @__PURE__ */
|
|
1004
|
+
children: /* @__PURE__ */ jsx(X, { size: 15 })
|
|
1153
1005
|
})
|
|
1154
1006
|
})
|
|
1155
1007
|
})
|
|
@@ -1158,67 +1010,67 @@ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove }) {
|
|
|
1158
1010
|
});
|
|
1159
1011
|
}
|
|
1160
1012
|
function ArchivedRow({ number, project, environment, entry, canArchive, canReveal, status: state, onRestore, onDismiss }) {
|
|
1161
|
-
const [historyOpen, setHistoryOpen] =
|
|
1162
|
-
return /* @__PURE__ */
|
|
1163
|
-
/* @__PURE__ */
|
|
1013
|
+
const [historyOpen, setHistoryOpen] = useState(false);
|
|
1014
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1015
|
+
/* @__PURE__ */ jsxs("tr", {
|
|
1164
1016
|
className: `secret-row is-archived ${rowClass(state)}`,
|
|
1165
1017
|
children: [
|
|
1166
|
-
/* @__PURE__ */
|
|
1018
|
+
/* @__PURE__ */ jsx("td", {
|
|
1167
1019
|
className: "n",
|
|
1168
1020
|
children: number
|
|
1169
1021
|
}),
|
|
1170
|
-
/* @__PURE__ */
|
|
1022
|
+
/* @__PURE__ */ jsx("td", {
|
|
1171
1023
|
className: "cell-key",
|
|
1172
1024
|
"data-label": "Key",
|
|
1173
1025
|
children: breakAfterUnderscores(entry.key)
|
|
1174
1026
|
}),
|
|
1175
|
-
/* @__PURE__ */
|
|
1027
|
+
/* @__PURE__ */ jsx("td", {
|
|
1176
1028
|
className: "col-version",
|
|
1177
1029
|
"data-label": "Version",
|
|
1178
|
-
children: /* @__PURE__ */
|
|
1030
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1179
1031
|
className: "version-shift",
|
|
1180
1032
|
children: entry.version === null ? "—" : `v${entry.version}`
|
|
1181
1033
|
})
|
|
1182
1034
|
}),
|
|
1183
|
-
/* @__PURE__ */
|
|
1035
|
+
/* @__PURE__ */ jsx("td", {
|
|
1184
1036
|
className: "col-written col-hide-narrow",
|
|
1185
1037
|
"data-label": "Last written",
|
|
1186
|
-
children: /* @__PURE__ */
|
|
1038
|
+
children: /* @__PURE__ */ jsx(Written, { entry })
|
|
1187
1039
|
}),
|
|
1188
|
-
/* @__PURE__ */
|
|
1040
|
+
/* @__PURE__ */ jsx("td", {
|
|
1189
1041
|
className: "col-actions",
|
|
1190
|
-
children: /* @__PURE__ */
|
|
1042
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1191
1043
|
className: "acts",
|
|
1192
|
-
children: [/* @__PURE__ */
|
|
1044
|
+
children: [/* @__PURE__ */ jsx(SecretReadOnly, {
|
|
1193
1045
|
canReveal,
|
|
1194
|
-
children: /* @__PURE__ */
|
|
1046
|
+
children: /* @__PURE__ */ jsx(Tip, {
|
|
1195
1047
|
label: historyOpen ? "Hide history" : "Version history",
|
|
1196
|
-
children: /* @__PURE__ */
|
|
1048
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
1197
1049
|
className: "act act-icon act-quiet",
|
|
1198
1050
|
onClick: () => setHistoryOpen((open) => !open),
|
|
1199
1051
|
"aria-label": `${historyOpen ? "Hide history of" : "Version history of"} ${entry.key}`,
|
|
1200
1052
|
"aria-expanded": historyOpen,
|
|
1201
|
-
children: /* @__PURE__ */
|
|
1053
|
+
children: /* @__PURE__ */ jsx(History, { size: 15 })
|
|
1202
1054
|
})
|
|
1203
1055
|
})
|
|
1204
|
-
}), canArchive && (state.state === "pending" ? /* @__PURE__ */
|
|
1056
|
+
}), canArchive && (state.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status: state }) : /* @__PURE__ */ jsx(Tip, {
|
|
1205
1057
|
label: "Restore",
|
|
1206
|
-
children: /* @__PURE__ */
|
|
1058
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
1207
1059
|
className: "act act-icon",
|
|
1208
1060
|
onClick: onRestore,
|
|
1209
1061
|
"aria-label": `Restore ${entry.key}`,
|
|
1210
|
-
children: /* @__PURE__ */
|
|
1062
|
+
children: /* @__PURE__ */ jsx(RotateBack, { size: 14 })
|
|
1211
1063
|
})
|
|
1212
1064
|
}))]
|
|
1213
1065
|
})
|
|
1214
1066
|
})
|
|
1215
1067
|
]
|
|
1216
1068
|
}),
|
|
1217
|
-
historyOpen && /* @__PURE__ */
|
|
1069
|
+
historyOpen && /* @__PURE__ */ jsx("tr", {
|
|
1218
1070
|
className: "detail-row",
|
|
1219
|
-
children: /* @__PURE__ */
|
|
1071
|
+
children: /* @__PURE__ */ jsx("td", {
|
|
1220
1072
|
colSpan: 5,
|
|
1221
|
-
children: /* @__PURE__ */
|
|
1073
|
+
children: /* @__PURE__ */ jsx(VersionHistory, {
|
|
1222
1074
|
project,
|
|
1223
1075
|
environment,
|
|
1224
1076
|
secretKey: entry.key,
|
|
@@ -1229,7 +1081,7 @@ function ArchivedRow({ number, project, environment, entry, canArchive, canRevea
|
|
|
1229
1081
|
})
|
|
1230
1082
|
})
|
|
1231
1083
|
}),
|
|
1232
|
-
/* @__PURE__ */
|
|
1084
|
+
/* @__PURE__ */ jsx(RowFailure, {
|
|
1233
1085
|
status: state,
|
|
1234
1086
|
columns: 5,
|
|
1235
1087
|
onDismiss: () => state.state === "failed" && onDismiss(state.mutationId)
|
|
@@ -1237,11 +1089,11 @@ function ArchivedRow({ number, project, environment, entry, canArchive, canRevea
|
|
|
1237
1089
|
] });
|
|
1238
1090
|
}
|
|
1239
1091
|
function VersionHistory({ project, environment, secretKey, currentVersion, canWrite, onClose, onRolledBack }) {
|
|
1240
|
-
const [versions, setVersions] =
|
|
1241
|
-
const [loadError, setLoadError] =
|
|
1092
|
+
const [versions, setVersions] = useState(null);
|
|
1093
|
+
const [loadError, setLoadError] = useState(null);
|
|
1242
1094
|
const coffre = useCoffre();
|
|
1243
1095
|
const { pending, error, run } = useAction();
|
|
1244
|
-
|
|
1096
|
+
useEffect(() => {
|
|
1245
1097
|
let cancelled = false;
|
|
1246
1098
|
coffre.secrets.history(`${project}/${environment}/${secretKey}`).then((result) => {
|
|
1247
1099
|
if (cancelled) return;
|
|
@@ -1261,91 +1113,91 @@ function VersionHistory({ project, environment, secretKey, currentVersion, canWr
|
|
|
1261
1113
|
secretKey,
|
|
1262
1114
|
currentVersion
|
|
1263
1115
|
]);
|
|
1264
|
-
return /* @__PURE__ */
|
|
1116
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
1265
1117
|
className: "history",
|
|
1266
1118
|
children: [
|
|
1267
|
-
/* @__PURE__ */
|
|
1119
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1268
1120
|
className: "history-head",
|
|
1269
|
-
children: [/* @__PURE__ */
|
|
1121
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
1270
1122
|
className: "history-title th",
|
|
1271
1123
|
children: [
|
|
1272
|
-
/* @__PURE__ */
|
|
1124
|
+
/* @__PURE__ */ jsx(History, { size: 14 }),
|
|
1273
1125
|
"Versions of ",
|
|
1274
|
-
/* @__PURE__ */
|
|
1126
|
+
/* @__PURE__ */ jsx("span", {
|
|
1275
1127
|
className: "mono",
|
|
1276
1128
|
children: secretKey
|
|
1277
1129
|
})
|
|
1278
1130
|
]
|
|
1279
|
-
}), /* @__PURE__ */
|
|
1131
|
+
}), /* @__PURE__ */ jsx("button", {
|
|
1280
1132
|
className: "act",
|
|
1281
1133
|
onClick: onClose,
|
|
1282
1134
|
children: "Close"
|
|
1283
1135
|
})]
|
|
1284
1136
|
}),
|
|
1285
|
-
loadError !== null ? /* @__PURE__ */
|
|
1137
|
+
loadError !== null ? /* @__PURE__ */ jsx("div", {
|
|
1286
1138
|
className: "history-body",
|
|
1287
|
-
children: /* @__PURE__ */
|
|
1288
|
-
}) : versions === null ? /* @__PURE__ */
|
|
1139
|
+
children: /* @__PURE__ */ jsx(ErrorLine, { error: loadError })
|
|
1140
|
+
}) : versions === null ? /* @__PURE__ */ jsxs("p", {
|
|
1289
1141
|
className: "hint history-body",
|
|
1290
|
-
children: [/* @__PURE__ */
|
|
1291
|
-
}) : /* @__PURE__ */
|
|
1142
|
+
children: [/* @__PURE__ */ jsx(Spinner, { size: 13 }), " Loading versions…"]
|
|
1143
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
1292
1144
|
className: "dt-wrap",
|
|
1293
|
-
children: /* @__PURE__ */
|
|
1145
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
1294
1146
|
className: "dt",
|
|
1295
|
-
children: [/* @__PURE__ */
|
|
1296
|
-
/* @__PURE__ */
|
|
1147
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1148
|
+
/* @__PURE__ */ jsx("th", {
|
|
1297
1149
|
className: "col-shrink",
|
|
1298
1150
|
children: "Version"
|
|
1299
1151
|
}),
|
|
1300
|
-
/* @__PURE__ */
|
|
1152
|
+
/* @__PURE__ */ jsx("th", {
|
|
1301
1153
|
className: "col-shrink",
|
|
1302
1154
|
children: "Written (UTC)"
|
|
1303
1155
|
}),
|
|
1304
|
-
/* @__PURE__ */
|
|
1305
|
-
/* @__PURE__ */
|
|
1156
|
+
/* @__PURE__ */ jsx("th", { children: "By" }),
|
|
1157
|
+
/* @__PURE__ */ jsx("th", {
|
|
1306
1158
|
className: "col-shrink",
|
|
1307
1159
|
children: "Key id"
|
|
1308
1160
|
}),
|
|
1309
|
-
/* @__PURE__ */
|
|
1161
|
+
/* @__PURE__ */ jsx("th", {
|
|
1310
1162
|
className: "col-actions",
|
|
1311
|
-
children: /* @__PURE__ */
|
|
1163
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1312
1164
|
className: "visually-hidden",
|
|
1313
1165
|
children: "Actions"
|
|
1314
1166
|
})
|
|
1315
1167
|
})
|
|
1316
|
-
] }) }), /* @__PURE__ */
|
|
1317
|
-
/* @__PURE__ */
|
|
1168
|
+
] }) }), /* @__PURE__ */ jsx("tbody", { children: versions.map((version) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
1169
|
+
/* @__PURE__ */ jsxs("td", {
|
|
1318
1170
|
className: "cell-mono nowrap",
|
|
1319
1171
|
children: [
|
|
1320
1172
|
"v",
|
|
1321
1173
|
version.version,
|
|
1322
1174
|
" ",
|
|
1323
|
-
version.current && /* @__PURE__ */
|
|
1175
|
+
version.current && /* @__PURE__ */ jsx("span", {
|
|
1324
1176
|
className: "tag tag-blue",
|
|
1325
1177
|
children: "current"
|
|
1326
1178
|
})
|
|
1327
1179
|
]
|
|
1328
1180
|
}),
|
|
1329
|
-
/* @__PURE__ */
|
|
1181
|
+
/* @__PURE__ */ jsx("td", {
|
|
1330
1182
|
className: "nowrap",
|
|
1331
|
-
children: /* @__PURE__ */
|
|
1183
|
+
children: /* @__PURE__ */ jsx(Timestamp, { iso: version.createdAt })
|
|
1332
1184
|
}),
|
|
1333
|
-
/* @__PURE__ */
|
|
1334
|
-
/* @__PURE__ */
|
|
1185
|
+
/* @__PURE__ */ jsx("td", { children: version.createdBy }),
|
|
1186
|
+
/* @__PURE__ */ jsx("td", {
|
|
1335
1187
|
className: "cell-mono cell-muted nowrap",
|
|
1336
1188
|
children: version.kek
|
|
1337
1189
|
}),
|
|
1338
|
-
/* @__PURE__ */
|
|
1190
|
+
/* @__PURE__ */ jsx("td", {
|
|
1339
1191
|
className: "col-actions",
|
|
1340
|
-
children: canWrite && !version.current && /* @__PURE__ */
|
|
1341
|
-
trigger: /* @__PURE__ */
|
|
1192
|
+
children: canWrite && !version.current && /* @__PURE__ */ jsx(ConfirmButton, {
|
|
1193
|
+
trigger: /* @__PURE__ */ jsxs("button", {
|
|
1342
1194
|
className: "act",
|
|
1343
1195
|
disabled: pending,
|
|
1344
|
-
children: [/* @__PURE__ */
|
|
1196
|
+
children: [/* @__PURE__ */ jsx(RotateBack, { size: 13 }), "Roll back"]
|
|
1345
1197
|
}),
|
|
1346
|
-
title: /* @__PURE__ */
|
|
1198
|
+
title: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1347
1199
|
"Roll ",
|
|
1348
|
-
/* @__PURE__ */
|
|
1200
|
+
/* @__PURE__ */ jsx("span", {
|
|
1349
1201
|
className: "mono",
|
|
1350
1202
|
children: secretKey
|
|
1351
1203
|
}),
|
|
@@ -1353,12 +1205,12 @@ function VersionHistory({ project, environment, secretKey, currentVersion, canWr
|
|
|
1353
1205
|
version.version,
|
|
1354
1206
|
"?"
|
|
1355
1207
|
] }),
|
|
1356
|
-
body: /* @__PURE__ */
|
|
1208
|
+
body: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1357
1209
|
"The current pointer moves to v",
|
|
1358
1210
|
version.version,
|
|
1359
1211
|
". Nothing is copied or deleted, every version stays readable, and the next write continues the numbering forward. Anything reading",
|
|
1360
1212
|
" ",
|
|
1361
|
-
/* @__PURE__ */
|
|
1213
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1362
1214
|
className: "mono",
|
|
1363
1215
|
children: [
|
|
1364
1216
|
project,
|
|
@@ -1386,11 +1238,11 @@ function VersionHistory({ project, environment, secretKey, currentVersion, canWr
|
|
|
1386
1238
|
] }, version.version)) })]
|
|
1387
1239
|
})
|
|
1388
1240
|
}),
|
|
1389
|
-
error !== null && /* @__PURE__ */
|
|
1241
|
+
error !== null && /* @__PURE__ */ jsx("div", {
|
|
1390
1242
|
className: "history-body",
|
|
1391
|
-
children: /* @__PURE__ */
|
|
1243
|
+
children: /* @__PURE__ */ jsx(ErrorLine, { error })
|
|
1392
1244
|
}),
|
|
1393
|
-
/* @__PURE__ */
|
|
1245
|
+
/* @__PURE__ */ jsx("p", {
|
|
1394
1246
|
className: "history-note",
|
|
1395
1247
|
children: "Metadata only. Listing versions decrypts nothing."
|
|
1396
1248
|
})
|
|
@@ -1425,10 +1277,10 @@ async function planEnv(coffre, path, content) {
|
|
|
1425
1277
|
* then sends exactly the changes the preview showed, in one patch.
|
|
1426
1278
|
*/
|
|
1427
1279
|
function ImportEnv({ project, environment }) {
|
|
1428
|
-
const [content, setContent] =
|
|
1429
|
-
const [plan, setPlan] =
|
|
1430
|
-
const [problems, setProblems] =
|
|
1431
|
-
const [open, setOpen] =
|
|
1280
|
+
const [content, setContent] = useState("");
|
|
1281
|
+
const [plan, setPlan] = useState(null);
|
|
1282
|
+
const [problems, setProblems] = useState([]);
|
|
1283
|
+
const [open, setOpen] = useState(false);
|
|
1432
1284
|
const coffre = useCoffre();
|
|
1433
1285
|
const { pending, error, setError, run } = useAction();
|
|
1434
1286
|
const path = `${project}/${environment}`;
|
|
@@ -1466,17 +1318,17 @@ function ImportEnv({ project, environment }) {
|
|
|
1466
1318
|
setError(null);
|
|
1467
1319
|
}
|
|
1468
1320
|
const changes = plan?.entries.filter((entry) => entry.action !== "unchanged") ?? [];
|
|
1469
|
-
return /* @__PURE__ */
|
|
1321
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
1470
1322
|
className: "btn",
|
|
1471
1323
|
onClick: () => setOpen(true),
|
|
1472
|
-
children: [/* @__PURE__ */
|
|
1473
|
-
}), /* @__PURE__ */
|
|
1324
|
+
children: [/* @__PURE__ */ jsx(Upload, { size: 14 }), "Import .env"]
|
|
1325
|
+
}), /* @__PURE__ */ jsx(Modal, {
|
|
1474
1326
|
open,
|
|
1475
1327
|
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
1476
|
-
title: /* @__PURE__ */
|
|
1328
|
+
title: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1477
1329
|
"Import into",
|
|
1478
1330
|
" ",
|
|
1479
|
-
/* @__PURE__ */
|
|
1331
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1480
1332
|
className: "mono",
|
|
1481
1333
|
children: [
|
|
1482
1334
|
project,
|
|
@@ -1486,17 +1338,17 @@ function ImportEnv({ project, environment }) {
|
|
|
1486
1338
|
})
|
|
1487
1339
|
] }),
|
|
1488
1340
|
wide: true,
|
|
1489
|
-
description: /* @__PURE__ */
|
|
1490
|
-
children: /* @__PURE__ */
|
|
1341
|
+
description: /* @__PURE__ */ jsx(Fragment$1, { children: "Paste a .env file. It is read by the CLI’s own parser, so this page and the CLI cannot disagree about what it means, and malformed lines are reported rather than guessed at. coffre compares it with the current values without sending any to this page." }),
|
|
1342
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
1491
1343
|
className: "form",
|
|
1492
1344
|
style: { marginTop: "1.25rem" },
|
|
1493
1345
|
children: [
|
|
1494
|
-
/* @__PURE__ */
|
|
1346
|
+
/* @__PURE__ */ jsxs("label", {
|
|
1495
1347
|
className: "field",
|
|
1496
|
-
children: [/* @__PURE__ */
|
|
1348
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
1497
1349
|
className: "label",
|
|
1498
1350
|
children: "File contents"
|
|
1499
|
-
}), /* @__PURE__ */
|
|
1351
|
+
}), /* @__PURE__ */ jsx("textarea", {
|
|
1500
1352
|
className: "textarea",
|
|
1501
1353
|
autoFocus: true,
|
|
1502
1354
|
spellCheck: false,
|
|
@@ -1509,62 +1361,62 @@ function ImportEnv({ project, environment }) {
|
|
|
1509
1361
|
}
|
|
1510
1362
|
})]
|
|
1511
1363
|
}),
|
|
1512
|
-
plan !== null && plan.entries.length > 0 && /* @__PURE__ */
|
|
1364
|
+
plan !== null && plan.entries.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
1513
1365
|
className: "card dt-wrap",
|
|
1514
|
-
children: /* @__PURE__ */
|
|
1366
|
+
children: /* @__PURE__ */ jsxs("table", {
|
|
1515
1367
|
className: "dt",
|
|
1516
|
-
children: [/* @__PURE__ */
|
|
1517
|
-
/* @__PURE__ */
|
|
1518
|
-
/* @__PURE__ */
|
|
1368
|
+
children: [/* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
1369
|
+
/* @__PURE__ */ jsx("th", { children: "Key" }),
|
|
1370
|
+
/* @__PURE__ */ jsx("th", {
|
|
1519
1371
|
className: "col-shrink",
|
|
1520
1372
|
children: "Plan"
|
|
1521
1373
|
}),
|
|
1522
|
-
/* @__PURE__ */
|
|
1374
|
+
/* @__PURE__ */ jsx("th", {
|
|
1523
1375
|
className: "col-shrink",
|
|
1524
1376
|
children: "Current"
|
|
1525
1377
|
})
|
|
1526
|
-
] }) }), /* @__PURE__ */
|
|
1527
|
-
/* @__PURE__ */
|
|
1378
|
+
] }) }), /* @__PURE__ */ jsx("tbody", { children: plan.entries.map((entry) => /* @__PURE__ */ jsxs("tr", { children: [
|
|
1379
|
+
/* @__PURE__ */ jsx("td", {
|
|
1528
1380
|
className: "cell-key",
|
|
1529
1381
|
children: breakAfterUnderscores(entry.key)
|
|
1530
1382
|
}),
|
|
1531
|
-
/* @__PURE__ */
|
|
1383
|
+
/* @__PURE__ */ jsx("td", {
|
|
1532
1384
|
className: "col-shrink",
|
|
1533
|
-
children: /* @__PURE__ */
|
|
1385
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
1534
1386
|
className: PLAN_TAG[entry.action],
|
|
1535
1387
|
children: entry.action
|
|
1536
1388
|
})
|
|
1537
1389
|
}),
|
|
1538
|
-
/* @__PURE__ */
|
|
1390
|
+
/* @__PURE__ */ jsx("td", {
|
|
1539
1391
|
className: "col-shrink cell-mono cell-muted",
|
|
1540
1392
|
children: entry.version === null ? "—" : `v${entry.version}`
|
|
1541
1393
|
})
|
|
1542
1394
|
] }, entry.key)) })]
|
|
1543
1395
|
})
|
|
1544
1396
|
}),
|
|
1545
|
-
plan !== null && plan.entries.length > 0 && changes.length === 0 && /* @__PURE__ */
|
|
1397
|
+
plan !== null && plan.entries.length > 0 && changes.length === 0 && /* @__PURE__ */ jsx(Notice, {
|
|
1546
1398
|
tone: "good",
|
|
1547
1399
|
children: "Every key already has this value. There is nothing to write."
|
|
1548
1400
|
}),
|
|
1549
|
-
problems.length > 0 && /* @__PURE__ */
|
|
1401
|
+
problems.length > 0 && /* @__PURE__ */ jsxs(Notice, {
|
|
1550
1402
|
tone: "bad",
|
|
1551
|
-
children: [/* @__PURE__ */
|
|
1403
|
+
children: [/* @__PURE__ */ jsxs("strong", { children: [
|
|
1552
1404
|
problems.length,
|
|
1553
1405
|
" line",
|
|
1554
1406
|
problems.length === 1 ? "" : "s",
|
|
1555
1407
|
" could not be parsed"
|
|
1556
|
-
] }), /* @__PURE__ */
|
|
1408
|
+
] }), /* @__PURE__ */ jsx("ul", {
|
|
1557
1409
|
style: {
|
|
1558
1410
|
margin: "0.375rem 0 0",
|
|
1559
1411
|
paddingLeft: "1.1rem"
|
|
1560
1412
|
},
|
|
1561
|
-
children: problems.map((problem) => /* @__PURE__ */
|
|
1413
|
+
children: problems.map((problem) => /* @__PURE__ */ jsxs("li", { children: [
|
|
1562
1414
|
"Line ",
|
|
1563
1415
|
problem.line,
|
|
1564
1416
|
": ",
|
|
1565
1417
|
problem.reason,
|
|
1566
1418
|
" ",
|
|
1567
|
-
/* @__PURE__ */
|
|
1419
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1568
1420
|
className: "mono",
|
|
1569
1421
|
children: [
|
|
1570
1422
|
"(",
|
|
@@ -1575,24 +1427,24 @@ function ImportEnv({ project, environment }) {
|
|
|
1575
1427
|
] }, problem.line))
|
|
1576
1428
|
})]
|
|
1577
1429
|
}),
|
|
1578
|
-
/* @__PURE__ */
|
|
1579
|
-
/* @__PURE__ */
|
|
1430
|
+
/* @__PURE__ */ jsx(ErrorLine, { error }),
|
|
1431
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1580
1432
|
className: "dialog-actions",
|
|
1581
|
-
children: [/* @__PURE__ */
|
|
1433
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
1582
1434
|
className: "btn",
|
|
1583
1435
|
onClick: close,
|
|
1584
1436
|
children: "Cancel"
|
|
1585
|
-
}), plan === null ? /* @__PURE__ */
|
|
1437
|
+
}), plan === null ? /* @__PURE__ */ jsxs("button", {
|
|
1586
1438
|
className: "btn btn-primary",
|
|
1587
1439
|
disabled: pending || content.trim() === "",
|
|
1588
1440
|
onClick: preview,
|
|
1589
|
-
children: [pending && /* @__PURE__ */
|
|
1590
|
-
}) : /* @__PURE__ */
|
|
1441
|
+
children: [pending && /* @__PURE__ */ jsx(Spinner, {}), "Preview changes"]
|
|
1442
|
+
}) : /* @__PURE__ */ jsxs("button", {
|
|
1591
1443
|
className: "btn btn-primary",
|
|
1592
1444
|
disabled: pending || changes.length === 0,
|
|
1593
1445
|
onClick: apply,
|
|
1594
1446
|
children: [
|
|
1595
|
-
pending && /* @__PURE__ */
|
|
1447
|
+
pending && /* @__PURE__ */ jsx(Spinner, {}),
|
|
1596
1448
|
"Write ",
|
|
1597
1449
|
changes.length,
|
|
1598
1450
|
" change",
|
|
@@ -1605,4 +1457,6 @@ function ImportEnv({ project, environment }) {
|
|
|
1605
1457
|
})] });
|
|
1606
1458
|
}
|
|
1607
1459
|
//#endregion
|
|
1608
|
-
export { EnvironmentPage
|
|
1460
|
+
export { EnvironmentPage };
|
|
1461
|
+
|
|
1462
|
+
//# sourceMappingURL=environment.js.map
|