@coffre/ui 0.1.9 → 0.1.11
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/dist/client/_coffre/assets/account-BJAdDvZf.js +2 -0
- package/dist/client/_coffre/assets/account-D0jLpk5c.js +1 -0
- package/dist/client/_coffre/assets/affordances-Bq2-oUB5.js +1 -0
- package/dist/client/_coffre/assets/audit-C-pcBgKe.js +2 -0
- package/dist/client/_coffre/assets/audit-CHGlDeBB.js +1 -0
- package/dist/client/_coffre/assets/{auth.device--rDR2F8w.js → auth.device-BndOUjse.js} +1 -1
- package/dist/client/_coffre/assets/auth.device-CWHNQn9W.js +2 -0
- package/dist/client/_coffre/assets/directory-nDExpkAz.js +1 -0
- package/dist/client/_coffre/assets/dist-QVHMLatb.js +1 -0
- package/dist/client/_coffre/assets/globals-CKBoTlyH.css +1 -0
- package/dist/client/_coffre/assets/grants-CjoOnxzz.js +1 -0
- package/dist/client/_coffre/assets/icons-BQ27Ds9u.js +1 -0
- package/dist/client/_coffre/assets/index-CUGytaO3.js +12 -0
- package/dist/client/_coffre/assets/link-DP8SVWon.js +1 -0
- package/dist/client/_coffre/assets/login-CeaxDMcr.js +2 -0
- package/dist/client/_coffre/assets/login-DrMgvqZn.js +1 -0
- package/dist/client/_coffre/assets/offboarding-CNr_1tnl.js +1 -0
- package/dist/client/_coffre/assets/page-CGmvjSy4.js +1 -0
- package/dist/client/_coffre/assets/preload-helper-ClBkJ19f.js +1 -0
- package/dist/client/_coffre/assets/principal-page-DNLb_q_e.js +1 -0
- package/dist/client/_coffre/assets/projects._project._environment-CHzbboGp.js +3 -0
- package/dist/client/_coffre/assets/projects._project._environment-DDxu_HHD.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-CIAsjvg6.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-DZ9l6d-1.js +1 -0
- package/dist/client/_coffre/assets/projects.index-4eUXreE_.js +1 -0
- package/dist/client/_coffre/assets/row-state-ByET1OKX.js +1 -0
- package/dist/client/_coffre/assets/settings-D2zp1Ssu.js +1 -0
- package/dist/client/_coffre/assets/suspense-C7KwSnTG.js +1 -0
- package/dist/client/_coffre/assets/tokens._token-DWmbqzNk.js +2 -0
- package/dist/client/_coffre/assets/tokens._token-Dui_4KfS.js +1 -0
- package/dist/client/_coffre/assets/tokens.index-CSi5Wxwf.js +1 -0
- package/dist/client/_coffre/assets/ui-BdipqGpP.js +46 -0
- package/dist/client/_coffre/assets/unregistered-CA7B4C1m.js +1 -0
- package/dist/client/_coffre/assets/use-action-DRm9yVhV.js +1 -0
- package/dist/client/_coffre/assets/use-change-BRRMJocl.js +1 -0
- package/dist/client/_coffre/assets/use-shell-BMGlJ25Q.js +1 -0
- package/dist/client/_coffre/assets/useQuery-D__2KBOs.js +1 -0
- package/dist/client/_coffre/assets/useSuspenseQuery-CSXyDALB.js +1 -0
- package/dist/client/_coffre/assets/users._user-BkNrX7Qf.js +1 -0
- package/dist/client/_coffre/assets/users._user-jbSvtdOg.js +2 -0
- package/dist/client/_coffre/assets/users.index-CKnQ1G76.js +1 -0
- package/dist/server/.vite/manifest.json +343 -246
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-Dx-c3XVk.js +162 -0
- package/dist/server/_coffre/assets/{account-CZgVVZTf.js → account-BocTPU1J.js} +150 -117
- package/dist/server/_coffre/assets/{account-D7-ZAE2T.js → account-CL8hOGhO.js} +10 -24
- package/dist/server/_coffre/assets/{affordances-BNaXjMOb.js → affordances-CKANXDTG.js} +2 -22
- package/dist/server/_coffre/assets/{async-local-storage-C0cwgkEr.js → async-local-storage-C10uQtMM.js} +3 -2
- package/dist/server/_coffre/assets/{audit-BEbhtsEp.js → audit-Bcka4vA6.js} +46 -16
- package/dist/server/_coffre/assets/audit-CSRQYIhu.js +31 -0
- package/dist/server/_coffre/assets/{auth.device-w9N3FlNk.js → auth.device-CMcUISZY.js} +7 -5
- package/dist/server/_coffre/assets/{auth.device-CMR3csAI.js → auth.device-DqO0T-rU.js} +5 -5
- package/dist/server/_coffre/assets/{directory-Dr5X9TB5.js → directory-CyYx6Jx1.js} +87 -112
- package/dist/server/_coffre/assets/{use-action-DQUmeH-5.js → dist-CnnV3t2g.js} +3 -48
- package/dist/server/_coffre/assets/globals-CKBoTlyH.css +1 -0
- package/dist/server/_coffre/assets/grants-CRijabX0.js +158 -0
- package/dist/server/_coffre/assets/{page-BdnhpwvH.js → icons-Dy-5ccDF.js} +3 -196
- package/dist/server/_coffre/assets/lazyRouteComponent-CqBNCGuZ.js +480 -0
- package/dist/server/_coffre/assets/link-42ZWdjzZ.js +422 -0
- package/dist/server/_coffre/assets/{login-DUtCQju5.js → login-BI9tzJEy.js} +7 -5
- package/dist/server/_coffre/assets/{login-B2njIq_o.js → login-C-v88YwP.js} +2 -2
- package/dist/server/_coffre/assets/matchContext-qLfYbC6_.js +56 -0
- package/dist/server/_coffre/assets/{offboarding-DY5MarpG.js → offboarding-1H0LavTd.js} +6 -4
- package/dist/server/_coffre/assets/page-D_mO0-sn.js +3592 -0
- package/dist/server/_coffre/assets/{principal-page-SdG8_zcu.js → principal-page-DQDoXute.js} +51 -42
- package/dist/server/_coffre/assets/{projects._project._environment-CUS0VFUe.js → projects._project._environment-C-yVwC92.js} +168 -248
- package/dist/server/_coffre/assets/{projects._project._environment-BQIrmE3r.js → projects._project._environment-D_5R40of.js} +4 -11
- package/dist/server/_coffre/assets/{projects._project.index-D1NxvBtZ.js → projects._project.index-A2BImFIT.js} +134 -96
- package/dist/server/_coffre/assets/{projects._project.index-BjNdR4KC.js → projects._project.index-BPPKxKrt.js} +5 -4
- package/dist/server/_coffre/assets/{projects.index-BQDuuh6t.js → projects.index-543IsPzY.js} +62 -54
- package/dist/server/_coffre/assets/{react-dom-qCTiwGGR.js → react-dom-bBoJXlK2.js} +417 -51
- package/dist/server/_coffre/assets/{router-BUwZOXEH.js → router-CM3vK8QO.js} +376 -92
- package/dist/server/_coffre/assets/row-state-XBtDoIA4.js +117 -0
- package/dist/server/_coffre/assets/{settings-HOErM3pd.js → settings-BLVU74ym.js} +8 -6
- package/dist/server/_coffre/assets/suspense-CzYTwxOj.js +602 -0
- package/dist/server/_coffre/assets/tokens._token-B-hBgwBW.js +10 -0
- package/dist/server/_coffre/assets/{tokens._token-BZUArbzi.js → tokens._token-aubAUonP.js} +97 -79
- package/dist/server/_coffre/assets/{tokens.index-BReCgoV9.js → tokens.index-4D3jwp5v.js} +9 -6
- package/dist/server/_coffre/assets/{ui-D_slKpSF.js → ui-BI3Bf72q.js} +7 -836
- package/dist/server/_coffre/assets/{unregistered-Z17da4Rc.js → unregistered-CagDxMyw.js} +5 -3
- package/dist/server/_coffre/assets/use-action-tzBZvjjQ.js +47 -0
- package/dist/server/_coffre/assets/use-change-Dggqxy5y.js +1212 -0
- package/dist/server/_coffre/assets/use-shell-CwStDfzX.js +462 -0
- package/dist/server/_coffre/assets/useQuery-C6_dBjem.js +8 -0
- package/dist/server/_coffre/assets/{useStore-DWGPqzXR.js → useRouter-CaUSUNsw.js} +1 -420
- package/dist/server/_coffre/assets/useSuspenseQuery-BuapQt_P.js +117 -0
- package/dist/server/_coffre/assets/{users._user-DHTNhQ9o.js → users._user-137WNyxn.js} +4 -5
- package/dist/server/_coffre/assets/users._user-C252Iilj.js +10 -0
- package/dist/server/_coffre/assets/{users.index-Cfo3ODpX.js → users.index-DQHsfnal.js} +9 -6
- package/dist/server/index.js +6 -5
- package/package.json +5 -3
- package/src/components/directory.tsx +75 -104
- package/src/components/grants.tsx +60 -112
- package/src/components/principal-page.tsx +54 -67
- package/src/components/principal-picker.tsx +7 -16
- package/src/components/row-state.tsx +95 -0
- package/src/components/service-tokens.tsx +75 -64
- package/src/components/shell.tsx +1 -1
- package/src/components/syncs.tsx +42 -26
- package/src/lib/announce.ts +36 -0
- package/src/lib/changes.ts +498 -0
- package/src/lib/coffre.ts +3 -2
- package/src/lib/optimistic.ts +233 -0
- package/src/lib/queries.ts +393 -0
- package/src/lib/use-action.ts +20 -15
- package/src/lib/use-change.ts +42 -0
- package/src/lib/use-shell.ts +17 -0
- package/src/router.tsx +17 -9
- package/src/routes/__root.tsx +8 -38
- package/src/routes/account.tsx +163 -154
- package/src/routes/audit.tsx +51 -72
- package/src/routes/auth.device.tsx +4 -2
- package/src/routes/login.tsx +3 -2
- package/src/routes/projects.$project.$environment.tsx +226 -231
- package/src/routes/projects.$project.index.tsx +136 -118
- package/src/routes/projects.index.tsx +125 -145
- package/src/routes/settings.tsx +7 -7
- package/src/routes/tokens.$token.tsx +14 -17
- package/src/routes/tokens.index.tsx +8 -4
- package/src/routes/unregistered.tsx +3 -2
- package/src/routes/users.$user.tsx +4 -4
- package/src/routes/users.index.tsx +8 -4
- package/src/styles/globals.css +78 -1
- package/dist/client/_coffre/assets/account-C3rBPdu6.js +0 -2
- package/dist/client/_coffre/assets/account-J194gi6l.js +0 -1
- package/dist/client/_coffre/assets/affordances-CmoY-8Xf.js +0 -1
- package/dist/client/_coffre/assets/audit-BtI9em7Q.js +0 -2
- package/dist/client/_coffre/assets/audit-jURfT8Km.js +0 -1
- package/dist/client/_coffre/assets/auth.device-viDUwZRT.js +0 -2
- package/dist/client/_coffre/assets/coffre-CXkp3Efg.js +0 -1
- package/dist/client/_coffre/assets/directory-PEjdb8PS.js +0 -1
- package/dist/client/_coffre/assets/globals-Bh2x1gBM.css +0 -1
- package/dist/client/_coffre/assets/grants-4mSkXPU4.js +0 -1
- package/dist/client/_coffre/assets/index-CD7bvUCb.js +0 -12
- package/dist/client/_coffre/assets/login-C-wTm_t1.js +0 -2
- package/dist/client/_coffre/assets/login-CLLv1om9.js +0 -1
- package/dist/client/_coffre/assets/offboarding-DQ-56W0H.js +0 -1
- package/dist/client/_coffre/assets/page-DbSS7pYH.js +0 -1
- package/dist/client/_coffre/assets/preload-helper-DduCCcmc.js +0 -46
- package/dist/client/_coffre/assets/principal-page-DjH1cUyz.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-BZnNvENc.js +0 -3
- package/dist/client/_coffre/assets/projects._project._environment-CLUpTvi-.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-CWXRo307.js +0 -2
- package/dist/client/_coffre/assets/projects._project.index-Dzgf95zv.js +0 -1
- package/dist/client/_coffre/assets/projects.index-BG8W91BX.js +0 -2
- package/dist/client/_coffre/assets/projects.index-N_kCFBMq.js +0 -1
- package/dist/client/_coffre/assets/settings-CNIY0--5.js +0 -1
- package/dist/client/_coffre/assets/settings-EimGqlQL.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-CkU4dCwo.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-Df2R8TF_.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-CSf5Mlz8.js +0 -2
- package/dist/client/_coffre/assets/tokens.index-DtiWrKVq.js +0 -1
- package/dist/client/_coffre/assets/unregistered-D5go1AfR.js +0 -1
- package/dist/client/_coffre/assets/use-action-CUvWPRTx.js +0 -1
- package/dist/client/_coffre/assets/users._user-CImGVpYj.js +0 -1
- package/dist/client/_coffre/assets/users._user-D0JK911L.js +0 -2
- package/dist/client/_coffre/assets/users.index-B-7o0KBD.js +0 -1
- package/dist/client/_coffre/assets/users.index-BoFWF3mF.js +0 -2
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-CrnrBINO.js +0 -133
- package/dist/server/_coffre/assets/audit-wjpo1BWg.js +0 -74
- package/dist/server/_coffre/assets/coffre-DMs96kfX.js +0 -280
- package/dist/server/_coffre/assets/globals-Bh2x1gBM.css +0 -1
- package/dist/server/_coffre/assets/grants-C6UmWE8b.js +0 -243
- package/dist/server/_coffre/assets/projects.index-ha7jO4nC.js +0 -54
- package/dist/server/_coffre/assets/settings-Cy__khNA.js +0 -18
- package/dist/server/_coffre/assets/tokens._token-CmpmtfB_.js +0 -18
- package/dist/server/_coffre/assets/tokens.index-B5-4dD4C.js +0 -10
- package/dist/server/_coffre/assets/users._user-BKdSQhIg.js +0 -10
- package/dist/server/_coffre/assets/users.index-dMn0tlmc.js +0 -10
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { r as
|
|
6
|
-
import {
|
|
7
|
-
import { t as
|
|
1
|
+
import { i as require_react, r as require_jsx_runtime, s as __toESM } from "./useRouter-CaUSUNsw.js";
|
|
2
|
+
import { t as Link } from "./link-42ZWdjzZ.js";
|
|
3
|
+
import { C as useCoffre, G as initialValues, H as configFromForm, K as isAsked, S as uiResult, V as CoffreError, W as firstMissing, c as keys, g as refresh, h as queries, i as PageHeader, n as ClosedDoor, o as affects, q as planImport, t as Card, w as canRevealSecrets, y as failureMessage } from "./page-D_mO0-sn.js";
|
|
4
|
+
import { f as useQueryClient } from "./suspense-CzYTwxOj.js";
|
|
5
|
+
import { C as hasSecretEditConflict, a as archiveSecret, n as useChangeStatus, r as UnsavedEdits, t as useChange, v as restoreSecret, w as secretChangeFor, x as saveSecrets } from "./use-change-Dggqxy5y.js";
|
|
6
|
+
import { t as useShell } from "./use-shell-CwStDfzX.js";
|
|
7
|
+
import { t as useSuspenseQuery } from "./useSuspenseQuery-BuapQt_P.js";
|
|
8
|
+
import { n as toast } from "./dist-CnnV3t2g.js";
|
|
9
|
+
import { a as ErrorLine, c as Spinner, d as Toggletip, h as dropdown_menu_exports, i as EmptyState, l as Timestamp, n as ConfirmDialog, o as Modal, p as breakAfterUnderscores, r as CopyButton, s as Notice, t as ConfirmButton, u as Tip } from "./ui-BI3Bf72q.js";
|
|
10
|
+
import { i as SecretReadOnly } from "./affordances-CKANXDTG.js";
|
|
11
|
+
import { A as Pencil, D as MoreHorizontal, F as Search, H as SyncMark, J as X, M as Plus, P as RotateBack, S as Lock, U as Terminal, V as Sync, W as Upload, d as Eye, f as EyeOff, g as History, h as Hash, i as Archive, j as Play, k as Pause, l as Clock, n as AlertCircle, r as AlertTriangle, v as Key } from "./icons-Dy-5ccDF.js";
|
|
12
|
+
import { a as rowClass, i as RowPending, r as RowFailure } from "./row-state-XBtDoIA4.js";
|
|
13
|
+
import { t as Route } from "./projects._project._environment-D_5R40of.js";
|
|
14
|
+
import { t as useAction } from "./use-action-tzBZvjjQ.js";
|
|
8
15
|
import { t as secretKeyProblem } from "./validation-BQtqPe2V.js";
|
|
9
16
|
//#region ../core/dist/dotenv.js
|
|
10
17
|
var KEY_RE = /^[A-Za-z_][A-Za-z0-9_]{0,127}$/;
|
|
@@ -153,127 +160,8 @@ function unescapeDoubleQuoted(text) {
|
|
|
153
160
|
});
|
|
154
161
|
}
|
|
155
162
|
//#endregion
|
|
156
|
-
//#region src/lib/secret-edit-batch.ts
|
|
157
|
-
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
158
|
-
function secretChangeFor(changes, key) {
|
|
159
|
-
return Object.hasOwn(changes, key) ? changes[key] : void 0;
|
|
160
|
-
}
|
|
161
|
-
/** Return true when one save would give two pending edits the same target. */
|
|
162
|
-
function hasSecretEditConflict(active, drafts, changes) {
|
|
163
|
-
const finalActiveKeys = active.filter((entry) => !secretChangeFor(changes, entry.key)?.archived).map((entry) => secretChangeFor(changes, entry.key)?.key.trim() ?? entry.key);
|
|
164
|
-
if (new Set(finalActiveKeys).size !== finalActiveKeys.length) return true;
|
|
165
|
-
const draftKeys = drafts.map((draft) => draft.key.trim());
|
|
166
|
-
if (new Set(draftKeys).size !== draftKeys.length) return true;
|
|
167
|
-
const valueEditTargets = new Set(active.flatMap((entry) => {
|
|
168
|
-
const change = secretChangeFor(changes, entry.key);
|
|
169
|
-
return change !== void 0 && !change.archived && change.value !== null ? [change.key.trim()] : [];
|
|
170
|
-
}));
|
|
171
|
-
if (draftKeys.some((key) => valueEditTargets.has(key))) return true;
|
|
172
|
-
const archivedKeys = new Set(active.filter((entry) => secretChangeFor(changes, entry.key)?.archived).map((entry) => entry.key));
|
|
173
|
-
return draftKeys.some((key) => archivedKeys.has(key));
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Save every pending edit: renames first, one call each, then everything else
|
|
177
|
-
* as one merge patch.
|
|
178
|
-
*
|
|
179
|
-
* The patch is a single transaction, so values, new keys and archives land
|
|
180
|
-
* together or not at all. Renames cannot join it: a merge patch names keys and
|
|
181
|
-
* has no way to move one with its history. A failed rename therefore stops the
|
|
182
|
-
* save before the patch. The renames before it stay done, and every other edit
|
|
183
|
-
* is kept for the retry, a value following its key to the new name.
|
|
184
|
-
*/
|
|
185
|
-
async function applySecretEditBatch({ active, drafts, changes, operations }) {
|
|
186
|
-
const remainingChanges = { ...changes };
|
|
187
|
-
const plan = planEdits(active, drafts, changes);
|
|
188
|
-
if (plan instanceof Error) return {
|
|
189
|
-
applied: 0,
|
|
190
|
-
drafts: [...drafts],
|
|
191
|
-
changes: remainingChanges,
|
|
192
|
-
error: plan
|
|
193
|
-
};
|
|
194
|
-
let applied = 0;
|
|
195
|
-
const patch = Object.create(null);
|
|
196
|
-
try {
|
|
197
|
-
for (const { sourceKey, change } of plan) {
|
|
198
|
-
if (change.archived) {
|
|
199
|
-
patch[sourceKey] = null;
|
|
200
|
-
continue;
|
|
201
|
-
}
|
|
202
|
-
const key = change.key.trim();
|
|
203
|
-
if (key !== sourceKey) {
|
|
204
|
-
await operations.rename(sourceKey, key);
|
|
205
|
-
delete remainingChanges[sourceKey];
|
|
206
|
-
applied += 1;
|
|
207
|
-
if (change.value !== null) remainingChanges[key] = {
|
|
208
|
-
key,
|
|
209
|
-
value: change.value,
|
|
210
|
-
archived: false
|
|
211
|
-
};
|
|
212
|
-
}
|
|
213
|
-
if (change.value !== null) patch[key] = change.value;
|
|
214
|
-
}
|
|
215
|
-
for (const draft of drafts) patch[draft.key.trim()] = draft.value;
|
|
216
|
-
const written = Object.keys(patch).length;
|
|
217
|
-
if (written > 0) await operations.write({ ...patch });
|
|
218
|
-
return {
|
|
219
|
-
applied: applied + written,
|
|
220
|
-
drafts: [],
|
|
221
|
-
changes: {},
|
|
222
|
-
error: null
|
|
223
|
-
};
|
|
224
|
-
} catch (error) {
|
|
225
|
-
return {
|
|
226
|
-
applied,
|
|
227
|
-
drafts: [...drafts],
|
|
228
|
-
changes: remainingChanges,
|
|
229
|
-
error
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
/**
|
|
234
|
-
* Put dependent renames in an order that frees each destination first.
|
|
235
|
-
* Cycles and archive-then-restore plans fail before the first mutation.
|
|
236
|
-
*/
|
|
237
|
-
function planEdits(active, drafts, changes) {
|
|
238
|
-
const activeKeys = new Set(active.map((entry) => entry.key));
|
|
239
|
-
const archivedKeys = new Set(active.filter((entry) => secretChangeFor(changes, entry.key)?.archived).map((entry) => entry.key));
|
|
240
|
-
const restoredByDraft = drafts.find((draft) => archivedKeys.has(draft.key.trim()));
|
|
241
|
-
if (restoredByDraft) return /* @__PURE__ */ new Error(`${restoredByDraft.key.trim()}: cannot archive and write the same key in one save`);
|
|
242
|
-
const renames = /* @__PURE__ */ new Map();
|
|
243
|
-
const otherEdits = [];
|
|
244
|
-
for (const entry of active) {
|
|
245
|
-
const change = secretChangeFor(changes, entry.key);
|
|
246
|
-
if (change === void 0) continue;
|
|
247
|
-
if (!change.archived && change.key.trim() !== entry.key) renames.set(entry.key, change);
|
|
248
|
-
else otherEdits.push({
|
|
249
|
-
sourceKey: entry.key,
|
|
250
|
-
change
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
for (const [sourceKey, change] of renames) {
|
|
254
|
-
const destination = change.key.trim();
|
|
255
|
-
if (activeKeys.has(destination) && !renames.has(destination)) return /* @__PURE__ */ new Error(`${sourceKey}: ${destination} is already in use`);
|
|
256
|
-
}
|
|
257
|
-
const orderedRenames = [];
|
|
258
|
-
const freedKeys = /* @__PURE__ */ new Set();
|
|
259
|
-
while (renames.size > 0) {
|
|
260
|
-
const ready = [...renames].find(([, change]) => {
|
|
261
|
-
const destination = change.key.trim();
|
|
262
|
-
return !activeKeys.has(destination) || freedKeys.has(destination);
|
|
263
|
-
});
|
|
264
|
-
if (!ready) return /* @__PURE__ */ new Error("Secret renames contain a cycle. Save them in separate steps.");
|
|
265
|
-
const [sourceKey, change] = ready;
|
|
266
|
-
renames.delete(sourceKey);
|
|
267
|
-
freedKeys.add(sourceKey);
|
|
268
|
-
orderedRenames.push({
|
|
269
|
-
sourceKey,
|
|
270
|
-
change
|
|
271
|
-
});
|
|
272
|
-
}
|
|
273
|
-
return [...orderedRenames, ...otherEdits];
|
|
274
|
-
}
|
|
275
|
-
//#endregion
|
|
276
163
|
//#region src/lib/reveal.ts
|
|
164
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
277
165
|
function revealIsCurrent(reveal, currentVersion) {
|
|
278
166
|
return reveal !== null && reveal.version === currentVersion;
|
|
279
167
|
}
|
|
@@ -290,14 +178,15 @@ var FIRST_RUN_WAIT_MS = 6e4;
|
|
|
290
178
|
* Hidden from people who can neither see a sync nor add one; everyone who can
|
|
291
179
|
* write a secret sees them, since saving one sends it on.
|
|
292
180
|
*/
|
|
293
|
-
function Syncs({ project, environment,
|
|
294
|
-
const
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
181
|
+
function Syncs({ project, environment, canRun }) {
|
|
182
|
+
const place = {
|
|
183
|
+
project,
|
|
184
|
+
environment
|
|
185
|
+
};
|
|
186
|
+
const { data: result } = useSuspenseQuery({
|
|
187
|
+
...queries.syncs(useCoffre(), place),
|
|
188
|
+
refetchInterval: (query) => query.state.data?.ok === true && query.state.data.syncs.some((sync) => sync.running) ? RUNNING_POLL_MS : false
|
|
189
|
+
});
|
|
301
190
|
if (result.ok && result.syncs.length === 0 && !result.canManage) return null;
|
|
302
191
|
const canManage = result.ok && result.canManage;
|
|
303
192
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
@@ -340,6 +229,7 @@ function Syncs({ project, environment, result, canRun }) {
|
|
|
340
229
|
})
|
|
341
230
|
})
|
|
342
231
|
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: result.syncs.map((sync) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SyncRow, {
|
|
232
|
+
place,
|
|
343
233
|
sync,
|
|
344
234
|
canRun,
|
|
345
235
|
canManage
|
|
@@ -348,7 +238,7 @@ function Syncs({ project, environment, result, canRun }) {
|
|
|
348
238
|
})
|
|
349
239
|
});
|
|
350
240
|
}
|
|
351
|
-
function SyncRow({ sync, canRun, canManage }) {
|
|
241
|
+
function SyncRow({ place, sync, canRun, canManage }) {
|
|
352
242
|
const [removing, setRemoving] = (0, import_react.useState)(false);
|
|
353
243
|
const coffre = useCoffre();
|
|
354
244
|
const pushing = useAction();
|
|
@@ -356,13 +246,19 @@ function SyncRow({ sync, canRun, canManage }) {
|
|
|
356
246
|
const pending = pushing.pending || managing.pending;
|
|
357
247
|
const error = pushing.error ?? managing.error;
|
|
358
248
|
function runNow() {
|
|
359
|
-
pushing.run(() => coffre.syncs.run(sync.id),
|
|
249
|
+
pushing.run(() => coffre.syncs.run(sync.id), {
|
|
250
|
+
affects: affects.syncs(place),
|
|
251
|
+
onSuccess: (result) => announce(sync, result.outcome)
|
|
252
|
+
});
|
|
360
253
|
}
|
|
361
254
|
function setPaused(paused) {
|
|
362
|
-
managing.run(() => coffre.syncs.update(sync.id, { paused }),
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
255
|
+
managing.run(() => coffre.syncs.update(sync.id, { paused }), {
|
|
256
|
+
affects: affects.syncs(place),
|
|
257
|
+
onSuccess: () => toast.success(paused ? `Paused ${sync.destination}` : `Resumed ${sync.destination}`, { action: {
|
|
258
|
+
label: "Undo",
|
|
259
|
+
onClick: () => setPaused(!paused)
|
|
260
|
+
} })
|
|
261
|
+
});
|
|
366
262
|
}
|
|
367
263
|
const shownError = error ?? (sync.offered ? sync.lastError : null);
|
|
368
264
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
|
|
@@ -444,7 +340,10 @@ function SyncRow({ sync, canRun, canManage }) {
|
|
|
444
340
|
] }),
|
|
445
341
|
body: `Nothing more is pushed to ${sync.providerLabel}. Keys coffre already pushed stay there; remove them at ${sync.providerLabel} if they should go too.`,
|
|
446
342
|
confirmLabel: "Remove sync",
|
|
447
|
-
onConfirm: () => managing.run(() => coffre.syncs.remove(sync.id),
|
|
343
|
+
onConfirm: () => managing.run(() => coffre.syncs.remove(sync.id), {
|
|
344
|
+
affects: affects.syncs(place),
|
|
345
|
+
onSuccess: () => toast.success(`No longer syncing to ${sync.destination}`)
|
|
346
|
+
})
|
|
448
347
|
})]
|
|
449
348
|
})
|
|
450
349
|
]
|
|
@@ -645,7 +544,7 @@ function AddSyncForm({ project, environment, providers, onDone }) {
|
|
|
645
544
|
const [values, setValues] = (0, import_react.useState)(() => initialValues(providers[0]));
|
|
646
545
|
const [credential, setCredential] = (0, import_react.useState)("");
|
|
647
546
|
const coffre = useCoffre();
|
|
648
|
-
const
|
|
547
|
+
const queryClient = useQueryClient();
|
|
649
548
|
const { pending, error, setError, run } = useAction();
|
|
650
549
|
const missing = firstMissing(provider, values);
|
|
651
550
|
function pick(next) {
|
|
@@ -668,9 +567,18 @@ function AddSyncForm({ project, environment, providers, onDone }) {
|
|
|
668
567
|
provider: provider.id,
|
|
669
568
|
config: configFromForm(provider, values),
|
|
670
569
|
credential: credential.trim()
|
|
671
|
-
}),
|
|
672
|
-
|
|
673
|
-
|
|
570
|
+
}), {
|
|
571
|
+
affects: affects.syncs({
|
|
572
|
+
project,
|
|
573
|
+
environment
|
|
574
|
+
}),
|
|
575
|
+
onSuccess: (sync) => {
|
|
576
|
+
onDone();
|
|
577
|
+
followFirstRun(coffre, `${project}/${environment}`, sync, () => refresh(queryClient, affects.syncs({
|
|
578
|
+
project,
|
|
579
|
+
environment
|
|
580
|
+
})));
|
|
581
|
+
}
|
|
674
582
|
});
|
|
675
583
|
},
|
|
676
584
|
children: [
|
|
@@ -802,8 +710,11 @@ function AddSyncForm({ project, environment, providers, onDone }) {
|
|
|
802
710
|
*/
|
|
803
711
|
var REVEAL_TTL_SECONDS = 45;
|
|
804
712
|
function EnvironmentPage() {
|
|
805
|
-
const { keys: result, syncs } = Route.useLoaderData();
|
|
806
713
|
const { project, environment } = Route.useParams();
|
|
714
|
+
const { data: result } = useSuspenseQuery(queries.secrets(useCoffre(), {
|
|
715
|
+
project,
|
|
716
|
+
environment
|
|
717
|
+
}));
|
|
807
718
|
if (!result.ok) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClosedDoor, {
|
|
808
719
|
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Lock, { size: 18 }),
|
|
809
720
|
label: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
@@ -827,27 +738,40 @@ function EnvironmentPage() {
|
|
|
827
738
|
project,
|
|
828
739
|
environment,
|
|
829
740
|
permissions: result.permissions,
|
|
830
|
-
keys: result.keys
|
|
831
|
-
syncs
|
|
741
|
+
keys: result.keys
|
|
832
742
|
}, `${project}/${environment}`);
|
|
833
743
|
}
|
|
834
|
-
function EnvironmentLedger({ project, environment, permissions, keys
|
|
835
|
-
const router = useRouter();
|
|
744
|
+
function EnvironmentLedger({ project, environment, permissions, keys: keys$1 }) {
|
|
836
745
|
const coffre = useCoffre();
|
|
837
|
-
const
|
|
746
|
+
const { principal } = useShell();
|
|
747
|
+
const save = useChange(saveSecrets(coffre, {
|
|
748
|
+
project,
|
|
749
|
+
environment
|
|
750
|
+
}, principal?.id ?? null));
|
|
751
|
+
const restore = useChange(restoreSecret(coffre, {
|
|
752
|
+
project,
|
|
753
|
+
environment
|
|
754
|
+
}));
|
|
755
|
+
const archive = useChange(archiveSecret(coffre, {
|
|
756
|
+
project,
|
|
757
|
+
environment
|
|
758
|
+
}));
|
|
759
|
+
const { status, dismiss } = useChangeStatus(keys.secrets({
|
|
760
|
+
project,
|
|
761
|
+
environment
|
|
762
|
+
}));
|
|
838
763
|
const [drafts, setDrafts] = (0, import_react.useState)([]);
|
|
839
764
|
const [changes, setChanges] = (0, import_react.useState)({});
|
|
840
765
|
const [editing, setEditing] = (0, import_react.useState)(() => /* @__PURE__ */ new Set());
|
|
841
|
-
const [saving, setSaving] = (0, import_react.useState)(false);
|
|
842
766
|
const [saveError, setSaveError] = (0, import_react.useState)(null);
|
|
843
767
|
const [query, setQuery] = (0, import_react.useState)(Route.useSearch().filter ?? "");
|
|
844
768
|
const nextDraftId = (0, import_react.useRef)(0);
|
|
845
769
|
const canWrite = permissions.includes("secret.write");
|
|
846
770
|
const canArchive = permissions.includes("secret.archive");
|
|
847
771
|
const canReveal = canRevealSecrets(permissions);
|
|
848
|
-
const active = keys.filter((entry) => !entry.archived);
|
|
849
|
-
const archived = keys.filter((entry) => entry.archived);
|
|
850
|
-
const existing = new Set(keys.map((entry) => entry.key));
|
|
772
|
+
const active = keys$1.filter((entry) => !entry.archived);
|
|
773
|
+
const archived = keys$1.filter((entry) => entry.archived);
|
|
774
|
+
const existing = new Set(keys$1.map((entry) => entry.key));
|
|
851
775
|
const changedEntries = active.filter((entry) => secretChangeFor(changes, entry.key) !== void 0);
|
|
852
776
|
const hasConflict = hasSecretEditConflict(active, drafts, changes);
|
|
853
777
|
const pendingNames = [...drafts.map((row) => row.key.trim()), ...changedEntries.flatMap((entry) => {
|
|
@@ -899,53 +823,47 @@ function EnvironmentLedger({ project, environment, permissions, keys, syncs }) {
|
|
|
899
823
|
setChanges({});
|
|
900
824
|
setEditing(/* @__PURE__ */ new Set());
|
|
901
825
|
setSaveError(null);
|
|
826
|
+
for (const entry of keys$1) {
|
|
827
|
+
const state = status(entry.key);
|
|
828
|
+
if (state.state === "failed") dismiss(state.mutationId);
|
|
829
|
+
}
|
|
902
830
|
}
|
|
903
831
|
/**
|
|
904
|
-
* Write every pending edit: renames one by one, then the
|
|
905
|
-
* that lands whole or not at all
|
|
906
|
-
*
|
|
832
|
+
* Write every pending edit (`saveSecrets`): renames one by one, then the
|
|
833
|
+
* rest as one patch that lands whole or not at all. The edits show in the
|
|
834
|
+
* list at once, each row marked as saving; whatever did not land comes
|
|
835
|
+
* back as pending, so pressing save again retries exactly that, and the
|
|
836
|
+
* save bar says why.
|
|
907
837
|
*/
|
|
908
|
-
|
|
909
|
-
if (!ready
|
|
910
|
-
|
|
911
|
-
setSaveError(null);
|
|
912
|
-
const outcome = await applySecretEditBatch({
|
|
838
|
+
function saveChanges() {
|
|
839
|
+
if (!ready) return;
|
|
840
|
+
const batch = {
|
|
913
841
|
active,
|
|
914
842
|
drafts,
|
|
915
|
-
changes
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
await coffre.secrets.rename(`${place}/${key}`, nextKey);
|
|
920
|
-
} catch (error) {
|
|
921
|
-
throw new Refusal(`${key}: ${failureMessage(error)}`);
|
|
922
|
-
}
|
|
923
|
-
},
|
|
924
|
-
write: async (patch) => {
|
|
925
|
-
try {
|
|
926
|
-
await coffre.secrets.set(place, patch);
|
|
927
|
-
} catch (error) {
|
|
928
|
-
throw new Refusal(failureMessage(error));
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
});
|
|
933
|
-
setDrafts(outcome.drafts);
|
|
934
|
-
setChanges(outcome.changes);
|
|
843
|
+
changes
|
|
844
|
+
};
|
|
845
|
+
setDrafts([]);
|
|
846
|
+
setChanges({});
|
|
935
847
|
setEditing(/* @__PURE__ */ new Set());
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
}
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
848
|
+
setSaveError(null);
|
|
849
|
+
save(batch, { onError: (error) => {
|
|
850
|
+
const left = error instanceof UnsavedEdits ? error.outcome : batch;
|
|
851
|
+
setDrafts(left.drafts);
|
|
852
|
+
setChanges(left.changes);
|
|
853
|
+
setSaveError(failureMessage(error));
|
|
854
|
+
} });
|
|
855
|
+
}
|
|
856
|
+
/**
|
|
857
|
+
* Bring an archived secret back: in the list at once, as saving. Restoring
|
|
858
|
+
* is fully reversible, so it gets an undo rather than a confirmation
|
|
859
|
+
* dialog in front of it. Asked here, not by its row, which leaves the
|
|
860
|
+
* Archived list as soon as it is restored.
|
|
861
|
+
*/
|
|
862
|
+
function restoreSecretKey(key) {
|
|
863
|
+
restore({ key }, { onSuccess: () => toast.success(`${key} restored`, { action: {
|
|
864
|
+
label: "Undo",
|
|
865
|
+
onClick: () => archive({ key })
|
|
866
|
+
} }) });
|
|
949
867
|
}
|
|
950
868
|
const saveRef = (0, import_react.useRef)(saveChanges);
|
|
951
869
|
saveRef.current = saveChanges;
|
|
@@ -1001,7 +919,6 @@ function EnvironmentLedger({ project, environment, permissions, keys, syncs }) {
|
|
|
1001
919
|
}), canWrite && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
1002
920
|
className: "btn btn-primary",
|
|
1003
921
|
onClick: addDraft,
|
|
1004
|
-
disabled: saving,
|
|
1005
922
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { size: 14 }), "New secret"]
|
|
1006
923
|
})] })
|
|
1007
924
|
}),
|
|
@@ -1115,8 +1032,8 @@ function EnvironmentLedger({ project, environment, permissions, keys, syncs }) {
|
|
|
1115
1032
|
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tbody", { children: [
|
|
1116
1033
|
drafts.map((draft) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DraftRow, {
|
|
1117
1034
|
draft,
|
|
1118
|
-
existingVersion: keys.find((entry) => entry.key === draft.key.trim())?.version ?? null,
|
|
1119
|
-
disabled:
|
|
1035
|
+
existingVersion: keys$1.find((entry) => entry.key === draft.key.trim())?.version ?? null,
|
|
1036
|
+
disabled: false,
|
|
1120
1037
|
onChange: (patch) => setDrafts((rows) => rows.map((row) => row.id === draft.id ? {
|
|
1121
1038
|
...row,
|
|
1122
1039
|
...patch
|
|
@@ -1125,6 +1042,7 @@ function EnvironmentLedger({ project, environment, permissions, keys, syncs }) {
|
|
|
1125
1042
|
}, draft.id)),
|
|
1126
1043
|
listed.map((entry) => {
|
|
1127
1044
|
const change = secretChangeFor(changes, entry.key);
|
|
1045
|
+
const state = status(entry.key);
|
|
1128
1046
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SecretRow, {
|
|
1129
1047
|
number: active.indexOf(entry) + 1,
|
|
1130
1048
|
project,
|
|
@@ -1139,7 +1057,8 @@ function EnvironmentLedger({ project, environment, permissions, keys, syncs }) {
|
|
|
1139
1057
|
canWrite,
|
|
1140
1058
|
canArchive,
|
|
1141
1059
|
canReveal,
|
|
1142
|
-
|
|
1060
|
+
status: state,
|
|
1061
|
+
disabled: state.state === "pending",
|
|
1143
1062
|
columns,
|
|
1144
1063
|
onEdit: () => setEditing((current) => new Set(current).add(entry.key)),
|
|
1145
1064
|
onPatch: (patch) => patchChange(entry, patch),
|
|
@@ -1178,7 +1097,6 @@ function EnvironmentLedger({ project, environment, permissions, keys, syncs }) {
|
|
|
1178
1097
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Syncs, {
|
|
1179
1098
|
project,
|
|
1180
1099
|
environment,
|
|
1181
|
-
result: syncs,
|
|
1182
1100
|
canRun: canWrite || permissions.includes("environment.manage")
|
|
1183
1101
|
}),
|
|
1184
1102
|
archived.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
@@ -1232,7 +1150,10 @@ function EnvironmentLedger({ project, environment, permissions, keys, syncs }) {
|
|
|
1232
1150
|
environment,
|
|
1233
1151
|
entry,
|
|
1234
1152
|
canArchive,
|
|
1235
|
-
canReveal
|
|
1153
|
+
canReveal,
|
|
1154
|
+
status: status(entry.key),
|
|
1155
|
+
onRestore: () => restoreSecretKey(entry.key),
|
|
1156
|
+
onDismiss: dismiss
|
|
1236
1157
|
}, entry.key)) })]
|
|
1237
1158
|
})
|
|
1238
1159
|
})
|
|
@@ -1273,19 +1194,14 @@ function EnvironmentLedger({ project, environment, permissions, keys, syncs }) {
|
|
|
1273
1194
|
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
1274
1195
|
className: "btn btn-sm",
|
|
1275
1196
|
onClick: discardAll,
|
|
1276
|
-
disabled: saving,
|
|
1277
1197
|
children: "Discard"
|
|
1278
1198
|
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
1279
1199
|
className: "btn btn-sm btn-primary",
|
|
1280
|
-
onClick:
|
|
1281
|
-
disabled:
|
|
1200
|
+
onClick: saveChanges,
|
|
1201
|
+
disabled: !ready,
|
|
1282
1202
|
title: "Save (⌘ Enter or Ctrl Enter)",
|
|
1283
1203
|
"aria-keyshortcuts": "Meta+Enter Control+Enter",
|
|
1284
|
-
children: [
|
|
1285
|
-
saving && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { size: 13 }),
|
|
1286
|
-
"Save ",
|
|
1287
|
-
pendingCount === 1 ? "change" : `${pendingCount} changes`
|
|
1288
|
-
]
|
|
1204
|
+
children: ["Save ", pendingCount === 1 ? "change" : `${pendingCount} changes`]
|
|
1289
1205
|
})]
|
|
1290
1206
|
}),
|
|
1291
1207
|
(saveError ?? problem) !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
|
|
@@ -1300,7 +1216,7 @@ function EnvironmentLedger({ project, environment, permissions, keys, syncs }) {
|
|
|
1300
1216
|
}
|
|
1301
1217
|
/** The display name sits beside the slug; it comes from the shell's project tree. */
|
|
1302
1218
|
function EnvironmentName({ project, environment }) {
|
|
1303
|
-
const { projects } =
|
|
1219
|
+
const { projects } = useShell();
|
|
1304
1220
|
const name = projects.find((entry) => entry.slug === project)?.environments.find((entry) => entry.slug === environment)?.name;
|
|
1305
1221
|
return name === void 0 ? null : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: name });
|
|
1306
1222
|
}
|
|
@@ -1364,7 +1280,7 @@ function useSecondsLeft(reveal) {
|
|
|
1364
1280
|
if (reveal === null) return 0;
|
|
1365
1281
|
return Math.max(0, Math.ceil(REVEAL_TTL_SECONDS - (now - reveal.at) / 1e3));
|
|
1366
1282
|
}
|
|
1367
|
-
function SecretRow({ number, project, environment, entry, change, editing, canWrite, canArchive, canReveal, disabled, columns, onEdit, onPatch, onUndo, onMarkArchive }) {
|
|
1283
|
+
function SecretRow({ number, project, environment, entry, change, editing, canWrite, canArchive, canReveal, status, disabled, columns, onEdit, onPatch, onUndo, onMarkArchive }) {
|
|
1368
1284
|
const [reveal, setReveal] = (0, import_react.useState)(null);
|
|
1369
1285
|
const coffre = useCoffre();
|
|
1370
1286
|
const [revealing, setRevealing] = (0, import_react.useState)(false);
|
|
@@ -1417,7 +1333,7 @@ function SecretRow({ number, project, environment, entry, change, editing, canWr
|
|
|
1417
1333
|
const version = entry.version ?? 0;
|
|
1418
1334
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1419
1335
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
|
|
1420
|
-
className: `secret-row${state}`,
|
|
1336
|
+
className: `secret-row${state} ${rowClass(status)}`,
|
|
1421
1337
|
children: [
|
|
1422
1338
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
1423
1339
|
className: "n",
|
|
@@ -1534,7 +1450,7 @@ function SecretRow({ number, project, environment, entry, change, editing, canWr
|
|
|
1534
1450
|
}),
|
|
1535
1451
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
1536
1452
|
className: "col-actions",
|
|
1537
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1453
|
+
children: status.state === "pending" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowPending, { status }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1538
1454
|
className: "acts",
|
|
1539
1455
|
children: leaving ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tip, {
|
|
1540
1456
|
label: "Keep",
|
|
@@ -1780,19 +1696,11 @@ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove }) {
|
|
|
1780
1696
|
]
|
|
1781
1697
|
});
|
|
1782
1698
|
}
|
|
1783
|
-
function ArchivedRow({ number, project, environment, entry, canArchive, canReveal }) {
|
|
1699
|
+
function ArchivedRow({ number, project, environment, entry, canArchive, canReveal, status: state, onRestore, onDismiss }) {
|
|
1784
1700
|
const [historyOpen, setHistoryOpen] = (0, import_react.useState)(false);
|
|
1785
|
-
const coffre = useCoffre();
|
|
1786
|
-
const { pending, error, run } = useAction();
|
|
1787
|
-
function setArchived(archived) {
|
|
1788
|
-
run(() => coffre.secrets.update(`${project}/${environment}/${entry.key}`, { archived }), () => toast.success(archived ? `${entry.key} archived` : `${entry.key} restored`, { action: {
|
|
1789
|
-
label: "Undo",
|
|
1790
|
-
onClick: () => setArchived(!archived)
|
|
1791
|
-
} }));
|
|
1792
|
-
}
|
|
1793
1701
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1794
1702
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
|
|
1795
|
-
className:
|
|
1703
|
+
className: `secret-row is-archived ${rowClass(state)}`,
|
|
1796
1704
|
children: [
|
|
1797
1705
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
1798
1706
|
className: "n",
|
|
@@ -1832,16 +1740,15 @@ function ArchivedRow({ number, project, environment, entry, canArchive, canRevea
|
|
|
1832
1740
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(History, { size: 15 })
|
|
1833
1741
|
})
|
|
1834
1742
|
})
|
|
1835
|
-
}), canArchive && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tip, {
|
|
1743
|
+
}), canArchive && (state.state === "pending" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowPending, { status: state }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Tip, {
|
|
1836
1744
|
label: "Restore",
|
|
1837
1745
|
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
1838
1746
|
className: "act act-icon",
|
|
1839
|
-
onClick:
|
|
1840
|
-
disabled: pending,
|
|
1747
|
+
onClick: onRestore,
|
|
1841
1748
|
"aria-label": `Restore ${entry.key}`,
|
|
1842
|
-
children:
|
|
1749
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RotateBack, { size: 14 })
|
|
1843
1750
|
})
|
|
1844
|
-
})]
|
|
1751
|
+
}))]
|
|
1845
1752
|
})
|
|
1846
1753
|
})
|
|
1847
1754
|
]
|
|
@@ -1861,12 +1768,10 @@ function ArchivedRow({ number, project, environment, entry, canArchive, canRevea
|
|
|
1861
1768
|
})
|
|
1862
1769
|
})
|
|
1863
1770
|
}),
|
|
1864
|
-
|
|
1865
|
-
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error })
|
|
1869
|
-
})
|
|
1771
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowFailure, {
|
|
1772
|
+
status: state,
|
|
1773
|
+
columns: 5,
|
|
1774
|
+
onDismiss: () => state.state === "failed" && onDismiss(state.mutationId)
|
|
1870
1775
|
})
|
|
1871
1776
|
] });
|
|
1872
1777
|
}
|
|
@@ -2005,9 +1910,15 @@ function VersionHistory({ project, environment, secretKey, currentVersion, canWr
|
|
|
2005
1910
|
] }),
|
|
2006
1911
|
confirmLabel: `Roll back to v${version.version}`,
|
|
2007
1912
|
destructive: false,
|
|
2008
|
-
onConfirm: () => run(() => coffre.secrets.restore(`${project}/${environment}/${secretKey}`, version.version),
|
|
2009
|
-
|
|
2010
|
-
|
|
1913
|
+
onConfirm: () => run(() => coffre.secrets.restore(`${project}/${environment}/${secretKey}`, version.version), {
|
|
1914
|
+
affects: affects.secrets({
|
|
1915
|
+
project,
|
|
1916
|
+
environment
|
|
1917
|
+
}),
|
|
1918
|
+
onSuccess: () => {
|
|
1919
|
+
onRolledBack();
|
|
1920
|
+
toast.success(`${secretKey} rolled back to v${version.version}`);
|
|
1921
|
+
}
|
|
2011
1922
|
})
|
|
2012
1923
|
})
|
|
2013
1924
|
})
|
|
@@ -2061,20 +1972,29 @@ function ImportEnv({ project, environment }) {
|
|
|
2061
1972
|
const { pending, error, setError, run } = useAction();
|
|
2062
1973
|
const path = `${project}/${environment}`;
|
|
2063
1974
|
function preview() {
|
|
2064
|
-
run(() => planEnv(coffre, path, content),
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
|
|
2069
|
-
|
|
1975
|
+
run(() => planEnv(coffre, path, content), {
|
|
1976
|
+
affects: [],
|
|
1977
|
+
onSuccess: (result) => {
|
|
1978
|
+
setProblems(result.problems);
|
|
1979
|
+
setPlan({
|
|
1980
|
+
entries: result.plan,
|
|
1981
|
+
changes: result.changes
|
|
1982
|
+
});
|
|
1983
|
+
}
|
|
2070
1984
|
});
|
|
2071
1985
|
}
|
|
2072
1986
|
function apply() {
|
|
2073
1987
|
if (plan === null) return;
|
|
2074
1988
|
const written = Object.keys(plan.changes).length;
|
|
2075
|
-
run(() => coffre.secrets.set(path, plan.changes),
|
|
2076
|
-
|
|
2077
|
-
|
|
1989
|
+
run(() => coffre.secrets.set(path, plan.changes), {
|
|
1990
|
+
affects: affects.secrets({
|
|
1991
|
+
project,
|
|
1992
|
+
environment
|
|
1993
|
+
}),
|
|
1994
|
+
onSuccess: () => {
|
|
1995
|
+
toast.success(`Imported ${written} change${written === 1 ? "" : "s"}`);
|
|
1996
|
+
close();
|
|
1997
|
+
}
|
|
2078
1998
|
});
|
|
2079
1999
|
}
|
|
2080
2000
|
function close() {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as createFileRoute, t as lazyRouteComponent } from "./lazyRouteComponent-CqBNCGuZ.js";
|
|
2
|
+
import { h as queries } from "./page-D_mO0-sn.js";
|
|
3
3
|
//#region src/routes/projects.$project.$environment.tsx
|
|
4
|
-
var $$splitComponentImporter = () => import("./projects._project._environment-
|
|
4
|
+
var $$splitComponentImporter = () => import("./projects._project._environment-C-yVwC92.js");
|
|
5
5
|
/**
|
|
6
6
|
* How long a revealed value stays on screen.
|
|
7
7
|
*
|
|
@@ -11,14 +11,7 @@ var $$splitComponentImporter = () => import("./projects._project._environment-CU
|
|
|
11
11
|
*/
|
|
12
12
|
var Route = createFileRoute("/projects/$project/$environment")({
|
|
13
13
|
validateSearch: (search) => ({ filter: typeof search.filter === "string" && search.filter !== "" ? search.filter : void 0 }),
|
|
14
|
-
loader:
|
|
15
|
-
const path = `${params.project}/${params.environment}`;
|
|
16
|
-
const [keys, syncs] = await Promise.all([uiResult(() => client.secrets.list(path)), uiResult(() => client.syncs.list(path))]);
|
|
17
|
-
return {
|
|
18
|
-
keys,
|
|
19
|
-
syncs
|
|
20
|
-
};
|
|
21
|
-
},
|
|
14
|
+
loader: ({ context: { client, queryClient }, params }) => Promise.all([queryClient.fetchQuery(queries.secrets(client, params)), queryClient.fetchQuery(queries.syncs(client, params))]),
|
|
22
15
|
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
23
16
|
});
|
|
24
17
|
/** The display name sits beside the slug; it comes from the shell's project tree. */
|