@aventurevc/mcp-server 0.8.114 → 0.8.125
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/chunks/cli-help-policy-CbA_VsWk.js +1 -0
- package/dist/chunks/commander-BB7CDPLs.js +19 -0
- package/dist/chunks/contract-BUKPRFvC.js +22 -0
- package/dist/chunks/detail-D2GAzBWm.js +1 -0
- package/dist/chunks/dist-CsqqcGFw.js +96 -0
- package/dist/chunks/env-DXp5C45x.js +1 -0
- package/dist/chunks/{esm-BWsAMtJl.js → esm-BjPDrmO6.js} +9 -9
- package/dist/chunks/logging-DawOnVrS.js +1 -0
- package/dist/chunks/mcp-generation-contract-BNCFdT3C.js +1 -0
- package/dist/chunks/output-spill-ElM4lImT.js +1 -0
- package/dist/chunks/package-DfJq3Rui.js +1 -0
- package/dist/chunks/provider-catalog-8znVjXqU.js +1 -0
- package/dist/chunks/response-problem-Dc5NYwo4.js +1 -0
- package/dist/chunks/result-envelope-CJKoFeOM.js +1 -0
- package/dist/chunks/runtime-identity-DWyecGw5.js +1 -0
- package/dist/chunks/text-field-r9akQrZl.js +3 -0
- package/dist/chunks/tool-policy-BM77Uxx0.js +1 -0
- package/dist/mcp-server/index.js +76 -76
- package/package.json +3 -3
- package/dist/chunks/detail-DMAoIueG.js +0 -1
- package/dist/chunks/dist-3YiK5y1n.js +0 -114
- package/dist/chunks/provider-catalog-BtEhAQb8.js +0 -1
- package/dist/chunks/text-field-C9phORWc.js +0 -3
- package/dist/chunks/text-response-Ba6YgSjJ.js +0 -22
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{c as e}from"./tool-policy-BM77Uxx0.js";function t(t,n,r,i){let a=t===`array`?n:t,o=t===`array`?`...`:``;return r===`uuid`||r===`date-time`||r===`date`?`${r}${o}`:a===`boolean`?`true|false${o}`:a===`integer`||a===`number`?`${a}${o}`:`${e(i)}${o}`}function n(e,t){let n=s(e);if(t===void 0||t.length===0)return n;let r=`Allowed values: ${t.join(`, `)}`;return n===``?`${r}.`:`${n} ${r}.`}var r={path:{heading:`Path parameters:`,rank:0},header:{heading:`Request headers:`,rank:1},input:{heading:`Input:`,rank:2},body:{heading:`Body fields:`,rank:3},option:{heading:`Options:`,rank:1/0}};function i(e){return o(e).rank}function a(e){return o(e).heading}function o(e){return e.location===`path`?r.path:e.location===`header`?r.header:e.inputType===`file`||e.schemaFormat===`binary`?r.input:e.location===`body`?r.body:r.option}var s=e=>e===``||/[.!?]$/u.test(e)?e:`${e}.`,c={researchData:{heading:`Research data commands:`,rank:0},account:{heading:`Account commands:`,rank:1},administration:{heading:`Administration commands:`,rank:2},cli:{heading:`CLI commands:`,rank:3}};function l(e,t){return e!==void 0&&u(e,t)===`administration`}function u(e,t){return d[e]??t?.[e]?.section}var d={app:`account`,auth:`account`,entities:`researchData`,people:`researchData`,enrichments:`researchData`,news:`researchData`,search:`researchData`,resolve:`researchData`,lookup:`researchData`,"lookup-jobs":`researchData`,"lookup-mentions":`researchData`,provenance:`administration`,billing:`account`,harness:`administration`,jobs:`administration`,operations:`administration`,metrics:`cli`,inference:`administration`,web:`researchData`,contacts:`administration`,"url-types":`researchData`,"unique-ids":`researchData`,research:`administration`,status:`cli`,agents:`cli`,help:`cli`},f=new Set([`metrics`]);export{n as a,a as c,u as i,s as l,f as n,t as o,l as r,i as s,c as t};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import{EventEmitter as e}from"node:events";import t from"node:child_process";import n from"node:path";import r from"node:fs";import i from"node:process";import{stripVTControlCharacters as a}from"node:util";var o=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},s=class extends o{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}},c=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new s(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,t):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function l(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}var u=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let t=e.registeredArguments.map(e=>l(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(t?` `+t:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
|
|
2
|
+
`)}displayWidth(e){return a(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
|
|
3
|
+
`+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
|
|
4
|
+
`)}},d=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=m(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,t)=>{if(!this.argChoices.includes(e))throw new s(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,t):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?p(this.name().replace(/^no-/,``)):p(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},f=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r!==void 0&&r;return t.negate===(i===e)}};function p(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function m(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
|
|
5
|
+
- a short flag is a single dash and a single character
|
|
6
|
+
- either use a single dash and a single character (for a short flag)
|
|
7
|
+
- or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
|
|
8
|
+
- too many short flags`):i.test(t)?Error(`${n}
|
|
9
|
+
- too many long flags`):Error(`${n}
|
|
10
|
+
- unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}var h=3;function g(e,t){if(Math.abs(e.length-t.length)>h)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function _(e,t){if(!t||t.length===0)return``;t=Array.from(new Set(t));let n=e.startsWith(`--`);n&&(e=e.slice(2),t=t.map(e=>e.slice(2)));let r=[],i=h;return t.forEach(t=>{if(t.length<=1)return;let n=g(e,t),a=Math.max(e.length,t.length);(a-n)/a>.4&&(n<i?(i=n,r=[t]):n===i&&r.push(t))}),r.sort((e,t)=>e.localeCompare(t)),n&&(r=r.map(e=>`--${e}`)),r.length>1?`\n(Did you mean one of ${r.join(`, `)}?)`:r.length===1?`\n(Did you mean ${r[0]}?)`:``}var v=class s extends e{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>i.stdout.write(e),writeErr:e=>i.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>i.stdout.isTTY?i.stdout.columns:void 0,getErrHelpWidth:()=>i.stderr.isTTY?i.stderr.columns:void 0,getOutHasColors:()=>b()??(i.stdout.isTTY&&i.stdout.hasColors?.()),getErrHasColors:()=>b()??(i.stderr.isTTY&&i.stderr.hasColors?.()),stripColor:e=>a(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(e){return new s(e)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
|
|
11
|
+
- specify the name in Command constructor or using .name()`);return t||={},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new c(e,t)}argument(e,t,n,r){let i=this.createArgument(e,t);return typeof n==`function`?i.default(r).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==`boolean`)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,n,r]=(e??`help [command]`).match(/([^ ]+) *(.*)/),i=t??`display help for command`,a=this.createCommand(n);return a.helpOption(!1),r&&a.arguments(r),i&&a.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e==`object`?(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this):(this.helpCommand(e,t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand(`help`))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=[`preSubcommand`,`preAction`,`postAction`];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
|
|
12
|
+
Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return this._exitCallback=e||(e=>{if(e.code!==`commander.executeSubCommandAsync`)throw e}),this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new o(e,t,n)),i.exit(e)}action(e){let t=t=>{let n=this.registeredArguments.length,r=t.slice(0,n);return r[n]=this._storeOptionsAsProperties?this:this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new d(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(e){if(e.code===`commander.invalidArgument`){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
|
|
13
|
+
- already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){let r=t(this._findCommand(n)).join(`|`),i=t(e).join(`|`);throw Error(`cannot add command '${i}' as already have command '${r}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,`default`);let r=(t,r,i)=>{t==null&&e.presetArg!==void 0&&(t=e.presetArg);let a=this.getOptionValue(n);t!==null&&e.parseArg?t=this._callParseArg(e,t,a,r):t!==null&&e.variadic&&(t=e._collectValue(t,a)),t??=e.negate?!1:e.isBoolean()||e.optional?!0:``,this.setOptionValueWithSource(n,t,i)};return this.on(`option:`+t,t=>{let n=`error: option '${e.flags}' argument '${t}' is invalid.`;r(t,n,`cli`)}),e.envVar&&this.on(`optionEnv:`+t,t=>{let n=`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`;r(t,n,`env`)}),this}_optionEx(e,t,n,r,i){if(typeof t==`object`&&t instanceof d)throw Error(`To add an Option object use addOption() instead of option() or requiredOption()`);let a=this.createOption(t,n);if(a.makeOptionMandatory(!!e.mandatory),typeof r==`function`)a.default(i).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,n)=>{let r=e.exec(t);return r?r[0]:n},a.default(i).argParser(r)}else a.default(r);return this.addOption(a)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error(`call .storeOptionsAsProperties() before adding options`);if(Object.keys(this._optionValues).length)throw Error(`call .storeOptionsAsProperties() before setting option values`);return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error(`first parameter to parse must be array or undefined`);if(t||={},e===void 0&&t.from===void 0){i.versions?.electron&&(t.from=`electron`);let e=i.execArgv??[];(e.includes(`-e`)||e.includes(`--eval`)||e.includes(`-p`)||e.includes(`--print`))&&(t.from=`eval`)}e===void 0&&(e=i.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case`node`:this._scriptPath=e[1],n=e.slice(2);break;case`electron`:i.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case`user`:n=e.slice(0);break;case`eval`:n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||`program`,n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?(this.options.filter(e=>e.negate&&e.defaultValue===void 0&&this.getOptionValue(e.attributeName())===void 0).forEach(e=>{let t=e.long.replace(/^--no-/,`--`);this._findOption(t)||this.setOptionValueWithSource(e.attributeName(),!0,`default`)}),this.saveStateBeforeParse()):this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
|
|
14
|
+
- either make a new Command for each call to parse, or stop storing options as properties`);this._name=this._savedState._name,this._scriptPath=null,this.rawArgs=[],this._optionValues={...this._savedState._optionValues},this._optionValueSources={...this._savedState._optionValueSources},this.args=[],this.processedArgs=[]}_checkForMissingExecutable(e,t,n){if(r.existsSync(e))return;let i=`'${e}' does not exist
|
|
15
|
+
- if '${n}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
16
|
+
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
17
|
+
- ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(i)}_executeSubCommand(e,a){a=a.slice();let s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let i=n.resolve(e,t);if(r.existsSync(i))return i;if(s.includes(n.extname(t)))return;let a=s.find(e=>r.existsSync(`${i}${e}`));if(a)return`${i}${a}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let l=e._executableFile||`${this._name}-${e._name}`,u=this._executableDir||``;if(this._scriptPath){let e;try{e=r.realpathSync(this._scriptPath)}catch{e=this._scriptPath}u=n.resolve(n.dirname(e),u)}if(u){let t=c(u,l);if(!t&&!e._executableFile&&this._scriptPath){let r=n.basename(this._scriptPath,n.extname(this._scriptPath));r!==this._name&&(t=c(u,`${r}-${e._name}`))}l=t||l}let d=s.includes(n.extname(l)),f;i.platform===`win32`?(this._checkForMissingExecutable(l,u,e._name),a.unshift(l),a=y(i.execArgv).concat(a),f=t.spawn(i.execPath,a,{stdio:`inherit`})):d?(a.unshift(l),a=y(i.execArgv).concat(a),f=t.spawn(i.argv[0],a,{stdio:`inherit`})):f=t.spawn(l,a,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{i.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new o(e,`commander.executeSubCommandAsync`,`(close)`)):i.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(l,u,e._name);else if(t.code===`EACCES`)throw Error(`'${l}' not executable`);if(!p)i.exit(1);else{let e=new o(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)!==void 0&&this.getOptionValueSource(t)!=="default"});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
|
|
18
|
+
`),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in i.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,i.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new f(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=_(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=e.length,i=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${r}: ${e.join(`, `)}.`;this.error(i,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=_(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>l(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=n.basename(e,n.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(i.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
|
|
19
|
+
Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function y(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function b(){if(i.env.NO_COLOR||i.env.FORCE_COLOR===`0`||i.env.FORCE_COLOR===`false`)return!1;if(i.env.FORCE_COLOR||i.env.CLICOLOR_FORCE!==void 0)return!0}new v;export{o as a,c as i,d as n,s as o,u as r,v as t};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import{C as e,O as t,T as n,i as r,l as i,n as a,o,p as s,r as c,t as l,u,v as d,w as f,y as p}from"./person-owner-BJgNYLKX.js";import{r as m,s as ee,t as h,u as g}from"./result-envelope-CJKoFeOM.js";import{i as _}from"./package-DfJq3Rui.js";import{a as te,i as ne,o as re,s as ie}from"./tool-policy-BM77Uxx0.js";import{C as ae,S as oe,T as se,_ as ce,a as le,b as v,c as ue,d as de,f as fe,g as y,h as pe,i as me,l as he,m as ge,n as _e,o as ve,p as ye,r as be,s as xe,t as Se,u as Ce,v as we,w as Te,x as Ee,y as De}from"./detail-D2GAzBWm.js";import{a as Oe,n as ke,r as b,t as x}from"./text-field-r9akQrZl.js";import{a as Ae,o as je}from"./cli-help-policy-CbA_VsWk.js";import{Buffer as Me}from"node:buffer";var S=o([`HIGH`,`MEDIUM`,`LOW`]),Ne=n([o([`OPERATION`,`SKILL`,`PROMPT`,`COMPLETION_GATE`,`RESEARCH_DETAIL_TYPE`,`RESEARCH_SNIPPET_TYPE`,`TEXT_TYPE`]),f()]),Pe=p({excerpt:f(),sourceId:f(),sourceType:Ne,sourceVersion:f().nullish()}),Fe=p({instruction:f(),operationId:f(),stepKey:f()}),Ie=p({body:f(),expectation:f(),method:i(f()),override:f(),reject:i(f()),typeCatalog:f()}),Le=p({cliCommand:f(),mcpTool:f().nullish(),step:Fe,writeGuidance:Ie.nullish()}),Re=n([o([`ENTITY`,`TEXT`]),f()]),ze=p({description:f(),key:f(),type:Re}),Be=p({catalogRevision:s(),gateId:i(f()),input:i(ze),step:i(Le),taskKey:f()}),C=o([`TASK_PLAN`,`OPERATION_ADVICE`,`CLARIFY`,`ABSTAIN`]),Ve=p({candidate:i(Pe),operationId:f().nullish(),outcome:C,probability:d().nullish(),taskKey:f().nullish(),taskPlan:Be.nullish()}),He=p({answer:f(),citation:i(Pe),confidence:S,resolution:Ve.nullish()});function w(e,t,n=t.inputName){if(t.in===`body`)return n;let r=Qe.find(t=>n===t.name&&e.path.includes(t.path));return r===void 0?Ze(T(n!==`id`&&n!==`slug`?n:`${Ge(e.path)}${Je(n)}`),t):r.inputName}function Ue(e,t,n=qe(e)){return We(Ke(e,t),new Set(n))}function We(e,t){if(!t.has(e))return e;let n=`body${Je(e)}`,r=n;for(let e=2;t.has(r);e+=1)r=`${n}${e}`;return r}function Ge(e){return $e.find(([,t])=>t.test(e))?.[0]??`record`}function Ke(e,t){if(t.name===`id`&&e.path===`/v1/app/url-slug-redirects`)return`recordId`;let n=Ye(t);return Ze(e.intent===`search`&&(t.name.startsWith(`filter.`)||t.name.startsWith(`search.`))?T(n.replace(/^(?:filter|search)/u,``).replace(/^./u,e=>e.toLowerCase())):n,t)}function qe(e){return new Set(e.parameter.filter(e=>e.in===`path`||e.in===`query`||e.in===`header`).map(t=>w(e,t)))}function Je(e){return e.replace(/^./u,e=>e.toUpperCase())}function T(e){return e.replace(/^addressAddress/u,`address`).replace(/^arrayFilterAmountInvestedRange/u,`fundraiseAmountInvestedRange`).replace(/^arrayFilterAmountRaisedRange/u,`fundraiseAmountRaisedRange`).replace(/^arrayFilterEntityName$/u,`entityName`).replace(/^arrayFilterInvestedCompany$/u,`fundraiseInvestedCompanyName`).replace(/^arrayFilterPersonTitle$/u,`personTitle`).replace(/^arrayFilterRound$/u,`fundraiseRound`).replace(/^arrayFilterTotalInvestmentCount/u,`totalInvestmentCount`).replace(/^arrayFilterTypeRecord$/u,`typeRecord`).replace(/^createEntity/u,`entity`).replace(/^createUrlLink/u,`urlLink`).replace(/^fundraiseActivity/u,`fundraise`).replace(/FundraiseActivity/gu,`Fundraise`).replace(/^logoOption/u,`logo`).replace(/LogoOption/gu,`Logo`).replace(/^researchDetailTypeResearchDetail$/u,`researchDetailType`).replace(/^researchDetailValueResearchDetail$/u,`researchDetailValue`).replace(/^textText$/u,`text`).replace(/^textTextName$/u,`textName`).replace(/^textTextType$/u,`textType`)}function Ye(e){let t=T(e.inputName);return/(?:^|\.)nameAlias\[\]\./u.test(e.name)?t.replace(/^entityNameAlias/u,`alias`):/(?:^|\.)urlLink\[\]\./u.test(e.name)?Xe(t):/(?:^|\.)manualLogo\./u.test(e.name)?t.replace(/^manualLogo/u,`logo`):t}function Xe(e){return e===`urlLinkUrl`?`url`:e===`urlLinkUrlType`?`urlType`:e.replace(/^urlLink/u,`url`)}function Ze(e,t){return e===`text`?/(?:^|\.)text(?:\[\])?\.text$/u.test(t.name)?`textBody`:`inputText`:e}var Qe=[{name:`detailId`,path:`/research-details/{detailId}`,inputName:`researchDetailId`},{name:`version`,path:`/instructions/`,inputName:`instructionVersion`},{name:`detailId`,path:`/financial/valuation/{detailId}`,inputName:`valuationDetailId`},{name:`joinId`,path:`/fundraise-investor-joins`,inputName:`fundraiseInvestorJoinId`}],$e=[[`entity`,/^\/v1\/entities(?:$|\/detail|\/lookup|\/summary|\/duplicate-check)/u],[`person`,/^\/v1\/people(?:\/detail|\/lookup|\/duplicate-check|\/\{slug\})/u],[`news`,/^\/v1\/(?:news\/|jobs\/news\/)/u],[`screenshot`,/^\/v1\/media\/screenshots\//u],[`media`,/^\/v1\/media/u],[`article`,/^\/v1\/app\/blog\/articles/u],[`page`,/^\/v1\/app\/pages/u],[`contact`,/^\/v1\/contacts\//u],[`provenance`,/^\/v1\/provenance\//u],[`location`,/^\/v1\/addresses\/locations\//u]];function et(e){let t=e.requestBody?.[0],n=e.parameter.map(t=>tt(t,w(e,t))),r=(t?.parameter??[]).map(t=>tt(t,Ue(e,t)));return{selector:n.filter(e=>e.location===`path`||nt(e)),pagination:n.filter(rt),filter:[...n.filter(E),...r.filter(E)],body:r.filter(e=>!E(e))}}function tt(e,t){return{name:e.in===`body`?t:e.name,flag:ne(t),required:e.required,location:e.in,description:e.description||`${e.name} ${e.in} parameter`}}function nt(e){return/(^|[A-Z])(id|slug)$/u.test(e.name)}function rt(e){return[`page`,`size`,`sort`,`cursor`,`mode`,`projection`].includes(e.name)}function E(e){return e.location!==`path`&&!nt(e)&&!rt(e)}function it(e,t){let n=e.requestBody?.[0],r={operationId:e.operationId,method:e.method,path:e.path,summary:e.summary,cli:e.projection.cliPath.join(` `),intent:e.intent,scope:e.projection.scope,requiredInput:at(e)};return t?{...r,resource:e.resource,bodySchemaName:n?.schemaName??null,bodyKind:n?.kind??null,bodyRequired:n?.required??!1,requiredBodyPath:n?.requiredPath??[],argument:et(e)}:{...r,optionalInput:ot(e)}}function at(e){return[...e.parameter.filter(({required:e})=>e).map(({name:e})=>e),...e.requestBody?.[0]?.requiredPath??[]]}function ot(e){let t=e.requestBody?.[0],n=new Set(t?.requiredPath??[]);return{query:e.parameter.filter(e=>e.in===`query`&&!e.required).map(({name:e})=>e),body:(t?.parameter??[]).filter(({name:e})=>!n.has(e)).map(({name:e})=>e)}}var st=160;function ct(e){return!Array.isArray(e)||e.length===0||!e.every(lt)?null:`Operation catalog matches\n${e.flatMap(e=>[`${e.operationId} ${e.method} ${e.path} (aventure_${e.intent})`,` ${e.summary}`,` required: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}`,...`optionalInput`in e?Object.entries(e.optionalInput).filter(([,e])=>e.length>0).map(([e,t])=>` optional ${e}: ${t.join(`, `)}`):[],...`argument`in e?Object.values(e.argument).flat().map(e=>` ${e.name} (${e.location}${e.required?`, required`:``}): ${e.description.length<=st?e.description:`${e.description.slice(0,157)}...`}`):[]]).join(`
|
|
2
|
+
`)}\n`}function lt(e){return typeof e==`object`&&!!e&&`operationId`in e&&typeof e.operationId==`string`&&`requiredInput`in e&&Array.isArray(e.requiredInput)&&`intent`in e&&`summary`in e}function ut(e){let t=t=>{let n=e.parameter.filter(e=>e.in===t&&e.required&&e.schemaDefault===void 0).map(dt);return n.length===0?void 0:Object.fromEntries(n)},n=t(`path`),r=t(`query`),i=[...new Set((e.requestBody?.[0]?.requiredPath??[]).map(e=>e.split(/[.[]/u)[0]))];return{tool:re(e.intent),operationId:e.operationId,...n===void 0?{}:{pathParams:n},...r===void 0?{}:{query:r},...e.requestBody===void 0?{}:{body:Object.fromEntries(i.map(e=>[e,`<${e}>`]))}}}function dt(e){return[e.name,`<${e.name}>`]}function ft(e){let t=D(e.description);return{useFor:t.useFor||e.summary||e.description||`${e.method} ${e.path}`,notFor:t.notFor}}function D(e){let t=e.match(/USE FOR:\s*([\s\S]*?)(?:NOT FOR:|$)/iu),n=e.match(/NOT FOR:\s*([\s\S]*?)$/iu);return{useFor:t?.[1]?.trim()??``,notFor:n?.[1]?.trim()??``}}var O=2,pt=new Set(`a.an.the.and.or.for.to.of.in.on.at.by.with.from.into.is.are.be.do.does.how.what.which.that.this.these.those.i.me.my.we.our.you.your.it.its.please.want.need.can.could.should.would`.split(`.`));function k(e,t){let n=j(t);n.length!==0&&(e.add(n),(n===`individual`||n===`individuals`)&&k(e,`person`),gt(e,mt(n),n),gt(e,ht(n),n))}function mt(e){if(e===`people`)return`person`;let t=e.endsWith(`ies`)?e.slice(0,-3):``;if(t.length>=O&&!t.endsWith(`v`)&&/[^aeiou]$/u.test(t))return`${e.slice(0,-3)}y`;if(e.length>O&&e.endsWith(`s`)&&!e.endsWith(`ss`)&&!e.endsWith(`us`)&&e!==`news`)return e.slice(0,-1)}function ht(e){return e===`person`?`people`:e.length>=O&&e.endsWith(`y`)&&/[^aeiou]y$/u.test(e)?`${e.slice(0,-1)}ies`:e.endsWith(`s`)?void 0:`${e}s`}function gt(e,t,n){t!==void 0&&t!==n&&t.length>=O&&/^[a-z]+$/u.test(t)&&e.add(t)}function _t(e){let t=new Set(A(e)),n=Array.from(t);for(let e of n)k(t,e);return t}function vt(e){return A(e).map(_t)}function yt(e,t){if(e.length===0)return!1;let n=_t(t.join(` `));return e.every(e=>[...e].some(e=>n.has(e)))}function A(e){return j(e).split(/[^a-z0-9]+/u).filter(e=>e.length>0&&!pt.has(e))}function j(e){return e.trim().replace(/([a-z0-9])([A-Z])/gu,`$1 $2`).replace(/[_-]/gu,` `).replace(/\s+/gu,` `).toLowerCase().replace(/\blook up\b/gu,`lookup`)}var bt=/\b(?:https?:\/\/)?(?:[a-z0-9-]+\.)+[a-z]{2,}(?::\d+)?(?:\/\S*)?/giu,xt=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b/giu,St=/^[a-z0-9]+(?:-[a-z0-9]+)+$/u,Ct=250,wt=40,Tt=100;function Et(e,t){let n=new Set,r=[],i=/\bslugs?\b/iu.test(e);return{text:e.replace(xt,()=>(n.add(`uuid`),` `)).replace(bt,e=>{n.add(`url`);let t=e.replace(/^(?:https?:\/\/)?[^/]+/iu,``).split(/[?#]/u)[0].split(`/`).filter(e=>e.length>0).map(e=>e.toLowerCase()),i=t.at(-1);return i!==void 0&&St.test(i)&&(n.add(`slug`),t.pop()),r.push(...t.flatMap(e=>e.split(/[^a-z0-9]+/u))),` `}).split(/\s+/u).filter(e=>{let r=e.replace(/^[^a-z0-9]+|[^a-z0-9]+$/giu,``).toLowerCase(),a=St.test(r)&&!t.has(r)&&(i||/\d/u.test(r));return a&&n.add(`slug`),!a}).join(` `).trim(),kind:n,urlPathWord:r.filter(e=>e.length>0)}}function Dt(e,t,n){return e===`uuid`?/(?:^id|Id)$/u.test(t)&&n.includes(`{${t}}`):t===e}function Ot(e,t){let n=new Set;for(let r of e){let e=new Set;k(e,r);let i=t.filter(({cliPath:t})=>e.has(t[0]??``)),a=i.length>0?i:t.filter(({cliPath:t})=>t.some(t=>e.has(t)));for(let{resource:e}of a)n.add(e)}return n}function kt(e,t,n){if(n.intent!==`read`&&n.intent!==`lookup`)return 0;let r=new Set(A(n.summary)),i=0;for(let t of e.kind)n.directParameterName.some(e=>Dt(t,e,n.path))&&(i+=Ct,r.has(t)&&(i+=wt));if(i===0)return 0;let a=new Set(A(`${n.summary} ${n.description}`));return(t.size>0?t.has(n.resource):e.urlPathWord.some(e=>{let t=new Set;return k(t,e),[...t].some(e=>a.has(e))}))&&(i+=Tt),i}var At=5,jt=.5,Mt=15,Nt=30,Pt=2;function Ft(e,t,n){let r=t.map(e=>({item:e,fields:n(e)})),i=Et(e,new Set(r.flatMap(({fields:e})=>e.cliPath))),a=Ot(i.urlPathWord,r.map(({fields:e})=>e)),o=j(i.text);if(o.length===0&&i.kind.size===0)return t.map(e=>({item:e,score:1}));let s=_t(o),c=vt(o);return r.map(({item:e,fields:t})=>({item:e,fields:t,score:(o.length===0?0:zt(o,s,c,t))+kt(i,a,t)})).filter(({score:e})=>e>0).toSorted((e,t)=>Number(e.fields.deprecated===!0)-Number(t.fields.deprecated===!0)||t.score-e.score||e.fields.cliPath.length-t.fields.cliPath.length||e.fields.cliPath.join(` `).localeCompare(t.fields.cliPath.join(` `))||e.fields.operationId.localeCompare(t.fields.operationId)).map(({item:e,score:t})=>({item:e,score:t}))}function It(e){let t=[...e.parameter,...(e.requestBody??[]).flatMap(e=>e.parameter)];return{...e,cliPath:e.projection.cliPath,enumParameter:t.map(e=>({values:e.itemSchemaEnum??e.schemaEnum??[],direct:e.name===e.inputName})),parameterName:t.flatMap(e=>[e.name,e.inputName]),directParameterName:e.parameter.map(e=>e.name),parameterDescription:[...e.parameter,...e.requestBody??[],...(e.requestBody??[]).flatMap(e=>e.parameter)].map(({description:e})=>e)}}function Lt(e,t){let n=Ft(e.q?.trim()??``,t.filter(t=>Rt(e,t)),It),r=(n[0]?.score??0)*jt,i=n.filter(({score:e})=>e>=r),a=e.limit===void 0||!Number.isFinite(e.limit)?At:e.limit,o=Math.min(i.length,Math.max(0,Math.trunc(a))),s=i.slice(0,o).map(({item:e})=>e),c=s.map(e=>it(e,s.length===1));return{summary:`Operation catalog matches`,data:c,counts:{totalOperations:t.length,matched:i.length,returned:c.length}}}function Rt(e,t){let n=e.root?.trim().toLowerCase();return!(e.method!==void 0&&t.method!==e.method||e.scope!==void 0&&t.projection.scope!==e.scope||n&&t.resource!==n&&t.projection.cliPath[0]!==n)}function zt(e,t,n,r){let i=Ht(r),a=Bt(r),o=0;i.some(t=>t===e)&&(o+=100),i.some(t=>t.includes(e))&&(o+=40),o+=Vt(e,i);let s=new Set(i.flatMap(A));for(let e of t)i.some(t=>t===e)?o+=20:s.has(e)&&(o+=8);for(let e of r.cliPath){let n=new Set;k(n,e),[...n].some(e=>t.has(e))&&(o+=Mt)}yt(n,a)&&(o+=200),r.parameterName.some(t=>j(t)===e)&&(o+=Nt);let c=new Set(r.parameterDescription.flatMap(A));for(let e of t)c.has(e)&&(o+=Pt);return o+=Wt(t,r.enumParameter),[`list`,`search`,`find`,`browse`].some(e=>t.has(e))&&/^(?:list|search)[A-Z]/u.test(r.operationId)&&(o+=30),o-=Ut(e,t,r.description),o}function Bt(e){return[e.operationId,e.cliPath.join(` `),e.summary].map(j).filter(e=>e.length>0)}function Vt(e,t){let n=A(e),r=0;for(let e=0;e<n.length-1;e+=1){let i=n.slice(e,e+2).join(` `);t.some(e=>e.includes(i))&&(r+=24)}return r}function Ht(e){return[...new Set([e.operationId,e.method,e.path,e.resource,e.intent,e.cliPath.join(` `),e.summary,D(e.description).useFor||e.description].map(j).filter(e=>e.length>0))]}function Ut(e,t,n){let r=j(D(n).notFor);if(r.length===0)return 0;let i=r.includes(e)?40:0,a=new Set(A(r));for(let e of t)r===e?i+=20:a.has(e)&&(i+=8);return i}function Wt(e,t){let n=0;for(let{values:r,direct:i}of t)r.some(t=>Gt(e,t))&&(n+=i?40:10);return n}function Gt(e,t){let n=A(t);return n.length>0&&n.every(t=>e.has(t))}var Kt=3,qt=200;function Jt(e,t){let{operationId:n}=e;if(n===void 0||t.some(e=>e.operationId===n))return null;let r=Lt({q:[n,...Yt(e)].join(` `),limit:Kt},t),i=r.summary===`Operation catalog matches`?r.data:[],a=i.map(e=>`${e.operationId} (${e.method} ${e.path})`);return m(`Operation ${n} is not in the MCP catalog.${a.length===0?``:` Closest operations: ${a.join(`, `)}.`}`,i.map(e=>`Use operationId ${e.operationId} with aventure_${e.intent}: ${e.method} ${e.path}; required inputs: ${e.requiredInput.length===0?`none`:e.requiredInput.join(`, `)}.`))}function Yt(e){let t=e.body,n=typeof t==`object`&&t&&!Array.isArray(t)?Object.entries(t):[];return[...Object.entries(e.pathParams??{}),...Object.entries(e.query??{}),...n].flatMap(([e,t])=>typeof t==`string`&&t.length<=qt?[e,t]:[e])}function Xt(e){return typeof e.data==`object`&&e.data!==null&&`response`in e.data?e.data.response:void 0}async function Zt(e,t,n,r){let i=e.q?.trim()??``;if(i.length===0)return m(`Provide q to resolve a request to one operation.`);let a=n.find(({resource:e,intent:t,deprecated:n})=>e===`help`&&t===`search`&&n!==!0);if(a===void 0)return m(`This build ships no help resolve operation.`);let o=await r(a,{body:{question:i,resolve:!0,...e.scope===void 0?{}:{scope:e.scope===`read`?`READ`:`WRITE`},includePrivate:!1}});if(!o.ok)return{...o,data:null};let s=He.safeParse(Xt(o));if(!s.success||s.data.resolution==null)return m(`The help resolve operation returned no resolution.`);let{answer:c,resolution:l}=s.data,u=e=>t.find(t=>t.operationId===e),d=u(l.operationId),f=l.taskPlan??void 0,p=(f?.step??[]).map(({step:e})=>({step:e,contract:u(e.operationId)})),h=[...new Set([...l.operationId!=null&&d===void 0?[l.operationId]:[],...p.filter(({contract:e})=>e===void 0).map(({step:e})=>e.operationId)])];return ee(h.length===0?`Help resolution`:`Help resolution this connection cannot finish: it cannot run ${h.join(`, `)}.`,{outcome:l.outcome,probability:l.probability,answer:c,candidate:l.candidate.map(({sourceId:e})=>e),...d===void 0?{}:{operation:{operationId:d.operationId,apiRoute:`${d.method} ${d.path}`,...ft(d),bodySchemaName:d.requestBody?.[0]?.schemaName??null,mcpCall:ut(d)}},...l.taskKey==null?{}:{taskKey:l.taskKey},...f===void 0?{}:{taskPlan:{catalogRevision:f.catalogRevision,input:f.input,...f.gateId.length===0?{}:{gateId:f.gateId},step:p.map(({contract:e,step:{stepKey:t,instruction:n,operationId:r}})=>e===void 0?{stepKey:t,instruction:n,operationId:r}:{stepKey:t,instruction:n,mcpCall:ut(e)})}}},{warnings:h.map(e=>n.some(t=>t.operationId===e)?`Operation ${e} is in this server's catalog, but your grant does not allow it.`:`Operation ${e} is outside this server's catalog, so no credential runs it here.`)})}var Qt=p({detail:f(),field:f().nullish(),scope:o([`entity`,`person`,`news`])}),$t=n([o([`auto`,`exact`,`keyword`,`semantic`,`natural`,`hybrid`]),f()]),M=p({modeRequested:$t,modeUsed:$t}),en=p({answerUnavailable:u(),entity:M,news:M,person:M,rejection:i(Qt),unavailable:i(o([`entity`,`person`,`news`]))}),tn=p({acceleratorParticipation:i(ye),detail:i(de)}),N=p({core:v,enrichment:Ee,fundraiseRound:i(y),research:tn,semanticMatch:le.nullish()}),nn=o([`curated`,`semantic`,`precomputed`,`derived`,`computed`]),rn=p({compositeScore:d().nullish(),cosineScore:d().nullish(),curatedAsOf:c().nullish(),curatedRelationshipType:f().nullish(),curatedSource:f().nullish(),derivedFromEntityId:t().nullish(),matchedSectionWeight:d().nullish(),origin:nn,rank:s(),sharedSectionCount:s().nullish()}),an=p({entity:N,similarity:rn}),on=o([`aventureBlog`,`personalBlog`,`employerBlog`,`linkedin`,`xTwitter`,`medium`,`substack`,`other`]),sn=p({author:f().nullish(),createdAt:r({offset:!0}),externalId:f().nullish(),id:t(),isCurrent:u(),lastFetchedAt:r({offset:!0}).nullish(),mentionedEntityId:i(t()),mentionedPersonId:i(t()),owner:l,publishedAt:r({offset:!0}).nullish(),summary:f().nullish(),summaryGeneratedAt:r({offset:!0}).nullish(),title:f().nullish(),topic:f().nullish(),type:on,updatedAt:r({offset:!0}),url:f()}),cn=o([`low`,`medium`,`high`]),ln=p({asOfDate:r({offset:!0}).nullish(),dataConfidence:cn.nullish(),dateValue:r({offset:!0}).nullish(),numericValue:d().nullish(),referenceValue:f().nullish(),source:f().nullish(),textValue:f().nullish(),updatedAt:r({offset:!0}).nullish(),valueType:fe}),un=p({asOfDate:r({offset:!0}),fact:ln,id:f()}),dn=p({fundraiseInvestorJoin:u(),fundraiseTransaction:u(),operatingStatus:u(),relationship:u()}),fn=o([`Acquisition`,`Acquired`,`Acquired Subsidiary`]),pn=o([`Announced`,`Announced; subject to approvals and closing conditions`,`Active`,`Closed`,`Completed`,`In Progress`,`Open`]),mn=p({acquiredEntity:v,acquirerEntity:v,amount:d().int().nullish(),announcedAt:r({offset:!0}).nullish(),asOf:c().nullish(),completedAt:r({offset:!0}).nullish(),createdAt:r({offset:!0}).nullish(),currency:f().nullish(),dataConfidence:De.nullish(),evidence:dn,fundraiseTransactionId:t().nullish(),investorJoinId:t().nullish(),publicSource:pe.nullish(),relationshipId:s(),status:fn,transactionStatus:pn.nullish(),updatedAt:r({offset:!0}).nullish()}),hn=o([`SAFE`,`Convertible Note`,`Preferred Stock`,`Common Stock`,`Other Equity`,`Bond`,`Loan`,`Other Debt`,`Grant`,`Token`]),gn=p({amountInvested:d().nullish(),createdAt:r({offset:!0}),financialInstrumentType:hn.nullish(),id:t(),investor:l,leadInvestor:u(),transactionId:t(),updatedAt:r({offset:!0})}),_n=p({entity:Se,investorAttribution:i(ce),round:i(we),roundCount:s()}),vn=p({core:v,similarity:rn,urlLink:i(oe)}),yn=p({compliance:Ce.nullish(),createdAt:r({offset:!0}).nullish(),id:s(),isCurrent:u().nullish(),isPrimary:u().nullish(),language:f().nullish(),owner:l,text:f(),textName:f().nullish(),textType:f(),updatedAt:r({offset:!0}).nullish()}),bn=o([`stored`,`derivedFromPreAndRaised`,`derivedFromPostMinusRaised`,`reportedAssumedPost`]),xn=o([`fundraiseRound`,`researchDetail`]),Sn=o([`preMoney`,`postMoney`,`reported`]),Cn=p({amountRaised:d().int().nullish(),asOfDate:r({offset:!0}),confidence:cn,currency:f(),declaredBasis:Sn,derivation:bn,detailId:s().nullish(),label:f().nullish(),source:xn,sourceRef:f(),valuationPostMoney:d().int().nullish(),valuationPreMoney:d().int().nullish()}),wn=p({createdAt:r({offset:!0}).nullish(),description:f().nullish(),forkCount:s(),githubId:d().int(),homepageUrl:f().nullish(),id:d().int(),isArchived:u(),isFork:u(),language:f().nullish(),license:f().nullish(),name:f(),ownerLogin:f(),repoCreatedAt:r({offset:!0}).nullish(),repoPushedAt:r({offset:!0}).nullish(),stargazerCount:s(),topic:i(f()),updatedAt:r({offset:!0}).nullish(),url:f()}),P=p({empty:u().optional(),sorted:u().optional(),unsorted:u().optional()}),F=p({offset:d().int().optional(),paged:u().optional(),pageNumber:s().optional(),pageSize:s().optional(),sort:P.optional(),unpaged:u().optional()}),Tn=p({investorAttribution:i(ce),person:be,round:i(we),roundCount:s()}),En=o([`precomputed`,`live`]),Dn=p({compositeScore:d().nullish(),cosineScore:d().nullish(),matchedSectionWeight:d().nullish(),origin:En,rank:s(),sharedSectionCount:s().nullish()}),On=p({currentRole:xe.nullish(),person:me,similarity:Dn}),kn=o([`by`,`about`]),An=o([`newsArticle`,`blogPost`,`externalSocialPost`,`repositoryOwner`,`repository`,`webSite`,`webPage`,`researchPaper`]),jn=p({canonicalUrl:f().nullish(),contentId:f(),contentType:An,createdAt:r({offset:!0}).nullish(),publishedAt:r({offset:!0}).nullish(),relation:kn.nullish(),sourceDomain:f().nullish(),sourceName:f().nullish(),summary:f().nullish(),title:f(),topic:f().nullish(),updatedAt:r({offset:!0}).nullish(),url:f().nullish(),year:s().nullish()});p({content:i(sn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(n([se,Te])).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(un).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(v).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(mn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(Se).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(gn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(y).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(_n).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(N).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(xe).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(ge).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(de).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(he).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(an).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(vn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(yn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(oe).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(Cn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(wn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(ue).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(me).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(be).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(ve).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(Tn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(On).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()}),p({content:i(jn).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()});var Mn=p({content:i(N),number:s(),size:s(),totalElements:d().int(),totalPages:s()}),Nn=p({content:i(ue),number:s(),size:s(),totalElements:d().int(),totalPages:s()}),Pn=p({content:i(me),number:s(),size:s(),totalElements:d().int(),totalPages:s()});p({content:i(_e).optional(),empty:u().optional(),first:u().optional(),last:u().optional(),number:s().optional(),numberOfElements:s().optional(),pageable:F.optional(),size:s().optional(),sort:P.optional(),totalElements:d().int().optional(),totalPages:s().optional()});var Fn=n([o([`entityRecord`,`researchSnippet`,`newsArticle`,`personRecord`,`fundraiseTransaction`]),f()]),In=p({entityId:t(),source:Fn,sourceId:f()}),Ln=p({citation:i(In),text:f(),topic:f().nullish()}),Rn=p({citation:i(In),confidence:S,description:f().nullish(),heading:f().nullish(),paragraph:i(Ln),relatedQuery:i(f()),shareable:u(),text:f(),title:f().nullish()}),zn=p({sortPriority:o([`NONE`,`ANY_LOGO_FIRST`,`REAL_LOGO_FIRST`]).optional()}),Bn=p({max:r({offset:!0}).nullish(),min:r({offset:!0}).nullish()}),I=p({max:d().nullish(),min:d().nullish()}),L=p({max:s().nullish(),min:s().nullish()}),Vn=p({averageAmountInvestedUsdRange:i(I).optional(),largestAmountInvestedUsdRange:i(I).optional(),smallestAmountInvestedUsdRange:i(I).optional(),totalAmountInvestedUsdRange:i(I).optional(),totalInvestmentRange:i(L).optional()}),Hn=p({amountInvestedRange:i(I).optional(),amountRaisedRange:i(I).optional(),dateAnnouncedRange:Bn.nullish(),investedCompanyName:i(f()).optional(),investedCountry:i(f()).optional(),investedIndustry:i(f()).optional(),investedRound:i(f()).optional(),investorActivity:Vn.optional(),investorName:i(f()).optional(),lastRoundYearRange:i(L).optional(),rankByInvestmentActivity:u().nullish(),round:i(f()).optional(),totalRaisedRange:i(I).optional(),valuationRange:i(I).optional()}),Un=o([`NONE`,`COMPANY_LISTING_READY`]),Wn=o([`Operating`,`Acquired`,`Acquired Subsidiary`,`Closed`,`Closed (Acquihire)`,`Inactive`]),Gn=o([`hostPath`,`domain`]),Kn=e({acceleratorBrand:i(f()).optional(),acceleratorCohort:i(f()).optional(),acceleratorName:i(f()).optional(),acceleratorStatus:i(f()).optional(),affinity:i(f()).optional(),closedLast:u().optional(),employeeCountRange:i(L).optional(),entityId:i(t()).optional(),entityName:i(f()).optional(),featured:u().nullish(),fundraiseActivity:Hn.optional(),hasFundraising:u().nullish(),headquartersCity:i(f()).optional(),headquartersCountry:i(f()).optional(),headquartersState:i(f()).optional(),industry:i(f()).optional(),letter:f().nullish(),location:i(f()).optional(),logoOption:zn.optional(),mainProduct:i(f()).optional(),operatingStatus:i(Wn).optional(),originCountry:i(f()).optional(),person:i(f()).optional(),portfolioHeadquartersCity:i(f()).optional(),portfolioHeadquartersCountry:i(f()).optional(),portfolioHeadquartersState:i(f()).optional(),qualityGate:Un.optional(),rankByProminence:u().nullish(),semanticQuery:f().nullish(),slug:i(f().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(f()).optional(),suppressLateStage:u().nullish(),suppressNonOperating:u().nullish(),suppressZeroTotalRaised:u().nullish(),tag:i(f()).optional(),textSearch:f().nullish(),typeCustomer:i(f()).optional(),typeModel:i(f()).optional(),typeOwnership:i(f()).optional(),typeRecord:i(a).optional(),typeRevenue:i(f()).optional(),typeTechnologyUsed:i(f()).optional(),url:f().nullish(),urlDomain:f().nullish(),urlMatchMode:Gn.nullish(),urlType:ae.nullish(),yearFoundedRange:i(L).optional()}),qn=o([`discovery`,`profile`,`peer`,`comparison`]),Jn=o([`keyword`,`semantic`]),Yn=n([o([`ID`,`NAME_BRAND`,`YEAR_FOUNDED`,`STATUS_OPERATING`,`UPDATED_AT`,`CREATED_AT`,`NEXT_DUE_AT`,`DATA_COMPLETION_COVERAGE`,`TOTAL_RAISED`,`AMOUNT_INVESTED`,`RECENT_INVESTMENT_AT`,`STAGE`,`MOST_RECENT_AMOUNT`,`LATEST_VALUATION`,`MOST_RECENT_DATE`,`ACCELERATOR_BRAND`,`ACCELERATOR_COHORT`,`HEADQUARTERS_COUNTRY`,`EMPLOYEE_COUNT`]),f()]),Xn=p({descending:u(),field:Yn,sortKey:f().nullish()}),Zn=p({order:i(Xn),relevance:Jn.nullish()}),Qn=p({confidence:S,execution:M,fallbackUsed:u(),filter:Kn,intent:qn,interpretation:f(),sort:Zn,subjectEntityName:i(f()),unsupported:f().nullish()}),R=p({changedAt:r({offset:!0}).nullish(),dataSourceUpdatedAt:r({offset:!0}).nullish(),pendingApproval:s().nullish(),sourceId:f().nullish(),status:f().nullish()}),$n=p({fundManagerRelationshipSource:R.nullish(),fundraiseTransaction:y,fundraiseTransactionSource:R.nullish(),investorJoinSource:R.nullish()}),er=p({evidence:$n,investor:l,semanticMatch:le.nullish()}),tr=p({entityId:t(),matchedOffering:v.nullish(),probability:d(),webUrl:i(f())}),nr=p({entityId:t(),label:f(),publishedAt:r({offset:!0}).nullish(),score:d(),source:Fn,sourceId:f(),text:f(),url:f().nullish()}),rr=p({answer:Rn.nullish(),interpretation:Qn,investment:i(er),judgment:i(tr),passage:i(nr),peer:i(an),pendingWebQuery:i(f()),result:Mn,searchRequestId:t().nullish(),subject:i(N)}),ir=o([`auto-match`,`needs-review`,`approved`,`rejected`]),ar=p({createdAt:r({offset:!0}),entityId:t(),href:f().nullish(),internal:u(),matchStatus:ir.nullish(),mention:f().nullish(),slug:f().regex(/^[a-z0-9_-]+$/).max(255).nullish(),typeRecord:a.nullish(),updatedAt:r({offset:!0})}),or=p({entity:i(ar),newsId:s()}),sr=e({acceleratorBrand:i(f()).optional(),acceleratorCohort:i(f()).optional(),acceleratorName:i(f()).optional(),acceleratorStatus:i(f()).optional(),affinity:i(f()).optional(),closedLast:u().optional(),employeeCountRange:i(L).optional(),entityId:i(t()).optional(),entityName:i(f()).optional(),featured:u().nullish(),fundraiseActivity:Hn.optional(),hasFundraising:u().nullish(),headquartersCity:i(f()).optional(),headquartersCountry:i(f()).optional(),headquartersState:i(f()).optional(),industry:i(f()).optional(),letter:f().nullish(),location:i(f()).optional(),logoOption:zn.optional(),mainProduct:i(f()).optional(),operatingStatus:i(Wn).optional(),originCountry:i(f()).optional(),person:i(f()).optional(),portfolioHeadquartersCity:i(f()).optional(),portfolioHeadquartersCountry:i(f()).optional(),portfolioHeadquartersState:i(f()).optional(),qualityGate:Un.optional(),rankByProminence:u().nullish(),slug:i(f().regex(/^[a-z0-9_-]+$/).max(255)).optional(),stage:i(f()).optional(),suppressLateStage:u().nullish(),suppressNonOperating:u().nullish(),suppressZeroTotalRaised:u().nullish(),tag:i(f()).optional(),textSearch:f().nullish(),typeCustomer:i(f()).optional(),typeModel:i(f()).optional(),typeOwnership:i(f()).optional(),typeRecord:i(a).optional(),typeRevenue:i(f()).optional(),typeTechnologyUsed:i(f()).optional(),url:f().nullish(),urlDomain:f().nullish(),urlMatchMode:Gn.nullish(),urlType:ae.nullish(),yearFoundedRange:i(L).optional()}),cr=p({amountInvestedRange:i(I).nullish(),amountRaisedRange:i(I).nullish(),entityName:i(f()).nullish(),investedCompany:i(f()).nullish(),personTitle:i(f()).nullish(),round:i(f()).nullish(),totalInvestmentCount:i(L).nullish(),typeRecord:i(a).nullish()}),lr=p({arrayFilter:cr.optional(),entityFilter:sr.optional(),entityId:t().nullish(),entitySlug:f().nullish(),firstName:f().nullish(),includeAddress:u().nullish(),includeUrl:u().nullish(),investorActivity:Vn.optional(),isCurrent:u().nullish(),lastName:f().nullish(),letter:f().nullish(),personId:i(t()).max(200).optional(),personName:i(f()).optional(),role:f().nullish(),search:f().nullish(),semanticQuery:f().nullish(),status:f().nullish()}),ur=p({descending:u(),field:o([`ID`,`FIRST_NAME`,`LAST_NAME`,`FULL_NAME`,`SLUG`,`CREATED_AT`,`UPDATED_AT`,`STATUS`,`GENDER`,`AMOUNT_INVESTED`,`TOTAL_INVESTMENTS`]),sortKey:f().nullish()}),dr=p({order:i(ur),relevance:Jn.nullish()}),fr=p({confidence:S,execution:M,fallbackUsed:u(),filter:lr,interpretation:f(),sort:dr,unsupported:f().nullish()}),pr=p({interpretation:fr,investment:i(er),result:Pn,searchRequestId:t().nullish()}),mr=p({entity:rr,entityDetail:i(Se),news:Nn,newsEntityMention:i(or),person:pr,personDetail:i(be),provenance:en});function z(e,t){return e.map(e=>{let n=e.requestBody??[],r=[...e.parameters.map(e=>hr(e)),...n.flatMap(e=>e.parameter.map(t=>hr(t,n.length>1?e.contentType:void 0))),...gr(n)],i=[t,...e.cliPath].join(` `),a=te(e.intent),o=e.method===`DELETE`||e.intent===`delete`,s=n[0];return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,scope:e.scope,mutates:a,destructive:o,auth:e.auth,cli:{command:i,path:e.cliPath},mcpTool:e.binaryResponse||!ie(e.path)?null:re(e.intent),body:{hasBody:s!==void 0,kind:s?.kind??null,...s!==void 0&&n.length>1?{contentType:s.contentType}:{},required:s?.required??!1,description:s?.description??``,requiredPath:s?.requiredPath??[]},flags:r,errorResponse:e.errorResponse,successResponse:e.successResponse,summary:e.summary,description:e.description,deprecated:e.deprecated}})}function hr(e,t){let n=e.flag.split(/\s+/u);return{name:n[0]??e.flag,optionKey:e.optionKey,wireName:e.name,location:e.location,required:e.required,placeholder:n.length<=1?null:n.slice(1).join(` `),description:e.description,choices:e.choices??[],...t===void 0?{}:{contentType:t}}}function gr(e){if((e?.length??0)<=1)return[];let t=e?.map(({contentType:e})=>e)??[];return[{name:`--content-type`,optionKey:`contentType`,wireName:`Content-Type`,location:`body`,required:!1,placeholder:`<media-type>`,description:`Select the request content type; omit for ${t[0]}.`,choices:t}]}function _r(e){return e.flags.filter(({contentType:t})=>t===void 0||t===e.body.contentType)}var vr=[`-id`,`-slug`,`-url`],yr=[`--id`,`--slug`,`--url`],br=`/v1/lookup`,xr=`--from-file "<path>"`;function Sr(e,t,n=_().bin[0]){let r=z(t,n),i=r.find(t=>t.operationId===e);return i===void 0?[]:Er(i,r)}function Cr(e,t,n=_().bin[0]){let r=t.find(t=>t.operationId===e),[i]=r===void 0?[]:z([r],n);return i&&Tr(i,kr(i,!1))}function wr(e,t,n,r=_().bin[0]){let i=e=>{let t=e.findIndex((e,t)=>n[t]!==e);return t===-1?e.length:t},a=`${n[0]} get`,[o,s]=t.filter(({method:t,path:n,parameters:r,cliPath:o})=>{let s=r.filter(({location:e})=>e===`path`),[c]=s;return t===`GET`&&s.length===1&&c?.flag.split(/\s+/u)[0]===e&&n.endsWith(`/{${c.name}}`)&&(i(o)>1||o.join(` `)===a)}).toSorted((e,t)=>i(t.cliPath)-i(e.cliPath));if(o!==void 0&&(s===void 0||i(s.cliPath)!==i(o.cliPath)))return Cr(o.operationId,t,r)}function Tr(e,t){return[e.cli.command,...t,`--data`].join(` `)}function Er(e,t){return[`example: ${Tr(e,kr(e))}`,...Dr(e,t)]}function Dr(e,t){return _r(e).flatMap(e=>{if(!e.required||!e.optionKey.endsWith(`Id`))return[];let n=`${e.optionKey.slice(0,-2)}Slug`,r=t.find(e=>e.method===`GET`&&/\/lookup(?:-exact)?$/u.test(e.path)&&e.flags.some(e=>e.optionKey===n)),i=r?.flags.find(e=>e.optionKey===n);if(r===void 0||i===void 0)return[];let a=`${r.cli.command} ${jr(i)} --data`,o=t.find(e=>e.method===`POST`&&e.path===br),s=o?.flags.find(e=>e.optionKey===`name`),c=o?.flags.find(e=>e.optionKey===`kind`),l=c?.choices.find(t=>e.optionKey.toUpperCase().startsWith(t)),u=`lookup: ${e.name} from a slug: ${a}`;return o===void 0||s===void 0||c===void 0||l===void 0?[u]:[u,`lookup: ${e.name} from a name or URL: ${o.cli.command} ${c.name} ${l} ${jr(s)} --data, then match.owner.${e.optionKey} when status is MATCHED`]})}var Or=/(?:^|\.)text$/u;function kr(e,t=!0){let n=_r(e).filter(e=>e.required),r=e.body.kind===`json`&&n.some(e=>e.location===`body`&&Or.test(e.wireName))?n.filter(e=>e.location!==`body`):n,i=(n.length>0||!t?r:Ar(e)).map(jr);return(e.body.required||e.body.requiredPath.length>0)&&!r.some(e=>e.location===`body`)?[...i,xr]:i}function Ar(e){let t=new Set;k(t,e.resource);for(let n of vr)for(let r of t){let t=e.flags.find(e=>e.name===`--${r}${n}`);if(t!==void 0)return[t]}for(let t of yr){let n=e.flags.find(e=>e.name===t);if(n!==void 0)return[n]}return[]}function jr(e){return e.placeholder===null?e.name:`${e.name} "${e.placeholder}"`}var Mr=`aventure`;function Nr(e,t){let n=t.find(t=>t.operationId===e)?.cliPath;return n===void 0?void 0:`${Mr} ${n.join(` `)}`}function Pr(e,t,n=e){return Cr(e,t,`aventure`)??n}function Fr(e,t){let n=He.safeParse(e);if(!n.success)return null;let{answer:r,citation:i,confidence:a,resolution:o}=n.data;if(o!=null)return Ir(r,o,t);let s=r.trimEnd().split(`
|
|
3
|
+
`),c=new Set(i.flatMap(({sourceType:e,sourceId:n})=>{if(e!==Ne.options[0].enum.OPERATION)return[];let r=Nr(n,t);return r===void 0?[]:[r]}));return c.size>0&&s.push(``,`Commands:`,...[...c].map(e=>` ${e}`)),s.push(``,`Confidence: ${a}`),i.length===0?s:(s.push(`Sources (${i.length}):`),s.push(...i.map(({excerpt:e,sourceId:t})=>{let n=e.trim();return n.length>0?` - ${t}: ${n}`:` - ${t}`})),s)}function Ir(e,t,n){let{outcome:r,operationId:i,probability:a,candidate:o,taskKey:s,taskPlan:c}=t,l=[c==null?e.trimEnd():Rr(c)],u=[``,`Outcome: ${r}${a==null?``:` (probability ${a.toFixed(2)})`}`];switch(r){case C.enum.TASK_PLAN:return[...l,...c==null?[]:zr(c,n),...u];case C.enum.OPERATION_ADVICE:{let e=o.filter(({sourceId:e})=>e!==i);return[...l,...i==null?[]:[``,`Command:`,` ${Pr(i,n)}`],...u,...e.length===0?[]:[`Alternatives: ${e.map(({sourceId:e})=>e).join(`, `)}`]]}case C.enum.CLARIFY:return[...l,...s==null?[]:[``,`Leading catalog task: ${s}`],...Vr(`Candidates:`,o,n),...u];case C.enum.ABSTAIN:return[...l,...Vr(`Nearest operations:`,o,n),...u];default:throw Error(`Unhandled help resolution outcome ${String(r)}`)}}function Lr(e,t){let n=Be.safeParse(e);return n.success?[Rr(n.data),...zr(n.data,t)]:null}var Rr=({taskKey:e,catalogRevision:t})=>`Run catalog task ${e} (catalog revision ${t}).`;function zr(e,t){return e.step.length===0?[``,`This catalog task has no planned steps yet.`]:[...e.input.length===0?[]:[``,`Inputs:`,...e.input.map(({key:e,type:t,description:n})=>` ${e} (${t}): ${n}`)],``,`Steps:`,...e.step.flatMap(({step:n,cliCommand:r,writeGuidance:i},a)=>[` ${a+1}. ${n.stepKey}: ${Pr(n.operationId,t,r)}`,` ${n.instruction}`,...Br(e,a,i)]),...e.gateId.length===0?[]:[``,`Completion gates: ${e.gateId.join(`, `)}`]]}function Br(e,t,n){if(n==null)return[];let r=JSON.stringify(n),i=e.step.findIndex(({writeGuidance:e})=>JSON.stringify(e)===r);return i===t?[` Write guidance:`,` - Expectation: ${n.expectation}`,` - Body: ${n.body}`,` - Read first: ${n.typeCatalog}`,` - Rejected when:`,...n.reject.map(e=>` - ${e}`),` - Override: ${n.override}`,` - Method: ${n.method.join(`; `)}`]:[` Write guidance: as step ${i+1}.`]}function Vr(e,t,n){if(t.length===0)return[];let r=t.map(({sourceId:e,excerpt:t})=>({command:Nr(e,n)??e,excerpt:t})),i=Math.max(...r.map(({command:e})=>e.length));return[``,e,...r.map(({command:e,excerpt:t})=>` ${e.padEnd(i)} # ${t}`)]}var B=120,V=30,Hr=8,H=10,Ur=2,Wr=[`id`,`association.associationId`,`slug`,`name`,`nameBrand`,`nameFull`,`core.nameBrand`,`core.nameFull`,`core.slug`,`core.typeRecord`,`entity.core.nameBrand`,`entity.core.slug`,`title`,`sourceName`,`publishedAt`,`round`,`dateAnnounced`,`amountRaised`,`investorAttribution.amountInvested`,`stage`,`updatedAt`,`createdAt`],Gr=new Set([`page`,`size`,`sort`,`cursor`,`mode`,`projection`]),Kr=[`interpretation`,`confidence`,`unsupported`,`execution`,`fallbackUsed`];function qr(e,t,n){if(typeof t==`string`)return Q(t);let r=ct(t);if(r!==null)return Q(r);let i=ii(t);if(i===null)return null;let a=e.find(({operationId:e})=>e===i.operationId),{response:o,hiddenNote:s}=Oe(a?.detailField,i.response),c={...i,response:o},l=Fr(c.response,e)??Lr(c.response,e);if(l!==null)return Q(l.join(`
|
|
4
|
+
`),!0);let u=Jr(c.endpoint,c.response);if(u!==null)return Q([...u,...s].join(`
|
|
5
|
+
`),!0,s.length>0);let d=c.summary??n??c.operationId??`OpenAPI call succeeded`,f=Qr(c);return Q([...[d,`${c.method} ${c.endpoint}`,...f].filter(e=>e.length>0),...s].join(`
|
|
6
|
+
`),!0,s.length>0)}function Jr(e,t){if(t===void 0||!J(t)||!(`entity`in t&&`person`in t&&`news`in t))return null;let n=mr.safeParse(t);if(!n.success)return null;let{entity:r,person:i,news:a,provenance:o}=n.data;return[...r.answer?Yr(r.answer):[],...o.unavailable.map(e=>`${e} unavailable: retry this scope later`),...o.answerUnavailable?[`answer unavailable: retry this search later`]:[],...o.rejection.map(({scope:e,detail:t})=>b(`${e} rejected: ${t}`)),[`entities:`,...U(r.result,e)].join(`
|
|
7
|
+
`),[`people:`,...U(i.result,e)].join(`
|
|
8
|
+
`),[`news:`,...U(a,e)].join(`
|
|
9
|
+
`)]}function Yr(e){let t=`relatedQuery:\n${e.relatedQuery.map(e=>` - ${b(e)}`).join(`
|
|
10
|
+
`)}`,n=`citations:\n${e.citation.map(({source:e,sourceId:t,entityId:n})=>b(` - ${e}:${t} entity=${n}`)).join(`
|
|
11
|
+
`)}`;return[`answer:\n ${ke(e.text).replaceAll(`
|
|
12
|
+
`,`
|
|
13
|
+
`)}`,...e.relatedQuery.length===0?[]:[t],...e.citation.length===0?[]:[n]]}function Xr(e){let t=ii(e)?.response,n=t!==void 0&&J(t)?t.interpretation:void 0;if(n===void 0||!J(n))return null;let r=M.safeParse(n.execution);if(!r.success)return null;let{modeRequested:i,modeUsed:a}=r.data,o=K(n.filter??null),{unsupported:s,fallbackUsed:c}=n;return Q([`strategy: requested=${i} used=${a}`,...o!==void 0&&J(o)?[`constraints:`,...Object.entries(o).map(([e,t])=>` ${e}: ${Zr(t)}`)]:[],typeof s==`string`&&s.trim().length>0?`unsupported: ${s}`:``,c===!0?`fallback: semantic search over the original query`:``].filter(Boolean).join(`
|
|
14
|
+
`),!0)}var Zr=e=>Y(e)?b(e):Array.isArray(e)&&e.every(Y)?e.map(e=>b(e)).join(`, `):JSON.stringify(e);function Qr(e){let{response:t,method:n,endpoint:r,nextCursor:i,httpStatus:a,location:o}=e;if(t===void 0)return o!==void 0&&a!==void 0?[`status=${a} redirect=${o}`]:a===void 0?[]:[`status=${a} no response body`];let s=a===void 0||n===`GET`?``:`status=${a}`,c=J(t)&&!ai(t)?oi(t):null,l=c===null?void 0:J(c.context.interpretation)?K(c.context):c.context,u=l!==void 0&&J(l)?Object.entries(l):[],d=u.filter(e=>Array.isArray(e[1])&&e[1].length>0&&e[1].every(J)),f=new Set(d.map(([e])=>e)),p=Object.fromEntries(u.filter(([e])=>!f.has(e)));return[s,...ai(t)?U(t,r,i):c===null?ci(t)?ti(t.filter,t.meta):li(t)?ti([...t.arrayFilterEntry,...t.rangeFilterEntry],t.filtersMeta):di(t)?ni(t):W(t,``):[...U(c.page,r,i),...Object.keys(p).length===0?[]:W(p,``),...d.flatMap(([e,t])=>[`${e}:`].concat($r(t)))]].filter(Boolean)}function U(e,t,n){let r=ri(t);return[`rows=${e.numberOfElements??e.content.length}${e.number===void 0?``:` page=${e.number}`}${e.size===void 0?``:` size=${e.size}`}${e.totalElements===void 0?``:` total=${e.totalElements}`}${e.totalPages===void 0?``:` totalPages=${e.totalPages}`}`,r.length>0?`filters: ${r.join(` `)}`:``,n===void 0?``:`next: --cursor ${Z(n)}`,...$r(e.content)].filter(Boolean)}function $r(e){let t=e.filter(J);if(t.length===0)return e.length===0?[`(empty)`]:G(e,``);let n=ei(t);if(n.length===0)return G(e.slice(0,V),``);let r=t.slice(0,V).map(e=>{let t=q(e);return n.map(e=>t[e]??``)}),i=n.map(e=>e.split(`.`).at(-1)??e),a=i.map((e,t)=>{let n=r.map(e=>e[t]??``),i=Math.max(e.length,...n.map(e=>e.length));return e===`id`||e.endsWith(`Id`)?i:Math.min(32,i)}),o=e=>e.map((e,t)=>fi(e,a[t]??12).padEnd(a[t]??12)).join(` `),s=[o(i),o(a.map(e=>`-`.repeat(e)))];return r.forEach(e=>s.push(o(e))),t.length>V&&s.push(`... ${t.length-V} more rows`),s}function ei(e){let t=new Set(e.flatMap(e=>Object.keys(q(e)))),n=Wr.filter(e=>t.has(e)),r=[...t].filter(e=>!n.includes(e)).filter(e=>!e.toLowerCase().includes(`logo`)).slice(0,Hr-n.length);return[...n,...r].slice(0,Hr)}function ti(e,t){let n=t!==void 0&&J(t)?t:{},r=[`total`,`limit`].flatMap(e=>typeof n[e]==`number`?[` ${e}=${n[e]}`]:[]).join(``),i=[`filters=${e.length}${r}`];for(let t of e){let e=t.choiceOption.length,n=t.choiceOptionTotal===null?`unknown (degraded)`:t.choiceOptionTotal??e,r=t.choiceOptionTruncated===!0?` truncated`:``;i.push(`- ${t.filterKey} (${t.label}): choices ${e}/${n}${r}`),t.choiceOption.slice(0,H).forEach(e=>{i.push(` ${X(t.filterKey)} ${Z(e.value)}`)}),e>H&&i.push(` ... ${e-H} more shown`)}return i}function ni(e){let t=X(e.filterKey);return[`${e.filterKey}: ${e.result.length} matches`,...e.result.slice(0,H).map(e=>`${t} ${Z(e)}`),e.result.length>H?`... ${e.result.length-H} more matches`:``].filter(Boolean)}function ri(e){let t=e.indexOf(`?`);return t<0?[]:[...new URLSearchParams(e.slice(t+1)).entries()].filter(([e,t])=>!Gr.has(e)&&t.length>0).map(([e,t])=>`${X(e)} ${Z(t)}`)}function ii(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=Reflect.get(e,`method`),n=Reflect.get(e,`endpoint`);if(typeof t!=`string`||typeof n!=`string`)return null;let r=Reflect.get(e,`operationId`),i=Reflect.get(e,`summary`),a=Reflect.get(e,`httpStatus`),o=Reflect.get(e,`location`),s=Reflect.get(e,`nextCursor`),c=Reflect.get(e,`response`),l=c===void 0?void 0:g.safeParse(c);return l!==void 0&&!l.success?null:{method:t,endpoint:n,httpStatus:typeof a==`number`?a:void 0,location:typeof o==`string`?o:void 0,operationId:typeof r==`string`?r:void 0,summary:typeof i==`string`?i:void 0,nextCursor:typeof s==`string`&&s.length>0?s:void 0,response:l?.data}}function W(e,t,n){if(e===void 0)return[];if(Y(e))return[`${t}${x(e,n)}`];if(Array.isArray(e))return G(e,t,n);let r=[];for(let[n,i]of Object.entries(e)){if(Y(i)){r.push(`${t}${n}: ${x(i,n)}`);continue}r.push(`${t}${n}:`);for(let e of W(i,`${t} `,n))r.push(e)}return r.length===0?[`${t}(empty)`]:r}function G(e,t,n){if(e.length===0)return[`${t}(empty)`];let r=[];for(let i of e){if(Y(i)){r.push(`${t}- ${x(i,n)}`);continue}r.push(`${t}-`);for(let e of W(i,`${t} `))r.push(e)}return r}function K(e){if(Y(e))return e===null||typeof e==`string`&&e.trim().length===0?void 0:e;if(Array.isArray(e)){let t=e.flatMap(e=>{let t=K(e);return t===void 0?[]:[t]});return t.length===0?void 0:t}let t=Object.entries(e).flatMap(([e,t])=>{let n=K(t);return n===void 0?[]:[[e,n]]});if(t.length!==0)return Object.fromEntries([...Kr.flatMap(e=>t.filter(([t])=>t===e)),...t.filter(([e])=>!Kr.includes(e))])}function q(e,t=``,n=0){return Y(e)?t.length===0?{}:{[t]:b(e,t)}:n>Ur?{}:Array.isArray(e)?e.length===0?{}:q(e[0],t,n+1):Object.fromEntries(Object.entries(e).flatMap(([e,r])=>{let i=t.length===0?e:`${t}.${e}`;return Y(r)?[[i,b(r,i)]]:Object.entries(q(r,i,n+1))}))}var ai=e=>J(e)&&Array.isArray(e.content);function oi(e){let[t,...n]=Object.entries(e).filter(e=>ai(e[1])&&typeof e[1].totalElements==`number`);if(t===void 0||n.length>0)return null;let[r,i]=t;return{page:i,context:Object.fromEntries(Object.entries(e).filter(([e])=>e!==r))}}function si(e){return J(e)&&typeof e.label==`string`&&typeof e.filterKey==`string`&&Array.isArray(e.choiceOption)}var ci=e=>J(e)&&ui(e.filter),li=e=>J(e)&&ui(e.arrayFilterEntry)&&ui(e.rangeFilterEntry),ui=e=>Array.isArray(e)&&e.every(si),di=e=>J(e)&&typeof e.filterKey==`string`&&Array.isArray(e.result)&&e.result.every(e=>typeof e==`string`),J=e=>typeof e==`object`&&!!e&&!Array.isArray(e),Y=e=>typeof e!=`object`||!e,X=e=>`--${e.replace(/([a-z0-9])([A-Z])/g,`$1-$2`).toLowerCase()}`,Z=e=>/^[A-Za-z0-9._:/@-]+$/.test(e)?e:`'${e.replaceAll(`'`,`'\\''`)}'`,fi=(e,t)=>e.length<=t?e:`${e.slice(0,Math.max(0,t-3))}...`,Q=(e,t=!1,n=!1,r=1)=>{let i=ke(e),a=t||i.endsWith(`
|
|
15
|
+
`),o=i.endsWith(`
|
|
16
|
+
`)?i.slice(0,-1):i,s=o.length===0?[]:o.split(`
|
|
17
|
+
`),c=Me.byteLength(`${s.join(`
|
|
18
|
+
`)}\n`,`utf8`);if(s.length<=B&&c<=5e4)return`${s.join(`
|
|
19
|
+
`)}${a?`
|
|
20
|
+
`:``}`;let l=n?Math.min(Math.max(1,r),118):0,u=l>0?s.slice(-l):[],d=u.length===0?s:s.slice(0,-u.length),f=[s.length>B?`${B} physical lines`:``,c>5e4?`${h} UTF-8 bytes`:``].filter(Boolean).join(` and `),p=e=>ke(`... output truncated: ${e} more lines omitted to stay within ${f}; recover omitted response content with narrower server-side filters, the relevant sub-resource operation (aventure_help names it), or responseFormat json.`),m=(e,t)=>[...e,...u,t].join(`
|
|
21
|
+
`),ee=B-u.length-1,g=d.slice(0,ee),_=p(s.length-g.length-u.length);for(;Me.byteLength(`${m(g,_)}\n`,`utf8`)>h;){if(g.length>0)g=g.slice(0,-1);else if(u.length>0)u=u.slice(1);else break;_=p(s.length-g.length-u.length)}return`${m(g,_)}${a?`
|
|
22
|
+
`:``}`},pi=/\{([^}]+)\}/gu;function mi(e,t){let n=t.filter(e=>e.method===`GET`),r=t=>e.endpoint!==void 0&&t.endsWith(e.endpoint),i=t.find(t=>t.operationId===e.operationId),a=e.ok&&i!==void 0&&te(i.intent),o=[...a&&e.endpoint!==void 0?gi(e.endpoint.split(`?`)[0]??``,n,!1).map(e=>`${e} --data --to-file <path>`):[],...e.references.filter(e=>!r(e)).flatMap(hi).flatMap(e=>gi(e.pathname,n,!0)),...e.references.filter(r).flatMap(hi).flatMap(e=>_i(e,n))];return o.length===0?{write:a}:{exactRecovery:`Read the full result ${o.join(`; `)}.`,write:a}}function hi(e){return URL.canParse(e)?[new URL(e)]:[]}function gi(e,t,n){return t.flatMap(t=>{let r=[...t.path.matchAll(pi)].map(([,e])=>e),i=RegExp(`^${t.path.replace(pi,`([^/]+)`)}$`,`u`),a=n&&r.length===0?null:i.exec(e);if(a===null)return[];let o=r.flatMap((e,n)=>{let r=t.parameters.find(t=>t.name===e);return r===void 0?[]:[$(r),a[n+1]??``]});return[`${vi(t)}, ${yi(t,o)}`]})}function _i(e,t){let n=t.find(t=>t.path===e.pathname);return n===void 0?[]:t.flatMap(t=>{if(!t.path.startsWith(`${n.path}/`))return[];let r=t.parameters.find(({name:e})=>e.endsWith(`Offset`)),i=t.parameters.find(({name:e})=>e.endsWith(`Limit`));if(r===void 0||i===void 0)return[];let a=t.parameters.flatMap(t=>{let n=e.searchParams.get(t.name);return t.location!==`query`||n===null?[]:[$(t),bi(n)]}),o=[$(r),`<n>`,$(i),`<n>`];return[`${vi(t)}, in windows: ${yi(t,[...a,...o])}, advancing ${$(r)} until a window returns fewer than ${$(i)} units`]})}function vi(e){return e.auth===`write`?`with admin sign-in`:`with any sign-in`}function yi(e,t){return[Mr,...e.cliPath,...t].join(` `)}function $(e){return e.flag.split(/\s+/u)[0]??e.flag}function bi(e){return`'${e.replaceAll(`'`,`'"'"'`)}'`}function xi(e){return e.toSorted((e,t)=>e.projection.cliPath.length-t.projection.cliPath.length||e.projection.cliPath.join(` `).localeCompare(t.projection.cliPath.join(` `))||e.operationId.localeCompare(t.operationId)).map(e=>{let t=e.parameter.flatMap(t=>{if(t.in!==`path`&&t.in!==`query`&&t.in!==`header`)return[];let n=t.in;return(t.in===`query`&&t.itemProperty!==void 0?t.itemProperty:[t]).map(t=>{let r=Ei(t,w(e,t),n);if(t.legacyName===void 0)return r;let i=Ei(t,w(e,t,t.legacyName),n).flag;return i===r.flag?r:Object.assign(r,{legacyFlag:i})})}),n=e.requestBody?.map(n=>{let r=wi(e,t,n),i=Ci(n.cliConflicts,r),a=i.length===0?{}:{cliConflicts:i};return Object.assign({},n,{parameter:r},a)}),r=e.response.find(({status:e})=>e.startsWith(`2`))?.schemaName?.replace(/Schema$/,``);return{operationId:e.operationId,method:e.method,path:e.path,resource:e.resource,intent:e.intent,cliPath:e.projection.cliPath,summary:e.summary,description:e.description,binaryResponse:e.binaryResponse?!0:void 0,explain:e.explain?!0:void 0,deprecated:e.deprecated?!0:void 0,requestBody:n,mutationReadback:e.mutationReadback,scope:e.projection.scope,auth:e.projection.auth,visibility:e.projection.visibility,errorResponse:e.errorResponse,successResponse:r,detailField:e.response.find(e=>e.detailField!==void 0)?.detailField,parameters:t}})}function Si(e,t){let[n,r]=e.filter(e=>e.role===t);if(n===void 0||r!==void 0)throw Error(`Generated composite CLI role '${t}' is incomplete`);return n}function Ci(e,t){let n=new Map(t.map(({name:e,optionKey:t})=>[e,t]));return(e??[]).map(e=>e.map(e=>{let t=n.get(e);if(t===void 0)throw Error(`x-aventure-cli-conflicts field '${e}' was removed from the generated CLI projection`);return t}))}function wi(e,t,n){let r=new Set(t.map(e=>e.optionKey));(e.requestBody?.length??0)>1&&r.add(`contentType`);let i=new Set(t.filter(e=>e.location===`path`).map(e=>e.name));return n.parameter.toSorted((e,t)=>Ti(e.name)-Ti(t.name)).flatMap(t=>{if(!t.required&&(r.has(t.inputName)||i.has(t.name)))return[];let n=Ue(e,t,r);return r.add(n),[Ei(t,n,`body`)]})}function Ti(e){let t=e.split(`.`).at(-1);return t===`min`?0:t===`max`?1:2}function Ei(e,t,n){let r=e.itemSchemaEnum??e.schemaEnum,i=je(e.schemaType,e.itemSchemaType,e.schemaFormat,t);return{name:e.name,optionKey:t,flag:`${ne(t)} ${e.schemaType===`boolean`?`[${i}]`:`<${i}>`}`,required:e.required&&e.schemaDefault===void 0,description:Ae(e.description,r),schemaType:e.schemaType,schemaFormat:e.schemaFormat,itemSchemaType:e.itemSchemaType,defaultValue:Di(e.schemaDefault),choices:r,...e.envName===void 0?{}:{envName:e.envName},...e.visibility&&{visibility:e.visibility},location:n}}var Di=e=>Array.isArray(e)?e.map(String):typeof e==`number`?String(e):e;export{j as _,Q as a,_r as c,Er as d,z as f,Zt as g,Lt as h,qr as i,Sr as l,Ft as m,Si as n,Xr as o,Jt as p,mi as r,Or as s,xi as t,wr as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{O as e,T as t,i as n,l as r,m as i,n as a,o,p as s,r as c,t as l,u,v as d,w as f,y as p}from"./person-owner-BJgNYLKX.js";var ee=o([`domicile`,`dominant`,`origin`]),te=p({endDate:c().nullish(),id:s(),isCurrent:u(),role:ee.nullish(),startDate:c().nullish()}),ne=p({id:s().nullish(),name:f()}),re=p({countryCodeChar2:f().nullish(),countryCodeChar3:f().nullish(),id:s().nullish(),name:f(),unRegion:f().nullish(),unSubregion:f().nullish()}),ie=p({id:s().nullish(),name:f(),stateAbbrev:f().nullish()}),m=p({address:s().nullish(),addressLine1:f().nullish(),addressLine2:f().nullish(),association:r(te).optional(),city:ne.nullish(),country:re.nullish(),countryAbbrev:f().nullish(),createdAt:n({offset:!0}).nullish(),fullAddress:f().nullish(),id:s().nullish(),isCurrent:u().nullish(),isHq:u().nullish(),isPrimary:u().nullish(),latitude:d().nullish(),longitude:d().nullish(),postalCode:f().nullish(),state:ie.nullish(),stateAbbrev:f().nullish(),street:f().nullish(),updatedAt:n({offset:!0}).nullish()}),h=p({creatable:u(),isCurrent:u().nullish(),isPrimary:u().nullish(),name:f().max(255),writable:u()}),g=i(h,p({bucket:f().nullish(),classificationId:s().nullish(),creatable:u(),createdAt:n({offset:!0}).nullish(),id:s(),isCurrent:u().nullish(),isPrimary:u().nullish(),name:f().max(255),slug:f().regex(/^[a-z0-9_-]+$/).max(255).nullish(),type:f(),updatedAt:n({offset:!0}).nullish(),writable:u()})),_=i(h,p({category:f(),code:s().nullish(),creatable:u(),createdAt:n({offset:!0}).nullish(),entityClassificationId:s().nullish(),id:s(),isCurrent:u().nullish(),isPrimary:u().nullish(),level:s().nullish(),name:f().max(255),updatedAt:n({offset:!0}).nullish(),writable:u()})),ae=p({geoLocationExposure:r(g).default([]).optional(),industry:r(g).default([]).optional(),mainProduct:r(g).default([]).optional(),standardizedClassification:r(_).default([]).optional(),tag:r(g).default([]).optional(),typeCustomer:r(g).default([]).optional(),typeModel:r(g).default([]).optional(),typeOwnership:r(g).default([]).optional(),typeRevenue:r(g).default([]).optional(),typeTechnologyUsed:r(g).default([]).optional()}),v=t([o(`Angel.Pre-Seed.Seed.Series A.Series B.Series C.Series D.Series E.Series F.Series G.Series H.Series I.Series J.Series K.Series L.Series M.Series N.Series O.Series P.Series Q.Series R.Series S.Series T.Series U.Series V.Series W.Series X.Series Y.Series Z.Late Stage Private.Investment Firm.Fund.Nonprofit.Government.Public.Acquired.Acquired Subsidiary`.split(`.`)),f()]),y=p({currency:f().nullish(),fundingRoundCount:s(),investorCount:s(),latestValuation:d().nullish(),mostRecentAmount:d().nullish(),mostRecentDate:c().nullish(),stage:v.nullish(),totalRaised:d(),totalRaisedUsd:d().nullish(),unconvertedRoundCount:s()}),b=p({expanded:f().nullish(),generatedDescription:f().nullish(),short:f().nullish()}),x=o([`cloudflare`,`akamai`,`fastly`,`awsCloudfront`,`vercel`,`netlify`,`sucuri`,`incapsula`,`bunny`,`keycdn`,`cdn77`,`gcore`,`cdnetworks`,`azureCdn`,`leaseweb`,`digitalocean`,`stackpath`,`googlecloudCdn`,`none`,`unknown`]),oe=o([`static`,`jsRequired`,`jsEnhanced`]),S=f(),C=p({crawlCdnProvider:x.nullish(),crawlRenderMode:oe.nullish(),createdAt:n({offset:!0}).nullish(),id:s().nullish(),isCurrent:u().nullish(),isPrimary:u().nullish(),owner:l.nullish(),sourceId:f().nullish(),status:f().nullish(),statusChecked:n({offset:!0}).nullish(),updatedAt:n({offset:!0}).nullish(),url:f(),urlType:S}),w=p({address:r(m),classification:ae,fundingDetail:y.nullish(),headquartersAddressId:s().nullish(),text:b,urlLink:r(C),urlLinkSuppressedCount:s()}),T=p({isMonogram:u(),logo:f().nullish(),logoSquare:f().nullish()}),se=o([`alternativeDba`,`relatedLegal`]),ce=p({displayable:u().nullish(),name:f(),type:se.nullish()}),E=p({hasAcquisitions:u().default(!1).optional(),hasAnalysis:u(),hasEmployees:u(),hasFundraising:u(),hasNews:u(),productServiceSlug:r(f())}),D=p({defaultCurrency:f().nullish(),foundedYear:s().nullish(),id:e(),image:T,lastModifiedAt:n({offset:!0}).nullish(),nameAlias:r(ce),nameBrand:f(),nameLegal:f().nullish(),operatingStatus:f().nullish(),publicId:f().regex(/^e[0-9A-Za-z]{11}$/).nullish(),publicUrl:f().nullish(),sitemap:E.nullish(),slug:f().regex(/^[a-z0-9_-]+$/).max(255),typeRecord:a,updatedAt:n({offset:!0}).nullish()}),O=p({core:D,fundingDetail:y.nullish()}),k=o([`High`,`Medium`,`Low`,`Verified`]),A=o([`direct`,`managedFund`]),j=p({round:f()}),M=p({amountInvested:d().nullish(),attributionType:A,beneficialEntityId:e().nullish(),fundManagerRelationshipId:s().nullish(),joinId:e(),leadInvestor:u(),recordedEntityId:e().nullish(),round:j.nullish(),transactionId:e()}),N=p({amountRaised:d().int().nullish(),createdAt:n({offset:!0}).nullish(),currency:f().nullish(),dataConfidence:k.nullish(),dateAnnounced:n({offset:!0}).nullish(),dateFundingComplete:n({offset:!0}).nullish(),dateInvestorExit:n({offset:!0}).nullish(),entity:O.nullish(),id:e(),investorAttribution:M.nullish(),investorCount:s().nullish(),round:f().nullish(),sourceAttribution:r(M),updatedAt:n({offset:!0}).nullish(),valuationPostMoney:d().int().nullish(),valuationPreMoney:d().int().nullish()}),le=p({fundingStage:v.nullish(),ownership:r(f()),pricingModel:r(f()),sellsTo:r(f()),totalRaised:d().nullish(),website:f().nullish()}),P=p({lastFetchedAt:n({offset:!0}).nullish(),publishedAt:n({offset:!0}).nullish(),recordedAt:n({offset:!0}),sourceDetail:f()}),F=p({asOf:c().nullish(),comparisonSignals:le.nullish(),createdAt:n({offset:!0}).nullish(),detail:f().nullish(),entity:D,id:s().nullish(),isCurrent:u().nullish(),isPrimary:u().nullish(),publicSource:P.nullish(),get relationship(){return r(F)},relationshipType:f(),sourceEntityId:e().nullish(),targetEntityId:e().nullish(),updatedAt:n({offset:!0}).nullish()}),I=F,L=p({accelerator:D,acceleratorName:f(),asOfDate:n({offset:!0}),batch:f().nullish(),id:f(),program:f().nullish(),status:f().nullish()}),R=o([`text`,`numeric`,`monetary`,`percentage`,`date`]),z=o([`pastDue`,`withinThreeMonths`,`threeToSixMonths`,`sixToTwelveMonths`,`twelveToTwentyFourMonths`,`beyondTwoYears`]),B=p({asOfDate:n({offset:!0}),bucket:z,monthsFromNow:s(),targetDate:n({offset:!0})}),V=p({asOfDate:n({offset:!0}).nullish(),derivedRange:B.nullish(),discreteValue:d().nullish(),entityId:e(),id:s(),publicSource:P.nullish(),textValue:f().nullish(),typeResearchDetail:f(),updatedAt:n({offset:!0}).nullish(),valueResearchDetail:f().nullish(),valueType:R}),H=p({characterCount:s(),meetsRequirements:u(),violation:r(f()),wordCount:s()}),U=p({compliance:H.nullish(),entityId:e(),id:s(),publicSource:P.nullish(),text:f(),textType:f(),updatedAt:n({offset:!0}).nullish()}),ue=p({acceleratorParticipation:r(L),detail:r(V),snippet:r(U)}),W=p({author:f().nullish(),category:f().nullish(),createdAt:n({offset:!0}).nullish(),excerpt:f().nullish(),externalNewsArticle:u().nullish(),id:s(),newsImageThumbnail:f().nullish(),newsUrlOriginal:f().nullish(),publication:f().nullish(),publishedAt:n({offset:!0}).nullish(),slug:f().regex(/^[a-z0-9_-]+$/).max(255).nullish(),title:f(),updatedAt:n({offset:!0}).nullish()}),de=o([`nickname`,`maidenName`,`formerName`,`stageName`]),G=p({displayable:u().nullish(),name:f(),type:de.nullish()}),K=p({isMonogram:u(),picture:f().nullish()}),q=p({associationId:s(),endDate:f().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-][0-9]{2}:[0-5][0-9]))?)?)?$/).nullish(),entityAddress:r(m),entityId:e(),entityLogo:T,entityName:f().nullish(),entityOperatingStatus:f().nullish(),entitySlug:f().regex(/^[a-z0-9_-]+$/).max(255),entityType:a.nullish(),entityUrlLink:r(C),isCurrent:u().nullish(),personAddress:r(m),personId:e(),personImage:K,personName:f(),personSlug:f().regex(/^[a-z0-9_-]+$/).max(255),personUrlLink:r(C),score:s().nullish(),startDate:f().regex(/^(?!0000)[0-9]{4}(?:-(?:0[1-9]|1[0-2])(?:-(?:0[1-9]|[12][0-9]|3[01])(?:T(?:[01][0-9]|2[0-3]):[0-5][0-9](?::[0-5][0-9](?:\.[0-9]{1,9})?)?(?:Z|[+-][0-9]{2}:[0-5][0-9]))?)?)?$/).nullish(),titleFunction:f().nullish(),titleId:s().nullish(),titleLevel:f().nullish(),titleName:f().nullish()}),J=p({address:r(m),urlLink:r(C)}),fe=p({amountRaised:d().nullish(),dateAnnounced:n({offset:!0}).nullish(),id:e(),image:T,investorCount:s().nullish(),nameBrand:f(),round:f().nullish(),status:f().nullish(),valuationPostMoney:d().nullish()}),pe=p({entity:D,headquartersCity:f().nullish(),headquartersCountry:f().nullish(),headquartersRegion:f().nullish(),industry:f().nullish()}),Y=p({amount:d().nullish(),company:pe,date:n({offset:!0}).nullish(),fundraiseTransaction:fe.nullish(),fundraiseTransactionId:e(),id:f(),investmentDate:n({offset:!0}),investorAttribution:M.nullish(),round:f().nullish()}),me=t([o([`entity`,`person`,`newsArticle`,`blogPost`,`text`,`classificationTag`,`classificationCode`,`product`,`service`,`agentHelpDoc`,`researchSnippet`,`sourceDocument`]),f()]),X=p({computedAt:n({offset:!0}),cosineDistance:d(),cosineScore:d(),modelVersion:f(),rank:s(),sourceHash:f(),sourceId:f(),sourceType:me}),Z=p({createdAt:n({offset:!0}).nullish(),gender:f().nullish(),id:e(),image:K,lastModifiedAt:n({offset:!0}).nullish(),nameAlias:r(G),nameFirst:f().nullish(),nameFull:f(),nameLast:f().nullish(),nameMiddle:f().nullish(),nickname:f().nullish(),publicId:f().regex(/^p[0-9A-Za-z]{12}$/).nullish(),semanticMatch:X.nullish(),slug:f().regex(/^[a-z0-9_-]+$/).max(255),suffix:f().nullish(),text:b,updatedAt:n({offset:!0}).nullish()}),Q=p({articleCount:s().nullish(),association:r(q),core:Z,enrichment:J,investment:r(Y),nameAlias:r(G)}),he=o([`ein`,`secCik`,`ticker`,`lei`,`duns`,`isin`,`cusip`,`crd`,`orcid`]),$=p({createdAt:n({offset:!0}),id:s(),identifier:f(),idType:he,owner:l,source:f().nullish(),updatedAt:n({offset:!0})}),ge=p({core:D,enrichment:w,fundraiseRound:r(N),newsArticle:r(W),person:r(Q),publicUrl:f().nullish(),relationship:r(I),research:ue,sitemap:E,uniqueId:r($)});export{S as C,C as S,g as T,M as _,X as a,D as b,W as c,V as d,R as f,N as g,P as h,Z as i,U as l,I as m,$ as n,Y as o,L as p,Q as r,q as s,ge as t,H as u,j as v,_ as w,w as x,k as y};
|