@ppdostudio/ppdo-cli 1.0.0-beta.0 → 1.0.0-beta.1
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 +66 -54
- package/LICENSE +114 -114
- package/README.md +362 -331
- package/dist/bin.js +2 -2
- package/dist/chunks/{ado-NLCWVIVQ.js → ado-XAHQWYNQ.js} +6 -6
- package/dist/chunks/{api-T5SWGOFX.js → api-7RAWLIQV.js} +1 -1
- package/dist/chunks/{api-YKKPVMTX.js → api-KN24TLH6.js} +1 -1
- package/dist/chunks/auth-VZSJMSMF.js +6 -0
- package/dist/chunks/azCli-AEZK2RBQ.js +2 -0
- package/dist/chunks/{batch-GCXLGQET.js → batch-EZPKLWEI.js} +1 -1
- package/dist/chunks/{build-XDCWMEEL.js → build-LSQEAEFK.js} +3 -3
- package/dist/chunks/{bulk-5QO343HO.js → bulk-7FZCDH5U.js} +1 -1
- package/dist/chunks/chunk-4KP27OCL.js +2 -0
- package/dist/chunks/chunk-B4FPKDMH.js +2 -0
- package/dist/chunks/chunk-BCAXUZIO.js +2 -0
- package/dist/chunks/{chunk-X7VWUI6N.js → chunk-BODUSF3V.js} +1 -1
- package/dist/chunks/{chunk-WXCLWAE2.js → chunk-DVQ7OYIJ.js} +1 -1
- package/dist/chunks/chunk-H4OY4EFC.js +3 -0
- package/dist/chunks/chunk-HIW2K6OP.js +4 -0
- package/dist/chunks/{chunk-GT52BRS2.js → chunk-I3TMFYRJ.js} +18 -18
- package/dist/chunks/{chunk-PDFXH652.js → chunk-KBQYSAJX.js} +1 -1
- package/dist/chunks/chunk-LB7WNZVK.js +5 -0
- package/dist/chunks/{chunk-J777TCSE.js → chunk-LL4XQ3L7.js} +1 -1
- package/dist/chunks/chunk-MBNUMAAZ.js +2 -0
- package/dist/chunks/{chunk-5KZDCOFA.js → chunk-MGZDEW3X.js} +1 -1
- package/dist/chunks/chunk-MK6QZ4ES.js +2 -0
- package/dist/chunks/chunk-MZEUD7ET.js +6 -0
- package/dist/chunks/{chunk-JGLUQBCK.js → chunk-OXZG44O5.js} +1 -1
- package/dist/chunks/{chunk-UWFDJKOJ.js → chunk-PYTSDUPY.js} +1 -1
- package/dist/chunks/{chunk-QE4DELWW.js → chunk-RC5VPVGC.js} +1 -1
- package/dist/chunks/chunk-STWQDANK.js +5 -0
- package/dist/chunks/{chunk-HLE2WURE.js → chunk-TADCW6ZI.js} +1 -1
- package/dist/chunks/{chunk-XL7E7LX5.js → chunk-TM3M633T.js} +2 -2
- package/dist/chunks/{chunk-UKKSN4F7.js → chunk-TXVNEV3M.js} +1 -1
- package/dist/chunks/{chunk-UYDBLVAM.js → chunk-WMDKJRDC.js} +1 -1
- package/dist/chunks/{chunk-NNHEYYF5.js → chunk-WNQERCOO.js} +1 -1
- package/dist/chunks/{commands-GHYN6GZT.js → commands-GRWX32IX.js} +1 -1
- package/dist/chunks/{component-PAASRIK6.js → component-TCL43QXZ.js} +1 -1
- package/dist/chunks/config-UKI5TBH5.js +2 -0
- package/dist/chunks/{connection-IWFELK5W.js → connection-QNXMJGHZ.js} +1 -1
- package/dist/chunks/{connref-ZDY7JYK5.js → connref-U3CMQ64O.js} +1 -1
- package/dist/chunks/{customizations-IE2KO275.js → customizations-VNEASPWI.js} +2 -2
- package/dist/chunks/{dependency-EFDSIKSN.js → dependency-U6OQA5PS.js} +1 -1
- package/dist/chunks/{discovery-XXVLVHD6.js → discovery-IWAWXXWF.js} +1 -1
- package/dist/chunks/{dv-3OESFBNW.js → dv-C45WDXRG.js} +21 -21
- package/dist/chunks/{env-MZPI3UA2.js → env-GL5ZPAZI.js} +1 -1
- package/dist/chunks/{environment-NUQHU74A.js → environment-FPS4AFM5.js} +1 -1
- package/dist/chunks/{environments-WMBLSAQF.js → environments-VZWNFJYE.js} +1 -1
- package/dist/chunks/{envvar-YN35IDWJ.js → envvar-52V6K6LF.js} +1 -1
- package/dist/chunks/{fanout-DUP5CD5X.js → fanout-Q3656CCP.js} +1 -1
- package/dist/chunks/{fetchxml-ONTNTA6Z.js → fetchxml-FWUQZP4M.js} +1 -1
- package/dist/chunks/{functions-K5TYRB2C.js → functions-SNCK2IYV.js} +1 -1
- package/dist/chunks/{graph-JI23YQB5.js → graph-OK24IOUV.js} +1 -1
- package/dist/chunks/{group-DKEPSVRV.js → group-TLGLTTUG.js} +2 -2
- package/dist/chunks/{history-SNSJRV6B.js → history-67SQS54S.js} +1 -1
- package/dist/chunks/identity-SRTOEQVC.js +2 -0
- package/dist/chunks/{jobs-PXNJFWWF.js → jobs-2ZPBDDHT.js} +1 -1
- package/dist/chunks/{lifecycle-7RMWV26J.js → lifecycle-OJRM7K2I.js} +1 -1
- package/dist/chunks/{main-ZVIKC3VA.js → main-HOYSLMHZ.js} +2 -2
- package/dist/chunks/{metadata-74WGGOV5.js → metadata-WYVJ7NP7.js} +1 -1
- package/dist/chunks/{metadataCreate-W3NDI5FB.js → metadataCreate-PBA3KH3A.js} +1 -1
- package/dist/chunks/msalUser-3PBGT655.js +2 -0
- package/dist/chunks/{names-SFYZQY6Q.js → names-ZRM6SAYU.js} +1 -1
- package/dist/chunks/{pack-2UDE25IY.js → pack-3OYGV36R.js} +1 -1
- package/dist/chunks/pat-KGOBISLG.js +2 -0
- package/dist/chunks/{pipelines-O3OYNCHT.js → pipelines-62CVDRXV.js} +1 -1
- package/dist/chunks/{plugins-EUDJ7QIS.js → plugins-SBMDFXVA.js} +1 -1
- package/dist/chunks/{policies-KVPQVUHS.js → policies-BZR5437X.js} +1 -1
- package/dist/chunks/{pools-7H2L4QJC.js → pools-I4NVR67Z.js} +1 -1
- package/dist/chunks/{process-G7LCTGKS.js → process-WS76WV3T.js} +1 -1
- package/dist/chunks/{projects-BHG2B4IX.js → projects-GXIQO7HV.js} +1 -1
- package/dist/chunks/protect-X2J7LU7X.js +2 -0
- package/dist/chunks/provider-FN7TXWRE.js +2 -0
- package/dist/chunks/{prs-NOXIZ7AT.js → prs-F2EVQJRV.js} +1 -1
- package/dist/chunks/{records-TN7ZKUJ7.js → records-7IQET422.js} +1 -1
- package/dist/chunks/run-APD3TRCW.js +2 -0
- package/dist/chunks/{run-MGLIIM7Z.js → run-G2MVOV3C.js} +1 -1
- package/dist/chunks/{run-JYU5BTWN.js → run-H2OLE76P.js} +1 -1
- package/dist/chunks/run-ICS4FNZA.js +3 -0
- package/dist/chunks/run-KP2SNX2A.js +3 -0
- package/dist/chunks/{run-BXFENCN6.js → run-LNEOCXZA.js} +1 -1
- package/dist/chunks/run-SB4QN5Q4.js +2 -0
- package/dist/chunks/run-XRPU3YZF.js +2 -0
- package/dist/chunks/{runtime-VOF7XYXW.js → runtime-MIU5CS5B.js} +1 -1
- package/dist/chunks/{security-FLEAZ4EA.js → security-RC3EI7CZ.js} +1 -1
- package/dist/chunks/{service-V2TQEEID.js → service-4VHAPTA6.js} +1 -1
- package/dist/chunks/{service-4PIAYFYF.js → service-RFKOKM72.js} +1 -1
- package/dist/chunks/services-4BORTJPM.js +2 -0
- package/dist/chunks/{skills-GD6Z6P3R.js → skills-6O2GSTU4.js} +1 -1
- package/dist/chunks/{solution-HF57MP27.js → solution-3WUUDYF3.js} +1 -1
- package/dist/chunks/{solutionExport-TLGHMUM5.js → solutionExport-GTBTHG2D.js} +1 -1
- package/dist/chunks/{solutionfiles-P223QW2J.js → solutionfiles-VWZHFZZ6.js} +1 -1
- package/dist/chunks/spn-2RZJLCML.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-JIBQKPYA.js} +1 -1
- package/dist/chunks/{vargroups-33EZAHGZ.js → vargroups-Q2KG7LHR.js} +1 -1
- package/dist/chunks/{whoami-ULK5UMZV.js → whoami-V54TCLT5.js} +1 -1
- package/dist/chunks/{workitems-YGES6KKN.js → workitems-UG5O3EGB.js} +1 -1
- package/package.json +57 -57
- package/schema/ppdo-cli.schema.json +16 -4
- package/skills/ppdo-cli/SKILL.md +1 -1
- package/dist/chunks/auth-IP7AOWSF.js +0 -6
- package/dist/chunks/azCli-T67ZMIC3.js +0 -2
- package/dist/chunks/chunk-3C3GSN3J.js +0 -2
- package/dist/chunks/chunk-4S5ETLH4.js +0 -2
- package/dist/chunks/chunk-5UOZCXQF.js +0 -5
- package/dist/chunks/chunk-BWZ6HZXM.js +0 -2
- package/dist/chunks/chunk-MME53RWW.js +0 -4
- package/dist/chunks/chunk-OP6EXLWQ.js +0 -5
- package/dist/chunks/chunk-RHQP7X6H.js +0 -3
- package/dist/chunks/config-JN3I5EII.js +0 -2
- package/dist/chunks/identity-OW4WCDOA.js +0 -2
- package/dist/chunks/msalUser-JRNX5HPO.js +0 -2
- package/dist/chunks/protect-WZO3MAHF.js +0 -2
- package/dist/chunks/provider-VXRAQRN2.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/services-B6V4VVX5.js +0 -2
- package/dist/chunks/spn-AIUWML5R.js +0 -2
- package/dist/chunks/tokenCache-3LMJRUTI.js +0 -2
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a as oe,e as I}from"./chunk-J4R6QXW7.js";import{a as se}from"./chunk-5SBBTR3Y.js";import{a as te}from"./chunk-UYDBLVAM.js";import{h as ne}from"./chunk-RHQP7X6H.js";import{a as re}from"./chunk-TQLZ3TRU.js";import{a as A,c as L,d as V,e as K,f as Z,g as Q,h as ee}from"./chunk-WXOTXJNG.js";import{execFileSync as xe}from"node:child_process";import{createWriteStream as Se,mkdirSync as be,readdirSync as _e,readFileSync as G,statSync as ve}from"node:fs";import D from"node:http";import N from"node:https";import{pipeline as Ce}from"node:stream/promises";import z from"node:tls";import{dirname as Ae,join as me,resolve as Oe}from"node:path";var ke=`ppdo-cli/${te}`,Le=new Set([429,502,503,504]),B=new Set(["GET","HEAD","PUT","DELETE","OPTIONS"]),ie=60,Ne=2,P=6,$e=300,F=class{constructor(e,t,n,s,i,o=null){this.status=e;this.reason=t;this.headers=n;this.body=s;this.url=i;this.savedTo=o}header(e){return this.headers[e.toLowerCase()]??null}get text(){return this.body.toString("utf8")}json(){return this.body.length?JSON.parse(this.body.toString("utf8")):null}get isJson(){return(this.header("content-type")??"").includes("json")}},H,$="";function ae(r){return r.match(/-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/g)??[]}function Ue(){let r=[],e=process.env.SSL_CERT_FILE;if(e)try{r.push(...ae(G(e,"latin1")))}catch{}let t=process.env.SSL_CERT_DIR;if(t)for(let n of t.split(process.platform==="win32"?";":":")){let s=[];try{s=_e(n)}catch{continue}for(let i of s)try{let o=me(n,i);ve(o).isFile()&&r.push(...ae(G(o,"latin1")))}catch{}}return r}function Ie(){let r=z;if(typeof r.getCACertificates!="function")return $="this Node cannot read the OS certificate store",null;let e=new Set;for(let t of["default","system"])try{for(let n of r.getCACertificates(t))e.add(n.trim())}catch(n){t==="system"&&($=`cannot read the OS certificate store (${n.message})`)}for(let t of Ue())e.add(t.trim());return[...e]}function Pe(){if(H===void 0){let r=Ie();try{H=r?z.createSecureContext({ca:r}):null}catch(e){$=`cannot load the certificate roots (${e.message})`,H=null}}return H??void 0}function He(){let r="behind TLS inspection? the proxy's root CA must be in the OS store, or set SSL_CERT_FILE";return $?`${r}; ${$}: set NODE_USE_SYSTEM_CA=1`:r}var De=new Set(["UNABLE_TO_VERIFY_LEAF_SIGNATURE","UNABLE_TO_GET_ISSUER_CERT","UNABLE_TO_GET_ISSUER_CERT_LOCALLY","SELF_SIGNED_CERT_IN_CHAIN","DEPTH_ZERO_SELF_SIGNED_CERT","CERT_HAS_EXPIRED","CERT_NOT_YET_VALID","CERT_UNTRUSTED","CERT_REVOKED","CERT_SIGNATURE_FAILURE","CERT_CHAIN_TOO_LONG","HOSTNAME_MISMATCH"]);function ye(r){let e=r,t=typeof e?.code=="string"?e.code:"";return De.has(t)||t.startsWith("ERR_SSL_")||t.startsWith("ERR_TLS_")||e?.library==="SSL routines"}var Fe="HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",v;function Me(r){let e={};for(let t of r.split(/\r?\n/)){let n=/^\s+(\S(?:.*?\S)?)\s+(REG_[A-Z_]+)(?:\s+(.*))?$/.exec(t);if(!n)continue;let[,s="",i="",o=""]=n;e[s]=i==="REG_DWORD"||i==="REG_QWORD"?String(parseInt(o.trim(),16)||0):o.trim()}return e}function qe(r){if(!Number(r.ProxyEnable??"0"))return[{},[]];let e=r.ProxyServer??"",t=r.ProxyOverride??"",n={};if(e.includes("="))for(let s of e.split(";")){let i=s.indexOf("=");i>=0&&(n[s.slice(0,i).trim().toLowerCase()]=s.slice(i+1).trim())}else e&&(n={http:e,https:e});return[n,t.split(";").map(s=>s.trim()).filter(s=>s)]}var Ge=3600;function Ee(){return me(re(),"proxy-registry.json")}function Be(){try{let r=JSON.parse(G(Ee(),"utf8"));return typeof r.checked!="number"||Date.now()/1e3-r.checked>Ge||r.checked>Date.now()/1e3+60||typeof r.proxies!="object"||r.proxies===null||!Array.isArray(r.override)?null:[r.proxies,r.override.map(String)]}catch{return null}}function Re(){let r="";try{r=xe("reg.exe",["query",Fe],{encoding:"utf8",windowsHide:!0,timeout:5e3,stdio:["ignore","pipe","ignore"]})}catch{r=""}let e=qe(Me(r));try{ne(Ee(),JSON.stringify({checked:Math.trunc(Date.now()/1e3),proxies:e[0],override:e[1]}))}catch{}return e}function je(){if(process.platform!=="win32")return[{},[]];if(v)return v.value;let r=Be();return v=r?{value:r,cached:!0}:{value:Re(),cached:!1},v.value}function We(){if(process.platform!=="win32"||!v?.cached)return!1;let r=JSON.stringify(v.value);return v={value:Re(),cached:!1},JSON.stringify(v.value)!==r}function Ye(r,e){let t="";for(let n=0;n<e.length;n++){let s=e[n];if(s==="*")t+=".*";else if(s==="?")t+=".";else if(s==="["){let i=e.indexOf("]",n+2);if(i<0)t+="\\[";else{let o=e.slice(n+1,i).replace(/\\/g,"\\\\");o.startsWith("!")?o="^"+o.slice(1):o.startsWith("^")&&(o="\\"+o),t+=`[${o}]`,n=i}}else t+=s.replace(/[.+^${}()|\\/]/g,"\\$&")}return new RegExp(`^${t}$`,"s").test(r)}function ue(r,e){r=r.toLowerCase();for(let t of e)if(t=t.toLowerCase(),t==="<local>"){if(!r.includes("."))return!0}else{if(t==="*"||Ye(r,t))return!0;if(t.startsWith(".")&&r.endsWith(t))return!0;if(r===t||r.endsWith("."+t.replace(/^[*.]+/,"")))return!0}return!1}function ce(r,e){let t=process.env,n=t.NO_PROXY||t.no_proxy||"";if(n&&ue(e,n.split(",").map(o=>o.trim()).filter(o=>o)))return null;for(let o of[`${r.toUpperCase()}_PROXY`,`${r}_proxy`]){let a=t[o];if(a)return a}let[s,i]=je();return!Object.keys(s).length||ue(e,i)?null:s[r]||s.http||null}function le(r){return new URL(r.includes("://")?r:"http://"+r)}function we(r){if(!r.username)return{};let e=`${decodeURIComponent(r.username)}:${decodeURIComponent(r.password)}`;return{"Proxy-Authorization":"Basic "+Buffer.from(e,"utf8").toString("base64")}}var j=class extends Error{code="EPROXY"},k=class extends Error{code="ETIMEDOUT"};function Je(r,e,t,n,s){return new Promise((i,o)=>{let a=`${e.includes(":")?`[${e}]`:e}:${t}`,c=r.protocol==="https:",T={host:r.hostname.replace(/^\[|\]$/g,""),port:Number(r.port)||(c?443:80),method:"CONNECT",path:a,headers:{Host:a,...we(r)},agent:!1,...c&&s?{secureContext:s}:{}},d=(c?N:D).request(T),h=!1,g=y=>{h||(h=!0,d.destroy(),o(y))};d.setTimeout(n,()=>g(new k(`proxy ${r.host} timed out`))),d.once("connect",(y,u,E)=>{if(!h){if(y.statusCode===200){h=!0,d.setTimeout(0),E.length&&u.unshift(E),i(u);return}u.destroy(),g(new j(`Tunnel connection failed: ${y.statusCode} ${y.statusMessage??""}`.trim()))}}),d.once("error",g),d.end()})}var W=class extends N.Agent{constructor(t,n){super(n);this.proxy=t}createConnection(t,n){let s=String(t.host??t.hostname??"localhost"),i=Number(t.port)||443,o=typeof t.timeout=="number"&&t.timeout>0?t.timeout:6e4;Je(this.proxy,s,i,o,this.options.secureContext).then(a=>{let c=z.connect({...t,socket:a});n?.(null,c)},a=>n?.(a,void 0))}},ze=new Set(["ECONNRESET","EPIPE","ECONNABORTED"]),Y=class{timeout;agents=new Map;constructor(e=60){this.timeout=e}agent(e,t){let n=`${e} ${t?.href??""}`,s=this.agents.get(n);if(!s){let i=e==="https"||t?.protocol==="https:"?Pe():void 0,o={keepAlive:!0,...i?{secureContext:i}:{}};e==="https"&&t?s=new W(t,o):e==="https"||t?.protocol==="https:"?s=new N.Agent(o):s=new D.Agent({keepAlive:!0}),this.agents.set(n,s)}return s}async request(e,t,n={},s=null,i={}){let o=new URL(t),a=I(t),c=o.protocol==="http:"?"http":"https",T=o.hostname.replace(/^\[|\]$/g,""),d=Number(o.port)||(c==="https"?443:80),h=a.path||"/";a.query&&(h+="?"+a.query);let g={"User-Agent":ke,"Accept-Encoding":"identity",...n},y=Math.max(1,Math.round((i.timeout??this.timeout)*1e3)),u=ce(c,T),E=u?le(u):null,R=!1;for(let C=1;;C++)try{return await this.once(e,t,c,T,d,h,g,s,y,E,i.saveTo??null)}catch(m){let w=m;if(w.reused&&C===1&&ze.has(w.code??""))continue;if(!R&&typeof w.code=="string"&&!ye(w)&&(R=!0,We())){let f=ce(c,T);if(f!==u){u=f,E=f?le(f):null;continue}}throw m}}once(e,t,n,s,i,o,a,c,T,d,h){return new Promise((g,y)=>{let u,E;if(d&&n==="http"){let f=d.protocol==="https:";E=f?N:D,u={host:d.hostname.replace(/^\[|\]$/g,""),port:Number(d.port)||(f?443:80),path:`http://${s}:${i}${o}`,headers:{Host:i===80?s:`${s}:${i}`,...a,...we(d)}}}else E=n==="https"?N:D,u={host:s,port:i,path:o,headers:a};u.method=e,u.agent=this.agent(n,d),u.timeout=T;let R=!1,C=!1,m=E.request(u),w=f=>{if(R)return;R=!0;let x=C?new k(`timed out after ${T} ms`):f;x.reused=m.reusedSocket,m.destroy(),y(x)};m.on("timeout",()=>{C=!0,m.destroy(new k("timeout"))}),m.on("error",w),m.on("response",f=>{let x={},O=f.rawHeaders;for(let b=0;b+1<O.length;b+=2){let S=O[b].toLowerCase(),X=O[b+1];x[S]=S in x?`${x[S]}, ${X}`:X}let p=f.statusCode??0,l=f.statusMessage??"";if(f.on("error",w),f.on("aborted",()=>w(Object.assign(new Error("aborted"),{code:"ECONNRESET"}))),h&&p>=200&&p<300){let b=Oe(h);try{be(Ae(b),{recursive:!0})}catch(S){w(S);return}Ce(f,Se(h)).then(()=>{R||(R=!0,g(new F(p,l,x,Buffer.alloc(0),t,h)))},S=>w(S));return}let U=[];f.on("data",b=>U.push(b)),f.on("end",()=>{R||(R=!0,g(new F(p,l,x,Buffer.concat(U),t)))})}),c&&c.length?m.end(Buffer.from(c.buffer,c.byteOffset,c.byteLength)):m.end()})}close(){for(let e of this.agents.values())e.destroy();this.agents.clear()}},Xe;function Ve(){return Xe??=new Y}function de(r,e=Date.now()){if(!r)return null;let t=r.trim();if(/^[+-]?(\d+\.?\d*|\.\d+)(e[+-]?\d+)?$/i.test(t))return Math.max(0,Number(t));if(!/[A-Za-z]{3}/.test(t))return null;let n=Date.parse(/GMT|UTC|[+-]\d{4}$/.test(t)?t:t+" GMT");return Number.isNaN(n)?null:Math.max(0,(n-e)/1e3)}function Ke(r,e){return Le.has(e)?e===429||B.has(r.toUpperCase()):!1}function fe(r,e=30){return Math.random()*Math.min(e,2**r)}var Ze=new Set(["authorization","proxy-authorization","cookie","set-cookie"]);function Qe(r){let e={};for(let[t,n]of Object.entries(r))e[t]=Ze.has(t.toLowerCase())?"<redacted>":n;return e}var J=class extends A{constructor(e="dry run"){super(e,{exitCode:0})}},pe=class{defaultHeaders(){return{Accept:"application/json"}}requestId(e){return null}error(e){return et(this.name,e,null,null)}authTrap(e){return null}};function et(r,e,t,n,s=null,i=null){let o=e.status,a=n||`HTTP ${o} ${e.reason}`.trim();o===403&&i===null&&(i="signed in, but this account lacks permission for the request");let c={service:r,status:o};switch(t&&(c.code=t),s&&(c.requestId=s),i!==null&&(c.hint=i),o){case 401:return new L(a,c);case 403:return new ee(a,c);case 404:return new V(a,c);case 409:case 412:return new Z(a,c);case 429:return new K(a,c);default:return new A(a,c)}}var tt=["login.microsoftonline.com","login.windows.net","login.live.com"],M="run: ppdo-cli auth login <identity>",q=r=>new Promise(e=>setTimeout(e,Math.max(0,r*1e3))),_=()=>performance.now()/1e3,rt=":/?#[]@!$&'()*+,;=%~",he=class{service;rt;tokenFn;http;target=null;identity=null;token=null;notBefore=0;inLookups=!1;also=[];constructor(e,t,n,s=Ve()){this.service=e,this.rt=t,this.tokenFn=n,this.http=s}async lookups(e,t=[]){this.inLookups=!0,this.also=t.map(n=>n.toLowerCase());try{return await e()}finally{this.inLookups=!1,this.also=[]}}async request(e,t,n={}){e=e.toUpperCase();let s=oe(this.service.url(t,n.params??null),rt);if(!this.service.allowed(s)){let a="";try{a=new URL(s).hostname}catch{a=I(s).netloc}throw new Q(`refusing to send a ${this.service.name} token to ${a||"None"}`,{hint:"absolute URLs must belong to the environment's own host or organization",service:this.service.name})}let i={...this.service.defaultHeaders(),...n.headers??{}},o=n.body??null;return o!==null&&!Object.keys(i).some(a=>a.toLowerCase()==="content-type")&&(i["Content-Type"]="application/json"),this.rt.dryRun&&!(this.inLookups&&this.isRead(e,s))&&await this.dryRun(e,s,i,o),this.send(e,s,i,o,n.saveTo??null,n.check??!0)}async*paginate(e,t){let n=0,s=await this.request("GET",e,{params:t.params??null,headers:t.headers??null}),i=t.limit??null;for(;;){for(let a of t.items(s))if(yield a,n++,i!==null&&n>=i)return;let o=t.nextLink(s);if(!o)return;s=await this.request("GET",o,{headers:t.headers??null})}}isRead(e,t){if(e==="GET"||e==="HEAD")return!0;if(e!=="POST")return!1;let n=I(t).path.replace(/\/+$/,""),s=n.slice(n.lastIndexOf("/")+1).toLowerCase();return this.also.includes(s)||se(this.service.name,t)}async dryRun(e,t,n,s){let i=null;if(s!==null){let o=Buffer.from(s).toString("utf8");try{i=JSON.parse(o)}catch{i=o}}throw await this.rt.emit({dry_run:!0,method:e,url:t,headers:Qe(n),body:i}),new J("dry run")}async authHeader(e=!1){return this.tokenFn===null?"":((e||this.token===null)&&(this.token=await this.tokenFn(e)),"Bearer "+this.token)}async send(e,t,n,s,i,o){let a=this.service.name,c=_()+(this.rt.timeout||$e),T=!1,d=0,h=0,g=t,y=!0,u;for(;;){d++;let E=this.notBefore-_();E>0&&(this.rt.log(`throttle: waiting ${E.toFixed(1)}s (Retry-After from an earlier response)`),await q(E));let R={...n};y&&this.tokenFn!==null&&(R.Authorization=await this.authHeader());let C=_();this.rt.log(`-> ${e} ${g}`);let m=ge(g);try{u=await this.http.request(e,g,R,s,{timeout:Math.min(120,Math.max(5,c-_())),saveTo:i})}catch(p){let l=p;if(l instanceof A)throw l;if(l instanceof k||l.code==="ETIMEDOUT"){if(B.has(e)&&d<P&&_()<c){this.rt.log(` timeout (${l.message}); retrying`);continue}throw new A(`request timed out: ${e} ${g}`,{service:a})}if(ye(l))throw new A(`TLS error talking to ${m}: ${l.message}`,{service:a,hint:He()});if(typeof l.code!="string")throw p;let U=l.code==="ENOTFOUND"||l.code==="EAI_AGAIN"||l.code==="EAI_FAIL";if((l.code==="ECONNREFUSED"||B.has(e))&&!U&&d<P&&_()<c){let S=fe(d);this.rt.log(` connection error (${l.message}); retrying in ${S.toFixed(1)}s`),await q(S);continue}throw new A(`cannot reach ${m}: ${l.message}`,{service:a,hint:"check the network, proxy (HTTPS_PROXY) and the URL"})}let w=(_()-C)*1e3,f=this.service.requestId(u);this.rt.log(`<- ${u.status} ${u.reason} (${w.toFixed(0)} ms)`+(f?` request-id=${f}`:""));let x=de(u.header("retry-after"));x&&u.status<400&&(this.notBefore=_()+Math.min(x,ie));let O=this.service.authTrap(u);if(O)throw new L(O,{service:a,status:u.status,hint:M});if(u.status===401&&y&&this.tokenFn!==null){let p=u.header("www-authenticate")??"";if(p.includes("insufficient_claims")||p.includes("claims="))throw new L("the service requires a fresh sign-in (claims challenge)",{service:a,status:401,hint:M});if(!T){T=!0,this.rt.log(" 401: refreshing the token once"),await this.authHeader(!0);continue}}if(u.status>=300&&u.status<400&&u.status!==304){let p=u.header("location");if(!p)break;try{p=new URL(p,g).toString()}catch{break}let l=ge(p);if(tt.includes(l)||p.includes("_signin"))throw new L("the service redirected to a sign-in page (token rejected)",{service:a,status:u.status,hint:M});if(h++,h>5||e!=="GET"&&e!=="HEAD")break;g=p,y=!1,this.rt.log(` redirect to ${l} (without Authorization)`);continue}if(Ke(e,u.status)&&d<P){let p=de(u.header("retry-after")),l=p!==null?Math.min(p,ie):u.status===429?Ne:fe(d);if(_()+l<c){this.rt.log(` ${u.status}: retrying in ${l.toFixed(1)}s (attempt ${d}/${P})`),await q(l);continue}}break}if(o&&u.status>=400)throw this.service.error(u);return u}};function ge(r){try{return new URL(r).hostname}catch{return""}}export{Ve as a,pe as b,et as c,he as d};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{q as m,s as g}from"./chunk-OP6EXLWQ.js";import{b as l,g as d}from"./chunk-WXOTXJNG.js";function h(n){return new Promise((t,o)=>{let e="",s=a=>{n.off("data",i),n.off("end",r),n.off("error",c),n.pause(),t(a)},i=a=>{e+=a.toString();let f=e.indexOf(`
|
|
3
|
-
`);f>=0&&s(e.slice(0,f))},r=()=>s(e),c=a=>{n.off("data",i),n.off("end",r),o(a)};n.on("data",i),n.once("end",r),n.once("error",c),n.resume()})}async function w(n,t,o={stdin:process.stdin,stderr:process.stderr}){if(!(o.stdin.isTTY&&o.stderr.isTTY))throw new d(`changing '${n}' needs a person: ${t.join("; ")}`,{hint:"ask the user to run this command themselves in a terminal"});if(o.stderr.write(`This widens what agents can change:
|
|
4
|
-
`+t.map(e=>` - ${e}
|
|
5
|
-
`).join("")+`Type '${n}' to confirm: `),(await h(o.stdin)).trim()!==n)throw new d("not confirmed; nothing was changed")}async function p(n,t,o){let e=await m.load(),s=e.clone();await t(s),s.validate();let i=g(e,s);return i.length&&await w(n,i,o),m.edit(async r=>{let c=r.clone(),a=await t(r);if(r.validate(),g(c,r).some(f=>!i.includes(f)))throw new l("the config changed while confirming; run the command again");return a})}export{p as a};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a as v,b as w}from"./chunk-MTF66YXU.js";import{b as y,c as f}from"./chunk-4S5ETLH4.js";import{a,c as l,d as u,e as c,f as d,g as p}from"./chunk-J4R6QXW7.js";import{b as g,h as m}from"./chunk-WXOTXJNG.js";var b="499b84ac-1321-427f-aa17-267ca6975798",k="7.1";function h(o){return typeof o=="object"&&o!==null&&!Array.isArray(o)}var j=class extends y{name="devops";org;project;hostKey;apiVersion;constructor(e,t="core",n){super(),this.org=e.org??"",this.project=e.project??null,this.hostKey=t,this.apiVersion=n||k}scope(){return b+"/.default"}base(){return`https://${this.hostKey==="core"?"dev.azure.com":`${this.hostKey}.dev.azure.com`}/${a(this.org)}/`}expand(e){if(e.includes("{project}")){if(!this.project)throw new g("the path uses {project} but the environment has no DevOps project",{hint:"ask the user to set one: ppdo-cli env update <name> --devops-project <project>"});e=e.split("{project}").join(a(this.project))}return e}url(e,t){e=this.expand(e);let n=e.includes("://")?e:this.base()+e.replace(/^\/+/,""),r=c(n),i=[...u(r.query),...t??[]],s=p(n).host||r.netloc.toLowerCase();return!(r.path.includes("/_odata/")||s==="analytics.dev.azure.com")&&!i.some(([x])=>x.toLowerCase()==="api-version")&&i.push(["api-version",this.apiVersion]),d({...r,query:l(i,"$'(),/:@*"),fragment:""})}allowed(e){let t=p(e);if(t.scheme!=="https"||!t.host)return!1;let n=this.org.toLowerCase();if(new Set(["dev.azure.com",...v.filter(s=>s!=="core").map(s=>`${s}.dev.azure.com`)]).has(t.host)){let s=(t.path.replace(/^\/+/,"").split("/",1)[0]??"").toLowerCase();return s===n||s===a(n).toLowerCase()}return new Set([`${n}.visualstudio.com`,...w.map(s=>`${n}.${s}.visualstudio.com`)]).has(t.host)}requestId(e){return e.header("activityid")||e.header("x-vss-e2eid")}authTrap(e){let t=e.header("content-type")??"";return e.status===203||e.status>=200&&e.status<300&&t.includes("text/html")&&e.body.subarray(0,2e3).toString("latin1").toLowerCase().includes("<html")?"Azure DevOps returned a sign-in page instead of data (the token was rejected)":null}error(e){let t=null,n=null,r=null;if(e.body.length)try{let i=e.json(),s=h(i)?i:{};n=typeof s.message=="string"?s.message:null,t=typeof s.typeKey=="string"&&s.typeKey||(s.errorCode?String(s.errorCode):null)||null}catch{n=e.text.trim().slice(0,300)||null}if(n&&n.includes("TF401444"))r="a service principal must be added to the organization first: Organization settings > Users > Add users, with an access level and project permissions";else if(e.status===401||n&&n.includes("TF400813"))r="this account isn't a member of the organization, or the token is for another tenant";else if(e.status===404)r="404 also means 'no permission to see it' in Azure DevOps";else if(t==="WorkItemTrackingFieldDefinitionNotFoundException")r="use the field's reference name (e.g. Microsoft.VSTS.Common.Priority) or a System field name";else if(t==="GitPullRequestUpdateRejectedByPolicyException")r="a branch policy isn't passing yet (approvals, builds, linked work items): ppdo-cli ado pr checks <pr> shows which; get it passing, don't bypass it";else if(t==="TestPatchOperationFailedException")r="the work item changed after ppdo-cli read it; run the command again";else if(t==="VssInvalidPreviewVersionException")r="this endpoint is preview-only: pass --api-version <version>-preview";else if(n&&n.includes("VS403664")){let i=this.requestId(e);return new m(n,{service:this.name,status:e.status,...t?{code:t}:{},...i?{requestId:i}:{},hint:"only a comment's author can edit or delete it"})}return f(this.name,e,t,n,this.requestId(e),r)}};function q(o){let e=o.header("x-ms-continuationtoken");if(e){let n=c(o.url),r=u(n.query).filter(([i])=>i!=="continuationToken");return r.push(["continuationToken",e]),d({...n,query:l(r),fragment:""})}let t=o.isJson?o.json():null;return h(t)&&t["@odata.nextLink"]?String(t["@odata.nextLink"]):null}function O(o){let e=o.isJson?o.json():null;return h(e)&&Array.isArray(e.value)?e.value:Array.isArray(e)?e:e!=null?[e]:[]}export{b as a,k as b,j as c,q as d,O as e};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a as O,b as M,c as N,j as F}from"./chunk-GT52BRS2.js";import{a as D,b as K,e as _}from"./chunk-3C3GSN3J.js";import{a as P,b as k,c as B}from"./chunk-WXOTXJNG.js";import{createHash as V,createPrivateKey as me}from"node:crypto";import{existsSync as ye,readFileSync as Z,statSync as ve}from"node:fs";import{createDecipheriv as z,createHash as H,createPrivateKey as U,pbkdf2Sync as ee,X509Certificate as te}from"node:crypto";var l=class extends Error{};function S(e,n){if(n+2>e.length)throw new l("truncated DER");let o=e[n];if((o&31)===31)throw new l("unsupported DER tag");let t=n+1,r=e[t++];if(r===128){let a=t;for(;;){if(t+2>e.length)throw new l("truncated BER");if(e[t]===0&&e[t+1]===0)return{tag:o,value:e.subarray(a,t),end:t+2};t=S(e,t).end}}let c=r;if(r&128){let a=r&127;if(a>4)throw new l("DER length too long");c=0;for(let f=0;f<a;f++)c=c*256+e[t++]}if(t+c>e.length)throw new l("truncated DER");return{tag:o,value:e.subarray(t,t+c),end:t+c}}function u(e){let n=[];for(let o=0;o<e.value.length;){let t=S(e.value,o);n.push(t),o=t.end}return n}function C(e){return S(e,0)}function d(e,n,o){let t=e[n];if(!t)throw new l(`missing ${o}`);return t}function y(e){if(e.tag===4)return e.value;if(e.tag===36)return Buffer.concat(u(e).map(y));throw new l("expected an OCTET STRING")}function b(e){if(e.tag!==160)throw new l("expected [0]");return d(u(e),0,"[0] content")}function x(e){if(e.tag!==6)throw new l("expected an OID");let n=e.value,o=[],t=0;for(let r=0;r<n.length;r++)t=t*128+(n[r]&127),n[r]&128||(o.length?o.push(t):o.push(t<80?Math.floor(t/40):2,t<80?t%40:t-80),t=0);return o.join(".")}function Y(e){if(e.tag!==2)throw new l("expected an INTEGER");let n=0;for(let o of e.value)n=n*256+o;return n}var G="1.2.840.113549.1.7.1",ne="1.2.840.113549.1.7.6",re="1.2.840.113549.1.12.10.1.1",oe="1.2.840.113549.1.12.10.1.2",se="1.2.840.113549.1.12.10.1.3",ce="1.2.840.113549.1.9.22.1",ie="1.2.840.113549.1.9.21",ae="1.2.840.113549.1.5.13",fe="1.2.840.113549.1.5.12",le="1.2.840.113549.1.12.1.3",j="1.2.840.113549.1.12.1.4",ue="1.2.840.113549.1.12.1.5",pe="1.2.840.113549.1.12.1.6",de={"1.2.840.113549.2.7":"sha1","1.2.840.113549.2.8":"sha224","1.2.840.113549.2.9":"sha256","1.2.840.113549.2.10":"sha384","1.2.840.113549.2.11":"sha512"},he={"2.16.840.1.101.3.4.1.2":["aes-128-cbc",16],"2.16.840.1.101.3.4.1.22":["aes-192-cbc",24],"2.16.840.1.101.3.4.1.42":["aes-256-cbc",32],"1.2.840.113549.3.7":["des-ede3-cbc",24]};function L(e,n,o,t,r){let f=g=>{if(!g.length)return Buffer.alloc(0);let m=Buffer.alloc(64*Math.ceil(g.length/64));for(let p=0;p<m.length;p++)m[p]=g[p%g.length];return m},s=Buffer.alloc(64,o),i=Buffer.concat([f(n),f(e)]),h=[],w=0;for(;w<r;){let g=H("sha1").update(s).update(i).digest();for(let p=1;p<t;p++)g=H("sha1").update(g).digest();if(h.push(g),w+=20,w>=r)break;let m=Buffer.alloc(64);for(let p=0;p<64;p++)m[p]=g[p%20];for(let p=0;p<i.length;p+=64){let E=1;for(let v=63;v>=0;v--){let T=i[p+v]+m[v]+E;i[p+v]=T&255,E=T>>8}}}return Buffer.concat(h).subarray(0,r)}var ge=[Buffer.from([0,0]),Buffer.alloc(0)];function W(e,n,o,t){let r=z(e,n,o);return Buffer.concat([r.update(t),r.final()])}function X(e,n,o){let t=u(e),r=x(d(t,0,"algorithm")),c=t[1],a=[];if(r===ae&&c){let[s,i]=u(c);if(!s||!i)throw new l("bad PBES2 parameters");let h=u(s);if(x(d(h,0,"KDF"))!==fe)throw new l("unsupported key derivation");let w=u(d(h,1,"PBKDF2 parameters")),g=y(d(w,0,"salt")),m=Y(d(w,1,"iterations")),p="sha1";for(let A of w.slice(2))A.tag===48&&(p=de[x(d(u(A),0,"PRF"))]??"");if(!p)throw new l("unsupported PRF");let E=u(i),v=he[x(d(E,0,"cipher"))];if(!v)throw new l("unsupported cipher");let T=y(d(E,1,"IV"));a.push(()=>W(v[0],ee(Buffer.alloc(0),g,m,v[1],p),T,n))}else if((r===le||r===j)&&c){let s=u(c),i=y(d(s,0,"salt")),h=Y(d(s,1,"iterations"));for(let w of ge)a.push(()=>{let g=L(w,i,1,h,24);return r===j&&(g=Buffer.concat([g.subarray(0,16),g.subarray(0,8)])),W("des-ede3-cbc",g,L(w,i,2,h,8),n)})}else throw r===pe||r===ue?new l("it uses RC2 encryption, which Node cannot decrypt"):new l(`unsupported encryption ${r}`);let f;for(let s of a)try{let i=s();return o(i),i}catch(i){f=i}throw new l(`cannot decrypt it without a password (${f?.message??"no key"})`)}function I(e){let n=e[2];if(!n||n.tag!==49)return null;for(let o of u(n)){let[t,r]=u(o);if(t&&r&&x(t)===ie){let c=u(r)[0];if(c)return y(c).toString("hex")}}return null}function J(e,n){for(let o of u(C(e))){let t=u(o),r=x(d(t,0,"bag type")),c=b(d(t,1,"bag value"));if(r===re)n.keys.push({der:we(c),id:I(t)});else if(r===oe){let[a,f]=u(c);if(!a||!f)throw new l("bad shrouded key bag");let s=X(a,y(f),i=>{U({key:i,format:"der",type:"pkcs8"})});n.keys.push({der:s,id:I(t)})}else if(r===se){let a=u(c);if(x(d(a,0,"certificate type"))!==ce)continue;n.certs.push({der:y(b(d(a,1,"certificate"))),id:I(t)})}}}function we(e){let n=e.value.length,o;if(n<128)o=[e.tag,n];else{let t=[];for(let r=n;r>0;r=Math.floor(r/256))t.unshift(r&255);o=[e.tag,128|t.length,...t]}return Buffer.concat([Buffer.from(o),e.value])}function q(e){let n=u(C(e)),o=u(d(n,1,"authSafe"));if(x(d(o,0,"content type"))!==G)throw new l("it is signed, not password-protected");let t={keys:[],certs:[]};for(let f of u(C(y(b(d(o,1,"content")))))){let s=u(f),i=x(d(s,0,"content type"));if(i===G)J(y(b(d(s,1,"content"))),t);else if(i===ne){let h=u(b(d(s,1,"content"))),w=u(d(h,1,"encrypted content info")),g=d(w,1,"algorithm"),m=w[2];if(!m)continue;let p=m.tag===160?Buffer.concat(u(m).map(y)):m.value;J(X(g,p,E=>{u(C(E))}),t)}}let r=t.keys[0];if(!r)throw new l("it has no private key");if(!t.certs.length)throw new l("it has no certificate");let c=U({key:r.der,format:"der",type:"pkcs8"}),a=r.id&&t.certs.find(f=>f.id===r.id)||t.certs.find(f=>{try{return new te(f.der).checkPrivateKey(c)}catch{return!1}})||t.certs[0];return{privateKey:c.export({type:"pkcs8",format:"pem"}).toString(),certificate:a.der}}var R=new Map,$=new Map,Q={7000215:"the client secret is wrong: check {where}",7000222:"the client secret has expired: create a new one on the app registration and update {where}",700016:"no app with this client id in tenant '{tenant}': check --client-id and --tenant",90002:"tenant '{tenant}' was not found: check --tenant",700027:"the certificate is not registered on the app, or its key doesn't match"};function xe(e){return e.certificate?e.certificate:e.secretEnv||"the secret"}function Ee(e){let n=e.replace(/\$(\w+)|\$\{([^}]*)\}/g,(o,t,r)=>process.env[t??r]??o);if(process.platform==="win32"&&(n=n.replace(/%([^%]+)%/g,(o,t)=>process.env[t]??o)),n==="~"||n.startsWith("~/")||n.startsWith("~\\")){let o=process.env.USERPROFILE||process.env.HOME||"";o&&(n=o+n.slice(1))}return n}function ke(e){let n=process.stdin;return new Promise((o,t)=>{process.stderr.write(e);let r="",c=n.isRaw;n.setRawMode?.(!0),n.resume(),n.setEncoding("utf8");let a=s=>{n.setRawMode?.(c??!1),n.pause(),n.off("data",f),process.stderr.write(`
|
|
3
|
-
`),s?t(s):o(r)},f=s=>{for(let i of s){let h=i.charCodeAt(0);if(i==="\r"||i===`
|
|
4
|
-
`||h===4)return a();if(h===3)return a(Object.assign(new Error("interrupted"),{code:"SIGINT"}));h===8||h===127?r=r.slice(0,-1):h>=32&&(r+=i)}};n.on("data",f)})}var Be=/-----BEGIN ([A-Z ]+)-----[\s\S]+?-----END \1-----/g;function be(e){e=Ee(e);let n=e.toLowerCase();if(n.endsWith(".pfx")||n.endsWith(".p12")){if(!ye(e)||!ve(e).isFile())throw new k(`cannot read certificate ${e}: no such file`);let s;try{s=q(Z(e))}catch(i){let h=i instanceof Error?i.message:String(i);throw new k(`cannot read certificate ${e}: ${h}`,{hint:i instanceof l?"export it again without a password, or convert it to PEM: openssl pkcs12 -in <pfx> -nodes -out <pem>":void 0})}return{privateKey:s.privateKey,thumbprint:V("sha1").update(s.certificate).digest("hex")}}let o;try{let s=Z(e);if(s.some(i=>i>127))throw new Error("'ascii' codec can't decode the file");o=s.toString("ascii")}catch(s){let i=s,h=i.code==="ENOENT"?`[Errno 2] No such file or directory: '${e}'`:i.message;throw new k(`cannot read certificate ${e}: ${h}`)}let t=new Map;for(let s of o.matchAll(Be))t.set(s[1],s[0]);let r=t.get("CERTIFICATE"),c=[...t].find(([s])=>s.endsWith("PRIVATE KEY")&&!s.includes("ENCRYPTED"))?.[1];if(!r||!c){let s=c?"the certificate":"an unencrypted private key";throw new k(`${e} has no ${s}`,{hint:"the PEM file needs both the private key and the certificate"})}let a=Buffer.from(r.replace(/-----[A-Z ]+-----/g,"").replace(/\s+/g,""),"base64"),f;try{f=me(c).export({type:"pkcs8",format:"pem"}).toString()}catch(s){throw new k(`cannot read certificate ${e}: ${s.message}`)}return{privateKey:f,thumbprint:V("sha1").update(a).digest("hex")}}async function Te(e){let n=JSON.stringify([e.clientId,e.tenant,e.certificate]),o=e.ephemeral?$.get(n):void 0;if(o!==void 0)return o;let t;if(e.certificate)t=be(e.certificate);else{let r=process.env[e.secretEnv||""]||"";if(!r&&e.ephemeral&&process.stdin.isTTY&&process.stderr.isTTY&&(r=await ke(`Client secret for app ${e.clientId}: `)),!r)throw new B(`no client secret for app ${e.clientId}`,{hint:`set ${e.secretEnv}, or pass --certificate <pem|pfx>`});t=r}return e.ephemeral&&$.set(n,t),t}function Ce(e,n){if(e instanceof P)throw e;let o=e instanceof O?e:M();if(o)throw new P(`cannot reach login.microsoftonline.com: ${o.message}`,{hint:"check the network and proxy (HTTPS_PROXY)"});let t=F(e);if(!t)throw e;if(!(e.name==="ServerError"||t.codes.length>0)){let f=(t.description.split(/\r?\n/)[0]??"").split(". ")[0];throw new B(`cannot sign in as app ${n.clientId}: ${f}`,{hint:"check --tenant, and --certificate if given"})}let c=t.codes.find(f=>f in Q),a=(c!==void 0?Q[c]:"check --client-id, --tenant and the secret or certificate").replace("{where}",xe(n)).replace("{tenant}",n.tenant);throw new B(`sign-in as app ${n.clientId} failed: ${t.description}`,{code:t.error,hint:a})}async function Pe(e,n){let o=await Te(e),t=await import("./dist-ILNYGTM2.js"),r;try{r=await new t.ConfidentialClientApplication({auth:{clientId:e.clientId??"",authority:`https://login.microsoftonline.com/${e.tenant}`,...typeof o=="string"?{clientSecret:o}:{clientCertificate:o}},system:{networkClient:new N}}).acquireTokenByClientCredential({scopes:[n]})}catch(a){Ce(a,e)}if(!r?.accessToken)throw new B(`sign-in as app ${e.clientId} failed: no token returned`,{hint:"check --client-id, --tenant and the secret or certificate"});let c=r.expiresOn?r.expiresOn.getTime()/1e3:Date.now()/1e3;return[r.accessToken,c]}async function Ne(e,n,o,t){let r=JSON.stringify([e.clientId,e.tenant,n]),c=R.get(r);if(c&&!o&&c[1]-Date.now()/1e3>120)return t(` token: process (${e.name})`),c[0];t(` token: client credentials (${e.name}${o?", forced":""})`);let[a,f]=await Pe(e,n);return Ie(e,K(a)),R.set(r,[a,f]),a}function Ie(e,n){_(e.name,null,D(e.tenant)?e.tenant:null,n);let o=n?.appid||n?.azp;if(typeof o=="string"&&o&&o.toLowerCase()!==(e.clientId??"").toLowerCase())throw new B(`the token is for app ${o}, expected ${e.clientId}`)}function Fe(){R.clear(),$.clear()}export{Ee as a,ke as b,be as c,Te as d,Pe as e,Ne as f,Ie as g,Fe as h};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{b as w}from"./chunk-TQLZ3TRU.js";import{e as R}from"./chunk-S4KF5Z3S.js";import{b as c}from"./chunk-WXOTXJNG.js";import{existsSync as F,readFileSync as W,realpathSync as Y,statSync as q}from"node:fs";import{basename as K,dirname as I,join as f,resolve as Q}from"node:path";var X=/^[a-z0-9][a-z0-9_-]*$/,O=["broker","browser","device_code","az_cli","spn"],j=["read-only","read-write","full"],Z={"read-only":0,"read-write":1,full:2},T=["dataverse","devops"],hn={dv:"dataverse",dataverse:"dataverse",ado:"devops",devops:"devops"},m={dataverse:"Dataverse",devops:"DevOps"},k={dataverse:"PPDEVOPS_DATAVERSE",devops:"PPDEVOPS_DEVOPS"},N=".ppdo-cli.json",nn="config.toml",_=".ppdevops.toml",tn="PPDEVOPS_CLIENT_SECRET",en="04b07795-8ddb-461a-bbee-02f9e1bf7b46";function vn(e,n){if(!X.test(e??""))throw new c(`invalid ${n} name '${e}'`,{hint:"use lowercase letters, digits, '-' and '_' (start with a letter or digit)"});return e}function g(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function d(e,n){let t=e[n];return typeof t=="string"?t:null}var C=[["tenant","tenant"],["username","username"],["method","method"],["client_id","clientId"],["config_dir","configDir"],["secret_env","secretEnv"],["certificate","certificate"]],y=class e{name;tenant;username;method;clientId;configDir;secretEnv;certificate;ephemeral=!1;constructor(n,t){this.name=n,this.tenant=t.tenant,this.username=t.username??null,this.method=t.method,this.clientId=t.clientId??null,this.configDir=t.configDir??null,this.secretEnv=t.secretEnv??null,this.certificate=t.certificate??null}get effectiveClientId(){return this.clientId||en}account(){return JSON.stringify(C.map(([,n])=>this[n]))}toDict(){let n={};for(let[t,i]of C)this[i]!==null&&(n[t]=this[i]);return n}static fromDict(n,t){return new e(n,{tenant:d(t,"tenant")??"",username:d(t,"username"),method:d(t,"method")??"browser",clientId:d(t,"client_id"),configDir:d(t,"config_dir"),secretEnv:d(t,"secret_env"),certificate:d(t,"certificate")})}clone(){let n=new e(this.name,this);return n.ephemeral=this.ephemeral,n}},$=class e{name;identity;mode;constructor(n,t=null,i="read-only"){this.name=n,this.identity=t,this.mode=i}clone(){return new e(this.name,this.identity,this.mode)}},h=class e{name;group;service;url;org;project;constructor(n,t,i,r={}){this.name=n,this.group=t,this.service=i,this.url=r.url??null,this.org=r.org??null,this.project=r.project??null}get endpoint(){return this.service==="dataverse"?this.url??"":[this.org,this.project].filter(n=>n).join("/")}spec(){return this.service==="dataverse"?{url:this.url}:{org:this.org,project:this.project}}toDict(){return{[this.service]:this.endpoint}}static fromDict(n,t,i){let r=d(i,"dataverse");if(r!==null)return new e(n,t,"dataverse",{url:r});let o=d(i,"devops");if(o!==null){let s=o.indexOf("/"),a=s<0?o:o.slice(0,s),l=s<0?"":o.slice(s+1);return new e(n,t,"devops",{org:a,project:l||null})}throw new c(`environment '${n}' in group '${t}' needs 'dataverse = "<url>"' or 'devops = "<org>/<project>"'`)}clone(){return new e(this.name,this.group,this.service,this)}};function x(e){return e?e instanceof Map?new Map(e):new Map(Object.entries(e)):new Map}function U(e){if(!g(e))return e;let n={};for(let[t,i]of Object.entries(e))i!=null&&(n[t]=U(i));return n}function V(e){let n;try{n=W(e)}catch(r){if(r.code==="ENOENT")return null;throw r}let t;try{t=new TextDecoder("utf-8",{fatal:!0}).decode(n)}catch{throw new c(`cannot read ${e}: not valid UTF-8`,{hint:"fix or delete the file"})}let i;try{i=JSON.parse(t)}catch(r){throw new c(`cannot read ${e}: ${r.message}`,{hint:"fix or delete the file"})}if(!g(i))throw new c(`cannot read ${e}: expected a JSON object`,{hint:"fix or delete the file"});return i}var L=new Set;function G(e,n){L.has(e)||(L.add(e),R(`ignored ${e}: ppdo-cli now reads ${K(e)===_?N:"config.json"}; ${n}`))}function S(e,n,t){let i=e[n];if(i==null)return{};if(!g(i))throw new c(`cannot read ${t}: '${n}' must be an object`,{hint:"fix or delete the file"});return i}var M=class e{identities;groups;environments;current;output;schema;path;constructor(n={}){this.identities=x(n.identities),this.groups=x(n.groups),this.environments=x(n.environments),this.current={...n.current??{}},this.output=n.output??null,this.schema=n.schema??null,this.path=n.path??null}static async load(n=w()){let t=V(n);if(t)return e.fromData(t,n);let i=f(I(n),nn);return D(i)&&G(i,"set up again with ppdo-cli identity add, group add and env add"),new e({path:n})}static fromData(n,t=null){let i=t??"the config",r=new Map,o=new Map;for(let[u,p]of Object.entries(S(n,"groups",i))){let b=g(p)?p:{};r.set(u,new $(u,d(b,"identity"),d(b,"mode")??"read-only"));for(let[v,P]of Object.entries(S(b,"environments",i))){if(o.has(v))throw new c(`environment '${v}' is in more than one group`,{hint:`fix ${i}`});o.set(v,h.fromDict(v,u,g(P)?P:{}))}}let s=new Map;for(let[u,p]of Object.entries(S(n,"identities",i)))s.set(u,y.fromDict(u,g(p)?p:{}));let a={};for(let u of T){let p=d(n,`current-${u}`);p&&(a[u]=p)}let l=new e({identities:s,groups:r,environments:o,current:a,output:d(n,"output"),schema:d(n,"$schema"),path:t});return l.checkFile(i),l}checkFile(n){let t={hint:`fix ${n}`};for(let r of this.identities.values())if(!O.includes(r.method))throw new c(`identity '${r.name}' has method '${r.method}'; use one of: ${O.join(", ")}`,t);for(let r of this.groups.values())if(!j.includes(r.mode))throw new c(`group '${r.name}' has mode '${r.mode}'; use one of: ${j.join(", ")}`,t);let i=new Map;for(let r of this.environments.values()){let o=`${r.service}
|
|
3
|
-
${r.endpoint.toLowerCase()}`,s=i.get(o);if(s!==void 0)throw new c(`${r.endpoint} is both environment '${s}' and '${r.name}'`,{hint:`an environment belongs to one group, so it has one account and one mode; keep one of them in ${n}`});i.set(o,r.name)}}toDict(){let n={};for(let r of this.groups.values()){let o={identity:r.identity,mode:r.mode},s={};for(let a of this.members(r.name))s[a.name]=a.toDict();Object.keys(s).length&&(o.environments=s),n[r.name]=o}let t={};for(let[r,o]of this.identities)t[r]=o.toDict();let i={$schema:this.schema};for(let r of T)i[`current-${r}`]=this.current[r]??null;return i.output=this.output,i.identities=t,i.groups=n,i}async dumps(){let n=U(this.toDict());for(let t of["identities","groups"])g(n[t])&&!Object.keys(n[t]).length&&delete n[t];return JSON.stringify(n,null,2)+`
|
|
4
|
-
`}async save(){let{atomicWrite:n}=await import("./protect-WZO3MAHF.js");n(this.path??w(),await this.dumps())}static async edit(n){let{withFileLock:t}=await import("./protect-WZO3MAHF.js"),i=w();return t(i,async()=>{let r=await e.load(i),o=await n(r);return await r.save(),o})}clone(){let n=t=>new Map([...t].map(([i,r])=>[i,r.clone()]));return new e({identities:n(this.identities),groups:n(this.groups),environments:n(this.environments),current:this.current,output:this.output,schema:this.schema,path:this.path})}validate(){let n=new Map;for(let t of this.environments.values()){this.group(t.group);let i=`${t.service}
|
|
5
|
-
${t.endpoint.toLowerCase()}`,r=n.get(i);if(r!==void 0)throw new c(`${t.endpoint} is already environment '${r}'`,{hint:`an environment belongs to one group; move it instead: ppdo-cli env move ${r} --to <group>`});n.set(i,t.name)}for(let t of this.groups.values())t.identity&&this.identity(t.identity)}identity(n){let t=this.identities.get(n);if(!t)throw new c(`no identity named '${n}'`,{hint:"run: ppdo-cli identity list"});return t}group(n){let t=this.groups.get(n);if(!t)throw new c(`no group named '${n}'`,{hint:"run: ppdo-cli group list"});return t}environment(n){let t=this.environments.get(n);if(!t)throw new c(`no environment named '${n}'`,{hint:"run: ppdo-cli env list"});return t}members(n){return[...this.environments.values()].filter(t=>t.group===n)}};function A(e){let n=new Map;for(let t of e.environments.values()){let i=e.groups.get(t.group),r=i&&i.identity?e.identities.get(i.identity):void 0;if(!i||!r)continue;let o=JSON.stringify([t.service,t.endpoint.toLowerCase(),r.account()]),s=Z[i.mode]??0;s>=(n.get(o)?.[0]??-1)&&n.set(o,[s,t.name])}return n}function wn(e,n){let t=A(e),i=[];for(let[r,[o,s]]of A(n))if(o>(t.get(r)?.[0]??0)){let a=n.environment(s),l=n.group(a.group),u=n.identity(l.identity??""),p=l.mode==="full"?"write and delete":"write";i.push(`agents could ${p} in '${s}' (${a.endpoint}) as ${u.username||u.name} (group '${l.name}', ${l.mode})`)}return i}function z(e){let n=Q(e??process.cwd());try{return Y(n)}catch{return n}}function J(e){let n=[e];for(let t=I(e);t!==n[n.length-1];t=I(t))n.push(t);return n}function D(e){try{return q(e).isFile()}catch{return!1}}async function rn(e){let n=J(z(e)),t=n.findIndex(r=>F(f(r,".git"))),i=t>=0?n.slice(0,t+1):n.slice(0,1);for(let r of i){let o=f(r,N);if(!D(o)){let l=f(r,_);D(l)&&G(l,"pin again with ppdo-cli env pin <env>");continue}let s;try{s=V(o)}catch(l){throw l instanceof c?new c(l.message):l}if(!s)continue;let a={};for(let l of T){let u=s[l];typeof u=="string"&&u&&(a[l]=u)}if(!Object.keys(a).length)throw new c(`${o} names no environment`,{hint:'expected {"dataverse": "<env>"} and/or {"devops": "<env>"}; run: ppdo-cli env pin <env>'});return[a,o]}return null}function yn(e){for(let n of J(z(e)))if(F(f(n,".git")))return n;return null}var E=class{env;group;source;app;constructor(n,t,i,r=!1){this.env=n,this.group=t,this.source=i,this.app=r}get mode(){return this.group.mode}};function B(e){return!!e&&e.includes("://")}function on(e){return`run: ppdo-cli env list --service ${e==="devops"?"ado":"dv"}`}async function $n(e,n,t){let[i,r]=await H(e,n,t);if(B(i))throw new c(`'${i}' is a URL; a URL target needs --client-id and --tenant`,{hint:"or pass an environment name (see ppdo-cli env list)"});let o=e.environment(i);if(o.service!==n)throw new c(`environment '${i}' is a ${m[o.service]} environment, not ${m[n]}`,{hint:on(n)});return new E(o,e.group(o.group),r)}async function H(e,n,t){let i,r="",o=process.env[k[n]];if(t)[i,r]=[t,"flag"];else if(o)[i,r]=[o,`env ${k[n]}`];else{let s=await rn();s&&s[0][n]?[i,r]=[s[0][n],`file ${s[1]}`]:e.current[n]&&([i,r]=[e.current[n],`global current-${n}`])}if(!i)throw new c(`no ${m[n]} environment selected`,{hint:"pass --env <name>, or run: ppdo-cli env use <name> (see ppdo-cli env list)"});return[i,r]}var sn=[["clientId","--client-id"],["tenant","--tenant"],["certificate","--certificate"],["mode","--mode"]];function En(e){let n=sn.filter(([t])=>e[t]);if(!n.length)return!1;if(!n.some(([t])=>t==="clientId")){let t=n.map(([,i])=>i).join(", ");throw new c(`${t} ${n.length===1?"applies":"apply"} only with --client-id`,{hint:"a configured environment's mode comes from its group (ppdo-cli group list)"})}if(!e.tenant)throw new c("--client-id needs --tenant <id|domain>");if(e.identity)throw new c("use --identity or --client-id, not both");return!0}function cn(e){let n=String(e.clientId).trim(),t=e.certificate?String(e.certificate):null,i=new y(`app:${n}`,{tenant:String(e.tenant).trim(),username:null,method:"spn",clientId:n,secretEnv:t?null:tn,certificate:t});return i.ephemeral=!0,i}function an(e){if(!e.includes("://"))return null;let n;try{n=new URL(e.trim())}catch{throw new c(`'${e}' is not a dev.azure.com URL`)}let t=n.hostname.toLowerCase(),i=n.pathname.split("/").filter(a=>a).map(a=>decodeURIComponent(a)),r,o;if(t==="dev.azure.com"&&i.length)r=i[0]??"",o=i.slice(1);else if(t.endsWith(".visualstudio.com"))r=t.split(".")[0]??"",o=i,o[0]?.toLowerCase()==="defaultcollection"&&(o=o.slice(1));else throw new c(`'${e}' is not a dev.azure.com URL`);let s=o[0];return[r,s&&!s.startsWith("_")?s:null]}function ln(e,n){if(e==="dataverse"){let o=un(n);return new h(o.slice(o.indexOf("://")+3),"app","dataverse",{url:o})}let t=an(n);if(!t)throw new c(`'${n}' is not a dev.azure.com URL`);let[i,r]=t;return new h([i,r].filter(o=>o).join("/"),"app","devops",{org:i,project:r})}async function bn(e,n,t){let i=typeof t.env=="string"?t.env:null,[r,o]=await H(e,n,i),s;if(B(r))s=ln(n,r);else if(s=e.environment(r),s.service!==n)throw new c(`environment '${r}' is a ${m[s.service]} environment, not ${m[n]}`);let a=new $("app",null,typeof t.mode=="string"&&t.mode?t.mode:"read-only");return[new E(s,a,o,!0),cn(t)]}function xn(e,n,t){if(t)return[e.identity(t),"flag"];let i=process.env.PPDEVOPS_IDENTITY;if(i)return[e.identity(i),"env PPDEVOPS_IDENTITY"];let r=n.group.identity;if(!r)throw new c(`group '${n.group.name}' has no identity`,{hint:`run: ppdo-cli group update ${n.group.name} --identity <name>`});return[e.identity(r),`group ${n.group.name}`]}function un(e){let n=e.trim();n.includes("://")||(n="https://"+n);let t=null;try{t=new URL(n)}catch{t=null}if(!t||t.protocol!=="https:"||!t.hostname)throw new c(`invalid Dataverse URL '${n}'`,{hint:"use https://<org>.crm.dynamics.com"});return`https://${t.hostname.toLowerCase()}`}export{X as a,O as b,j as c,Z as d,T as e,hn as f,m as g,k as h,N as i,tn as j,en as k,vn as l,y as m,$ as n,h as o,V as p,M as q,A as r,wn as s,rn as t,yn as u,E as v,B as w,$n as x,En as y,cn as z,an as A,ln as B,bn as C,xn as D,un as E};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{e as h}from"./chunk-S4KF5Z3S.js";import{a as c}from"./chunk-WXOTXJNG.js";import{createRequire as I}from"node:module";import{chmodSync as M,closeSync as y,fsyncSync as O,linkSync as U,mkdirSync as B,openSync as N,readFileSync as f,renameSync as A,statSync as J,unlinkSync as u,writeSync as D}from"node:fs";import{hostname as _}from"node:os";import{basename as R,dirname as S,join as v}from"node:path";var T=Buffer.from("PPD1","ascii"),C=Buffer.from("PPP1","ascii"),P=Buffer.from("ppdo-cli token cache","ascii"),b="CurrentUser",m="run: ppdo-cli auth login <identity>",a,p="",w=!1;function L(){if(a!==void 0)return a;if(process.platform!=="win32")return p="DPAPI is Windows only",a=null;try{let r=I(import.meta.url),t=r.resolve("@azure/msal-node-extensions/package.json"),e=r(v(S(t),"bin",process.arch,"dpapi.node"));if(typeof e.protectData!="function"||typeof e.unprotectData!="function")throw new Error("dpapi.node has no protectData/unprotectData");a=e}catch(r){p=r instanceof Error?r.message.split(`
|
|
3
|
-
`)[0]??r.message:String(r),a=null}return a}function ot(r){a=r,w=!1}function $(r,t,e){try{let n=t?e.protectData(r,P,b):e.unprotectData(r,P,b);return Buffer.from(n.buffer,n.byteOffset,n.byteLength)}catch(n){let o=n instanceof Error?n.message:String(n);throw new c(`DPAPI ${t?"encrypt":"decrypt"} failed (${o})`,{hint:`the cache may belong to another user or machine; ${m}`})}}function q(r){if(process.platform==="win32"){let t=L();if(t)return Buffer.concat([T,$(r,!0,t)]);w||(w=!0,h(`token caches are stored unencrypted: DPAPI is not available (${p}); install the optional dependency @azure/msal-node-extensions to encrypt them`))}return Buffer.concat([C,r])}function F(r){let t=Buffer.from(r.buffer,r.byteOffset,r.byteLength);if(t.subarray(0,4).equals(T)){let e=L();if(!e)throw new c(`cannot decrypt the cache: DPAPI is not available (${p})`,{hint:`install @azure/msal-node-extensions, or ${m}`});return $(t.subarray(4),!1,e)}if(t.subarray(0,4).equals(C))return Buffer.from(t.subarray(4));throw new c("unrecognised cache file format",{hint:`delete it and ${m}`})}function it(r){let t;try{t=f(r)}catch(e){if(e.code==="ENOENT")return null;throw e}return F(t)}function at(r,t){G(r,q(t))}var z=new Int32Array(new SharedArrayBuffer(4));function g(r){Atomics.wait(z,0,0,r)}function E(){return`${process.pid}.${Date.now().toString(36)}.${Math.random().toString(36).slice(2,10)}`}function l(r){let t=r.code;return t==="EPERM"||t==="EACCES"||t==="EBUSY"}function G(r,t){let e=S(r);B(e,{recursive:!0});let n=typeof t=="string"?Buffer.from(t,"utf8"):t,o=v(e,`${R(r)}.${E()}.tmp`),s=N(o,"wx",384);try{try{let i=0;for(;i<n.byteLength;)i+=D(s,n,i,n.byteLength-i);O(s)}finally{y(s)}process.platform!=="win32"&&M(o,384);for(let i=0;;i++)try{A(o,r);break}catch(k){if(!l(k)||i===39)throw k;g(25)}}catch(i){try{u(o)}catch{}throw i}}var X=600*1e3,j=5,H=50,W=1e3,Y;function x(){return Y??=process.platform==="win32"&&process.env.COMPUTERNAME||_()}function K(r){try{let t=JSON.parse(r);return typeof t.pid=="number"&&typeof t.host=="string"?t:null}catch{return null}}function Q(r){try{return process.kill(r,0),!0}catch(t){return t.code==="EPERM"}}var d=class{lockPath;token=E();deadline;wait=j;lastStaleCheck=-1/0;constructor(t,e){this.lockPath=t+".lock",this.deadline=performance.now()+e*1e3,B(S(this.lockPath),{recursive:!0})}poll(){if(this.tryCreate())return 0;let t=performance.now();if(t-this.lastStaleCheck>=W){this.lastStaleCheck=t;let n=this.staleContent();if(n!==null&&(this.breakStale(n),this.tryCreate()))return 0}if(t>this.deadline)throw new c(`timed out waiting for lock ${this.lockPath}`,{hint:"another ppdo-cli process is busy; retry"});let e=this.wait;return this.wait=Math.min(this.wait*2,H),e}tryCreate(){let t;try{t=N(this.lockPath,"wx",384)}catch(e){if(e.code==="EEXIST"||l(e))return!1;throw e}try{let e={pid:process.pid,host:x(),token:this.token};D(t,JSON.stringify(e))}catch(e){throw y(t),u(this.lockPath),e}return y(t),!0}staleContent(){let t,e;try{e=J(this.lockPath).mtimeMs,t=f(this.lockPath,"utf8")}catch(o){if(o.code==="ENOENT"||l(o))return null;throw o}let n=K(t);return n&&n.host===x()&&n.pid!==process.pid&&!Q(n.pid)||Date.now()-e>X?t:null}breakStale(t){let e=`${this.lockPath}.${E()}.stale`;try{A(this.lockPath,e)}catch(o){if(o.code==="ENOENT"||l(o))return;throw o}let n="";try{n=f(e,"utf8")}catch(o){if(o.code!=="ENOENT")throw o}try{if(n!==t)try{U(e,this.lockPath)}catch(o){if(o.code!=="EEXIST")throw o}}finally{u(e)}}release(){for(let t=0;;t++)try{if(!f(this.lockPath,"utf8").includes(this.token))return;u(this.lockPath);return}catch(e){if(e.code==="ENOENT")return;if(!l(e)||t===39){h(`could not remove lock ${this.lockPath}: ${e.message}`);return}g(25)}}};function st(r,t,e=30){let n=new d(r,e);for(let o=n.poll();o>0;o=n.poll())g(o);try{return t()}finally{n.release()}}async function ct(r,t,e=30){let n=new d(r,e);for(let o=n.poll();o>0;o=n.poll())await new Promise(s=>setTimeout(s,o));try{return await t()}finally{n.release()}}export{L as a,ot as b,q as c,F as d,it as e,at as f,g,G as h,X as i,x as j,st as k,ct as l};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{A,B,C,D,E,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-OP6EXLWQ.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{q as Config,k as DEFAULT_CLIENT_ID,h as ENV_VARS,o as Environment,n as Group,m as Identity,g as LABELS,b as METHODS,c as MODES,a as NAME_RE,i as PIN_FILE,d as RANK,v as Resolved,j as SECRET_ENV,e as SERVICES,f as SERVICE_ALIASES,z as appIdentity,y as appRequested,l as checkName,A as devopsUrlScope,t as findPin,u as gitRoot,r as grants,w as isUrl,E as normaliseDataverseUrl,p as readJsonFile,C as resolveApp,x as resolveEnv,D as resolveIdentity,B as urlEnvironment,s as widening};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{e as a,o as r,r as n}from"./chunk-BALEFXOL.js";import{b as s}from"./chunk-OP6EXLWQ.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";function f(o){let t=r(o,"identity","manage identities (one account in one tenant)"),i=n(t,"add","L","add an identity").argument("<name>");c(i,!0),i.handler(async e=>(await import("./run-ZNDSC7LR.js")).add(e));let d=n(t,"update","L","change fields of an identity").argument("<name>");c(d,!1),d.handler(async e=>(await import("./run-ZNDSC7LR.js")).update(e)),n(t,"list","L","list identities").handler(async e=>(await import("./run-ZNDSC7LR.js")).list(e)),n(t,"show","L","show one identity and its cache files").argument("<name>").handler(async e=>(await import("./run-ZNDSC7LR.js")).show(e)),n(t,"remove","L","remove an identity and delete its token caches").argument("<name>").option("--force","remove even if a group uses it").handler(async e=>(await import("./run-ZNDSC7LR.js")).remove(e))}function c(o,t){let i=new a("--tenant <id|domain>","Entra tenant ID or domain");t&&i.makeOptionMandatory(),o.addOption(i).option("--username <upn>","account to sign in as (required for broker, browser, device_code)").addOption(new a("--method <method>","how to sign in (default: browser)").choices(s)).option("--client-id <id>","app (client) ID; default: the Azure CLI's public client").option("--config-dir <path>","az_cli only: AZURE_CONFIG_DIR for this identity").option("--secret-env <VAR>","spn only: env var holding the client secret").option("--certificate <path>","spn only: certificate (PEM) path")}export{f as register};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{d as a,e as b,f as c,g as d,h as e,i as f,j as g,k as h,l as i,m as j,n as k,o as l}from"./chunk-GT52BRS2.js";import"./chunk-4S5ETLH4.js";import"./chunk-J4R6QXW7.js";import"./chunk-5SBBTR3Y.js";import"./chunk-UYDBLVAM.js";import"./chunk-3C3GSN3J.js";import"./chunk-RHQP7X6H.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{c as FAILED_PATH,e as LOGIN_TIMEOUT,i as Loopback,a as SIGN_IN_PATH,b as SUCCESS_PATH,f as USER_METHODS,k as acquire,j as login,l as logout,g as msalError,d as newSignInId,h as openUrl};
|
|
@@ -1,2 +0,0 @@
|
|
|
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}from"./chunk-RHQP7X6H.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{i as STALE_MS,h as atomicWrite,j as hostId,a as loadDpapi,e as readSealed,c as seal,b as setDpapiForTests,g as sleepSync,d as unseal,l as withFileLock,k as withFileLockSync,f as writeSealed};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a as x,b as k,e as O,g,j as v,k as h,l as d,m as p,n as C,o as y,p as I}from"./chunk-3C3GSN3J.js";import{l as f}from"./chunk-RHQP7X6H.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import{a as m,b as w,c as _}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var b=["browser","broker","device_code"],T="https://graph.microsoft.com/.default",$=600;async function L(e,t,n={}){let c=n.log??(()=>{}),i=!!n.forceRefresh;if(e.ephemeral)return(await import("./spn-AIUWML5R.js")).ephemeralToken(e,t,i,c);if(!i){let a=p(e,t);if(a)return c(` token: cache (${e.name})`),a}return f(g(e.name),async()=>{let a=h(e.name);if(!i){let o=p(e,t,a);if(o)return c(` token: cache after lock (${e.name})`),o}let s,r,l;if(b.includes(e.method)){let o=a.account;if(!o||!y(a,e))throw new _(`identity '${e.name}' is not signed in`,{hint:`run: ppdo-cli auth login ${e.name}`});let E=await import("./msalUser-JRNX5HPO.js");c(` token: refreshing via msal (${e.name}${i?", forced":""})`),[s,r]=await E.acquire(e,t,o,i),l=o.tenant_id??null}else if(e.method==="az_cli"){let o=await import("./azCli-T67ZMIC3.js");c(` token: az cli (${e.name})`),[s,r,l]=await o.acquire(e,t)}else if(e.method==="spn"){let o=await import("./spn-AIUWML5R.js");c(` token: client credentials (${e.name})`),[s,r]=await o.acquire(e,t),l=null,o.check(e,k(s))}else throw new w(`sign-in method '${e.method}' is not available yet`);let u=k(s);return O(e.name,e.username,l||(x(e.tenant)?e.tenant:null),u),C(a,e,t,s,r),d(e.name,a),s})}async function P(e,t={}){let n;try{n=h(e.name)}catch(r){if(!(r instanceof m))throw r;n={account:null,tokens:{}}}if(!t.force&&y(n,e))return{identity:e.name,status:"already signed in",account:n.account?.account??null};let c=t.deviceCode?"device_code":e.method;if(c==="az_cli")return{identity:e.name,status:"uses az cli",hint:"run: az login (with this identity's AZURE_CONFIG_DIR)"};let i=t.scope??T,a=await import("./msalUser-JRNX5HPO.js"),s=await f(g(e.name),async()=>{let[r,l]=await a.login(e,{method:c,scopes:[i],usedBy:t.usedBy??[]}),u={account:r,tokens:{}};return l&&C(u,e,i,l.accessToken,l.expiresOn),d(e.name,u),r},$);return{identity:e.name,status:"signed in",account:s.account??null,tenant_id:s.tenant_id??null,method:c}}async function A(e){let t;try{t=h(e.name)}catch(n){if(!(n instanceof m))throw n;t={account:null,tokens:{}}}return t.account&&b.includes(e.method)&&await(await import("./msalUser-JRNX5HPO.js")).logout(e,t.account),{identity:e.name,deleted_files:v(e.name)}}function S(e){let t={identity:e.name,username:e.username,tenant:e.tenant,method:e.method,client_id:e.effectiveClientId};try{return{...t,...I(e)}}catch(n){if(!(n instanceof m))throw n;return{...t,signed_in:!1,error:n.message,...n.hint?{hint:n.hint}:{}}}}export{T as DEFAULT_LOGIN_SCOPE,b as USER_METHODS,L as getToken,P as login,A as logout,S as status};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a as g}from"./chunk-5UOZCXQF.js";import{E as C,l as v,n as U,o as x}from"./chunk-OP6EXLWQ.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-XXVLVHD6.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,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a as d}from"./chunk-5UOZCXQF.js";import{E as j,e as g,f as S,g as R,i as f,l,o as P,p as x,t as w,u as $,x as y}from"./chunk-OP6EXLWQ.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import{b as m}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";import{existsSync as O,realpathSync as I,statSync as E,unlinkSync as N,writeFileSync as C}from"node:fs";import{join as k,resolve as F}from"node:path";function u(n){return typeof n=="string"&&n?n:null}function D(n){return{dataverse:u(n.args.dataverse),devopsOrg:u(n.args.devopsOrg),devopsProject:u(n.args.devopsProject)}}function A(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 p(n,e){let t=n.groups.get(e.group),o={name:e.name,service:e.service,endpoint:e.endpoint,group:e.group,mode:t?t.mode:null,identity:t?t.identity:null},r=t&&t.identity?n.identities.get(t.identity):void 0;return r&&(o.account=r.username||r.name),o}async function B(n){let e=String(n.args.name),t=String(n.args.in);l(e,"environment");let o=D(n);if(!(o.dataverse||o.devopsOrg))throw new m("pass --dataverse <url>, or --devops-org <org> [--devops-project <project>]");let r=o.dataverse?"dataverse":"devops";await n.emit(await d(e,s=>{if(s.environments.has(e))throw new m(`environment '${e}' already exists`,{hint:`run: ppdo-cli env update ${e} ...`});s.group(t);let a=new P(e,t,r);return A(a,o),s.environments.set(e,a),s.current[r]??=e,p(s,a)}))}async function M(n){let e=String(n.args.name),t=D(n);await n.emit(await d(e,o=>{let r=o.environment(e);return A(r,t),p(o,r)}))}async function q(n){let e=String(n.args.name),t=String(n.args.newName);l(t,"environment");let o=await d(e,a=>{let i=a.environment(e);if(a.environments.has(t))throw new m(`environment '${t}' already exists`);return i.name=t,a.environments=new Map([...a.environments].map(([c,v])=>[c===e?t:c,v])),a.current[i.service]===e&&(a.current[i.service]=t),p(a,i)}),r=await w(),s=r&&Object.values(r[0]).includes(e);await n.emit({renamed:e,...o,...s?{warning:`${r[1]} still names '${e}'`}:{}})}async function z(n){let e=String(n.args.name),t=String(n.args.to);await n.emit(await d(e,o=>{let r=o.environment(e);return o.group(t),r.group=t,p(o,r)}))}async function G(n){let e=await n.config(),t=u(n.args.group);t&&e.group(t);let o=u(n.args.service),r=o?S[o]:void 0,s={};for(let i of g)try{s[i]=(await y(e,i,null)).env.name}catch(c){if(!(c instanceof m))throw c}let a=[];for(let i of e.environments.values())t&&i.group!==t||r&&i.service!==r||a.push({...p(e,i),default:s[i.service]===i.name});await n.emit(a)}async function H(n){let e=await n.config();await n.emit(p(e,e.environment(String(n.args.name))))}async function K(n){let e=String(n.args.name);await n.emit(await d(e,t=>{let o=t.environment(e);return t.current[o.service]=e,{[`current-${o.service}`]:e}}))}async function Q(n){let e=await n.config(),t={};for(let o of g)try{let r=await y(e,o,null);t[o]={env:r.env.name,group:r.group.name,mode:r.mode,source:r.source}}catch(r){if(!(r instanceof m))throw r;t[o]={error:r.message}}await n.emit(t)}function L(n){try{return E(n).isDirectory()}catch{return!1}}function b(n){if(n){let t=F(n);if(!L(t))throw new m(`not a folder: ${n}`);return I.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 W(n){let e=await n.config(),t={},o=Array.isArray(n.args.names)?n.args.names:[];for(let i of o){let c=e.environment(i),v=t[c.service];if(v!==void 0)throw new m(`pin one ${R[c.service]} environment, not '${v}' and '${i}'`);t[c.service]=i}let r=k(b(u(n.args.path)),f),s=null;if(O(r)&&E(r).isFile()){let i={};try{i=x(r)??{}}catch{i={}}let c={};for(let v of g){let h=i[v];typeof h=="string"&&(c[v]=h)}t={...c,...t},s=u(i.$schema)}let a=s?{$schema:s}:{};for(let i of g)t[i]!==void 0&&(a[i]=t[i]);C(r,JSON.stringify(a,null,2)+`
|
|
3
|
-
`,"utf8"),await n.emit({pinned:t,file:r})}async function X(n){let e=k(b(u(n.args.path)),f),t=O(e);t&&N(e),await n.emit({removed:t?e:null})}async function Y(n){let e=String(n.args.name);await d(e,r=>{let s=r.environment(e);r.environments.delete(e),r.current[s.service]===e&&delete r.current[s.service]});let t=await w(),o=t&&Object.values(t[0]).includes(e);await n.emit({removed:e,...o?{warning:`${t[1]} still names it`}:{}})}export{B as add,Q as current,p as describe,G as list,z as move,W as pin,Y as remove,q as rename,H as show,X as unpin,M as update,K as use};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{D as v,e as g,f as l,x as f}from"./chunk-OP6EXLWQ.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import{a as m,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 n=d(s.args.service),i=n?l[n]: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(e){let s=await import("./tokenCache-3LMJRUTI.js"),n=await e.config(),i=h(n,e),o={};for(let r of i){let c;try{c=await f(n,r,d(e.args.env))}catch(t){if(!(t instanceof u)||i.length===1)throw t;continue}let a={env:c.env.name,group:c.group.name,mode:c.mode,source:c.source,endpoint:c.env.endpoint};try{let[t,p]=v(n,c,d(e.args.identity)),w=s.load(t.name);Object.assign(a,{identity:t.name,identity_source:p,username:t.username,method:t.method,signed_in:s.accountMatches(w,t)||t.method==="az_cli"})}catch(t){if(!(t instanceof m))throw t;a.error=t.message}e.args.check&&"identity"in a&&(a.check=await y(e,r)),o[r]=a}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 n=await e.client(s);if(s==="dataverse"){let r=(await n.request("GET","WhoAmI")).json()??{};return{ok:!0,user_id:r.UserId??null,organization_id:r.OrganizationId??null}}let o=((await n.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(n){if(!(n instanceof m))throw n;return{ok:!1,error:n.message,exit_code:n.exitCode}}}export{E as whoami};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{D as l,e as w,f as d,x as f}from"./chunk-OP6EXLWQ.js";import"./chunk-TQLZ3TRU.js";import{e as u}from"./chunk-S4KF5Z3S.js";import{b as p}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";function c(e){return typeof e=="string"&&e?e:null}async function y(e){let o=await e.config(),i=c(e.args.name);if(i)return[o.identity(i)];let n=c(e.args.env),s=c(e.args.service),t;n?t=[o.environment(n).service]:t=s?[d[s]]:[...w];let r=[];for(let a of t)try{r.push(await f(o,a,n))}catch(m){if(!(m instanceof p)||t.length===1)throw m}if(!r.length)throw new p("no environment selected",{hint:"name an identity, or pass --env <name>"});let g=[];for(let a of r){let[m]=l(o,a,c(e.args.identity));g.some(v=>v.name===m.name)||g.push(m)}return g}async function k(e){let o=await import("./provider-VXRAQRN2.js"),{loginScope:i}=await import("./services-B6V4VVX5.js"),n=await e.config(),s=!!(c(e.args.name)||c(e.args.service)),t=[];for(let r of await y(e)){let g=[...n.environments.values()].flatMap(a=>{let m=n.groups.get(a.group);return m?.identity===r.name?[{name:a.name,mode:m.mode}]:[]});t.push(await o.login(r,{deviceCode:!!e.args.deviceCode,scope:i(n,r),force:s,usedBy:g}))}await e.emit(t.length!==1?t:t[0])}async function I(e){let o=await import("./provider-VXRAQRN2.js"),i=await e.config(),n=c(e.args.name),s;if(e.args.all)s=[...i.identities.values()];else if(n)s=[i.identity(n)];else throw new p("name an identity or pass --all");let t=[];for(let r of s)t.push(await o.logout(r));await e.emit(t.length!==1?t:t[0])}async function E(e){let o=await import("./provider-VXRAQRN2.js"),i=await e.config(),n=c(e.args.name),t=(n?[i.identity(n)]:[...i.identities.values()]).map(r=>o.status(r));await e.emit(n?t[0]:t)}async function x(e){let o=c(e.args.service),i=c(e.args.scope);if(!o&&!i)throw new p("pass --service dv|ado or --scope <scope>");let n=await e.config(),s,t;if(o){let a=await f(n,d[o],c(e.args.env));[s]=l(n,a,c(e.args.identity));let{scopeFor:m}=await import("./services-B6V4VVX5.js");t=i??m(a.env)}else{let a=c(e.args.identity);if(!a)throw new p("pass --identity <name> or --service");s=n.identity(a),t=i}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:r}=await import("./provider-VXRAQRN2.js"),g=await r(s,t,{log:a=>e.log(a)});process.stdout.write(g+`
|
|
3
|
-
`),e.verbose&&u(`token for ${s.name} (${t})`)}export{k as login,I as logout,E as status,x as token};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{a as c}from"./chunk-5UOZCXQF.js";import{l as d,m as f}from"./chunk-OP6EXLWQ.js";import"./chunk-TQLZ3TRU.js";import{e as m}from"./chunk-S4KF5Z3S.js";import{b as r}from"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";var p=["broker","browser","device_code"],h=[["tenant","tenant"],["username","username"],["method","method"],["clientId","clientId"],["configDir","configDir"],["secretEnv","secretEnv"],["certificate","certificate"]];function s(e,t){let n=e.args[t];return typeof n=="string"?n:void 0}function l(e){if(!e.tenant)throw new r("--tenant is required");if(p.includes(e.method)&&!e.username)throw new r(`--username is required for method '${e.method}'`,{hint:"it pins sign-in to the right account"});if(e.method==="spn"&&!e.clientId)throw new r(`--client-id is required for method '${e.method}'`);if(e.method==="spn"&&!(e.secretEnv||e.certificate))throw new r("method 'spn' needs --secret-env or --certificate");if(e.configDir&&e.method!=="az_cli")throw new r("--config-dir applies to method 'az_cli' only");if((e.secretEnv||e.certificate)&&e.method!=="spn")throw new r("--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`)}async function D(e){let t=String(e.args.name);d(t,"identity");let n=new f(t,{tenant:s(e,"tenant")??"",username:s(e,"username")??null,method:s(e,"method")??"browser",clientId:s(e,"clientId")??null,configDir:s(e,"configDir")??null,secretEnv:s(e,"secretEnv")??null,certificate:s(e,"certificate")??null});l(n),await c(t,i=>{if(i.identities.has(t))throw new r(`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 g(e){let t=[];for(let[n,i]of h){let a=s(e,n);a!==void 0&&t.push([i,a||null])}return t}function u(e,t){for(let[n,i]of t)n==="tenant"?e.tenant=i??"":n==="method"?e.method=i??"":e[n]=i}async function E(e){let t=String(e.args.name),n=g(e),i=(await e.config()).identity(t).clone();u(i,n),l(i),await e.emit(await c(t,a=>{let o=a.identity(t);return u(o,n),{name:t,...o.toDict()}}))}async function b(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 R(e){let{filesFor:t}=await import("./tokenCache-3LMJRUTI.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 S(e){let t=String(e.args.name);await c(t,i=>{i.identity(t);let a=[...i.groups.values()].filter(o=>o.identity===t).map(o=>o.name);if(a.length&&!e.args.force)throw new r(`identity '${t}' is used by group(s): ${a.join(", ")}`,{hint:"update those groups first, or pass --force"});i.identities.delete(t);for(let o of i.groups.values())o.identity===t&&(o.identity=null)});let{deleteAll:n}=await import("./tokenCache-3LMJRUTI.js");await e.emit({removed:t,deleted_files:n(t)})}export{D as add,b as list,S as remove,R as show,E as update};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import { createRequire as __cr } from 'node:module'; const require = __cr(import.meta.url);
|
|
2
|
-
import{c as v}from"./chunk-NNHEYYF5.js";import{c as f}from"./chunk-BWZ6HZXM.js";import"./chunk-MTF66YXU.js";import{C as g,D as m,x as a,y as l}from"./chunk-OP6EXLWQ.js";import{d as u}from"./chunk-4S5ETLH4.js";import"./chunk-J4R6QXW7.js";import"./chunk-5SBBTR3Y.js";import"./chunk-UYDBLVAM.js";import"./chunk-RHQP7X6H.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 v({url:e.url}):new f({org:e.org,project:e.project})}function C(e){return y(e).scope()}function E(e,o){for(let n of e.environments.values()){let t=e.groups.get(n.group);if(t&&t.identity===o.name)return C(n)}return"https://graph.microsoft.com/.default"}async function h(e,o){let n=await e.config(),t,r;if(l(e.args))[t,r]=await g(n,o,e.args);else{let i=e.args.env;t=await a(n,o,typeof i=="string"?i:null);let s=e.args.identity;[r]=m(n,t,typeof s=="string"?s:null)}let p=y(t.env),d=async i=>{let{getToken:s}=await import("./provider-VXRAQRN2.js");return s(r,p.scope(),{forceRefresh:i,log:S=>e.log(S)})},c=new u(p,e,d);return c.target=t,c.identity=r,c}export{h as clientFor,E as loginScope,y as makeService,C as scopeFor};
|
|
@@ -1,2 +0,0 @@
|
|
|
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-MME53RWW.js";import"./chunk-GT52BRS2.js";import"./chunk-4S5ETLH4.js";import"./chunk-J4R6QXW7.js";import"./chunk-5SBBTR3Y.js";import"./chunk-UYDBLVAM.js";import"./chunk-3C3GSN3J.js";import"./chunk-RHQP7X6H.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{e as acquire,b as askHidden,c as certificate,g as check,d as credential,f as ephemeralToken,a as expandPath,h as resetForTests};
|
|
@@ -1,2 +0,0 @@
|
|
|
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}from"./chunk-3C3GSN3J.js";import"./chunk-RHQP7X6H.js";import"./chunk-TQLZ3TRU.js";import"./chunk-S4KF5Z3S.js";import"./chunk-WXOTXJNG.js";import"./chunk-ZHHVG47C.js";export{a as MIN_LIFETIME,j as accountMatches,e as deleteAll,k as describe,d as filesFor,h as getValid,f as load,c as msalPath,i as put,g as save,b as tokensPath};
|