@coffre/ui 0.1.15 → 0.1.16
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-DqjL4kP9.js → account-BoLGAxbD.js} +2 -2
- package/dist/client/_coffre/assets/{account-DGGcVkqt.js → account-CnnuRTDB.js} +1 -1
- package/dist/client/_coffre/assets/{affordances-B9nFwqIv.js → affordances-CEafRJcN.js} +1 -1
- package/dist/client/_coffre/assets/audit-CHSvKLWX.js +1 -0
- package/dist/client/_coffre/assets/audit-Cn4hmS4u.js +2 -0
- package/dist/client/_coffre/assets/{auth.device-CHHcm089.js → auth.device-Co5vrpaA.js} +2 -2
- package/dist/client/_coffre/assets/{auth.device-CFCn1DXA.js → auth.device-DAlqWacc.js} +1 -1
- package/dist/client/_coffre/assets/{directory-skRBmF1Y.js → directory-H8Eh3MnS.js} +1 -1
- package/dist/client/_coffre/assets/{dist-BHhATf1q.js → dist-Braunv_x.js} +1 -1
- package/dist/client/_coffre/assets/globals-CpMrgkV6.css +1 -0
- package/dist/client/_coffre/assets/{grants-BEmVXYg5.js → grants-DPDxJXU1.js} +1 -1
- package/dist/client/_coffre/assets/icons-Dc_-t0lp.js +1 -0
- package/dist/client/_coffre/assets/{index-Bo6udWLL.js → index-sUCIXRgJ.js} +3 -3
- package/dist/client/_coffre/assets/{link-Bg_PHv45.js → link-DBINMwm6.js} +1 -1
- package/dist/client/_coffre/assets/{login-GV0ZjCQy.js → login-BZFYfL1Y.js} +1 -1
- package/dist/client/_coffre/assets/login-CYCKWTOD.js +2 -0
- package/dist/client/_coffre/assets/{offboarding-CXV0KyMt.js → offboarding-Bwpftp3g.js} +1 -1
- package/dist/client/_coffre/assets/page-C_hnzdaR.js +1 -0
- package/dist/client/_coffre/assets/{preload-helper-CYFH1xAV.js → preload-helper-CLkO85Nq.js} +1 -1
- package/dist/client/_coffre/assets/{principal-page-BmgkTnAl.js → principal-page-DLho8TSJ.js} +1 -1
- package/dist/client/_coffre/assets/projects._project._environment-DHRRvQw0.js +3 -0
- package/dist/client/_coffre/assets/projects._project._environment-TLI-RjBZ.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-BO-8FZIY.js +2 -0
- package/dist/client/_coffre/assets/{projects._project.index-wjtfc8E6.js → projects._project.index-DGl921dP.js} +1 -1
- package/dist/client/_coffre/assets/{projects.index-dl7dfnGW.js → projects.index-BDn7Bhoo.js} +1 -1
- package/dist/client/_coffre/assets/{row-state-BzGdu73b.js → row-state-DJ-KLamZ.js} +1 -1
- package/dist/client/_coffre/assets/{settings-DnENNWn8.js → settings-q9G1QvR_.js} +1 -1
- package/dist/client/_coffre/assets/{suspense-Cnh1cNc1.js → suspense-O8sP0mEC.js} +1 -1
- package/dist/client/_coffre/assets/tokens._token-B_qczpT9.js +2 -0
- package/dist/client/_coffre/assets/tokens._token-T-sqwMbz.js +2 -0
- package/dist/client/_coffre/assets/{tokens.index-D4HYaFJl.js → tokens.index-CcXSZnAG.js} +1 -1
- package/dist/client/_coffre/assets/{ui-Ch0beQy-.js → ui-BXP2IqrW.js} +2 -2
- package/dist/client/_coffre/assets/{unregistered-wV1yqr9t.js → unregistered-D2JXJ90x.js} +1 -1
- package/dist/client/_coffre/assets/{use-action-cgaBRBBH.js → use-action-BpzKWhgg.js} +1 -1
- package/dist/client/_coffre/assets/use-change-CKj3Inq9.js +1 -0
- package/dist/client/_coffre/assets/{use-shell-BJwawvkh.js → use-shell-W0SusPkz.js} +1 -1
- package/dist/client/_coffre/assets/useQuery-B-lxFSES.js +1 -0
- package/dist/client/_coffre/assets/{useSuspenseQuery-BfnNEmf7.js → useSuspenseQuery-BZ-nzHST.js} +1 -1
- package/dist/client/_coffre/assets/users._user-Bb3BGYHl.js +1 -0
- package/dist/client/_coffre/assets/users._user-DXmvKrzE.js +2 -0
- package/dist/client/_coffre/assets/{users.index-C7_aZ0jb.js → users.index-BvzP3qwW.js} +1 -1
- package/dist/server/.vite/manifest.json +205 -205
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-GsKnGGRy.js +162 -0
- package/dist/server/_coffre/assets/{account-BJtaf5d7.js → account-CV-a2IU2.js} +8 -8
- package/dist/server/_coffre/assets/{account-CL3AX6kY.js → account-hk6wcIXU.js} +4 -4
- package/dist/server/_coffre/assets/{audit-DiHTzVVe.js → audit-C1_Ej6YB.js} +2 -2
- package/dist/server/_coffre/assets/{audit-BtjuffEH.js → audit-qB9G2AQJ.js} +37 -9
- package/dist/server/_coffre/assets/{auth.device-8RMD0nyz.js → auth.device-6JRrWbSV.js} +4 -4
- package/dist/server/_coffre/assets/{auth.device-dUMx6Srl.js → auth.device-CLoAxC2T.js} +2 -2
- package/dist/server/_coffre/assets/{directory-9Jc5MEra.js → directory-B-_rqsPx.js} +5 -5
- package/dist/server/_coffre/assets/globals-CpMrgkV6.css +1 -0
- package/dist/server/_coffre/assets/{grants-D5-q8fXB.js → grants-DdKT11Ny.js} +5 -5
- package/dist/server/_coffre/assets/{icons-CWsTEfpn.js → icons-DOFT-eWB.js} +3 -2
- package/dist/server/_coffre/assets/{login-C80ImEsO.js → login-DRKUKkaW.js} +1 -1
- package/dist/server/_coffre/assets/{login-DmpfrcPB.js → login-DnwxVl4Y.js} +5 -5
- package/dist/server/_coffre/assets/{offboarding-CXIgvZbO.js → offboarding-CRz-K82H.js} +4 -4
- package/dist/server/_coffre/assets/{page-x4nICC9d.js → page-D6n45dcK.js} +28 -0
- package/dist/server/_coffre/assets/{principal-page-BO6Ijpqv.js → principal-page-C-EFwJQw.js} +11 -11
- package/dist/server/_coffre/assets/{projects._project._environment-BMqZsCfi.js → projects._project._environment-C6uybzeU.js} +9 -9
- package/dist/server/_coffre/assets/{projects._project._environment-BeXpetmJ.js → projects._project._environment-CS8DdSMY.js} +2 -2
- package/dist/server/_coffre/assets/{projects._project.index-B74-XdI3.js → projects._project.index-3CXwkyTh.js} +12 -12
- package/dist/server/_coffre/assets/{projects._project.index-DZ1KZvHR.js → projects._project.index-BGfcNpj0.js} +2 -2
- package/dist/server/_coffre/assets/{projects.index-D7F7hiVe.js → projects.index-iSoBpRFz.js} +7 -7
- package/dist/server/_coffre/assets/{router-fxr2e6Ht.js → router-9BTgJhWG.js} +20 -20
- package/dist/server/_coffre/assets/{row-state-CAItu3n_.js → row-state-C2P57xT1.js} +2 -2
- package/dist/server/_coffre/assets/{settings-DO8wvTmo.js → settings-BDQTF5XW.js} +3 -3
- package/dist/server/_coffre/assets/{suspense-WsBv84ga.js → suspense-C-2QfDd2.js} +1 -1
- package/dist/server/_coffre/assets/tokens._token-CrBMpcbN.js +988 -0
- package/dist/server/_coffre/assets/{tokens._token-DhcJxsf3.js → tokens._token-rY86Cjgp.js} +2 -2
- package/dist/server/_coffre/assets/{tokens.index-hvPM5IjY.js → tokens.index-Bq5qDW9q.js} +6 -6
- package/dist/server/_coffre/assets/{ui-DvlGkmaH.js → ui-Cc0CGMtr.js} +1 -1
- package/dist/server/_coffre/assets/{unregistered-DKdzrjVr.js → unregistered-D9ZKLOPJ.js} +3 -3
- package/dist/server/_coffre/assets/{use-action-D6KlY-sv.js → use-action-B-xpvVRO.js} +2 -2
- package/dist/server/_coffre/assets/{use-change-CAcOZo-a.js → use-change-C8BCf3oU.js} +20 -4
- package/dist/server/_coffre/assets/{use-shell-C-yuQ1hA.js → use-shell-DwOzEi87.js} +2 -2
- package/dist/server/_coffre/assets/{useQuery-MqmaAeUF.js → useQuery-CTe86qFq.js} +2 -2
- package/dist/server/_coffre/assets/{useSuspenseQuery-BDvlOPB7.js → useSuspenseQuery-CSoHzrMb.js} +2 -2
- package/dist/server/_coffre/assets/{users._user-dCIYuxyZ.js → users._user-BmLKYeo_.js} +2 -2
- package/dist/server/_coffre/assets/{users._user-pLdzKe1F.js → users._user-BmiHwQx3.js} +2 -2
- package/dist/server/_coffre/assets/{users.index-CDCDlQxN.js → users.index-BiEax90r.js} +6 -6
- package/dist/server/index.js +2 -2
- package/package.json +3 -3
- package/src/components/trusted-workloads.tsx +379 -0
- package/src/lib/audit-sentences.ts +26 -0
- package/src/lib/bindings.ts +111 -0
- package/src/lib/changes.ts +16 -0
- package/src/lib/queries.ts +16 -0
- package/src/routes/audit.tsx +7 -0
- package/src/routes/tokens.$token.tsx +3 -0
- package/src/styles/globals.css +43 -0
- package/dist/client/_coffre/assets/audit-CcQmaSan.js +0 -1
- package/dist/client/_coffre/assets/audit-XwuBA4r9.js +0 -2
- package/dist/client/_coffre/assets/globals-DCrHjrpD.css +0 -1
- package/dist/client/_coffre/assets/icons-BFziRUf9.js +0 -1
- package/dist/client/_coffre/assets/login-pzHGDqU5.js +0 -2
- package/dist/client/_coffre/assets/page-CDuo3uft.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-5PA9NHET.js +0 -2
- package/dist/client/_coffre/assets/projects._project._environment-B-5I0ZFP.js +0 -3
- package/dist/client/_coffre/assets/projects._project.index-BzJQojbd.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-BJiMX2TJ.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-C2s6HHWK.js +0 -2
- package/dist/client/_coffre/assets/use-change-DIpkq9iI.js +0 -1
- package/dist/client/_coffre/assets/useQuery-BHCBwHtH.js +0 -1
- package/dist/client/_coffre/assets/users._user--OY2srG0.js +0 -1
- package/dist/client/_coffre/assets/users._user-Cj4NY0p5.js +0 -2
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-C-_y9u60.js +0 -162
- package/dist/server/_coffre/assets/globals-DCrHjrpD.css +0 -1
- package/dist/server/_coffre/assets/tokens._token-CVWTFOM-.js +0 -286
package/dist/client/_coffre/assets/{projects.index-dl7dfnGW.js → projects.index-BDn7Bhoo.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,U as t,X as n,a as r,h as i,i as a,n as o,q as s}from"./page-
|
|
1
|
+
import{C as e,U as t,X as n,a as r,h as i,i as a,n as o,q as s}from"./page-C_hnzdaR.js";import{t as c}from"./link-DBINMwm6.js";import{c as l,h as u,n as d,t as f}from"./use-change-CKj3Inq9.js";import{t as p}from"./use-shell-W0SusPkz.js";import{t as m}from"./useSuspenseQuery-BZ-nzHST.js";import{i as h,o as g}from"./ui-BXP2IqrW.js";import{n as _}from"./project-environments-CfIH5kFM.js";import{n as v,r as y}from"./affordances-CEafRJcN.js";import{h as b,j as x,p as S,r as C,y as w}from"./icons-Dc_-t0lp.js";import{a as T,i as E,r as D}from"./row-state-DJ-KLamZ.js";import{n as O}from"./validation-9Cl_XS-l.js";var k=n(s()),A=t();function j(){let{data:t,refetch:n}=m(i.projects(e())),{capabilities:r}=p(),{failedAdds:s}=d(u.queryKey),l=t.ok?s(t.projects.map(e=>e.slug)):[];if(!t.ok)return(0,A.jsx)(o,{icon:(0,A.jsx)(C,{size:18}),title:`Projects could not be listed`,actions:t.signedOut?(0,A.jsx)(c,{className:`btn`,to:`/login`,children:`Sign in again`}):(0,A.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>void n(),children:`Try again`}),children:t.error});let f=t.projects.filter(e=>e.archivedAt===null),g=t.projects.filter(e=>e.archivedAt!==null);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a,{title:`Projects`,actions:(0,A.jsx)(y,{capabilities:r,children:(0,A.jsx)(P,{})})}),f.length===0&&l.length===0?(0,A.jsx)(`div`,{className:`card`,children:(0,A.jsx)(h,{title:`Nothing here for you yet`,children:(0,A.jsx)(v,{capabilities:r,hasArchivedProjects:g.length>0})})}):(0,A.jsx)(`section`,{className:`card`,"aria-label":`Projects`,children:(0,A.jsx)(M,{projects:f,refused:!0})}),g.length>0&&(0,A.jsxs)(`section`,{"aria-labelledby":`archived-projects`,children:[(0,A.jsx)(`h2`,{className:`section-title`,id:`archived-projects`,children:`Archived`}),(0,A.jsx)(`div`,{className:`card`,children:(0,A.jsx)(M,{projects:g})})]})]})}function M({projects:e,refused:t=!1}){let{status:n,failedAdds:r,dismiss:i}=d(u.queryKey);return(0,A.jsx)(`div`,{className:`dt-wrap`,children:(0,A.jsxs)(`table`,{className:`dt projects stacks`,children:[(0,A.jsx)(`thead`,{children:(0,A.jsxs)(`tr`,{children:[(0,A.jsx)(`th`,{className:`n`,children:`#`}),(0,A.jsx)(`th`,{className:`col-project`,children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(S,{size:14}),`Project`]})}),(0,A.jsx)(`th`,{children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(w,{size:14}),`Environments`]})}),(0,A.jsx)(`th`,{className:`col-shrink col-secrets`,children:(0,A.jsxs)(`span`,{className:`th`,children:[(0,A.jsx)(b,{size:14}),`Secrets`]})})]})}),(0,A.jsxs)(`tbody`,{children:[e.map((e,t)=>(0,A.jsx)(N,{number:t+1,project:e,status:n(e.slug),onDismiss:i},e.slug)),t&&r(e.map(e=>e.slug)).map(({mutationId:e,vars:t,status:n})=>(0,A.jsxs)(D,{status:n,columns:4,onDismiss:()=>i(e),children:[`Project `,t.slug,` was not created.`]},e))]})]})})}function N({number:e,project:t,status:n,onDismiss:i}){let a=t.secretCount,o=n.state===`pending`,s=t.archivedAt!==null,l=t.environments.filter(e=>e.details===null||e.details.archivedAt===null);return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`tr`,{className:`row-link ${T(n)}`,children:[(0,A.jsx)(`td`,{className:`n`,children:e}),(0,A.jsx)(`td`,{className:`col-project`,children:(0,A.jsxs)(`span`,{className:`cell-project`,children:[(0,A.jsx)(r,{name:t.slug}),(0,A.jsxs)(`span`,{className:`cell-stack`,children:[o?(0,A.jsx)(`span`,{children:t.name}):(0,A.jsx)(c,{className:`cell-link stretch`,to:`/projects/$project`,params:{project:t.slug},children:t.name}),(0,A.jsx)(`small`,{className:`mono`,children:t.slug})]})]})}),(0,A.jsx)(`td`,{className:`col-envs`,"data-label":`Environments`,children:s||l.length===0?(0,A.jsx)(`span`,{className:`cell-muted`,children:l.length===0?`No environments yet`:`${l.length} environment${l.length===1?``:`s`}`}):(0,A.jsx)(`span`,{className:`env-links`,"aria-label":`Environments in ${t.slug}`,children:l.map(e=>_(e)?(0,A.jsxs)(c,{className:`env-link`,to:`/projects/$project/$environment`,params:{project:t.slug,environment:e.slug},children:[e.slug,(0,A.jsx)(`span`,{className:`count`,children:e.details.secretCount})]},e.slug):(0,A.jsx)(`span`,{className:`env-link`,title:`You can see this environment exists, but not open it`,children:e.slug},e.slug))})}),(0,A.jsx)(`td`,{className:`col-secrets num nowrap`,children:o?(0,A.jsx)(E,{status:n}):a!==null&&!s?(0,A.jsxs)(A.Fragment,{children:[a,(0,A.jsxs)(`span`,{className:`narrow-only`,children:[` secret`,a===1?``:`s`]})]}):(0,A.jsx)(`span`,{className:`cell-muted wide-only`,children:`—`})})]}),(0,A.jsx)(D,{status:n,columns:4,onDismiss:()=>n.state===`failed`&&i(n.mutationId)})]})}function P(){let[t,n]=(0,k.useState)(``),[r,i]=(0,k.useState)(``),[a,o]=(0,k.useState)(!1),s=f(l(e())),c=t===``?null:O(t);function u(){o(!1)}return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{className:`btn btn-primary`,onClick:()=>o(!0),children:[(0,A.jsx)(x,{size:14}),`New project`]}),(0,A.jsx)(g,{open:a,onOpenChange:e=>e?o(!0):u(),title:`New project`,description:`A project holds environments, and access is granted on it or on one of its environments. You become its owner.`,children:(0,A.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),s({slug:t,name:r.trim()}),n(``),i(``),u()},children:[(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:`Slug`}),(0,A.jsx)(`input`,{className:`input input-mono`,autoFocus:!0,spellCheck:!1,autoComplete:`off`,placeholder:`market`,value:t,"aria-invalid":c!==null,"aria-describedby":`new-project-slug-hint`,onChange:e=>n(e.target.value)}),(0,A.jsx)(`span`,{className:`hint${c===null?``:` edit-note-error`}`,id:`new-project-slug-hint`,children:c??`Used in paths, as in market/prod. Renaming it later is safe.`})]}),(0,A.jsxs)(`label`,{className:`field`,children:[(0,A.jsx)(`span`,{className:`label`,children:`Display name`}),(0,A.jsx)(`input`,{className:`input`,placeholder:`Market data platform`,value:r,onChange:e=>i(e.target.value)})]}),(0,A.jsxs)(`div`,{className:`dialog-actions`,children:[(0,A.jsx)(`button`,{className:`btn`,type:`button`,onClick:u,children:`Cancel`}),(0,A.jsx)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:t===``||c!==null||r.trim()===``,children:`Create project`})]})]})})]})}export{j as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{U as e,X as t,q as n}from"./page-
|
|
1
|
+
import{U as e,X as t,q as n}from"./page-C_hnzdaR.js";import{c as r}from"./ui-BXP2IqrW.js";import{G as i,n as a}from"./icons-Dc_-t0lp.js";var o=t(n(),1),s={polite:null,urgent:null},c=0,l=new Set;function u(e,{urgent:t=!1}={}){let n={text:e,id:c++};s=t?{...s,urgent:n}:{...s,polite:n};for(let e of l)e()}function d(e){return l.add(e),()=>l.delete(e)}function f(){return s}var p={polite:null,urgent:null};function m(){return p}var h=e();function g(e){return e.state===`pending`?e.kind===`removing`?`is-removing`:`is-saving`:e.state===`failed`?`is-failed`:``}function _({status:e}){return e.state===`pending`?(0,h.jsxs)(`span`,{className:`row-pending`,children:[(0,h.jsx)(r,{size:13}),e.words.pending]}):null}function v({status:e,columns:t,onDismiss:n,children:r}){return e.state===`failed`?(0,h.jsx)(`tr`,{className:`row-error row-failure`,children:(0,h.jsx)(`td`,{colSpan:t,children:(0,h.jsx)(y,{status:e,onDismiss:n,children:r})})}):null}function y({status:e,onDismiss:t,children:n}){return e.state===`failed`?(0,h.jsxs)(`div`,{className:`row-failure-line`,children:[(0,h.jsxs)(`p`,{className:`error-line`,children:[(0,h.jsx)(a,{size:14}),(0,h.jsxs)(`span`,{children:[(0,h.jsx)(`strong`,{children:n??e.words.failed}),` `,e.error]})]}),(0,h.jsx)(`button`,{type:`button`,className:`act act-quiet`,onClick:t,"aria-label":`Dismiss`,children:(0,h.jsx)(i,{size:13})})]}):null}function b(){let{polite:e,urgent:t}=(0,o.useSyncExternalStore)(d,f,m);return(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(`div`,{className:`visually-hidden`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:e!==null&&(0,h.jsx)(`span`,{children:e.text},e.id)}),(0,h.jsx)(`div`,{className:`visually-hidden`,role:`alert`,"aria-live":`assertive`,"aria-atomic":`true`,children:t!==null&&(0,h.jsx)(`span`,{children:t.text},t.id)})]})}export{g as a,_ as i,b as n,u as o,v as r,y as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,U as t,h as n,i as r,r as i,t as a}from"./page-
|
|
1
|
+
import{C as e,U as t,h as n,i as r,r as i,t as a}from"./page-C_hnzdaR.js";import{t as o}from"./link-DBINMwm6.js";import{t as s}from"./use-shell-W0SusPkz.js";import{t as c}from"./useSuspenseQuery-BZ-nzHST.js";var l=t(),u=new Intl.ListFormat(`en`,{type:`disjunction`});function d(){let{auth:t,capabilities:d}=s(),{data:f}=c(n.directory(e(),d.canManageGrants)),p=t?.signin?.providers.map(e=>e.label)??[],m=f?.ok===!0?f.principals:null,h=m?.filter(e=>e.isRootAdmin)??[],g=m?.filter(e=>e.principalType===`user`).length??0,_=m?.filter(e=>e.principalType===`service`).length??0;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(r,{title:`Settings`}),(0,l.jsx)(a,{labelledBy:`instance`,title:`Instance`,description:`Set in the deployment's configuration, so shown here rather than edited.`,children:(0,l.jsxs)(`dl`,{className:`facts`,children:[(0,l.jsx)(i,{label:`Sign-in`,children:t?.signin?`coffre’s own sign-in, with ${u.format(p)}. Only invited members get in.`:`Cloudflare Access. coffre has no sign-in of its own; every request carries an Access assertion that is verified at the origin.`}),m!==null&&(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(i,{label:`Root admins`,children:(0,l.jsx)(`span`,{className:`fact-list`,children:h.map(e=>(0,l.jsx)(`span`,{className:`mono`,children:e.principalId},e.principalId))})}),(0,l.jsx)(i,{label:`Directory`,children:(0,l.jsxs)(`span`,{children:[(0,l.jsxs)(o,{to:`/users`,children:[g,` user`,g===1?``:`s`]}),` · `,(0,l.jsxs)(o,{to:`/tokens`,children:[_,` token`,_===1?``:`s`]})]})})]})]})})]})}export{d as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as e,B as t,D as n,E as r,I as i,L as a,M as o,N as s,O as c,P as l,R as u,U as d,X as f,k as p,q as m,z as h}from"./page-
|
|
1
|
+
import{A as e,B as t,D as n,E as r,I as i,L as a,M as o,N as s,O as c,P as l,R as u,U as d,X as f,k as p,q as m,z as h}from"./page-C_hnzdaR.js";var g=f(m(),1),_=d(),v=g.createContext(void 0),y=e=>{let t=g.useContext(v);if(e)return e;if(!t)throw Error(`No QueryClient set, use QueryClientProvider to set one`);return t},b=({client:e,children:t})=>(g.useEffect(()=>(e.mount(),()=>{e.unmount()}),[e]),(0,_.jsx)(v.Provider,{value:e,children:t})),x=class extends p{#e;#t=void 0;#n=void 0;#r=void 0;#i;#a;#o;#s;#c;#l;#u;#d;#f;#p=new Set;constructor(e,t){super(),this.options=t,this.#e=e,this.#o=null,this.bindMethods(),this.setOptions(t)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(this.#t.addObserver(this),C(this.#t,this.options)?this.#m():this.updateResult(),this.#y())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return w(this.#t,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return w(this.#t,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#b(),this.#x(),this.#t.removeObserver(this)}setOptions(e){let t=this.options,n=this.#t;if(this.options=this.#e.defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!=`boolean`&&typeof this.options.enabled!=`function`&&typeof i(this.options.enabled,this.#t)!=`boolean`)throw Error(`Expected enabled to be a boolean or a callback that returns a boolean`);this.#S(),this.#t.setOptions(this.options),t._defaulted&&!a(this.options,t)&&this.#e.getQueryCache().notify({type:`observerOptionsUpdated`,query:this.#t,observer:this});let r=this.hasListeners();r&&T(this.#t,n,this.options,t)&&this.#m(),this.updateResult(),r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||i(this.options.staleTime,this.#t)!==i(t.staleTime,this.#t))&&this.#g();let o=this.#_();r&&(this.#t!==n||i(this.options.enabled,this.#t)!==i(t.enabled,this.#t)||o!==this.#f)&&this.#v(o)}getOptimisticResult(e){let t=this.#e.getQueryCache().build(this.#e,e),n=this.createResult(t,e);return a(this.getCurrentResult(),n)||(this.#r=n,this.#a=this.options,this.#i=this.#t.state),n}getCurrentResult(){return this.#r}trackResult(e,t){return new Proxy(e,{get:(e,n)=>(this.trackProp(n),t?.(n),Reflect.get(e,n))})}trackProp(e){this.#p.add(e)}getCurrentQuery(){return this.#t}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),n=this.#e.getQueryCache().build(this.#e,t),r=()=>{},i,a=new Promise(e=>{i=e,r=this.#e.getQueryCache().subscribe(i=>{i.type===`updated`&&i.query.queryHash===n.queryHash&&n.state.data!==void 0&&(r(),e(this.createResult(n,t)))})});return Promise.race([n.fetch().then(()=>{let e=this.createResult(n,t);return i?.(e),e}).finally(()=>{r()}),a])}fetch(e){return this.#m({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#r))}#m(e){this.#S();let t=this.#t.fetch(this.options,e);return e?.throwOnError||(t=t.catch(s)),t}#h(t){return!e()&&i(this.options.enabled,this.#t)!==!1&&o(t)}#g(){this.#b();let e=i(this.options.staleTime,this.#t);if(this.#r.isStale||!this.#h(e))return;let n=h(this.#r.dataUpdatedAt,e)+1;this.#u=t.setTimeout(()=>{this.#r.isStale||this.updateResult()},n)}#_(){return i(this.options.refetchInterval,this.#t)??!1}#v(e){this.#x(),this.#f=e,!(this.#f===0||!this.#h(this.#f))&&(this.#d=t.setInterval(()=>{(this.options.refetchIntervalInBackground||c.isFocused())&&this.#m()},this.#f))}#y(){this.#g(),this.#v(this.#_())}#b(){this.#u!==void 0&&(t.clearTimeout(this.#u),this.#u=void 0)}#x(){this.#d!==void 0&&(t.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let n=this.#t,a=this.options,o=this.#r,s=this.#i,c=this.#a,u=e===n?this.#n:e.state,{state:d}=e,f={...d},p=!1,m;if(t._optimisticResults){let i=this.hasListeners(),o=!i&&C(e,t),s=i&&T(e,n,t,a);(o||s)&&(f={...f,...r(d.data,e.options)}),t._optimisticResults===`isRestoring`&&(f.fetchStatus=`idle`)}let{error:h,errorUpdatedAt:g,status:_}=f;m=f.data;let v=!1;if(t.placeholderData!==void 0&&m===void 0&&_===`pending`){let e;o?.isPlaceholderData&&t.placeholderData===c?.placeholderData?(e=o.data,v=!0):e=typeof t.placeholderData==`function`?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,e!==void 0&&(_=`success`,m=l(o?.data,e,t),p=!0)}if(t.select&&m!==void 0&&!v)if(o&&m===s?.data&&t.select===this.#s)m=this.#c;else try{this.#s=t.select,m=t.select(m),m=l(o?.data,m,t),this.#c=m,this.#o=null}catch(e){this.#o=e}else m===void 0&&(this.#o=null);this.#o&&(h=this.#o,m=this.#c,g=Date.now(),_=`error`,p=!1);let y=f.fetchStatus===`fetching`,b=_===`pending`,x=_===`error`,S=b&&y,w=m!==void 0;return{status:_,fetchStatus:f.fetchStatus,isPending:b,isSuccess:_===`success`,isError:x,isInitialLoading:S,isLoading:S,data:m,dataUpdatedAt:f.dataUpdatedAt,error:h,errorUpdatedAt:g,failureCount:f.fetchFailureCount,failureReason:f.fetchFailureReason,errorUpdateCount:f.errorUpdateCount,isFetched:e.isFetched(),isFetchedAfterMount:f.dataUpdateCount>u.dataUpdateCount||f.errorUpdateCount>u.errorUpdateCount,isFetching:y,isRefetching:y&&!b,isLoadingError:x&&!w,isPaused:f.fetchStatus===`paused`,isPlaceholderData:p,isRefetchError:x&&w,isStale:E(e,t),refetch:this.refetch,isEnabled:i(t.enabled,e)!==!1}}updateResult(){let e=this.#r,t=this.createResult(this.#t,this.options);if(this.#i=this.#t.state,this.#a=this.options,this.#i.data!==void 0&&(this.#l=this.#t),a(t,e))return;this.#r=t;let r=(()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,n=typeof t==`function`?t():t;if(n===`all`||!n&&!this.#p.size)return!0;let r=new Set(n??this.#p);return this.options.throwOnError&&r.add(`error`),Object.keys(this.#r).some(t=>{let n=t;return this.#r[n]!==e[n]&&r.has(n)})})();n.batch(()=>{r&&this.listeners.forEach(e=>{e(this.#r)}),this.#e.getQueryCache().notify({query:this.#t,type:`observerResultsUpdated`})})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#t)return;let t=this.#t;this.#t=e,this.#n=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#y()}};function S(e,t){return i(t.enabled,e)!==!1&&e.state.data===void 0&&!(e.state.status===`error`&&i(t.retryOnMount,e)===!1)}function C(e,t){return S(e,t)||e.state.data!==void 0&&w(e,t,t.refetchOnMount)}function w(e,t,n){if(i(t.enabled,e)!==!1&&i(t.staleTime,e)!==`static`){let r=i(n,e);return r===`always`||r!==!1&&E(e,t)}return!1}function T(e,t,n,r){return(e!==t||i(r.enabled,e)===!1)&&(!n.suspense||e.state.status!==`error`)&&E(e,n)}function E(e,t){return i(t.enabled,e)!==!1&&e.isStaleByTime(i(t.staleTime,e))}var D=g.createContext(!1),O=()=>g.useContext(D);D.Provider;function k(){let e=!1;return{clearReset:()=>{e=!1},reset:()=>{e=!0},isReset:()=>e}}var A=g.createContext(k()),j=()=>g.useContext(A),M=(e,t,n)=>{let r=n?.state.error&&typeof e.throwOnError==`function`?u(e.throwOnError,[n.state.error,n]):e.throwOnError;(e.suspense||r)&&(t.isReset()||(e.retryOnMount=!1))},N=e=>{g.useEffect(()=>{e.clearReset()},[e])},P=({result:e,errorResetBoundary:t,throwOnError:n,query:r,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&r&&(i&&e.data===void 0||u(n,[e.error,r])),F=(e,t)=>t.state.data===void 0,I=e=>{if(e.suspense){let t=1e3,n=e=>e===`static`?e:Math.max(e??t,t),r=e.staleTime;e.staleTime=typeof r==`function`?(...e)=>n(r(...e)):n(r),typeof e.gcTime==`number`&&(e.gcTime=Math.max(e.gcTime,t))}},L=(e,t)=>e?.suspense&&t.isPending,R=(e,t,n)=>t.fetchOptimistic(e).catch(()=>{n.clearReset()});export{M as a,j as c,b as d,y as f,L as i,O as l,I as n,P as o,R as r,N as s,F as t,x as u};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["_coffre/assets/tokens._token-T-sqwMbz.js","_coffre/assets/page-C_hnzdaR.js","_coffre/assets/use-change-CKj3Inq9.js","_coffre/assets/suspense-O8sP0mEC.js","_coffre/assets/row-state-DJ-KLamZ.js","_coffre/assets/ui-BXP2IqrW.js","_coffre/assets/link-DBINMwm6.js","_coffre/assets/icons-Dc_-t0lp.js","_coffre/assets/use-shell-W0SusPkz.js","_coffre/assets/useSuspenseQuery-BZ-nzHST.js","_coffre/assets/use-action-BpzKWhgg.js","_coffre/assets/principal-page-DLho8TSJ.js","_coffre/assets/dist-Braunv_x.js","_coffre/assets/directory-H8Eh3MnS.js","_coffre/assets/grants-DPDxJXU1.js","_coffre/assets/offboarding-Bwpftp3g.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{u as e}from"./page-C_hnzdaR.js";import{n as t,r as n,t as r}from"./preload-helper-CLkO85Nq.js";var i=n(`/tokens/$token`)({loader:({context:{client:t,queryClient:n},params:r})=>e(n,t,`service`,r.token),component:t(()=>r(()=>import(`./tokens._token-T-sqwMbz.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15])),`component`)});export{i as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{C as e,U as t,X as n,b as r,h as i,o as a,q as o,t as s}from"./page-C_hnzdaR.js";import{b as c,g as l,n as u,t as d}from"./use-change-CKj3Inq9.js";import{t as f}from"./use-shell-W0SusPkz.js";import{t as p}from"./useSuspenseQuery-BZ-nzHST.js";import{a as m,c as h,i as g,l as _,o as v,r as y,s as b,t as x}from"./ui-BXP2IqrW.js";import{G as S,j as C,m as w,v as T,x as E}from"./icons-Dc_-t0lp.js";import{a as D,i as O,r as k}from"./row-state-DJ-KLamZ.js";import{t as A}from"./tokens._token-B_qczpT9.js";import{t as j}from"./use-action-BpzKWhgg.js";import{t as M}from"./principal-page-DLho8TSJ.js";var N=n(o(),1),P=t(),F=[30,90,180,365];function I({serviceId:t,tokens:n}){let r=c(e(),t),i=d(r),{status:a,dismiss:o}=u(r.list.queryKey);return(0,P.jsx)(s,{labelledBy:`service-tokens`,title:`Credentials`,description:`Bearer tokens this service presents to the API. Each is shown once, when it is issued; coffre keeps only a hash.`,actions:(0,P.jsx)(L,{serviceId:t}),children:n.length===0?(0,P.jsx)(g,{title:`No live credentials`,children:`Nothing can act as this service until a token is issued.`}):(0,P.jsx)(`div`,{className:`dt-wrap`,children:(0,P.jsxs)(`table`,{className:`dt`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`Token`}),(0,P.jsx)(`th`,{className:`col-shrink`,children:`Issued (UTC)`}),(0,P.jsx)(`th`,{className:`col-shrink`,children:`Last used`}),(0,P.jsx)(`th`,{className:`col-shrink`,children:`Expires`}),(0,P.jsx)(`th`,{className:`col-actions`,children:(0,P.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,P.jsx)(`tbody`,{children:n.map(e=>{let t=a(e.id);return(0,P.jsxs)(N.Fragment,{children:[(0,P.jsxs)(`tr`,{className:D(t),children:[(0,P.jsx)(`td`,{children:(0,P.jsxs)(`span`,{className:`cell-account`,children:[(0,P.jsx)(T,{size:15}),(0,P.jsxs)(`span`,{className:`cell-stack`,children:[(0,P.jsx)(`span`,{children:e.label??`Unlabelled`}),(0,P.jsx)(`small`,{className:`mono`,children:e.hint})]})]})}),(0,P.jsx)(`td`,{className:`nowrap`,children:(0,P.jsxs)(`span`,{className:`cell-stack`,children:[(0,P.jsx)(_,{iso:e.createdAt}),(0,P.jsxs)(`small`,{children:[`by `,e.createdBy]})]})}),(0,P.jsx)(`td`,{className:`nowrap cell-muted`,children:e.lastUsedAt===null?`Never`:(0,P.jsxs)(`span`,{className:`cell-stack`,children:[(0,P.jsx)(_,{iso:e.lastUsedAt,display:`relative`}),e.lastUsedIp!==null&&(0,P.jsx)(`small`,{className:`mono`,children:e.lastUsedIp})]})}),(0,P.jsx)(`td`,{className:`nowrap cell-muted`,children:(0,P.jsx)(_,{iso:e.expiresAt,display:`relative`})}),(0,P.jsx)(`td`,{className:`col-actions`,children:t.state===`pending`?(0,P.jsx)(O,{status:t}):(0,P.jsx)(x,{trigger:(0,P.jsxs)(`button`,{className:`act`,children:[(0,P.jsx)(S,{size:13}),`Revoke`]}),title:(0,P.jsxs)(P.Fragment,{children:[`Revoke `,(0,P.jsx)(`span`,{className:`mono`,children:e.hint}),`?`]}),body:`Whatever uses it is refused from its next request. Issue a new token first if the service should keep working.`,confirmLabel:`Revoke token`,onConfirm:()=>i(e)})})]}),(0,P.jsx)(k,{status:t,columns:5,onDismiss:()=>t.state===`failed`&&o(t.mutationId)})]},e.id)})})]})})})}function L({serviceId:t}){let[n,i]=(0,N.useState)(!1),[o,s]=(0,N.useState)(``),[c,l]=(0,N.useState)(90),[u,d]=(0,N.useState)(null),f=e(),{pending:p,error:g,setError:x,run:S}=j();function w(){i(!1),d(null),s(``),x(null)}return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>i(!0),children:[(0,P.jsx)(C,{size:14}),`Issue token`]}),(0,P.jsx)(v,{open:n,onOpenChange:e=>e?i(!0):w(),title:u===null?`Issue a token`:`Copy the token now`,children:u===null?(0,P.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),S(()=>f.tokens.issue(r(`service`,t),{label:o.trim()===``?null:o.trim(),expiresInDays:c}),{affects:a.credentials(r(`service`,t)),onSuccess:e=>d(e)})},children:[(0,P.jsxs)(`div`,{className:`form-row`,children:[(0,P.jsxs)(`label`,{className:`field`,children:[(0,P.jsx)(`span`,{className:`label`,children:`Label`}),(0,P.jsx)(`input`,{className:`input`,value:o,maxLength:120,placeholder:`GitHub Actions deploy`,onChange:e=>s(e.target.value)})]}),(0,P.jsxs)(`label`,{className:`field`,style:{flex:`0 0 9rem`},children:[(0,P.jsx)(`span`,{className:`label`,children:`Expires after`}),(0,P.jsx)(`select`,{className:`select`,value:c,onChange:e=>l(Number(e.target.value)),children:F.map(e=>(0,P.jsxs)(`option`,{value:e,children:[e,` days`]},e))})]})]}),(0,P.jsx)(m,{error:g}),(0,P.jsxs)(`div`,{className:`dialog-actions`,children:[(0,P.jsx)(`button`,{className:`btn`,type:`button`,onClick:w,children:`Cancel`}),(0,P.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:p,children:[p&&(0,P.jsx)(h,{}),`Issue token`]})]})]}):(0,P.jsxs)(`div`,{className:`form`,children:[(0,P.jsxs)(b,{tone:`info`,children:[`This is the only time the value is shown. Store it where the service reads its configuration, as `,(0,P.jsx)(`span`,{className:`mono`,children:`COFFRE_TOKEN`}),`.`]}),(0,P.jsxs)(`div`,{className:`token-once`,children:[(0,P.jsx)(`code`,{className:`mono`,children:u.token}),(0,P.jsx)(y,{value:u.token,label:`Copy token`})]}),(0,P.jsxs)(`p`,{className:`hint`,children:[`Expires `,(0,P.jsx)(_,{iso:u.expiresAt}),`. Send it as`,` `,(0,P.jsx)(`span`,{className:`mono`,children:`Authorization: Bearer …`})]}),(0,P.jsx)(`div`,{className:`dialog-actions`,children:(0,P.jsx)(`button`,{className:`btn btn-primary`,type:`button`,onClick:w,children:`Done`})})]})})]})}var R=[`push`,`workflow_dispatch`,`schedule`,`release`],z=[`push`,`web`,`schedule`];function B(e,t){return`refs/${e===`branch`?`heads`:`tags`}/${t}`}function V(e,t,n){return`${e}/.github/workflows/${t.replace(/^\.github\/workflows\//,``)}@${n}`}function H(e){return{profile:`github`,claims:{repository_owner_id:e.ownerId,repository_id:e.repositoryId,workflow_ref:V(e.repository,e.workflow,e.ref),ref:e.ref,event_name:e.event}}}function U(e){let t={repository_owner_id:e.ownerId,...e.repositoryId===null?{}:{repository_id:e.repositoryId},ref:e.ref,event_name:e.event,job_workflow_ref:e.called,job_workflow_sha:e.sha};return e.caller!==void 0&&(t.workflow_ref=V(e.caller.repository,e.caller.workflow,e.ref)),{profile:e.repositoryId===null?`github-reusable-organization`:`github-reusable`,claims:t}}function W(e){return{profile:`gitlab`,claims:{namespace_id:e.namespaceId,project_id:e.projectId,ref_type:e.refType,ref:e.ref,pipeline_source:e.source}}}function G(e){let{claims:t}=e,n=e=>e?.replace(/^refs\/(heads|tags)\//,``)??``,[r,i]=(t.workflow_ref??``).split(`@`);if(e.profile===`github`){let[e,a,,,o]=(r??``).split(`/`);return{title:`${e}/${a} · ${o}`,detail:`${t.event_name} at ${n(i)}`}}if(e.profile.startsWith(`github-reusable`)){let r=(t.job_workflow_ref??``).split(`@`)[0].replace(`/.github/workflows/`,` · `),i=e.profile===`github-reusable-organization`?`any repository of the organization`:`repository ${t.repository_id}`;return{title:`${r} @ ${t.job_workflow_sha?.slice(0,7)}`,detail:`${t.event_name} at ${n(t.ref)}, from ${i}`}}return e.profile===`gitlab`?{title:`GitLab project ${t.project_id}`,detail:`${t.pipeline_source} at ${t.ref_type} ${t.ref}`}:{title:new URL(e.issuer).host,detail:`sub ${t.sub}`}}var K={platform:`github`,label:``,reusable:!1,repository:``,repositoryId:``,ownerId:``,workflow:``,event:`push`,refKind:`branch`,refName:`main`,called:``,sha:``,anyRepository:!1,gitlabUrl:``,project:``,projectId:``,namespaceId:``,source:`push`,issuer:``,sub:``,extra:``};function q(e){let t=(e,t)=>{if(e.trim()===``)throw Error(`${t} is needed`);return e.trim()};if(e.platform===`github`){let n=B(e.refKind,t(e.refName,e.refKind===`branch`?`The branch`:`The tag`));if(e.reusable){let r=t(e.called,`The called workflow`),i=t(e.sha,`The called workflow's commit`),a=t(e.ownerId,`The owner's ID`),o=e.workflow.trim()===``?void 0:{repository:t(e.repository,`The repository`),workflow:e.workflow.trim()};return{...U({repositoryId:e.anyRepository?null:t(e.repositoryId,`The repository's ID`),ownerId:a,ref:n,event:e.event,called:r,sha:i,caller:o}),issuer:null}}return{...H({repository:t(e.repository,`The repository`),repositoryId:t(e.repositoryId,`The repository's ID`),ownerId:t(e.ownerId,`The owner's ID`),workflow:t(e.workflow,`The workflow file`),ref:n,event:e.event}),issuer:null}}if(e.platform===`gitlab`)return{...W({namespaceId:t(e.namespaceId,`The namespace's ID`),projectId:t(e.projectId,`The project's ID`),refType:e.refKind,ref:t(e.refName,e.refKind===`branch`?`The branch`:`The tag`),source:e.source}),issuer:e.gitlabUrl.trim()===``?null:e.gitlabUrl.trim()};let n={sub:t(e.sub,`The subject`)};for(let t of e.extra.split(`
|
|
2
|
+
`).map(e=>e.trim()).filter(e=>e!==``)){let e=t.indexOf(`=`);if(e<=0)throw Error(`"${t}" is not <claim>=<value>`);n[t.slice(0,e).trim()]=t.slice(e+1).trim()}return{profile:`custom`,issuer:t(e.issuer,`The issuer`),claims:n}}function J({serviceId:t,bindings:n}){let r=l(e(),t),i=d(r),{status:a,dismiss:o}=u(r.list.queryKey);return(0,P.jsx)(s,{labelledBy:`trusted-workloads`,title:`Trusted workloads`,description:`CI runs that may sign in as this service with the ID token their platform signs, when every claim of a binding matches. Nothing long-lived is stored.`,actions:(0,P.jsx)(X,{serviceId:t}),children:n.length===0?(0,P.jsx)(g,{title:`No trusted workloads`,children:`CI can still use a token. Trust a workflow to let its runs sign in without one.`}):(0,P.jsx)(`div`,{className:`dt-wrap`,children:(0,P.jsxs)(`table`,{className:`dt`,children:[(0,P.jsx)(`thead`,{children:(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`Workload`}),(0,P.jsx)(`th`,{className:`col-shrink`,children:`Added (UTC)`}),(0,P.jsx)(`th`,{className:`col-shrink`,children:`Last used`}),(0,P.jsx)(`th`,{className:`col-actions`,children:(0,P.jsx)(`span`,{className:`visually-hidden`,children:`Actions`})})]})}),(0,P.jsx)(`tbody`,{children:n.map(e=>{let t=a(e.id),{title:n,detail:r}=G(e);return(0,P.jsxs)(N.Fragment,{children:[(0,P.jsxs)(`tr`,{className:D(t),children:[(0,P.jsx)(`td`,{children:(0,P.jsxs)(`span`,{className:`cell-account`,children:[e.profile.startsWith(`github`)?(0,P.jsx)(w,{size:15}):(0,P.jsx)(E,{size:15}),(0,P.jsxs)(`span`,{className:`cell-stack`,children:[(0,P.jsx)(`span`,{children:e.label??n}),(0,P.jsx)(`small`,{children:e.label===null?r:`${n} · ${r}`}),(0,P.jsxs)(`details`,{className:`claims`,children:[(0,P.jsx)(`summary`,{children:`Claims`}),(0,P.jsx)(Y,{binding:e})]})]})]})}),(0,P.jsx)(`td`,{className:`nowrap`,children:(0,P.jsxs)(`span`,{className:`cell-stack`,children:[(0,P.jsx)(_,{iso:e.createdAt}),(0,P.jsxs)(`small`,{children:[`by `,e.createdBy]})]})}),(0,P.jsx)(`td`,{className:`nowrap cell-muted`,children:e.lastUsedAt===null?`Never`:(0,P.jsx)(_,{iso:e.lastUsedAt,display:`relative`})}),(0,P.jsx)(`td`,{className:`col-actions`,children:t.state===`pending`?(0,P.jsx)(O,{status:t}):(0,P.jsx)(x,{trigger:(0,P.jsxs)(`button`,{className:`act`,children:[(0,P.jsx)(S,{size:13}),`Remove`]}),title:(0,P.jsxs)(P.Fragment,{children:[`Stop trusting `,e.label??n,`?`]}),body:`Its runs are refused from their next sign-in, and credentials they hold stop working. A binding removed is never trusted again; to trust the runs again, add a new one.`,confirmLabel:`Remove binding`,onConfirm:()=>i(e)})})]}),(0,P.jsx)(k,{status:t,columns:4,onDismiss:()=>t.state===`failed`&&o(t.mutationId)})]},e.id)})})]})})})}function Y({binding:e}){return(0,P.jsx)(`table`,{className:`claims-table`,children:(0,P.jsxs)(`tbody`,{children:[(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`iss`}),(0,P.jsx)(`td`,{className:`mono`,children:e.issuer})]}),Object.entries(e.claims).map(([e,t])=>(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{className:`mono`,children:e}),(0,P.jsx)(`td`,{className:`mono`,children:t})]},e)),(0,P.jsxs)(`tr`,{children:[(0,P.jsx)(`th`,{children:`keys`}),(0,P.jsx)(`td`,{className:`mono`,children:e.jwksUri})]})]})})}function X({serviceId:t}){let[n,i]=(0,N.useState)(!1),[o,s]=(0,N.useState)(K),[c,l]=(0,N.useState)(null),u=e(),d=r(`service`,t),{pending:f,error:p,setError:g,run:_}=j(),y=j(),x=e=>{s(t=>({...t,...e})),l(null)},S=()=>({...q(o),label:o.label.trim()===``?null:o.label.trim(),replaces:[]});function w(){i(!1),s(K),l(null),g(null),y.setError(null)}function T(){let e;try{e=S()}catch(e){g(e.message);return}_(()=>u.bindings.preview(d,e),{affects:[],onSuccess:l})}let E=(e,t,n={})=>(0,P.jsxs)(`label`,{className:`field`,children:[(0,P.jsx)(`span`,{className:`label`,children:e}),(0,P.jsx)(`input`,{className:`input${n.mono?` mono`:``}`,value:o[t],placeholder:n.placeholder,onChange:e=>x({[t]:e.target.value})}),n.hint!==void 0&&(0,P.jsx)(`span`,{className:`hint`,children:n.hint})]}),D=(0,P.jsxs)(`div`,{className:`form-row`,children:[(0,P.jsxs)(`label`,{className:`field`,style:{flex:`0 0 8rem`},children:[(0,P.jsx)(`span`,{className:`label`,children:`At`}),(0,P.jsxs)(`select`,{className:`select`,value:o.refKind,onChange:e=>x({refKind:e.target.value}),children:[(0,P.jsx)(`option`,{value:`branch`,children:`Branch`}),(0,P.jsx)(`option`,{value:`tag`,children:`Tag`})]})]}),E(o.refKind===`branch`?`Branch`:`Tag`,`refName`,{mono:!0})]});return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`button`,{className:`btn btn-sm`,onClick:()=>i(!0),children:[(0,P.jsx)(C,{size:14}),`Trust a workload`]}),(0,P.jsx)(v,{open:n,onOpenChange:e=>e?i(!0):w(),title:c===null?`Trust a workload`:`Review the binding`,children:c===null?(0,P.jsxs)(`form`,{className:`form`,onSubmit:e=>{e.preventDefault(),T()},children:[(0,P.jsx)(`nav`,{className:`segmented`,"aria-label":`Platform`,children:[`github`,`gitlab`,`other`].map(e=>(0,P.jsx)(`button`,{type:`button`,"aria-pressed":o.platform===e,onClick:()=>x({platform:e}),children:e===`github`?`GitHub Actions`:e===`gitlab`?`GitLab`:`Other issuer`},e))}),o.platform===`github`&&(0,P.jsxs)(P.Fragment,{children:[(0,P.jsxs)(`nav`,{className:`segmented`,"aria-label":`Workflow`,children:[(0,P.jsx)(`button`,{type:`button`,"aria-pressed":!o.reusable,onClick:()=>x({reusable:!1}),children:`A workflow of the repository`}),(0,P.jsx)(`button`,{type:`button`,"aria-pressed":o.reusable,onClick:()=>x({reusable:!0}),children:`A reusable workflow`})]}),(0,P.jsxs)(`div`,{className:`form-row`,children:[E(`Repository`,`repository`,{placeholder:`acme/api`,mono:!0}),(0,P.jsx)(`div`,{className:`field`,style:{flex:`0 0 auto`,alignSelf:`end`},children:(0,P.jsxs)(`button`,{className:`btn`,type:`button`,disabled:y.pending||o.repository.trim()===``,onClick:()=>void y.run(()=>u.bindings.lookup({github:o.repository.trim()}),{affects:[],onSuccess:e=>`repositoryId`in e&&x({repositoryId:e.repositoryId,ownerId:e.ownerId})}),children:[y.pending&&(0,P.jsx)(h,{}),`Look up IDs`]})})]}),(0,P.jsxs)(`div`,{className:`form-row`,children:[!(o.reusable&&o.anyRepository)&&E(`Repository ID`,`repositoryId`,{mono:!0}),E(`Owner ID`,`ownerId`,{mono:!0})]}),(0,P.jsxs)(`p`,{className:`hint`,children:[`Bindings name IDs, which unlike names nobody else can take over. For a private repository:`,` `,(0,P.jsxs)(`span`,{className:`mono`,children:[`gh api repos/`,o.repository.trim()||`acme/api`,` --jq '.id, .owner.id'`]})]}),(0,P.jsx)(m,{error:y.error}),o.reusable?(0,P.jsxs)(P.Fragment,{children:[E(`Called workflow`,`called`,{placeholder:`acme/deploy/.github/workflows/release.yml@refs/heads/main`,mono:!0}),E(`Its commit`,`sha`,{placeholder:`the full SHA it is trusted at`,mono:!0,hint:`A new version of the workflow needs a new binding.`}),E(`Calling workflow (optional)`,`workflow`,{placeholder:`deploy.yml`,mono:!0,hint:`Left out, every workflow of the repository at the ref below may call it.`}),(0,P.jsxs)(`label`,{className:`check`,children:[(0,P.jsx)(`input`,{type:`checkbox`,checked:o.anyRepository,onChange:e=>x({anyRepository:e.target.checked})}),`Called from any repository of the organization`]})]}):E(`Workflow file`,`workflow`,{placeholder:`deploy.yml`,mono:!0}),(0,P.jsxs)(`label`,{className:`field`,children:[(0,P.jsx)(`span`,{className:`label`,children:`Event`}),(0,P.jsx)(`select`,{className:`select`,value:o.event,onChange:e=>x({event:e.target.value}),children:R.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))}),(0,P.jsx)(`span`,{className:`hint`,children:`Pull requests and workflow_run are never trusted: their runs can carry a stranger's code.`})]}),D]}),o.platform===`gitlab`&&(0,P.jsxs)(P.Fragment,{children:[E(`GitLab`,`gitlabUrl`,{placeholder:`https://gitlab.com`,hint:`Left empty, gitlab.com.`}),(0,P.jsxs)(`div`,{className:`form-row`,children:[E(`Project`,`project`,{placeholder:`acme/api`,mono:!0}),(0,P.jsx)(`div`,{className:`field`,style:{flex:`0 0 auto`,alignSelf:`end`},children:(0,P.jsxs)(`button`,{className:`btn`,type:`button`,disabled:y.pending||o.project.trim()===``,onClick:()=>void y.run(()=>u.bindings.lookup({gitlab:o.project.trim(),...o.gitlabUrl.trim()===``?{}:{gitlabUrl:o.gitlabUrl.trim()}}),{affects:[],onSuccess:e=>`projectId`in e&&x({projectId:e.projectId,namespaceId:e.namespaceId})}),children:[y.pending&&(0,P.jsx)(h,{}),`Look up IDs`]})})]}),(0,P.jsxs)(`div`,{className:`form-row`,children:[E(`Project ID`,`projectId`,{mono:!0}),E(`Namespace ID`,`namespaceId`,{mono:!0})]}),(0,P.jsx)(m,{error:y.error}),D,(0,P.jsxs)(`label`,{className:`field`,children:[(0,P.jsx)(`span`,{className:`label`,children:`Pipeline source`}),(0,P.jsx)(`select`,{className:`select`,value:o.source,onChange:e=>x({source:e.target.value}),children:z.map(e=>(0,P.jsx)(`option`,{value:e,children:e},e))}),(0,P.jsx)(`span`,{className:`hint`,children:`Merge-request pipelines are never trusted: they name another project.`})]})]}),o.platform===`other`&&(0,P.jsxs)(P.Fragment,{children:[E(`Issuer`,`issuer`,{placeholder:`https://accounts.google.com`}),E(`Subject (sub)`,`sub`,{mono:!0,hint:`You vouch for what this issuer's subject means: a Google service account's unique ID, say.`}),(0,P.jsxs)(`label`,{className:`field`,children:[(0,P.jsxs)(`span`,{className:`label`,children:[`Other claims, one `,(0,P.jsx)(`span`,{className:`mono`,children:`name=value`}),` a line`]}),(0,P.jsx)(`textarea`,{className:`input mono`,rows:3,value:o.extra,onChange:e=>x({extra:e.target.value})})]})]}),E(`Label (optional)`,`label`,{placeholder:`Deploys to production`}),(0,P.jsx)(m,{error:p}),(0,P.jsxs)(`div`,{className:`dialog-actions`,children:[(0,P.jsx)(`button`,{className:`btn`,type:`button`,onClick:w,children:`Cancel`}),(0,P.jsxs)(`button`,{className:`btn btn-primary`,type:`submit`,disabled:f,children:[f&&(0,P.jsx)(h,{}),`Review`]})]})]}):(0,P.jsxs)(`div`,{className:`form`,children:[(0,P.jsxs)(`p`,{children:[`Runs whose ID token carries exactly these claims will sign in as `,(0,P.jsx)(`span`,{className:`mono`,children:d}),`, and read what it may read.`]}),(0,P.jsx)(Y,{binding:c}),c.replaces.length>0&&(0,P.jsxs)(b,{tone:`info`,children:[`This replaces `,c.replaces.length===1?`a binding`:`${c.replaces.length} bindings`,c.replaces.some(e=>e.why===`keys_moved`)?`, since the issuer moved its keys`:``,`.`]}),(0,P.jsx)(m,{error:p}),(0,P.jsxs)(`div`,{className:`dialog-actions`,children:[(0,P.jsx)(`button`,{className:`btn`,type:`button`,onClick:()=>l(null),children:`Back`}),(0,P.jsxs)(`button`,{className:`btn btn-primary`,type:`button`,disabled:f,onClick:()=>void _(()=>u.bindings.create(d,S()),{affects:a.bindings(d),onSuccess:w}),children:[f&&(0,P.jsx)(h,{}),`Save binding`]})]})]})})]})}function Z(){let{token:t}=A.useParams(),n=e(),{auth:a,capabilities:o}=f(),s=r(`service`,t),c=o.canManageGrants,{data:l}=p(i.report(n,s,c)),{data:u}=p(i.credentials(n,s,c&&a.signin!==null)),{data:d}=p(i.bindings(n,s,c&&a.signin!==null)),m=l?.ok===!0&&l.report?.status===`active`;return(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(M,{principalType:`service`,principalId:t}),m&&u?.ok===!0&&(0,P.jsx)(I,{serviceId:t,tokens:u.tokens}),m&&d?.ok===!0&&(0,P.jsx)(J,{serviceId:t,bindings:d.bindings})]})}export{Z as component};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{C as e,U as t,h as n,i as r,n as i}from"./page-
|
|
1
|
+
import{C as e,U as t,h as n,i as r,n as i}from"./page-C_hnzdaR.js";import{t as a}from"./use-shell-W0SusPkz.js";import{t as o}from"./useSuspenseQuery-BZ-nzHST.js";import{v as s}from"./icons-Dc_-t0lp.js";import{n as c,t as l}from"./directory-H8Eh3MnS.js";import{n as u}from"./offboarding-Bwpftp3g.js";var d=t();function f(){let{capabilities:t}=a(),{data:f}=o(n.directory(e(),t.canManageGrants));if(!f.ok)return(0,d.jsx)(i,{icon:(0,d.jsx)(s,{size:18}),label:`Tokens`,title:`Tokens are closed to you`,children:f.error});let p=f.principals.filter(e=>e.principalType===`service`);return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(r,{title:`Tokens`,actions:(0,d.jsx)(l,{principalType:`service`})}),(0,d.jsx)(c,{principalType:`service`,principals:p,hasRemoved:f.removed.some(e=>e.principalType===`service`)}),(0,d.jsx)(u,{principalType:`service`,removed:f.removed})]})}export{f as component};
|