@coffre/ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +8 -2
- package/dist/client/.assetsignore +2 -0
- package/dist/client/_coffre/assets/account-C3Zo1l5A.js +1 -0
- package/dist/client/_coffre/assets/account-C4bNbeO7.js +2 -0
- package/dist/client/_coffre/assets/affordances-DiuJIiR2.js +1 -0
- package/dist/client/_coffre/assets/audit-1xLyuxGz.js +2 -0
- package/dist/client/_coffre/assets/audit-Dab2GuRj.js +1 -0
- package/dist/client/_coffre/assets/auth.device-BfCfeBWe.js +2 -0
- package/dist/client/_coffre/assets/auth.device-D2pCLF-X.js +1 -0
- package/dist/client/_coffre/assets/coffre-C7qL3HGR.js +1 -0
- package/dist/client/_coffre/assets/directory-C2Ou4SQv.js +1 -0
- package/dist/client/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
- package/dist/client/_coffre/assets/grants-fqTtJ-aW.js +1 -0
- package/dist/client/_coffre/assets/index-BpGwbjmM.js +12 -0
- 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/login-CR9CBXlw.js +2 -0
- package/dist/client/_coffre/assets/login-DZizFxa4.js +1 -0
- package/dist/client/_coffre/assets/offboarding-DOLJQcXU.js +1 -0
- package/dist/client/_coffre/assets/page-BxW2MwaX.js +1 -0
- package/dist/client/_coffre/assets/preload-helper-BHuP8_FL.js +46 -0
- package/dist/client/_coffre/assets/principal-page-xnBZVURr.js +1 -0
- package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +1 -0
- package/dist/client/_coffre/assets/projects._project._environment-CrWjQmIA.js +2 -0
- package/dist/client/_coffre/assets/projects._project._environment-CwRVG9Ne.js +3 -0
- package/dist/client/_coffre/assets/projects._project.index-CCDEuE-z.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-DCJsmnD7.js +1 -0
- package/dist/client/_coffre/assets/projects.index-B8eV8JIn.js +1 -0
- package/dist/client/_coffre/assets/projects.index-BNEC7Oz8.js +2 -0
- package/dist/client/_coffre/assets/settings-2BPsenNM.js +2 -0
- package/dist/client/_coffre/assets/settings-BrS0-wEt.js +1 -0
- package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +1 -0
- package/dist/client/_coffre/assets/tokens._token-B3-YwuKp.js +2 -0
- package/dist/client/_coffre/assets/tokens._token-D_hsbHx6.js +1 -0
- package/dist/client/_coffre/assets/tokens.index-BdKE2Jv8.js +2 -0
- package/dist/client/_coffre/assets/tokens.index-XvA4XRxh.js +1 -0
- package/dist/client/_coffre/assets/unregistered-CTRMtBIy.js +1 -0
- package/dist/client/_coffre/assets/use-action-DgAf-tiX.js +1 -0
- package/dist/client/_coffre/assets/users._user-BFPXcJ4y.js +2 -0
- package/dist/client/_coffre/assets/users._user-DEtMeSoh.js +1 -0
- package/dist/client/_coffre/assets/users.index-B03beUHq.js +1 -0
- package/dist/client/_coffre/assets/users.index-D8hwzM6P.js +2 -0
- package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/server/.vite/manifest.json +572 -0
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-B6CZDfrB.js +133 -0
- package/dist/server/_coffre/assets/account-B71_b5xc.js +296 -0
- package/dist/server/_coffre/assets/account-BoO6ZqMc.js +176 -0
- package/dist/server/_coffre/assets/affordances-BNaXjMOb.js +46 -0
- package/dist/server/_coffre/assets/async-local-storage-C0cwgkEr.js +3107 -0
- package/dist/server/_coffre/assets/audit-CwRFnSAY.js +74 -0
- package/dist/server/_coffre/assets/audit-t1sYjtrf.js +964 -0
- package/dist/server/_coffre/assets/auth.device-1IcJ475s.js +208 -0
- package/dist/server/_coffre/assets/auth.device-CJwZYYtn.js +29 -0
- package/dist/server/_coffre/assets/coffre-1hxT2E_U.js +278 -0
- package/dist/server/_coffre/assets/directory-wm_JQUfk.js +396 -0
- package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +5 -0
- package/dist/server/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
- package/dist/server/_coffre/assets/grants-BmhEY1vz.js +243 -0
- 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/login-B5O5LPXV.js +100 -0
- package/dist/server/_coffre/assets/login-Bvc4gp0X.js +22 -0
- package/dist/server/_coffre/assets/offboarding-CvSilnSm.js +330 -0
- package/dist/server/_coffre/assets/page-BjXk0Ehu.js +2003 -0
- package/dist/server/_coffre/assets/principal-page-DkwNGzM2.js +617 -0
- package/dist/server/_coffre/assets/project-environments-lEzFHUt4.js +9 -0
- package/dist/server/_coffre/assets/projects._project._environment-7grhqlgq.js +2227 -0
- package/dist/server/_coffre/assets/projects._project._environment-ByEf6pmz.js +55 -0
- package/dist/server/_coffre/assets/projects._project.index-B1bjowP-.js +932 -0
- package/dist/server/_coffre/assets/projects._project.index-DU8wtoHD.js +22 -0
- package/dist/server/_coffre/assets/projects.index-B0DoHbCz.js +280 -0
- package/dist/server/_coffre/assets/projects.index-kMDA6pMy.js +54 -0
- package/dist/server/_coffre/assets/react-dom-qCTiwGGR.js +1352 -0
- package/dist/server/_coffre/assets/router-ChU_CwCX.js +2028 -0
- package/dist/server/_coffre/assets/settings-CM9-h7in.js +18 -0
- package/dist/server/_coffre/assets/settings-Cg5qOGij.js +60 -0
- package/dist/server/_coffre/assets/signin-errors-BEFlVDbQ.js +28 -0
- package/dist/server/_coffre/assets/start-DR3rN0St.js +4 -0
- package/dist/server/_coffre/assets/tokens._token-CCpaPMAk.js +268 -0
- package/dist/server/_coffre/assets/tokens._token-Di4OZdAA.js +18 -0
- package/dist/server/_coffre/assets/tokens.index-Do3OHR31.js +34 -0
- package/dist/server/_coffre/assets/tokens.index-tDKq4AFh.js +10 -0
- package/dist/server/_coffre/assets/ui-BNzhIAQP.js +15710 -0
- package/dist/server/_coffre/assets/unregistered-BqaWYFJK.js +51 -0
- package/dist/server/_coffre/assets/use-action-BkJXC5JM.js +953 -0
- package/dist/server/_coffre/assets/useStore-DWGPqzXR.js +892 -0
- package/dist/server/_coffre/assets/users._user-BenYva93.js +15 -0
- package/dist/server/_coffre/assets/users._user-Cp039Va-.js +10 -0
- package/dist/server/_coffre/assets/users.index-BrzG1Ecq.js +10 -0
- package/dist/server/_coffre/assets/users.index-DQ_45DQl.js +34 -0
- package/dist/server/_coffre/assets/validation-BQtqPe2V.js +27 -0
- package/dist/server/index.js +13910 -0
- package/package.json +58 -3
- package/src/components/affordances.ts +80 -0
- package/src/components/agentation.tsx +34 -0
- package/src/components/command-palette.tsx +271 -0
- package/src/components/directory.tsx +448 -0
- package/src/components/grants.tsx +204 -0
- package/src/components/icons.tsx +283 -0
- package/src/components/offboarding.tsx +286 -0
- package/src/components/page.tsx +128 -0
- package/src/components/principal-page.tsx +549 -0
- package/src/components/principal-picker.tsx +168 -0
- package/src/components/principal.tsx +53 -0
- package/src/components/route-states.tsx +60 -0
- package/src/components/service-tokens.tsx +212 -0
- package/src/components/shell.tsx +641 -0
- package/src/components/syncs.tsx +581 -0
- package/src/components/theme.tsx +141 -0
- package/src/components/tile.tsx +22 -0
- package/src/components/ui.tsx +440 -0
- package/src/entry.ts +19 -0
- package/src/lib/access-plan.ts +201 -0
- package/src/lib/audit-sentences.ts +468 -0
- package/src/lib/capabilities.ts +45 -0
- package/src/lib/coffre.ts +57 -0
- package/src/lib/project-access.ts +95 -0
- package/src/lib/project-environments.ts +23 -0
- package/src/lib/reveal.ts +21 -0
- package/src/lib/secret-edit-batch.ts +181 -0
- package/src/lib/signin-errors.ts +33 -0
- package/src/lib/use-action.ts +50 -0
- package/src/lib/validation.ts +27 -0
- package/src/routeTree.gen.ts +367 -0
- package/src/router.tsx +84 -0
- package/src/routes/__root.tsx +192 -0
- package/src/routes/access.tsx +11 -0
- package/src/routes/account.tsx +359 -0
- package/src/routes/audit.tsx +545 -0
- package/src/routes/auth.device.tsx +200 -0
- package/src/routes/index.tsx +15 -0
- package/src/routes/login.tsx +129 -0
- package/src/routes/projects.$project.$environment.tsx +1659 -0
- package/src/routes/projects.$project.index.tsx +917 -0
- package/src/routes/projects.index.tsx +353 -0
- package/src/routes/settings.tsx +72 -0
- package/src/routes/tokens.$token.tsx +35 -0
- package/src/routes/tokens.index.tsx +37 -0
- package/src/routes/unregistered.tsx +59 -0
- package/src/routes/users.$user.tsx +13 -0
- package/src/routes/users.index.tsx +37 -0
- package/src/shared/models.ts +55 -0
- package/src/styles/globals.css +4118 -0
- package/src/types.ts +21 -0
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
import { o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
|
|
2
|
+
import { a as ErrorLine, c as Spinner, t as ConfirmButton } from "./ui-BNzhIAQP.js";
|
|
3
|
+
import { U as ShieldCheck, m as Clock } from "./page-BjXk0Ehu.js";
|
|
4
|
+
import { a as uiFailure, n as failureMessage, r as memberRef, s as useCoffre } from "./coffre-1hxT2E_U.js";
|
|
5
|
+
import { r as toast, t as useAction } from "./use-action-BkJXC5JM.js";
|
|
6
|
+
//#region src/lib/project-access.ts
|
|
7
|
+
var LEVEL_LABELS = {
|
|
8
|
+
owner: "Owner",
|
|
9
|
+
viewer: "Read",
|
|
10
|
+
developer: "Write"
|
|
11
|
+
};
|
|
12
|
+
function projectAccessOptions(environments) {
|
|
13
|
+
const options = [{
|
|
14
|
+
value: "owner:",
|
|
15
|
+
role: "owner",
|
|
16
|
+
environmentSlug: null,
|
|
17
|
+
label: "Owner"
|
|
18
|
+
}];
|
|
19
|
+
for (const role of ["viewer", "developer"]) options.push({
|
|
20
|
+
value: `${role}:`,
|
|
21
|
+
role,
|
|
22
|
+
environmentSlug: null,
|
|
23
|
+
label: `${LEVEL_LABELS[role]}: all`
|
|
24
|
+
});
|
|
25
|
+
for (const environment of environments) {
|
|
26
|
+
if (environment.details === null || environment.details.archivedAt !== null) continue;
|
|
27
|
+
for (const role of ["viewer", "developer"]) options.push({
|
|
28
|
+
value: `${role}:${environment.slug}`,
|
|
29
|
+
role,
|
|
30
|
+
environmentSlug: environment.slug,
|
|
31
|
+
label: `${LEVEL_LABELS[role]}: ${environment.slug}`
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
return options;
|
|
35
|
+
}
|
|
36
|
+
function parseProjectAccess(value) {
|
|
37
|
+
const [role, environmentSlug = ""] = value.split(":", 2);
|
|
38
|
+
if (role !== "owner" && role !== "viewer" && role !== "developer") throw new Error("unknown project access level");
|
|
39
|
+
return {
|
|
40
|
+
role,
|
|
41
|
+
environmentSlug: environmentSlug || null
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function projectAccessLabel(grant) {
|
|
45
|
+
const scope = grant.environmentSlug === null ? "all environments" : grant.environmentSlug;
|
|
46
|
+
if (grant.role === "owner") return "Owner";
|
|
47
|
+
if (grant.role === "viewer") return grant.environmentSlug === null ? "Read: all" : `Read: ${scope}`;
|
|
48
|
+
if (grant.role === "developer") return grant.environmentSlug === null ? "Write: all" : `Write: ${scope}`;
|
|
49
|
+
return `${grant.roleName}: ${scope}`;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
//#region src/components/grants.tsx
|
|
53
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
54
|
+
/**
|
|
55
|
+
* One project and, when you manage its access, its grants. A project that is
|
|
56
|
+
* not there for you fails with no message: the page words that itself.
|
|
57
|
+
*/
|
|
58
|
+
async function loadProject(client, slug) {
|
|
59
|
+
let project;
|
|
60
|
+
try {
|
|
61
|
+
project = (await client.projects.list()).projects.find((entry) => entry.slug === slug);
|
|
62
|
+
} catch (error) {
|
|
63
|
+
return uiFailure(error);
|
|
64
|
+
}
|
|
65
|
+
if (project === void 0) return {
|
|
66
|
+
ok: false,
|
|
67
|
+
error: null
|
|
68
|
+
};
|
|
69
|
+
if (!project.permissions.includes("grant.manage")) return {
|
|
70
|
+
ok: true,
|
|
71
|
+
project,
|
|
72
|
+
grants: [],
|
|
73
|
+
grantsError: null
|
|
74
|
+
};
|
|
75
|
+
try {
|
|
76
|
+
const { members } = await client.members.list(slug);
|
|
77
|
+
const grants = members.flatMap((member) => member.grants.map((grant) => ({
|
|
78
|
+
id: grant.id,
|
|
79
|
+
principalType: member.principalType,
|
|
80
|
+
principalId: member.principalId,
|
|
81
|
+
role: grant.role,
|
|
82
|
+
roleName: grant.roleName,
|
|
83
|
+
permissions: grant.permissions,
|
|
84
|
+
scope: grant.environment === null ? "project" : "environment",
|
|
85
|
+
environmentSlug: grant.environment,
|
|
86
|
+
expiresAt: grant.expiresAt
|
|
87
|
+
})));
|
|
88
|
+
return {
|
|
89
|
+
ok: true,
|
|
90
|
+
project,
|
|
91
|
+
grants,
|
|
92
|
+
grantsError: null
|
|
93
|
+
};
|
|
94
|
+
} catch (error) {
|
|
95
|
+
return {
|
|
96
|
+
ok: true,
|
|
97
|
+
project,
|
|
98
|
+
grants: [],
|
|
99
|
+
grantsError: failureMessage(error)
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/** Where a grant applies, as the API names it: `market`, or `market/prod`. */
|
|
104
|
+
function grantPlace(project, environmentSlug) {
|
|
105
|
+
return environmentSlug === null ? project : `${project}/${environmentSlug}`;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Give someone a role at one place. Access is declarative, so asking for what
|
|
109
|
+
* they already hold is not an error, whoever asked first: `existed` says so.
|
|
110
|
+
*/
|
|
111
|
+
async function ensureGrant(coffre, data) {
|
|
112
|
+
const place = grantPlace(data.project, data.environmentSlug);
|
|
113
|
+
const role = data.role;
|
|
114
|
+
const { changes } = await coffre.access.set(memberRef(data.principalType, data.principalId), { [place]: data.expiresAt === null ? role : {
|
|
115
|
+
role,
|
|
116
|
+
until: data.expiresAt
|
|
117
|
+
} });
|
|
118
|
+
return { existed: changes[place] === "unchanged" };
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Grants as a table: who or where in the first column, then the access, when
|
|
122
|
+
* it lapses, and a revoke.
|
|
123
|
+
*
|
|
124
|
+
* A project's page leads each row with the principal; a user's page leads with
|
|
125
|
+
* the project. Everything after the first column is the same grant either way.
|
|
126
|
+
*/
|
|
127
|
+
function GrantsTable({ lead, children }) {
|
|
128
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
129
|
+
className: "dt-wrap",
|
|
130
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
|
|
131
|
+
className: "dt grants stacks",
|
|
132
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
134
|
+
className: "n",
|
|
135
|
+
children: "#"
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
138
|
+
className: "col-principal",
|
|
139
|
+
children: lead
|
|
140
|
+
}),
|
|
141
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
142
|
+
className: "th",
|
|
143
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShieldCheck, { size: 14 }), "Permissions"]
|
|
144
|
+
}) }),
|
|
145
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
146
|
+
className: "col-expires",
|
|
147
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
148
|
+
className: "th",
|
|
149
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Clock, { size: 14 }), "Expires"]
|
|
150
|
+
})
|
|
151
|
+
}),
|
|
152
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
153
|
+
className: "col-actions",
|
|
154
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
155
|
+
className: "visually-hidden",
|
|
156
|
+
children: "Actions"
|
|
157
|
+
})
|
|
158
|
+
})
|
|
159
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children })]
|
|
160
|
+
})
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function GrantRowView({ number, project, grant, lead, leadLabel }) {
|
|
164
|
+
const coffre = useCoffre();
|
|
165
|
+
const { pending, error, run } = useAction();
|
|
166
|
+
const label = projectAccessLabel(grant);
|
|
167
|
+
const expired = grant.expiresAt !== null && new Date(grant.expiresAt).getTime() < Date.now();
|
|
168
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
170
|
+
className: "n",
|
|
171
|
+
children: number
|
|
172
|
+
}),
|
|
173
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
174
|
+
className: "col-lead",
|
|
175
|
+
"data-label": leadLabel,
|
|
176
|
+
children: lead
|
|
177
|
+
}),
|
|
178
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
179
|
+
className: "col-access",
|
|
180
|
+
"data-label": "Permissions",
|
|
181
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
182
|
+
className: `tag${grant.role === "owner" ? " tag-violet" : ""}`,
|
|
183
|
+
children: label
|
|
184
|
+
})
|
|
185
|
+
}),
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
187
|
+
className: `col-expires cell-mono cell-muted${grant.expiresAt === null ? " is-never" : ""}`,
|
|
188
|
+
"data-label": "Expires",
|
|
189
|
+
children: grant.expiresAt === null ? "never" : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
191
|
+
className: "narrow-only",
|
|
192
|
+
children: "expires "
|
|
193
|
+
}),
|
|
194
|
+
grant.expiresAt.slice(0, 10),
|
|
195
|
+
expired && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [" ", /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
196
|
+
className: "tag tag-red",
|
|
197
|
+
children: "expired"
|
|
198
|
+
})] })
|
|
199
|
+
] })
|
|
200
|
+
}),
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
202
|
+
className: "col-actions",
|
|
203
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfirmButton, {
|
|
204
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
205
|
+
className: "act act-danger",
|
|
206
|
+
disabled: pending,
|
|
207
|
+
children: [pending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, { size: 13 }), "Revoke"]
|
|
208
|
+
}),
|
|
209
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
210
|
+
"Revoke ",
|
|
211
|
+
label,
|
|
212
|
+
" from ",
|
|
213
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
214
|
+
className: "mono",
|
|
215
|
+
children: grant.principalId
|
|
216
|
+
}),
|
|
217
|
+
"?"
|
|
218
|
+
] }),
|
|
219
|
+
body: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
220
|
+
"They lose ",
|
|
221
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: label }),
|
|
222
|
+
" on ",
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
224
|
+
className: "mono",
|
|
225
|
+
children: project
|
|
226
|
+
}),
|
|
227
|
+
" ",
|
|
228
|
+
"immediately, including any process using it right now. Other grants they hold still apply."
|
|
229
|
+
] }),
|
|
230
|
+
confirmLabel: "Revoke access",
|
|
231
|
+
onConfirm: () => run(() => coffre.access.set(memberRef(grant.principalType, grant.principalId), { [grantPlace(project, grant.environmentSlug)]: null }), () => toast.success(`Revoked ${label} on ${project} from ${grant.principalId}`))
|
|
232
|
+
})
|
|
233
|
+
})
|
|
234
|
+
] }), error !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tr", {
|
|
235
|
+
className: "row-error",
|
|
236
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
237
|
+
colSpan: 5,
|
|
238
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error })
|
|
239
|
+
})
|
|
240
|
+
})] });
|
|
241
|
+
}
|
|
242
|
+
//#endregion
|
|
243
|
+
export { parseProjectAccess as a, loadProject as i, GrantsTable as n, projectAccessLabel as o, ensureGrant as r, projectAccessOptions as s, GrantRowView as t };
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { C as require_react, E as __toESM, o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
|
|
2
|
+
import { a as ErrorLine, c as Spinner } from "./ui-BNzhIAQP.js";
|
|
3
|
+
import { D as Lock, U as ShieldCheck, n as ClosedDoor, tt as useLoaderData, z as ProviderMark } from "./page-BjXk0Ehu.js";
|
|
4
|
+
import { t as Route } from "./login-Bvc4gp0X.js";
|
|
5
|
+
import { t as signinErrorMessage } from "./signin-errors-BEFlVDbQ.js";
|
|
6
|
+
//#region src/routes/login.tsx?tsr-split=component
|
|
7
|
+
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
8
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
9
|
+
/**
|
|
10
|
+
* The front door, as `GET /api/auth` describes it.
|
|
11
|
+
*
|
|
12
|
+
* With coffre's own sign-in, one button per provider. Behind Cloudflare
|
|
13
|
+
* Access, Access authenticates people before any request arrives, so this
|
|
14
|
+
* page only explains why it is showing at all.
|
|
15
|
+
*/
|
|
16
|
+
function LoginPage() {
|
|
17
|
+
const { signin, access } = useLoaderData({ from: "__root__" }).auth;
|
|
18
|
+
if (signin !== null) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProviderLoginPage, { ...signin });
|
|
19
|
+
return access?.assertion ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CloudflareAuthenticationFailed, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CloudflareAccessRequired, {});
|
|
20
|
+
}
|
|
21
|
+
function CloudflareAccessRequired() {
|
|
22
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ClosedDoor, {
|
|
23
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Lock, { size: 18 }),
|
|
24
|
+
label: "Cloudflare Access",
|
|
25
|
+
title: "Open coffre through Access",
|
|
26
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "This instance has no sign-in of its own. Cloudflare Access authenticates you before a request ever reaches coffre, and this request arrived without an Access assertion." }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Use the Access-protected hostname. A request straight to the origin is refused by design." })]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function CloudflareAuthenticationFailed() {
|
|
30
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ClosedDoor, {
|
|
31
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShieldCheck, { size: 18 }),
|
|
32
|
+
label: "Cloudflare Access",
|
|
33
|
+
title: "Your identity could not be confirmed",
|
|
34
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Cloudflare Access forwarded an identity assertion, but coffre could not verify it. The Access session may have expired, or the identity verifier may be unavailable." }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "Reopen coffre through its Access-protected hostname. If this keeps happening, tell whoever operates coffre." })]
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
function ProviderLoginPage({ title, note, providers }) {
|
|
38
|
+
const { next, error } = Route.useSearch();
|
|
39
|
+
const message = signinErrorMessage(error);
|
|
40
|
+
const [leaving, setLeaving] = (0, import_react.useState)(null);
|
|
41
|
+
const query = next === void 0 ? "" : `?next=${encodeURIComponent(next)}`;
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", {
|
|
43
|
+
className: "card signin",
|
|
44
|
+
"aria-labelledby": "signin-title",
|
|
45
|
+
children: [
|
|
46
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
47
|
+
className: "signin-head",
|
|
48
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
|
|
49
|
+
className: "signin-title",
|
|
50
|
+
id: "signin-title",
|
|
51
|
+
children: title
|
|
52
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
53
|
+
className: "signin-lede",
|
|
54
|
+
children: note ?? "Sign in with your organization’s account. Only people an owner has invited can get in."
|
|
55
|
+
})]
|
|
56
|
+
}),
|
|
57
|
+
message !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
58
|
+
className: "signin-error",
|
|
59
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error: message })
|
|
60
|
+
}),
|
|
61
|
+
providers.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
|
|
62
|
+
className: "signin-empty",
|
|
63
|
+
children: [
|
|
64
|
+
"No sign-in provider is configured. Whoever runs coffre lists them in",
|
|
65
|
+
" ",
|
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
67
|
+
className: "mono",
|
|
68
|
+
children: [
|
|
69
|
+
"signin(",
|
|
70
|
+
"{",
|
|
71
|
+
" providers ",
|
|
72
|
+
"}",
|
|
73
|
+
")"
|
|
74
|
+
]
|
|
75
|
+
}),
|
|
76
|
+
"."
|
|
77
|
+
]
|
|
78
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ul", {
|
|
79
|
+
className: "providers",
|
|
80
|
+
children: providers.map((provider) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", {
|
|
81
|
+
className: "btn provider",
|
|
82
|
+
href: `/auth/signin/${encodeURIComponent(provider.id)}${query}`,
|
|
83
|
+
"aria-busy": leaving === provider.id,
|
|
84
|
+
onClick: () => setLeaving(provider.id),
|
|
85
|
+
children: [
|
|
86
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
87
|
+
className: "provider-mark",
|
|
88
|
+
"aria-hidden": true,
|
|
89
|
+
children: leaving === provider.id ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ProviderMark, { brand: provider.brand })
|
|
90
|
+
}),
|
|
91
|
+
"Continue with ",
|
|
92
|
+
provider.label
|
|
93
|
+
]
|
|
94
|
+
}) }, provider.id))
|
|
95
|
+
})
|
|
96
|
+
]
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//#endregion
|
|
100
|
+
export { LoginPage as component };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { C as lazyRouteComponent, w as createFileRoute } from "./ui-BNzhIAQP.js";
|
|
2
|
+
//#region src/routes/login.tsx
|
|
3
|
+
var $$splitComponentImporter = () => import("./login-B5O5LPXV.js");
|
|
4
|
+
var Route = createFileRoute("/login")({
|
|
5
|
+
validateSearch: (search) => {
|
|
6
|
+
const out = {};
|
|
7
|
+
const { next, error } = search;
|
|
8
|
+
if (typeof next === "string" && next.startsWith("/") && !next.startsWith("//")) out.next = next;
|
|
9
|
+
if (typeof error === "string" && /^[a-z_]{1,40}$/.test(error)) out.error = error;
|
|
10
|
+
return out;
|
|
11
|
+
},
|
|
12
|
+
component: lazyRouteComponent($$splitComponentImporter, "component")
|
|
13
|
+
});
|
|
14
|
+
/**
|
|
15
|
+
* The front door, as `GET /api/auth` describes it.
|
|
16
|
+
*
|
|
17
|
+
* With coffre's own sign-in, one button per provider. Behind Cloudflare
|
|
18
|
+
* Access, Access authenticates people before any request arrives, so this
|
|
19
|
+
* page only explains why it is showing at all.
|
|
20
|
+
*/
|
|
21
|
+
//#endregion
|
|
22
|
+
export { Route as t };
|