@aventurevc/aventure-cli 0.8.82 → 0.8.83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/aventure-cli/index.js +1 -1
- package/dist/aventure-cli/unified-operations.json +1 -1
- package/dist/chunks/{aventure-cli-DAem7-7s.js → aventure-cli-D9ZOYetF.js} +1 -1
- package/dist/chunks/{client-DIIL1OMZ.js → client-BW6DekYi.js} +1 -1
- package/dist/chunks/{oauth-bearer-credential-NM9Y1Exb.js → oauth-bearer-credential-BSAnMQue.js} +2 -2
- package/dist/chunks/oauth-login-CM0biwpT.js +1 -0
- package/dist/chunks/{oauth-login-DkhO9MAb.js → oauth-login-CNXkZIl0.js} +1 -1
- package/dist/chunks/{openapi-commands-BCrHJmS5.js → openapi-commands-Bm3XLR6i.js} +1 -1
- package/dist/chunks/provider-catalog-BnUBzRl3.js +1 -0
- package/dist/chunks/{text-field-Bwrj-Da1.js → text-field-XSqO60CA.js} +1 -1
- package/dist/chunks/{text-response-PQC2nyx8.js → text-response-DPJ9KsfR.js} +1 -1
- package/package.json +3 -3
- package/dist/chunks/oauth-login-CS4C5BkV.js +0 -1
- package/dist/chunks/provider-catalog-BTXlVpD7.js +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{_i as e,ci as t,gi as n,la as r,ui as i}from"../chunks/client-
|
|
2
|
+
import{_i as e,ci as t,gi as n,la as r,ui as i}from"../chunks/client-BW6DekYi.js";import{t as a,v as o}from"../chunks/oauth-bearer-credential-BSAnMQue.js";import{i as s}from"../chunks/text-field-XSqO60CA.js";import{c,i as l,t as u}from"../chunks/openapi-commands-Bm3XLR6i.js";var d=process.argv.slice(2);l(d)&&i(!1),d.includes(`--all-fields`)&&s(!0);try{if(e(),c(d,u)===`optional`)try{await a(),await o()}catch(e){t({component:n().bin[0],event:`optional_auth_materialization_failed`,message:`saved credential unavailable; continuing with credential-optional command`,error:e})}await import(`../chunks/aventure-cli-D9ZOYetF.js`)}catch(e){if(!(e instanceof r))throw e;process.stderr.write(`${e.message}\n`),process.exitCode=e.exitCode}export{};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 1,
|
|
3
3
|
"generatedFrom": "MCP_GENERATION_CONTRACT",
|
|
4
|
-
"generatedAt": "2026-10-07T00:
|
|
4
|
+
"generatedAt": "2026-10-07T00:33:25.794Z",
|
|
5
5
|
"totalOperations": 136,
|
|
6
6
|
"note": "Projection of MCP_GENERATION_CONTRACT - see mcp/scripts/build-unified-operations.ts header for SSOT rules.",
|
|
7
7
|
"operations": [
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{Ai as e,C as t,Ci as n,D as r,Di as i,Oi as a,S as o,Ti as s,a as c,b as l,bi as u,c as d,ca as f,ci as p,d as m,f as h,gi as g,i as _,ki as v,l as y,m as b,mi as ee,n as te,o as x,oa as ne,oi as re,p as ie,r as ae,sa as S,u as oe,ua as se,v as ce,vi as C,wi as le,xi as ue,y as de}from"./client-DIIL1OMZ.js";import{M as fe,O as pe,i as w,o as me,v as he,w as T,y as E}from"./person-owner-BJgNYLKX.js";import{A as ge,C as _e,D as ve,M as D,N as ye,O as be,S as xe,T as Se,a as Ce,b as we,c as Te,d as Ee,g as De,j as Oe,k as ke,l as Ae,m as je,o as Me,r as Ne,s as Pe,t as Fe,u as Ie,v as Le,w as Re,x as ze,y as Be}from"./oauth-bearer-credential-NM9Y1Exb.js";import{c as Ve,d as He,h as Ue,m as We,o as Ge,p as Ke,s as qe,u as Je}from"./text-field-Bwrj-Da1.js";import{a as Ye,c as Xe,d as Ze,f as Qe,g as $e,h as et,l as tt,m as nt,n as rt,o as O,p as it,r as k,s as at,t as A,u as ot}from"./openapi-commands-BCrHJmS5.js";import{a as st,c as ct,i as j,n as lt,o as ut,p as dt,r as ft,s as pt,t as mt,u as ht}from"./text-response-PQC2nyx8.js";import{n as gt,r as _t,t as vt}from"./oauth-login-DkhO9MAb.js";import{spawnSync as yt}from"node:child_process";import{basename as bt,dirname as M,resolve as N,sep as xt}from"node:path";import{copyFileSync as St,existsSync as Ct,lstatSync as wt,mkdirSync as Tt,mkdtempSync as Et,readFileSync as Dt,readlinkSync as Ot,realpathSync as kt,renameSync as At,rmdirSync as jt,unlinkSync as Mt,writeFileSync as Nt}from"node:fs";import P,{stderr as F,stdin as Pt}from"node:process";import{TextDecoder as Ft,inspect as It}from"node:util";import{fileURLToPath as Lt}from"node:url";import{readFile as Rt}from"node:fs/promises";import{setTimeout as zt}from"node:timers/promises";import{webcrypto as Bt}from"node:crypto";import{homedir as Vt,hostname as Ht,platform as Ut}from"node:os";import{createInterface as Wt}from"node:readline/promises";function Gt(e,t,n){let r={...n};for(let n of t.parameter){let t=n.envName;if(t===void 0)continue;let i=process.env[t]?.trim();if(i===void 0||i.length===0)continue;let o=r[n.optionKey];if(o!==void 0&&(typeof o!=`string`||o!==i))return{...a(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};o===void 0&&(r[n.optionKey]=i)}return v(`Environment-bound options applied`,r)}function Kt(e,t,n){if(!I(n))return null;for(let r of t.parameter){let t=r.envName,i=t===void 0?void 0:process.env[t]?.trim();if(t===void 0||i===void 0||i.length===0||!sn(n,r.name))continue;let a=on(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function qt(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function Jt(e,t,n,r=!1){if(r||!un(t)||!Array.isArray(n))return fn(e,t,n);for(let[r,i]of n.entries()){let n=fn(e,t,i,r);if(!n.ok)return n}return v(`Body value assigned`,null)}function Yt(e,t,n,r){return fn(e,t,r,n)}function Xt(e){let t=[];for(let n of e.split(`.`)){let e=mn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function Zt(e,t){let n=Xt(t);if(n===null)return null;let r=an(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:rn(r)}:null}function Qt(e,t){if(un(e.name)||e.schemaType===`array`)return v(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return v(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?v(`Scalar body option selected`,t[0]):a(`${n} was already given; pass it once.`)}var $t=/^(?<row>\d+):(?<item>.*)$/su;function en(e,t){let n=Xt(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=$t.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function tn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&Xt(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function nn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let o=Zt(r,i.name);if(o===null)continue;if(o.firstHole!==null)return a(`${e} has no ${o.path}[] row ${o.firstHole} — number ${o.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||o.rowCount<=1||en(i,t)!==null)continue;let s=i.flag.split(` `)[0]??i.name;return a(`${s} fills one ${o.path}[] row's list, so ${e} cannot also build ${o.rowCount} ${o.path}[] rows from direct options — prefix each value with its 0-based ${o.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function rn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function an(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function on(e,t){if(!un(t))return an(e,t.split(`.`))}function sn(e,t){return ln(e,t.split(`.`))}function cn(e,t,n){if(!I(n))return null;let r=new Set(t.parameter.map(({name:e})=>e));for(let i of e)if(i!==t){for(let e of i.parameter)if(!r.has(e.name)&&sn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function ln(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=mn(n);if(!I(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>ln(e,r)):ln(a,r)}function un(e){return e.split(`.`).some(e=>mn(e).isArray)}function dn(e,t){return e.parameter.length===0||!I(t)?null:gn(t,[],hn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fn(e,t,n,r=0){let i=t.split(`.`),o=e;for(let[e,s]of i.entries()){let c=mn(s),l=e===i.length-1,u=pn(o,c,t,l,n,r);if(!u.ok||u.data===null)return a(u.summary,u.warnings);if(l)return v(`Body value assigned`,null);o=u.data}return a(`${t} is not a valid body option path.`)}function pn(e,t,n,r,i,o){let s=()=>a(`${n} cannot be combined with another body option at ${t.key}.`),c=e[t.key];if(t.isArray){if(c!==void 0&&!Array.isArray(c))return s();let n=c??[];if(c===void 0&&(e[t.key]=n),r)return n[o]===void 0?(n[o]=i,v(`Body value assigned`,e)):s();let a=n[o];if(a===void 0){let e={};return n[o]=e,v(`Body path created`,e)}return I(a)?v(`Body path stepped`,a):s()}if(r)return c===void 0?(e[t.key]=i,v(`Body value assigned`,e)):s();if(c===void 0){let n={};return e[t.key]=n,v(`Body path created`,n)}return I(c)?v(`Body path stepped`,c):s()}function mn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function hn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function gn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=gn(r,t,n);if(e!==null)return e}return null}if(!I(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!_n(a,n)){if(!vn(e))continue;return{path:a,suggestion:yn(e,n)}}let o=gn(i,e,n);if(o!==null)return o}return null}function _n(e,t){return t.prefix.has(e)||t.leaf.has(e)}function vn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function yn(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:bn(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function bn(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}function xn(e,t){let n=new Map;for(let e of t){let t=e.flag?.split(` `)[0];t!==void 0&&n.set(t,t===`--from-file`?{...e,inputType:`file`}:e)}for(let t of e){let e=t.long===void 0?void 0:n.get(t.long);e!==void 0&&(t.helpGroup(We(e)),t.description=d(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?kn(r,i):r===void 0?i===void 0?0:1:-1})}function Sn(e){let t=new Map;for(let n of e)for(let e of n.parameter){let r=e.flag.split(` `)[0]??e.flag,i=t.get(r);i===void 0?t.set(r,{variant:[{descriptor:n,parameter:e}]}):t.set(r,{variant:[...i.variant,{descriptor:n,parameter:e}]})}return[...t.values()]}function Cn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function wn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Dn(e,t)})),n=t[0];return n===void 0?``:t.every(({text:e})=>e===n.text)?`${n.text===``?``:`${n.text} `}Request content: ${t.map(({contentType:e})=>e).join(`, `)}.`:t.map(({contentType:e,text:t})=>`${e}: ${t}`).join(` `)}function Tn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function En(e,t){let n=e.kind===`multipart`?`Read a JSON object keyed by multipart part name from a file, or use - for stdin`:`Read the JSON request body from a file, or use - for stdin`,r=t.filter(e=>!t.some(t=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`)));return r.length===0?Ue(n):`${Ue(n)} Required JSON paths: ${r.join(`, `)}.`}function Dn(e,t){let n=He(t.description,void 0),r=e.kind!==`multipart`&&un(t.name),i=e.kind!==`multipart`&&t.optionKey!==t.name&&/^\w+$/u.test(t.name);return`${n}${r?` Repeat to add another value.`:``}${i?` --from-file JSON key: ${t.name}.`:``}${On(e,t)}`}function On(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=Xt(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function kn(e,t){return Ke(e)-Ke(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function An(e){let t;try{t=e===`-`?await jn():await Rt(e,`utf8`)}catch(t){return a(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return v(`No input provided`,null);let e=JSON.parse(t);return v(`Input parsed`,e)}catch(e){return a(`Input is not valid JSON: ${e.message}`)}}async function jn(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var Mn=`--content-type`;function Nn(e,t,n){let r=e=>!n?.has(e)&&(n?.add(e),!0),i=t.requestBody??[];if(i.length>1&&r(Mn)){let t=i.map(({contentType:e})=>e);e.addOption(new S(`${Mn} <media-type>`,`Select the request content type; omit for ${t[0]}.`).choices(t).argParser(Fn(i)))}if(er(t)&&r(`--from-file`)){let n=i[0];if(n===void 0)throw Error(`${t.operationId} has no request body`);e.addOption(new S(`--from-file <path>`,En(n,n.requiredPath)).argParser(Ln(`--from-file`)))}let a=Sn(i).filter(e=>r(L(e.variant[0].parameter)));for(let t of a.toSorted((e,t)=>kn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:n,parameter:r}=t.variant[0],a=new S(Cn(t),i.length>1?wn(t):Dn(n,r));i.length===1&&r.envName!==void 0&&a.env(r.envName);let o=i.length===1?Tn(n,r.optionKey):[];o.length>0&&a.conflicts(o),i.length>1?a.argParser(Pn):un(r.name)||r.schemaType===`array`?a.argParser(In):a.argParser(Ln(r.flag)),e.addOption(a),a.envVar!==void 0&&e.on(`optionEnv:${a.name()}`,()=>{let t=e.opts()[r.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(r.optionKey,t.trim(),`env`)})}$n(e,t,a)}function Pn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Fn(e){return(t,n)=>{if(n!==void 0)throw new se(`${Mn} was already given; pass it once.`);let i=r(e,t);if(!i.ok)throw new se(i.summary);return t}}function In(e,t){return[...t??[],e]}function Ln(e){let t=e.split(/\s+/u)[0]??e;return(e,n)=>{if(n!==void 0)throw new se(`${t} was already given; pass it once.`);return e}}async function Rn(e,t){let n=Ze(e,t),i=r(e.requestBody??[],n);if(!i.ok||i.data===null)return a(i.summary,i.warnings);let o=i.data;if(o===void 0)return v(`No body`,void 0);let s=zn(e,o,t);if(s!==null)return a(s);let c=Gt(e.operationId,o,t);if(!c.ok)return a(c.summary,c.warnings);t=c.data;let l=Bn(o,t);if(l!==null)return a(l);let u=await Wn(t);if(!u.ok)return a(u.summary,u.warnings);let d=cn(e.requestBody??[],o,u.data);if(d!==null)return a(d);let f=Un(e.operationId,o,u.data);if(!f.ok)return f;let p=Kt(e.operationId,o,u.data);if(p!==null)return a(p);let m=Gn(e.operationId,o,t);if(!m.ok)return m;if(u.data===void 0&&m.data===void 0)return o.required?a(Qn(e.operationId,o)):v(`No body`,void 0);let h=qn(e.operationId,u.data,m.data);if(!h.ok||h.data===void 0)return h;if(o.schemaType===`array`&&!Array.isArray(h.data))return a(`${e.operationId} requires a JSON array body.`);if(o.parameter.length>0&&!I(h.data)){let t=o.kind===`multipart`?` keyed by multipart part name`:` body`;return a(`${e.operationId} requires a JSON object${t}.`)}let g=Hn(o,h.data);if(g.length>0)return a(`${e.operationId} requires body option(s): ${g.join(`, `)}`);let _=h.data,y=I(_)?qt(o).filter(e=>!sn(_,e)):[];return y.length>0?a(Vn(e.operationId,o,y)):h}function zn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${L(t)} requires ${Mn} ${i.join(` or `)}.`}return null}function Bn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Vn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Hn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!sn(t,e.name)).map(L):[]}function Un(e,t,n){let r=dn(t,n);if(r===null)return v(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return a(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Wn(t){let n=typeof t.fromFile==`string`?t.fromFile:void 0;if(n===void 0)return v(`No body file`,void 0);let r=await An(n);if(!r.ok)return a(r.summary,r.warnings);let i=e.safeParse(r.data);return i.success?v(`Input parsed`,i.data):a(`Input is not valid JSON value: ${i.error.message}`)}function Gn(e,t,n){let r={},i=!1;for(let e of t.parameter){let o=Qt(e,n[e.optionKey]);if(!o.ok||o.data===null)return a(o.summary,o.warnings);let s=o.data;if(s===void 0)continue;let c=Kn(t,n,r,e,s);if(!c.ok)return a(c.summary,c.warnings);i=!0}if(!i)return v(`No direct body options`,void 0);let o=nn(e,t,n,r);return o===null?v(`Direct body options parsed`,r):o}function Kn(e,t,n,r,i){let o=en(r,i);if(o===null){let e=Xn(r,i);return e.ok?Jt(n,r.name,e.data,r.schemaType===`array`):a(e.summary,e.warnings)}if(o.plain.length>0)return a(`${L(r)} mixes row-form values with plain value(s): ${o.plain.join(`, `)} — prefix every value with its 0-based ${o.container}[] row index, as 0:value.`);let s=tn(e,t,o.container);for(let e of o.rows.keys())if(!(e<s))return a(`${L(r)} names ${o.container}[] row ${e}, but these options build at most ${s} ${o.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of o.rows){let i=[];for(let e of t){let t=Zn(r.name,r.itemSchemaType,e);if(!t.ok)return a(t.summary,t.warnings);i.push(t.data)}let o=Yt(n,r.name,e,i);if(!o.ok)return o}return v(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function qn(e,t,n){if(t===void 0)return v(`Direct body parsed`,n);if(n===void 0)return v(`Input parsed`,t);if(I(t)&&I(n))try{return v(`Input parsed`,Jn(t,n))}catch(t){return a(`${e} ${t.message}`)}return a(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function Jn(e,t){let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if(Array.isArray(t)&&Array.isArray(r))throw Error(`cannot combine --from-file array '${e}' with array body options at the same key — move the per-item fields inside the matching '${e}[]' object(s) in the file body.`);if(t!==void 0&&Yn(t)!==Yn(r))throw Error(`cannot combine --from-file ${Yn(t)} '${e}' with ${Yn(r)} body option(s) at the same key — align the file body shape with the schema.`);n[e]=I(t)&&I(r)?Jn(t,r):r}return n}function Yn(e){return Array.isArray(e)?`array`:I(e)?`object`:`scalar`}function Xn(e,t){if(typeof t==`boolean`)return v(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return Zn(e.name,e.schemaType,t??``);let n=[],r=un(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=Zn(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return v(`Body value parsed`,n)}function Zn(e,t,n){if(t===`boolean`)return n===`true`?v(`Body value parsed`,!0):n===`false`?v(`Body value parsed`,!1):a(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?a(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?a(`${e} must be an integer.`):v(`Body value parsed`,i)}return v(`Body value parsed`,n)}function Qn(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(L).join(`, `)}`;let r=qt(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(L).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function $n(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Mn,location:`body`}),er(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),xn(e.options,r)}function er(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function tr(e){let t=i(e);return ur(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function nr(e){let t=i(e);ur(t);let n=mt(t.data,t.summary),r=[];if(t.ok&&n!==null){let e=rr(t);r.push(n.endsWith(`
|
|
1
|
+
import{Ai as e,C as t,Ci as n,D as r,Di as i,Oi as a,S as o,Ti as s,a as c,b as l,bi as u,c as d,ca as f,ci as p,d as m,f as h,gi as g,i as _,ki as v,l as y,m as b,mi as ee,n as te,o as x,oa as ne,oi as re,p as ie,r as ae,sa as S,u as oe,ua as se,v as ce,vi as C,wi as le,xi as ue,y as de}from"./client-BW6DekYi.js";import{M as fe,O as pe,i as w,o as me,v as he,w as T,y as E}from"./person-owner-BJgNYLKX.js";import{A as ge,C as _e,D as ve,M as D,N as ye,O as be,S as xe,T as Se,a as Ce,b as we,c as Te,d as Ee,g as De,j as Oe,k as ke,l as Ae,m as je,o as Me,r as Ne,s as Pe,t as Fe,u as Ie,v as Le,w as Re,x as ze,y as Be}from"./oauth-bearer-credential-BSAnMQue.js";import{c as Ve,d as He,h as Ue,m as We,o as Ge,p as Ke,s as qe,u as Je}from"./text-field-XSqO60CA.js";import{a as Ye,c as Xe,d as Ze,f as Qe,g as $e,h as et,l as tt,m as nt,n as rt,o as O,p as it,r as k,s as at,t as A,u as ot}from"./openapi-commands-Bm3XLR6i.js";import{a as st,c as ct,i as j,n as lt,o as ut,p as dt,r as ft,s as pt,t as mt,u as ht}from"./text-response-DPJ9KsfR.js";import{n as gt,r as _t,t as vt}from"./oauth-login-CNXkZIl0.js";import{spawnSync as yt}from"node:child_process";import{basename as bt,dirname as M,resolve as N,sep as xt}from"node:path";import{copyFileSync as St,existsSync as Ct,lstatSync as wt,mkdirSync as Tt,mkdtempSync as Et,readFileSync as Dt,readlinkSync as Ot,realpathSync as kt,renameSync as At,rmdirSync as jt,unlinkSync as Mt,writeFileSync as Nt}from"node:fs";import P,{stderr as F,stdin as Pt}from"node:process";import{TextDecoder as Ft,inspect as It}from"node:util";import{fileURLToPath as Lt}from"node:url";import{readFile as Rt}from"node:fs/promises";import{setTimeout as zt}from"node:timers/promises";import{webcrypto as Bt}from"node:crypto";import{homedir as Vt,hostname as Ht,platform as Ut}from"node:os";import{createInterface as Wt}from"node:readline/promises";function Gt(e,t,n){let r={...n};for(let n of t.parameter){let t=n.envName;if(t===void 0)continue;let i=process.env[t]?.trim();if(i===void 0||i.length===0)continue;let o=r[n.optionKey];if(o!==void 0&&(typeof o!=`string`||o!==i))return{...a(`${e} ${n.flag.split(` `)[0]??n.name} conflicts with ${t}; omit the flag or use ${i}.`),data:r};o===void 0&&(r[n.optionKey]=i)}return v(`Environment-bound options applied`,r)}function Kt(e,t,n){if(!I(n))return null;for(let r of t.parameter){let t=r.envName,i=t===void 0?void 0:process.env[t]?.trim();if(t===void 0||i===void 0||i.length===0||!sn(n,r.name))continue;let a=on(n,r.name);if(typeof a!=`string`||a!==i)return`${e} ${r.name} in --from-file conflicts with ${t}; omit the field or use ${i}.`}return null}function qt(e){let t=new Set(e.parameter.map(({name:e})=>e));return e.kind===`multipart`?e.requiredPath:e.requiredPath.filter(e=>!t.has(e))}function Jt(e,t,n,r=!1){if(r||!un(t)||!Array.isArray(n))return fn(e,t,n);for(let[r,i]of n.entries()){let n=fn(e,t,i,r);if(!n.ok)return n}return v(`Body value assigned`,null)}function Yt(e,t,n,r){return fn(e,t,r,n)}function Xt(e){let t=[];for(let n of e.split(`.`)){let e=mn(n);if(t.push(e.key),e.isArray)return t.join(`.`)}return null}function Zt(e,t){let n=Xt(t);if(n===null)return null;let r=an(e,n.split(`.`));return Array.isArray(r)?{path:n,rowCount:r.length,firstHole:rn(r)}:null}function Qt(e,t){if(un(e.name)||e.schemaType===`array`)return v(`Repeated body option selected`,typeof t==`string`?[t]:t);if(!Array.isArray(t))return v(`Scalar body option selected`,t);let n=e.flag.split(` `)[0]??e.name;return t.length===1?v(`Scalar body option selected`,t[0]):a(`${n} was already given; pass it once.`)}var $t=/^(?<row>\d+):(?<item>.*)$/su;function en(e,t){let n=Xt(e.name);if(e.schemaType!==`array`||n===null||t===void 0||typeof t==`boolean`)return null;let r=new Map,i=[];for(let e of typeof t==`string`?[t]:t){let t=$t.exec(e)?.groups,n=t?.row,a=t?.item;if(n===void 0||a===void 0){i.push(e);continue}let o=r.get(Number(n));o===void 0?r.set(Number(n),[a]):o.push(a)}return r.size===0?null:{container:n,rows:r,plain:i}}function tn(e,t,n){let r=0;for(let i of e.parameter){let e=t[i.optionKey];e!==void 0&&typeof e!=`boolean`&&Xt(i.name)===n&&(r=Math.max(r,typeof e==`string`?1:e.length))}return r}function nn(e,t,n,r){for(let i of t.parameter){let t=n[i.optionKey];if(t===void 0)continue;let o=Zt(r,i.name);if(o===null)continue;if(o.firstHole!==null)return a(`${e} has no ${o.path}[] row ${o.firstHole} — number ${o.path}[] rows from 0 with no gaps.`);if(i.schemaType!==`array`||o.rowCount<=1||en(i,t)!==null)continue;let s=i.flag.split(` `)[0]??i.name;return a(`${s} fills one ${o.path}[] row's list, so ${e} cannot also build ${o.rowCount} ${o.path}[] rows from direct options — prefix each value with its 0-based ${o.path}[] row index, as 0:value, or pass the rows with --from-file.`)}return null}function rn(e){for(let t=0;t<e.length;t+=1)if(e[t]===void 0)return t;return null}function an(e,t){let n=e;for(let e of t){if(!I(n))return;n=n[e]??null}return n}function on(e,t){if(!un(t))return an(e,t.split(`.`))}function sn(e,t){return ln(e,t.split(`.`))}function cn(e,t,n){if(!I(n))return null;let r=new Set(t.parameter.map(({name:e})=>e));for(let i of e)if(i!==t){for(let e of i.parameter)if(!r.has(e.name)&&sn(n,e.name))return`${e.name} in --from-file requires --content-type ${i.contentType}.`}return null}function ln(e,t){let[n,...r]=t;if(n===void 0)return!0;let i=mn(n);if(!I(e)||!Object.hasOwn(e,i.key))return!1;let a=e[i.key]??null;return i.isArray?Array.isArray(a)&&a.every(e=>ln(e,r)):ln(a,r)}function un(e){return e.split(`.`).some(e=>mn(e).isArray)}function dn(e,t){return e.parameter.length===0||!I(t)?null:gn(t,[],hn(e.parameter))}function I(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function fn(e,t,n,r=0){let i=t.split(`.`),o=e;for(let[e,s]of i.entries()){let c=mn(s),l=e===i.length-1,u=pn(o,c,t,l,n,r);if(!u.ok||u.data===null)return a(u.summary,u.warnings);if(l)return v(`Body value assigned`,null);o=u.data}return a(`${t} is not a valid body option path.`)}function pn(e,t,n,r,i,o){let s=()=>a(`${n} cannot be combined with another body option at ${t.key}.`),c=e[t.key];if(t.isArray){if(c!==void 0&&!Array.isArray(c))return s();let n=c??[];if(c===void 0&&(e[t.key]=n),r)return n[o]===void 0?(n[o]=i,v(`Body value assigned`,e)):s();let a=n[o];if(a===void 0){let e={};return n[o]=e,v(`Body path created`,e)}return I(a)?v(`Body path stepped`,a):s()}if(r)return c===void 0?(e[t.key]=i,v(`Body value assigned`,e)):s();if(c===void 0){let n={};return e[t.key]=n,v(`Body path created`,n)}return I(c)?v(`Body path stepped`,c):s()}function mn(e){let t=e.endsWith(`[]`);return{key:t?e.slice(0,-2):e,isArray:t}}function hn(e){let t=new Set,n=new Set;for(let r of e){let e=`${r.name}${r.schemaType===`array`?`[]`:``}`;t.add(e);let i=e.split(`.`);for(let e=1;e<i.length;e+=1)n.add(i.slice(0,e).join(`.`))}return{leaf:t,prefix:n}}function gn(e,t,n){if(Array.isArray(e)){if(e.length===0)return null;for(let r of e){let e=gn(r,t,n);if(e!==null)return e}return null}if(!I(e))return null;for(let[r,i]of Object.entries(e)){let e=[...t,Array.isArray(i)?`${r}[]`:r],a=e.join(`.`);if(!_n(a,n)){if(!vn(e))continue;return{path:a,suggestion:yn(e,n)}}let o=gn(i,e,n);if(o!==null)return o}return null}function _n(e,t){return t.prefix.has(e)||t.leaf.has(e)}function vn(e){return e.slice(0,-1).some(e=>e.endsWith(`[]`))}function yn(e,t){let n=e.slice(0,-1).join(`.`),r=e.at(-1)?.replace(/\[\]$/u,``).toLowerCase()??``;return[...t.leaf].filter(e=>e.split(`.`).slice(0,-1).join(`.`)===n).map(e=>({path:e,score:bn(r,e.split(`.`).at(-1)??``)})).filter(({score:e})=>e<1/0).toSorted((e,t)=>e.score-t.score||e.path.localeCompare(t.path))[0]?.path}function bn(e,t){let n=t.replace(/\[\]$/u,``).toLowerCase();return n===e?0:n.endsWith(e)||e.endsWith(n)?1:n.includes(e)||e.includes(n)?2:1/0}function xn(e,t){let n=new Map;for(let e of t){let t=e.flag?.split(` `)[0];t!==void 0&&n.set(t,t===`--from-file`?{...e,inputType:`file`}:e)}for(let t of e){let e=t.long===void 0?void 0:n.get(t.long);e!==void 0&&(t.helpGroup(We(e)),t.description=d(t.description,{...e,hasParseDefault:t.defaultValue!==void 0}))}e.sort((e,t)=>{let r=e.long===void 0?void 0:n.get(e.long),i=t.long===void 0?void 0:n.get(t.long);return r!==void 0&&i!==void 0?kn(r,i):r===void 0?i===void 0?0:1:-1})}function Sn(e){let t=new Map;for(let n of e)for(let e of n.parameter){let r=e.flag.split(` `)[0]??e.flag,i=t.get(r);i===void 0?t.set(r,{variant:[{descriptor:n,parameter:e}]}):t.set(r,{variant:[...i.variant,{descriptor:n,parameter:e}]})}return[...t.values()]}function Cn(e){let{flag:t}=e.variant[0].parameter;return e.variant.every(({parameter:e})=>e.flag===t)?t:`${t.split(` `)[0]??t} <value>`}function wn(e){let t=e.variant.map(({descriptor:e,parameter:t})=>({contentType:e.contentType,text:Dn(e,t)})),n=t[0];return n===void 0?``:t.every(({text:e})=>e===n.text)?`${n.text===``?``:`${n.text} `}Request content: ${t.map(({contentType:e})=>e).join(`, `)}.`:t.map(({contentType:e,text:t})=>`${e}: ${t}`).join(` `)}function Tn(e,t){return[...new Set((e.cliConflicts??[]).filter(e=>e.includes(t)).flatMap(e=>e.filter(e=>e!==t)))]}function En(e,t){let n=e.kind===`multipart`?`Read a JSON object keyed by multipart part name from a file, or use - for stdin`:`Read the JSON request body from a file, or use - for stdin`,r=t.filter(e=>!t.some(t=>t.startsWith(`${e}.`)||t.startsWith(`${e}[].`)));return r.length===0?Ue(n):`${Ue(n)} Required JSON paths: ${r.join(`, `)}.`}function Dn(e,t){let n=He(t.description,void 0),r=e.kind!==`multipart`&&un(t.name),i=e.kind!==`multipart`&&t.optionKey!==t.name&&/^\w+$/u.test(t.name);return`${n}${r?` Repeat to add another value.`:``}${i?` --from-file JSON key: ${t.name}.`:``}${On(e,t)}`}function On(e,t){if(e.kind===`multipart`||t.schemaType!==`array`)return``;let n=Xt(t.name);return n===null?``:` Prefix each value with its 0-based ${n}[] row index, as 0:value, to fill more than one ${n}[] row. A leading digits-and-colon is always read as that index, so name the row of a value that starts the same way, as 0:0:00 for the value 0:00.`}function kn(e,t){return Ke(e)-Ke(t)||Number(e.required!==!0)-Number(t.required!==!0)}async function An(e){let t;try{t=e===`-`?await jn():await Rt(e,`utf8`)}catch(t){return a(`Could not read input: ${t.message}`,[`path=${e}`])}try{if(t.trim().length===0)return v(`No input provided`,null);let e=JSON.parse(t);return v(`Input parsed`,e)}catch(e){return a(`Input is not valid JSON: ${e.message}`)}}async function jn(){if(process.stdin.isTTY)throw Error(`--from-file - requires JSON on stdin, but stdin is a TTY`);process.stdin.setEncoding(`utf8`);let e=``;for await(let t of process.stdin)e+=t;return e}var Mn=`--content-type`;function Nn(e,t,n){let r=e=>!n?.has(e)&&(n?.add(e),!0),i=t.requestBody??[];if(i.length>1&&r(Mn)){let t=i.map(({contentType:e})=>e);e.addOption(new S(`${Mn} <media-type>`,`Select the request content type; omit for ${t[0]}.`).choices(t).argParser(Fn(i)))}if(er(t)&&r(`--from-file`)){let n=i[0];if(n===void 0)throw Error(`${t.operationId} has no request body`);e.addOption(new S(`--from-file <path>`,En(n,n.requiredPath)).argParser(Ln(`--from-file`)))}let a=Sn(i).filter(e=>r(L(e.variant[0].parameter)));for(let t of a.toSorted((e,t)=>kn(e.variant[0].parameter,t.variant[0].parameter))){let{descriptor:n,parameter:r}=t.variant[0],a=new S(Cn(t),i.length>1?wn(t):Dn(n,r));i.length===1&&r.envName!==void 0&&a.env(r.envName);let o=i.length===1?Tn(n,r.optionKey):[];o.length>0&&a.conflicts(o),i.length>1?a.argParser(Pn):un(r.name)||r.schemaType===`array`?a.argParser(In):a.argParser(Ln(r.flag)),e.addOption(a),a.envVar!==void 0&&e.on(`optionEnv:${a.name()}`,()=>{let t=e.opts()[r.optionKey];typeof t==`string`&&t.trim()&&e.setOptionValueWithSource(r.optionKey,t.trim(),`env`)})}$n(e,t,a)}function Pn(e,t){return t===void 0?e:typeof t==`string`?[t,e]:[...t,e]}function Fn(e){return(t,n)=>{if(n!==void 0)throw new se(`${Mn} was already given; pass it once.`);let i=r(e,t);if(!i.ok)throw new se(i.summary);return t}}function In(e,t){return[...t??[],e]}function Ln(e){let t=e.split(/\s+/u)[0]??e;return(e,n)=>{if(n!==void 0)throw new se(`${t} was already given; pass it once.`);return e}}async function Rn(e,t){let n=Ze(e,t),i=r(e.requestBody??[],n);if(!i.ok||i.data===null)return a(i.summary,i.warnings);let o=i.data;if(o===void 0)return v(`No body`,void 0);let s=zn(e,o,t);if(s!==null)return a(s);let c=Gt(e.operationId,o,t);if(!c.ok)return a(c.summary,c.warnings);t=c.data;let l=Bn(o,t);if(l!==null)return a(l);let u=await Wn(t);if(!u.ok)return a(u.summary,u.warnings);let d=cn(e.requestBody??[],o,u.data);if(d!==null)return a(d);let f=Un(e.operationId,o,u.data);if(!f.ok)return f;let p=Kt(e.operationId,o,u.data);if(p!==null)return a(p);let m=Gn(e.operationId,o,t);if(!m.ok)return m;if(u.data===void 0&&m.data===void 0)return o.required?a(Qn(e.operationId,o)):v(`No body`,void 0);let h=qn(e.operationId,u.data,m.data);if(!h.ok||h.data===void 0)return h;if(o.schemaType===`array`&&!Array.isArray(h.data))return a(`${e.operationId} requires a JSON array body.`);if(o.parameter.length>0&&!I(h.data)){let t=o.kind===`multipart`?` keyed by multipart part name`:` body`;return a(`${e.operationId} requires a JSON object${t}.`)}let g=Hn(o,h.data);if(g.length>0)return a(`${e.operationId} requires body option(s): ${g.join(`, `)}`);let _=h.data,y=I(_)?qt(o).filter(e=>!sn(_,e)):[];return y.length>0?a(Vn(e.operationId,o,y)):h}function zn(e,t,n){let r=new Set(t.parameter.map(({optionKey:e})=>e));for(let i of e.requestBody??[])if(i!==t)for(let t of i.parameter){if(r.has(t.optionKey)||n[t.optionKey]===void 0)continue;let i=(e.requestBody??[]).filter(e=>e.parameter.some(({optionKey:e})=>e===t.optionKey)).map(({contentType:e})=>e);return`${L(t)} requires ${Mn} ${i.join(` or `)}.`}return null}function Bn(e,t){for(let n of e.cliConflicts??[]){let e=n.filter(e=>t[e]!==void 0);if(e.length>1)return`Options ${e.join(`, `)} cannot be used together.`}return null}function Vn(e,t,n){let r=`${e} requires JSON body path(s): ${n.join(`, `)}`;return t.kind===`multipart`?`${r}. ${n.includes(`body`)?`For multipart --from-file, wrap the endpoint JSON under top-level "body".`:`For multipart --from-file, put the missing nested path(s) inside top-level "body".`}`:r}function Hn(e,t){return I(t)?e.parameter.filter(e=>e.required&&!sn(t,e.name)).map(L):[]}function Un(e,t,n){let r=dn(t,n);if(r===null)return v(`Body file paths validated`,null);let i=r.suggestion===void 0?``:` Use ${r.suggestion}.`;return a(`${e} --from-file contains unknown JSON path ${r.path}.${i}`)}async function Wn(t){let n=typeof t.fromFile==`string`?t.fromFile:void 0;if(n===void 0)return v(`No body file`,void 0);let r=await An(n);if(!r.ok)return a(r.summary,r.warnings);let i=e.safeParse(r.data);return i.success?v(`Input parsed`,i.data):a(`Input is not valid JSON value: ${i.error.message}`)}function Gn(e,t,n){let r={},i=!1;for(let e of t.parameter){let o=Qt(e,n[e.optionKey]);if(!o.ok||o.data===null)return a(o.summary,o.warnings);let s=o.data;if(s===void 0)continue;let c=Kn(t,n,r,e,s);if(!c.ok)return a(c.summary,c.warnings);i=!0}if(!i)return v(`No direct body options`,void 0);let o=nn(e,t,n,r);return o===null?v(`Direct body options parsed`,r):o}function Kn(e,t,n,r,i){let o=en(r,i);if(o===null){let e=Xn(r,i);return e.ok?Jt(n,r.name,e.data,r.schemaType===`array`):a(e.summary,e.warnings)}if(o.plain.length>0)return a(`${L(r)} mixes row-form values with plain value(s): ${o.plain.join(`, `)} — prefix every value with its 0-based ${o.container}[] row index, as 0:value.`);let s=tn(e,t,o.container);for(let e of o.rows.keys())if(!(e<s))return a(`${L(r)} names ${o.container}[] row ${e}, but these options build at most ${s} ${o.container}[] row(s) — number rows from 0, and name the row of a value that itself starts with digits and a colon, as 0:0:00 for the value 0:00.`);for(let[e,t]of o.rows){let i=[];for(let e of t){let t=Zn(r.name,r.itemSchemaType,e);if(!t.ok)return a(t.summary,t.warnings);i.push(t.data)}let o=Yt(n,r.name,e,i);if(!o.ok)return o}return v(`Body value assigned`,null)}var L=e=>e.flag.split(` `)[0]??e.name;function qn(e,t,n){if(t===void 0)return v(`Direct body parsed`,n);if(n===void 0)return v(`Input parsed`,t);if(I(t)&&I(n))try{return v(`Input parsed`,Jn(t,n))}catch(t){return a(`${e} ${t.message}`)}return a(`${e} cannot combine --from-file with direct body options unless the file body is an object.`)}function Jn(e,t){let n={...e};for(let[e,r]of Object.entries(t)){let t=n[e];if(Array.isArray(t)&&Array.isArray(r))throw Error(`cannot combine --from-file array '${e}' with array body options at the same key — move the per-item fields inside the matching '${e}[]' object(s) in the file body.`);if(t!==void 0&&Yn(t)!==Yn(r))throw Error(`cannot combine --from-file ${Yn(t)} '${e}' with ${Yn(r)} body option(s) at the same key — align the file body shape with the schema.`);n[e]=I(t)&&I(r)?Jn(t,r):r}return n}function Yn(e){return Array.isArray(e)?`array`:I(e)?`object`:`scalar`}function Xn(e,t){if(typeof t==`boolean`)return v(`Body value parsed`,t);if(t===void 0||typeof t==`string`)return Zn(e.name,e.schemaType,t??``);let n=[],r=un(e.name)&&e.schemaType!==`array`?e.schemaType:e.itemSchemaType;for(let i of t){let t=Zn(e.name,r,i);if(!t.ok)return t;n.push(t.data)}return v(`Body value parsed`,n)}function Zn(e,t,n){if(t===`boolean`)return n===`true`?v(`Body value parsed`,!0):n===`false`?v(`Body value parsed`,!1):a(`${e} must be true or false.`);if(t===`number`||t===`integer`){let r=n.trim(),i=Number(r);return r===``||!Number.isFinite(i)?a(`${e} must be a finite ${t}.`):t===`integer`&&!Number.isInteger(i)?a(`${e} must be an integer.`):v(`Body value parsed`,i)}return v(`Body value parsed`,n)}function Qn(e,t){let n=t.parameter.filter(e=>e.required);if(n.length>0&&t.requiredPath.every(e=>n.some(({name:t})=>t===e||t.startsWith(`${e}.`))))return`${e} requires body option(s): ${n.map(L).join(`, `)}`;let r=qt(t);if(r.length>0)return`${e} requires --from-file with JSON body path(s): ${r.join(`, `)}`;let i=t.parameter.map(L).join(`, `);return i.length===0?`${e} requires --from-file`:`${e} requires --from-file or body option(s): ${i}`}function $n(e,t,n){let r=[...t.parameters,...n.map(({variant:e})=>e[0].parameter)];(t.requestBody?.length??0)>1&&r.push({optionKey:`contentType`,flag:Mn,location:`body`}),er(t)&&r.push({optionKey:`fromFile`,flag:`--from-file`,location:`body`}),xn(e.options,r)}function er(e){return(e.requestBody??[]).some(e=>e.kind!==`multipart`||e.parameter.some(e=>e.schemaFormat!==`binary`))}function tr(e){let t=i(e);return ur(t),process.stdout.write(`${JSON.stringify(t)}\n`),t}function nr(e){let t=i(e);ur(t);let n=mt(t.data,t.summary),r=[];if(t.ok&&n!==null){let e=rr(t);r.push(n.endsWith(`
|
|
2
2
|
`)?n.slice(0,-1):n),r.push(...e),process.stdout.write(lt(r.join(`
|
|
3
3
|
`),!0,!0,e.length));return}let a=t.ok?`OK`:`FAIL`;r.push(`[${a}] ${t.summary}`),!t.ok&&t.problem!==void 0&&r.push(...or(t.problem)),r.push(...rr(t)),process.stdout.write(lt(r.join(`
|
|
4
4
|
`),!0))}function rr(e){let t=[];e.ids.length>0&&t.push(` ids: ${e.ids.join(`, `)}`);for(let[n,r]of Object.entries(e.counts))t.push(` ${n}: ${r}`);for(let n of e.references)t.push(` ref: ${n}`);if(e.truncation!==void 0){let n=e.truncation.omitted.join(`, `);t.push(` truncated: byteLength=${e.truncation.byteLength} maxBytes=${e.truncation.maxBytes} omitted=${n}`,` recovery: ${e.truncation.recovery}`)}for(let n of e.warnings)t.push(` warn: ${n}`);return t}function R(e,t){if(e.mode===`data`||e.mode===`data-full`){let n=e.mode===`data`?i(t):t;ur(n),process.stdout.write(`${JSON.stringify(n.ok&&n.truncated!==!0?ir(n.data):n)}\n`),n.ok||(process.exitCode=1);return}let n=e.mode===`json`?tr(t):t;e.mode===`text`&&nr(n),n.ok||(process.exitCode=1)}function ir(e){return typeof e!=`object`||!e||Array.isArray(e)||!Reflect.has(e,`method`)||!Reflect.has(e,`endpoint`)||!(`response`in e)||e.response===void 0?e:e.response}function ar(e,t){let n=ft(t);if(n===null){process.stderr.write(`explain: the response carried no search interpretation
|