@ppdostudio/ppdo-cli 1.0.0-beta.0 → 1.0.0-beta.2
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/CHANGELOG.md +96 -54
- package/LICENSE +114 -114
- package/README.md +381 -331
- package/THIRD-PARTY-NOTICES +1 -0
- package/dist/bin.js +2 -2
- package/dist/chunks/{ado-NLCWVIVQ.js → ado-OTSVKTOE.js} +6 -6
- package/dist/chunks/{api-YKKPVMTX.js → api-IRGGH5DJ.js} +1 -1
- package/dist/chunks/{api-T5SWGOFX.js → api-TZJXGWWQ.js} +1 -1
- package/dist/chunks/auth-7CDWOYJE.js +6 -0
- package/dist/chunks/azCli-UEDQHRLP.js +2 -0
- package/dist/chunks/batch-LKWCBKAB.js +2 -0
- package/dist/chunks/{build-XDCWMEEL.js → build-PBPXO3GJ.js} +3 -3
- package/dist/chunks/bulk-NY5XX752.js +2 -0
- package/dist/chunks/chunk-2IUXH534.js +2 -0
- package/dist/chunks/chunk-3L7657R3.js +5 -0
- package/dist/chunks/{chunk-5KZDCOFA.js → chunk-46KBBWEH.js} +1 -1
- package/dist/chunks/chunk-6NBCHK6X.js +2 -0
- package/dist/chunks/chunk-6VLFO5FJ.js +7 -0
- package/dist/chunks/chunk-B3TJ3RJN.js +2 -0
- package/dist/chunks/chunk-BG2OIOSN.js +2 -0
- package/dist/chunks/chunk-BWOEIEFY.js +6 -0
- package/dist/chunks/chunk-ELSYHAYC.js +2 -0
- package/dist/chunks/chunk-FOEBNCSD.js +3 -0
- package/dist/chunks/{chunk-XL7E7LX5.js → chunk-GLU4X7PT.js} +2 -2
- package/dist/chunks/chunk-GQLXEQVQ.js +4 -0
- package/dist/chunks/chunk-GY6BUIDP.js +2 -0
- package/dist/chunks/chunk-H4OY4EFC.js +3 -0
- package/dist/chunks/chunk-HJQJ77F2.js +3 -0
- package/dist/chunks/chunk-I7MHI5CU.js +151 -0
- package/dist/chunks/chunk-ITP35SAY.js +2 -0
- package/dist/chunks/{chunk-J777TCSE.js → chunk-J67P6QFC.js} +2 -2
- package/dist/chunks/{chunk-NNHEYYF5.js → chunk-KBZI5UDL.js} +1 -1
- package/dist/chunks/chunk-LB7WNZVK.js +5 -0
- package/dist/chunks/chunk-MBNUMAAZ.js +2 -0
- package/dist/chunks/chunk-MNGA7IHQ.js +4 -0
- package/dist/chunks/chunk-P4IFCLVF.js +2 -0
- package/dist/chunks/chunk-Q2RD4TRK.js +2 -0
- package/dist/chunks/chunk-S6NK6GX2.js +5 -0
- package/dist/chunks/chunk-SWXCK5C2.js +2 -0
- package/dist/chunks/chunk-T4IH34D7.js +2 -0
- package/dist/chunks/{chunk-HLE2WURE.js → chunk-TADCW6ZI.js} +1 -1
- package/dist/chunks/{chunk-UYDBLVAM.js → chunk-TCLZ4XM6.js} +1 -1
- package/dist/chunks/chunk-VC7ADQ6E.js +2 -0
- package/dist/chunks/{chunk-GT52BRS2.js → chunk-XUHLW6B2.js} +18 -18
- package/dist/chunks/{commands-GHYN6GZT.js → commands-EOUU353W.js} +1 -1
- package/dist/chunks/component-JCIJQELN.js +2 -0
- package/dist/chunks/config-WV3NZGTI.js +2 -0
- package/dist/chunks/connection-L6CUFUPJ.js +2 -0
- package/dist/chunks/connref-IT6K56UT.js +2 -0
- package/dist/chunks/convert-ILMJ2HHN.js +5 -0
- package/dist/chunks/customizations-AX7ZSXCK.js +2 -0
- package/dist/chunks/data-UWOV3LBO.js +5 -0
- package/dist/chunks/dependency-V4ZJIWQL.js +3 -0
- package/dist/chunks/{discovery-XXVLVHD6.js → discovery-PSGWFMJH.js} +1 -1
- package/dist/chunks/{dv-3OESFBNW.js → dv-SD5LTNZJ.js} +109 -48
- package/dist/chunks/{env-MZPI3UA2.js → env-6RZCHQUC.js} +2 -2
- package/dist/chunks/environment-IBLJHUAL.js +2 -0
- package/dist/chunks/{environments-WMBLSAQF.js → environments-3P2I4QUC.js} +1 -1
- package/dist/chunks/envvar-KJ2TUZGJ.js +2 -0
- package/dist/chunks/fanout-2WQYFUWL.js +2 -0
- package/dist/chunks/{fetchxml-ONTNTA6Z.js → fetchxml-M6EOF7N6.js} +1 -1
- package/dist/chunks/functions-NILMLS4R.js +2 -0
- package/dist/chunks/{graph-JI23YQB5.js → graph-NO2OT2TL.js} +1 -1
- package/dist/chunks/{group-DKEPSVRV.js → group-ISSJ4H2A.js} +2 -2
- package/dist/chunks/history-JPMLQDJI.js +2 -0
- package/dist/chunks/identity-SBQNHSBF.js +2 -0
- package/dist/chunks/init-X2VEK4T2.js +2 -0
- package/dist/chunks/jobs-XC7EYPBP.js +2 -0
- package/dist/chunks/lifecycle-2F7MF6EP.js +2 -0
- package/dist/chunks/{main-ZVIKC3VA.js → main-J3O5YMIY.js} +2 -2
- package/dist/chunks/metadata-NZFQIAAG.js +2 -0
- package/dist/chunks/metadataCreate-XSHK32TR.js +2 -0
- package/dist/chunks/msalUser-KC75VDVV.js +2 -0
- package/dist/chunks/names-N5JRXO33.js +2 -0
- package/dist/chunks/{pack-2UDE25IY.js → pack-3OYGV36R.js} +1 -1
- package/dist/chunks/pat-PCMOZYM5.js +2 -0
- package/dist/chunks/{pipelines-O3OYNCHT.js → pipelines-OCHSIQ2E.js} +1 -1
- package/dist/chunks/pluginRegister-LEVZNDZN.js +4 -0
- package/dist/chunks/{plugins-EUDJ7QIS.js → plugins-TEME2R77.js} +1 -1
- package/dist/chunks/{policies-KVPQVUHS.js → policies-EWCANNBE.js} +1 -1
- package/dist/chunks/{pools-7H2L4QJC.js → pools-54KMEL5D.js} +1 -1
- package/dist/chunks/process-KR7LIXZB.js +2 -0
- package/dist/chunks/{projects-BHG2B4IX.js → projects-LPVDFLPC.js} +1 -1
- package/dist/chunks/protect-X2J7LU7X.js +2 -0
- package/dist/chunks/provider-D7DMMAS6.js +2 -0
- package/dist/chunks/{prs-NOXIZ7AT.js → prs-C4EKGJWA.js} +1 -1
- package/dist/chunks/records-C4RLQXFK.js +2 -0
- package/dist/chunks/{run-BXFENCN6.js → run-27MYTWHY.js} +1 -1
- package/dist/chunks/run-46PEJS3S.js +2 -0
- package/dist/chunks/run-7L6W2YWJ.js +3 -0
- package/dist/chunks/run-CD3ZOB5V.js +4 -0
- package/dist/chunks/run-EUNN6OZO.js +2 -0
- package/dist/chunks/{run-JYU5BTWN.js → run-JDNEQMJC.js} +1 -1
- package/dist/chunks/{run-MGLIIM7Z.js → run-T3IIJ7SK.js} +1 -1
- package/dist/chunks/run-ZHIDOKQH.js +2 -0
- package/dist/chunks/{runtime-VOF7XYXW.js → runtime-FJJPTBEE.js} +1 -1
- package/dist/chunks/security-SBIAK6QD.js +2 -0
- package/dist/chunks/{service-V2TQEEID.js → service-4N3YP4Z7.js} +1 -1
- package/dist/chunks/{service-4PIAYFYF.js → service-HASXLUGE.js} +1 -1
- package/dist/chunks/services-C6G4XRXR.js +2 -0
- package/dist/chunks/{skills-GD6Z6P3R.js → skills-FW4F3EIW.js} +1 -1
- package/dist/chunks/solution-CNBNIS7Z.js +2 -0
- package/dist/chunks/solutionExport-Y524HMGN.js +2 -0
- package/dist/chunks/{solutionfiles-P223QW2J.js → solutionfiles-2TP3Y2RW.js} +1 -1
- package/dist/chunks/spn-YSYMDTOI.js +2 -0
- package/dist/chunks/tokenCache-TQFT6LAD.js +2 -0
- package/dist/chunks/{unpack-XZLTBUGC.js → unpack-HUH7OJMP.js} +1 -1
- package/dist/chunks/{users-KFAPPGF4.js → users-Q7BJKBPP.js} +1 -1
- package/dist/chunks/{vargroups-33EZAHGZ.js → vargroups-GNZBODVJ.js} +1 -1
- package/dist/chunks/{whoami-ULK5UMZV.js → whoami-6G6UFTNS.js} +1 -1
- package/dist/chunks/{workitems-YGES6KKN.js → workitems-2IOGD3EL.js} +1 -1
- package/package.json +61 -57
- package/schema/ppdo-cli.schema.json +16 -4
- package/schema/reference-data.schema.json +192 -0
- package/skills/ppdo-cli/SKILL.md +2 -1
- package/skills/ppdo-cli-data/SKILL.md +669 -0
- package/skills/ppdo-cli-dataverse/SKILL.md +6 -0
- package/skills/ppdo-cli-plugins/PluginRegistration.cs +229 -0
- package/skills/ppdo-cli-plugins/SKILL.md +95 -0
- package/skills/ppdo-cli-plugins/reference.md +72 -0
- package/dist/chunks/auth-IP7AOWSF.js +0 -6
- package/dist/chunks/azCli-T67ZMIC3.js +0 -2
- package/dist/chunks/batch-GCXLGQET.js +0 -4
- package/dist/chunks/bulk-5QO343HO.js +0 -2
- package/dist/chunks/chunk-3C3GSN3J.js +0 -2
- package/dist/chunks/chunk-4S5ETLH4.js +0 -2
- package/dist/chunks/chunk-5SBBTR3Y.js +0 -2
- package/dist/chunks/chunk-5UOZCXQF.js +0 -5
- package/dist/chunks/chunk-BWZ6HZXM.js +0 -2
- package/dist/chunks/chunk-JGLUQBCK.js +0 -2
- package/dist/chunks/chunk-MME53RWW.js +0 -4
- package/dist/chunks/chunk-OP6EXLWQ.js +0 -5
- package/dist/chunks/chunk-PDFXH652.js +0 -2
- package/dist/chunks/chunk-QE4DELWW.js +0 -2
- package/dist/chunks/chunk-RHQP7X6H.js +0 -3
- package/dist/chunks/chunk-UKKSN4F7.js +0 -3
- package/dist/chunks/chunk-UWFDJKOJ.js +0 -2
- package/dist/chunks/chunk-WXCLWAE2.js +0 -2
- package/dist/chunks/chunk-X7VWUI6N.js +0 -2
- package/dist/chunks/component-PAASRIK6.js +0 -2
- package/dist/chunks/config-JN3I5EII.js +0 -2
- package/dist/chunks/connection-IWFELK5W.js +0 -2
- package/dist/chunks/connref-ZDY7JYK5.js +0 -2
- package/dist/chunks/customizations-IE2KO275.js +0 -7
- package/dist/chunks/dependency-EFDSIKSN.js +0 -3
- package/dist/chunks/environment-NUQHU74A.js +0 -2
- package/dist/chunks/envvar-YN35IDWJ.js +0 -2
- package/dist/chunks/fanout-DUP5CD5X.js +0 -2
- package/dist/chunks/functions-K5TYRB2C.js +0 -2
- package/dist/chunks/history-SNSJRV6B.js +0 -2
- package/dist/chunks/identity-OW4WCDOA.js +0 -2
- package/dist/chunks/jobs-PXNJFWWF.js +0 -2
- package/dist/chunks/lifecycle-7RMWV26J.js +0 -2
- package/dist/chunks/metadata-74WGGOV5.js +0 -2
- package/dist/chunks/metadataCreate-W3NDI5FB.js +0 -2
- package/dist/chunks/msalUser-JRNX5HPO.js +0 -2
- package/dist/chunks/names-SFYZQY6Q.js +0 -2
- package/dist/chunks/process-G7LCTGKS.js +0 -2
- package/dist/chunks/protect-WZO3MAHF.js +0 -2
- package/dist/chunks/provider-VXRAQRN2.js +0 -2
- package/dist/chunks/records-TN7ZKUJ7.js +0 -2
- package/dist/chunks/run-F6H4QCWR.js +0 -2
- package/dist/chunks/run-HBQCSGYY.js +0 -3
- package/dist/chunks/run-MHM3GTGH.js +0 -2
- package/dist/chunks/run-SRQPP6N3.js +0 -3
- package/dist/chunks/run-ZNDSC7LR.js +0 -2
- package/dist/chunks/security-FLEAZ4EA.js +0 -2
- package/dist/chunks/services-B6V4VVX5.js +0 -2
- package/dist/chunks/solution-HF57MP27.js +0 -2
- package/dist/chunks/solutionExport-TLGHMUM5.js +0 -2
- package/dist/chunks/spn-AIUWML5R.js +0 -2
- package/dist/chunks/tokenCache-3LMJRUTI.js +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{d as I,f as M}from"./chunk-
|
|
2
|
+
import{d as I,f as M}from"./chunk-Q2RD4TRK.js";import"./chunk-ITP35SAY.js";import"./chunk-ZUXLC5VX.js";import{A as F,G as d,b as Y,c as N,d as O,e as k,f as t,g as T,h as C,i as x,j as J,k as Q,n as S,t as f,u as R,v as q,w as A,x as Z,z as B}from"./chunk-BG2OIOSN.js";import"./chunk-UCTMKA2J.js";import{b as v,d as _,e as w,f as P,i as E}from"./chunk-FOEBNCSD.js";import{x as W}from"./chunk-BALEFXOL.js";import"./chunk-J4R6QXW7.js";import{b}from"./chunk-2IUXH534.js";import{e as G}from"./chunk-S4KF5Z3S.js";import{a as j,b as y,d as L}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";import{createHash as le}from"node:crypto";import{readFileSync as pe,statSync as de,writeFileSync as ue}from"node:fs";import{normalize as me}from"node:path";var ne={off:0,exception:1,all:2},se="plugintracelogid,createdon,typename,messagename,primaryentity,mode,operationtype,depth,correlationid,requestid,pluginstepid,performanceexecutionduration,exceptiondetails,messageblock",ge="executecount,failurecount,failurepercent,crashcount,crashpercent,averageexecutetimeinmilliseconds,crashcontributionpercent,terminatecpucontributionpercent,terminatememorycontributionpercent,terminatehandlescontributionpercent,terminateothercontributionpercent,modifiedon",ee="\u2026",H=()=>Z(`odata.include-annotations="${Y}"`);function U(e){return e.includes("*")?e:`*${e}*`}var fe=new RegExp("\\r\\n|[\\n\\r\\x0b\\x0c\\x1c\\x1d\\x1e"+[133,8232,8233].map(e=>String.fromCharCode(e)).join("")+"]");function ie(e){if(!e)return[];let n=e.split(fe);return n.length&&n[n.length-1]===""&&n.pop(),n}function ye(e,n=6,s=800){if(!e)return null;let i=ie(P(e)),c=i.slice(0,n),a=c.join(`
|
|
3
3
|
`),l=[...a];return l.length>s?a=l.slice(0,s-1).join("")+ee:c.length<i.length&&(a+=`
|
|
4
4
|
`+ee),a}var he=/^(?:[\w.]+(?:`\d+)?(?:\[[\w.]+\])?:\s*)+/;function we(e){let n=ie(e||"").map(i=>P(i)).filter(i=>i);if(!n.length)return null;let s=n[0];return[...s.replace(he,"")||s].slice(0,500).join("")}function be(e){if(!e)return[null,null];let n=e.split(",").map(a=>P(a)),s=n.slice(2).find(a=>a.startsWith("Version=")),i=s===void 0?null:s.slice(s.indexOf("=")+1),c=[n.length>1?n[1]:null,i].filter(a=>!!a).join(" ")||null;return[n[0],c]}function oe(e,n=!1){let[s,i]=be(t(e,"typename")),c={id:t(e,"plugintracelogid"),when:t(e,"createdon"),type:s,assembly:i,message:t(e,"messagename"),table:t(e,"primaryentity"),mode:k(t(e,`mode${N}`),t(e,"mode")),kind:k(t(e,`operationtype${N}`),t(e,"operationtype")),depth:t(e,"depth"),duration_ms:t(e,"performanceexecutionduration"),correlation_id:t(e,"correlationid"),request_id:t(e,"requestid"),step_id:t(e,"pluginstepid"),error:we(t(e,"exceptiondetails"))};return n?(c.exception=k(t(e,"exceptiondetails"),null),c.trace=k(t(e,"messageblock"),null)):c.trace=ye(t(e,"messageblock")),J(c)}async function Me(e){let n=e.args,s=await f(e),i=[],c=d(n.type);c&&i.push(E("typename",U(c)));let a=d(n.message);a&&i.push(`messagename eq ${w(a)}`);let l=d(n.table);l&&i.push(`primaryentity eq ${w(l)}`);let o=d(n.correlation);if(o){if(!v(o))throw new y("--correlation expects a GUID");i.push(`correlationid eq ${_(o)}`)}n.state==="failed"&&i.push("exceptiondetails ne null and exceptiondetails ne ''");let p=d(n.since);p&&i.push(`createdon ge ${W(p)}`);let r=[["$select",se],["$orderby","createdon desc"]];i.length&&r.push(["$filter",i.join(" and ")]),b(e,s,"GET","plugintracelogs",null);let[u]=await B(e,s,"plugintracelogs",r,H(),S(n),"trace logs");u.length||await V(e,s)==="off"&&G("no trace logs: plugin tracing is off (ppdo-cli dv plugin tracing set exception|all turns it on)"),await e.emit(u.map(g=>oe(g)))}async function ze(e){let n=await f(e),s=String(e.args.id);if(!v(s))throw new y(`'${s}' is not a trace log id`);let i=q(await R(e,n,"GET",`plugintracelogs(${_(s)})`,{params:[["$select",se]],headers:H()}));await e.emit(oe(i,!0))}async function ae(e,n){let s=C(q(await R(e,n,"GET","organizations",{params:[["$select","organizationid,plugintracelogsetting"]]})).value);return s.length?s[0]:{}}async function V(e,n){let s=t(await ae(e,n),"plugintracelogsetting");return Object.entries(ne).find(([,i])=>i===s)?.[0]??null}async function De(e){let n=await f(e);await e.emit({tracing:await V(e,n)})}async function He(e){let n=await f(e),s=A({plugintracelogsetting:ne[String(e.args.level)]});b(e,n,"PATCH","organizations",s);let i=await n.lookups(async()=>t(await ae(e,n),"organizationid"));await R(e,n,"PATCH",`organizations(${i??"None"})`,{body:s}),await e.emit({tracing:await V(e,n)})}async function Ue(e){let n=e.args,s=await f(e),i=[["$select",ge],["$expand","plugintypeid($select=typename,assemblyname)"],["$orderby","failurecount desc"]],c=d(n.type);c&&i.push(["$filter",E("plugintypeid/typename",U(c))]),b(e,s,"GET","plugintypestatistics",null);let[a]=await B(e,s,"plugintypestatistics",i,null,S(n),"plugin types"),l=a.map(o=>{let p=T(t(o,"plugintypeid"));return x({type:t(p,"typename"),assembly:t(p,"assemblyname"),executions:t(o,"executecount"),failures:t(o,"failurecount"),failure_percent:t(o,"failurepercent"),crashes:t(o,"crashcount"),crash_percent:t(o,"crashpercent"),average_ms:t(o,"averageexecutetimeinmilliseconds"),crash_contribution_percent:t(o,"crashcontributionpercent"),terminate_cpu_percent:t(o,"terminatecpucontributionpercent"),terminate_memory_percent:t(o,"terminatememorycontributionpercent"),terminate_handles_percent:t(o,"terminatehandlescontributionpercent"),terminate_other_percent:t(o,"terminateothercontributionpercent"),updated:t(o,"modifiedon")})});a.length||G("no plugin statistics: Dataverse fills them in some time after plugins run, and some environments have none (ppdo-cli dv plugin trace list shows recent runs when tracing is on)"),await e.emit(l)}var $e=91,ke=92,xe=new Map([[10,"pre-validation"],[20,"pre-operation"],[30,"main"],[40,"post-operation"],[45,"post-operation (deprecated)"]]),z={statecode:0,statuscode:1},D={statecode:1,statuscode:2},Re="name,stage,mode,rank,statecode,filteringattributes,ismanaged,description,modifiedon",ve="plugintypeid($select=typename,assemblyname),sdkmessageid($select=name),sdkmessagefilterid($select=primaryobjecttypecode)",_e=new Map([[1,"none"],[2,"sandbox"]]),Ee=new Map([[0,"database"],[1,"disk"],[2,"normal"],[3,"azure-webapp"],[4,"file-store"]]);async function Ve(e){let n=e.args,s=await f(e);b(e,s,"GET","pluginassemblies",null);let i=d(n.solution),c=i?await M(e,s,I(i),$e):null,a=n.hidden?[]:["ishidden/Value eq false"],l=d(n.name);l&&a.push(E("name",l));let o=[["$select","name,version,culture,publickeytoken,isolationmode,sourcetype,ismanaged,modifiedon"],["$expand","pluginassembly_plugintype($select=plugintypeid)"],["$orderby","name"]];a.length&&o.push(["$filter",a.join(" and ")]);let p=await F(e,s,"pluginassemblies","pluginassemblyid",c,o,null,S(n),"assemblies",r=>String(t(r,"name")||"").toLowerCase());await e.emit(p.map(r=>x({name:t(r,"name"),version:t(r,"version"),types:C(t(r,"pluginassembly_plugintype")).length,isolation:_e.get(t(r,"isolationmode"))??t(r,"isolationmode"),source:Ee.get(t(r,"sourcetype"))??t(r,"sourcetype"),public_key_token:t(r,"publickeytoken"),managed:t(r,"ismanaged"),modified:t(r,"modifiedon"),id:t(r,"pluginassemblyid")})))}function te(e){return le("sha256").update(e).digest("hex")}function Te(e){try{return de(e).isFile()}catch{return!1}}async function Xe(e){let n=e.args,s=await f(e),i=String(n.assembly),c=v(i)?`pluginassemblyid eq ${_(i)}`:`name eq ${w(i)}`,a=C(q(await R(e,s,"GET","pluginassemblies",{params:[["$select","name,version,culture,publickeytoken,sourcetype,ismanaged,modifiedon,_packageid_value,content"],["$filter",c]]})).value);if(!a.length)throw new L(`no plugin assembly '${i}'`,{service:"dataverse",hint:"run: ppdo-cli dv plugin assembly list --name <pattern>"});if(a.length>1)throw new y(`${a.length} assemblies are named '${i}'`,{hint:"pass one of their ids: "+a.map(g=>g.pluginassemblyid).join(", ")});let l=a[0],o=O(t(l,"content"))?Buffer.from(String(l.content),"base64"):null,p={name:t(l,"name"),version:t(l,"version"),culture:t(l,"culture"),public_key_token:t(l,"publickeytoken"),managed:t(l,"ismanaged"),modified:t(l,"modifiedon"),package:t(l,"_packageid_value"),id:t(l,"pluginassemblyid")},r=d(n.save),u=d(n.compare);if(o===null){if(r||u)throw new y(`${t(l,"name")??"None"} has no content of its own`+(O(t(l,"_packageid_value"))?" (it's in a plugin package)":""))}else p.size=o.length,p.sha256=te(o);if(r&&(ue(r,o),p.saved=r),u){if(!Te(u))throw new y(`not a file: ${u}`);let g=pe(u);p.compare={file:me(u),size:g.length,sha256:te(g)},p.match=o!==null&&g.equals(o)}await e.emit(x(p))}function re(e){let n=T(t(e,"plugintypeid"));return x({name:t(e,"name"),state:t(e,"statecode")===0?"on":"off",message:t(T(t(e,"sdkmessageid")),"name"),table:t(T(t(e,"sdkmessagefilterid")),"primaryobjecttypecode"),stage:xe.get(t(e,"stage"))??t(e,"stage"),mode:{0:"sync",1:"async"}[String(t(e,"mode"))]??t(e,"mode"),rank:t(e,"rank"),filtering_attributes:k(t(e,"filteringattributes"),null),type:t(n,"typename"),assembly:t(n,"assemblyname"),managed:t(e,"ismanaged"),id:t(e,"sdkmessageprocessingstepid")})}async function X(e,n,s,i=null,c=null){let a=d(s.solution),l=a?await M(e,n,I(a),ke):null,o=s.hidden?[]:["ishidden/Value eq false"],p=d(s.assembly);p&&o.push(`plugintypeid/assemblyname eq ${w(p)}`);let r=d(s.type);r&&o.push(E("plugintypeid/typename",U(r)));let u=d(s.message);u&&o.push(`sdkmessageid/name eq ${w(u)}`);let g=d(s.table);g&&o.push(`sdkmessagefilterid/primaryobjecttypecode eq ${w(g)}`);let h=d(s.state);h&&o.push(`statecode eq ${h==="on"?0:1}`),o.push(...i??[]);let m=[["$select",Re],["$expand",ve],["$orderby","name"]];return o.length&&m.push(["$filter",o.join(" and ")]),F(e,n,"sdkmessageprocessingsteps","sdkmessageprocessingstepid",l,m,H(),c,"steps",$=>String(t($,"name")||"").toLowerCase())}async function Ke(e){let n=await f(e);b(e,n,"GET","sdkmessageprocessingsteps",null),await e.emit((await X(e,n,e.args,null,S(e.args))).map(re))}async function Se(e,n,s){let i=v(s)?`sdkmessageprocessingstepid eq ${_(s)}`:`name eq ${w(s)}`,c=await X(e,n,{hidden:!0},[i]);if(!c.length)throw new L(`no plugin step '${s}'`,{service:"dataverse",hint:"run: ppdo-cli dv plugin step list --assembly <name>"});if(c.length>1)throw new y(`${c.length} steps are named '${s}'; use an id`,{hint:"ids: "+c.map(a=>a.sdkmessageprocessingstepid).join(", ")});return c[0]}async function ce(e,n){let s=e.args,i=s.step??[],c=d(s.assembly);if(!i.length&&!c)throw new y("name the steps to change, or pass --assembly");let a=await f(e),l=A(n?z:D);b(e,a,"PATCH","sdkmessageprocessingsteps",l);let o=await a.lookups(async()=>{let m=new Map;for(let $ of i){let K=await Se(e,a,$);m.set(K.sdkmessageprocessingstepid,K)}if(c)for(let $ of await X(e,a,{assembly:c}))m.set($.sdkmessageprocessingstepid,$);return m});if(c&&!i.length&&!o.size)throw new y(`assembly '${c}' has no (non-hidden) steps`,{hint:"run: ppdo-cli dv plugin assembly list --name '*<part of the name>*'"});let p=Q(o.values(),m=>String(t(m,"name")||"").toLowerCase()),r=p.filter(m=>t(m,"statecode")===0!==n);if(e.dryRun){await e.emit({dry_run:!0,requests:r.map(m=>({method:"PATCH",path:`sdkmessageprocessingsteps(${m.sdkmessageprocessingstepid})`,body:n?z:D,name:t(m,"name")})),unchanged:p.filter(m=>!r.includes(m)).map(m=>t(m,"name"))});return}let[u,g]=await Pe(e,a,p,n);await e.emit(u);let h=Object.keys(g).length;if(h)throw new j(`${h} of ${r.length} steps could not be turned ${n?"on":"off"}`,{service:"dataverse"})}async function Pe(e,n,s,i){let c=A(i?z:D),a=s.filter(p=>t(p,"statecode")===0!==i),l={};for(let p of a)try{await R(e,n,"PATCH",`sdkmessageprocessingsteps(${p.sdkmessageprocessingstepid})`,{body:c,headers:{"If-Match":"*"}})}catch(r){if(!(r instanceof j)||r.exitCode===0)throw r;l[p.sdkmessageprocessingstepid]=r.message}let o=[];for(let p of s){let r=p.sdkmessageprocessingstepid,u=a.includes(p)&&!(r in l),g=re(p),h={name:t(g,"name"),state:u?i?"on":"off":g.state,changed:u,type:t(g,"type"),id:r};r in l&&(h.error=l[r]),o.push(x(h))}return[o,l]}function We(e){return ce(e,!0)}function Ye(e){return ce(e,!1)}export{$e as ASSEMBLY_COMPONENT,xe as STAGES,ke as STEP_COMPONENT,ne as TRACING,Pe as applyState,Xe as assemblyGet,Ve as assemblyList,we as errorSummary,ye as firstLines,oe as shapeTrace,be as splitType,ie as splitlines,Ue as stats,Ye as stepDisable,We as stepEnable,Ke as stepList,X as stepRows,ze as traceGet,Me as traceList,De as tracingGet,He as tracingSet};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{B as j,F as $,G as D,I as B,L as C,d as f,e as g,f as o,g as a,h,i as v,j as A,k as b,m as N,u as J,w as x,z as w}from"./chunk-
|
|
2
|
+
import{B as j,F as $,G as D,I as B,L as C,d as f,e as g,f as o,g as a,h,i as v,j as A,k as b,m as N,u as J,w as x,z as w}from"./chunk-46KBBWEH.js";import"./chunk-BALEFXOL.js";import{d as S,e as q}from"./chunk-6NBCHK6X.js";import"./chunk-MTF66YXU.js";import"./chunk-GY6BUIDP.js";import"./chunk-J4R6QXW7.js";import{b as k}from"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var _="7.1-preview.1",P=["queued","running","rejected","broken"],L={rejected:0,broken:0,running:1,queued:1,approved:2,notApplicable:3};function M(t){let s=v(o(t,"refName")),e=(v(g(t.matchKind??null,""))??"").toLowerCase();if(e==="defaultbranch")return"(default branch)";if(!s)return null;let r=s.startsWith("refs/heads/")?s.slice(11):s;return e==="prefix"?`${r}*`:r}async function E(t,s,e){let r=e.map(i=>a(i.settings)),c=[...new Set(r.filter(i=>f(i.buildDefinitionId)).map(i=>b(i.buildDefinitionId)))].sort(),u=[...new Set(r.flatMap(i=>h(i.requiredReviewerIds).map(l=>String(l))))].sort(),p=new Map;if(c.length){let i=await j(t,s,`${w(s)}/_apis/build/definitions`,[["definitionIds",c.join(",")]]);for(let l of $(i))p.set(`build:${b(o(l,"id"))}`,o(l,"name"))}if(u.length)for(let i of await B(t,s,[["identityIds",u.join(",")]])){let l=Object.fromEntries(Object.entries(a(i.properties)).map(([y,n])=>[y,o(a(n),"$value")]));p.set(`person:${b(o(i,"id"))}`,g(l.Account??null,i.providerDisplayName??null))}return p}function O(t,s){let e=Object.fromEntries(Object.entries(a(t)).filter(([r])=>r!=="scope"));if("buildDefinitionId"in e&&(e.pipeline=s.get(`build:${b(e.buildDefinitionId)}`)??null),"requiredReviewerIds"in e){let r=h(e.requiredReviewerIds);delete e.requiredReviewerIds,e.reviewers=r.map(c=>g(s.get(`person:${b(c)}`)??null,c))}return e}function T(t,s){let e=h(a(t.settings).scope),r=e.map(M).filter(c=>!!c);return A({id:o(t,"id"),type:o(a(t.type),"displayName"),required:f(t.isBlocking),enabled:f(t.isEnabled),branches:r.length?r:null,all_repos:e.some(c=>o(c,"repositoryId")===null)?!0:null,settings:O(t.settings,s)})}async function V(t){let s=t.args,e=await J(t),r=await D(t,e,String(s.repo)),c=typeof s.branch=="string"&&s.branch?s.branch:null,u,p;c?(u=`${w(e)}/_apis/git/policy/configurations`,p=[["repositoryId",r],["refName",C(c)]]):(u=`${w(e)}/_apis/policy/configurations`,p=[]),k(t,e,"GET",u,null);let i=[];for await(let n of e.paginate(u,{params:p,nextLink:S,items:q}))f(o(n,"isDeleted"))||i.push(a(n));c||(i=i.filter(n=>{let d=h(a(n.settings).scope);return(d.length?d:[{}]).some(m=>{let I=o(m,"repositoryId");return I===null||I===r})}));let l=await E(t,e,i),y=i.map(n=>T(n,l));await t.emit(N(y,n=>[!n.enabled,!n.required,v(g(n.type??null,"")),g(n.id??null,0)??0]))}async function z(t){let s=t.args,e=await J(t),r=x(s.pr,"pr",e),c=await j(t,e,`${w(e)}/_apis/git/pullrequests/${r}`),u=o(a(o(a(c.repository),"project")),"id"),p=[["artifactId",`vstfs:///CodeReview/CodeReviewId/${b(u)}/${r}`],["api-version",_]];s.notApplicable&&p.push(["includeNotApplicable","true"]);let i=$(await j(t,e,`${w(e)}/_apis/policy/evaluations`,p)),l=await E(t,e,i.map(n=>a(n.configuration))),y=[];for(let n of i){let d=a(n.configuration),m=a(n.context),I=o(n,"status"),R={policy:o(d,"id"),type:o(a(d.type),"displayName"),required:f(d.isBlocking),status:I,blocks:f(d.isBlocking)&&P.includes(String(I))};f(m.buildId)&&(R.run={id:m.buildId,pipeline:o(m,"buildDefinitionName"),expired:o(m,"isExpired"),outdated:o(m,"buildIsNotCurrent")}),R.settings=O(d.settings,l),y.push(R)}await t.emit(N(y,n=>[!n.blocks,L[String(n.status)]??9,g(n.policy??null,0)??0]))}export{_ as EVALUATIONS_API,M as branch,T as policyRow,z as prChecks,V as repoPolicies,O as settingsOf};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{B as h,F as _,d as N,e as f,f as i,g as k,i as y,j as R,k as w,l as B,m as j,n as H,o as v,s as M,u as x}from"./chunk-
|
|
2
|
+
import{B as h,F as _,d as N,e as f,f as i,g as k,i as y,j as R,k as w,l as B,m as j,n as H,o as v,s as M,u as x}from"./chunk-46KBBWEH.js";import{x as L}from"./chunk-BALEFXOL.js";import"./chunk-6NBCHK6X.js";import"./chunk-MTF66YXU.js";import"./chunk-GY6BUIDP.js";import"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import{e as T}from"./chunk-S4KF5Z3S.js";import{d as D}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var Z=/^(\d{4})-(\d{2})-(\d{2})[T ](\d{2}):(\d{2})(?::(\d{2})(?:[.,](\d+))?)?(Z|[+-]\d{2}:?\d{2})?$/i;function S(e){if(typeof e!="string"||!e)return null;let t=Z.exec(e.trim());if(!t)return null;let[,n,s,r,o,a,u="0",l="",g="Z"]=t,m=Date.UTC(Number(n),Number(s)-1,Number(r),Number(o),Number(a),Number(u)),c=new Date(m);if(c.getUTCMonth()!==Number(s)-1||c.getUTCDate()!==Number(r))return null;let p=0;if(g.toUpperCase()!=="Z"){let d=g.slice(1).replace(":","");p=(g.startsWith("-")?-1:1)*(Number(d.slice(0,2))*60+Number(d.slice(2,4)))*6e4}return(m-p)*1e3+Number((l+"000000").slice(0,6))}function G(e){return(e%1e6+1e6)%1e6}async function U(e,t,n){if(B(n))return h(e,t,`_apis/distributedtask/pools/${n}`);let s=_(await h(e,t,"_apis/distributedtask/pools",[["poolName",n]])).find(r=>(y(f(r.name??null,""))??"").toLowerCase()===n.toLowerCase());if(!s)throw new D(`no agent pool '${n}'`,{service:"devops",hint:"run: ppdo-cli ado pool list"});return s}async function I(e){let t=e.args,n=await x(e),s=typeof t.name=="string"&&t.name?t.name:null,r=[];for(let o of _(await h(e,n,"_apis/distributedtask/pools",s?[["poolName",s]]:null)))N(o.isLegacy)&&!t.legacy||r.push(R({id:i(o,"id"),name:i(o,"name"),hosted:i(o,"isHosted"),type:i(o,"poolType"),agents:i(o,"size"),legacy:f(o.isLegacy??null,null),auto_provision:i(o,"autoProvision")}));await e.emit(M(j(r,o=>(y(f(o.name??null,""))??"").toLowerCase()),t,"pools"))}async function K(e){let t=e.args,n=await x(e),s=await U(e,n,String(t.pool)),r=_(await h(e,n,`_apis/distributedtask/pools/${w(s.id)}/agents`,[["includeAssignedRequest","true"]])),o=typeof t.status=="string"&&t.status?t.status:null,a=[];for(let u of r){let l=k(u.assignedRequest);o&&u.status!==o||a.push(R({name:i(u,"name"),status:i(u,"status"),enabled:i(u,"enabled"),busy:N(l)||null,running:i(k(l.definition),"name"),version:i(u,"version"),os:i(u,"osDescription"),provisioning:i(u,"provisioningState"),id:i(u,"id")}))}await e.emit({pool:i(s,"name"),hosted:i(s,"isHosted"),agents:a})}function J(e,t){if(!e.length)return null;let n=[...e].sort((s,r)=>s-r);return v(n[Math.min(n.length-1,H(t*(n.length-1)))])}var q=e=>e.reduce((t,n)=>t+n,0);function z(e,t){let n=[],s=[],r=[],o=0,a=new Map,u={};for(let c of e){let p=S(c.queueTime),d=S(c.assignTime),C=S(c.finishTime);if(d===null){o++;continue}if(p!==null&&n.push((d-p)/1e6),C!==null){let b=(C-d)/1e6;s.push(b),r.push([d,1],[C,-1]);let P=w(f(i(k(c.definition),"name"),"?")),$=a.get(P);$?$.push(b):a.set(P,[b])}if(N(c.result)){let b=w(c.result);u[b]=(u[b]??0)+1}}let l=0,g=0;for(let[,c]of[...r].sort((p,d)=>p[0]-d[0]||p[1]-d[1]))g+=c,l=Math.max(l,g);let m=j([...a],([,c])=>-q(c)).slice(0,t);return{jobs:e.length,waiting_now:o,results:Object.keys(u).length?u:null,wait_seconds:{average:n.length?v(q(n)/n.length):null,p50:J(n,.5),p95:J(n,.95),max:J(n,1)},run_seconds:{average:s.length?v(q(s)/s.length):null,max:J(s,1)},peak_concurrent:l,busiest:m.map(([c,p])=>({pipeline:c,jobs:p.length,minutes:v(q(p)/60)}))}}async function Q(e){let t=e.args,n=await x(e),s=await U(e,n,String(t.pool)),r=L(typeof t.since=="string"&&t.since?t.since:"7d"),o=typeof t.limit=="number"&&t.limit?t.limit:5e3,a=_(await h(e,n,`_apis/distributedtask/pools/${w(s.id)}/jobrequests`,[["completedRequestCount",String(o)]])),u=a.filter(m=>(y(f(m.queueTime??null,""))??"")>=r),l=a.map(m=>y(f(m.queueTime??null,""))??""),g=l.length?l.reduce((m,c)=>c<m?c:m):"";a.length&&g>r?T(`the pool's history only goes back to ${g.slice(0,19)}Z`):a.length>=o&&T(`read the newest ${o} job requests; pass --limit n for more`),await e.emit({pool:i(s,"name"),since:r,agents:i(s,"size"),...z(u,Number(t.top??5))})}export{K as agents,U as findPool,I as list,G as microsecond,z as summarise,Q as usage,S as when};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{c as Z,d as F,f as oo}from"./chunk-Q2RD4TRK.js";import"./chunk-ITP35SAY.js";import"./chunk-ZUXLC5VX.js";import{A as I,G as y,d as j,e as O,f as r,h as V,i as W,j as X,k as b,n as A,t as R,u as v,v as G,w as E,z as P}from"./chunk-BG2OIOSN.js";import"./chunk-UCTMKA2J.js";import{b as z,d as N,e as B,f as S,i as Q}from"./chunk-FOEBNCSD.js";import{x as Y}from"./chunk-BALEFXOL.js";import"./chunk-J4R6QXW7.js";import{b as $}from"./chunk-2IUXH534.js";import{e as M}from"./chunk-S4KF5Z3S.js";import{a as _,b as k,d as L,j as K}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var eo=29,q={workflow:0,dialog:1,"business-rule":2,action:3,bpf:4,flow:5},no=new Map(Object.entries(q).map(([o,t])=>[t,o])),H={statecode:1,statuscode:2},U={statecode:0,statuscode:1},so="name,category,statecode,primaryentity,ismanaged,modifiedon,workflowid",lo=/\/flows\/([0-9a-fA-F-]{36})/;function uo(o){if(!o)return null;let t=[];for(let e of o.split(",").filter(n=>S(n)).map(n=>S(n).toLowerCase())){if(!(e in q))throw new k(`unknown category '${e}'`,{hint:"use "+Object.keys(q).filter(n=>n!=="dialog").join(", ")});t.push(q[e])}return t}function ro(o){let t=["type eq 1"],e=uo(y(o.category));return e&&e.length&&t.push("("+e.map(n=>`category eq ${n}`).join(" or ")+")"),t}function io(o){return no.get(o)??o??null}function fo(o){let t=r(o,"primaryentity");return W({name:r(o,"name"),category:io(r(o,"category")),state:r(o,"statecode")===1?"on":"off",table:t===null||t==="none"?null:t,managed:r(o,"ismanaged"),modified:r(o,"modifiedon"),id:r(o,"workflowid")})}async function ao(o,t,e,n=null,a=null){let i=y(e.solution),l=i?await oo(o,t,F(i),eo):null,c=[...ro(e),...n??[]],w=[["$select",so],["$filter",c.join(" and ")],["$orderby","name"]];return I(o,t,"workflows","workflowid",l,w,null,a,"processes",s=>[String(r(s,"name")||"").toLowerCase(),r(s,"workflowid")])}async function So(o){let t=o.args,e=await R(o);$(o,e,"GET","workflows",null);let n=[],a=y(t.state);a&&n.push(`statecode eq ${a==="on"?1:0}`);let i=y(t.name);i&&n.push(Q("name",i)),await o.emit((await ao(o,e,t,n,A(t))).map(fo))}async function jo(o){let t=o.args,e=await R(o);$(o,e,"GET","workflows",null);let n=y(t.solution),a=new Map;if(n)for(let f of F(n))a.set((await Z(o,e,f)).solutionid,f);else{let[f]=await P(o,e,"solutions",[["$select","solutionid,uniquename"]],null,null);for(let d of f)["Default","Active"].includes(r(d,"uniquename"))||a.set(d.solutionid,d.uniquename)}let i=n?[...a.keys()].map(f=>`_solutionid_value eq ${f}`).join(" or "):null,l=`componenttype eq ${eo}`+(i?` and (${i})`:""),[c]=await P(o,e,"solutioncomponents",[["$select","objectid,_solutionid_value"],["$filter",l]],null,null),w=new Map;for(let f of c){let d=r(f,"_solutionid_value");a.has(d)&&(w.has(d)||w.set(d,new Set),w.get(d).add(f.objectid))}let s=b(new Set([...w.values()].flatMap(f=>[...f])),f=>f),u=new Map;if(s.length){let f=await I(o,e,"workflows","workflowid",s,[["$select","name,category,statecode,workflowid"],["$filter",ro(t).join(" and ")]],null,null);for(let d of f)u.set(d.workflowid,d)}let m=[];for(let[f,d]of a){let h=[...w.get(f)??[]].filter(p=>u.has(p)).map(p=>u.get(p));if(!h.length&&!n)continue;let C=new Map;for(let p of h){let T=r(p,"category"),J=no.get(T)??String(T===null?"None":T);C.set(J,(C.get(J)??0)+1)}let x=b(h.filter(p=>r(p,"statecode")!==1).map(p=>j(r(p,"name"))?p.name:p.workflowid),p=>p.toLowerCase());m.push({solution:d,total:h.length,on:h.length-x.length,off:x.length,by_category:Object.fromEntries(b(C.entries(),([p])=>p)),off_names:x})}m=b(m,f=>String(f.solution).toLowerCase());let g=A(t);g!==null&&m.length>g&&(M(`showing the first ${g} solutions; pass --limit n or --all for more`),m=m.slice(0,g)),await o.emit(m)}async function D(o,t,e,n=!1){let a=lo.exec(e),i=a?a[1]:S(e),l;z(i)?l=`(workflowid eq ${N(i)} or resourceid eq ${N(i)})`:l=`name eq ${B(i)}`,l+=" and type eq 1"+(n?" and category eq 5":"");let c=V(G(await v(o,t,"GET","workflows",{params:[["$select",so],["$filter",l]]})).value),w=n?"cloud flow":"process";if(!c.length)throw new L(`no ${w} '${e}'`,{service:"dataverse",hint:"run: ppdo-cli dv workflow list --name '*<part of the name>*'"});if(c.length>1)throw new k(`${c.length} processes are named '${e}'; use an id`,{hint:"ids: "+c.map(s=>s.workflowid).join(", ")});return c[0]}async function wo(o,t,e){let n=e.process??[];if(!n.length&&!y(e.solution))throw new k("name the processes to change, or pass --solution");let a=new Map;for(let i of n){let l=await D(o,t,i);a.set(l.workflowid,l)}if(y(e.solution))for(let i of await ao(o,t,e))a.set(i.workflowid,i);return[...a.values()]}async function co(o,t){let e=o.args,n=await R(o),a=E(t?H:U);$(o,n,"PATCH","workflows",a);let i=await n.lookups(()=>wo(o,n,e)),l=i.filter(u=>r(u,"statecode")===1!==t);if(o.dryRun){await o.emit({dry_run:!0,requests:l.map(u=>({method:"PATCH",path:`workflows(${u.workflowid})`,body:t?H:U,name:r(u,"name")})),unchanged:i.filter(u=>!l.includes(u)).map(u=>r(u,"name"))});return}let[c,w]=await mo(o,n,i,t);await o.emit(c);let s=Object.keys(w).length;if(s)throw new _(`${s} of ${l.length} processes could not be turned ${t?"on":"off"}`,{service:"dataverse"})}async function mo(o,t,e,n,a=null){let i=E(n?H:U),l=e.filter(s=>r(s,"statecode")===1!==n),c={};for(let s=0;s<2;s++){let u=s===0?l:l.filter(m=>m.workflowid in c);for(let m of u){let g={"If-Match":"*"},f=(a??{})[String(m.workflowid).toLowerCase()];f&&(g.MSCRMCallerID=f);try{await v(o,t,"PATCH",`workflows(${m.workflowid})`,{body:i,headers:g}),delete c[m.workflowid]}catch(d){if(!(d instanceof _)||d.exitCode===0)throw d;c[m.workflowid]=d.message}}}let w=[];for(let s of b(e,u=>String(r(u,"name")||"").toLowerCase())){let u=l.includes(s)&&!(s.workflowid in c),m=u?n?"on":"off":r(s,"statecode")===1?"on":"off",g={name:r(s,"name"),category:io(r(s,"category")),state:m,changed:u,id:s.workflowid};s.workflowid in c&&(g.error=c[s.workflowid]),w.push(g)}return[w,c]}function Ao(o){return co(o,!0)}function Eo(o){return co(o,!1)}async function Po(o){let t=o.args,e=await R(o);$(o,e,"GET","flowruns",null);let a=[`_workflow_value eq ${(await D(o,e,String(t.flow),!0)).workflowid}`],i=y(t.state);i&&a.push(`status eq ${B(i.charAt(0).toUpperCase()+i.slice(1).toLowerCase())}`);let l=y(t.since);l&&a.push(`starttime ge ${Y(l)}`);let c=[["$select","name,status,starttime,endtime,duration,triggertype,errorcode,errormessage"],["$filter",a.join(" and ")],["$orderby","starttime desc"]],[w]=await P(o,e,"flowruns",c,null,A(t),"runs");await o.emit(w.map(s=>X({run:r(s,"name"),status:r(s,"status"),started:r(s,"starttime"),ended:r(s,"endtime"),duration_ms:r(s,"duration"),trigger:r(s,"triggertype"),error_code:r(s,"errorcode"),error:po(r(s,"errormessage"))})))}function po(o){if(!o)return null;try{let t=JSON.parse(o);return!j(t)||typeof t!="object"||Array.isArray(t)?o:O(r(t,"message"),o)}catch{return o}}function to(o){return o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function go(o,t,e){let n=c=>new RegExp('"'+to(c)+'"\\s*:',"i").test(o);if(n(t)&&n(e))throw new k(`the flow already has a ${e} entry; swapping would duplicate it`);let a=0,i=K(e);return[o.replace(new RegExp('"'+to(t)+'"',"gi"),()=>(a++,i)),a]}async function qo(o){let t=o.args,e=await R(o);$(o,e,"PATCH","workflows",Buffer.from("{}"));let{find:n,shape:a}=await import("./connref-IT6K56UT.js"),[i,l,c,w]=await e.lookups(async()=>{let f=await D(o,e,String(t.flow),!0),d=await n(o,e,String(t.from)),h=await n(o,e,String(t.to)),C=G(await v(o,e,"GET",`workflows(${f.workflowid})`,{params:[["$select","clientdata"]]}));return[f,d,h,String(O(r(C,"clientdata"),""))]}),s=l.connectionreferencelogicalname,u=c.connectionreferencelogicalname;if(a(l).connector!==a(c).connector)throw new k(`${s} is for ${a(l).connector??"None"} but ${u} is for ${a(c).connector??"None"}; both must use the same connector`);let[m,g]=go(w,s,u);if(!g)throw new L(`flow '${r(i,"name")??"None"}' does not use ${s}`,{service:"dataverse"});await v(o,e,"PATCH",`workflows(${i.workflowid})`,{body:E({clientdata:m}),headers:{"If-Match":"*"}}),j(r(c,"connectionid"))||M(`${u} has no connection, so the flow's runs will fail until it has one (ppdo-cli dv connref set ${u} --connection <id>)`),await o.emit({flow:r(i,"name"),id:i.workflowid,from:s,to:u,replacements:g,state:r(i,"statecode")===1?"on":"off"})}export{q as CATEGORIES,eo as COMPONENT_TYPE,no as LABELS,mo as applyState,Eo as disable,Ao as enable,D as findProcess,So as list,go as replaceName,ao as rows,po as runError,Po as runs,fo as shape,jo as summary,qo as swap};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{A as z,B as w,F as k,K as O,M as q,N as G,O as N,Q as A,a as B,b as V,d as b,e as $,f as n,g as d,h as _,i as C,j as E,k as L,l as U,m as R,r as W,s as J,u as y,z as v}from"./chunk-
|
|
2
|
+
import{A as z,B as w,F as k,K as O,M as q,N as G,O as N,Q as A,a as B,b as V,d as b,e as $,f as n,g as d,h as _,i as C,j as E,k as L,l as U,m as R,r as W,s as J,u as y,z as v}from"./chunk-46KBBWEH.js";import{x as D}from"./chunk-BALEFXOL.js";import{d as x,e as F}from"./chunk-6NBCHK6X.js";import"./chunk-MTF66YXU.js";import"./chunk-GY6BUIDP.js";import{a as S}from"./chunk-J4R6QXW7.js";import{b as T}from"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import{b as I}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";import{writeFileSync as K}from"node:fs";async function ct(t){let e=await y(t);T(t,e,"GET","_apis/projects",null);let s=[];for await(let r of e.paginate("_apis/projects",{nextLink:x,items:F})){let o=d(r);s.push({name:n(o,"name"),id:n(o,"id"),visibility:n(o,"visibility"),state:n(o,"state"),updated:n(o,"lastUpdateTime")})}await t.emit(J(R(s,r=>C($(r.name,""))),t.args,"projects"))}function H(t){return{name:n(t,"name"),id:n(t,"id"),default_branch:O(t.defaultBranch),size:n(t,"size"),disabled:n(t,"isDisabled"),web_url:n(t,"webUrl")}}async function mt(t){let e=await y(t),s=await w(t,e,`${v(e)}/_apis/git/repositories`),r=R(k(s).map(H),o=>C($(o.name,"")));await t.emit(J(r,t.args,"repositories"))}async function pt(t){let e=await y(t);await t.emit(H(await w(t,e,`${v(e)}/_apis/git/repositories/${S(String(t.args.name))}`)))}function P(t){return"/"+q(t).replace(/\\/g,"/").replace(/^\/+/,"")}function M(t){if(/^[0-9a-fA-F]{40}$/.test(t))return[t,"commit"];if(/^[0-9a-fA-F]{7,39}$/.test(t))throw new I(`'${t}' is a short SHA; Azure DevOps needs all 40 characters`,{hint:"use git rev-parse <sha>"});return t.startsWith("refs/tags/")?[t.slice(10),"tag"]:[t.startsWith("refs/heads/")?t.slice(11):t,"branch"]}function j(t,e="versionDescriptor."){if(!t)return[];let[s,r]=M(t);return[[`${e}version`,s],[`${e}versionType`,r]]}function g(t){return typeof t=="string"&&t?t:null}async function lt(t){let e=t.args,s=await y(t),r=String(e.repo),o=P(String(e.path)),u=g(e.ref),a=`${v(s)}/_apis/git/repositories/${S(r)}`,p=await w(t,s,`${a}/items`,[["path",o],...j(u)]);if(b(p.isFolder))throw new I(`${o} is a folder`,{hint:`run: ppdo-cli ado repo tree ${r} ${o.replace(/^\/+/,"")}`});let f=(await z(t,s,"GET",`${a}/blobs/${L(p.objectId)}`,{params:[["$format","octetStream"]],headers:{Accept:"application/octet-stream"}})).body,c={repo:r,path:$(p.path,o),ref:e.ref??null,commit:n(p,"commitId"),bytes:f.length},l=g(e.save);if(l){K(l,f),await t.emit({...c,saved:l});return}let i=G(f);if(i===null)throw new I(`${o} is binary`,{hint:"pass --save <file>"});await t.format()==="json"?await t.emit({...c,content:i}):await A(i.endsWith(`
|
|
3
3
|
`)||!i?i:i+`
|
|
4
4
|
`)}async function ut(t){let e=t.args,s=await y(t),r=P(String(e.path??"/")),o=await w(t,s,`${v(s)}/_apis/git/repositories/${S(String(e.repo))}/items`,[["scopePath",r],["recursionLevel",e.oneLevel?"OneLevel":"Full"],...j(g(e.ref))]),u=k(o).filter(a=>!(b(a.isFolder)&&a.path===r)).map(a=>({path:n(a,"path"),type:b(a.isFolder)?"folder":"file"}));await t.emit(J(u,e,"items"))}function X(t){return typeof t=="string"&&t.trim()?B(t.trim())[0]??"":t??null}async function ft(t){let e=t.args,s=await y(t),r=`${v(s)}/_apis/git/repositories/${S(String(e.repo))}`,o=O((await w(t,s,r)).defaultBranch);if(!o){await t.emit([]);return}let u=g(e.base),a=u?j(u,"baseVersionDescriptor."):[],p=String(e.name??"").split(",").map(c=>c.trim().toLowerCase()).filter(c=>c),f=[];for(let c of k(await w(t,s,`${r}/stats/branches`,a))){let l=C($(c.name,""))??"";if(p.length&&!p.some(h=>V(l.toLowerCase(),h)))continue;let i=d(c.commit),m={name:l,commit:n(i,"commitId"),author:n(d(i.author),"name"),updated:n(d(i.committer),"date"),message:X(i.comment),ahead:n(c,"aheadCount"),behind:n(c,"behindCount")};l===o&&(m.default=!0),f.push(m)}await t.emit(J(R(f,c=>C($(c.updated,"")),!0),e,"branches"))}async function ht(t){let e=t.args,s=await y(t),r=`${v(s)}/_apis/git/repositories/${S(String(e.repo))}`,o=g(e.ref);if(!o&&(o=g((await w(t,s,r)).defaultBranch),!o)){await t.emit([]);return}let u=g(e.notIn),a=u?[...j(u,"searchCriteria.itemVersion."),...j(o,"searchCriteria.compareVersion.")]:j(o,"searchCriteria.itemVersion.");g(e.path)&&a.push(["searchCriteria.itemPath",P(String(e.path))]),g(e.author)&&a.push(["searchCriteria.author",String(e.author)]);for(let[i,m,h]of[["fromDate","--since",e.since],["toDate","--until",e.until]])g(h)&&a.push([`searchCriteria.${i}`,D(String(h),m)]);let p=!!e.workItems;p&&a.push(["searchCriteria.includeWorkItems","true"]);let f=W(e),c=f?Math.min(f+1,1e3):1e3,l=[];for(;;){let i=k(await w(t,s,`${r}/commits`,[...a,["searchCriteria.$top",String(c)],["searchCriteria.$skip",String(l.length)]]));if(l.push(...i.map(m=>Y(m,p))),i.length<c||f!==null&&l.length>f)break}await t.emit(J(l,e,"commits"))}function Y(t,e){let s=d(t.author),r=d(t.committer),o=Object.entries(d(t.changeCounts)).filter(([,a])=>b(a)),u={commit:n(t,"commitId"),author:n(s,"name"),email:n(s,"email"),date:n(s,"date"),committed:n(r,"date")!==n(s,"date")?n(r,"date"):null,message:n(t,"comment"),truncated:$(t.commentTruncated??null,null),changes:o.length?Object.fromEntries(o.map(([a,p])=>[a.toLowerCase(),p])):null};return e&&(u.work_items=_(t.workItems).filter(a=>U(L(n(a,"id")??""))).map(a=>parseInt(String(n(a,"id")),10))),E(u)}async function gt(t){let e=t.args,s=await y(t),r=S(String(e.repo)),o=[];for(let[i,m]of[["base",String(e.base)],["target",String(e.target)]]){let[h,Q]=M(m);o.push([`${i}Version`,h],[`${i}VersionType`,Q])}e.mergeBase===!1&&o.push(["diffCommonCommit","false"]);let u=`${v(s)}/_apis/git/repositories/${r}/diffs/commits`,a=null,p=[];for(;;){let i=await w(t,s,u,[...o,["$top","1000"],["$skip",String(p.length)]]);a=a&&b(a)?a:i;let m=_(i.changes);if(p.push(...m),b(i.allChangesIncluded)||!m.length)break}let c=p.filter(i=>n(d(i.item),"gitObjectType")!=="tree").map(i=>{let m=d(i.item),h=$(i.originalPath??null,i.sourceServerItem??null);return{change:n(i,"changeType"),path:$(m.path??null,h),from:b(h)&&h!==n(m,"path")?h:null,old:n(m,"originalObjectId"),new:n(m,"objectId")}});if(g(e.file)){let i=P(String(e.file));c=c.filter(m=>m.path===i||m.from===i)}if(e.stat){await t.emit(c.map(i=>Object.fromEntries([["path",i.path],["change",i.change],["from",i.from]].filter(([,m])=>b(m)))));return}let l=await N(t,s,r,c,Number(e.unified??3));if(await t.format()==="json"){let i=a??{};await t.emit({base:e.base,target:e.target,merge_base:n(i,"commonCommit"),ahead:n(i,"aheadCount"),behind:n(i,"behindCount"),files:c.length,diff:l})}else await A(l)}export{ft as branches,Y as commitRow,ht as commits,M as descriptor,lt as file,ct as projects,pt as repo,gt as repoDiff,P as repoPath,H as repoRow,mt as repos,ut as tree,j as version};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"./chunk-H4OY4EFC.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{j as STALE_MS,i as atomicWrite,k as hostId,a as loadDpapi,c as protection,f as readSealed,d as seal,b as setDpapiForTests,h as sleepSync,e as unseal,m as withFileLock,l as withFileLockSync,g as writeSealed};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{d as A,e as v,f as I}from"./chunk-BWOEIEFY.js";import{a as T,b as g,e as O,g as k,k as p,l as f,m as y,n as C,o as w,p as _,q as b}from"./chunk-MBNUMAAZ.js";import"./chunk-LB7WNZVK.js";import"./chunk-GY6BUIDP.js";import"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import{m as d}from"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import{a as m,b as h,c as x}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var R=["browser","broker","device_code"],E="https://graph.microsoft.com/.default",P=600;async function S(e,t,n={}){if(e.method==="pat")throw new h(`identity '${e.name}' uses an Azure DevOps PAT, which is never handed out as a token`,{hint:"a PAT signs ppdo-cli ado commands only; use an Entra identity for anything else"});let r=n.log??(()=>{}),c=!!n.forceRefresh;if(e.ephemeral)return(await import("./spn-YSYMDTOI.js")).ephemeralToken(e,t,c,r);if(!c){let a=C(e,t);if(a)return r(` token: cache (${e.name})`),a}return d(k(e.name),async()=>{let a=f(e.name);if(!c){let o=C(e,t,a);if(o)return r(` token: cache after lock (${e.name})`),o}let i,s,l;if(R.includes(e.method)){let o=a.account;if(!o||!_(a,e))throw new x(`identity '${e.name}' is not signed in`,{hint:`run: ppdo-cli auth login ${e.name}`});let $=await import("./msalUser-KC75VDVV.js");r(` token: refreshing via msal (${e.name}${c?", forced":""})`),[i,s]=await $.acquire(e,t,o,c),l=o.tenant_id??null}else if(e.method==="az_cli"){let o=await import("./azCli-UEDQHRLP.js");r(` token: az cli (${e.name})`),[i,s,l]=await o.acquire(e,t)}else if(e.method==="spn"){let o=await import("./spn-YSYMDTOI.js");r(` token: client credentials (${e.name})`),[i,s]=await o.acquire(e,t),l=null,o.check(e,g(i))}else throw new h(`sign-in method '${e.method}' is not available yet`);let u=g(i);return O(e.name,e.username,l||(T(e.tenant)?e.tenant:null),u),w(a,e,t,i,s),y(e.name,a),i})}async function G(e,t={}){if(e.method==="pat"){if(!t.force&&v(e).signed_in===!0)return{identity:e.name,status:"already signed in",account:e.username,method:"pat"};if(!t.rt)throw new h("a PAT sign-in needs a runtime");return await A(e,{rt:t.rt,expires:t.expires??null,deviceCode:!!t.deviceCode,usedBy:t.usedBy??[],identities:t.identities??[]})}let n;try{n=f(e.name)}catch(s){if(!(s instanceof m))throw s;n={account:null,tokens:{}}}if(!t.force&&_(n,e))return{identity:e.name,status:"already signed in",account:n.account?.account??null};let r=t.deviceCode?"device_code":e.method;if(r==="az_cli")return{identity:e.name,status:"uses az cli",hint:"run: az login (with this identity's AZURE_CONFIG_DIR)"};let c=t.scope??E,a=await import("./msalUser-KC75VDVV.js"),i=await d(k(e.name),async()=>{let[s,l]=await a.login(e,{method:r,scopes:[c],usedBy:t.usedBy??[]}),u={account:s,tokens:{}};return l&&w(u,e,c,l.accessToken,l.expiresOn),y(e.name,u),s},P);return{identity:e.name,status:"signed in",account:i.account??null,tenant_id:i.tenant_id??null,method:r}}async function N(e){if(e.method==="pat"){let n=p(e.name);return{identity:e.name,deleted_files:n,hint:`revoke the PAT too: ${I(e)}`}}let t;try{t=f(e.name)}catch(n){if(!(n instanceof m))throw n;t={account:null,tokens:{}}}return t.account&&R.includes(e.method)&&await(await import("./msalUser-KC75VDVV.js")).logout(e,t.account),{identity:e.name,deleted_files:p(e.name)}}function q(e){if(e.method==="pat")return{identity:e.name,username:e.username,method:"pat",...v(e)};let t={identity:e.name,username:e.username,tenant:e.tenant,method:e.method,client_id:e.effectiveClientId};try{return{...t,...b(e)}}catch(n){if(!(n instanceof m))throw n;return{...t,signed_in:!1,error:n.message,...n.hint?{hint:n.hint}:{}}}}export{E as DEFAULT_LOGIN_SCOPE,R as USER_METHODS,S as getToken,G as login,N as logout,q as status};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{A as I,B as j,C as v,D as $,E as Z,F as A,G as tt,H as L,I as et,J as k,K as H,L as x,O as nt,P as T,Q as ot,c as K,d as h,e as N,f as r,g as p,h as O,j as M,k as u,q as Q,r as X,t as Y,u as y,w as C,x as F,z as R}from"./chunk-5KZDCOFA.js";import"./chunk-BWZ6HZXM.js";import"./chunk-MTF66YXU.js";import"./chunk-BALEFXOL.js";import"./chunk-4S5ETLH4.js";import{a as z}from"./chunk-J4R6QXW7.js";import"./chunk-5SBBTR3Y.js";import"./chunk-UYDBLVAM.js";import"./chunk-RHQP7X6H.js";import"./chunk-TQLZ3TRU.js";import{e as V}from"./chunk-S4KF5Z3S.js";import{b,d as G}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var it=4e3,W={active:"active",pending:"pending",fixed:"fixed","wont-fix":"wontFix",closed:"closed","by-design":"byDesign"},st=Object.fromEntries(Object.entries(W).map(([t,e])=>[e,t])),ct={merge:"noFastForward",squash:"squash",rebase:"rebase","rebase-merge":"rebaseMerge"},ht=new Map([[10,"approved"],[5,"approved with suggestions"],[0,"no vote"],[-5,"waiting for author"],[-10,"rejected"]]);function g(t){return typeof t=="string"&&t?t:null}function lt(t){return typeof t=="string"&&Object.hasOwn(st,t)?st[t]:t??null}function J(t,e,n){return j(t,e,`${R(e)}/_apis/git/pullrequests/${n}`)}function _(t){return{id:r(t,"pullRequestId"),title:r(t,"title"),status:r(t,"status"),draft:r(t,"isDraft"),repo:r(p(t.repository),"name"),source:H(t.sourceRefName),target:H(t.targetRefName),author:k(t.createdBy),created:r(t,"creationDate")}}function E(t){let e=r(p(t.repository),"webUrl");return h(e)?`${u(e)}/pullrequest/${u(r(t,"pullRequestId"))}`:null}async function rt(t,e,n){if(!n)return null;if(n==="me")return(await L(t,e)).id;let o=await et(t,e,[["searchFilter","General"],["filterValue",n]]);if(!o.length)throw new G(`no identity matches '${n}'`,{service:"devops"});return u(o[0].id)}function B(t){return t.repository}async function jt(t){let e=t.args,n=await y(t),o=X(e),i=[["searchCriteria.status",String(e.status??"active")]];g(e.repo)&&i.push(["searchCriteria.repositoryId",await tt(t,n,String(e.repo))]),g(e.creator)&&i.push(["searchCriteria.creatorId",u(await rt(t,n,String(e.creator)))]),g(e.reviewer)&&i.push(["searchCriteria.reviewerId",u(await rt(t,n,String(e.reviewer)))]),g(e.source)&&i.push(["searchCriteria.sourceRefName",x(String(e.source))]),g(e.target)&&i.push(["searchCriteria.targetRefName",x(String(e.target))]),o&&i.push(["$top",String(o+1)]);let s=A(await j(t,n,`${R(n)}/_apis/git/pullrequests`,i)).map(_);o&&s.length>o&&(Y(o,!0,"pull requests"),s=s.slice(0,o)),await t.emit(s)}async function $t(t){let e=await y(t),n=await J(t,e,C(t.args.pr,"pr",e)),o=O(n.labels).map(s=>r(s,"name")),i={..._(n),description:r(n,"description"),merge_status:r(n,"mergeStatus"),closed:r(n,"closedDate"),auto_complete:h(n.autoCompleteSetBy),reviewers:O(n.reviewers).map(s=>({name:k(s),vote:ht.get(r(s,"vote"))??r(s,"vote"),required:r(s,"isRequired")})),labels:o.length?o:null,url:E(n)};await t.emit(M(i))}function U(t){return N(r(p(t.item),"path"),t.originalPath??null)}async function Pt(t){let e=t.args,n=await y(t),o=C(e.pr,"pr",n),i=await J(t,n,o),s=u(B(i).id),c=`${R(n)}/_apis/git/repositories/${s}/pullRequests/${o}`,a=A(await j(t,n,`${c}/iterations`));if(!a.length){await t.emit([]);return}let m=a[a.length-1].id,w=await j(t,n,`${c}/iterations/${u(m)}/changes`,[["$compareTo","0"]]),l=O(w.changeEntries).filter(d=>r(p(d.item),"gitObjectType")!=="tree");if(g(e.file)){let d="/"+String(e.file).replace(/^\/+/,"");l=l.filter(S=>U(S)===d||r(S,"originalPath")===d)}if(e.stat){let d=l.map(S=>{let P={path:U(S),change:r(S,"changeType")};return h(S.originalPath)&&S.originalPath!==P.path&&(P.from=S.originalPath),P});await t.emit(d);return}let f=await nt(t,n,s,l.map(d=>({change:r(d,"changeType"),path:U(d),from:r(d,"originalPath"),old:r(p(d.item),"originalObjectId"),new:r(p(d.item),"objectId")})),Number(e.unified??3));await t.format()==="json"?await t.emit({pr:o,iteration:m,files:l.length,diff:f}):await ot(f)}async function Ot(t){let e=await y(t),n=C(t.args.pr,"pr",e),o=await J(t,e,n),i=`${R(e)}/_apis/git/repositories/${u(B(o).id)}/pullRequests/${n}/threads`,s=[];for(let c of A(await j(t,e,i))){let a=O(c.comments).filter(f=>!h(f.isDeleted));if((a.length?a.every(f=>r(f,"commentType")==="system"):!0)&&!t.args.all)continue;let w=p(c.threadContext),l=r(p(N(w.rightFileStart??null,w.leftFileStart??null)),"line");s.push({id:r(c,"id"),status:lt(r(c,"status")),file:r(w,"filePath"),line:l,comments:a.map(f=>({id:r(f,"id"),author:k(f.author),content:r(f,"content"),date:r(f,"publishedDate")}))})}await t.emit(s)}async function pt(t,e,n,o,i){let s="vstfs:///Git/PullRequestId/"+z(`${u(p(n.project).id)}/${u(n.id)}/${o}`,""),c=`${R(e)}/_apis/wit/workitems/${i}`,a=await e.lookups(()=>j(t,e,c,[["$expand","relations"]]));if(O(a.relations).some(w=>r(w,"url")===s))return;await I(t,e,"PATCH",c,{body:$([{op:"add",path:"/relations/-",value:{rel:"ArtifactLink",url:s,attributes:{name:"Pull Request"}}}]),headers:{"Content-Type":"application/json-patch+json"}})}function ut(t){if(at(t)>it)throw new b(`the description is ${at(t)} characters; Azure DevOps allows ${it}`,{hint:"shorten it (aim for about 3500)"})}function at(t){let e=0;for(let n of t)e++;return e}async function vt(t){let e=t.args,n=g(e.description)?T(String(e.description)):null;n&&ut(n);let o=await y(t),i=F(e.workItem,"wi",o),s=await j(t,o,`${R(o)}/_apis/git/repositories/${String(e.repo)}`),c={sourceRefName:x(String(e.source)),targetRefName:x(String(e.target)),title:e.title,isDraft:!!e.draft};n&&(c.description=n);let a=v(await I(t,o,"POST",`${R(o)}/_apis/git/repositories/${u(s.id)}/pullrequests`,{body:$(c)}));for(let m of i)await pt(t,o,s,Number(a.pullRequestId),m);await t.emit({..._(a),work_items:i.length?i:null,url:E(a)})}async function Ct(t){let e=t.args,n=typeof e.line=="number"?e.line:null,o=typeof e.endLine=="number"?e.endLine:null,i=typeof e.thread=="number"?e.thread:null,s=g(e.file),c=g(e.status);if(n&&!s)throw new b("--line needs --file");if(o&&!n)throw new b("--end-line needs --line");if(o&&n&&o<n)throw new b("--end-line is before --line");if(i&&(c||s))throw new b("--status and --file start a new thread; they don't apply to a reply (--thread)");let a=await y(t),m=C(e.pr,"pr",a),w=await J(t,a,m),l=`${R(a)}/_apis/git/repositories/${u(B(w).id)}/pullRequests/${m}/threads`,f=T(String(e.body));if(i){let P=await j(t,a,`${l}/${i}`),D=O(P.comments)[0]??{},gt=K(D)&&"id"in D?D.id:1,wt=v(await I(t,a,"POST",`${l}/${i}/comments`,{body:$({content:f,parentCommentId:gt,commentType:1})}));await t.emit({thread:i,comment:r(wt,"id")});return}let d={comments:[{parentCommentId:0,content:f,commentType:1}],status:W[c??"active"]};if(s){let P=n||1;d.threadContext={filePath:"/"+s.replace(/^\/+/,""),rightFileStart:{line:P,offset:1},rightFileEnd:{line:o||P,offset:1}}}let S=v(await I(t,a,"POST",l,{body:$(d)}));await t.emit({thread:r(S,"id"),comment:r(p(O(S.comments)[0]),"id")})}async function q(t,e,n){let o=C(n,"pr",e),i=await Z(t,e,()=>J(t,e,o));return[o,i,`${R(e)}/_apis/git/repositories/${u(B(i).id)}/pullrequests/${o}`]}async function Jt(t){let e=t.args,n={};if(g(e.title)&&(n.title=e.title),typeof e.description=="string"){let a=T(e.description);n.description=a,ut(a)}if((e.draft||e.publish)&&(n.isDraft=!!e.draft),!Object.keys(n).length)throw new b("nothing to update",{hint:"pass --title, --description, --draft or --publish"});let o=await y(t),[,i,s]=await q(t,o,e.pr),c=v(await I(t,o,"PATCH",s,{body:$(n)}));"description"in n&&h(i.autoCompleteSetBy)&&V("auto-complete is on and kept its merge commit message; set a new one with ppdo-cli ado pr auto-complete <pr> --message <text>"),await t.emit({..._(c),url:E(c)})}async function kt(t){let e=await y(t),n=F(t.args.workItem,"wi",e),[o,i]=await q(t,e,t.args.pr);for(let s of n)await pt(t,e,B(i),o,s);await t.emit({pr:o,work_items:n})}async function xt(t){let e=t.args,n=await y(t),[o,,i]=await q(t,n,e.pr),s=v(await I(t,n,"PATCH",`${i}/threads/${String(e.thread)}`,{body:$({status:W[String(e.status??"fixed")]})}));await t.emit({pr:o,thread:r(s,"id"),status:lt(r(s,"status"))})}function mt(t,e,n){let o=["bypassPolicy","bypassReason","squashMerge","triggeredByAutoComplete"],i=Object.fromEntries(Object.entries(p(e)).filter(([s])=>!o.includes(s)));return g(t.mergeStrategy)&&(i.mergeStrategy=ct[String(t.mergeStrategy)]),t.deleteSourceBranch&&(i.deleteSourceBranch=!0),t.transitionWorkItems&&(i.transitionWorkItems=!0),g(t.message)&&(i.mergeCommitMessage=T(String(t.message))),n&&g(t.ignorePolicy)&&(i.autoCompleteIgnoreConfigIds=String(t.ignorePolicy).split(",").filter(s=>s.trim()).map(Q)),i}function dt(t,e){if(!(t.conflictAuthorshipCommits||t.renames===!1))return null;let n={...p(e.mergeOptions)};return t.conflictAuthorshipCommits&&(n.conflictAuthorshipCommits=!0),t.renames===!1&&(n.disableRenames=!0),n}function ft(t){let e=p(t.completionOptions),n=Object.fromEntries(Object.entries(ct).map(([s,c])=>[c,s])),o=r(e,"mergeStrategy"),i=Object.fromEntries(Object.entries(p(t.mergeOptions)).filter(([,s])=>h(s)));return M({..._(t),merge_status:r(t,"mergeStatus"),auto_complete:h(t.autoCompleteSetBy)?k(t.autoCompleteSetBy):!1,merge_strategy:typeof o=="string"&&Object.hasOwn(n,o)?n[o]:o,delete_source_branch:r(e,"deleteSourceBranch"),transition_work_items:r(e,"transitionWorkItems"),merge_options:Object.keys(i).length?i:null,merge_commit:t.status==="completed"?r(p(t.lastMergeCommit),"commitId"):null,url:E(t)})}async function Tt(t){let e=t.args,n=[e.mergeStrategy,e.deleteSourceBranch,e.transitionWorkItems,e.message,e.conflictAuthorshipCommits,e.renames===!1,e.ignorePolicy];if(e.off&&n.some(h))throw new b("--off takes no completion options");let o=await y(t),[i,s,c]=await q(t,o,e.pr);if(s.status!=="active")throw new b(`PR ${i} is ${u(r(s,"status"))}`);let a;if(e.off)a={autoCompleteSetBy:{id:"00000000-0000-0000-0000-000000000000"}};else{a={autoCompleteSetBy:{id:(await o.lookups(()=>L(t,o))).id},completionOptions:mt(e,s.completionOptions,!0)};let l=dt(e,s);l&&h(l)&&(a.mergeOptions=l)}let m=v(await I(t,o,"PATCH",c,{body:$(a)}));await t.emit(ft(m))}async function _t(t){let e=t.args,n=await y(t),[o,i,s]=await q(t,n,e.pr);if(i.status!=="active")throw new b(`PR ${o} is ${u(r(i,"status"))}`);if(h(i.isDraft))throw new b(`PR ${o} is a draft`,{hint:"publish it first: ppdo-cli ado pr update <pr> --publish"});let c={status:"completed",lastMergeSourceCommit:r(i,"lastMergeSourceCommit"),completionOptions:mt(e,i.completionOptions,!1)},a=dt(e,i);a&&h(a)&&(c.mergeOptions=a);let m=v(await I(t,n,"PATCH",s,{body:$(c)})),w=performance.now()+6e4;for(;m.status==="active"&&performance.now()<w;)await new Promise(l=>setTimeout(l,2e3)),m=await J(t,n,o);await t.emit(ft(m))}export{it as DESCRIPTION_LIMIT,ct as MERGE_STRATEGIES,W as THREAD_STATUS,Tt as autoComplete,Ct as comment,_t as complete,vt as create,Pt as diff,$t as getOne,J as getPr,kt as link,pt as linkWorkItem,jt as list,xt as resolve,Ot as threads,Jt as update};
|
|
2
|
+
import{A as I,B as j,C as v,D as $,E as Z,F as A,G as tt,H as L,I as et,J as k,K as H,L as x,O as nt,P as T,Q as ot,c as K,d as h,e as N,f as r,g as p,h as O,j as M,k as u,q as Q,r as X,t as Y,u as y,w as C,x as F,z as R}from"./chunk-46KBBWEH.js";import"./chunk-BALEFXOL.js";import"./chunk-6NBCHK6X.js";import"./chunk-MTF66YXU.js";import"./chunk-GY6BUIDP.js";import{a as z}from"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import{e as V}from"./chunk-S4KF5Z3S.js";import{b,d as G}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var it=4e3,W={active:"active",pending:"pending",fixed:"fixed","wont-fix":"wontFix",closed:"closed","by-design":"byDesign"},st=Object.fromEntries(Object.entries(W).map(([t,e])=>[e,t])),ct={merge:"noFastForward",squash:"squash",rebase:"rebase","rebase-merge":"rebaseMerge"},ht=new Map([[10,"approved"],[5,"approved with suggestions"],[0,"no vote"],[-5,"waiting for author"],[-10,"rejected"]]);function g(t){return typeof t=="string"&&t?t:null}function lt(t){return typeof t=="string"&&Object.hasOwn(st,t)?st[t]:t??null}function J(t,e,n){return j(t,e,`${R(e)}/_apis/git/pullrequests/${n}`)}function _(t){return{id:r(t,"pullRequestId"),title:r(t,"title"),status:r(t,"status"),draft:r(t,"isDraft"),repo:r(p(t.repository),"name"),source:H(t.sourceRefName),target:H(t.targetRefName),author:k(t.createdBy),created:r(t,"creationDate")}}function E(t){let e=r(p(t.repository),"webUrl");return h(e)?`${u(e)}/pullrequest/${u(r(t,"pullRequestId"))}`:null}async function rt(t,e,n){if(!n)return null;if(n==="me")return(await L(t,e)).id;let o=await et(t,e,[["searchFilter","General"],["filterValue",n]]);if(!o.length)throw new G(`no identity matches '${n}'`,{service:"devops"});return u(o[0].id)}function B(t){return t.repository}async function jt(t){let e=t.args,n=await y(t),o=X(e),i=[["searchCriteria.status",String(e.status??"active")]];g(e.repo)&&i.push(["searchCriteria.repositoryId",await tt(t,n,String(e.repo))]),g(e.creator)&&i.push(["searchCriteria.creatorId",u(await rt(t,n,String(e.creator)))]),g(e.reviewer)&&i.push(["searchCriteria.reviewerId",u(await rt(t,n,String(e.reviewer)))]),g(e.source)&&i.push(["searchCriteria.sourceRefName",x(String(e.source))]),g(e.target)&&i.push(["searchCriteria.targetRefName",x(String(e.target))]),o&&i.push(["$top",String(o+1)]);let s=A(await j(t,n,`${R(n)}/_apis/git/pullrequests`,i)).map(_);o&&s.length>o&&(Y(o,!0,"pull requests"),s=s.slice(0,o)),await t.emit(s)}async function $t(t){let e=await y(t),n=await J(t,e,C(t.args.pr,"pr",e)),o=O(n.labels).map(s=>r(s,"name")),i={..._(n),description:r(n,"description"),merge_status:r(n,"mergeStatus"),closed:r(n,"closedDate"),auto_complete:h(n.autoCompleteSetBy),reviewers:O(n.reviewers).map(s=>({name:k(s),vote:ht.get(r(s,"vote"))??r(s,"vote"),required:r(s,"isRequired")})),labels:o.length?o:null,url:E(n)};await t.emit(M(i))}function U(t){return N(r(p(t.item),"path"),t.originalPath??null)}async function Pt(t){let e=t.args,n=await y(t),o=C(e.pr,"pr",n),i=await J(t,n,o),s=u(B(i).id),c=`${R(n)}/_apis/git/repositories/${s}/pullRequests/${o}`,a=A(await j(t,n,`${c}/iterations`));if(!a.length){await t.emit([]);return}let m=a[a.length-1].id,w=await j(t,n,`${c}/iterations/${u(m)}/changes`,[["$compareTo","0"]]),l=O(w.changeEntries).filter(d=>r(p(d.item),"gitObjectType")!=="tree");if(g(e.file)){let d="/"+String(e.file).replace(/^\/+/,"");l=l.filter(S=>U(S)===d||r(S,"originalPath")===d)}if(e.stat){let d=l.map(S=>{let P={path:U(S),change:r(S,"changeType")};return h(S.originalPath)&&S.originalPath!==P.path&&(P.from=S.originalPath),P});await t.emit(d);return}let f=await nt(t,n,s,l.map(d=>({change:r(d,"changeType"),path:U(d),from:r(d,"originalPath"),old:r(p(d.item),"originalObjectId"),new:r(p(d.item),"objectId")})),Number(e.unified??3));await t.format()==="json"?await t.emit({pr:o,iteration:m,files:l.length,diff:f}):await ot(f)}async function Ot(t){let e=await y(t),n=C(t.args.pr,"pr",e),o=await J(t,e,n),i=`${R(e)}/_apis/git/repositories/${u(B(o).id)}/pullRequests/${n}/threads`,s=[];for(let c of A(await j(t,e,i))){let a=O(c.comments).filter(f=>!h(f.isDeleted));if((a.length?a.every(f=>r(f,"commentType")==="system"):!0)&&!t.args.all)continue;let w=p(c.threadContext),l=r(p(N(w.rightFileStart??null,w.leftFileStart??null)),"line");s.push({id:r(c,"id"),status:lt(r(c,"status")),file:r(w,"filePath"),line:l,comments:a.map(f=>({id:r(f,"id"),author:k(f.author),content:r(f,"content"),date:r(f,"publishedDate")}))})}await t.emit(s)}async function pt(t,e,n,o,i){let s="vstfs:///Git/PullRequestId/"+z(`${u(p(n.project).id)}/${u(n.id)}/${o}`,""),c=`${R(e)}/_apis/wit/workitems/${i}`,a=await e.lookups(()=>j(t,e,c,[["$expand","relations"]]));if(O(a.relations).some(w=>r(w,"url")===s))return;await I(t,e,"PATCH",c,{body:$([{op:"add",path:"/relations/-",value:{rel:"ArtifactLink",url:s,attributes:{name:"Pull Request"}}}]),headers:{"Content-Type":"application/json-patch+json"}})}function ut(t){if(at(t)>it)throw new b(`the description is ${at(t)} characters; Azure DevOps allows ${it}`,{hint:"shorten it (aim for about 3500)"})}function at(t){let e=0;for(let n of t)e++;return e}async function vt(t){let e=t.args,n=g(e.description)?T(String(e.description)):null;n&&ut(n);let o=await y(t),i=F(e.workItem,"wi",o),s=await j(t,o,`${R(o)}/_apis/git/repositories/${String(e.repo)}`),c={sourceRefName:x(String(e.source)),targetRefName:x(String(e.target)),title:e.title,isDraft:!!e.draft};n&&(c.description=n);let a=v(await I(t,o,"POST",`${R(o)}/_apis/git/repositories/${u(s.id)}/pullrequests`,{body:$(c)}));for(let m of i)await pt(t,o,s,Number(a.pullRequestId),m);await t.emit({..._(a),work_items:i.length?i:null,url:E(a)})}async function Ct(t){let e=t.args,n=typeof e.line=="number"?e.line:null,o=typeof e.endLine=="number"?e.endLine:null,i=typeof e.thread=="number"?e.thread:null,s=g(e.file),c=g(e.status);if(n&&!s)throw new b("--line needs --file");if(o&&!n)throw new b("--end-line needs --line");if(o&&n&&o<n)throw new b("--end-line is before --line");if(i&&(c||s))throw new b("--status and --file start a new thread; they don't apply to a reply (--thread)");let a=await y(t),m=C(e.pr,"pr",a),w=await J(t,a,m),l=`${R(a)}/_apis/git/repositories/${u(B(w).id)}/pullRequests/${m}/threads`,f=T(String(e.body));if(i){let P=await j(t,a,`${l}/${i}`),D=O(P.comments)[0]??{},gt=K(D)&&"id"in D?D.id:1,wt=v(await I(t,a,"POST",`${l}/${i}/comments`,{body:$({content:f,parentCommentId:gt,commentType:1})}));await t.emit({thread:i,comment:r(wt,"id")});return}let d={comments:[{parentCommentId:0,content:f,commentType:1}],status:W[c??"active"]};if(s){let P=n||1;d.threadContext={filePath:"/"+s.replace(/^\/+/,""),rightFileStart:{line:P,offset:1},rightFileEnd:{line:o||P,offset:1}}}let S=v(await I(t,a,"POST",l,{body:$(d)}));await t.emit({thread:r(S,"id"),comment:r(p(O(S.comments)[0]),"id")})}async function q(t,e,n){let o=C(n,"pr",e),i=await Z(t,e,()=>J(t,e,o));return[o,i,`${R(e)}/_apis/git/repositories/${u(B(i).id)}/pullrequests/${o}`]}async function Jt(t){let e=t.args,n={};if(g(e.title)&&(n.title=e.title),typeof e.description=="string"){let a=T(e.description);n.description=a,ut(a)}if((e.draft||e.publish)&&(n.isDraft=!!e.draft),!Object.keys(n).length)throw new b("nothing to update",{hint:"pass --title, --description, --draft or --publish"});let o=await y(t),[,i,s]=await q(t,o,e.pr),c=v(await I(t,o,"PATCH",s,{body:$(n)}));"description"in n&&h(i.autoCompleteSetBy)&&V("auto-complete is on and kept its merge commit message; set a new one with ppdo-cli ado pr auto-complete <pr> --message <text>"),await t.emit({..._(c),url:E(c)})}async function kt(t){let e=await y(t),n=F(t.args.workItem,"wi",e),[o,i]=await q(t,e,t.args.pr);for(let s of n)await pt(t,e,B(i),o,s);await t.emit({pr:o,work_items:n})}async function xt(t){let e=t.args,n=await y(t),[o,,i]=await q(t,n,e.pr),s=v(await I(t,n,"PATCH",`${i}/threads/${String(e.thread)}`,{body:$({status:W[String(e.status??"fixed")]})}));await t.emit({pr:o,thread:r(s,"id"),status:lt(r(s,"status"))})}function mt(t,e,n){let o=["bypassPolicy","bypassReason","squashMerge","triggeredByAutoComplete"],i=Object.fromEntries(Object.entries(p(e)).filter(([s])=>!o.includes(s)));return g(t.mergeStrategy)&&(i.mergeStrategy=ct[String(t.mergeStrategy)]),t.deleteSourceBranch&&(i.deleteSourceBranch=!0),t.transitionWorkItems&&(i.transitionWorkItems=!0),g(t.message)&&(i.mergeCommitMessage=T(String(t.message))),n&&g(t.ignorePolicy)&&(i.autoCompleteIgnoreConfigIds=String(t.ignorePolicy).split(",").filter(s=>s.trim()).map(Q)),i}function dt(t,e){if(!(t.conflictAuthorshipCommits||t.renames===!1))return null;let n={...p(e.mergeOptions)};return t.conflictAuthorshipCommits&&(n.conflictAuthorshipCommits=!0),t.renames===!1&&(n.disableRenames=!0),n}function ft(t){let e=p(t.completionOptions),n=Object.fromEntries(Object.entries(ct).map(([s,c])=>[c,s])),o=r(e,"mergeStrategy"),i=Object.fromEntries(Object.entries(p(t.mergeOptions)).filter(([,s])=>h(s)));return M({..._(t),merge_status:r(t,"mergeStatus"),auto_complete:h(t.autoCompleteSetBy)?k(t.autoCompleteSetBy):!1,merge_strategy:typeof o=="string"&&Object.hasOwn(n,o)?n[o]:o,delete_source_branch:r(e,"deleteSourceBranch"),transition_work_items:r(e,"transitionWorkItems"),merge_options:Object.keys(i).length?i:null,merge_commit:t.status==="completed"?r(p(t.lastMergeCommit),"commitId"):null,url:E(t)})}async function Tt(t){let e=t.args,n=[e.mergeStrategy,e.deleteSourceBranch,e.transitionWorkItems,e.message,e.conflictAuthorshipCommits,e.renames===!1,e.ignorePolicy];if(e.off&&n.some(h))throw new b("--off takes no completion options");let o=await y(t),[i,s,c]=await q(t,o,e.pr);if(s.status!=="active")throw new b(`PR ${i} is ${u(r(s,"status"))}`);let a;if(e.off)a={autoCompleteSetBy:{id:"00000000-0000-0000-0000-000000000000"}};else{a={autoCompleteSetBy:{id:(await o.lookups(()=>L(t,o))).id},completionOptions:mt(e,s.completionOptions,!0)};let l=dt(e,s);l&&h(l)&&(a.mergeOptions=l)}let m=v(await I(t,o,"PATCH",c,{body:$(a)}));await t.emit(ft(m))}async function _t(t){let e=t.args,n=await y(t),[o,i,s]=await q(t,n,e.pr);if(i.status!=="active")throw new b(`PR ${o} is ${u(r(i,"status"))}`);if(h(i.isDraft))throw new b(`PR ${o} is a draft`,{hint:"publish it first: ppdo-cli ado pr update <pr> --publish"});let c={status:"completed",lastMergeSourceCommit:r(i,"lastMergeSourceCommit"),completionOptions:mt(e,i.completionOptions,!1)},a=dt(e,i);a&&h(a)&&(c.mergeOptions=a);let m=v(await I(t,n,"PATCH",s,{body:$(c)})),w=performance.now()+6e4;for(;m.status==="active"&&performance.now()<w;)await new Promise(l=>setTimeout(l,2e3)),m=await J(t,n,o);await t.emit(ft(m))}export{it as DESCRIPTION_LIMIT,ct as MERGE_STRATEGIES,W as THREAD_STATUS,Tt as autoComplete,Ct as comment,_t as complete,vt as create,Pt as diff,$t as getOne,J as getPr,kt as link,pt as linkWorkItem,jt as list,xt as resolve,Ot as threads,Jt as update};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f,g,h}from"./chunk-SWXCK5C2.js";import"./chunk-BG2OIOSN.js";import"./chunk-UCTMKA2J.js";import"./chunk-FOEBNCSD.js";import"./chunk-KBZI5UDL.js";import"./chunk-BALEFXOL.js";import"./chunk-GY6BUIDP.js";import"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{h as batch,d as create,c as get,b as query,g as readRequests,f as remove,a as splitlines,e as update};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{A as T,B as C,e as S}from"./chunk-3L7657R3.js";import{b as k,c as O,d as P}from"./chunk-GY6BUIDP.js";import{c as J,g as j}from"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import{e as x}from"./chunk-S4KF5Z3S.js";import{b as u,d as E,g as q}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var f="graph.microsoft.com";function A(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}var h=class extends k{name="graph";scope(){return`https://${f}/.default`}url(e,n){let i=e.includes("://")?e:`https://${f}/v1.0/${e.replace(/^\/+/,"")}`;return n&&n.length&&(i+=(i.includes("?")?"&":"?")+J(n,`$'(),:@"`)),i}allowed(e){let n=j(e);return n.scheme==="https"&&n.host===f}requestId(e){return e.header("request-id")||e.header("client-request-id")}error(e){let n=null,i=null;try{let s=e.json(),o=A(s)&&A(s.error)?s.error:{};n=typeof o.code=="string"?o.code:null,i=typeof o.message=="string"?o.message:null}catch{i=e.text.trim().slice(0,300)||null}return O(this.name,e,n,i,this.requestId(e))}},w=class{constructor(e){this.inner=e}request(e,n,i={}){if(e.toUpperCase()!=="GET")throw new q("blocked: the graph service is read-only",{service:"graph"});return this.inner.request(e,n,i)}paginate(e,n){return this.inner.paginate(e,n)}get identity(){return this.inner.identity??null}};async function b(t){let e=await t.config(),n=t.args,i;if(T(n))i=C(n);else if(typeof n.identity=="string"&&n.identity){let r=e.identities.get(n.identity);if(!r)throw new u(`no identity '${n.identity}'`,{hint:"run: ppdo-cli identity list"});i=r}else{let r,a=n.env;if(typeof a=="string"&&a){if(a.includes(","))throw new u("graph runs against one account: pass one --env, or --identity");r=a}else{let d=S.map(l=>e.current[l]).find(l=>l);if(!d)throw new u("no account to use",{hint:"pass --identity <name> or --env <environment>"});r=d}let p=e.environment(r),m=e.groups.get(p.group);if(!m||!m.identity)throw new u(`environment '${p.name}' has no account`,{hint:"pass --identity <name>"});i=e.identity(m.identity)}let s=new h,{getToken:o}=await import("./provider-D7DMMAS6.js"),c=new P(s,t,r=>o(i,s.scope(),{forceRefresh:r,log:a=>t.log(a)}));return c.identity=i,new w(c)}var R="id,displayName,description,mail,mailEnabled,securityEnabled,groupTypes,membershipRule,createdDateTime";function L(t){return typeof t=="object"&&t!==null&&!Array.isArray(t)}function $(t){let e=L(t)?t.value:null;return Array.isArray(e)?e:[]}function U(t){return(Array.isArray(t.groupTypes)?t.groupTypes:[]).includes("Unified")?"microsoft365":t.securityEnabled?t.mailEnabled?"mail-enabled-security":"security":"distribution"}function N(t){let e={id:t.id??null,name:t.displayName??null,type:U(t),description:t.description??null,mail:t.mail??null,dynamic:t.membershipRule?!0:null,rule:t.membershipRule??null,created:t.createdDateTime??null};return Object.fromEntries(Object.entries(e).filter(([,n])=>n!=null))}async function F(t,e){if(/^[0-9a-fA-F-]{36}$/.test(e.trim()))return(await t.request("GET",`groups/${e.trim()}`,{params:[["$select",R]]})).json();let n=e.replace(/'/g,"''"),i=$((await t.request("GET","groups",{params:[["$filter",`displayName eq '${n}'`],["$select",R]]})).json());if(!i.length)throw new E(`no Entra group named '${e}'`,{service:"graph",hint:"run: ppdo-cli graph group search <words>"});if(i.length>1)throw new u(`${i.length} groups are named '${e}'; use an id`,{hint:i.map(s=>String(s.id)).join(", ")});return i[0]}async function W(t){let e=t.args,n=await b(t),i=await F(n,String(e.groupRef)),s=String(i.id),o=(await n.request("GET",`groups/${s}/members/$count`,{headers:{ConsistencyLevel:"eventual",Accept:"text/plain"}})).text.trim(),c={...N(i),members_count:/^\d+$/.test(o)?parseInt(o,10):o};if(e.members){let r=e.all?null:typeof e.limit=="number"&&e.limit?e.limit:100,a=[],p=`groups/${s}/members`,m=[["$select","id,displayName,userPrincipalName,mail,appId"],["$top",String(Math.min(r||999,999))]];for(;p&&(r===null||a.length<r);){let g=(await n.request("GET",p,{params:m})).json()??{};for(let y of $(g)){let v=String(y["@odata.type"]??"").split(".").pop()??"",I={name:y.displayName??null,upn:y.userPrincipalName||y.mail||null,type:v==="servicePrincipal"?"service-principal":v,id:y.id??null};a.push(Object.fromEntries(Object.entries(I).filter(([,G])=>G)))}p=typeof g["@odata.nextLink"]=="string"&&g["@odata.nextLink"]?g["@odata.nextLink"]:null,m=null}let d=r!==null&&a.length>r?a.slice(0,r):a,l=c.members_count;r!==null&&typeof l=="number"&&l>d.length&&x(`showing ${d.length} of ${l} members; pass --limit n or --all`),c.members=d}await t.emit(c)}async function X(t){let e=t.args,n=await b(t),i=String(e.text).replace(/"/g,""),s=typeof e.limit=="number"&&e.limit?e.limit:25,o=(await n.request("GET","groups",{params:[["$search",`"displayName:${i}"`],["$select",R],["$top",String(Math.min(s,999))],["$orderby","displayName"]],headers:{ConsistencyLevel:"eventual"}})).json();await t.emit($(o).map(N).slice(0,s))}export{W as get,N as groupRow,X as search};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{a as c}from"./chunk-GQLXEQVQ.js";import{l as f,m as u,n as d,o as l}from"./chunk-3L7657R3.js";import"./chunk-LB7WNZVK.js";import"./chunk-TQLZ3TRU.js";import{e as m}from"./chunk-S4KF5Z3S.js";import{b as o}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var g=["broker","browser","device_code"],w=[["tenant","tenant"],["username","username"],["method","method"],["clientId","clientId"],["configDir","configDir"],["secretEnv","secretEnv"],["certificate","certificate"],["organization","organization"],["patEnv","patEnv"]];function a(e,t){let n=e.args[t];return typeof n=="string"?n:void 0}function h(e){if(e.method==="pat"){v(e);return}if(e.organization||e.patEnv)throw new o("--organization and --pat-env apply to method 'pat' only");if(!e.tenant)throw new o("--tenant is required");if(g.includes(e.method)&&!e.username)throw new o(`--username is required for method '${e.method}'`,{hint:"it pins sign-in to the right account"});if(e.method==="spn"&&!e.clientId)throw new o(`--client-id is required for method '${e.method}'`);if(e.method==="spn"&&!(e.secretEnv||e.certificate))throw new o("method 'spn' needs --secret-env or --certificate");if(e.configDir&&e.method!=="az_cli")throw new o("--config-dir applies to method 'az_cli' only");if((e.secretEnv||e.certificate)&&e.method!=="spn")throw new o("--secret-env and --certificate apply to method 'spn' only");e.method==="broker"&&e.clientId&&m(`warning: identity '${e.name}' uses the broker with a custom client ID; the app must have ms-appx-web://Microsoft.AAD.BrokerPlugin/${e.clientId} registered as a redirect URI`)}function v(e){if(!e.organization)throw new o("--organization is required for method 'pat'",{hint:"a PAT is sent to that one Azure DevOps organization only"});if(!f.test(e.organization))throw new o(`'${e.organization}' is not an Azure DevOps organization name`,{hint:"letters, digits and hyphens, as in https://dev.azure.com/<organization>"});if(!e.username)throw new o("--username is required for method 'pat'",{hint:"the PAT must belong to this account; auth login checks it before it's stored"});if(e.clientId||e.configDir||e.secretEnv||e.certificate)throw new o("--client-id, --config-dir, --secret-env and --certificate don't apply to method 'pat'");if(e.patEnv&&!u.test(e.patEnv))throw new o(`--pat-env '${e.patEnv}' is not an environment variable name`)}async function b(e){let t=String(e.args.name);d(t,"identity");let n=new l(t,{tenant:a(e,"tenant")??"",username:a(e,"username")??null,method:a(e,"method")??"browser",clientId:a(e,"clientId")??null,configDir:a(e,"configDir")??null,secretEnv:a(e,"secretEnv")??null,certificate:a(e,"certificate")??null,organization:a(e,"organization")??null,patEnv:a(e,"patEnv")??null});h(n),await c(t,i=>{if(i.identities.has(t))throw new o(`identity '${t}' already exists`,{hint:`run: ppdo-cli identity update ${t} ...`});i.identities.set(t,n.clone())}),await e.emit({name:t,...n.toDict()})}function y(e){let t=[];for(let[n,i]of w){let s=a(e,n);s!==void 0&&t.push([i,s||null])}return t}function p(e,t){for(let[n,i]of t)n==="tenant"?e.tenant=i??"":n==="method"?e.method=i??"":e[n]=i}async function R(e){let t=String(e.args.name),n=y(e),i=(await e.config()).identity(t).clone();p(i,n),h(i),await e.emit(await c(t,s=>{let r=s.identity(t);return p(r,n),{name:t,...r.toDict()}}))}async function A(e){let t=await e.config();await e.emit([...t.identities.values()].map(n=>({name:n.name,username:n.username,tenant:n.tenant,method:n.method})))}async function S(e){let{filesFor:t}=await import("./tokenCache-TQFT6LAD.js"),n=(await e.config()).identity(String(e.args.name));await e.emit({name:n.name,...n.toDict(),client_id:n.effectiveClientId,cache_files:t(n.name)})}async function _(e){let t=String(e.args.name);await c(t,i=>{i.identity(t);let s=[...i.groups.values()].filter(r=>r.identity===t).map(r=>r.name);if(s.length&&!e.args.force)throw new o(`identity '${t}' is used by group(s): ${s.join(", ")}`,{hint:"update those groups first, or pass --force"});i.identities.delete(t);for(let r of i.groups.values())r.identity===t&&(r.identity=null)});let{deleteAll:n}=await import("./tokenCache-TQFT6LAD.js");await e.emit({removed:t,deleted_files:n(t)})}export{b as add,A as list,_ as remove,S as show,R as update};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{F as u,e as w,f as g,z as f}from"./chunk-3L7657R3.js";import"./chunk-TQLZ3TRU.js";import{e as l}from"./chunk-S4KF5Z3S.js";import{b as p}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";function r(e){return typeof e=="string"&&e?e:null}async function y(e){let o=await e.config(),s=r(e.args.name);if(s)return[o.identity(s)];let n=r(e.args.env),i=r(e.args.service),t;n?t=[o.environment(n).service]:t=i?[g[i]]:[...w];let c=[];for(let a of t)try{c.push(await f(o,a,n))}catch(m){if(!(m instanceof p)||t.length===1)throw m}if(!c.length)throw new p("no environment selected",{hint:"name an identity, or pass --env <name>"});let d=[];for(let a of c){let[m]=u(o,a,r(e.args.identity));d.some(v=>v.name===m.name)||d.push(m)}return d}async function k(e){let o=await import("./provider-D7DMMAS6.js"),{loginScope:s}=await import("./services-C6G4XRXR.js"),n=await e.config(),i=!!(r(e.args.name)||r(e.args.service)),t=[];for(let c of await y(e)){let d=[...n.environments.values()].flatMap(a=>{let m=n.groups.get(a.group);return m?.identity===c.name?[{name:a.name,mode:m.mode}]:[]});t.push(await o.login(c,{deviceCode:!!e.args.deviceCode,scope:s(n,c),force:i,usedBy:d,rt:e,expires:r(e.args.expires),identities:[...n.identities.values()]}))}await e.emit(t.length!==1?t:t[0])}async function I(e){let o=await import("./provider-D7DMMAS6.js"),s=await e.config(),n=r(e.args.name),i;if(e.args.all)i=[...s.identities.values()];else if(n)i=[s.identity(n)];else throw new p("name an identity or pass --all");let t=[];for(let c of i)t.push(await o.logout(c));await e.emit(t.length!==1?t:t[0])}async function x(e){let o=await import("./provider-D7DMMAS6.js"),s=await e.config(),n=r(e.args.name),t=(n?[s.identity(n)]:[...s.identities.values()]).map(c=>o.status(c));await e.emit(n?t[0]:t)}async function E(e){let o=r(e.args.service),s=r(e.args.scope);if(!o&&!s)throw new p("pass --service dv|ado or --scope <scope>");let n=await e.config(),i,t;if(o){let a=await f(n,g[o],r(e.args.env));[i]=u(n,a,r(e.args.identity));let{scopeFor:m}=await import("./services-C6G4XRXR.js");t=s??m(a.env)}else{let a=r(e.args.identity);if(!a)throw new p("pass --identity <name> or --service");i=n.identity(a),t=s}if(i.method==="pat")throw new p(`identity '${i.name}' uses an Azure DevOps PAT, which ppdo-cli never prints`,{hint:"ppdo-cli ado commands use it for you"});if(process.stdout.isTTY&&!e.args.show)throw new p("refusing to print a token to the terminal",{hint:"pipe it, or pass --show"});let{getToken:c}=await import("./provider-D7DMMAS6.js"),d=await c(i,t,{log:a=>e.log(a)});process.stdout.write(d+`
|
|
3
|
+
`),e.verbose&&l(`token for ${i.name} (${t})`)}export{k as login,I as logout,x as status,E as token};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{a as v}from"./chunk-GQLXEQVQ.js";import{G as j,e as u,f as S,g as R,i as f,n as l,q as P,r as w,v as y,w as $,z as h}from"./chunk-3L7657R3.js";import"./chunk-LB7WNZVK.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import{b as m}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";import{existsSync as x,realpathSync as N,statSync as O,unlinkSync as I,writeFileSync as k}from"node:fs";import{join as E,resolve as C}from"node:path";function p(n){return typeof n=="string"&&n?n:null}function b(n){return{dataverse:p(n.args.dataverse),devopsOrg:p(n.args.devopsOrg),devopsProject:p(n.args.devopsProject)}}function D(n,e){if(e.dataverse&&(e.devopsOrg||e.devopsProject))throw new m("an environment is either Dataverse or DevOps, not both",{hint:"add a second environment for the other service"});if(e.dataverse){if(n.service!=="dataverse")throw new m(`'${n.name}' is a DevOps environment`,{hint:"remove it and add a new one"});n.url=j(e.dataverse)}if(e.devopsOrg||e.devopsProject){if(n.service!=="devops")throw new m(`'${n.name}' is a Dataverse environment`,{hint:"remove it and add a new one"});e.devopsOrg&&(n.org=e.devopsOrg.trim().replace(/^\/+|\/+$/g,"")),e.devopsProject&&(n.project=e.devopsProject.trim())}}function g(n,e){let t=n.groups.get(e.group),r={name:e.name,service:e.service,endpoint:e.endpoint,group:e.group,mode:t?t.mode:null,identity:t?t.identity:null},i=t&&t.identity?n.identities.get(t.identity):void 0;return i&&(r.account=i.username||i.name),r}async function _(n){let e=String(n.args.name),t=String(n.args.in);l(e,"environment");let r=b(n);if(!(r.dataverse||r.devopsOrg))throw new m("pass --dataverse <url>, or --devops-org <org> [--devops-project <project>]");let i=r.dataverse?"dataverse":"devops";await n.emit(await v(e,a=>{if(a.environments.has(e))throw new m(`environment '${e}' already exists`,{hint:`run: ppdo-cli env update ${e} ...`});a.group(t);let s=new P(e,t,i);return D(s,r),a.environments.set(e,s),a.current[i]??=e,g(a,s)}))}async function B(n){let e=String(n.args.name),t=b(n);await n.emit(await v(e,r=>{let i=r.environment(e);return D(i,t),g(r,i)}))}async function M(n){let e=String(n.args.name),t=String(n.args.newName);l(t,"environment");let r=await v(e,s=>{let o=s.environment(e);if(s.environments.has(t))throw new m(`environment '${t}' already exists`);return o.name=t,s.environments=new Map([...s.environments].map(([c,d])=>[c===e?t:c,d])),s.current[o.service]===e&&(s.current[o.service]=t),g(s,o)}),i=await y(),a=i&&Object.values(i[0]).includes(e);await n.emit({renamed:e,...r,...a?{warning:`${i[1]} still names '${e}'`}:{}})}async function q(n){let e=String(n.args.name),t=String(n.args.to);await n.emit(await v(e,r=>{let i=r.environment(e);return r.group(t),i.group=t,g(r,i)}))}async function z(n){let e=await n.config(),t=p(n.args.group);t&&e.group(t);let r=p(n.args.service),i=r?S[r]:void 0,a={};for(let o of u)try{a[o]=(await h(e,o,null)).env.name}catch(c){if(!(c instanceof m))throw c}let s=[];for(let o of e.environments.values())t&&o.group!==t||i&&o.service!==i||s.push({...g(e,o),default:a[o.service]===o.name});await n.emit(s)}async function G(n){let e=await n.config();await n.emit(g(e,e.environment(String(n.args.name))))}async function H(n){let e=String(n.args.name);await n.emit(await v(e,t=>{let r=t.environment(e);return t.current[r.service]=e,{[`current-${r.service}`]:e}}))}async function K(n){let e=await n.config(),t={};for(let r of u)try{let i=await h(e,r,null);t[r]={env:i.env.name,group:i.group.name,mode:i.mode,source:i.source}}catch(i){if(!(i instanceof m))throw i;t[r]={error:i.message}}await n.emit(t)}function F(n){try{return O(n).isDirectory()}catch{return!1}}function A(n){if(n){let t=C(n);if(!F(t))throw new m(`not a folder: ${n}`);return N.native(t)}let e=$();if(!e)throw new m("not inside a git repo",{hint:"run inside the repo or pass --path <repo>"});return e}async function Q(n){let e=await n.config(),t={},r=Array.isArray(n.args.names)?n.args.names:[];for(let o of r){let c=e.environment(o),d=t[c.service];if(d!==void 0)throw new m(`pin one ${R[c.service]} environment, not '${d}' and '${o}'`);t[c.service]=o}let i=E(A(p(n.args.path)),f),a={};if(x(i)&&O(i).isFile()){try{a=w(i)??{}}catch{a={}}let o={};for(let c of u){let d=a[c];typeof d=="string"&&(o[c]=d)}t={...o,...t}}let s={};typeof a.$schema=="string"&&(s.$schema=a.$schema);for(let o of u)t[o]!==void 0&&(s[o]=t[o]);for(let[o,c]of Object.entries(a))!(o in s)&&!u.includes(o)&&(s[o]=c);k(i,JSON.stringify(s,null,2)+`
|
|
3
|
+
`,"utf8"),await n.emit({pinned:t,file:i})}async function W(n){let e=E(A(p(n.args.path)),f);if(!x(e)){await n.emit({removed:null});return}let t=w(e)??{},r=u.filter(s=>s in t),i=Object.keys(t).filter(s=>s!=="$schema"&&!u.includes(s));if(!i.length){I(e),await n.emit({removed:e,unpinned:r});return}let a={};for(let[s,o]of Object.entries(t))u.includes(s)||(a[s]=o);r.length&&k(e,JSON.stringify(a,null,2)+`
|
|
4
|
+
`,"utf8"),await n.emit({removed:null,unpinned:r,kept:i,file:e})}async function X(n){let e=String(n.args.name);await v(e,i=>{let a=i.environment(e);i.environments.delete(e),i.current[a.service]===e&&delete i.current[a.service]});let t=await y(),r=t&&Object.values(t[0]).includes(e);await n.emit({removed:e,...r?{warning:`${t[1]} still names it`}:{}})}export{_ as add,K as current,g as describe,z as list,q as move,Q as pin,X as remove,M as rename,G as show,W as unpin,B as update,H as use};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{a as g}from"./chunk-GQLXEQVQ.js";import{G as C,n as v,p as U,q as x}from"./chunk-3L7657R3.js";import"./chunk-LB7WNZVK.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import{b as u}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";function h(n,t){return{name:t.name,mode:t.mode,identity:t.identity,environments:n.members(t.name).map(o=>({name:o.name,service:o.service,endpoint:o.endpoint}))}}function w(n){return typeof n=="string"&&n?n:null}async function A(n){let t=String(n.args.name);v(t,"group");let o=w(n.args.identity);if(!o)throw new u("--identity is required",{hint:"the account every environment in the group uses"});let i=w(n.args.mode)??"read-only";await n.emit(await g(t,s=>{if(s.groups.has(t))throw new u(`group '${t}' already exists`,{hint:`run: ppdo-cli group update ${t} ...`});let d=new U(t,o,i);return s.groups.set(t,d),h(s,d)}))}async function G(n){let t=String(n.args.name),o=w(n.args.identity),i=w(n.args.mode);await n.emit(await g(t,s=>{let d=s.group(t);return o&&(d.identity=o),i&&(d.mode=i),h(s,d)}))}async function O(n){let t=await n.config();await n.emit([...t.groups.values()].map(o=>({name:o.name,mode:o.mode,identity:o.identity,environments:t.members(o.name).map(i=>i.name)})))}async function T(n){let t=await n.config();await n.emit(h(t,t.group(String(n.args.name))))}async function q(n){let t=String(n.args.name);await g(t,o=>{o.group(t);let i=o.members(t).map(s=>s.name);if(i.length)throw new u(`group '${t}' still has environments: ${i.join(", ")}`,{hint:"move or remove them first: ppdo-cli env move <env> --to <group>"});o.groups.delete(t)}),await n.emit({removed:t})}function l(n){return typeof n=="string"?n.toLowerCase():""}async function D(n){let{ORG_TYPES:t,instances:o}=await import("./discovery-PSGWFMJH.js"),i=String(n.args.name),s=await n.config(),d=s.group(i);if(!d.identity)throw new u(`group '${i}' has no identity`,{hint:`run: ppdo-cli group update ${i} --identity <name>`});let P=await o(n,s.identity(d.identity)),R=new Map;for(let e of s.environments.values())e.service==="dataverse"&&R.set((e.url??"").toLowerCase(),e);let N=[...P].sort((e,m)=>{let a=l(e.UrlName),r=l(m.UrlName);return a<r?-1:a>r?1:0}),c=[];for(let e of N){let m=C(typeof e.Url=="string"?e.Url:""),a=R.get(m.toLowerCase()),r=e.OrganizationType,L={name:e.UrlName,friendly_name:e.FriendlyName,url:m,type:typeof r=="number"&&r in t?t[r]:r,state:e.State===0?"enabled":"disabled",version:e.Version,region:e.Region,sysadmin:e.IsUserSysAdmin,added:a?a.name:null,added_to:a?a.group:null},$={};for(let[j,y]of Object.entries(L))y!=null&&($[j]=y);c.push($)}let f=typeof n.args.add=="string"?n.args.add:null;if(!f){await n.emit(c);return}let p=f.trim().toLowerCase()==="all"?null:new Set(f.split(",").map(e=>e.trim().toLowerCase()).filter(e=>e));if(p&&p.size){let e=new Set(c.map(a=>l(a.name))),m=[...p].filter(a=>!e.has(a)).sort();if(m.length)throw new u("not found: "+m.join(", "),{hint:`run: ppdo-cli group discover ${i}`})}let k=e=>p===null||p.has(l(e.name)),b=c.filter(e=>!e.added&&k(e)),S=c.filter(e=>e.added&&k(e)).map(e=>e.name);if(!b.length){await n.emit({group:i,added:[],skipped:S,hint:"nothing new to add"});return}await n.emit(await g(i,e=>{let m=[];for(let a of b){let r=l(a.name).replace(/[^a-z0-9_-]/g,"-").replace(/^-+|-+$/g,"")||"dataverse";e.environments.has(r)&&(r=`${i}-${r}`),v(r,"environment"),e.environments.set(r,new x(r,i,"dataverse",{url:a.url})),e.current.dataverse??=r,m.push({name:r,url:a.url})}return{group:i,added:m,skipped:S}}))}export{A as add,h as describe,D as discover,O as list,q as remove,T as show,G as update};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{f as i}from"./chunk-BALEFXOL.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var l={dataverse:"dv",devops:"ado"};function m(n,r){for(let t=0;t<Math.min(n.length,r.length);t++){let s=n[t],e=r[t];if(s!==e)return s<e?-1:1}return n.length-r.length}async function c(n){let{buildProgram:r}=await import("./main-
|
|
2
|
+
import{f as i}from"./chunk-BALEFXOL.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var l={dataverse:"dv",devops:"ado"};function m(n,r){for(let t=0;t<Math.min(n.length,r.length);t++){let s=n[t],e=r[t];if(s!==e)return s<e?-1:1}return n.length-r.length}async function c(n){let{buildProgram:r}=await import("./main-J3O5YMIY.js");i.length=0,await r([],!0);let t=typeof n.args.only=="string"?n.args.only:null,s=t?l[t]??t:null,e=[...i].sort((o,a)=>m(o.path,a.path)).filter(o=>!s||o.path[0]===s).map(o=>({command:"ppdo-cli "+o.path.join(" "),class:o.cls,help:o.help}));await n.emit(e)}export{c as commands};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{
|
|
2
|
+
import{w as b}from"./chunk-3L7657R3.js";import{a as k}from"./chunk-TCLZ4XM6.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import{b as p,f as x,i as R}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";import{cpSync as I,existsSync as j,lstatSync as J,mkdirSync as _,readdirSync as D,readFileSync as U,realpathSync as B,rmdirSync as C,rmSync as A,statSync as M,symlinkSync as G,unlinkSync as K}from"node:fs";import{homedir as V}from"node:os";import{dirname as E,join as s,resolve as N}from"node:path";import{fileURLToPath as W}from"node:url";var w=".ppdevops-skills.json",O={claude:[[".claude","skills"],[".claude","skills"]],copilot:[[".copilot","skills"],[".github","skills"]]},y=null;function st(t){y=t}function q(t){try{return M(t).isDirectory()}catch{return!1}}function T(t){try{return M(t).isFile()}catch{return!1}}function F(){if(y)return y;let t=E(W(import.meta.url));for(;;){if(T(s(t,"package.json"))&&q(s(t,"skills")))return s(t,"skills");let r=E(t);if(r===t)throw new p("cannot find the bundled skills folder",{hint:"reinstall ppdo-cli"});t=r}}function L(){let t=F(),r=D(t).filter(n=>T(s(t,n,"SKILL.md"))).sort();return new Map(r.map(n=>[n,s(t,n)]))}function $(t,r,n){let[c,l]=O[t];if(r==="user")return s(V(),...c);let e;if(n){let i=N(n);try{e=B.native(i)}catch{e=i}}else e=b();if(!e)throw new p("--scope repo needs a git repo",{hint:"run inside the repo or pass --path <repo>"});return s(e,...l)}function z(t){try{return J(t).isSymbolicLink()}catch{return!1}}function h(t){if(z(t))try{K(t)}catch{C(t)}else j(t)&&A(t,{recursive:!0,force:!0})}function H(t,r){G(N(t),r,process.platform==="win32"?"junction":"dir")}function S(t){let r;try{r=U(s(t,w),"utf8")}catch(n){if(n.code==="ENOENT")return{skills:[]};throw n}try{let n=JSON.parse(r);return typeof n=="object"&&n!==null&&!Array.isArray(n)?n:{skills:[]}}catch{return{skills:[]}}}function v(t){return Array.isArray(t.skills)?t.skills.filter(r=>typeof r=="string"):[]}function d(t){return typeof t=="string"&&t?t:null}function P(t){return $(String(t.args.target),d(t.args.scope)??"user",d(t.args.path))}async function it(t){let r=P(t),n=!!t.args.link,c=new Set(v(S(r))),l=L(),e=[...l.keys()].filter(o=>j(s(r,o))&&!c.has(o));if(e.length&&!t.args.force)throw new x(`${r} already has skill folders ppdo-cli didn't create: ${e.join(", ")}`,{hint:"rename or remove them, or pass --force to overwrite"});_(r,{recursive:!0});for(let[o,u]of l){let m=s(r,o);h(m),n?H(u,m):I(u,m,{recursive:!0})}let i=[...c].filter(o=>!l.has(o)).sort();for(let o of i)h(s(r,o));let a=[...l.keys()],f={version:k,skills:a};n&&(f.linked_to=F());let{atomicWrite:g}=await import("./protect-X2J7LU7X.js");g(s(r,w),R(f,2)+`
|
|
3
3
|
`),await t.emit({installed:a,folder:r,version:k,mode:n?"linked":"copied",...i.length?{removed:i}:{}})}async function et(t){let r=P(t),n=v(S(r));for(let c of n)h(s(r,c));A(s(r,w),{force:!0}),await t.emit({removed:n,folder:r})}async function ot(t){let r=d(t.args.target),n=d(t.args.scope),c=d(t.args.path),l=[];for(let i of r?[r]:Object.keys(O))for(let a of n?[n]:["user","repo"])try{l.push([i,a,$(i,a,c)])}catch(f){if(!(f instanceof p))throw f}let e=[];for(let i of L().keys()){let a={skill:i,installed:[]};for(let[f,g,o]of l){let u=S(o);v(u).includes(i)&&a.installed.push(`${f}/${g} (${u.linked_to?"linked":String(u.version)})`)}e.push(a)}await t.emit(e)}export{w as MANIFEST,O as TARGETS,L as bundled,it as install,z as isLink,H as link,ot as list,h as remove,st as setSkillsRootForTests,F as skillsRoot,et as uninstall};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{F as v,e as g,f,z as p}from"./chunk-3L7657R3.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import{a as l,b as u}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";function d(e){return typeof e=="string"&&e?e:null}function h(e,s){let t=d(s.args.service),i=t?f[t]:void 0,o=d(s.args.env);if(o){let r=e.environment(o);if(i&&i!==r.service)throw new u(`environment '${o}' is not a ${i} environment`);return[r.service]}return i?[i]:[...g]}async function _(e){let s=await import("./tokenCache-TQFT6LAD.js"),t=await e.config(),i=h(t,e),o={};for(let r of i){let a;try{a=await p(t,r,d(e.args.env))}catch(n){if(!(n instanceof u)||i.length===1)throw n;continue}let c={env:a.env.name,group:a.group.name,mode:a.mode,source:a.source,endpoint:a.env.endpoint};try{let[n,w]=v(t,a,d(e.args.identity)),m;n.method==="pat"?m=(await import("./pat-PCMOZYM5.js")).describe(n).signed_in===!0:m=s.accountMatches(s.load(n.name),n)||n.method==="az_cli",Object.assign(c,{identity:n.name,identity_source:w,username:n.username,method:n.method,signed_in:m})}catch(n){if(!(n instanceof l))throw n;c.error=n.message}e.args.check&&"identity"in c&&(c.check=await y(e,r)),o[r]=c}if(!Object.keys(o).length)throw new u("no environment selected",{hint:"pass --env <name>, or run: ppdo-cli env use <name> (see ppdo-cli env list)"});await e.emit(o)}async function y(e,s){try{let t=await e.client(s);if(s==="dataverse"){let r=(await t.request("GET","WhoAmI")).json()??{};return{ok:!0,user_id:r.UserId??null,organization_id:r.OrganizationId??null}}let o=((await t.request("GET","_apis/connectionData",{params:[["api-version","7.1-preview"]]})).json()??{}).authenticatedUser??{};return{ok:!0,user:o.providerDisplayName??null,user_id:o.id??null}}catch(t){if(!(t instanceof l))throw t;return{ok:!1,error:t.message,exit_code:t.exitCode}}}export{_ as whoami};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a}from"./chunk-
|
|
2
|
+
import{a}from"./chunk-GLU4X7PT.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{a as Runtime};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s}from"./chunk-ELSYHAYC.js";import"./chunk-BG2OIOSN.js";import"./chunk-UCTMKA2J.js";import"./chunk-FOEBNCSD.js";import"./chunk-BALEFXOL.js";import"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{b as TEAM_LABELS,a as TEAM_TYPES,c as VERBS,f as findRole,e as findTeam,d as findUser,r as origin,r as origin_,k as privileges,q as rights,m as roleGet,l as roleList,s as shared,p as tableOf,i as teamAddRole,h as teamGet,g as teamList,j as teamRemoveRole,n as userGet,o as userPrivileges};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a as c,b as d,c as e,d as f,e as g}from"./chunk-
|
|
2
|
+
import{a as c,b as d,c as e,d as f,e as g}from"./chunk-6NBCHK6X.js";import{a,b}from"./chunk-MTF66YXU.js";import"./chunk-GY6BUIDP.js";import"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{d as DEFAULT_API_VERSION,e as DevOps,a as HOSTS,b as LEGACY_SUBHOSTS,c as RESOURCE,g as items,f as nextUrl};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e}from"./chunk-KBZI5UDL.js";import"./chunk-GY6BUIDP.js";import"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{a as API_PATH,c as Dataverse,b as cleanMessage,e as items,d as nextLink};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{c as f}from"./chunk-KBZI5UDL.js";import{A as m,E as u,F as g,z as l}from"./chunk-3L7657R3.js";import{c as v}from"./chunk-6NBCHK6X.js";import"./chunk-MTF66YXU.js";import{d as p}from"./chunk-GY6BUIDP.js";import"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";function y(e){return e.service==="dataverse"?new f({url:e.url}):new v({org:e.org,project:e.project})}function S(e){return y(e).scope()}function I(e,c){for(let o of e.environments.values()){let t=e.groups.get(o.group);if(t&&t.identity===c.name)return S(o)}return"https://graph.microsoft.com/.default"}async function k(e,c){let o=await e.config(),t,r;if(m(e.args))[t,r]=await u(o,c,e.args);else{let i=e.args.env;t=await l(o,c,typeof i=="string"?i:null);let n=e.args.identity;[r]=g(o,t,typeof n=="string"?n:null)}let a=y(t.env),s;if(r.method==="pat"){let{PatAuthorizer:i}=await import("./pat-PCMOZYM5.js"),n=new i(r,e);await n.check(a),s=new p(a,e,n)}else{let i=async n=>{let{getToken:d}=await import("./provider-D7DMMAS6.js");return d(r,a.scope(),{forceRefresh:n,log:w=>e.log(w)})};s=new p(a,e,i)}return s.target=t,s.identity=r,s}export{k as clientFor,I as loginScope,y as makeService,S as scopeFor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{e as o,o as a,r as i}from"./chunk-BALEFXOL.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var r=["claude","copilot"],p=["user","repo"];function m(d){let s=a(d,"skills","install the bundled agent skills"),t=()=>import("./run-
|
|
2
|
+
import{e as o,o as a,r as i}from"./chunk-BALEFXOL.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var r=["claude","copilot"],p=["user","repo"];function m(d){let s=a(d,"skills","install the bundled agent skills"),t=()=>import("./run-T3IIJ7SK.js");for(let[e,c]of[["install","copy the bundled skills into an agent's skill folder"],["uninstall","remove the skills ppdo-cli installed"]]){let l=i(s,e,"L",c).addOption(new o("--target <target>").choices(r).makeOptionMandatory()).addOption(new o("--scope <scope>").choices(p)).option("--path <repo>","repo folder for --scope repo (default: git root)");e==="install"?(l.option("--force","overwrite skill folders ppdo-cli didn't create").option("--link","link to the skills instead of copying them, so they follow the installed ppdo-cli (for npm link or a local build, your repo)"),l.handler(async n=>(await t()).install(n))):l.handler(async n=>(await t()).uninstall(n))}i(s,"list","L","bundled skills and where they are installed").addOption(new o("--target <target>").choices(r)).addOption(new o("--scope <scope>").choices(p)).option("--path <repo>").handler(async e=>(await t()).list(e))}export{p as SCOPES,r as TARGET_NAMES,m as register};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t}from"./chunk-Q2RD4TRK.js";import"./chunk-ITP35SAY.js";import"./chunk-ZUXLC5VX.js";import"./chunk-BG2OIOSN.js";import"./chunk-UCTMKA2J.js";import"./chunk-FOEBNCSD.js";import"./chunk-BALEFXOL.js";import"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{a as OPERATIONS,i as components,j as dependencies,k as exportCmd,c as find,h as get,s as history,p as importCmd,r as importResults,o as isInstalledAtLeast,g as list,d as names,f as objectIds,q as parseImportResults,m as projectZip,t as publish,b as row,l as settingsParameters,e as tableType,n as zipIdentity};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{a as R,b as U,c as N,m as v}from"./chunk-TADCW6ZI.js";import{ga as f}from"./chunk-TZSB4PR7.js";import"./chunk-C42MGXRN.js";import"./chunk-ZNJ4DRCA.js";import"./chunk-WIA546AL.js";import"./chunk-QMTPHZLQ.js";import{c as C}from"./chunk-Q2RD4TRK.js";import{b as M,g as $,j as B}from"./chunk-ITP35SAY.js";import{a as P}from"./chunk-ZUXLC5VX.js";import{t as E,u as A,v as S,w as h}from"./chunk-BG2OIOSN.js";import"./chunk-UCTMKA2J.js";import"./chunk-FOEBNCSD.js";import"./chunk-BALEFXOL.js";import"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import{e as p}from"./chunk-S4KF5Z3S.js";import{a as d,b as y,c as b,d as w,g as x,h as j}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var u=n=>n?"managed":"unmanaged";async function m(n,a,e,i){return S(await A(n,a,"POST",e,{body:h(i)}))}async function D(n,a,e,i){let s=async o=>{try{let g=(await m(n,a,"ExportSolution",{SolutionName:e,Managed:o})).ExportSolutionFile;if(typeof g!="string")return"unexpected response: 'ExportSolutionFile'";try{return f(g)}catch(F){return`unexpected response: ${F.message}`}}catch(t){if(t instanceof b||t instanceof j||t instanceof w||t instanceof y||t instanceof x)throw t;if(t instanceof d){if((t.status??500)<500)throw t;return t.message}throw t}},l=i.map(o=>(p(`exporting ${e} (${u(o)})`),s(o))),c=await Promise.allSettled(l),r=new Map;return c.forEach((o,t)=>{if(o.status==="rejected")throw o.reason;r.set(i[t],o.value)}),r}async function I(n,a,e,i){let s=[];for(let o of i){let t=await m(n,a,"ExportSolutionAsync",{SolutionName:e,Managed:o});s.push({managed:o,job:String(t.AsyncOperationId??""),export:String(t.ExportJobId??"")}),p(`exporting ${e} (${u(o)}), job ${String(t.AsyncOperationId??"None")}`)}let l=typeof n.args.maxWait=="number"&&n.args.maxWait?n.args.maxWait:60,c=await P(async()=>{let o=new Map;for(let t of s)o.set(t.job,await $(n,a,t.job));return o},o=>[...o.values()].every(t=>t.statecode===M),{timeout:l*60,log:p,hint:"raise --max-wait, or check later with the job id",describe:o=>s.map(t=>`${u(t.managed)}: ${String(o.get(t.job).status)}`).join("; ")}),r=new Map;for(let o of s){B(c.get(o.job));let t=await m(n,a,"DownloadSolutionExportData",{ExportJobId:o.export});r.set(o.managed,f(String(t.ExportSolutionFile)))}return r}async function O(n,a,e,i,s=!1){let l=new Map,c=s?[...i]:[];if(!s)for(let[r,o]of await D(n,a,e,i))typeof o!="string"?l.set(r,o):(p(`${u(r)} export didn't finish in one request (${o}); running it as a job`),c.push(r));if(c.length)for(let[r,o]of await I(n,a,e,c))l.set(r,o);return l}async function Z(n,a,e,i=[],s=null){let l=await E(n);await C(n,l,a);let r=await O(n,l,a,e===R?[!1]:e===U?[!0]:[!1,!0],!!n.args.async),o=r.get(!1)??r.get(!0);return v(o,e,{managedZip:e===N?r.get(!0)??null:null,ignore:i,mapping:s})}export{O as exportAll,Z as exportAndPlan};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a as M}from"./chunk-GE3XBV3K.js";import{a as k}from"./chunk-JEAIFLEN.js";import{a as q,b as D,c as x,g as B,m as L}from"./chunk-
|
|
2
|
+
import{a as M}from"./chunk-GE3XBV3K.js";import{a as k}from"./chunk-JEAIFLEN.js";import{a as q,b as D,c as x,g as B,m as L}from"./chunk-TADCW6ZI.js";import{Y as O}from"./chunk-TZSB4PR7.js";import{c as T,d as v}from"./chunk-C42MGXRN.js";import"./chunk-ZNJ4DRCA.js";import{q as E}from"./chunk-WIA546AL.js";import"./chunk-QMTPHZLQ.js";import{e as h}from"./chunk-S4KF5Z3S.js";import{a as R,b as m}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";import{existsSync as _,mkdirSync as G,readdirSync as I,statSync as J}from"node:fs";var N=100;function b(t){if(t==null)return null;let n={unmanaged:q,managed:D,both:x}[String(t)];if(n===void 0)throw new m(`unknown package type '${String(t)}'`);return n}async function u(t){try{return await t()}catch(n){if(n instanceof R)throw n;if(n instanceof O)throw new m(n.message);let r=n;throw r.code==="ENOENT"?new m(`not found: ${r.path??r.message}`):n instanceof Error&&!r.code?new m(n.message):n}}function z(t){let n=Object.entries(t),r={};for(let[e,o]of n)r[e]=Array.isArray(o)?o.length:o;let a={files:r},i={};for(let[e,o]of n)Array.isArray(o)&&o.length&&(i[e]=o.slice(0,N));return Object.keys(i).length&&(a.changes=i),n.some(([,e])=>Array.isArray(e)&&e.length>N)&&h(`lists are capped at ${N} paths each; the counts are complete`),a}function Z(t,n){return!!(t.added.length||t.changed.length||t.deleted.length||n&&t.stale.length)}function U(t){return new R(t,{code:"out_of_date",exitCode:6,hint:"run it again without --check to update the folder"})}async function $(t,n){if(typeof t!="string"||!t)return null;let r=await u(async()=>new M(t,n));for(let a of r.warnings)h(`warning: ${a}`);return r.warnings=[],r}function H(t){try{return J(t).isDirectory()}catch{return!1}}async function rn(t){let n=t.args,r=String(n.fileZip),a=b(n.packageType),i=String(n.folder),e=!!n.allowDelete,o=!!n.check,s=n.managedZip;if(s&&a!==x)throw new m("--managed-zip is for --package-type both");let{sol:l,diff:p}=await u(async()=>{let c=new T(i),f=await $(n.map,i),[g,w]=L(r,a,{managedZip:s??null,mapping:f});return{sol:w,diff:await v(g,i,{delete:e,check:o,snapshot:c})}});if(await t.emit({solution:l.uniqueName,version:l.version,package_type:(a??l.packageType).toLowerCase(),folder:i,checked_only:o,...z(p)}),o&&Z(p,e))throw U(`${i} doesn't match ${r}`)}async function an(t){let n=t.args,r=await import("./project-HSZLY2AY.js"),a=await import("./pack-3OYGV36R.js"),i=String(n.folder),e=b(n.packageType),o=typeof n.map=="string"?n.map:null,s=null,l=null,p=typeof n.configuration=="string"?n.configuration:"Debug",c=await u(async()=>r.findProject(i));if(c&&!_(k(i,"Other","Solution.xml"))){let y=await import("./build-PBPXO3GJ.js");i=r.sourceRoot(c);let d=await u(async()=>y.settings(c));if(e===null&&(e=b((d.package_type||(p.toLowerCase()==="release"?"managed":"unmanaged")).toLowerCase())),o=o||d.map_file,d.references.length){let j=i;[s,l]=await u(async()=>y.buildProject(c,j,p,n.build!==!1,h))}}let f=String(n.save),g=await u(()=>a.pack(i,f,e,{mapFile:o,remap:!!n.remapPlugins,overlay:s}));for(let y of g)for(let d of y.warnings)h(`warning: ${d}`);let w=g.length===1?{...g[0]}:{solution:g[0].solution,zips:g};c&&(w.project=c),l&&l.length&&(w.built=l),await t.emit(w)}async function sn(t){let n=t.args,{exportAndPlan:r}=await import("./solutionExport-Y524HMGN.js"),{writeProject:a}=await import("./project-HSZLY2AY.js"),i=String(n.uniquename),e=typeof n.folder=="string"&&n.folder?n.folder:k(".",i);if(H(e)&&I(e).length)throw new m(`${e} is not empty`,{hint:"clone into a new folder, or use dv solution sync"});let o=b(n.packageType??"both"),s=n.project===!1?e:k(e,"src"),l=await $(n.map,s),[p,c]=await u(()=>r(t,i,o,[],l));G(s,{recursive:!0}),await v(p,s,{delete:!1});let f={solution:c.uniqueName,version:c.version,package_type:o.toLowerCase(),folder:e,source:s,files:p.size};n.project!==!1&&(f.project=a(e,c.uniqueName)[0]),await t.emit(f)}async function cn(t){let n=t.args,{exportAndPlan:r}=await import("./solutionExport-Y524HMGN.js"),a=await import("./project-HSZLY2AY.js"),i=typeof n.folder=="string"?n.folder:".",e=i,o=[],s=null,l=typeof n.map=="string"?n.map:null;if(!_(k(e,"Other","Solution.xml"))){if(s=await u(async()=>a.findProject(i)),!s)throw new m(`${i} has no Other/Solution.xml and no .cdsproj`,{hint:"sync a folder made by dv solution clone or unpack"});let A=s;if(e=a.sourceRoot(A),o=await u(async()=>a.referencedComponents(A)),!l){let X=await import("./build-PBPXO3GJ.js");l=(await u(async()=>X.settings(A))).map_file}o.length&&h(`left out (built by project references): ${o.join(", ")}`)}let p=k(e,"Other","Solution.xml");if(!_(p))throw new m(`${p} is missing`,{hint:"clone the solution first: dv solution clone <uniquename>"});let c=await u(async()=>new B(E(p))),f=b(n.packageType??"both"),g=new T(e),w=await $(l,e),[y,d]=await u(()=>r(t,c.uniqueName,f,o,w)),j=!n.keepStale,S=!!n.check,C=await v(y,e,{delete:j,check:S,snapshot:g}),P={solution:d.uniqueName,version:d.version,previous_version:c.version,package_type:f.toLowerCase(),folder:e,checked_only:S};if(s&&(P.project=s),o.length&&(P.left_out=o),Object.assign(P,z(C)),await t.emit(P),S&&Z(C,j))throw U(`${e} is out of date with ${c.uniqueName} in the environment`)}export{sn as clone,an as pack,cn as sync,rn as unpack};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
import{a,b,c,d,e,f,g}from"./chunk-B3TJ3RJN.js";import"./chunk-XUHLW6B2.js";import"./chunk-P4IFCLVF.js";import"./chunk-3L7657R3.js";import"./chunk-MBNUMAAZ.js";import"./chunk-LB7WNZVK.js";import"./chunk-GY6BUIDP.js";import"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{d as acquire,b as certificate,f as check,c as credential,e as ephemeralToken,a as expandPath,g as resetForTests};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
+
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-MBNUMAAZ.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{a as MIN_LIFETIME,k as accountMatches,f as deleteAll,l as describe,e as filesFor,i as getValid,g as load,c as msalPath,d as patPath,j as put,h as save,b as tokensPath};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m}from"./chunk-TADCW6ZI.js";import"./chunk-TZSB4PR7.js";import"./chunk-C42MGXRN.js";import"./chunk-ZNJ4DRCA.js";import"./chunk-WIA546AL.js";import"./chunk-QMTPHZLQ.js";import"./chunk-ZHHVG47C.js";export{c as BOTH,h as Context,b as MANAGED,d as Part,g as Solution,a as UNMANAGED,m as buildPlan,l as detectType,k as managedZipName,f as partKey,i as readZip,j as unpackPass,e as unquote};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{H as f,I as c,e as r,f as o,g as a,j as d,k as l,u as h}from"./chunk-
|
|
2
|
+
import{H as f,I as c,e as r,f as o,g as a,j as d,k as l,u as h}from"./chunk-46KBBWEH.js";import"./chunk-BALEFXOL.js";import"./chunk-6NBCHK6X.js";import"./chunk-MTF66YXU.js";import"./chunk-GY6BUIDP.js";import"./chunk-J4R6QXW7.js";import"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import{b as u,d as p}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";async function v(e){let t=String(e.args.who).trim(),n=await h(e),i;if(t==="me"?i=await c(e,n,[["identityIds",l((await f(e,n)).id)]]):i=await c(e,n,[["searchFilter","General"],["filterValue",t]]),!i.length)throw new p(`no user or group matches '${t}'`,{service:"devops",hint:"use their email, UPN or full display name; part of a name matches nothing"});if(i.length>1){let w=i.map(s=>l(r(m(s).upn??null,m(s).name??null,s.id??null))).join(", ");throw new u(`${i.length} identities match '${t}'`,{hint:`use one of: ${w}`})}await e.emit(m(i[0]))}function m(e){let t=Object.fromEntries(Object.entries(a(e.properties)).map(([n,i])=>[n,o(a(i),"$value")]));return d({id:o(e,"id"),name:r(e.customDisplayName??null,e.providerDisplayName??null),upn:t.Account??null,mail:r(t.Mail??null,null),descriptor:o(e,"subjectDescriptor"),active:o(e,"isActive"),kind:t.SchemaClassName??null,object_id:t["http://schemas.microsoft.com/identity/claims/objectidentifier"]??null})}export{v as getUser,m as userRow};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{A as j,B as R,C as q,D as F,F as G,J as H,N as I,d as f,e as w,f as l,g as v,h as V,i as S,j as z,k as y,l as x,m as K,p as M,s as W,u as h,z as k}from"./chunk-
|
|
2
|
+
import{A as j,B as R,C as q,D as F,F as G,J as H,N as I,d as f,e as w,f as l,g as v,h as V,i as S,j as z,k as y,l as x,m as K,p as M,s as W,u as h,z as k}from"./chunk-46KBBWEH.js";import{w as D,y as L}from"./chunk-BALEFXOL.js";import{d as N,e as U}from"./chunk-6NBCHK6X.js";import"./chunk-MTF66YXU.js";import"./chunk-GY6BUIDP.js";import"./chunk-J4R6QXW7.js";import{b as $}from"./chunk-2IUXH534.js";import"./chunk-TCLZ4XM6.js";import"./chunk-H4OY4EFC.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import{a as T,b as d,d as _,f as A}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var ne=/(pass(word)?|pwd|secret|token|key|credential|connectionstring|sas)/i,Q="<hidden>";function te(e){let n={};for(let[t,r]of Object.entries(v(e))){let o=v(r);f(o.isSecret)?n[t]={secret:!0}:ne.test(t)?n[t]={value:Q,masked:"name looks secret"}:n[t]={value:l(o,"value")}}return n}function P(e,n){let t={id:l(e,"id"),name:l(e,"name"),type:l(e,"type"),description:l(e,"description"),modified:l(e,"modifiedOn"),modified_by:H(e.modifiedBy)};return e.type==="AzureKeyVault"&&(t.key_vault=l(v(e.providerData),"vault")),n?t.variables=te(e.variables):t.variable_count=Object.keys(v(e.variables)).length,z(t,[""])}async function ue(e){let n=await h(e),t=typeof e.args.name=="string"&&e.args.name?e.args.name:null,r=t?[["groupName",t]]:null,o=`${k(n)}/_apis/distributedtask/variablegroups`;$(e,n,"GET",o,null);let a=[];for await(let i of n.paginate(o,{params:r,nextLink:N,items:U}))a.push(P(v(i),!1));await e.emit(W(K(a,i=>S(w(i.name??null,""))),e.args,"variable groups"))}async function pe(e){let n=await h(e),t=`${k(n)}/_apis/distributedtask/variablegroups`,r=String(e.args.vargroup),o;if(x(r)){let a=(await j(e,n,"GET",`${t}/${r}`)).json();o=f(a)?a:null}else o=G(await R(e,n,t,[["groupName",r]])).find(i=>(S(w(i.name??null,""))??"").toLowerCase()===r.toLowerCase())??null;if(!o)throw new _(`no variable group '${r}'`,{service:"devops",hint:"run: ppdo-cli ado vargroup list"});await e.emit(P(o,!0))}function E(e,n){let t=[];for(let[r,o]of D(e,n)){let a=o;if(a.startsWith("@")){let i=I(L(a)??Buffer.alloc(0));if(i===null)throw M("'utf-8' codec can't decode the input");a=i.replace(/[\r\n]+$/,"")}if(!r)throw new d(`${n} needs a name`);t.push([r,a])}return t}function oe(e){let n={...e};return n.variables=Object.fromEntries(Object.entries(v(e.variables)).map(([t,r])=>{let o=r;return[t,f(o.isSecret)&&"value"in o?{...o,value:Q}:o]})),n}async function X(e,n,t,r,o,a){if(e.dryRun)return await e.emit({dry_run:!0,method:t,path:r,body:oe(o)}),null;try{return q(await j(e,n,t,r,{body:F(o)}))}catch(i){throw i instanceof T&&i.code==="VariableGroupExistsException"?new A(`a variable group named '${y(a)}' already exists`,{service:"devops",hint:`change it with: ppdo-cli ado vargroup set ${y(a)} ...`}):i}}async function Y(e,n,t,r){let o=await R(e,n,`_apis/projects/${k(n)}`);return{name:t,description:w(r??null,""),projectReference:{id:o.id,name:o.name}}}async function de(e){let n=e.args,t=Object.fromEntries(E(n.variable,"--variable").map(([m,u])=>[m,{value:u}]));for(let[m,u]of E(n.secret,"--secret")){if(!u)throw new d(`secret '${m}' is empty`,{hint:"Azure DevOps ignores an empty secret"});t[m]={value:u,isSecret:!0}}if(!Object.keys(t).length)throw new d("a variable group needs at least one variable",{hint:"pass --variable k=v or --secret k=@file"});let r=await h(e);$(e,r,"POST","_apis/distributedtask/variablegroups",Buffer.from("{}"));let o=await r.lookups(()=>Y(e,r,n.name,n.description??null)),a={name:n.name,type:"Vsts",description:w(n.description??null,""),variables:t,variableGroupProjectReferences:[o]},i=await X(e,r,"POST","_apis/distributedtask/variablegroups",a,n.name);i!==null&&await e.emit(P(i,!0))}async function fe(e){let n=e.args,t=E(n.variable,"--variable"),r=E(n.secret,"--secret"),o=n.remove??[],a=typeof n.description=="string"?n.description:null;if(!(t.length||r.length||o.length||a!==null))throw new d("nothing to change",{hint:"pass --variable, --secret, --remove or --description"});let i=await h(e);$(e,i,"PUT","_apis/distributedtask/variablegroups",Buffer.from("{}"));let m=`${k(i)}/_apis/distributedtask/variablegroups`,u=String(n.vargroup),p=await i.lookups(async()=>{let s=x(u)?u:null;if(!s){let C=G(await R(e,i,m,[["groupName",u]])).find(ee=>(S(w(ee.name??null,""))??"").toLowerCase()===u.toLowerCase());s=C?y(C.id):null}let c=null;if(s){let b=(await j(e,i,"GET",`${m}/${s}`)).json();c=f(b)?b:null}return c&&!f(c.variableGroupProjectReferences)&&(c.variableGroupProjectReferences=[await Y(e,i,c.name??null,c.description??null)]),c});if(!p)throw new _(`no variable group '${u}'`,{service:"devops",hint:"run: ppdo-cli ado vargroup list"});let g={};for(let[s,c]of Object.entries(v(p.variables))){let b=v(c);g[s]=f(b.isSecret)?{isSecret:!0}:{value:l(b,"value")}}let O=[];for(let[s,c]of t){if(f(g[s]?.isSecret))throw new d(`'${s}' is a secret; change it with --secret`,{hint:"turning a secret into a plain variable isn't supported"});g[s]={value:c},O.push(s)}for(let[s,c]of r){if(!c)throw new d(`secret '${s}' is empty`,{hint:"Azure DevOps ignores an empty secret"});g[s]={value:c,isSecret:!0},O.push(s)}for(let s of o){if(!(s in g))throw new d(`'${s}' isn't in the group`);delete g[s]}if(!Object.keys(g).length)throw new d("a variable group must keep at least one variable");let B=V(p.variableGroupProjectReferences).map(s=>({...s}));if(a!==null)for(let s of B)s.description=a;let Z={name:l(p,"name"),type:w(p.type??null,"Vsts"),description:a===null?l(p,"description"):a,providerData:l(p,"providerData"),variables:g,variableGroupProjectReferences:B},J=await X(e,i,"PUT",`_apis/distributedtask/variablegroups/${y(p.id)}`,Z,p.name??null);if(J!==null){let s=(await j(e,i,"GET",`${m}/${y(p.id)}`)).json();J=f(s)?s:J,await e.emit({...P(J,!0),changed:[...new Set(O)].sort(),removed:o.length?[...o].sort():null})}}export{Q as MASK,de as create,pe as getGroup,ue as list,fe as set};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{e,r as o}from"./chunk-BALEFXOL.js";import{f as i}from"./chunk-
|
|
2
|
+
import{e,r as o}from"./chunk-BALEFXOL.js";import{f as i}from"./chunk-3L7657R3.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";function a(r){o(r,"whoami","L","show the resolved environment, mode and account per service").addOption(new e("--service <service>").choices(Object.keys(i))).option("--check","call each service to confirm the account works").handler(async t=>(await import("./run-ZHIDOKQH.js")).whoami(t))}export{a as register};
|