@package-broker/dist-cloudflare 2.0.0-rc.2 → 2.0.0-rc.3
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/cloudflare/assets/access.6859f43998ca.js +1 -0
- package/cloudflare/assets/app.e8434f3343de.js +9 -0
- package/cloudflare/assets/app.f15f8f21f88b.css +2 -0
- package/cloudflare/assets/audit.576009342714.js +1 -0
- package/cloudflare/assets/chunk.297a2d571f9c.js +4 -0
- package/cloudflare/assets/chunk.3704953b4a66.js +1 -0
- package/cloudflare/assets/chunk.6e23a75a1324.js +1 -0
- package/cloudflare/assets/chunk.7cb6f6b4daaa.js +1 -0
- package/cloudflare/assets/chunk.855a50f45830.js +1 -0
- package/cloudflare/assets/chunk.862544cf5835.js +2 -0
- package/cloudflare/assets/chunk.976a2ff4338e.js +1 -0
- package/cloudflare/assets/chunk.bb25fc845269.js +1 -0
- package/cloudflare/assets/chunk.bf48b04e6a00.js +1 -0
- package/cloudflare/assets/chunk.ce96495b8b55.js +1 -0
- package/cloudflare/assets/chunk.f922af39a279.js +1 -0
- package/cloudflare/assets/import.e2a1e35fcb8d.js +1 -0
- package/cloudflare/assets/index.html +6 -2
- package/cloudflare/assets/manifest.json +80 -8
- package/cloudflare/assets/packages.a8726e5144de.js +1 -0
- package/cloudflare/assets/projects.711deb86b7c9.js +1 -0
- package/cloudflare/assets/setup.dfed30ecfbad.js +1 -0
- package/cloudflare/assets/setup.html +3 -3
- package/cloudflare/assets/sources.d0ba0048bd96.js +1 -0
- package/cloudflare/assets/tokens.f48d235e8d25.js +4 -0
- package/cloudflare/assets.json +2 -2
- package/cloudflare/build-info.json +4 -4
- package/cloudflare/generated/manifest.json +2 -2
- package/cloudflare/worker.js +137 -88
- package/package.json +1 -1
- package/prebuilt.json +33 -15
- package/cloudflare/assets/app.b2abf3c46f6e.js +0 -15
- package/cloudflare/assets/app.e8cea8b32d3a.css +0 -2
- package/cloudflare/assets/setup.98343039898f.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as w}from"./chunk.3704953b4a66.js";import{a as v}from"./chunk.f922af39a279.js";import{c as f}from"./chunk.862544cf5835.js";import{D as m,E as c,F as b,c as d,d as S,g,j as h,m as y,n as q,p as l}from"./chunk.6e23a75a1324.js";var u=d(S(),1);var r=d(g(),1),p=e=>[...e].some(t=>t.charCodeAt(0)<32||t.charCodeAt(0)===127);function E(e,t){let a=new URLSearchParams(b(e).split("?")[1]),n={project:a.get("project")},o=a.get("status");o!==null&&t.includes(o)&&(n.status=o);let s=a.get("q");s&&!p(s)&&(n.q=s);let i=a.get("after");return i&&!p(i)&&(n.after=i),n}function k(e){let t=e,a=new Set;return{snapshot:()=>t,set(n){t={...t,...n};for(let o of a)o()},subscribe(n){return a.add(n),()=>{a.delete(n)}}}}function C(e){if(e.status===412)return"Changed elsewhere. Reload before trying again.";switch(e.code){case"last_holder":return"The last holder of this role cannot be removed.";case"forbidden":return"You do not have permission for this action.";case"not_found":return"Not found. Reload the current data.";case"invalid_request":return"Check the entered values and try again.";case"duplicate":return"An item with these values already exists.";case"conflict":return"The action conflicts with the current data. Reload and review it.";default:return"The request could not be completed."}}function Q(e,t){return t.ok||t.code!=="reauth_required"?!1:(e.requireReauth(t.request,{credential:!1,secretFields:[]}),!0)}function D(e){return Number.isSafeInteger(e)&&e>0?`"r${e}"`:null}function H(e){e.preventDefault();let t=new FormData(e.currentTarget);return e.currentTarget.reset(),Object.fromEntries([...t].map(([a,n])=>[a,String(n)]))}function V(e){return(0,r.jsxs)(c,{className:"grid gap-1",children:[e.label,(0,r.jsx)(m,{name:e.name,defaultValue:e.value??"",required:e.required??!0})]})}function P(e){return(0,r.jsxs)(r.Fragment,{children:[e.listError?(0,r.jsx)(f,{kind:"error",title:e.notice??"Unable to load this list."}):e.notice?(0,r.jsx)(y,{className:"my-4",children:(0,r.jsx)(q,{children:e.notice})}):null,(0,r.jsx)(l,{type:"button",variant:"outline",className:"my-4",disabled:e.loading||e.busy,onClick:e.reload,children:"Reload"}),e.loading?(0,r.jsx)(f,{kind:"loading",title:"Loading\u2026"}):null]})}function B(e){let t=a=>{window.location.hash=h(e.route,a)};return(0,r.jsx)(w,{chips:[...e.query.q?[{label:"Name prefix",value:e.query.q,onRemove:()=>t({project:e.query.project,...e.query.status?{status:e.query.status}:{}})}]:[],...e.query.status?[{label:e.route==="projects"?"Status":"View",value:e.query.status,onRemove:()=>t({project:e.query.project,...e.query.q?{q:e.query.q}:{}})}]:[]],children:(0,r.jsxs)("form",{className:"my-4 flex flex-wrap items-end gap-3",onSubmit:a=>{a.preventDefault();let n=new FormData(a.currentTarget);t({project:e.query.project,status:String(n.get("status")??""),q:String(n.get("q")??"")})},children:[(0,r.jsx)("div",{children:(0,r.jsxs)(c,{className:"grid gap-1",children:[e.route==="projects"?"Name prefix (filtering loaded projects)":"Name prefix",(0,r.jsx)(m,{name:"q",maxLength:200,defaultValue:e.query.q??""})]})}),(0,r.jsx)("div",{children:(0,r.jsxs)(c,{className:"grid gap-1",children:[e.route==="projects"?"Status":"View",(0,r.jsxs)(v,{name:"status",defaultValue:e.query.status??(e.route==="projects"?"":e.statuses[0]),children:[e.route==="projects"?(0,r.jsx)("option",{value:"",children:"All statuses"}):null,e.statuses.map(a=>(0,r.jsx)("option",{value:a,children:a},a))]})]})}),(0,r.jsx)(l,{type:"submit",children:"Apply filters"}),(0,r.jsx)(l,{type:"button",variant:"outline",onClick:()=>t({project:e.query.project}),children:"Clear filters"}),e.children]})})}function _(e,t,a,n){let[o,s]=(0,u.useState)(()=>typeof window>"u"?`#/${n}`:window.location.hash);return(0,u.useEffect)(()=>{let i=()=>s(window.location.hash);return window.addEventListener("hashchange",i),()=>window.removeEventListener("hashchange",i)},[]),(0,u.useEffect)(()=>(t.load(a(o)),()=>t.dispose()),[t,o,a]),(0,u.useEffect)(()=>e.subscribeReplay?.(i=>{t.replayed(i)}),[e,t]),o}export{E as a,k as b,C as c,Q as d,D as e,H as f,V as g,P as h,B as i,_ as j};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{A as c,B as u,c as a,d as y,g as r,p as t,w as s,x as d,y as g,z as p}from"./chunk.6e23a75a1324.js";var D=a(y(),1);var o=a(r(),1);function L({action:n,target:f,scope:C,description:m,disabled:i=!1,onConfirm:b,open:v,onOpenChange:h,hideTrigger:O=!1}){let[B,T]=(0,D.useState)(!1),k=v??B,e=l=>{T(l),h?.(l)};return(0,o.jsxs)(o.Fragment,{children:[O?null:(0,o.jsx)(t,{type:"button",variant:"ghost",size:"sm",className:"text-red-700 hover:bg-red-50 hover:text-red-800",disabled:i,onClick:()=>e(!0),children:n}),k?(0,o.jsx)(s,{open:!0,onOpenChange:e,children:(0,o.jsxs)(d,{children:[(0,o.jsxs)(g,{children:[(0,o.jsxs)(c,{children:[n,"?"]}),(0,o.jsx)(u,{children:m})]}),(0,o.jsxs)("dl",{className:"detail-list",children:[(0,o.jsx)("dt",{children:"Target"}),(0,o.jsx)("dd",{children:f}),(0,o.jsx)("dt",{children:"Scope"}),(0,o.jsx)("dd",{children:C})]}),(0,o.jsxs)(p,{children:[(0,o.jsx)(t,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),(0,o.jsxs)(t,{type:"button",variant:"destructive",disabled:i,onClick:()=>{i||(e(!1),b())},children:["Confirm ",n.toLowerCase()]})]})]})}):null]})}export{L as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as n,g as i}from"./chunk.6e23a75a1324.js";var e=n(i(),1),r=new Intl.DateTimeFormat(void 0,{year:"numeric",month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"});function m({value:t,fallback:a="\u2014"}){return t===null||!Number.isFinite(Date.parse(t))?(0,e.jsx)("span",{className:"text-neutral-600",children:a}):(0,e.jsx)("time",{dateTime:t,title:t,className:"whitespace-nowrap tabular-nums",children:r.format(new Date(t))})}export{m as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e,g as o,l as r}from"./chunk.6e23a75a1324.js";var s=e(o(),1);function n({className:t,...l}){return(0,s.jsx)("select",{className:r("h-9 w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-600 disabled:cursor-not-allowed disabled:opacity-50",t),...l})}export{n as a};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{b as h}from"./chunk.855a50f45830.js";import{a as f}from"./chunk.ce96495b8b55.js";import{a as L,c as b}from"./chunk.862544cf5835.js";import{A as w,B as N,C as m,D as C,E as D,J as R,c as g,d as B,g as y,p as d,w as I,x as k,y as x,z as A}from"./chunk.6e23a75a1324.js";var u=g(B(),1);var e=g(y(),1);function S(a){return{id:a.id,state:a.state,planHash:a.planHash,approvedAt:a.approvedAt,approvedByUserId:a.approvedByUserId,acceptedAt:a.acceptedAt,beforeImageExpiresAt:a.beforeImageExpiresAt}}function v(a,t,s=Date.now()){if(t==="approve")return a.state==="planned"&&!!a.planHash&&a.approvedAt===null;if(t==="apply"){let i=a.approvedAt===null?NaN:Date.parse(a.approvedAt);return a.state==="planned"&&Number.isFinite(i)&&i<=s+6e4}return t==="cancel"?a.state==="planned":["failed","applied","verifying","verified"].includes(a.state)&&(a.beforeImageExpiresAt===null||Date.parse(a.beforeImageExpiresAt)>s)}function H(a){let t={runs:[],next:null,run:null,selectedId:null,loading:!1,detailLoading:!1,busy:!1,dialog:!1,confirmed:!1,error:null,notice:null},s=0,i=0,c=new Set,n=o=>{t={...t,...o};for(let l of c)l()},r={back(){++s,n({run:null,selectedId:null,detailLoading:!1,dialog:!1,confirmed:!1,error:null,notice:null})},snapshot:()=>t,subscribe(o){return c.add(o),()=>{c.delete(o)}},async load(o){let l=++i;n({loading:!0,error:null,cursor:o});let p=await a.client.request("get","/_pb/import-runs",{query:{cursor:o}});l===i&&n(p.ok?{runs:p.data.items.map(S),next:p.data.next,loading:!1}:{runs:[],next:null,loading:!1,error:"Unable to load import runs."})},async select(o){if(t.busy)return;let l=++s;n({run:null,selectedId:o,detailLoading:!0,dialog:!1,confirmed:!1,error:null,notice:null});let p=await a.client.request("get","/_pb/import-runs/{id}",{params:{id:o}});l===s&&n(p.ok?{run:S(p.data),detailLoading:!1}:{detailLoading:!1,error:"Unable to load the import run."})},openApproval(){!t.busy&&t.run?.state==="planned"&&t.run.planHash&&t.run.approvedAt===null&&n({dialog:!0,confirmed:!1})},closeApproval(){t.busy||n({dialog:!1,confirmed:!1})},confirmApproval(o){t.dialog&&!t.busy&&n({confirmed:o})},async action(o){let l=t.run;if(l===null||t.busy||!v(l,o)||o==="approve"&&(!t.dialog||!t.confirmed||!l.planHash||l.state!=="planned"||l.approvedAt!==null))return;n({busy:!0,error:null,notice:null});let p=o==="approve"?await a.client.request("post","/_pb/import-runs/{id}/approve",{params:{id:l.id},body:{planHash:l.planHash}}):await a.client.request("post",`/_pb/import-runs/{id}/${o}`,{params:{id:l.id}});if(n({busy:!1,dialog:!1,confirmed:!1}),!p.ok){p.code==="reauth_required"?a.requireReauth(p.request,{credential:!1,secretFields:[]}):n({error:p.code==="conflict"?"The run changed. Reload it and try again.":"Unable to update the import run."});return}await r.select(l.id),await r.load(t.cursor),n({notice:"Action accepted. Reload to check job progress."})}};return r}function E({state:a,controller:t,onSelect:s,onBack:i,onPage:c}){let n=a.run,[r,o]=(0,u.useState)(Date.now);return(0,u.useEffect)(()=>{let l=window.setInterval(()=>o(Date.now()),1e3);return()=>window.clearInterval(l)},[]),(0,e.jsxs)("section",{"aria-labelledby":"page-heading",className:"space-y-4",children:[(0,e.jsx)("h1",{tabIndex:-1,id:"page-heading",className:"text-2xl font-semibold",children:"Import"}),(0,e.jsx)("p",{children:"Upload credentials with the CLI. Import manifests are managed with the CLI."}),a.selectedId&&n===null?(0,e.jsx)(d,{type:"button",variant:"link",className:"px-0",disabled:a.busy,onClick:()=>i?i():t.back(),children:"\u2190 Back to import runs"}):null,a.error===null?null:(0,e.jsx)(b,{kind:"error",title:a.error,children:(0,e.jsx)(d,{type:"button",variant:"outline",disabled:a.busy||a.loading,onClick:()=>{a.selectedId?t.select(a.selectedId):t.load(a.cursor)},children:"Retry"})}),a.notice===null?null:(0,e.jsx)("p",{role:"status",children:a.notice}),(0,e.jsx)(d,{type:"button",variant:"outline",disabled:a.loading||a.busy,onClick:()=>{t.load(a.cursor)},children:"Reload runs"}),a.loading?(0,e.jsx)(b,{kind:"loading",title:"Loading import runs\u2026"}):null,a.detailLoading?(0,e.jsx)(b,{kind:"loading",title:"Loading import run\u2026"}):null,n===null&&!a.detailLoading&&!a.loading?a.runs.length?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(L,{label:"Import runs",items:a.runs,columns:[{key:"id",label:"Run",value:l=>l.id,render:l=>(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,e.jsxs)(d,{type:"button",variant:"link",className:"h-auto p-0 font-mono",disabled:a.busy,onClick:()=>s?s(l.id):void t.select(l.id),children:["Run ",l.id.slice(0,6),"\u2026",l.id.slice(-4)]}),(0,e.jsx)(m,{value:l.id,label:"run ID"})]})},{key:"state",label:"State",value:l=>l.state,render:l=>(0,e.jsx)(h,{status:l.state})},{key:"hash",label:"Plan hash",value:l=>l.planHash??"",render:l=>l.planHash?(0,e.jsx)(m,{value:l.planHash,label:"plan hash"}):"No plan hash"},{key:"approved",label:"Approved",priority:2,value:l=>l.approvedAt??"",render:l=>(0,e.jsx)(f,{value:l.approvedAt,fallback:"Not approved"})},{key:"accepted",label:"Accepted",priority:3,value:l=>l.acceptedAt??"",render:l=>(0,e.jsx)(f,{value:l.acceptedAt,fallback:"Not accepted"})},{key:"expires",label:"Before-image expires",priority:3,value:l=>l.beforeImageExpiresAt??"",render:l=>(0,e.jsx)(f,{value:l.beforeImageExpiresAt,fallback:"Not scheduled"})}]}),(0,e.jsxs)("div",{className:"flex gap-2",children:[(0,e.jsx)(d,{type:"button",variant:"outline",disabled:!a.cursor||a.busy,onClick:()=>c?c():void t.load(),children:"First page"}),(0,e.jsx)(d,{type:"button",variant:"outline",disabled:!a.next||a.busy,onClick:()=>{a.next&&(c?c(a.next):t.load(a.next))},children:"Next page"})]})]}):a.error?null:(0,e.jsx)(b,{kind:a.cursor?"filtered-empty":"empty",title:a.cursor?"No import runs on this page":"No import runs.",children:"Create an import plan with the CLI to get started."}):null,n===null?null:(0,e.jsxs)("section",{"aria-labelledby":"run-heading",className:"space-y-3",children:[(0,e.jsx)(d,{type:"button",variant:"link",className:"px-0",disabled:a.busy,onClick:()=>i?i():t.back(),children:"\u2190 Back to import runs"}),(0,e.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,e.jsxs)("h2",{id:"run-heading",className:"text-lg font-semibold",children:["Run ",(0,e.jsx)(m,{value:n.id,label:"run ID"})]}),(0,e.jsx)(h,{status:n.state})]}),(0,e.jsxs)("div",{className:"detail-grid",children:[(0,e.jsxs)("div",{className:"detail-group",children:[(0,e.jsx)("h3",{children:"Plan"}),(0,e.jsxs)("dl",{className:"detail-list",children:[(0,e.jsx)("dt",{children:"Plan hash"}),(0,e.jsx)("dd",{children:n.planHash?(0,e.jsx)(m,{value:n.planHash,label:"full plan hash",full:!0}):"No plan hash"}),(0,e.jsx)("dt",{children:"Run ID"}),(0,e.jsx)("dd",{children:(0,e.jsx)(m,{value:n.id,label:"run ID"})})]})]}),(0,e.jsxs)("div",{className:"detail-group",children:[(0,e.jsx)("h3",{children:"Approval"}),(0,e.jsxs)("dl",{className:"detail-list",children:[(0,e.jsx)("dt",{children:"Approved at"}),(0,e.jsx)("dd",{children:(0,e.jsx)(f,{value:n.approvedAt,fallback:"Not approved"})}),(0,e.jsx)("dt",{children:"Approved by"}),(0,e.jsx)("dd",{children:(0,e.jsx)(m,{value:n.approvedByUserId,label:"approving user ID"})})]})]}),(0,e.jsxs)("div",{className:"detail-group",children:[(0,e.jsx)("h3",{children:"Execution and retention"}),(0,e.jsxs)("dl",{className:"detail-list",children:[(0,e.jsx)("dt",{children:"Accepted at"}),(0,e.jsx)("dd",{children:(0,e.jsx)(f,{value:n.acceptedAt,fallback:"Not accepted"})}),(0,e.jsx)("dt",{children:"Before-image expires"}),(0,e.jsx)("dd",{children:(0,e.jsx)(f,{value:n.beforeImageExpiresAt,fallback:"Not scheduled"})})]})]})]}),(0,e.jsx)("h3",{className:"font-semibold",children:"Actions"}),(0,e.jsx)("p",{className:"text-sm text-neutral-600",children:"Apply requires an approved plan. Cancel is available for planned runs. Rollback is available after execution while before-images are retained."}),(0,e.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,e.jsx)(d,{type:"button",variant:"outline",disabled:a.busy,onClick:()=>{t.select(n.id)},children:"Reload run"}),(0,e.jsx)(d,{type:"button",disabled:a.busy||!v(n,"approve",r),onClick:()=>t.openApproval(),children:"Review approval"}),["apply","cancel","rollback"].map(l=>(0,e.jsx)(d,{type:"button",variant:l==="apply"?"outline":"ghost",className:l==="apply"?void 0:"text-red-700",disabled:a.busy||!v(n,l,r),title:v(n,l,r)?void 0:"Unavailable in the current state or retention window.",onClick:()=>{t.action(l)},children:l==="apply"?"Apply":l==="cancel"?"Cancel run":"Rollback"},l))]})]}),a.dialog&&n!==null?(0,e.jsx)(I,{open:!0,onOpenChange:l=>{l||t.closeApproval()},children:(0,e.jsx)(k,{onCancel:l=>{a.busy&&l.preventDefault()},children:(0,e.jsxs)("form",{className:"grid gap-4",onSubmit:l=>{l.preventDefault(),!(a.busy||!a.confirmed)&&t.action("approve")},children:[(0,e.jsxs)(x,{children:[(0,e.jsx)(w,{children:"Approve import run"}),(0,e.jsx)(N,{children:"Confirm the full plan hash for the plan you reviewed with the CLI."})]}),(0,e.jsx)("p",{className:"break-all",children:(0,e.jsx)("code",{children:n.planHash})}),(0,e.jsxs)("div",{className:"flex items-center gap-2",children:[(0,e.jsx)(C,{id:"confirm-plan",type:"checkbox",className:"h-4 w-4",checked:a.confirmed,disabled:a.busy,onChange:l=>t.confirmApproval(l.currentTarget.checked)}),(0,e.jsx)(D,{htmlFor:"confirm-plan",children:"I confirm this plan hash."})]}),(0,e.jsxs)(A,{children:[(0,e.jsx)(d,{type:"button",variant:"outline",disabled:a.busy,onClick:()=>t.closeApproval(),children:"Back"}),(0,e.jsx)(d,{type:"submit",disabled:!a.confirmed||a.busy,children:"Approve run"})]})]})})}):null]})}function O(){let a=R(),t=(0,u.useMemo)(()=>H(a),[a]),s=(0,u.useSyncExternalStore)(t.subscribe,t.snapshot,t.snapshot),[i,c]=(0,u.useState)(()=>window.location.hash);(0,u.useEffect)(()=>{let r=()=>c(window.location.hash);return window.addEventListener("hashchange",r),()=>window.removeEventListener("hashchange",r)},[]),(0,u.useEffect)(()=>{let r=new URLSearchParams(i.split("?")[1]);t.load(r.get("cursor")??void 0);let o=r.get("run");o?t.select(o):t.back()},[t,i]);let n=(r,o)=>{let l=new URLSearchParams(i.split("?")[1]);o?l.set(r,o):l.delete(r),r==="cursor"&&l.delete("run"),window.location.hash=`#/import${l.size?`?${l}`:""}`};return(0,e.jsx)(E,{state:s,controller:t,onSelect:r=>n("run",r),onBack:()=>n("run"),onPage:r=>n("cursor",r)})}export{O as ImportPage,E as ImportView,H as createImportController,v as importActionAllowed};
|
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<title>Package Broker</title>
|
|
7
|
-
<link rel="stylesheet" href="app.
|
|
8
|
-
<
|
|
7
|
+
<link rel="stylesheet" href="app.f15f8f21f88b.css" />
|
|
8
|
+
<link rel="modulepreload" href="chunk.976a2ff4338e.js" />
|
|
9
|
+
<link rel="modulepreload" href="chunk.6e23a75a1324.js" />
|
|
10
|
+
<link rel="modulepreload" href="chunk.7cb6f6b4daaa.js" />
|
|
11
|
+
<link rel="modulepreload" href="chunk.f922af39a279.js" />
|
|
12
|
+
<script type="module" src="app.e8434f3343de.js"></script>
|
|
9
13
|
</head>
|
|
10
14
|
<body>
|
|
11
15
|
<div id="root"></div>
|
|
@@ -4,23 +4,95 @@
|
|
|
4
4
|
"files": {
|
|
5
5
|
"index.html": {
|
|
6
6
|
"contentType": "text/html",
|
|
7
|
-
"bytes":
|
|
7
|
+
"bytes": 611
|
|
8
8
|
},
|
|
9
9
|
"setup.html": {
|
|
10
10
|
"contentType": "text/html",
|
|
11
|
-
"bytes":
|
|
11
|
+
"bytes": 464
|
|
12
12
|
},
|
|
13
|
-
"
|
|
13
|
+
"chunk.6e23a75a1324.js": {
|
|
14
14
|
"contentType": "text/javascript",
|
|
15
|
-
"bytes":
|
|
15
|
+
"bytes": 83178
|
|
16
16
|
},
|
|
17
|
-
"
|
|
17
|
+
"chunk.976a2ff4338e.js": {
|
|
18
18
|
"contentType": "text/javascript",
|
|
19
|
-
"bytes":
|
|
19
|
+
"bytes": 182273
|
|
20
20
|
},
|
|
21
|
-
"
|
|
21
|
+
"chunk.7cb6f6b4daaa.js": {
|
|
22
|
+
"contentType": "text/javascript",
|
|
23
|
+
"bytes": 242
|
|
24
|
+
},
|
|
25
|
+
"chunk.f922af39a279.js": {
|
|
26
|
+
"contentType": "text/javascript",
|
|
27
|
+
"bytes": 379
|
|
28
|
+
},
|
|
29
|
+
"chunk.3704953b4a66.js": {
|
|
30
|
+
"contentType": "text/javascript",
|
|
31
|
+
"bytes": 2221
|
|
32
|
+
},
|
|
33
|
+
"chunk.862544cf5835.js": {
|
|
34
|
+
"contentType": "text/javascript",
|
|
35
|
+
"bytes": 41926
|
|
36
|
+
},
|
|
37
|
+
"chunk.bb25fc845269.js": {
|
|
38
|
+
"contentType": "text/javascript",
|
|
39
|
+
"bytes": 4075
|
|
40
|
+
},
|
|
41
|
+
"chunk.bf48b04e6a00.js": {
|
|
42
|
+
"contentType": "text/javascript",
|
|
43
|
+
"bytes": 1120
|
|
44
|
+
},
|
|
45
|
+
"chunk.855a50f45830.js": {
|
|
46
|
+
"contentType": "text/javascript",
|
|
47
|
+
"bytes": 1793
|
|
48
|
+
},
|
|
49
|
+
"projects.711deb86b7c9.js": {
|
|
50
|
+
"contentType": "text/javascript",
|
|
51
|
+
"bytes": 19063
|
|
52
|
+
},
|
|
53
|
+
"chunk.ce96495b8b55.js": {
|
|
54
|
+
"contentType": "text/javascript",
|
|
55
|
+
"bytes": 457
|
|
56
|
+
},
|
|
57
|
+
"access.6859f43998ca.js": {
|
|
58
|
+
"contentType": "text/javascript",
|
|
59
|
+
"bytes": 26627
|
|
60
|
+
},
|
|
61
|
+
"chunk.297a2d571f9c.js": {
|
|
62
|
+
"contentType": "text/javascript",
|
|
63
|
+
"bytes": 57183
|
|
64
|
+
},
|
|
65
|
+
"sources.d0ba0048bd96.js": {
|
|
66
|
+
"contentType": "text/javascript",
|
|
67
|
+
"bytes": 646
|
|
68
|
+
},
|
|
69
|
+
"packages.a8726e5144de.js": {
|
|
70
|
+
"contentType": "text/javascript",
|
|
71
|
+
"bytes": 31606
|
|
72
|
+
},
|
|
73
|
+
"tokens.f48d235e8d25.js": {
|
|
74
|
+
"contentType": "text/javascript",
|
|
75
|
+
"bytes": 52901
|
|
76
|
+
},
|
|
77
|
+
"audit.576009342714.js": {
|
|
78
|
+
"contentType": "text/javascript",
|
|
79
|
+
"bytes": 6095
|
|
80
|
+
},
|
|
81
|
+
"import.e2a1e35fcb8d.js": {
|
|
82
|
+
"contentType": "text/javascript",
|
|
83
|
+
"bytes": 10445
|
|
84
|
+
},
|
|
85
|
+
"app.e8434f3343de.js": {
|
|
86
|
+
"contentType": "text/javascript",
|
|
87
|
+
"bytes": 217347
|
|
88
|
+
},
|
|
89
|
+
"setup.dfed30ecfbad.js": {
|
|
90
|
+
"contentType": "text/javascript",
|
|
91
|
+
"bytes": 15648
|
|
92
|
+
},
|
|
93
|
+
"app.f15f8f21f88b.css": {
|
|
22
94
|
"contentType": "text/css",
|
|
23
|
-
"bytes":
|
|
95
|
+
"bytes": 31145
|
|
24
96
|
}
|
|
25
97
|
}
|
|
26
98
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as K,b as ie,c as ce,d as le,e as ue}from"./chunk.297a2d571f9c.js";import"./chunk.976a2ff4338e.js";import"./chunk.bf48b04e6a00.js";import{a as ne}from"./chunk.3704953b4a66.js";import{a as T}from"./chunk.f922af39a279.js";import{a as re,b as M}from"./chunk.855a50f45830.js";import{a as R}from"./chunk.ce96495b8b55.js";import{a as G,b as ae,c as D}from"./chunk.862544cf5835.js";import{A as U,B as H,C as te,D as V,E as C,F as oe,J as se,c as _,d as J,g as E,j as F,m as X,n as ee,p as S,w as B,x as z,y as $,z as O}from"./chunk.6e23a75a1324.js";var w=_(J(),1);var o=_(E(),1);function de(s){return s.status==="paused"?"Paused \xB7 Enable this source to sync.":s.lastError?"Last check failed":s.lastSuccessAt?"Last check succeeded":"Not checked yet"}function Y(s){return["packagist_proxy","npmjs_proxy","npm_registry"].includes(s.type)&&"attached"in s&&s.attached}function pe(s,e,a,t){return s.projectId===null?e.includes("org:sources:write"):s.projectId===t&&a.includes("project:sources:write")}function je(s){return["packagist_proxy","npmjs_proxy","npm_registry"].includes(s.type)?"Checks packages already held from this source when their metadata is due for refresh. This does not download the whole registry.":s.type==="vcs"?"Syncs the Composer package from this configured Git repository.":"Syncs packages selected in this source's settings."}function Se(s,e){let{client:a}=s,t={loading:!0,busy:!1,organization:[],permissions:[],projects:[],project:null,sources:[],error:null,notice:null,requested:[],available:null},n=new Set,c=d=>{t={...t,...d},n.forEach(g=>g())},l=0;async function b(d){let g=++l;if(c({loading:!0,busy:!1,project:null,permissions:[],sources:[],error:null,notice:null,available:null}),d===null){let v=[],p;do{let i=await a.request("get","/_pb/sources",{query:{ownership:"organization",limit:"100",...p?{after:p}:{}}});if(g!==l)return;if(!i.ok){c({loading:!1,error:"Sources could not be loaded. Try again."});return}v.push(...i.data.items),p=i.data.next??void 0}while(p);c({loading:!1,sources:v});return}let[f,m]=await Promise.all([a.request("get","/_pb/projects/{project}",{params:{project:d}}),a.request("get","/_pb/projects/{project}/permissions",{params:{project:d}})]);if(g!==l)return;if(!f.ok||f.data.status!=="active"||!m.ok){c({loading:!1,error:"Project access could not be loaded. Choose an active project."});return}let q=[],k;do{let v=await a.request("get","/_pb/projects/{project}/sources",{params:{project:d},query:{limit:"100",...k?{after:k}:{}}});if(g!==l)return;if(!v.ok){c({loading:!1,error:"Sources could not be loaded. Try again."});return}q.push(...v.data.items.filter(p=>p.attached)),k=v.data.next??void 0}while(k);c({loading:!1,project:f.data,permissions:m.data.project,sources:q})}return{snapshot:()=>t,subscribe:d=>(n.add(d),()=>{n.delete(d)}),selectProject:b,clearFeedback(){c({notice:null,error:null,available:null})},async load(){let d=await a.request("get","/_pb/me/permissions");if(c({organization:d.ok?d.data.organization:[]}),e===null){let g=[],f;do{let m=await a.request("get","/_pb/projects",{query:{status:"active",limit:"100",...f?{after:f}:{}}});if(!m.ok)break;let q=await Promise.all(m.data.items.filter(k=>k.status==="active").map(async k=>{let v=await a.request("get","/_pb/projects/{project}/permissions",{params:{project:k.slug}});return v.ok&&v.data.project.includes("project:sources:write")?k:null}));g.push(...q.filter(k=>k!==null)),f=m.data.next??void 0}while(f);c({projects:g})}await b(e)},async submit(d,g,f){let m=t.sources.find(p=>p.id===g);if(!m||t.busy||t.loading||m.status==="paused"||d==="mirror"&&(!t.project||!t.permissions.includes("project:sources:write")||!Y(m))||d==="sync"&&(!pe(m,t.organization,t.permissions,t.project?.id??null)||t.requested.includes(m.id)))return;if(f=f.trim(),d==="mirror"&&(!f||f.length>428)){c({error:"Enter a package name of 1 to 428 characters."});return}let q=l;c({busy:!0,error:null,notice:null,available:null});let k=d==="mirror"?await a.request("post","/_pb/projects/{project}/sources/{source}/packages",{params:{project:t.project.slug,source:m.id},body:{name:f}}):m.projectId===null?await a.request("post","/_pb/sources/{source}/sync",{params:{source:m.id}}):await a.request("post","/_pb/projects/{project}/sources/{source}/sync",{params:{project:t.project.slug,source:m.id}});if(q!==l)return;let v=d==="sync"?ce(k):k;v.ok?c({busy:!1,notice:d==="mirror"?ie(v.status,f,m.name):K,available:d==="mirror"&&v.status===200?{name:f,source:m.id}:null,requested:d==="sync"?[...t.requested,m.id]:t.requested}):c({busy:!1,error:v.status===403?"You no longer have permission to sync this source. Your selection has been kept.":v.code==="source_paused"?"This source is paused. Enable it before syncing.":v.code==="package_not_found"?`No packages match \u2018${f}\u2019 in ${m.name}. Check the name or choose another source.`:v.status===400?"Enter a valid package name for this source.":"Sync couldn't be queued. Try again shortly."})}}}function Ne({ecosystem:s,mirror:e,setup:a,imported:t,onMirror:n,sourceLink:c}){return(0,o.jsxs)("div",{className:"grid gap-4 lg:grid-cols-2",children:[(0,o.jsxs)("div",{className:"rounded border p-4",children:[(0,o.jsx)("h3",{className:"font-semibold",children:"From a mirror"}),(0,o.jsx)("p",{children:s==="npm"?"Find packages in a connected npm registry.":"Find packages in Packagist or another connected Composer repository."}),e?(0,o.jsx)(S,{className:"mt-2 min-h-11",onClick:n,children:"From a mirror"}):(0,o.jsx)("p",{children:"A project source manager can add packages from a mirror."})]}),s==="composer"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsxs)("div",{className:"rounded border p-4",children:[(0,o.jsx)("h3",{className:"font-semibold",children:"From a connected GitHub organization"}),(0,o.jsx)("p",{children:"Choose repositories your GitHub connection can access."}),(0,o.jsx)("p",{children:"Organization picker \xB7 Coming soon"}),a?(0,o.jsx)("a",{className:"inline-flex min-h-11 items-center underline",href:`${c}&provider=github`,children:"Set up a GitHub repository source"}):(0,o.jsx)("p",{children:"Ask an organization source manager to connect GitHub."})]}),(0,o.jsxs)("div",{className:"rounded border p-4",children:[(0,o.jsx)("h3",{className:"font-semibold",children:"By repository URL"}),(0,o.jsx)("p",{children:"Add a Composer package from a Git repository."}),a?(0,o.jsx)("a",{className:"inline-flex min-h-11 items-center underline",href:c,children:"By repository URL"}):(0,o.jsx)("p",{children:"A source manager can add a Git repository."})]})]}):null,(0,o.jsxs)("div",{className:"rounded border p-4",children:[(0,o.jsx)("h3",{className:"font-semibold",children:"Import configuration"}),(0,o.jsx)("p",{children:"Bring source and package selections from a Satis configuration using the CLI."}),(0,o.jsx)("code",{className:"break-all",children:"pb import satis plan"}),t?(0,o.jsx)("a",{href:"#/import",className:"flex min-h-11 items-center underline",children:"Import review"}):(0,o.jsx)("p",{children:"An organization import manager can review imports."})]}),(0,o.jsxs)("div",{className:"lg:col-span-2",children:[(0,o.jsx)("h3",{className:"font-semibold",children:"Upload a private package"}),(0,o.jsx)("p",{children:"Publish a package archive for this project."}),(0,o.jsx)("p",{children:"Coming soon \xB7 Upload and publishing belong to #947."})]})]})}function me({services:s,project:e}){let a=(0,w.useMemo)(()=>Se(s,e),[s,e]),t=(0,w.useSyncExternalStore)(a.subscribe,a.snapshot,a.snapshot),[n,c]=(0,w.useState)(null),[l,b]=(0,w.useState)("composer"),[d,g]=(0,w.useState)(""),[f,m]=(0,w.useState)(!1),[q,k]=(0,w.useState)(""),v=(0,w.useRef)(null);(0,w.useEffect)(()=>{a.load()},[a]),(0,w.useEffect)(()=>{(t.notice||t.error)&&v.current?.focus()},[t.notice,t.error]);let p=t.sources.find(u=>u.id===d),i=t.permissions.includes("project:sources:write"),h=t.organization.includes("org:sources:write"),N=e===null?h:i,j=t.sources.filter(u=>n!=="mirror"||u.ecosystem===l&&Y(u)),P=p&&(n==="mirror"?i&&!!t.project:pe(p,t.organization,t.permissions,t.project?.id??null)),A=`#/sources?create=vcs${e?`&project=${encodeURIComponent(e)}`:""}`;function x(u){g(""),m(!1),k(""),a.clearFeedback(),c(u)}return(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{className:"my-3 text-neutral-600",children:e?`Packages available to ${t.project?.name??e}.`:"Packages available across your organization."}),(0,o.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,o.jsx)(S,{className:"min-h-11",onClick:()=>x("choices"),children:"Add package"}),(0,o.jsx)(S,{className:"min-h-11",variant:"outline",onClick:()=>x("sync"),children:"Sync from source"})]}),n?(0,o.jsx)(B,{open:!0,onOpenChange:u=>{u||c(null)},children:(0,o.jsxs)(z,{variant:"source",className:"lg:max-w-5xl",children:[(0,o.jsxs)($,{className:"shrink-0 p-6 pr-16",children:[(0,o.jsx)(U,{children:n==="sync"?"Sync from source":"Add package"}),(0,o.jsx)(H,{children:n==="sync"?"Check a source for package updates.":t.project?`Add packages to ${t.project.name}.`:"Choose how to add packages to a project."})]}),(0,o.jsxs)("div",{className:"min-h-0 overflow-y-auto px-6 pb-6",children:[t.loading?(0,o.jsx)("p",{role:"status",children:"Loading sources\u2026"}):null,n==="choices"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)(C,{htmlFor:"choice-ecosystem",children:"Ecosystem"}),(0,o.jsxs)(T,{className:"mb-4 min-h-11",id:"choice-ecosystem",value:l,onChange:u=>b(u.target.value),children:[(0,o.jsx)("option",{value:"composer",children:"Composer"}),(0,o.jsx)("option",{value:"npm",children:"npm"})]}),(0,o.jsx)(Ne,{ecosystem:l,mirror:e===null?t.projects.length>0:i,setup:N,imported:t.organization.includes("org:import:write"),sourceLink:A,onMirror:()=>c("mirror")})]}):(0,o.jsxs)("form",{id:"source-action-form",className:"grid gap-4 lg:grid-cols-2",onSubmit:u=>{u.preventDefault(),p&&a.submit(n,p.id,q)},children:[e===null?(0,o.jsxs)("div",{children:[(0,o.jsx)(C,{htmlFor:"destination-project",children:"Project"}),(0,o.jsxs)(T,{id:"destination-project",className:"min-h-11",disabled:t.busy,value:t.project?.slug??"",onChange:u=>{g(""),m(!1),a.selectProject(u.target.value||null)},children:[(0,o.jsx)("option",{value:"",children:n==="sync"?"Organization sources":"Choose a project"}),t.projects.map(u=>(0,o.jsx)("option",{value:u.slug,children:u.name},u.id))]})]}):null,n==="mirror"?(0,o.jsxs)("div",{children:[(0,o.jsx)(C,{htmlFor:"mirror-ecosystem",children:"Ecosystem"}),(0,o.jsxs)(T,{id:"mirror-ecosystem",className:"min-h-11",value:l,disabled:t.busy,onChange:u=>{b(u.target.value),g(""),m(!1)},children:[(0,o.jsx)("option",{value:"composer",children:"Composer"}),(0,o.jsx)("option",{value:"npm",children:"npm"})]})]}):null,(0,o.jsxs)("div",{children:[(0,o.jsx)(C,{htmlFor:"package-source",children:"Source"}),(0,o.jsxs)(T,{id:"package-source",className:"min-h-11",required:!0,"aria-invalid":f||void 0,"aria-describedby":f?"package-source-error":void 0,onInvalid:()=>m(!0),disabled:t.loading||t.busy,value:d,onChange:u=>{g(u.target.value),m(!1),a.clearFeedback()},children:[(0,o.jsx)("option",{value:"",children:"Choose a source"}),j.map(u=>(0,o.jsxs)("option",{value:u.id,children:[u.name," \xB7 ",ue[u.type]," \xB7 ",de(u)]},u.id))]}),f?(0,o.jsx)("p",{id:"package-source-error",role:"alert",children:"Choose a source."}):null]}),n==="mirror"?(0,o.jsxs)("div",{children:[(0,o.jsx)(C,{htmlFor:"mirror-package",children:"Find a package"}),(0,o.jsx)(V,{id:"mirror-package",className:"min-h-11",required:!0,maxLength:428,disabled:t.busy,value:q,onChange:u=>{k(u.target.value),a.clearFeedback()},"aria-describedby":"mirror-help"}),(0,o.jsx)("p",{id:"mirror-help",children:"This source does not support search. Enter the full package name."})]}):null,(0,o.jsxs)("div",{className:"space-y-3 lg:col-span-2",children:[!j.length&&!t.loading?(0,o.jsx)("p",{children:t.project?`No sources available for ${t.project.name}. Attach a source before adding packages.`:n==="mirror"?"Choose a destination project before adding packages.":"No sources available."}):null,!j.length&&N&&!t.loading?(0,o.jsx)("a",{className:"inline-flex min-h-11 items-center underline",href:`#/sources${t.project?`?project=${encodeURIComponent(t.project.slug)}`:""}`,children:"Manage sources"}):null,p?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{children:p.projectId===null?"Shared organization source":`Only ${t.project?.name??e}`}),(0,o.jsx)("p",{children:de(p)}),p.status==="paused"?(0,o.jsx)("p",{children:"This source is paused. Enable it before syncing."}):null,n==="sync"&&t.requested.includes(p.id)&&!t.notice?(0,o.jsx)("p",{role:"status",children:K}):null,n==="sync"?(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("h3",{className:"font-semibold",children:Y(p)||["packagist_proxy","npmjs_proxy"].includes(p.type)?"Check cached packages for updates":"All configured packages"}),(0,o.jsx)("p",{children:je(p)}),p.type==="composer_repository"&&p.config&&"selection"in p.config?(0,o.jsxs)("p",{className:"break-words",children:["Configured selection:"," ",[...p.config.selection?.packages??[],...p.config.selection?.patterns??[]].join(", ")||"No packages selected."]}):null,p.projectId===null?(0,o.jsx)("p",{children:"This source is shared. Updated metadata can be used by other attached projects."}):null,P?null:(0,o.jsx)("p",{children:p.projectId===null?"An organization source manager can sync this source.":"A project source manager can sync this source."})]}):(0,o.jsxs)(o.Fragment,{children:[(0,o.jsx)("p",{children:"Checks this source and queues the package if it is not already available."}),(0,o.jsx)("p",{children:"This syncs the selected packages. Dependencies are fetched through your project's sources when requested."})]})]}):null]})]}),t.notice||t.error?(0,o.jsxs)("div",{ref:v,tabIndex:-1,className:"mt-4 break-words",role:t.error?"alert":"status","aria-live":"polite",children:[(0,o.jsx)("h3",{className:"font-semibold",children:t.error?"Request could not be completed":"Request outcome"}),(0,o.jsx)("p",{children:t.error??t.notice}),t.available?(0,o.jsx)("a",{className:"inline-flex min-h-11 items-center underline",href:F("packages",{project:t.project?.slug??null,q:t.available.name,source:t.available.source}),children:"View"}):null,t.notice?(0,o.jsx)("a",{className:"inline-flex min-h-11 items-center underline",href:`#/sources${t.project?`?project=${encodeURIComponent(t.project.slug)}`:""}`,children:"View sources"}):null]}):null]}),(0,o.jsx)(O,{className:"shrink-0 border-t bg-white p-4 pb-[max(1rem,env(safe-area-inset-bottom))]",children:n!=="choices"&&P&&p?.status!=="paused"?(0,o.jsx)(S,{className:"min-h-11",form:"source-action-form",type:"submit",disabled:t.busy||t.loading||!!t.notice||n==="sync"&&t.requested.includes(p.id),children:t.busy?"Requesting\u2026":n==="mirror"?"Add package":"Request source sync"}):null})]})}):null]})}var L=_(J(),1);var y=_(E(),1),xe={not_checked:"Not checked",disabled:"Vulnerability checks disabled",unsupported_version:"Not checked: unsupported version",pending:"Not checked yet",upstream_unavailable:"Check unavailable; no result yet",incomplete:"Check incomplete; no complete result yet",expired:"Outdated result"},we={affected:{icon:"!",color:"border-red-200 bg-red-50 text-red-800"},not_affected:{icon:"i",color:"border-blue-200 bg-blue-50 text-blue-800"},unknown:{icon:"?",color:"border-neutral-200 bg-neutral-100 text-neutral-700"},stale:{icon:"\u25F7",color:"border-amber-300 bg-amber-50 text-amber-900"}};function Pe(s){return s.length<=200&&/^[A-Za-z0-9]/.test(s)&&!/[^A-Za-z0-9._-]/.test(s)?`https://osv.dev/vulnerability/${encodeURIComponent(s)}`:void 0}function ge({assessment:s,sourceType:e}){let{status:a,reason:t}=s,n=a==="unknown"&&t==="not_checked",c=["vcs","composer_repository","npm_registry","hosted"].includes(e),l=a==="affected"?`Known advisories: ${s.advisoryCount}`:a==="not_affected"?"No known advisories":a==="stale"?"Outdated result":n&&c?"Not checked: private package":t===null?"Not checked":xe[t],b=we[a];return(0,y.jsxs)("div",{className:"space-y-2 text-sm",children:[(0,y.jsxs)(ae,{variant:"outline",className:b.color,children:[(0,y.jsx)("span",{"aria-hidden":"true",children:b.icon})," ",l]}),n?(0,y.jsx)("p",{children:"Only verified public proxy packages are checked."}):(0,y.jsxs)(y.Fragment,{children:[s.source==="osv"?(0,y.jsxs)("p",{children:["OSV \xB7 ",a==="stale"?"Last checked":"checked"," ",(0,y.jsx)(R,{value:s.fetchedAt,fallback:"No successful check yet"})]}):null,a==="stale"&&s.lastKnownStatus!==null?(0,y.jsx)("p",{children:s.lastKnownStatus==="affected"?`Last result: known advisories: ${s.advisoryCount}`:"Last result: no known advisories"}):null,(0,y.jsxs)("details",{children:[(0,y.jsx)("summary",{className:"cursor-pointer",children:"Advisory check details"}),a==="stale"&&t==="incomplete"?(0,y.jsx)("p",{children:"Check incomplete; last complete result shown."}):null,s.advisoryCount>0&&!s.detailsComplete?(0,y.jsx)("p",{children:"Advisory details pending"}):null,s.advisoriesTruncated?(0,y.jsxs)("p",{children:["Showing ",s.advisories.length," of ",s.advisoryCount," advisories"]}):null,s.advisories.length>0?(0,y.jsx)("ul",{className:"list-disc pl-5",children:s.advisories.map(d=>{let g=Pe(d.id);return(0,y.jsxs)("li",{children:[g?(0,y.jsx)("a",{href:g,target:"_blank",rel:"noopener noreferrer",referrerPolicy:"no-referrer",className:"underline",children:d.id}):d.id," \xB7 ",d.severity.level==="unknown"?"Severity unavailable":`Severity: ${d.severity.level}`,d.detailsFetchedAt===null?(0,y.jsx)("span",{children:" \xB7 Advisory details pending"}):(0,y.jsxs)("span",{children:[" ","\xB7 Details fetched ",(0,y.jsx)(R,{value:d.detailsFetchedAt})]})]},d.id)})}):null]})]})]})}var r=_(E(),1),he=["active","quarantined","tombstoned","removed_upstream"],fe=/^[0-7][0-9A-HJKMNP-TV-Z]{25}$/,qe={quarantine:"Quarantine",tombstone:"Tombstone",release:"Release"},Ce=s=>re[s];function ve(s){return s.organization.includes("org:packages:manage")?"Organization":`Project ${s.projectSlug}`}function W(s){let e=new URLSearchParams(oe(s).split("?")[1]),a={project:e.get("project")},t=e.get("status");he.includes(t)&&(a.status=t);let n=e.get("source");n!==null&&(a.source=n);let c=e.get("projectId");a.project===null&&c!==null&&(a.projectId=c);let l=e.get("q")?.trim().toLowerCase();l&&l.length<=100&&!l.includes("\0")&&(a.q=l);let b=e.get("after");return b!==null&&(a.after=b),a}function Q(s){return F("packages",s)}function ye(s,e,a){let t=a.organization.includes("org:packages:manage"),n=a.projectSlug!==null&&a.projectId!==null&&a.project.includes("project:packages:manage")&&s.source.projectId===a.projectId;if(!t&&!n)return[];let c=[];return(e==="active"||e==="removed_upstream")&&c.push("quarantine"),(e==="active"||e==="removed_upstream"||e==="quarantined")&&c.push("tombstone"),e==="quarantined"&&c.push("release"),c}function Ae(s){let e={query:{project:null},items:[],next:null,access:{organization:[],project:[],projectId:null,projectSlug:null},selected:null,versions:[],versionsNext:null,loading:!1,versionsLoading:!1,busy:!1,notice:null,confirmVersion:null},a=new Set,t=i=>{e={...e,...i};for(let h of a)h()},n=0,c=0,l=0,b=null,d,g=s.client;async function f(i,h=null){let N=++n;++c,b=null,t({query:i,items:[],next:null,selected:null,versions:[],versionsNext:null,confirmVersion:null,loading:!0,listError:!1,versionsError:!1,versionsLoading:!1,busy:!1,notice:h,access:{organization:[],project:[],projectId:null,projectSlug:i.project}});let j={status:i.status,source:i.source,q:i.q,after:i.after},[P,A,x,u]=await Promise.all([g.request("get","/_pb/me/permissions"),i.project===null?null:g.request("get","/_pb/projects/{project}/permissions",{params:{project:i.project}}),i.project===null?null:g.request("get","/_pb/projects/{project}",{params:{project:i.project}}),i.project===null?g.request("get","/_pb/packages",{query:{...j,project:i.projectId}}):g.request("get","/_pb/projects/{project}/packages",{params:{project:i.project},query:j})]);N===n&&(b=u.ok?Q(i):null,t({loading:!1,listError:!u.ok,access:{organization:P.ok?P.data.organization:[],project:A?.ok?A.data.project:[],projectId:x?.ok?x.data.id:null,projectSlug:i.project},items:u.ok?u.data.items:[],next:u.ok?u.data.next:null,notice:[h,u.ok?null:u.status===404?"Not found.":"Packages could not be loaded. Try again."].filter(Boolean).join(" ")||null}))}async function m(i,h){if(e.busy||e.loading)return;let N=e.items.find(u=>u.id===i);if(!N)return;let j=++c,P=n,A=e.query.project;d=h,t({selected:N,versions:[],versionsNext:null,versionsLoading:!0,versionsError:!1,confirmVersion:null});let x=A===null?await g.request("get","/_pb/packages/{package}/versions",{params:{package:i},query:{after:h}}):await g.request("get","/_pb/projects/{project}/packages/{package}/versions",{params:{project:A,package:i},query:{after:h}});j!==c||P!==n||t({versionsLoading:!1,versionsError:!x.ok,versions:x.ok?x.data.items:[],versionsNext:x.ok?x.data.next:null,notice:x.ok?e.notice:x.status===404?"Not found.":"Versions could not be loaded. Try again."})}function q(){++c,d=void 0,t({selected:null,versions:[],versionsNext:null,versionsLoading:!1,confirmVersion:null})}async function k(i,h,N){let j=++l;b!==Q(i)&&await f(i),j===l&&(h?await m(h,N):q())}async function v(i=null){let h=e.selected?.id,N=d,j=n,P=l;await f(e.query,i),n===j+1&&P===l&&h&&await m(h,N)}async function p(i,h,N=!1){let j=e.selected,P=e.versions.find(ke=>ke.id===i);if(e.busy||e.loading||e.versionsLoading||!j||!P||!ye(j,P.status,e.access).includes(h))return;if(h==="tombstone"&&!N){t({confirmVersion:i});return}let A=n,x=c,u=e.query,Z={package:j.id,version:P.id},be=e.access.projectSlug;t({busy:!0,notice:null,confirmVersion:null});let I=e.access.organization.includes("org:packages:manage")?await g.request("post",`/_pb/packages/{package}/versions/{version}/${h}`,{params:Z,body:{}}):await g.request("post",`/_pb/projects/{project}/packages/{package}/versions/{version}/${h}`,{params:{...Z,project:be},body:{}});if(!(A!==n||x!==c)){if(t({busy:!1}),!I.ok&&I.code==="reauth_required"){s.requireReauth(I.request,{credential:!1,secretFields:[],display:{packageName:j.name,version:P.version,scope:ve(e.access)}});return}if(!I.ok&&I.status===404){await f(u,"Not found.");return}if(!I.ok){t({notice:I.status===409?"The version changed, refresh.":"The action could not be completed. Try again."});return}await f(u,"Version updated."),n===A+1&&await m(j.id)}}return{snapshot:()=>e,subscribe(i){return a.add(i),()=>{a.delete(i)}},async replayed(i){let h=e.query.project===null?null:`/_pb/projects/${encodeURIComponent(e.query.project)}/packages/`,N=i.path.startsWith("/_pb/packages/")?i.path.slice(14):h!==null&&i.path.startsWith(h)?i.path.slice(h.length):null;N===null||!/^[^/]+\/versions\/[^/]+\/(quarantine|tombstone|release)$/.test(N)||await v(i.ok?"Version updated.":i.status===404?"Not found.":i.status===409?"The version changed, refresh.":"The action could not be completed. Try again.")},load:f,open:m,navigate:k,refresh:v,act:p,close:q,cancelTombstone:()=>t({confirmVersion:null}),async confirmTombstone(){let i=e.confirmVersion;i!==null&&await p(i,"tombstone",!0)},dispose(){++l,++n,++c}}}function Le(s){return(0,r.jsx)(G,{label:`Versions of ${s.item.name}`,items:s.versions,columns:[{key:"version",label:"Version",value:e=>e.version,render:e=>(0,r.jsx)("span",{className:"font-mono",children:e.version})},{key:"status",label:"Status",value:e=>e.status,render:e=>(0,r.jsx)(M,{status:e.status})},{key:"vulnerability",label:"Known vulnerabilities",value:e=>e.vulnerability.status,render:e=>(0,r.jsx)(ge,{assessment:e.vulnerability,sourceType:s.item.source.type})},{key:"published",label:"Published",priority:2,value:e=>e.publishedAt??"",render:e=>(0,r.jsx)(R,{value:e.publishedAt})},{key:"actions",label:"Actions",value:()=>"",render:e=>(0,r.jsx)("div",{className:"flex flex-wrap gap-2",children:ye(s.item,e.status,s.access).map(a=>(0,r.jsx)(S,{type:"button",size:"sm",variant:a==="tombstone"?"ghost":"outline",className:a==="tombstone"?"text-red-700":void 0,disabled:s.busy,"data-package-action":a,onClick:()=>s.onAction(e.id,a),children:qe[a]},a))})}]})}function _e(s){let{state:e}=s,a=e.versions.find(n=>n.id===e.confirmVersion),t=!!(e.query.q||e.query.status||e.query.source||e.query.projectId||e.query.after);return(0,r.jsxs)(r.Fragment,{children:[e.notice?(0,r.jsx)(X,{className:"my-4",children:(0,r.jsx)(ee,{children:e.notice})}):null,(0,r.jsxs)("div",{className:"my-4 flex flex-wrap items-center gap-3",children:[(0,r.jsx)("span",{className:"mr-auto text-neutral-600",children:e.selected?e.selected.name:`${e.items.length} packages on this page`}),(0,r.jsx)(S,{type:"button",variant:"outline",onClick:s.onRefresh,disabled:e.loading||e.busy,children:"Refresh"})]}),e.selected===null?e.loading?(0,r.jsx)(D,{kind:"loading",title:"Loading packages\u2026"}):e.items.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(G,{label:"Packages",items:e.items,columns:[{key:"name",label:"Name",value:n=>n.name,render:n=>(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(S,{type:"button",variant:"link",className:"h-auto justify-start p-0 text-left",disabled:e.busy,onClick:()=>s.onOpen(n.id),children:n.name}),(0,r.jsx)("span",{className:"block text-xs text-neutral-600",children:n.ecosystem})]})},{key:"status",label:"Status",value:n=>n.status,render:n=>(0,r.jsx)(M,{status:n.status})},{key:"latest",label:"Latest version",value:n=>n.latestVersion??"",render:n=>(0,r.jsx)("span",{className:"font-mono",children:n.latestVersion??"\u2014"})},{key:"source",label:"Winning source",priority:2,value:n=>n.source.name,render:n=>(0,r.jsxs)(r.Fragment,{children:[n.source.name,(0,r.jsx)("span",{className:"block text-xs text-neutral-600",children:n.source.type})]})},{key:"count",label:"Version count",priority:2,value:n=>n.versionCount},{key:"synced",label:"Last synced",priority:3,value:n=>n.lastSyncedAt??"",render:n=>(0,r.jsx)(R,{value:n.lastSyncedAt,fallback:"Never"})}]}),e.next?(0,r.jsx)(S,{type:"button",className:"my-4",variant:"outline",disabled:e.busy,onClick:s.onNext,children:"Next packages"}):null]}):e.listError?(0,r.jsx)(D,{kind:"error",title:"Packages could not be loaded",children:(0,r.jsx)(S,{type:"button",variant:"outline",onClick:s.onRefresh,children:"Retry"})}):(0,r.jsx)(D,{kind:t?"filtered-empty":"empty",title:t?"No packages match these filters":"No packages yet",children:t?"Change or clear the filters to see more packages.":`No packages yet. Add a package from a connected source, or attach a source to get started. ${le}`}):(0,r.jsxs)("section",{"aria-labelledby":"versions-heading",className:"space-y-4",children:[(0,r.jsx)(S,{type:"button",variant:"link",className:"px-0",onClick:s.onBack,disabled:e.busy,children:"\u2190 Back to packages"}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-3",children:[(0,r.jsxs)("h2",{id:"versions-heading",className:"text-lg font-semibold break-all",children:["Versions of ",e.selected.name]}),(0,r.jsx)(M,{status:e.selected.status})]}),(0,r.jsx)(te,{value:e.selected.id,label:"package ID"}),e.versionsLoading?(0,r.jsx)(D,{kind:"loading",title:"Loading versions\u2026"}):e.versions.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(Le,{item:e.selected,versions:e.versions,access:e.access,busy:e.busy,onAction:s.onAction}),e.versionsNext?(0,r.jsx)(S,{type:"button",variant:"outline",disabled:e.busy,onClick:s.onVersionNext,children:"Next versions"}):null]}):(0,r.jsx)(D,{kind:e.versionsError?"error":"empty",title:e.versionsError?"Versions could not be loaded":"No versions found."})]}),e.confirmVersion!==null?(0,r.jsx)(B,{open:!0,onOpenChange:n=>{n||s.onCancel()},children:(0,r.jsxs)(z,{children:[(0,r.jsxs)($,{children:[(0,r.jsxs)(U,{children:["Tombstone ",a?.version??"version","?"]}),(0,r.jsx)(H,{children:"This removes the version from package resolution. Clients can no longer install it. Only this version is affected. This cannot be undone."})]}),(0,r.jsxs)("dl",{className:"detail-list",children:[(0,r.jsx)("dt",{children:"Package"}),(0,r.jsx)("dd",{children:e.selected?.name}),(0,r.jsx)("dt",{children:"Version"}),(0,r.jsx)("dd",{className:"font-mono",children:a?.version}),(0,r.jsx)("dt",{children:"Scope"}),(0,r.jsx)("dd",{children:ve(e.access)})]}),(0,r.jsxs)(O,{children:[(0,r.jsx)(S,{type:"button",variant:"outline",onClick:s.onCancel,children:"Cancel"}),(0,r.jsx)(S,{type:"button",variant:"destructive",onClick:s.onConfirm,children:"Confirm tombstone"})]})]})}):null]})}function Ie(s){function e(a){a.preventDefault();let t=new FormData(a.currentTarget),n=new URLSearchParams;s.query.project!==null&&n.set("project",s.query.project);for(let c of["status","source","projectId","q"]){let l=t.get(c);typeof l=="string"&&l.trim()!==""&&n.set(c,l.trim())}s.onChange(W(`#/packages?${n}`))}return(0,r.jsx)(ne,{chips:["q","status","source","projectId"].flatMap(a=>s.query[a]?[{label:{q:"Name prefix",status:"Status",source:"Source",projectId:"Project"}[a],value:s.query[a],onRemove:()=>{let t={...s.query};delete t[a],delete t.after,s.onChange(t)}}]:[]),children:(0,r.jsxs)("form",{onSubmit:e,className:"my-4 flex flex-wrap items-end gap-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)(C,{htmlFor:"package-q",children:"Name prefix"}),(0,r.jsx)(V,{id:"package-q",name:"q",maxLength:100,defaultValue:s.query.q??""})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(C,{htmlFor:"package-status",children:"Status"}),(0,r.jsxs)(T,{id:"package-status",name:"status",defaultValue:s.query.status??"",children:[(0,r.jsx)("option",{value:"",children:"All statuses"}),he.map(a=>(0,r.jsx)("option",{value:a,children:Ce(a)},a))]})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)(C,{htmlFor:"package-source",children:"Source ID"}),(0,r.jsx)(V,{id:"package-source",name:"source",pattern:fe.source,defaultValue:s.query.source??""})]}),s.query.project===null?(0,r.jsxs)("div",{children:[(0,r.jsx)(C,{htmlFor:"package-project",children:"Project ID"}),(0,r.jsx)(V,{id:"package-project",name:"projectId",pattern:fe.source,defaultValue:s.query.projectId??""})]}):null,(0,r.jsx)(S,{type:"submit",children:"Apply filters"}),(0,r.jsx)(S,{type:"reset",variant:"outline",onClick:()=>s.onChange({project:s.query.project}),children:"Clear filters"})]})})}function ct(){let s=se(),e=(0,L.useMemo)(()=>Ae(s),[s]),a=(0,L.useSyncExternalStore)(e.subscribe,e.snapshot,e.snapshot),[t,n]=(0,L.useState)(()=>typeof window>"u"?"#/packages":window.location.hash);(0,L.useEffect)(()=>{let l=()=>n(window.location.hash);return window.addEventListener("hashchange",l),()=>window.removeEventListener("hashchange",l)},[]),(0,L.useEffect)(()=>{let l=new URLSearchParams(t.split("?")[1]);return e.navigate(W(t),l.get("package")??void 0,l.get("versionAfter")??void 0),()=>e.dispose()},[e,t]),(0,L.useEffect)(()=>s.subscribeReplay?.(l=>{e.replayed(l)}),[s,e]);let c=l=>{window.location.hash=Q(l)};return(0,r.jsxs)("section",{"aria-labelledby":"page-heading",children:[(0,r.jsx)("h1",{tabIndex:-1,id:"page-heading",className:"text-2xl font-semibold",children:"Packages"}),a.selected===null?(0,r.jsx)(me,{services:s,project:a.query.project},a.query.project):null,a.selected===null?(0,r.jsx)(Ie,{query:W(t),onChange:c},t):null,(0,r.jsx)(_e,{state:a,onOpen:l=>{let b=new URLSearchParams(Q(a.query).split("?")[1]);b.set("package",l),window.location.hash=`#/packages?${b}`},onBack:()=>c(a.query),onAction:(l,b)=>{e.act(l,b)},onNext:()=>{a.next!==null&&c({...a.query,after:a.next})},onVersionNext:()=>{if(a.selected&&a.versionsNext){let l=new URLSearchParams(t.split("?")[1]);l.set("versionAfter",a.versionsNext),window.location.hash=`#/packages?${l}`}},onRefresh:()=>{e.refresh()},onConfirm:()=>{e.confirmTombstone()},onCancel:e.cancelTombstone})]})}export{Le as PackageVersions,ct as PackagesPage,_e as PackagesView,Q as buildPackagesHash,Ae as createPackagesController,ye as packageActions,W as parsePackagesHash};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{a as K,b as Z,c as P,d as X,h as ee,i as te,j as se}from"./chunk.bb25fc845269.js";import{a as D}from"./chunk.bf48b04e6a00.js";import"./chunk.3704953b4a66.js";import"./chunk.f922af39a279.js";import{b as J}from"./chunk.855a50f45830.js";import{a as Y,c as V}from"./chunk.862544cf5835.js";import{C as G,D as L,E as q,J as W,c as N,d as Q,g as M,j as _,p as $}from"./chunk.6e23a75a1324.js";var E=N(Q(),1);var j=N(Q(),1);var U=/^[a-z0-9](?:[a-z0-9-]{0,62}[a-z0-9])?$/,T="1\u201364 lowercase letters, numbers or hyphens. Start and end with a letter or number.";function z(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64).replace(/-+$/g,"")}function oe(e,t){return{...e,name:t,slug:e.manualSlug?e.slug:z(t)}}function ae(e,t){return{...e,slug:t,manualSlug:!0}}function re(e){return{...e,slug:z(e.name),manualSlug:!1}}function ne(e,t=!1){let r={};return e.name.trim()?[...e.name].length>100?r.name="Use 100 characters or fewer.":/[\p{Cc}\p{Cf}\p{Zl}\p{Zp}\p{Cs}]/u.test(e.name)&&(r.name="Use a name without control or formatting characters."):r.name="Enter a project name.",!t&&!U.test(e.slug)&&(r.slug=!e.slug&&e.name&&!z(e.name)?"Enter a project slug using lowercase letters, numbers or hyphens.":T),r}function ie(e,t){return{name:e.name,tokenMaxScope:e.tokenMaxScope,...t?{}:{slug:e.slug}}}function le(e,t){if(e.ok)return{};if(!t&&e.code==="duplicate")return{slug:"This project slug is already in use. Choose another."};let r={};for(let o of e.details)o.location&&o.location!=="body"||(o.path==="/body/name"&&(r.name="Check the entered values and try again."),!t&&o.path==="/body/slug"&&(r.slug=T),o.path==="/body/tokenMaxScope"&&(r.tokenMaxScope="Check the entered values and try again."));return r}var pe="This change limits existing personal and service tokens on their next request. Downloads can continue, but access above this limit will stop. Check any CI jobs that use these tokens.";function ce(e,t){let r=["read","write","full"];return e===t?null:r.indexOf(t)<r.indexOf(e)?pe:"Existing tokens may regain access if their scope and permissions allow it."}var a=N(M(),1),ue=[{value:"read",label:"Install and download",summary:"Install and download only",description:"Read project details and download packages."},{value:"write",label:"Include publish permission",summary:"Publish permission included",description:"Also allow the package publishing permission. Publishing is not available in this version."},{value:"full",label:"Include grants, sources and audit access",summary:"Grants, sources and audit access included",description:"Also allow reading project grants, sources and audit records, plus the publish permission."}];function F(e){let t=(0,j.useId)(),r=(0,j.useRef)(null),o=(0,j.useRef)(null),h=(0,j.useRef)(null),u=!!e.project,[s,l]=(0,j.useState)({name:e.project?.name??"",slug:e.project?.slug??"",tokenMaxScope:e.project?.tokenMaxScope??"read",manualSlug:!1}),[n,f]=(0,j.useState)({}),[p,x]=(0,j.useState)(!1),[b,I]=(0,j.useState)(""),m=c=>{f(c);let v=["name","slug","tokenMaxScope"].find(g=>c[g]);v==="tokenMaxScope"&&o.current&&(o.current.open=!0),v&&r.current?.querySelector(`[name="${v}"]`)?.focus()},d=U.test(s.slug)?s.slug:"{project-slug}",k=typeof window>"u"?"":window.location.origin,y=e.project?ce(e.project.tokenMaxScope,s.tokenMaxScope):null;return(0,a.jsxs)("form",{ref:r,noValidate:!0,"aria-label":u?"Project settings":"New project",className:"my-6 grid min-w-0 max-w-5xl items-start gap-x-6 gap-y-4 lg:grid-cols-2",onSubmit:async c=>{if(c.preventDefault(),e.disabled||p)return;I("");let v=ne(s,u);if(m(v),!Object.keys(v).length){x(!0);try{let g=await e.submit(ie(s,u));if(g&&!g.ok){let w=le(g,u);m(w),Object.keys(w).length||h.current?.focus(),I(g.status===412?"This project changed while you were editing. Reload the latest settings before saving.":P(g))}else g?.ok&&I(u?"Access policy saved. Existing tokens now use this limit.":"Project created.")}finally{x(!1)}}},children:[(0,a.jsxs)("div",{className:"grid min-w-0 gap-1",children:[(0,a.jsx)(q,{htmlFor:`${t}-name`,children:"Project name"}),(0,a.jsx)(L,{id:`${t}-name`,name:"name",required:!0,className:"h-11",placeholder:"e.g. Acme Company",value:s.name,onChange:c=>l(oe(s,c.target.value)),"aria-describedby":`${t}-name-help ${t}-name-error`,"aria-invalid":!!n.name}),(0,a.jsx)("p",{id:`${t}-name-help`,className:"text-sm text-neutral-600",children:"A name your team will recognize. You can change it later."}),(0,a.jsx)("p",{id:`${t}-name-error`,className:"text-sm text-red-700",children:n.name})]}),(0,a.jsxs)("div",{className:"grid min-w-0 gap-1",children:[u?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Project slug"}),(0,a.jsx)("p",{className:"break-all",children:s.slug})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(q,{htmlFor:`${t}-slug`,children:"Project slug"}),(0,a.jsx)(L,{id:`${t}-slug`,name:"slug",required:!0,className:"h-11",placeholder:"e.g. acme-company",value:s.slug,onChange:c=>l(ae(s,c.target.value)),"aria-describedby":`${t}-slug-help ${t}-slug-rule ${t}-slug-error`,"aria-invalid":!!n.slug}),s.manualSlug?(0,a.jsx)($,{type:"button",variant:"ghost",className:"min-h-11 justify-self-start",onClick:()=>l(re(s)),children:"Use suggested slug"}):null]}),(0,a.jsx)("p",{id:`${t}-slug-help`,className:"text-sm text-neutral-600",children:"Used in repository URLs and CLI commands. You cannot change it later."}),u?null:(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("p",{id:`${t}-slug-rule`,className:"text-sm text-neutral-600",children:T}),(0,a.jsx)("p",{id:`${t}-slug-error`,className:"text-sm text-red-700",children:n.slug})]})]}),(0,a.jsxs)("div",{className:"grid min-w-0 gap-2 rounded-md border border-neutral-300 bg-neutral-50 p-4 lg:col-span-2",children:[(0,a.jsx)("p",{className:"text-sm font-medium",children:"Repository URLs"}),(0,a.jsxs)("dl",{className:"grid min-w-0 gap-2 text-sm",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("dt",{children:"Composer"}),(0,a.jsx)("dd",{className:"overflow-x-auto whitespace-nowrap",tabIndex:0,children:(0,a.jsx)("code",{children:`${k}/${d}`})})]}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("dt",{children:"npm"}),(0,a.jsx)("dd",{className:"overflow-x-auto whitespace-nowrap",tabIndex:0,children:(0,a.jsx)("code",{children:`${k}/${d}/npm/`})})]})]})]}),(0,a.jsxs)("details",{ref:o,className:"min-w-0 rounded-md border border-neutral-300 lg:col-span-2",children:[(0,a.jsxs)("summary",{className:"min-h-11 cursor-pointer p-4 font-medium focus-visible:ring-2 focus-visible:ring-blue-600",children:["Access policy",(0,a.jsx)("span",{className:"block text-sm font-normal text-neutral-600",children:ue.find(c=>c.value===s.tokenMaxScope)?.summary})]}),(0,a.jsxs)("fieldset",{className:"m-4 grid min-w-0 gap-3","aria-describedby":`${t}-policy-help ${t}-policy-note ${t}-policy-error`,children:[(0,a.jsx)("legend",{className:"font-medium",children:"What can tokens do on this project?"}),(0,a.jsx)("p",{id:`${t}-policy-help`,className:"text-sm text-neutral-600",children:"Sets the maximum access for personal and service tokens, including tokens used by CI. Each token still needs its own permissions. Your access in the admin UI is unchanged."}),ue.map(c=>(0,a.jsxs)(q,{htmlFor:`${t}-${c.value}`,className:"flex min-h-11 cursor-pointer items-start gap-3 rounded-md border border-neutral-300 p-3 has-checked:border-blue-700 has-checked:bg-blue-50",children:[(0,a.jsx)("input",{id:`${t}-${c.value}`,type:"radio",name:"tokenMaxScope",value:c.value,checked:s.tokenMaxScope===c.value,onChange:()=>l({...s,tokenMaxScope:c.value}),className:"mt-1 accent-blue-700 focus-visible:ring-2 focus-visible:ring-blue-600","aria-describedby":`${t}-${c.value}-description ${t}-policy-error`,"aria-invalid":!!n.tokenMaxScope}),(0,a.jsxs)("span",{children:[c.label,c.value==="read"?(0,a.jsx)("span",{className:"ml-2 inline-block rounded bg-blue-100 px-1 text-xs text-blue-800",children:"Recommended"}):null,(0,a.jsx)("span",{id:`${t}-${c.value}-description`,className:"mt-1 block text-sm font-normal text-neutral-600",children:c.description})]})]},c.value)),(0,a.jsx)("p",{id:`${t}-policy-note`,className:"text-sm text-neutral-600",children:"Tokens cannot change project settings or delete packages. Publishing is not available in this version."}),(0,a.jsx)("p",{id:`${t}-policy-error`,className:"text-sm text-red-700",children:n.tokenMaxScope})]})]}),e.project?.requirePublishApproval?(0,a.jsx)("p",{className:"text-sm text-neutral-600 lg:col-span-2",children:"Publish approval is saved as required, but approval is not enforced in this version."}):null,y?(0,a.jsx)("p",{className:"text-sm text-neutral-600 lg:col-span-2",children:y}):null,(0,a.jsx)("div",{className:"lg:col-span-2",children:(0,a.jsx)($,{type:"submit",className:"min-h-11 w-full sm:w-auto lg:w-auto",disabled:e.disabled||p,children:p?u?"Saving settings\u2026":"Creating project\u2026":u?"Save settings":(0,a.jsx)(a.Fragment,{children:"Create project"})})}),(0,a.jsx)("p",{ref:h,role:"status",tabIndex:-1,className:"lg:col-span-2",children:p?u?"Saving settings\u2026":"Creating project\u2026":b||(Object.keys(n).length?"Check the entered values and try again.":"")})]})}var i=N(M(),1),S="Project archived.",A=["active","archived"],O=e=>K(e,A),C=e=>_("projects",O(_("projects",e)));async function B(e,t,r=!0){if(t.status)return e.request("get","/_pb/projects",{query:{status:t.status,after:t.after,limit:"50"}});let o=[t.after,void 0];if(t.after?.startsWith("all:"))try{let l=JSON.parse(t.after.slice(4));if(!Array.isArray(l)||l.length!==2||!l.every(n=>n===null||typeof n=="string"))throw new Error("Invalid cursor");o=l}catch{return{ok:!1,status:400,code:"invalid_request",details:[],request:{method:"GET",path:"/_pb/projects"}}}if(!r&&o[0]===null)return{ok:!0,status:200,data:{items:[],next:null}};if(!r)return e.request("get","/_pb/projects",{query:{status:"active",after:o[0]??void 0,limit:"50"}});let h=await Promise.all(A.map((l,n)=>o[n]===null?null:e.request("get","/_pb/projects",{query:{status:l,after:o[n]??void 0,limit:"50"}}))),u=[],s=[];for(let[l,n]of h.entries()){if(n&&!n.ok){if(A[l]==="archived"&&n.status===403){s.push(null);continue}return n}n?.ok&&u.push(...n.data.items),s.push(n?.ok?n.data.next:null)}return{ok:!0,status:200,data:{items:u,next:s.some(l=>l!==null)?`all:${JSON.stringify(s)}`:null}}}function R(e){let t=e.selected,r=!!t&&!!e.etag&&!e.loading&&!e.stale;return{items:e.items.filter(o=>!e.query.q||o.name.toLowerCase().startsWith(e.query.q.toLowerCase())),create:e.organization.includes("org:projects:create")&&!e.stale&&!e.loading,settings:r&&t.status==="active"&&e.permissions.includes("project:settings:write"),transition:r&&e.organization.includes("org:projects:archive"),transitionItems:!e.loading&&!e.stale&&e.organization.includes("org:projects:archive")}}function de(e){let t=Z({query:{project:null},items:[],next:null,selected:null,etag:null,organization:[],permissions:[],loading:!1,listError:!1,busy:!1,stale:!1,notice:null}),r=0,{client:o}=e;async function h(s,l=C(s)===C(t.snapshot().query)&&t.snapshot().notice===S?S:null){let n=++r;t.set({query:s,items:[],next:null,selected:null,etag:null,organization:[],permissions:[],loading:!0,listError:!1,busy:!1,stale:!1,notice:l});let f=o.request("get","/_pb/me/permissions"),[p,x,b,I]=await Promise.all([f.then(y=>B(o,s,y.ok&&y.data.organization.includes("org:projects:archive")&&y.data.organization.includes("project:read"))),f,s.project===null?null:o.request("get","/_pb/projects/{project}",{params:{project:s.project}}),s.project===null?null:o.request("get","/_pb/projects/{project}/permissions",{params:{project:s.project}})]);if(n!==r)return;let m=p,d=b,k=I;if(d&&!d.ok&&d.status===404){let y,c=new Set;for(;;){let v={project:null,status:"archived",after:y},g=await B(o,v);if(n!==r)return;if(!g.ok)break;if(g.data.items.some(H=>H.slug===s.project&&H.status==="archived")){s=v,m=g,d=null,k=null,l=S;break}let w=g.data.next;if(!w||c.has(w))break;c.add(w),y=w}}l===S&&(s={...s,project:null},d=null,k=null,!m.ok&&(s={...s,status:"active",after:void 0},m=await B(o,s),n!==r))||t.set({query:s,loading:!1,listError:!m.ok,items:m.ok?m.data.items:[],next:m.ok?m.data.next:null,organization:x.ok?x.data.organization:[],selected:d?.ok?d.data:null,etag:d?.ok?d.headers?.etag??null:null,permissions:k?.ok?k.data.project:[],notice:m.ok?d&&!d.ok?P(d):l:P(m)})}async function u(s,l,n="Project updated.",f="Changed elsewhere. Reload before trying again."){let p=t.snapshot();if(p.busy||p.loading||p.stale)return;let x=r;t.set({busy:!0,notice:null});let b=await s();if(b.ok&&e.onProjectsChanged?.(),x===r)return t.set({busy:!1}),X(e,b)?t.set({stale:!0,notice:"Complete reauthentication and confirm the pending action."}):b.ok?await h(l?{...p.query,project:l}:p.query,l?S:n):t.set({stale:b.status===412,notice:b.status===412?f:P(b)}),b}return{snapshot:t.snapshot,subscribe:t.subscribe,load:h,async create(s){if(R(t.snapshot()).create)return u(()=>o.request("post","/_pb/projects",{body:s,idempotencyKey:crypto.randomUUID()}),void 0,"Project created.")},async update(s){let l=t.snapshot();if(R(l).settings)return u(()=>o.request("patch","/_pb/projects/{project}",{params:{project:l.selected.slug},headers:{"If-Match":l.etag},body:s}),void 0,"Access policy saved. Existing tokens now use this limit.","This project changed while you were editing. Reload the latest settings before saving.")},async transition(){let s=t.snapshot();R(s).transition&&await u(()=>o.request("post",s.selected.status==="active"?"/_pb/projects/{project}/archive":"/_pb/projects/{project}/restore",{params:{project:s.selected.slug},headers:{"If-Match":s.etag},idempotencyKey:crypto.randomUUID()}),s.selected.status==="active"?s.selected.slug:void 0)},async transitionItem(s){let l=t.snapshot(),n=l.items.find(f=>f.id===s);!n?.etag||!R(l).transitionItems||await u(()=>o.request("post",n.status==="active"?"/_pb/projects/{project}/archive":"/_pb/projects/{project}/restore",{params:{project:n.slug},headers:{"If-Match":n.etag},idempotencyKey:crypto.randomUUID()}),n.status==="active"?n.slug:void 0)},async replayed(s){let l=t.snapshot().query.project,n=l===null?null:`/_pb/projects/${encodeURIComponent(l)}`,f=/^\/_pb\/projects\/[^/]+\/(?:archive|restore)$/.test(s.path);if(!(!f&&s.path!=="/_pb/projects"&&(n===null||![n,`${n}/archive`,`${n}/restore`].includes(s.path))))if(s.ok){let p=f&&s.path.endsWith("/archive")?decodeURIComponent(s.path.split("/")[3]):null;await h(p?{...t.snapshot().query,project:p}:t.snapshot().query,p?S:s.path==="/_pb/projects"?"Project created.":s.path===n?"Access policy saved. Existing tokens now use this limit.":"Project updated.")}else t.set({stale:!0,notice:s.path===n&&s.status===412?"This project changed while you were editing. Reload the latest settings before saving.":P(s)})},dispose(){++r}}}function me({state:e,controller:t}){let r=R(e);return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)("p",{role:"status",className:"sr-only",children:e.notice}),(0,i.jsx)(ee,{...e,reload:()=>{t.load(e.query)}}),e.query.q?(0,i.jsx)("p",{children:"Filtering loaded projects on this page."}):null,!e.loading&&!e.listError?r.items.length?(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("p",{className:"my-3 text-sm text-neutral-600",children:[r.items.length," projects on this page"]}),(0,i.jsx)(Y,{label:"Projects",items:r.items,selectedId:e.selected?.id??"",columns:[{key:"name",label:"Name",value:o=>o.name,render:o=>(0,i.jsxs)("div",{className:"grid gap-1",children:[(0,i.jsx)("a",{className:"font-medium underline",href:C({...e.query,project:o.slug}),children:o.name}),(0,i.jsx)("code",{className:"text-xs text-neutral-600",children:o.slug})]})},{key:"status",label:"Status",value:o=>o.status,render:o=>(0,i.jsx)(J,{status:o.status})},{key:"id",label:"Project ID",value:o=>o.id,render:o=>(0,i.jsx)(G,{value:o.id,label:"project ID"}),priority:3},{key:"actions",label:"Actions",value:()=>"",sortable:!1,render:o=>(0,i.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,i.jsx)("a",{className:"underline",href:C({...e.query,project:o.slug}),children:"Open settings"}),r.transitionItems&&o.etag?o.status==="active"?(0,i.jsx)(D,{action:"Archive",target:`${o.name} (${o.id})`,scope:`Project: ${o.slug}`,description:"Archiving keeps project history and blocks new publishes. You can restore this project later.",disabled:e.busy,onConfirm:()=>{t.transitionItem(o.id)}},`${o.id}:${o.etag}`):(0,i.jsx)($,{type:"button",size:"sm",variant:"outline",disabled:e.busy,onClick:()=>{t.transitionItem(o.id)},children:"Restore"}):null]})}]})]}):(0,i.jsx)(V,{kind:e.query.q||e.query.status?"filtered-empty":"empty",title:"No projects found on this page."}):null,e.next?(0,i.jsx)("a",{className:"my-4 inline-block underline",href:C({...e.query,after:e.next}),children:"Next projects"}):null,e.organization.includes("org:projects:create")&&!e.loading?(0,i.jsxs)("details",{className:"detail-group my-6",children:[(0,i.jsx)("summary",{className:"cursor-pointer font-semibold",children:"New project"}),(0,i.jsx)(F,{disabled:!r.create||e.busy,submit:o=>t.create({...o,slug:o.slug??""})})]}):null,e.selected?(0,i.jsxs)("section",{className:"detail-group my-6 grid gap-3","aria-label":"Project settings",children:[(0,i.jsxs)("h2",{className:"text-lg font-semibold",children:["Settings: ",e.selected.name]}),e.permissions.includes("project:settings:write")&&e.selected.status==="active"?(0,i.jsx)(F,{project:e.selected,disabled:!r.settings||e.busy,submit:t.update},`${e.selected.id}-${e.etag}`):e.selected.requirePublishApproval?(0,i.jsx)("p",{className:"text-sm text-neutral-600",children:"Publish approval is saved as required, but approval is not enforced in this version."}):null,r.transition?e.selected.status==="active"?(0,i.jsx)(D,{action:"Archive",target:e.selected.name,scope:`Project: ${e.selected.slug}`,description:"Archiving keeps project history and blocks new publishes. You can restore this project later.",disabled:e.busy,onConfirm:()=>{t.transition()}},`${e.selected.id}:${e.etag}`):(0,i.jsx)($,{type:"button",variant:"outline",disabled:e.busy,onClick:()=>{t.transition()},children:"Restore"}):null]}):null]})}function Re(){let e=W(),t=(0,E.useMemo)(()=>de(e),[e]),r=(0,E.useSyncExternalStore)(t.subscribe,t.snapshot,t.snapshot),o=se(e,t,O,"projects");return(0,E.useEffect)(()=>{if(r.loading||r.notice!==S||r.query.project!==null)return;let h=C(r.query);window.location.hash!==h&&(window.history.replaceState(null,"",h),window.dispatchEvent(new HashChangeEvent("hashchange")))},[r.loading,r.notice,r.query]),(0,i.jsxs)("section",{"aria-labelledby":"page-heading",children:[(0,i.jsx)("h1",{tabIndex:-1,id:"page-heading",className:"text-xl font-semibold",children:"Projects"}),(0,i.jsx)("p",{className:"mt-1 text-neutral-600",children:"Scopes for sources, packages and tokens. Archiving keeps history and blocks new publishes."}),(0,i.jsx)(te,{route:"projects",query:O(o),statuses:A},o),(0,i.jsx)(me,{state:r,controller:t})]})}export{Re as ProjectsPage,me as ProjectsView,C as buildProjectsHash,de as createProjectsController,O as parseProjectsHash,R as projectsViewModel};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var E={brand:"PACKAGE.broker",description:"open-source package registry broker",version:"2.0.0-rc.3",links:[{label:"AGPL-3.0",href:"https://github.com/package-broker/broker/blob/main/LICENSE"},{label:"Source code",href:"https://github.com/package-broker/broker"},{label:"Documentation",href:"https://package.broker/docs/"}]};function $(e){return e("footer",{className:"product-footer"},e("span",{},e("strong",{},E.brand),` ${E.description}`),e("span",{},`Version ${E.version}`),...E.links.map(({label:t,href:n})=>e("a",{href:n,target:"_blank",rel:"noopener noreferrer","aria-label":`${t} (opens externally in a new tab)`},t)))}function C(){return $((e,t,...n)=>{let r=document.createElement(e);for(let[s,u]of Object.entries(t))r.setAttribute(s==="className"?"class":s,u);return r.append(...n),r})}var q=[10,16,26,18,24,16,18,22,22,26,30,22,22,24],F=[1,1,1,2,2,4,4,4,5,5,5,8,9,9],z=[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66]],W=[236,17],Y=21522,J=1335,Z=7973,U=8;function j(e){let t=(16*e+128)*e+64;if(e>=2){let n=Math.floor(e/7)+2;t-=(25*n-10)*n-55,e>=7&&(t-=36)}return t}function v(e){let t=e-1;return Math.floor(j(e)/8)-q[t]*F[t]}function D(e){return e<=9?8:16}function K(e){if(!Number.isInteger(e)||e<1||e>14)throw new RangeError("unsupported QR version");return Math.floor((v(e)*8-4-D(e))/8)}var H=K(14),S=new Uint8Array(512),P=new Uint8Array(256);{let e=1;for(let t=0;t<255;t+=1)S[t]=e,P[e]=t,e<<=1,e&256&&(e^=285);for(let t=255;t<512;t+=1)S[t]=S[t-255]}function M(e,t){return e===0||t===0?0:S[P[e]+P[t]]}function ee(e,t){let n=[1];for(let s=0;s<t;s+=1){let u=new Array(n.length+1).fill(0);for(let a=0;a<n.length;a+=1)u[a]=u[a]^M(n[a],1),u[a+1]=u[a+1]^M(n[a],S[s]);n=u}let r=new Array(t).fill(0);for(let s of e){let u=s^r.shift();r.push(0);for(let a=0;a<t;a+=1)r[a]=r[a]^M(n[a+1],u)}return r}function te(e,t){let n=[],r=(o,l)=>{for(let i=l-1;i>=0;i-=1)n.push(o>>>i&1)};r(4,4),r(t.length,D(e));for(let o of t)r(o,8);let s=v(e)*8;r(0,Math.min(4,s-n.length)),r(0,(8-n.length%8)%8);let u=[];for(let o=0;o<n.length;o+=8)u.push(parseInt(n.slice(o,o+8).join(""),2));for(let o=0;u.length<v(e);o+=1)u.push(W[o%2]);let a=e-1,f=F[a],k=q[a],b=Math.floor(j(e)/8),m=f-b%f,y=Math.floor(b/f)-k,h=[],w=[],c=0;for(let o=0;o<f;o+=1){let l=y+(o<m?0:1),i=u.slice(c,c+l);c+=l,h.push(i),w.push(ee(i,k))}let d=[];for(let o=0;o<y+1;o+=1)for(let l of h)o<l.length&&d.push(l[o]);for(let o=0;o<k;o+=1)for(let l of w)d.push(l[o]);return d}function Q(e,t,n){let r=e;for(let s=0;s<n;s+=1)r=r<<1^(r>>>n-1)*t;return r}function ne(e,t,n){switch(e){case 0:return(t+n)%2===0;case 1:return n%2===0;case 2:return t%3===0;case 3:return(t+n)%3===0;case 4:return(Math.floor(t/3)+Math.floor(n/2))%2===0;case 5:return t*n%2+t*n%3===0;case 6:return(t*n%2+t*n%3)%2===0;default:return((t+n)%2+t*n%3)%2===0}}function B(e){let t=0,n=1;for(let s=1;s<=e.length;s+=1){if(s<e.length&&e[s]===e[s-1]){n+=1;continue}n>=5&&(t+=3+(n-5)),n=1}let r=`0000${e.map(s=>s?"1":"0").join("")}0000`;for(let s=0;s+11<=r.length;s+=1){let u=r.slice(s,s+11);(u==="10111010000"||u==="00001011101")&&(t+=40)}return t}function oe(e){let t=e.length,n=0,r=0;for(let u=0;u<t;u+=1){let a=e[u];n+=B(a),n+=B(e.map(f=>f[u]));for(let f=0;f<t;f+=1)a[f]&&(r+=1),f+1<t&&u+1<t&&a[f]===a[f+1]&&a[f]===e[u+1][f]&&a[f]===e[u+1][f+1]&&(n+=3)}let s=t*t;return n+=(Math.ceil(Math.abs(r*20-s*10)/s)-1)*10,n}function re(e,t,n){let r=e*4+17,s=Array.from({length:r},()=>new Array(r).fill(!1)),u=Array.from({length:r},()=>new Array(r).fill(!1)),a=(c,d,o)=>{s[d][c]=o,u[d][c]=!0};for(let c=0;c<r;c+=1)a(6,c,c%2===0),a(c,6,c%2===0);let f=(c,d)=>{for(let o=-4;o<=4;o+=1)for(let l=-4;l<=4;l+=1){let i=Math.max(Math.abs(l),Math.abs(o)),g=c+l,_=d+o;g>=0&&g<r&&_>=0&&_<r&&a(g,_,i!==2&&i!==4)}};f(3,3),f(r-4,3),f(3,r-4);let k=z[e-1],b=k.length-1;k.forEach((c,d)=>{k.forEach((o,l)=>{if(!(d===0&&l===0||d===0&&l===b||d===b&&l===0))for(let i=-2;i<=2;i+=1)for(let g=-2;g<=2;g+=1)a(o+g,c+i,Math.max(Math.abs(g),Math.abs(i))!==1)})});let m=c=>{let d=c,o=(d<<10|Q(d,J,10))^Y,l=i=>(o>>>i&1)!==0;for(let i=0;i<=5;i+=1)a(8,i,l(i));a(8,7,l(6)),a(8,8,l(7)),a(7,8,l(8));for(let i=9;i<15;i+=1)a(14-i,8,l(i));for(let i=0;i<8;i+=1)a(r-1-i,8,l(i));for(let i=8;i<15;i+=1)a(8,r-15+i,l(i));a(8,r-8,!0)};if(m(0),e>=7){let c=e<<12|Q(e,Z,12);for(let d=0;d<18;d+=1){let o=(c>>>d&1)!==0,l=r-11+d%3,i=Math.floor(d/3);a(l,i,o),a(i,l,o)}}let y=0;for(let c=r-1;c>=1;c-=2){c===6&&(c=5);for(let d=0;d<r;d+=1)for(let o=0;o<2;o+=1){let l=c-o,g=(c+1&2)===0?r-1-d:d;!u[g][l]&&y<t.length*8&&(s[g][l]=(t[y>>>3]>>>7-(y&7)&1)!==0,y+=1)}}let h=c=>s.map((d,o)=>d.map((l,i)=>!u[o][i]&&ne(c,i,o)?!l:l)),w=n??0;if(n===void 0){let c=1/0;for(let d=0;d<U;d+=1){m(d);let o=oe(h(d));o<c&&(c=o,w=d)}}return m(w),{version:e,size:r,mask:w,modules:h(w)}}function G(e,t={}){let{mask:n}=t;if(n!==void 0&&(!Number.isInteger(n)||n<0||n>=U))throw new RangeError("unsupported QR mask");if(typeof e!="string"||e.length===0)throw new TypeError("QR text is empty");if(e.length>H)throw new RangeError("QR text is too long");let r=new TextEncoder().encode(e);if(r.length>H)throw new RangeError("QR text is too long");let s=1;for(;K(s)<r.length;)s+=1;return re(s,te(s,r),n)}var se="/_pb/auth/local/setup/start",ae="/_pb/auth/local/setup/finish",ie="/_pb/ui/",le=43,V=1024,ue=["too_short","too_long","equals_email","not_well_formed"];function N(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function ce(e){if(!N(e)||!N(e.error))return null;let t=e.error;if(t.code!=="weak_password"||!Array.isArray(t.problems))return null;let n=t.problems.filter(r=>typeof r=="string"&&ue.includes(r));return n.length>0?n:null}function de(e){try{return G(e)}catch{return null}}function pe(e){let{transport:t}=e,n=new Set,r=null,s={stage:"token",busy:!1,notice:null,problems:[],enrollment:null},u=!1,a=b=>{if(!u){s={...s,...b};for(let m of[...n])m()}},f=()=>{r=null},k=async(b,m)=>{try{return await t.post(b,m)}catch{return null}};return{snapshot:()=>s,subscribe(b){return n.add(b),()=>{n.delete(b)}},async submitToken(b){if(s.busy||s.stage!=="token")return;let m=b.trim();if(m.length!==le||!/^[A-Za-z0-9_-]+$/.test(m)){a({notice:"bad_token_shape"});return}a({busy:!0,notice:null});let y=await k(se,{token:m});if(y===null){a({busy:!1,notice:"unavailable"});return}if(y.status===200){let h=y.json;if(N(h)&&typeof h.provisioningUri=="string"&&typeof h.secret=="string"&&h.secret.length>0){r=m;let w=de(h.provisioningUri);a({busy:!1,stage:"enroll",notice:w===null?"qr_unavailable":null,enrollment:{provisioningUri:h.provisioningUri,secret:h.secret,qr:w}});return}a({busy:!1,notice:"unavailable"});return}a({busy:!1,notice:fe(y.status)})},async finish(b){if(s.busy||s.stage!=="enroll"||r===null)return;let{password:m,confirmation:y,code:h}=b,w=h.replace(/\s+/g,"");if(m.length===0||w.length===0){a({notice:"missing_fields",problems:[]});return}if(m.length>V||w.length>V||m!==y){a({notice:"password_mismatch",problems:[]});return}a({busy:!0,notice:null,problems:[]});let c=await k(ae,{token:r,password:m,code:w});if(c===null||c.status>=500){f(),a({busy:!1,stage:"uncertain",notice:null,enrollment:null});return}if(c.status===204){f(),a({busy:!1,stage:"done",notice:null,enrollment:null});return}let d=c.status===400?ce(c.json):null;if(d!==null){a({busy:!1,notice:"weak_password",problems:d});return}if(c.status===403){a({busy:!1,notice:"origin_refused"});return}if(c.status===429){a({busy:!1,notice:"rate_limited"});return}a({busy:!1,notice:"finish_refused"})},dispose(){f(),u=!0,s={...s,enrollment:null,problems:[],busy:!1},n.clear()}}}function fe(e){return e===401||e===400?"token_refused":e===403?"origin_refused":e===429?"rate_limited":"unavailable"}function me(e,t){return{async post(n,r){let s=await e(n,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify(r),credentials:"same-origin",cache:"no-store",redirect:"error",referrerPolicy:"no-referrer",...t===void 0?{}:{signal:t}}),u=await s.json().catch(()=>null);return{status:s.status,json:u}}}}var be={bad_token_shape:"That does not look like a setup token. Paste the whole token exactly as it was issued.",token_refused:"This setup token was not accepted. It may be wrong, expired or already used. Ask the person who runs the broker for a fresh token.",origin_refused:"The broker refused this request because it came from a different address.",rate_limited:"Too many attempts. Wait a few minutes and try again.",unavailable:"The broker could not be reached or answered unexpectedly. Try again in a moment.",password_mismatch:"The password and its confirmation do not match.",missing_fields:"Enter a password and the six digit code from your authenticator.",weak_password:"The password does not meet the requirements.",finish_refused:"Setup was not completed. Check the six digit code and try again. If it keeps failing, ask for a fresh setup token.",qr_unavailable:"The QR code could not be drawn. Enter the setup key below in your authenticator instead."},he={too_short:"The password is too short.",too_long:"The password is too long.",equals_email:"The password must not be the same as the account e-mail address.",not_well_formed:"The password contains characters that are not allowed."},T=6,A=4;function ge(e,t){let n=t.size+A*2;e.width=n*T,e.height=n*T;let r=e.getContext("2d");r!==null&&(r.fillStyle="#ffffff",r.fillRect(0,0,e.width,e.height),r.fillStyle="#000000",t.modules.forEach((s,u)=>{s.forEach((a,f)=>{a&&r.fillRect((f+A)*T,(u+A)*T,T,T)})}))}function p(e,t={},...n){let r=document.createElement(e);for(let[s,u]of Object.entries(t))r.setAttribute(s,u);for(let s of n)r.append(s);return r}var ye="mt-1 block w-full rounded border border-gray-400 px-3 py-2 text-base focus:outline-none focus:ring-2 focus:ring-blue-600",L="rounded bg-blue-700 px-4 py-2 text-base font-medium text-white hover:bg-blue-800 focus:outline-none focus:ring-2 focus:ring-blue-600 focus:ring-offset-2 disabled:opacity-60";function R(e,t,n,r){let s=p("input",{id:e,name:e,class:ye,autocapitalize:"off",spellcheck:"false",required:"",...r===void 0?{}:{"aria-describedby":`${e}-hint`},...n});return{wrapper:p("div",{class:"mt-4"},p("label",{for:e,class:"block text-sm font-medium"},t),...r===void 0?[]:[p("p",{id:`${e}-hint`,class:"mt-1 text-sm text-gray-700"},r)],s),input:s}}function we(e,t){let n=pe({transport:t.transport}),r=null,s={},u=null,a=null,f=null,k=o=>p("h1",{class:"text-2xl font-semibold",tabindex:"-1",id:"setup-heading"},o),b=()=>{for(let o of Object.values(s))o.value="";s={}},m=()=>{let o=R("setup-token","Setup token",{type:"password",autocomplete:"off","aria-describedby":"setup-token-hint"}),l=p("p",{id:"setup-token-hint",class:"mt-1 text-sm text-gray-700"},"Paste the one-time token printed by the command that created your administrator account. It is never put in the address bar.");o.wrapper.insertBefore(l,o.input),s={token:o.input},f=p("button",{type:"submit",class:L},"Continue");let i=p("form",{id:"token-form",novalidate:"","aria-labelledby":"setup-heading"},o.wrapper,p("div",{class:"mt-6"},f));return i.addEventListener("submit",g=>{g.preventDefault(),n.submitToken(o.input.value)}),p("section",{},k("Set up the administrator account"),p("p",{class:"mt-2 text-gray-700"},"Step 1 of 2. Enter your setup token. You will then choose a password and connect an authenticator app."),i)},y=o=>{let l=o.enrollment,i=R("setup-password","Password",{type:"password",autocomplete:"new-password"}),g=R("setup-password-confirm","Confirm password",{type:"password",autocomplete:"new-password"}),_=R("setup-code","Six digit code from your authenticator",{type:"text",inputmode:"numeric",autocomplete:"one-time-code",pattern:"[0-9 ]*"});s={password:i.input,confirmation:g.input,code:_.input};let O=p("div",{class:"mt-4"});if(l?.qr){let x=p("canvas",{id:"setup-qr",role:"img","aria-label":"QR code for your authenticator app. If you cannot scan it, use the setup key below.",class:"h-auto max-w-full rounded border border-gray-400 [image-rendering:pixelated]"});ge(x,l.qr),O.append(x)}let X=p("div",{class:"mt-4"},p("p",{class:"text-sm font-medium",id:"setup-secret-label"},"Setup key (enter manually)"),p("code",{id:"setup-secret","aria-labelledby":"setup-secret-label",class:"mt-1 block break-all rounded bg-gray-100 px-3 py-2 font-mono text-base"},l?.secret??""),p("p",{class:"mt-1 text-sm text-gray-700"},"Type: time based, 6 digits, 30 seconds, SHA-1."));f=p("button",{type:"submit",class:L},"Finish setup");let I=p("form",{id:"finish-form",novalidate:"","aria-labelledby":"setup-heading"},i.wrapper,g.wrapper,_.wrapper,p("div",{class:"mt-6"},f));return I.addEventListener("submit",x=>{x.preventDefault(),n.finish({password:i.input.value,confirmation:g.input.value,code:_.input.value})}),p("section",{},k("Connect your authenticator"),p("p",{class:"mt-2 text-gray-700"},"Step 2 of 2. Scan the QR code with an authenticator app, or enter the setup key by hand. Then choose a password and enter the current code."),O,X,I)},h=()=>{let o=p("button",{type:"button",id:"open-app",class:L},"Open Package Broker");return o.addEventListener("click",()=>{t.navigate(ie)}),p("section",{},k("Setup complete"),p("p",{class:"mt-2 text-gray-700"},"Your administrator account is ready and you are signed in. From now on sign in with your e-mail address, your password and a code from your authenticator."),p("div",{class:"mt-6"},o))},w=()=>p("section",{},k("Setup may or may not have finished"),p("p",{class:"mt-2 text-gray-700"},"The broker did not give a clear answer. Nothing was retried. Keep your authenticator enrollment and the password you chose. The broker currently accepts sign-in through its HTTP API. If sign-in fails, ask for a fresh setup token and start again."),p("p",{class:"mt-4 text-gray-700"},"From a trusted HTTP client, send POST /_pb/auth/local/login to this broker with Content-Type: application/json and an Origin header equal to the broker address. Supply JSON fields email (your administrator e-mail address), password (the password you just chose), and code (a fresh six digit authenticator code). Read credentials from a protected file or private prompt, rather than command-line arguments. Save the response to a protected file and session cookies to a protected cookie jar; do not print either. A 204 response means you are signed in for subsequent requests using that cookie jar in the same client. See docs/workers-install.md for curl instructions and cleanup.")),c=()=>{let o=n.snapshot();if(r!==o.stage){b(),e.replaceChildren();let l=o.stage==="token"?m():o.stage==="enroll"?y(o):o.stage==="done"?h():w();a=p("div",{id:"setup-notice",role:"alert",class:"mt-4 text-red-800"}),u=p("p",{id:"setup-status",role:"status",class:"mt-4 text-gray-700"});let i=p("main",{class:"mx-auto w-full max-w-xl flex-1 p-6"},l,a,u);e.className="flex min-h-screen flex-col",e.append(i,C()),document.getElementById("setup-heading")?.focus(),r=o.stage}f&&(f.disabled=o.busy),u&&(u.textContent=o.busy?"Working\u2026":""),a&&(a.replaceChildren(),o.notice!==null&&(a.append(p("p",{},be[o.notice])),o.notice==="weak_password"&&a.append(p("ul",{class:"mt-1 list-disc pl-6"},...o.problems.map(l=>p("li",{},he[l]))))))},d=n.subscribe(c);return c(),()=>{d(),b(),n.dispose(),e.replaceChildren()}}if(typeof document<"u"){let e=document.getElementById("root");if(e!==null){let t=we(e,{transport:me(fetch.bind(globalThis)),navigate:n=>{window.location.assign(n)}});window.addEventListener("pagehide",t,{once:!0}),window.addEventListener("pageshow",n=>{n.persisted&&window.location.reload()})}}export{ie as APP_PATH,be as NOTICE_TEXT,he as PROBLEM_TEXT,ae as SETUP_FINISH_PATH,se as SETUP_START_PATH,me as createFetchTransport,pe as createSetupController,we as mountSetup};
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
6
6
|
<meta name="referrer" content="no-referrer" />
|
|
7
7
|
<title>Package Broker setup</title>
|
|
8
|
-
<link rel="stylesheet" href="/_pb/ui/setup/assets/app.
|
|
9
|
-
<script type="module" src="/_pb/ui/setup/assets/setup.
|
|
8
|
+
<link rel="stylesheet" href="/_pb/ui/setup/assets/app.f15f8f21f88b.css" />
|
|
9
|
+
<script type="module" src="/_pb/ui/setup/assets/setup.dfed30ecfbad.js"></script>
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
|
12
|
-
<
|
|
12
|
+
<div id="root"></div>
|
|
13
13
|
</body>
|
|
14
14
|
</html>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{f as a,g as b,h as c,i as d,j as e,k as f,l as g,m as h,n as i,o as j,p as k,q as l}from"./chunk.297a2d571f9c.js";import"./chunk.976a2ff4338e.js";import"./chunk.bf48b04e6a00.js";import"./chunk.3704953b4a66.js";import"./chunk.f922af39a279.js";import"./chunk.855a50f45830.js";import"./chunk.ce96495b8b55.js";import"./chunk.862544cf5835.js";import"./chunk.6e23a75a1324.js";export{g as CredentialFields,h as SYNC_ERROR_LABELS,i as SourceActions,l as SourcesPage,k as SourcesView,e as createSourcesModel,d as displayUrl,j as filterSources,b as sourceCredentialKind,a as sourceCredentialKinds,f as submitCredential,c as suggestedScopePatterns};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{a as fe}from"./chunk.7cb6f6b4daaa.js";import{a as Q}from"./chunk.bf48b04e6a00.js";import{b as je}from"./chunk.3704953b4a66.js";import{a as E}from"./chunk.f922af39a279.js";import{b as ne}from"./chunk.855a50f45830.js";import{a as re}from"./chunk.ce96495b8b55.js";import{a as te,b as ye,c as U}from"./chunk.862544cf5835.js";import{C as J,D as O,E as T,J as ge,c as q,d as ee,g as V,h as pe,i as de,m as ue,n as me,p as w}from"./chunk.6e23a75a1324.js";var $=q(ee(),1);var A=q(ee(),1);var L=q(ee(),1);var k=q(V(),1),Y={"project:read":["Read project details","View project information."],"project:packages:read":["Install and download packages","Read package metadata and download packages."],"project:packages:write":["Include publish permission","Publishing is not available in this version."],"project:grants:read":["Read project grants","View who has access to this project."],"project:sources:read":["Read project sources","View this project's package sources."],"project:audit:read":["Read project audit records","View recorded changes in this project."],"org:read":["Read organization details","View organization information."],"org:users:read":["Read organization users","Read user information allowed by the API."],"org:roles:read":["Read organization roles","View organization role definitions."],"org:grants:read":["Read organization grants","View organization access rules."],"org:sources:read":["Read organization sources","View organization package sources."],"org:import:write":["Create and read import runs","Plan and inspect imports; cannot approve or apply them."],"org:audit:read":["Read organization audit records","View recorded organization changes."]},oe=Object.keys(Y),H=["project:read","project:packages:read"],he=["project:read","project:grants:read","project:sources:read","project:audit:read"];function ke({state:e,controller:n}){let[r,p]=(0,L.useState)(!1),[i,d]=(0,L.useState)(""),[v,s]=(0,L.useState)(""),[S,o]=(0,L.useState)(H),[R,P]=(0,L.useState)("Install packages"),[N,x]=(0,L.useState)(""),[l,y]=(0,L.useState)("principal-name"),[u,b]=(0,L.useState)(null),f=e.projects.find(m=>m.id===v),h=v==="organization"?e.organizationPermissions:f?.permissions??[],C=oe.filter(m=>v==="organization"||m.startsWith("project:")).map(m=>({name:m,scope:m.startsWith("org:")?"organization":"project",description:Y[m][0]})),D=e.organizationPermissions.includes("org:service-principals:write"),g=e.organizationPermissions.includes("org:settings:write")&&D;return(0,L.useEffect)(()=>{f&&n.loadProjectPolicies([f.id])},[n,f]),(0,L.useEffect)(()=>{!v||f&&f.policyState!=="loaded"||o(m=>(R==="Install packages"?H:R==="Read project records"?he:m).filter(j=>h.includes(j)))},[v,f,R,e.organizationPermissions]),g?(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(w,{className:"min-h-11 w-full sm:w-auto",type:"button",onClick:()=>{p(!0),b(null)},children:"New service principal"}),u&&(0,k.jsx)("div",{children:(0,k.jsx)(w,{className:"min-h-11 w-full sm:w-auto",type:"button",onClick:()=>{n.choosePrincipal(u.id,e.projects.find(m=>m.id===u.projectId)?.slug??null,u.projectId===null),b(null),document.getElementById("new-token")?.focus()},children:"Create token"})}),r&&(0,k.jsxs)("form",{noValidate:!0,"aria-label":"New service principal",className:"grid max-w-5xl items-start gap-x-6 gap-y-4 lg:grid-cols-2",onSubmit:m=>{m.preventDefault();let j=i.trim()?v?f?.policyState==="loading"||f?.policyState==="idle"?{target:"principal-project",message:"Project access is still loading."}:f?.policyState==="error"?{target:"principal-project",message:"Project access could not be loaded. Try again."}:S.length?S.every(I=>h.includes(I))?null:{target:"principal-permissions",message:"You cannot grant every selected permission here."}:{target:"principal-permissions",message:"Choose at least one permission."}:{target:"principal-project",message:"Choose a project."}:{target:"principal-name",message:"Enter a service identity name."};if(j){y(j.target),requestAnimationFrame(()=>document.getElementById("principal-errors")?.focus()),x(j.message);return}x(""),n.createPrincipal(i,v==="organization"?"":v,S).then(I=>{I&&(b(I),p(!1),d(""))})},children:[(0,k.jsx)("h2",{className:"lg:col-span-2",children:"New service principal"}),(0,k.jsx)("p",{className:"lg:col-span-2",children:"Create a service identity for automation, then issue a token for it."}),N&&(0,k.jsx)("div",{id:"principal-errors",tabIndex:-1,role:"alert",className:"lg:col-span-2",children:(0,k.jsx)("button",{type:"button",className:"min-h-11 underline",onClick:()=>document.getElementById(l)?.focus(),children:N})}),(0,k.jsxs)("div",{children:[(0,k.jsx)(T,{htmlFor:"principal-name",children:"Service identity name"}),(0,k.jsx)(O,{className:"min-h-11",id:"principal-name","aria-invalid":!!N&&l==="principal-name",value:i,placeholder:"e.g. ci-storefront","aria-describedby":"principal-name-help",onChange:m=>d(m.target.value)}),(0,k.jsx)("p",{id:"principal-name-help",children:"Use one identity for each CI pipeline so you can stop its access separately."})]}),(0,k.jsxs)("div",{children:[(0,k.jsx)(T,{htmlFor:"principal-project",children:"Project"}),(0,k.jsxs)(E,{className:"min-h-11",id:"principal-project","aria-invalid":!!N&&l==="principal-project",value:v,onChange:m=>{let j=m.target.value,I=S.filter(F=>j==="organization"||F.startsWith("project:"));s(j),o(I),I.length!==S.length&&n.announce("Project changed. Incompatible permissions were removed.")},children:[(0,k.jsx)("option",{value:"",children:"Choose a project"}),e.projects.map(m=>(0,k.jsx)("option",{value:m.id,children:m.name},m.id)),(0,k.jsx)("option",{value:"organization",children:"Organization-wide (advanced)"})]}),v==="organization"&&(0,k.jsx)("p",{children:"Can carry permissions across projects and for the organization. Choose a single project for a CI pipeline that only installs its packages."})]}),(0,k.jsxs)("fieldset",{id:"principal-permissions",tabIndex:-1,className:"lg:col-span-2",children:[(0,k.jsx)("legend",{children:"Permissions"}),(0,k.jsx)("div",{className:"flex flex-wrap gap-2",children:["Install packages","Read project records","Custom"].map(m=>(0,k.jsx)(w,{className:"min-h-11 w-full sm:w-auto",type:"button","aria-pressed":R===m,onClick:()=>{P(m),m!=="Custom"&&o((m==="Install packages"?H:he).filter(j=>h.includes(j)))},children:m},m))}),R==="Read project records"&&(0,k.jsx)("p",{children:"To issue an Install and download token, also select Install and download packages."}),f?.policyState==="loading"&&(0,k.jsx)("p",{children:"Loading project access\u2026"}),f?.policyState==="error"&&(0,k.jsx)(w,{className:"min-h-11 w-full sm:w-auto",type:"button",onClick:()=>n.loadProjectPolicies([f.id],!0),children:"Try again loading project access"}),(v==="organization"?["Packages","Project records","Organization"]:["Packages","Project records"]).map(m=>(0,k.jsxs)("fieldset",{children:[(0,k.jsx)("legend",{children:m}),C.filter(j=>m==="Organization"?j.scope==="organization":m==="Packages"?H.includes(j.name)||j.name==="project:packages:write":j.scope==="project"&&!H.includes(j.name)&&j.name!=="project:packages:write").map(j=>(0,k.jsxs)("label",{className:"flex min-h-11 items-center gap-2",children:[(0,k.jsx)("input",{type:"checkbox",checked:S.includes(j.name)&&h.includes(j.name),disabled:!h.includes(j.name),"aria-invalid":!!N&&l==="principal-permissions",onChange:I=>{P("Custom"),o(F=>I.target.checked?[...F,j.name]:F.filter(B=>B!==j.name))}}),Y[j.name]?.[0]??j.description," \u2014 ",Y[j.name]?.[1],!h.includes(j.name)&&" You cannot grant this permission here."]},j.name))]},m)),(0,k.jsx)("p",{children:"A token's access level and the project's access policy may limit these permissions further."})]}),(0,k.jsxs)("p",{className:"lg:col-span-2",children:[i," \xB7 ",v==="organization"?"Organization-wide":f?.name," \xB7"," ",S.length," ",S.length===1?"permission":"permissions"]}),(0,k.jsxs)("div",{className:"flex flex-wrap gap-2 lg:col-span-2",children:[(0,k.jsx)(w,{className:"min-h-11 w-full sm:w-auto",type:"submit",disabled:e.busy,children:e.busy?"Creating service principal\u2026":"Create service principal"}),(0,k.jsx)(w,{className:"min-h-11 w-full sm:w-auto",type:"button",variant:"outline",onClick:()=>p(!1),children:"Cancel"})]})]})]}):null}var c=q(V(),1),Ee="Create token",K={read:"Install and download",write:"Include publish permission",full:"Include grants, sources and audit access"},Re={"project:read":"Read project details","project:packages:read":"Install and download packages","project:packages:write":"Include publish permission","project:grants:read":"Read project grants","project:sources:read":"Read project sources","project:audit:read":"Read project audit records"},ze={read:"Read project details and download packages.",write:"Also include the package publishing permission. Publishing is not available in this version.",full:"Also allow reading project grants, sources and audit records, plus the publish permission."},we={read:"project:packages:read",write:"project:packages:write",full:null},Le={read:["project:read","project:packages:read"],write:["project:read","project:packages:read","project:packages:write"],full:null};function Ie(e,n,r){let p=Le[n];return[...new Set(e.filter(i=>oe.includes(i)&&(p===null||p.includes(i))&&(r||i.startsWith("project:"))))].sort()}function Ae(e,n,r){if(!n)return"Choose a service identity first.";if(!n.length)return"This service identity has no permissions.";let p=Ie(n,e,!0),i=we[e];return i!==null&&!p.includes(i)?"The service identity needs the required package permission.":p.length?p.some(d=>!r.includes(d))?"You cannot confer this service identity\u2019s permissions at this access level.":null:"This service identity has no token-eligible permissions at this access level."}function be(e,n,r,p){if(!n.length)return"Choose a project first.";let i={read:0,write:1,full:2};for(let d of n){if(d.policyState==="idle"||d.policyState==="loading")return"Loading project access\u2026";if(d.cap===null||d.permissions===null)return"Project policy or permissions could not be loaded. Try again.";if(i[e]>i[d.cap])return"This access level is not available for every selected project. Choose Install and download or change the selected projects.";let v=e==="read"?"project:packages:read":"project:packages:write";if(r&&!d.permissions.includes(v))return e==="full"?"Creating this access level requires package publishing permission on every selected project, even when you only need audit access.":"Your access does not include the required package permission for every selected project.";if(!r){if(!d.permissions.includes("project:tokens:create"))return"You need permission to create tokens for this project.";if(!p)return"Choose a service identity first.";if(!p.length)return"This service identity has no permissions. Choose another identity or ask an organization administrator to grant it access.";let s=Ie(p,e,!1);if(e!=="full"&&!s.includes(we[e]))return"The service identity needs the required package permission.";if(!s.length||s.some(S=>!d.permissions.includes(S)))return"You cannot confer this service identity\u2019s permissions at this access level."}}return null}var ie=()=>({name:"",scope:"read",days:"",project:"",ids:[],mode:"selected",principal:""});function ve(e){return e.length<1||e.length>200?"Choose between 1 and 200 projects.":null}function Be(e,n){return e.principals.filter(r=>r.status==="active"&&r.projectId===n)}function Ce({state:e,controller:n,initialAudience:r="ci",defaultOpen:p=!1}){let i=e.issuanceDraft,[d,v]=(0,A.useState)(p||i!==null),[s,S]=(0,A.useState)(i?i.target==="personal":r==="personal"),o=()=>i?{name:i.draft.name,scope:i.draft.scope,days:String(i.draft.lifetimeDays),project:i.target==="organization"?"__organization":i.project??"",ids:i.draft.projectIds,mode:i.draft.projectMode,principal:i.draft.servicePrincipalId}:ie(),[R,P]=(0,A.useState)(()=>i&&i.target!=="personal"?o():{...ie(),project:e.issuanceProject??""});(0,A.useEffect)(()=>{e.issuanceProject!==null&&P(a=>({...a,project:e.issuanceProject,principal:e.issuancePrincipal??a.principal,scope:e.issuanceProject==="__organization"?"full":a.scope})),e.issuancePrincipal&&(v(!0),S(!1))},[e.issuanceProject,e.issuancePrincipal,e.issuanceNonce]);let[N,x]=(0,A.useState)(()=>i?.target==="personal"?o():ie());(0,A.useEffect)(()=>{if(!i)return;let a={name:i.draft.name,scope:i.draft.scope,days:String(i.draft.lifetimeDays),project:i.target==="organization"?"__organization":i.project??"",ids:i.draft.projectIds,mode:i.draft.projectMode,principal:i.draft.servicePrincipalId};(i.target==="personal"?x:P)(a),S(i.target==="personal"),v(!0)},[i]);let[l,y]=(0,A.useState)(""),[u,b]=(0,A.useState)(null),[f,h]=(0,A.useState)(null),C=s?f:u,D=s?h:b,g=s?N:R,m=a=>(s?x:P)(z=>({...z,...a})),j=s?e.projects.filter(a=>g.mode==="all"?a.permissions===null||a.permissions.some(z=>z==="project:packages:read"||z==="project:packages:write"):g.ids.includes(a.id)):e.projects.filter(a=>a.slug===g.project),I=!s&&g.project==="__organization",F=Be(e,I?null:j[0]?.id),B=F.find(a=>a.id===g.principal),_=e.lifetime?.[s?"personal":"service"],G=g.days||String(_?.defaultDays??""),M=s&&g.mode==="all",le=a=>B?Ae(a,B.permissions,e.organizationPermissions):"Choose a service identity first.",ce=M?null:I?le(g.scope):be(g.scope,j,s,B?.permissions),Z=j.map(a=>a.id).join(",");(0,A.useEffect)(()=>{d&&!M&&n.loadProjectPolicies(Z?Z.split(","):[])},[n,d,M,Z,e.projects]);function xe(){return g.name.trim()?e.projectsError&&!M?{message:"Projects could not be loaded. Try again.",target:s?"project-search":"issue-project"}:s&&g.mode==="selected"&&ve(g.ids)?{message:ve(g.ids),target:"project-search"}:!s&&!g.project?{message:"Choose a project first.",target:"issue-project"}:!s&&!B?{message:"Choose a service identity first.",target:"issue-principal"}:ce?{message:ce,target:"issue-access"}:!_||!X(_).includes(Number(G))?{message:"Choose an available lifetime.",target:"issue-lifetime"}:null:{message:"Enter a token name.",target:"issue-name"}}function Te(){v(!1),document.getElementById("new-token")?.focus()}return(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(w,{className:"min-h-11",id:"new-token",type:"button",onClick:()=>v(!0),children:"New token"}),d?(0,c.jsxs)("form",{noValidate:!0,className:"grid max-w-5xl items-start gap-x-6 gap-y-4 lg:grid-cols-2",onSubmit:a=>{a.preventDefault();let z=xe();if(z){D(z),requestAnimationFrame(()=>document.getElementById("token-errors")?.focus());return}D(null),n.issueFor(s?"personal":I?"organization":"project",s||I?null:g.project,{name:g.name,scope:g.scope,lifetimeDays:Number(G),servicePrincipalId:s?"":g.principal,projectMode:s?g.mode:"selected",projectIds:s&&g.mode==="selected"?g.ids:[]})},children:[(0,c.jsx)("h2",{className:"lg:col-span-2",children:"New token"}),(0,c.jsxs)("fieldset",{className:"lg:col-span-2",children:[(0,c.jsx)("legend",{children:"Who is this token for?"}),(0,c.jsxs)("label",{className:"flex min-h-11 items-center gap-2",children:[(0,c.jsx)("input",{type:"radio",name:"audience",checked:!s,onChange:()=>{S(!1)}}),"A CI pipeline or service"]}),(0,c.jsx)("p",{children:"Keeps working when the person who created it leaves."}),(0,c.jsxs)("label",{className:"flex min-h-11 items-center gap-2",children:[(0,c.jsx)("input",{type:"radio",name:"audience",checked:s,onChange:()=>{S(!0)}}),"Me"]}),(0,c.jsx)("p",{children:"Uses your access. Stops working if you leave or your account is suspended."})]}),C&&(0,c.jsx)("div",{id:"token-errors",role:"alert",tabIndex:-1,className:"lg:col-span-2",children:(0,c.jsx)("button",{type:"button",className:"min-h-11 underline",onClick:()=>document.getElementById(C.target)?.focus(),children:C.message})}),(0,c.jsxs)("div",{children:[(0,c.jsx)(T,{htmlFor:"issue-name",children:"Token name"}),(0,c.jsx)(O,{className:"min-h-11",id:"issue-name",value:g.name,"aria-invalid":!!C&&!g.name.trim(),"aria-describedby":C?"token-errors":void 0,placeholder:s?"e.g. My laptop":"e.g. Storefront CI",onChange:a=>m({name:a.target.value})})]}),s?(0,c.jsxs)("fieldset",{children:[(0,c.jsx)("legend",{children:"Which projects?"}),["selected","all"].map(a=>(0,c.jsxs)("label",{className:"flex min-h-11 items-center gap-2",children:[(0,c.jsx)("input",{type:"radio",name:"projects-mode",checked:g.mode===a,onChange:()=>m({mode:a})}),a==="selected"?"Choose projects":"All projects I can access"]},a)),g.mode==="all"?(0,c.jsx)("p",{children:"Includes projects you can access now and projects you gain access to later."}):(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(T,{htmlFor:"project-search",children:"Search projects"}),(0,c.jsx)(O,{className:"min-h-11",id:"project-search",value:l,onChange:a=>y(a.target.value)}),(0,c.jsx)("p",{id:"project-help",children:"Choose up to 200 projects. This does not give you access you do not already have."}),(0,c.jsxs)("p",{children:[g.ids.length," ",g.ids.length===1?"project selected":"projects selected"]}),(0,c.jsx)("div",{className:"max-h-60 overflow-y-auto",children:e.projects.filter(a=>a.name.toLowerCase().includes(l.toLowerCase())).map(a=>(0,c.jsxs)("label",{className:"flex min-h-11 items-center gap-2",children:[(0,c.jsx)("input",{type:"checkbox",checked:g.ids.includes(a.id),disabled:!g.ids.includes(a.id)&&g.ids.length>=200,"aria-describedby":"project-help",onChange:z=>m({ids:z.target.checked?[...g.ids,a.id]:g.ids.filter(De=>De!==a.id)})}),a.name]},a.id))})]})]}):(0,c.jsxs)("div",{children:[(0,c.jsx)(T,{htmlFor:"issue-project",children:"Project"}),(0,c.jsxs)(E,{className:"min-h-11","aria-invalid":!!C&&!g.project,"aria-describedby":C?"token-errors":void 0,id:"issue-project",value:g.project,onChange:a=>m({project:a.target.value,principal:"",scope:a.target.value==="__organization"?"full":"read"}),children:[(0,c.jsx)("option",{value:"",children:"Choose a project"}),e.projects.map(a=>(0,c.jsx)("option",{value:a.slug,children:a.name},a.id)),e.organizationPermissions.includes("org:settings:write")&&e.organizationPermissions.includes("org:service-principals:write")&&(0,c.jsx)("option",{value:"__organization",children:"Organization-wide (advanced)"})]}),g.project===""&&g.principal!==""&&e.principals.some(a=>a.id===g.principal&&a.projectId!==null)&&(0,c.jsx)("p",{children:"Project name unavailable. You may not have access to this service identity\u2019s project."})]}),e.projectsError&&(0,c.jsxs)("p",{className:"lg:col-span-2",children:["Projects could not be loaded."," ",(0,c.jsx)(w,{type:"button",onClick:()=>{n.identity()},children:"Try again"})]}),(0,c.jsxs)("fieldset",{id:"issue-access",tabIndex:-1,className:"lg:col-span-2","aria-describedby":"access-help",children:[(0,c.jsx)("legend",{children:"What can this token do?"}),["read","write","full"].map(a=>{let z=M?null:I?le(a):be(a,j,s,B?.permissions);return(0,c.jsxs)("div",{children:[(0,c.jsxs)("label",{className:"flex min-h-11 items-center gap-2",children:[(0,c.jsx)("input",{type:"radio",name:"access",checked:g.scope===a,disabled:z!==null,"aria-invalid":C?.target==="issue-access",onChange:()=>m({scope:a}),"aria-describedby":`help-${a}`}),K[a]]}),(0,c.jsxs)("p",{id:`help-${a}`,children:[ze[a]," ",z]})]},a)}),j.filter(a=>!M||a.policyState==="error").map(a=>(0,c.jsx)("p",{children:a.cap&&!M?`${a.name} allows ${{read:"install and download only",write:"install, download and publish permission",full:"all token-eligible project permissions"}[a.cap]}.`:`${a.name}: ${a.policyState==="loading"?"Loading project access\u2026":a.policyState==="error"?"Project access could not be loaded.":"Project access has not been loaded."}`},a.id)),j.some(a=>a.policyState==="error")&&(0,c.jsx)(w,{type:"button",onClick:()=>n.loadProjectPolicies(j.filter(a=>a.policyState==="error").map(a=>a.id),!0),children:"Try again loading project access"}),I&&(0,c.jsx)("p",{children:"This token may also use the service identity\u2019s organization permissions. Project policies only limit access within projects."}),(0,c.jsx)("p",{id:"access-help",children:"Your token can only use permissions its holder has and the project allows. Tokens cannot change project settings or delete packages. Publishing is not available in this version."})]}),!s&&(0,c.jsxs)("div",{children:[(0,c.jsx)(T,{htmlFor:"issue-principal",children:"Service identity"}),(0,c.jsxs)(E,{className:"min-h-11","aria-invalid":!!C&&!B,"aria-describedby":C?"token-errors":void 0,id:"issue-principal",value:g.principal,onChange:a=>m({principal:a.target.value}),children:[(0,c.jsx)("option",{value:"",children:"Choose a service identity"}),F.map(a=>(0,c.jsx)("option",{value:a.id,children:a.name},a.id))]}),(0,c.jsx)("p",{children:"A service principal is an identity for automation. Its tokens keep working when the person who created them leaves."}),B&&(0,c.jsxs)("p",{children:["Permissions:"," ",(B.permissions??[]).map(a=>Re[a]??Y[a]?.[0]).filter(Boolean).join("; ")]}),e.principalsLoading?(0,c.jsx)("p",{children:"Loading service principals\u2026"}):e.principalsError?(0,c.jsxs)("p",{children:["Service principals could not be loaded."," ",(0,c.jsx)(w,{type:"button",onClick:()=>{n.loadPrincipals()},children:"Try again"})]}):(e.principalsRestricted||!F.length)&&(0,c.jsxs)("p",{children:[e.principalsRestricted&&"You cannot browse service principals here. ","Ask an organization administrator to create a service identity for this project."]})]}),(0,c.jsxs)("div",{children:[(0,c.jsx)(T,{htmlFor:"issue-lifetime",children:"Expires after"}),(0,c.jsx)(E,{className:"min-h-11",id:"issue-lifetime","aria-invalid":C?.target==="issue-lifetime","aria-describedby":C?.target==="issue-lifetime"?"token-errors":void 0,value:G,disabled:!_,onChange:a=>m({days:a.target.value}),children:_&&X(_).map(a=>(0,c.jsxs)("option",{value:a,children:[W(a),a===_.defaultDays?" (organization default)":""]},a))}),!_&&!e.loading&&(0,c.jsx)(w,{type:"button",onClick:()=>{n.load()},children:"Try again"}),(0,c.jsx)("p",{children:_?`Maximum: ${W(_.maxDays)}. Create a replacement before this token expires.`:"Lifetime policy could not be loaded."})]}),(0,c.jsx)("p",{className:"lg:col-span-2 break-words",children:[g.name,M?"All projects I can access":j.map(a=>a.name).join(", "),K[g.scope],W(Number(G)),s?"":B?.name].filter(Boolean).join(" \xB7 ")}),(0,c.jsxs)("div",{className:"flex flex-wrap gap-2 lg:col-span-2",children:[(0,c.jsx)(w,{className:"min-h-11 w-full sm:w-auto",type:"submit",disabled:e.busy,children:e.busy?"Creating token\u2026":Ee}),(0,c.jsx)(w,{className:"min-h-11 w-full sm:w-auto",type:"button",variant:"outline",disabled:e.busy,onClick:Te,children:"Cancel"})]})]}):null]})}function ae(e){return`'${e.replaceAll("'","'\\''")}'`}function Pe(e,n,r){let p=new URL(e),i=`${p.origin}/${encodeURIComponent(n)}`,d=`registry=${i}/npm/`,v=`//${p.host}/${encodeURIComponent(n)}/npm/:_authToken=`;return{composer:`composer config ${ae(`repositories.${n}`)} composer ${ae(i)}`,composerAuth:JSON.stringify({bearer:{[p.host]:r}},null,2),npm:`${d}
|
|
2
|
+
${v}${r}`,ciComposer:`export COMPOSER_AUTH="$(printf ${ae(JSON.stringify({bearer:{[p.host]:"%s"}}).replaceAll("%","%%").replace("%%s","%s"))} "$PACKAGE_BROKER_TOKEN")"
|
|
3
|
+
composer install --no-interaction`,ciNpm:`${d}
|
|
4
|
+
${v}\${PACKAGE_BROKER_TOKEN}`}}var t=q(V(),1),W=e=>`${e} ${e===1?"day":"days"}`;function X(e){return[...new Set([30,90,180,365,e.maxDays,e.defaultDays])].filter(n=>n>0&&n<=e.maxDays).sort((n,r)=>n-r)}function $e(e,n){return n.type==="navigate"?{...e,secret:null,secretProject:null,result:null,issuedId:null,oldPersonalId:null,pending:null,renewal:null,busy:!1,notice:null}:e}function Se(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function _e(e){if(!Se(e)||!Se(e.draft))return null;let n=e.draft;return!["personal","project","organization"].includes(String(e.target))||!(e.project===null||typeof e.project=="string")||typeof e.key!="string"||typeof n.name!="string"||!["read","write","full"].includes(String(n.scope))||!Number.isInteger(n.lifetimeDays)||Number(n.lifetimeDays)<1||typeof n.servicePrincipalId!="string"||!["all","selected"].includes(String(n.projectMode))||!Array.isArray(n.projectIds)||!n.projectIds.every(r=>typeof r=="string")||e.rotate!==void 0&&typeof e.rotate!="string"||e.replace!==void 0&&typeof e.replace!="string"||n.overlapDays!==void 0&&![0,1,7].includes(Number(n.overlapDays))?null:{target:e.target,project:e.project,key:e.key,...e.refresh===!0?{refresh:!0}:{},...["personal","project","organization"].includes(String(e.listTarget))?{listTarget:e.listTarget,listProject:typeof e.listProject=="string"?e.listProject:null}:{},...typeof e.rotate=="string"?{rotate:e.rotate}:{},...typeof e.replace=="string"?{replace:e.replace}:{},draft:{name:n.name,scope:n.scope,lifetimeDays:Number(n.lifetimeDays),servicePrincipalId:n.servicePrincipalId,projectMode:n.projectMode,projectIds:[...n.projectIds],...n.overlapDays===void 0?{}:{overlapDays:Number(n.overlapDays)}}}}function qe(e){return{id:e.id,kind:e.kind,name:e.name,scope:e.scope,readOnly:e.readOnly,status:e.status,projectMode:e.projectMode,projectCount:e.projectCount,projectId:e.projectId,userId:e.userId,createdByUserId:e.createdByUserId,servicePrincipalId:e.servicePrincipalId,createdAt:e.createdAt,expiresAt:e.expiresAt,lastUsedAt:e.lastUsedAt,revokedAt:e.revokedAt}}function Ne(e,n){return e?e.target==="project"?n.slug===e.project:e.target==="personal"?e.draft.projectMode!=="selected"||e.draft.projectIds.includes(n.id):!0:!0}function se(e,n){let r=e.result;if(!r)return!1;let p=r.target==="personal"?n.permissions:e.principals.find(i=>i.id===r.draft.servicePrincipalId)?.permissions;return p?.includes("project:packages:read")===!0||r.draft.scope!=="read"&&n.cap!=="read"&&p?.includes("project:packages:write")===!0}function Fe(e,n){let r={target:"personal",project:null,issuanceProject:null,items:[],next:null,principals:[],principalsNext:null,principalsRestricted:!1,principalsLoading:!0,principalsError:!1,organizationPermissions:[],issuanceDraft:null,issuancePrincipal:null,issuanceNonce:0,names:{},projectSlugs:{},projects:[],projectsError:!1,result:null,lifetime:null,userId:null,secret:null,secretProject:null,issuedId:null,oldPersonalId:null,pending:null,renewal:null,busy:!1,loading:!1,listError:!1,notice:null},p=0,i=0,d=0,v=[],s=0,S=new Set,o=l=>{r={...r,...l};for(let y of S)y()},R=fe(n.storage);function P(l){l.code==="reauth_required"?e.requireReauth(l.request,{credential:!1,secretFields:[]}):o({notice:l.status===412||l.status===428?"The record changed. Reload before trying again.":"Unable to update tokens. Try again."})}async function N(l){if(r.busy)return;let y=++p;o({busy:!0,secret:null,secretProject:null,result:null,issuedId:null,oldPersonalId:null,pending:null,notice:null});let{draft:u,target:b,project:f,key:h}=l,C={name:u.name,scope:u.scope,lifetimeDays:u.lifetimeDays},D={...C,servicePrincipalId:u.servicePrincipalId},g={name:u.name,lifetimeDays:u.lifetimeDays,overlapDays:u.overlapDays??0},m=l.rotate!==void 0?b==="project"?await e.client.request("post","/_pb/projects/{project}/tokens/{token}/rotate",{params:{project:f,token:l.rotate},body:g,idempotencyKey:h}):await e.client.request("post","/_pb/tokens/{token}/rotate",{params:{token:l.rotate},body:g,idempotencyKey:h}):b==="personal"?await e.client.request("post","/_pb/me/tokens",{body:{...C,projectMode:u.projectMode,projectIds:u.projectIds},idempotencyKey:h}):b==="project"?await e.client.request("post","/_pb/projects/{project}/tokens",{params:{project:f},body:D,idempotencyKey:h}):await e.client.request("post","/_pb/tokens",{body:D,idempotencyKey:h});if(y===p)if(o({busy:!1}),m.ok)o({secret:m.data.token,secretProject:b==="project"?f:u.projectMode==="selected"&&u.projectIds.length===1?r.projectSlugs[u.projectIds[0]]??null:null,result:l,oldPersonalId:l.replace??null,issuedId:m.data.id,notice:"Token created."});else if(m.code==="reauth_required"){let j=pe(R,{method:"POST",path:"/_pb/me/tokens",body:l,idempotencyKey:h,credential:!1,secretFields:[]});o({secret:null,notice:j.ok?"Confirm your identity, then confirm token issue.":"Unable to save the pending action."}),j.ok&&n.navigate(`#/reauth?return=${encodeURIComponent(`/tokens${f===null?"":`?project=${encodeURIComponent(f)}`}`)}`)}else m.code==="already_issued"?o({notice:"already issued, create a new token"}):P(m)}let x={snapshot:()=>r,announce(l){o({notice:l})},subscribe(l){return S.add(l),()=>{S.delete(l)}},navigate(){p++,d++,i++,v.length=0,o({...$e(r,{type:"navigate"}),principalsLoading:!1,projects:r.projects.map(l=>l.policyState==="loading"?{...l,policyState:"idle"}:l)})},dispose(){x.navigate(),S.clear()},closeSecret(){r.busy||(p++,o({secret:null,secretProject:null,result:null,issuedId:null,oldPersonalId:null,notice:null,renewal:null,issuanceDraft:r.pending===null?null:r.issuanceDraft}))},restore(){let l=de(R,n.now()),y=l.ok?_e(l.action?.body):null;y!==null&&o({pending:y,issuanceDraft:y.refresh?y:null,secret:null})},async start(l,y){o({issuanceProject:y}),x.restore();let u=r.pending;await x.load(u?.listTarget??u?.target??l,u?u.listTarget?u.listProject??null:u.project:y)},async selectTarget(l,y){r.busy||(o({pending:null,renewal:null}),await x.load(l,y))},decline(){o({pending:null})},async confirm(){let l=r.pending;l===null||r.busy||r.loading||r.lifetime===null&&(await x.load(),r.pending!==l||r.lifetime===null||r.loading)||(await N(l),l.refresh&&r.secret!==null&&await x.load())},async issueFor(l,y,u){let b={target:l,project:y,draft:u,key:n.newKey(),refresh:!0,listTarget:r.target,listProject:r.project};o({issuanceDraft:b}),await N(b),r.secret!==null&&await x.load()},configureProject(l){let y=r.result,u=r.projects.find(b=>b.slug===l);!u||!y||y.target==="project"&&y.project!==l||y.target==="personal"&&y.draft.projectMode==="selected"&&!y.draft.projectIds.includes(u.id)||o({secretProject:l})},async issue(l){await N({target:r.renewal?.kind==="pat"?"personal":r.renewal?.projectId?"project":r.target,project:r.renewal?.kind==="svc"&&r.renewal.projectId!==null?r.projectSlugs[r.renewal.projectId]??r.project:r.project,draft:l,key:n.newKey(),...r.renewal?.kind==="svc"?{rotate:r.renewal.id}:{},...r.renewal?.kind==="pat"?{replace:r.renewal.id}:{}})},renew(l){if(!(r.busy||l.kind==="pat"&&l.userId!==r.userId)){if(l.kind==="svc"&&l.projectId!==null&&r.projectSlugs[l.projectId]===void 0&&r.target!=="project"){o({notice:"Choose this token\u2019s project scope before renewing."});return}o({renewal:l,secret:null,issuedId:null,oldPersonalId:null,notice:null})}},invalidProjects(){o({notice:"Choose between 1 and 200 projects."})},registryOrigin:()=>new URL(n.origin).origin,clientConfig(){return r.secret===null||r.secretProject===null?null:Pe(n.origin,r.secretProject,r.secret)},async copy(l){if(r.secret===null)return;let y=l===void 0?r.secret:x.clientConfig()?.[l];if(y===void 0)return;let u=l===void 0?"Token":"Configuration",b=p;try{await n.clipboard(y),b===p&&o({...n.clearAfterCopy?{secret:null}:{},notice:`${u} copied.`})}catch{b===p&&o({notice:l===void 0?"Could not copy. Select and copy the token manually.":"Could not copy. Select and copy the configuration manually."})}},async load(l=r.target,y=r.project,u){let b=++i;o({target:l,project:y,loading:!0,listError:!1,notice:r.secret===null?null:r.notice,items:[],next:null,lifetime:null});let f=l==="personal"?await e.client.request("get","/_pb/me/tokens",{query:{after:u}}):l==="project"&&y!==null?await e.client.request("get","/_pb/projects/{project}/tokens",{params:{project:y},query:{after:u}}):await e.client.request("get","/_pb/tokens",{query:{after:u}});b===i&&o(f.ok?{items:f.data.items.map(qe),next:f.data.next,lifetime:f.data.lifetime,loading:!1}:{loading:!1,listError:!0,lifetime:null,notice:"Unable to load tokens."})},async loadPrincipals(l){let y=d;o({principalsLoading:!0,principalsError:!1});let u=[],b=l;do{let f=await e.client.request("get","/_pb/service-principals",{query:{after:b}});if(y!==d)return;if(!f.ok){o({principalsLoading:!1,principalsError:f.status!==403,principalsRestricted:f.status===403,principals:[],principalsNext:null});return}u.push(...f.data.items.map(h=>({id:h.id,name:h.name,projectId:h.projectId,status:h.status,revision:h.revision,createdByUserId:h.createdByUserId,permissions:h.permissions}))),b=f.data.next??void 0}while(b!==void 0);o({principals:u,principalsNext:null,principalsRestricted:!1,principalsLoading:!1})},loadProjectPolicies(l,y=!1){let u=new Set;for(let f of l){let h=r.projects.find(C=>C.id===f);!h||h.policyState==="loading"||h.policyState==="loaded"||!y&&h.policyState==="error"||(u.add(f),v.push(f))}u.size&&o({projects:r.projects.map(f=>u.has(f.id)?{...f,policyState:"loading"}:f)});async function b(){s++;try{for(;v.length;){let f=v.shift(),h=r.projects.find(m=>m.id===f);if(!h)continue;let C=d,D=await e.client.request("get","/_pb/projects/{project}",{params:{project:h.slug}}),g=await e.client.request("get","/_pb/projects/{project}/permissions",{params:{project:h.slug}});C===d&&o({projects:r.projects.map(m=>m.id===f?{...m,cap:D.ok?D.data.tokenMaxScope:null,permissions:g.ok?g.data.project:null,policyState:D.ok&&g.ok?"loaded":"error"}:m)})}}finally{s--}}for(;v.length&&s<4;)b()},choosePrincipal(l,y,u=y===null){o({issuancePrincipal:l,issuanceProject:u?"__organization":y??"",issuanceNonce:r.issuanceNonce+1})},async identity(){let l=d,y=e.client.request("get","/_pb/session"),u={},b=[],f=!1,h;do{let j=await e.client.request("get","/_pb/projects",{query:{after:h}});if(l!==d)return;if(!j.ok){f=!0;break}for(let I of j.data.items)u[I.id]=I.slug,I.status!=="archived"&&b.push({id:I.id,slug:I.slug,name:I.name??I.slug,cap:null,permissions:null,policyState:"idle"});h=j.data.next??void 0,o({projectSlugs:{...u},projects:[...b],projectsError:f})}while(h!==void 0);o({projectSlugs:u,projects:b,projectsError:f});let C=await y;if(l!==d)return;C.ok&&o({userId:C.data.user.id});let D=await e.client.request("get","/_pb/me/permissions");if(l!==d)return;if(o({organizationPermissions:D.ok?D.data.organization:[]}),!D.ok||!D.data.organization.includes("org:users:read")){o({names:{}});return}let g,m={};do{let j=await e.client.request("get","/_pb/users",{query:{after:g}});if(l!==d)return;if(!j.ok)break;for(let I of j.data.items)I.displayName!==null&&(m[I.id]=I.displayName);g=j.data.next??void 0}while(g!==void 0);l===d&&o({names:m})},async revoke(l,y=!1){if(r.busy)return;let u=p;o({busy:!0,secret:null,issuedId:null});let b=r.target==="personal"||y?await e.client.request("delete","/_pb/me/tokens/{token}",{params:{token:l}}):r.target==="project"?await e.client.request("delete","/_pb/projects/{project}/tokens/{token}",{params:{project:r.project,token:l}}):await e.client.request("delete","/_pb/tokens/{token}",{params:{token:l}});u===p&&(o({busy:!1}),b.ok?(await x.load(),o({notice:"Token revoked.",renewal:null})):P(b))},async createPrincipal(l,y,u){if(r.busy)return;let b=p;o({busy:!0,secret:null,issuedId:null});let f={name:l,permissions:u,...y===""?{}:{project:y}},h=await e.client.request("post","/_pb/service-principals",{body:f,idempotencyKey:n.newKey()});if(b===p)if(o({busy:!1}),!h.ok)P(h);else return await x.loadPrincipals(),o({notice:"Service principal created. Create a token to use it."}),h.data},async suspendPrincipal(l){if(r.busy)return;let y=p;o({busy:!0,secret:null,issuedId:null});let u=l.projectId===null?void 0:r.projectSlugs[l.projectId],b=u!==void 0?await e.client.request("post","/_pb/projects/{project}/service-principals/{principal}/suspend",{params:{project:u,principal:l.id}}):await e.client.request("post","/_pb/service-principals/{principal}/suspend",{params:{principal:l.id}});y===p&&(o({busy:!1}),b.ok?(await x.loadPrincipals(),o({notice:"Service principal suspended; its tokens no longer work."})):P(b))}};return x}function Me(e,n){return e.filter(r=>r.name.toLowerCase().includes(n.q.toLowerCase())&&(!n.scope||r.scope===n.scope||K[r.scope]===n.scope)&&(!n.status||r.status===n.status))}function Oe({state:e,controller:n}){let[r,p]=(0,$.useState)({q:"",scope:"",status:""}),i=!!(r.q||r.scope||r.status),d=Me(e.items,r),v=e.target==="personal"?"My personal tokens":e.target==="project"?`Project: ${e.project}`:"Organization";return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(je,{values:r,fields:[{key:"q",label:"Name (this page)"},{key:"scope",label:"Scope",options:Object.values(K)},{key:"status",label:"Status",options:["active","expired","revoked"]}],onChange:p}),(0,t.jsxs)("div",{className:"my-3 flex flex-wrap items-center justify-between gap-3",children:[(0,t.jsxs)("p",{className:"text-sm text-neutral-600",children:[d.length," tokens on this page \xB7"," ",d.filter(s=>s.status==="active").length," active"]}),(0,t.jsx)(w,{type:"button",variant:"outline",disabled:e.loading||e.busy,onClick:()=>{n.load()},children:"Reload tokens"})]}),e.loading?(0,t.jsx)(U,{kind:"loading",title:"Loading tokens\u2026"}):e.listError?(0,t.jsx)(U,{kind:"error",title:"Unable to load tokens."}):d.length===0?(0,t.jsx)(U,{kind:i?"filtered-empty":"empty",title:i?"No tokens match these filters on this page.":"No tokens on this page."}):(0,t.jsx)(te,{label:"Tokens",items:d,columns:[{key:"name",label:"Token",value:s=>s.name,render:s=>(0,t.jsxs)("div",{className:"grid gap-1",children:[(0,t.jsx)("strong",{children:s.name}),(0,t.jsx)(J,{value:s.id,label:"token ID"})]})},{key:"status",label:"Status",value:s=>s.status,render:s=>(0,t.jsx)(ne,{status:s.status})},{key:"scope",label:"Scope",value:s=>s.scope,render:s=>(0,t.jsx)(ye,{variant:"outline",children:K[s.scope]})},{key:"project",label:"Project",value:s=>s.projectId===null?s.kind==="pat"?s.projectMode==="all"?"All accessible projects":`${s.projectCount} selected projects`:"Organization":e.projectSlugs[s.projectId]??s.projectId,priority:2,render:s=>s.projectId!==null&&!e.projectSlugs[s.projectId]?(0,t.jsx)(J,{value:s.projectId,label:"project ID"}):s.projectId!==null?e.projectSlugs[s.projectId]:s.kind==="pat"?s.projectMode==="all"?"All accessible projects":`${s.projectCount} selected projects`:"Organization"},{key:"lastUsedAt",label:"Last used",value:s=>s.lastUsedAt??"",priority:2,render:s=>(0,t.jsx)(re,{value:s.lastUsedAt,fallback:"Never"})},{key:"expiresAt",label:"Expires",value:s=>s.expiresAt??"",priority:3,render:s=>(0,t.jsx)(re,{value:s.expiresAt,fallback:"None"})},{key:"issuer",label:"Issued by",value:s=>s.kind==="svc"&&s.createdByUserId!==null?e.names[s.createdByUserId]??"a member":"a member",priority:3},{key:"actions",label:"Actions",value:()=>"",sortable:!1,render:s=>(0,t.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,t.jsx)(w,{type:"button",size:"sm",variant:"outline",disabled:e.busy||s.status!=="active"||s.kind==="pat"&&s.userId!==e.userId,onClick:()=>n.renew(s),children:"Renew"}),(0,t.jsx)(Q,{action:"Revoke",target:`${s.name} (${s.id})`,scope:v,description:"Revoking this token stops clients using it from authenticating. This cannot be undone. Create a new token to restore client access.",disabled:e.busy||s.status==="revoked",onConfirm:()=>{n.revoke(s.id)}},`${s.id}:${s.status}`)]})}]}),e.next===null?null:(0,t.jsx)(w,{type:"button",disabled:e.busy||e.loading,onClick:()=>{n.load(e.target,e.project,e.next)},children:"Next tokens"}),(0,t.jsx)("p",{className:"mt-3 text-xs text-neutral-600",children:"Secrets are never listed. Only tokens in your accessible scope appear here."})]})}function Ue(e){e?.focus()}function Ke({state:e,controller:n}){let[r,p]=(0,$.useState)(""),i=e.projects.find(d=>d.id===r);return(0,$.useEffect)(()=>{e.secret&&i?.policyState==="loaded"&&se(e,i)&&n.configureProject(i.slug)},[n,e.secret,i]),(0,t.jsxs)(t.Fragment,{children:[" ",e.projects.some(d=>d.permissions===null)&&(0,t.jsxs)("details",{children:[(0,t.jsx)("summary",{className:"min-h-11 cursor-pointer",children:"Check another project's package access"}),(0,t.jsx)(T,{htmlFor:"setup-candidate",children:"Project to configure"}),(0,t.jsxs)(E,{id:"setup-candidate",className:"min-h-11",value:r,onChange:d=>{p(d.target.value),n.loadProjectPolicies([d.target.value])},children:[(0,t.jsx)("option",{value:"",children:"Choose a project"}),e.projects.filter(d=>Ne(e.result,d)).map(d=>(0,t.jsx)("option",{value:d.id,children:d.name},d.id))]}),i?.policyState==="loading"&&(0,t.jsx)("p",{children:"Loading project access\u2026"}),i?.policyState==="error"&&(0,t.jsx)(w,{type:"button",onClick:()=>n.loadProjectPolicies([i.id],!0),children:"Try again loading project access"}),i?.policyState==="loaded"&&!se(e,i)&&(0,t.jsx)("p",{children:"This token does not have package access to this project."})]})]})}function Ve({state:e,controller:n}){let r=e.renewal!==null?e.renewal.kind==="pat":e.target==="personal",p=e.lifetime?.[r?"personal":"service"],i=e.renewal,d=n.clientConfig(),v=i?.kind==="svc"?i.projectId:e.target==="project"?Object.keys(e.projectSlugs).find(o=>e.projectSlugs[o]===e.project):null,s=e.principals.filter(o=>o.status==="active");function S(o){if(o.preventDefault(),e.busy)return;let R=o.currentTarget,P=new FormData(R),N=P.getAll("projectIds").map(String);if(r&&P.get("projectMode")==="selected"&&(N.length<1||N.length>200)){n.invalidProjects();return}let x=i?.kind==="svc"?i.scope:String(P.get("scope"));n.issue({name:String(P.get("name")),scope:x,lifetimeDays:Number(P.get("lifetimeDays")),servicePrincipalId:String(P.get("principal")??""),projectMode:P.get("projectMode")==="selected"?"selected":"all",projectIds:P.getAll("projectIds").map(String),overlapDays:Number(P.get("overlap")??0)})}return(0,t.jsxs)("section",{"aria-labelledby":"page-heading",className:"space-y-4",children:[(0,t.jsx)("h1",{tabIndex:-1,id:"page-heading",className:"text-xl font-semibold",children:"Tokens"}),(0,t.jsx)("p",{className:"text-neutral-600",children:"Connect your tools and CI pipelines to your packages."}),e.notice===null||e.listError?null:(0,t.jsx)(ue,{role:"status","aria-live":"polite",children:(0,t.jsx)(me,{children:e.notice})}),e.pending===null?null:(0,t.jsxs)("section",{"aria-label":"Confirm token issue",className:"space-y-2",children:[(0,t.jsx)("h2",{children:"Confirm token issue"}),(0,t.jsx)("p",{children:"Your identity was checked. Issue this token now?"}),(0,t.jsx)(w,{type:"button",disabled:e.busy||e.loading||e.lifetime===null,onClick:()=>{n.confirm()},children:"Confirm token issue"}),(0,t.jsx)(w,{type:"button",variant:"outline",onClick:()=>n.decline(),children:"Cancel"})]}),e.secret===null?null:(0,t.jsxs)("section",{"aria-label":"Token secret",className:"detail-group space-y-3 border-emerald-200",children:[(0,t.jsx)("h2",{tabIndex:-1,ref:Ue,children:"Token created"}),e.result&&(0,t.jsxs)("p",{className:"break-words",children:[e.result.draft.name," \xB7"," ",e.result.target==="project"?e.projects.find(o=>o.slug===e.result?.project)?.name??"Project name unavailable":e.result.target==="organization"?"Organization-wide":e.result.draft.projectMode==="all"?"All accessible projects":e.result.draft.projectIds.length===1?e.projects.find(o=>o.id===e.result?.draft.projectIds[0])?.name??"1 selected project":`${e.result.draft.projectIds.length} selected projects`," ","\xB7 ",K[e.result.draft.scope]," \xB7 Expires after"," ",W(e.result.draft.lifetimeDays)]}),(0,t.jsx)("p",{children:"Copy this token now. You cannot view it again. Closing this panel keeps it active."}),(0,t.jsx)("pre",{className:"rounded-md border bg-neutral-50 p-3 overflow-x-auto whitespace-pre-wrap break-all",children:(0,t.jsx)("code",{role:"region","aria-label":"Created token",children:e.secret})}),(0,t.jsx)(w,{className:"min-h-11",type:"button",onClick:()=>{n.copy()},children:"Copy token"}),(0,t.jsx)(w,{type:"button",variant:"outline",className:"min-h-11",onClick:()=>{n.closeSecret(),requestAnimationFrame(()=>document.getElementById("new-token")?.focus())},children:"Done"}),(0,t.jsx)(Ke,{state:e,controller:n}),(0,t.jsx)(T,{htmlFor:"configure-project",children:"Configure for project"}),(0,t.jsxs)(E,{className:"min-h-11",id:"configure-project",value:e.secretProject??"",onChange:o=>n.configureProject(o.target.value),children:[(0,t.jsx)("option",{value:"",children:"Choose a project"}),e.projects.filter(o=>se(e,o)).filter(o=>Ne(e.result,o)).map(o=>(0,t.jsx)("option",{value:o.slug,children:o.name},o.id))]}),d===null?(0,t.jsx)("p",{children:"Choose a project this token can access to configure Composer or npm."}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("p",{children:"Composer sends this credential to this registry host. The token still limits which projects it can access."}),[["Composer",["composer","composerAuth"]],["npm",["npm"]],["CI environment",["ciComposer","ciNpm"]]].map(([o,R],P)=>(0,t.jsxs)("details",{open:P===0,className:"min-w-0",children:[(0,t.jsx)("summary",{className:"min-h-11 cursor-pointer",children:o}),R.map(N=>(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{children:{composer:"Composer repository command",composerAuth:"Merge this into your local auth.json. Do not commit credentials.",npm:"Use this on your computer. For CI, use the environment-variable version below.",ciComposer:"Save PACKAGE_BROKER_TOKEN as a secret in your CI settings. These examples install packages; they do not publish them.",ciNpm:"Save this as .npmrc, then run npm ci."}[N]}),(0,t.jsx)("pre",{className:"whitespace-pre-wrap break-all rounded-md border bg-neutral-50 p-3",children:(0,t.jsx)("code",{children:d[N]})}),(0,t.jsx)(w,{type:"button",variant:"outline",className:"min-h-11",onClick:()=>{n.copy(N)},children:{composer:"Copy Composer configuration",composerAuth:"Copy auth.json",npm:"Copy npm configuration",ciComposer:"Copy CI Composer",ciNpm:"Copy CI npm"}[N]})]},N))]},o))]}),e.oldPersonalId!==null?(0,t.jsx)(Q,{action:"Revoke old personal token",target:e.oldPersonalId,scope:"My personal tokens",description:"Clients using the old token will lose access immediately. This cannot be undone. Update clients to the new token before revoking.",disabled:e.busy,onConfirm:()=>{n.revoke(e.oldPersonalId,!0)}}):null]}),(0,t.jsx)("div",{hidden:e.pending!==null||e.secret!==null||i!==null,children:(0,t.jsx)(Ce,{state:e,controller:n})}),e.pending!==null||e.secret!==null||i===null?null:(0,t.jsxs)("details",{open:i!==null,className:"detail-group",children:[(0,t.jsx)("summary",{className:"min-h-11 cursor-pointer font-semibold",children:i===null?"Issue token":"Renew token"}),(0,t.jsxs)("form",{onSubmit:S,className:"grid gap-2",children:[(0,t.jsx)(T,{htmlFor:"token-name",children:"Name"}),(0,t.jsx)(O,{id:"token-name",name:"name",defaultValue:i?.name??"",required:!0}),(0,t.jsx)(T,{htmlFor:"token-scope",children:"Scope"}),(0,t.jsxs)(E,{id:"token-scope",name:"scope",defaultValue:i?.scope??"read",disabled:i?.kind==="svc",children:[(0,t.jsx)("option",{value:"read",children:"Install and download"}),(0,t.jsx)("option",{value:"write",children:"Include publish permission"}),(0,t.jsx)("option",{value:"full",children:"Include grants, sources and audit access"})]}),(0,t.jsx)(T,{htmlFor:"token-lifetime",children:"Lifetime"}),(0,t.jsx)(E,{id:"token-lifetime",name:"lifetimeDays",defaultValue:p?.defaultDays,required:!0,children:p===void 0?null:X(p).map(o=>(0,t.jsx)("option",{value:o,children:W(o)},o))}),r?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T,{htmlFor:"token-project-mode",children:"Projects"}),(0,t.jsxs)(E,{id:"token-project-mode",name:"projectMode",defaultValue:i?.projectMode??"all",children:[(0,t.jsx)("option",{value:"all",children:"All accessible projects"}),(0,t.jsx)("option",{value:"selected",children:"Selected projects"})]}),(0,t.jsxs)("fieldset",{children:[(0,t.jsx)("legend",{children:"Choose projects again when renewing a selected token"}),e.projects.map(o=>(0,t.jsxs)("label",{className:"flex min-h-11 items-center gap-2",children:[(0,t.jsx)("input",{type:"checkbox",name:"projectIds",value:o.id}),o.name]},o.id))]})]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T,{htmlFor:"token-principal",children:"Service principal"}),(0,t.jsxs)(E,{id:"token-principal",name:"principal",defaultValue:i?.servicePrincipalId??"",disabled:i?.kind==="svc",required:i?.kind!=="svc",children:[(0,t.jsx)("option",{value:"",disabled:!0,children:"Select a principal"}),s.filter(o=>o.projectId===v).map(o=>(0,t.jsx)("option",{value:o.id,children:o.name},o.id))]}),e.principalsRestricted?(0,t.jsx)("p",{children:"Ask an organization administrator to create a service identity for this project."}):null]}),i?.kind!=="svc"?null:(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T,{htmlFor:"token-overlap",children:"Overlap"}),(0,t.jsxs)(E,{id:"token-overlap",name:"overlap",defaultValue:"0",children:[(0,t.jsx)("option",{value:"0",children:"None"}),(0,t.jsx)("option",{value:"1",children:"1 day"}),(0,t.jsx)("option",{value:"7",children:"7 days"})]}),(0,t.jsx)("p",{children:"The old token stops at the end of the overlap or when the new token expires, whichever is first."})]}),(0,t.jsx)(w,{type:"submit",disabled:e.busy||e.loading||p===void 0,children:i===null?"Issue token":"Renew token"}),i===null?null:(0,t.jsx)(w,{type:"button",variant:"outline",disabled:e.busy,onClick:()=>n.closeSecret(),children:"Cancel renewal"})]},`${e.target}:${i?.id??""}:${p?.defaultDays}`)]},`${e.target}:${i?.id??""}`),(0,t.jsx)(T,{htmlFor:"token-list",children:"Token list"}),(0,t.jsxs)(E,{id:"token-list",value:e.target,disabled:e.busy,onChange:o=>{n.selectTarget(o.target.value,e.project)},children:[(0,t.jsx)("option",{value:"personal",children:"My personal tokens"}),e.project===null?null:(0,t.jsx)("option",{value:"project",children:"Project tokens"}),(0,t.jsx)("option",{value:"organization",children:"Organization tokens"})]}),(0,t.jsxs)("details",{className:"detail-group",children:[(0,t.jsx)("summary",{children:"How token access works"}),(0,t.jsx)("p",{children:"Personal tokens use your access and stop working if you leave or your account is suspended. Service tokens use a service identity and keep working when their creator leaves. Each project's access policy can limit a token further."})]}),(0,t.jsx)(Oe,{state:e,controller:n},`${e.target}:${e.project}`),(0,t.jsxs)("details",{className:"detail-group",children:[(0,t.jsx)("summary",{className:"min-h-11 cursor-pointer font-semibold",children:"Service principals"}),(0,t.jsx)(ke,{state:e,controller:n}),(0,t.jsx)(w,{type:"button",variant:"outline",disabled:e.busy,onClick:()=>{n.loadPrincipals()},children:"Reload service principals"}),e.principalsRestricted?(0,t.jsx)(U,{kind:"placeholder",title:"You cannot browse service principals here."}):e.principalsLoading?(0,t.jsx)(U,{kind:"loading",title:"Loading service principals\u2026"}):e.principals.length===0?(0,t.jsx)(U,{kind:"empty",title:"No service principals loaded."}):(0,t.jsx)(te,{label:"Service principals",items:e.principals,columns:[{key:"name",label:"Name",value:o=>o.name,render:o=>(0,t.jsxs)("div",{className:"grid gap-1",children:[(0,t.jsx)("strong",{children:o.name}),(0,t.jsx)(J,{value:o.id,label:"principal ID"})]})},{key:"status",label:"Status",value:o=>o.status,render:o=>(0,t.jsx)(ne,{status:o.status})},{key:"actions",label:"Actions",value:()=>"",sortable:!1,render:o=>(0,t.jsx)(Q,{action:"Revoke principal access",target:`${o.name} (${o.id})`,scope:o.projectId===null?"Organization":`Project: ${e.projectSlugs[o.projectId]??o.projectId}`,description:"Suspending this principal stops all of its tokens from working. Update clients before continuing.",disabled:e.busy||o.status!=="active",onConfirm:()=>{n.suspendPrincipal(o)}},`${o.id}:${o.status}`)}]}),e.principalsNext===null?null:(0,t.jsx)(w,{type:"button",disabled:e.busy,onClick:()=>{n.loadPrincipals(e.principalsNext)},children:"Next service principals"})]})]})}function Ye(e,n,r){let p=()=>{e.navigate(),r()},i=()=>e.navigate(),d=v=>{i(),v.persisted===!0&&r()};return n.addEventListener("hashchange",p),n.addEventListener("pagehide",i),n.addEventListener("pageshow",d),()=>{n.removeEventListener("hashchange",p),n.removeEventListener("pagehide",i),n.removeEventListener("pageshow",d),e.dispose()}}function We(e,n){return n.subscribeReplay?.(r=>{r.ok&&(/^\/_pb\/(?:me\/)?tokens\/[^/]+$/.test(r.path)||/^\/_pb\/projects\/[^/]+\/tokens\/[^/]+$/.test(r.path)||/^\/_pb\/service-principals(?:\/[^/]+\/suspend)?$/.test(r.path)||/^\/_pb\/projects\/[^/]+\/service-principals\/[^/]+\/suspend$/.test(r.path))&&(e.load(),e.loadPrincipals())})}function St(){let e=ge(),n=(0,$.useMemo)(()=>Fe(e,{storage:{getItem:p=>window.sessionStorage.getItem(p),setItem:(p,i)=>window.sessionStorage.setItem(p,i),removeItem:p=>window.sessionStorage.removeItem(p)},origin:window.location.origin,clipboard:p=>navigator.clipboard.writeText(p),navigate:p=>{window.location.hash=p},newKey:()=>crypto.randomUUID(),now:Date.now}),[e]),r=(0,$.useSyncExternalStore)(n.subscribe,n.snapshot,n.snapshot);return(0,$.useEffect)(()=>{function p(){let d=new URLSearchParams(window.location.hash.split("?")[1]??"").get("project");window.location.hash.startsWith("#/tokens")&&n.start(d===null?"personal":"project",d)}function i(){window.location.hash.startsWith("#/tokens")&&(n.identity(),n.loadPrincipals())}return p(),n.identity(),n.loadPrincipals(),Ye(n,window,()=>{p(),i()})},[n]),(0,$.useEffect)(()=>We(n,e),[n,e]),(0,t.jsx)(Ve,{state:r,controller:n})}export{Oe as TokenList,St as TokensPage,Ve as TokensView,Ye as bindTokensLifecycle,We as bindTokensReplay,Fe as createTokensController,W as dayLabel,Me as filterTokens,se as hasSetupAccess,Ne as inResultScope,X as lifetimeChoices,$e as tokensReducer};
|
package/cloudflare/assets.json
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"provider": {
|
|
4
4
|
"specifier": "@package-broker/ui-assets",
|
|
5
|
-
"version": "0.1.0-rc.
|
|
5
|
+
"version": "0.1.0-rc.3"
|
|
6
6
|
},
|
|
7
|
-
"digest": "sha256:
|
|
7
|
+
"digest": "sha256:d391410559b984542da5e3523005279c41af13c72812d5e1d4c7b43c7d3fdf50",
|
|
8
8
|
"descriptor": {
|
|
9
9
|
"directory": "./assets",
|
|
10
10
|
"binding": "ASSETS",
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"target": "cloudflare",
|
|
4
|
-
"core": "2.0.0-rc.
|
|
4
|
+
"core": "2.0.0-rc.3",
|
|
5
5
|
"plugins": {
|
|
6
|
-
"@package-broker/plugin-sso-oidc": "0.1.0-rc.
|
|
7
|
-
"@package-broker/plugin-github": "0.1.0-rc.
|
|
6
|
+
"@package-broker/plugin-sso-oidc": "0.1.0-rc.3",
|
|
7
|
+
"@package-broker/plugin-github": "0.1.0-rc.3"
|
|
8
8
|
},
|
|
9
9
|
"lockfileSha256": "5349d3f893242687c7b1bf65b975654f1ed2808d8aa876f232ce00d285c57fe2",
|
|
10
|
-
"gitSha": "
|
|
10
|
+
"gitSha": "be2c01451db211883762e995df33ec6df6f23979",
|
|
11
11
|
"dirty": false
|
|
12
12
|
}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
{
|
|
10
10
|
"id": "sso-oidc",
|
|
11
11
|
"package": "@package-broker/plugin-sso-oidc",
|
|
12
|
-
"version": "0.1.0-rc.
|
|
12
|
+
"version": "0.1.0-rc.3",
|
|
13
13
|
"apiVersion": 3,
|
|
14
14
|
"platforms": [
|
|
15
15
|
"cloudflare",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
{
|
|
27
27
|
"id": "github",
|
|
28
28
|
"package": "@package-broker/plugin-github",
|
|
29
|
-
"version": "0.1.0-rc.
|
|
29
|
+
"version": "0.1.0-rc.3",
|
|
30
30
|
"apiVersion": 3,
|
|
31
31
|
"platforms": [
|
|
32
32
|
"cloudflare",
|