@corrreia/hl 0.1.2 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -13
- package/dist/catalogs-BMSq1MuA.mjs +1 -0
- package/dist/catalogs-Di2RbeRG.mjs +1 -0
- package/dist/index.mjs +9 -9
- package/package.json +3 -1
- package/dist/catalogs-kJMRy_jv.mjs +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import{createInterface as e}from"node:readline/promises";import t from"yargs";import{mkdir as n,readFile as r,rename as i,writeFile as a}from"node:fs/promises";import{homedir as o}from"node:os";import{dirname as s,join as c}from"node:path";import{Result as l,TaggedError as u}from"better-result";import{z as d}from"zod";import{execFile as f,spawn as p}from"node:child_process";import{promisify as ee}from"node:util";import{Agent as te,fetch as
|
|
2
|
-
`)[0]??``;return l.err(new h({kind:`command`,message:`\`${e}\` failed${n===``?``:`: ${n}`}`,cause:t}))}}function
|
|
3
|
-
`)?e:`${e}\n`;if(t.format===`table`){let n=
|
|
4
|
-
`;let n=t??
|
|
5
|
-
`)}\n`}function
|
|
6
|
-
If it uses a self-signed certificate, add --insecure.`:``;return
|
|
7
|
-
`),0):(e.io.stdout.write(P(r,{format:n,pretty:e.io.stdout.isTTY})),0)}async function Ke(e,t,n){let r=e.config.instances[t]??{},i=r[n];if(i===void 0)return R(e.io,`No ${t} instance named "${n}"`);if(i.secret?.kind===`keyring`){let t=await e.keyring(),n=t.isErr()?void 0:await t.value.delete(i.secret.account);(n===void 0||n.isErr())&&z(e.io,`Couldn't delete ${i.secret.account}'s key from the keyring; delete it there (service hl)`)}let a=Object.fromEntries(Object.entries(r).filter(([e])=>e!==n)),o=Object.fromEntries(Object.entries(e.config.defaults).filter(([e,r])=>e!==t||r!==n)),s=await I(e,{instances:{...e.config.instances,[t]:a},defaults:o});return s.isErr()?R(e.io,s.error.message):(B(e.io,`Removed ${t}@${n}`),0)}async function qe(e,t,n){if(e.config.instances[t]?.[n]===void 0)return R(e.io,`No ${t} instance named "${n}"`);let r=await I(e,{...e.config,defaults:{...e.config.defaults,[t]:n}});return r.isErr()?R(e.io,r.error.message):(B(e.io,`${t}@${n} is the default`),0)}async function Je(e,t,n){let r=0,i=e.services.filter(e=>t===void 0||e.id===t);for(let t of i){let i=n===void 0?D(e.config,t.id):[n];for(let n of i){let i=O(e.config,t,n);if(i.isErr()){r=R(e.io,i.error.message);continue}let a=await k(t,i.value,e);if(a.isErr()){r=R(e.io,a.error.message);continue}let o=await L(e,a.value,!0);if(o.probeError!==void 0){r=R(e.io,`${t.id}@${n}: ${o.probeError.message}`);continue}let{catalog:s,match:c}=await N(t,o.version);B(e.io,`${t.id}@${n}: ${t.title} ${o.version??`?`}${c?.kind===`exact`?``:` (commands from ${s.version})`}`),c?.kind===`server-older`&&z(e.io,`${t.id}@${n} is older than any version hl has commands for`)}}return r}function Ye(e,t){if(t===`json`)return e;let[n]=e,r=e.at(-1);return n===void 0||r===void 0||n===r?n??``:`${e.length}: ${n} – ${r}`}const Xe=/* @__PURE__ */ new Set([`all`,`all-pages`,`body`,`columns`,`dry-run`,`help`,`instance`,`output`,`version`,`yes`]);var V=class extends u(`InvalidArgument`){};function H(e,t){let n=t.params.filter(e=>e.in===`path`),r=e.context.filter(e=>n.some(t=>t.wireName===e.wireName)).map(e=>({flag:e.flag,spec:e})),i=n.filter(e=>!r.some(t=>t.spec.wireName===e.wireName)),a=/* @__PURE__ */ new Set([...Xe,...r.map(e=>e.flag),...i.map(e=>e.flag)]),o=t.params.filter(e=>e.in===`query`).map(e=>({flag:U(e.flag,`query`,a),spec:e})),s=(t.body?.fields??[]).map(e=>({flag:U(e.flag,`body`,a),spec:e})),c=e.pagination;return{positionals:i,context:r,queries:o,bodyFields:s,pages:c!==void 0&&o.some(e=>e.spec.wireName===c.offsetParam)&&o.some(e=>e.spec.wireName===c.limitParam)}}function U(e,t,n){let r=n.has(e)?`${t}-${e}`:e;return n.add(r),r}async function Ze(e,t,n,r){let i=H(t.service,n),a=/* @__PURE__ */ new Map;for(let e of i.positionals){let t=r[e.flag];if(typeof t!=`string`&&typeof t!=`number`||t===``)return l.err(new V({flag:e.flag,message:`Missing <${e.flag}>`}));a.set(e.wireName,String(t))}for(let{flag:e,spec:n}of i.context){let i=r[e],o=await n.resolve(t.api,typeof i==`string`?i:void 0,t.config.context[e]);if(o.isErr())return o;a.set(n.wireName,o.value)}let o=n.route.replace(/\{([^}]+)\}/g,(e,t)=>encodeURIComponent(a.get(t)??``)),s={};for(let{flag:e,spec:t}of i.queries){let n=r[e];if(n===void 0){if(t.required)return l.err(new V({flag:e,message:`Missing --${e}`}));continue}let i=W(e,t.type,n);if(i.isErr())return i;s[t.wireName]=Array.isArray(i.value)?i.value.map(et):[et(i.value)]}let c=await Qe(e,n,i,r);return c.isErr()?c:l.ok({method:n.method,route:o,query:s,body:c.value})}async function Qe(e,t,n,r){if(t.body===void 0)return l.ok(void 0);let i,a=r.body;if(typeof a==`string`){let t=await $e(e,a);if(t.isErr())return t;try{i=JSON.parse(t.value)}catch{return l.err(new V({flag:`body`,message:`--body is not valid JSON`}))}}let o={};for(let{flag:e,spec:t}of n.bodyFields){let n=r[e];if(n===void 0)continue;let i=W(e,t.type,n);if(i.isErr())return i;o[t.wireName]=i.value}if(Object.keys(o).length>0){if(i===void 0)i=o;else if(typeof i==`object`&&i&&!Array.isArray(i))i={...i,...o};else return l.err(new V({flag:`body`,message:`--body must be a JSON object to combine it with field flags`}))}if(i===void 0&&t.body.required){let e=n.bodyFields.length>0?` (or its field flags; see --help)`:``;return l.err(new V({flag:`body`,message:`This command needs a body: pass --body${e}`}))}return l.ok(i)}async function $e(e,t){if(t===`@-`||t===`-`)return l.ok(await e.readStdin());if(!t.startsWith(`@`))return l.ok(t);let n=t.slice(1);try{return l.ok(await r(n,`utf8`))}catch{return l.err(new V({flag:`body`,message:`Could not read ${n}`}))}}function W(e,t,n){let r=t=>l.err(new V({flag:e,message:`--${e} must be ${t}, not ${JSON.stringify(n)}`}));switch(t.kind){case`string`:return l.ok(String(n));case`integer`:return typeof n==`number`&&Number.isInteger(n)?l.ok(n):r(`an integer`);case`number`:return typeof n==`number`&&!Number.isNaN(n)?l.ok(n):r(`a number`);case`boolean`:return typeof n==`boolean`?l.ok(n):r(`true or false`);case`enum`:{let e=t.values.find(e=>String(e)===String(n));return e===void 0?r(`one of ${t.values.join(`, `)}`):l.ok(e)}case`array`:{let r=[];for(let i of Array.isArray(n)?n:[n]){let n=W(e,t.elem,i);if(n.isErr())return n;r.push(n.value)}return l.ok(r)}case`json`:if(typeof n!=`string`)return l.ok(n);try{return l.ok(JSON.parse(n))}catch{return r(`JSON`)}default:return it(t)}}function et(e){return typeof e==`string`?e:JSON.stringify(e)}async function tt(e,t){return(await e.http.send({method:t.method,url:j(e.baseUrl,t.route,t.query),headers:t.body===void 0?e.headers:{...e.headers,"Content-Type":`application/json`},body:t.body===void 0?void 0:JSON.stringify(t.body)})).map(e=>e.body)}async function nt(e,t){let n=e.service.pagination;if(n===void 0)throw Error(`${e.service.id} has no pagination`);let r=[];for(;;){let i={...t.query,[n.offsetParam]:[String(r.length)],[n.limitParam]:[String(n.maxLimit)]},a=await tt(e,{...t,query:i});if(a.isErr())return a;let o=n.page(a.value);if(o.isErr())return o;r.push(...o.value.items);let s=o.value.total;if(o.value.items.length===0||(s===void 0?o.value.items.length<n.maxLimit:r.length>=s))return l.ok(r)}}function rt(e,t){return{instance:`${e.service.id}@${e.name}`,method:t.method,url:j(e.baseUrl,t.route,t.query).toString(),body:t.body}}function it(e){throw Error(`unexpected case: ${JSON.stringify(e)}`)}async function at(e,t,n){let r=O(e.config,t,n);if(r.isErr())return{choice:await N(t,void 0),instance:void 0};let{config:i}=r.value,a=i.pinnedVersion??i.detected?.version;if(i.pinnedVersion!==void 0||!M(i,e.now()))return{choice:await N(t,a),instance:r.value.name};let o=await k(t,r.value,e);return o.isErr()?{choice:await N(t,a),instance:r.value.name}:{choice:await N(t,(await L(e,o.value)).version),instance:r.value.name}}function ot(e,t,n,r){let{catalog:i,match:a}=r.choice,o=r.instance===void 0?`Commands from ${n.title} ${i.version}.`:`Commands for ${n.id}@${r.instance}, from ${n.title} ${i.version}${a?.kind===`exact`?``:` (${r.instance} runs ${a===void 0?`an unknown version`:`a different version`})`}.`;return e.command(n.id,`${n.title} (also ${n.id}@<instance>)`,e=>(e.usage(`$0 ${n.id}[@<instance>] <command>\n\n${o}`).option(`instance`,{alias:`i`,type:`string`,description:`The instance to use (or write <service>@<instance>)`}).option(`all`,{type:`boolean`,default:!1,description:`Run on every instance of the service`}).option(`output`,{alias:`o`,choices:Fe,default:`json`,description:`How to print results`}).option(`columns`,{type:`string`,description:`The columns of a table, comma-separated`}).option(`yes`,{alias:`y`,type:`boolean`,default:!1,description:`Don't ask before destructive commands`}).option(`dry-run`,{type:`boolean`,default:!1,description:`Print the request instead of sending it`}).group([`instance`,`all`,`output`,`columns`,`yes`,`dry-run`],`Instance and output:`),st(e,t,n,ft(i)),e.demandCommand(1,`Pick a command; see: hl ${n.id} --help`)))}function st(e,t,n,r){for(let i of r.children.values())e.command(i.name,i.description,e=>(st(e,t,n,i),e.demandCommand(1,`Pick a command`)));for(let i of r.commands)ct(e,t,n,i)}function ct(e,t,n,r){let i=H(n,r),a=[r.path.at(-1)??``,...i.positionals.map(e=>`<${e.flag}>`)].join(` `),o=r.summary||`${r.method} ${r.route}`;e.command({command:a,describe:!r.hidden&&`${o}${r.deprecated?` (deprecated)`:``}`,builder:e=>{e.usage(`$0 ${n.id} ${r.path.join(` `)}${i.positionals.map(e=>` <${e.flag}>`).join(``)}\n\n${o}\n\n${r.method} ${r.route}`);for(let t of i.positionals)e.positional(t.flag,mt(t.type,t.description));for(let{flag:t,spec:n}of i.context)e.option(t,{type:`string`,description:n.description});for(let{flag:t,spec:n}of i.queries)e.option(t,{...G(n.type),description:K(n.description),demandOption:n.required});if(i.pages&&e.option(`all-pages`,{type:`boolean`,default:!1,description:`Fetch every page, and print every item`}),r.body!==void 0){e.option(`body`,{type:`string`,description:`The JSON body: JSON, @file, or @- for standard input. Field flags are set over it.`});for(let{flag:t,spec:n}of i.bodyFields)e.option(t,{...G(n.type),description:K(n.description)});i.bodyFields.length>0&&e.group(i.bodyFields.map(e=>e.flag),`Body fields:`)}return r.description!==``&&r.description!==o&&e.epilog(r.description),e},handler:async e=>{t.exitCode=await lt(t,n,r,e)}})}async function lt(e,t,n,r){let{io:i}=e,a=typeof r.instance==`string`?r.instance:void 0,o=r.all===!0,s=r[`dry-run`]===!0,c=r.output===`table`?`table`:`json`,l=typeof r.columns==`string`?r.columns.split(`,`).map(e=>e.trim()).filter(e=>e!==``):void 0,u={format:c,pretty:i.stdout.isTTY,columns:l},d;if(o){if(d=D(e.config,t.id),d.length===0){let n=O(e.config,t,void 0);return R(i,n.isErr()?n.error.message:`No ${t.id} instances`)}}else{let n=O(e.config,t,a);if(n.isErr())return R(i,n.error.message);d=[n.value.name]}if(n.confirmation!==void 0&&!s&&r.yes!==!0){let e=n.confirmation===``?`${n.method} ${n.route}`:n.confirmation,r=d.map(e=>`${t.id}@${e}`).join(`, `),a=await i.confirm(`${e}\nRun \`${n.path.join(` `)}\` on ${r}?`);if(a===void 0)return R(i,`This command needs confirmation; pass --yes to run it without a terminal`);if(!a)return R(i,`Cancelled`)}let f=[],p=!1;for(let a of d){let c=await ut(e,t,n,a,r,s);if(c.kind===`skipped`){z(i,`skipped ${t.id}@${a}: ${c.reason}`);continue}if(c.kind===`failed`){p=!0,R(i,o?`${t.id}@${a}: ${c.message}`:c.message);continue}f.push({instance:a,value:c.value})}return o?i.stdout.write(Ie(f,u)):f[0]!==void 0&&i.stdout.write(P(f[0].value,u)),+!!p}async function ut(e,t,n,r,i,a){let o=O(e.config,t,r);if(o.isErr())return{kind:`failed`,message:o.error.message};let s=await k(t,o.value,e);if(s.isErr())return{kind:`failed`,message:s.error.message};let c=await L(e,s.value);c.version===void 0&&c.probeError!==void 0&&z(e.io,`couldn't ask ${t.id}@${r} for its version (${c.probeError.message}); using the newest commands`);let{catalog:l,match:u}=await N(t,c.version);u?.kind===`server-older`&&z(e.io,`${t.id}@${r} runs ${c.version}, older than any ${t.title} version hl has (oldest: ${l.version}); some commands may not exist there`);let d=dt(l,n.path);if(d===void 0)return{kind:`skipped`,reason:`${t.title} ${l.version} has no \`${n.path.join(` `)}\``};let f=await Ze(e.io,s.value,d,i);if(f.isErr())return{kind:`failed`,message:f.error.message};if(a)return{kind:`ok`,value:rt(s.value,f.value)};let p=i[`all-pages`]===!0&&H(t,d).pages?await nt(s.value,f.value):await tt(s.value,f.value);if(p.isErr()){let e=p.error,n=S.is(e)&&e.status===404&&u!==void 0&&u.kind!==`exact`?` (${r} runs ${t.title} ${c.version??`?`}; this command comes from ${l.version} and may not exist there)`:``;return{kind:`failed`,message:`${e.message}${n}`}}return{kind:`ok`,value:t.unwrap===void 0?p.value:t.unwrap(p.value)}}function dt(e,t){let n=t.join(` `);return e.commands.find(e=>e.path.join(` `)===n)}function ft(e){let t={name:``,description:``,children:/* @__PURE__ */ new Map,commands:[]},n=new Map(e.groups.map(e=>[e.path.join(` `),e.description]));for(let r of e.commands){let e=t;for(let[t,i]of r.path.slice(0,-1).entries()){let a=e.children.get(i);if(a===void 0){let o=r.path.slice(0,t+1).join(` `);a={name:i,description:n.get(o)??``,children:/* @__PURE__ */ new Map,commands:[]},e.children.set(i,a)}e=a}e.commands.push(r)}return pt(t),t}function pt(e){for(let t of e.children.values())pt(t),t.description===``&&(t.description=[...t.children.keys(),...t.commands.map(e=>e.path.at(-1)??``)].join(`, `))}function G(e){switch(e.kind){case`string`:case`json`:return{type:`string`};case`integer`:case`number`:return{type:`number`};case`boolean`:return{type:`boolean`};case`enum`:return{type:`string`,choices:e.values.map(String)};case`array`:{let t=G(e.elem);return{...t,type:t.type===`boolean`?`boolean`:t.type===`number`?`number`:`string`,array:!0}}default:return ht(e)}}function mt(e,t){return{type:e.kind===`integer`||e.kind===`number`?`number`:`string`,description:K(t),demandOption:!0}}function K(e){return e.split(/\n\s*\n/)[0]?.trim()??``}function ht(e){throw Error(`unexpected case: ${JSON.stringify(e)}`)}async function gt(e,n){let r=_t(e,n.services),i=n.services.find(e=>e.id===r[0]),a=t([...r]).scriptName(`hl`).usage(`$0 <service>[@<instance>] <command>
|
|
1
|
+
import{createInterface as e}from"node:readline/promises";import t from"yargs";import{mkdir as n,readFile as r,rename as i,writeFile as a}from"node:fs/promises";import{homedir as o}from"node:os";import{dirname as s,join as c}from"node:path";import{Result as l,TaggedError as u}from"better-result";import{z as d}from"zod";import{execFile as f,spawn as p}from"node:child_process";import{promisify as ee}from"node:util";import{Agent as te,WebSocket as ne,fetch as re}from"undici";var ie=`0.2.1`;const m=ee(f),ae=d.discriminatedUnion(`kind`,[d.strictObject({kind:d.literal(`keyring`),account:d.string().min(1)}),d.strictObject({kind:d.literal(`command`),command:d.string().min(1)}),d.strictObject({kind:d.literal(`env`),name:d.string().min(1)}),d.strictObject({kind:d.literal(`file`),value:d.string().min(1)})]);var h=class extends u(`SecretUnavailable`){},oe=class extends u(`NoKeyring`){};async function se(e=process.platform){return e===`darwin`&&await pe(`security`)?l.ok(le):e===`linux`||e===`freebsd`||e===`openbsd`?await pe(`secret-tool`)?l.ok(ce):l.err(new oe({message:`secret-tool isn't installed (it's in libsecret: libsecret-tools on Debian, libsecret on Arch)`})):l.err(new oe({message:`hl can't use the keyring on ${e}`}))}const ce={name:`Secret Service`,async get(e){try{let{stdout:t}=await m(`secret-tool`,[`lookup`,`service`,`hl`,`account`,e]);return l.ok(t===``?void 0:t.replace(/\n$/,``))}catch(e){return _(e)===1&&v(e)===``?l.ok(void 0):l.err(new h({kind:`keyring`,message:`The Secret Service failed: ${v(e)||`is it running?`}`,cause:e}))}},async set(e,t){return(await g(`secret-tool`,[`store`,`--label`,`hl: ${e}`,`service`,`hl`,`account`,e],t)).mapError(e=>new h({kind:`keyring`,message:`The Secret Service failed to store the key: ${e}`}))},async delete(e){try{return await m(`secret-tool`,[`clear`,`service`,`hl`,`account`,e]),l.ok(void 0)}catch(e){return l.err(new h({kind:`keyring`,message:`The Secret Service failed: ${v(e)}`,cause:e}))}}},le={name:`Keychain`,async get(e){try{let{stdout:t}=await m(`security`,[`find-generic-password`,`-s`,`hl`,`-a`,e,`-w`]);return l.ok(t.replace(/\n$/,``))}catch(e){return _(e)===44?l.ok(void 0):l.err(new h({kind:`keyring`,message:`The Keychain failed: ${v(e)}`,cause:e}))}},async set(e,t){let n=e=>`"${e.replace(/[\\"]/g,`\\$&`)}"`;return(await g(`security`,[`-i`],`add-generic-password -U -s hl -a ${n(e)} -l ${n(`hl: ${e}`)} -w ${n(t)}\n`)).mapError(e=>new h({kind:`keyring`,message:`The Keychain failed to store the key: ${e}`}))},async delete(e){try{return await m(`security`,[`delete-generic-password`,`-s`,`hl`,`-a`,e]),l.ok(void 0)}catch(e){return _(e)===44?l.ok(void 0):l.err(new h({kind:`keyring`,message:`The Keychain failed: ${v(e)}`,cause:e}))}}};async function ue(e,t){switch(e.kind){case`file`:return l.ok(e.value);case`env`:{let n=t.env[e.name];return n===void 0||n===``?l.err(new h({kind:`env`,message:`$${e.name} is not set`})):l.ok(n)}case`command`:return fe(e.command);case`keyring`:{let n=await t.keyring();if(n.isErr())return l.err(new h({kind:`keyring`,message:`The key is in the keyring, but ${n.error.message}`}));let r=await n.value.get(e.account);return r.isErr()?r:r.value===void 0||r.value===``?l.err(new h({kind:`keyring`,message:`The ${n.value.name} has no key for ${e.account}`})):l.ok(r.value)}default:return y(e)}}function de(e){switch(e?.kind){case void 0:return`none`;case`keyring`:return`keyring`;case`command`:return`command: ${e.command}`;case`env`:return`$${e.name}`;case`file`:return`config file`;default:return y(e)}}async function fe(e){let[t,n]=process.platform===`win32`?[`cmd.exe`,`/c`]:[`/bin/sh`,`-c`];try{let{stdout:r}=await m(t,[n,e],{timeout:6e4,maxBuffer:1048576}),i=r.replace(/\r?\n$/,``);return i===``?l.err(new h({kind:`command`,message:`\`${e}\` printed no key`})):l.ok(i)}catch(t){let n=v(t).split(`
|
|
2
|
+
`)[0]??``;return l.err(new h({kind:`command`,message:`\`${e}\` failed${n===``?``:`: ${n}`}`,cause:t}))}}function g(e,t,n){return new Promise(r=>{let i=p(e,t,{stdio:[`pipe`,`ignore`,`pipe`]}),a=``;i.stderr.on(`data`,e=>a+=e.toString()),i.on(`error`,e=>r(l.err(e.message))),i.on(`close`,e=>r(e===0?l.ok(void 0):l.err(a.trim()||`exit ${e??`?`}`))),i.stdin.end(n)})}async function pe(e){try{return await m(process.platform===`win32`?`where`:`which`,[e]),!0}catch{return!1}}function _(e){return typeof e==`object`&&e&&`code`in e&&typeof e.code==`number`?e.code:void 0}function v(e){return typeof e==`object`&&e&&`stderr`in e&&typeof e.stderr==`string`?e.stderr.trim():``}function y(e){throw Error(`unexpected case: ${JSON.stringify(e)}`)}const b=d.string().regex(/^[a-z0-9][a-z0-9-]*$/,`use lower-case letters, digits and dashes, starting with a letter or digit`),me=d.strictObject({version:d.string().min(1),at:d.iso.datetime()}),he=d.strictObject({url:d.url({protocol:/^https?$/}),secret:ae.optional(),insecure:d.boolean().default(!1),basePath:d.string().startsWith(`/`).optional(),context:d.record(d.string(),d.string().min(1)).default({}),detected:me.optional(),pinnedVersion:d.string().min(1).optional()}),ge=d.strictObject({instances:d.record(d.string(),d.record(b,he)).default({}),defaults:d.record(d.string(),b).default({})});var _e=class extends u(`InvalidConfig`){},x=class extends u(`ConfigIoFailed`){};function ve(e){let t=e.HL_CONFIG;if(t!==void 0&&t!==``)return t;let n=e.XDG_CONFIG_HOME||c(o(),`.config`);return c(n,`hl`,`config.json`)}function ye(){return{instances:{},defaults:{}}}async function be(e){let t;try{t=await r(e,`utf8`)}catch(t){return Ce(t)?l.ok(ye()):l.err(new x({path:e,operation:`read`,cause:t,message:`Could not read ${e}`}))}return xe(e,t)}function xe(e,t){let n;try{n=JSON.parse(t)}catch{return l.err(new _e({path:e,issues:`not JSON`,message:`${e} is not valid JSON`}))}let r=ge.safeParse(n);if(!r.success){let t=d.prettifyError(r.error);return l.err(new _e({path:e,issues:t,message:`${e} is not a valid hl config:\n${t}`}))}return l.ok(r.data)}async function Se(e,t){let r=`${e}.${process.pid}.tmp`;try{return await n(s(e),{recursive:!0,mode:448}),await a(r,`${JSON.stringify(t,void 0,` `)}\n`,{mode:384}),await i(r,e),l.ok(void 0)}catch(t){return l.err(new x({path:e,operation:`write`,cause:t,message:`Could not write ${e}`}))}}function Ce(e){return e instanceof Error&&`code`in e&&e.code===`ENOENT`}var we=class extends u(`HttpStatusError`){},S=class extends u(`TlsUnverified`){},C=class extends u(`Unreachable`){};const Te=/* @__PURE__ */ new Set([`DEPTH_ZERO_SELF_SIGNED_CERT`,`SELF_SIGNED_CERT_IN_CHAIN`,`UNABLE_TO_VERIFY_LEAF_SIGNATURE`,`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`,`CERT_HAS_EXPIRED`,`ERR_TLS_CERT_ALTNAME_INVALID`]);function Ee(e){let t=new te({connect:{rejectUnauthorized:!e.insecure}});return{async send(n){let r=n.url.toString(),i,a;try{i=await re(n.url,{method:n.method,headers:n.headers,body:n.body??null,dispatcher:t,signal:AbortSignal.timeout(e.timeoutMs)}),a=await i.text()}catch(e){let t=ke(e);return t!==void 0&&Te.has(t)?l.err(new S({url:r,code:t,cause:e,message:`The certificate of ${n.url.host} can't be verified (${t})`})):l.err(new C({url:r,cause:e,message:`Could not reach ${n.url.host}: ${Ae(e)}`}))}let o=De(a,i.headers.get(`content-type`));return i.ok?l.ok({status:i.status,body:o}):l.err(new we({method:n.method,url:r,status:i.status,body:o,message:`${n.method} ${n.url.pathname} failed with ${i.status}${Oe(o,i.statusText)}`}))}}}function De(e,t){if(e!==``){if(t!==null&&/[/+]json\b/.test(t))try{return JSON.parse(e)}catch{return e}return e}}function Oe(e,t){let n=[];return typeof e==`string`&&e.length>0&&e.length<300?n.push(e.trim()):typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`?n.push(e.message.trim()):t!==``&&!/^(Bad Request|Unauthorized|Forbidden|Not Found|Internal Server Error)$/i.test(t)&&n.push(t),typeof e==`object`&&e&&`errors`in e&&typeof e.errors==`object`&&e.errors!==null&&n.push(...Object.entries(e.errors).map(([e,t])=>`${e}: ${typeof t==`string`?t.trim():JSON.stringify(t)}`)),n.length===0?``:`: ${n.join(`; `)}`}function ke(e){for(let t=e,n=0;t instanceof Error&&n<4;n++){if(`code`in t&&typeof t.code==`string`)return t.code;t=t.cause}}function Ae(e){if(e instanceof Error&&e.name===`TimeoutError`)return`timed out`;let t=ke(e);return t===void 0?e instanceof Error?e.message:`unknown error`:t}function w(e,t){let n=Ne(e),r=Ne(t);for(let e=0;e<Math.max(n.length,r.length);e++){let t=n[e]??0,i=r[e]??0;if(t!==i)return typeof t==`number`&&typeof i==`number`?t-i:String(t).localeCompare(String(i))}return 0}function je(e,t){let n=[...e].sort(w),[r]=n;if(r===void 0)throw Error(`pickVersion needs at least one version`);let i={kind:`server-older`,version:r};for(let e of n){let n=w(e,t);if(n>0)break;i={kind:n===0?`exact`:`older`,version:e}}return i}function Me(e){let t=[...e].sort(w).at(-1);if(t===void 0)throw Error(`newestVersion needs at least one version`);return t}function Ne(e){return e.replace(/^v/i,``).split(/[.\-+]/).map(e=>/^\d+$/.test(e)?Number(e):e)}var Pe=class extends u(`NoInstances`){},Fe=class extends u(`UnknownInstance`){},Ie=class extends u(`NoDefaultInstance`){},T=class extends u(`MissingApiKey`){};function E(e,t){return Object.keys(e.instances[t]??{}).sort()}function D(e,t,n){let r=e.instances[t.id]??{},i=E(e,t.id),a=`hl instances add ${t.id} <name> --url <url> --api-key <key>`;if(i.length===0)return l.err(new Pe({service:t.id,message:`No ${t.title} instances yet; add one with: ${a}`}));let o=n??e.defaults[t.id]??(i.length===1?i[0]:void 0);if(o===void 0)return l.err(new Ie({service:t.id,names:i,message:`${t.title} has ${i.length} instances (${i.join(`, `)}); pick one with ${t.id}@<name>, or set a default with: hl instances use ${t.id} <name>`}));let s=r[o];return s===void 0?l.err(new Fe({service:t.id,name:o,message:`No ${t.id} instance named "${o}"; instances: ${i.join(`, `)}`})):l.ok({name:o,config:s})}async function O(e,t,n){let{secret:r}=t.config,i=`${e.id}@${t.name}`;if(r===void 0)return e.authOptional===!0?l.ok(k(e,t,void 0)):l.err(new T({service:e.id,name:t.name,message:`${i} has no API key`}));let a=await ue(r,n);return a.isErr()?l.err(new T({service:e.id,name:t.name,message:`${i}: ${a.error.message}`})):l.ok(k(e,t,a.value))}function k(e,t,n){let{config:r}=t,i=`${r.url.replace(/\/+$/,``)}${r.basePath??e.basePath}`,a=n===void 0?{Accept:`application/json`}:e.authHeaders(n),o=Ee({insecure:r.insecure,timeoutMs:15e3}),s={async get(e,t){return(await o.send({method:`GET`,url:A(i,e,t??{}),headers:a})).map(e=>e.body)},connection:{url:r.url,insecure:r.insecure,apiKey:n}};return{...t,service:e,baseUrl:i,headers:a,http:o,api:s}}function A(e,t,n){let r=new URL(`${e}${t}`);for(let[e,t]of Object.entries(n))for(let n of typeof t==`string`?[t]:t)r.searchParams.append(e,n);return r}function j(e,t){return e.detected===void 0||t.getTime()-Date.parse(e.detected.at)>864e5}async function M(e,t){let n=Object.keys(e.versions),r=t===void 0?void 0:je(n,t),i=r?.version??Me(n),a=e.versions[i];if(a===void 0)throw Error(`no catalogue loader for ${e.id} ${i}`);return{catalog:(await a()).default,match:r}}const Le=[`json`,`table`];function N(e,t){if(e===void 0)return``;if(typeof e==`string`)return e.endsWith(`
|
|
3
|
+
`)?e:`${e}\n`;if(t.format===`table`){let n=ze(e);if(n!==void 0)return Be(n,t.columns)}return`${JSON.stringify(e,void 0,t.pretty?2:void 0)}\n`}function Re(e,t){if(t.format===`table`){let n=[];for(let t of e)for(let e of ze(t.value)??[t.value])n.push({instance:t.instance,...P(e)?e:{value:e}});return Be(n,t.columns===void 0?void 0:[`instance`,...t.columns])}let n=Object.fromEntries(e.map(e=>[e.instance,e.value]));return`${JSON.stringify(n,void 0,t.pretty?2:void 0)}\n`}function ze(e){if(Array.isArray(e))return e;if(P(e)&&Array.isArray(e.data))return e.data}function Be(e,t){if(e.length===0)return`(none)
|
|
4
|
+
`;let n=t??Ve(e),r=e.map(e=>n.map(t=>He(P(e)?e[t]:t===`value`?e:void 0))),i=n.map(e=>Ue(e)),a=i.map((e,t)=>Math.max(e.length,...r.map(e=>(e[t]??``).length))),o=e=>e.map((t,n)=>n===e.length-1?t:t.padEnd(a[n]??0)).join(` `).trimEnd();return`${[o(i),...r.map(o)].join(`
|
|
5
|
+
`)}\n`}function Ve(e){let t=[];for(let n of e){if(!P(n))return t.length===0?[`value`]:t;for(let[e,r]of Object.entries(n))!t.includes(e)&&(typeof r!=`object`||!r)&&t.push(e)}return t.slice(0,8)}function He(e){return e==null?``:typeof e==`string`?e:typeof e==`number`||typeof e==`boolean`||typeof e==`bigint`?`${e}`:JSON.stringify(e)??``}function Ue(e){return e.replace(/([a-z0-9])([A-Z])/g,`$1 $2`).replace(/[-_]/g,` `).toUpperCase()}function P(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}async function F(e,t){let n=await Se(e.configPath,t);return n.isOk()&&(e.config=t),n}async function I(e,t,n=!1){if(t.config.pinnedVersion!==void 0)return{version:t.config.pinnedVersion,probeError:void 0};let r=t.config.detected?.version,i=t.service.probeVersion;if(i===void 0||!n&&!j(t.config,e.now()))return{version:r,probeError:void 0};let a=await i(t.api);if(a.isErr())return{version:r,probeError:a.error};let o=e.config.instances[t.service.id]??{},s=o[t.name];if(s!==void 0){let n={version:a.value,at:e.now().toISOString()},r=await F(e,{...e.config,instances:{...e.config.instances,[t.service.id]:{...o,[t.name]:{...s,detected:n}}}});r.isErr()&&e.io.stderr.write(`⚠ ${r.error.message}; the detected version is not saved\n`)}return{version:a.value,probeError:void 0}}function L(e,t){return e.stderr.write(`✗ ${t}\n`),1}function R(e,t){e.stderr.write(`⚠ ${t}\n`)}function z(e,t){e.stderr.write(`✓ ${t}\n`)}function We(e,t){let n=()=>t.services.map(e=>e.id);return e.command(`instances`,`Add, list and pick the servers of each service`,e=>e.command(`add <service> <name>`,`Add a server, and ask it which version it runs`,e=>e.positional(`service`,{type:`string`,choices:n(),demandOption:!0}).positional(`name`,{type:`string`,demandOption:!0,description:`A name for it, such as home or cabin`}).option(`url`,{type:`string`,demandOption:!0,description:`Its URL on the LAN, such as https://192.168.1.1`}).option(`api-key-cmd`,{type:`string`,description:`A command that prints its key, run each time, such as "pass show unifi"`}).option(`api-key-env`,{type:`string`,description:`An environment variable to read its key from each time`}).option(`api-key-stdin`,{type:`boolean`,default:!1,description:`Read its key from standard input, and keep it in the keyring`}).option(`api-key`,{type:`string`,description:`Its key, kept in the keyring (it stays in your shell history; without it, hl asks)`}).option(`store-in-config`,{type:`boolean`,default:!1,description:`Keep the key in the config file instead of the keyring, for machines without one`}).group([`api-key-cmd`,`api-key-env`,`api-key-stdin`,`api-key`,`store-in-config`],`The key:`).option(`insecure`,{type:`boolean`,default:!1,description:`Accept a certificate that can't be verified, such as a self-signed one`}).option(`base-path`,{type:`string`,description:`Where the API lives under the URL, if not where the service usually has it`}).option(`site`,{type:`string`,description:`The default site (UniFi)`}).option(`default`,{type:`boolean`,default:!1,description:`Make it the service's default instance`}).option(`probe`,{type:`boolean`,default:!0,description:`Ask the server for its version (--no-probe to skip)`}).option(`pin-version`,{type:`string`,description:`Use this version's commands, for servers that can't say which they run`}),async e=>{t.exitCode=await Ge(t,e)}).command([`list [service]`,`ls`],`List the servers`,e=>e.positional(`service`,{type:`string`,choices:n()}).option(`output`,{alias:`o`,choices:[`table`,`json`],default:`table`}),e=>{t.exitCode=qe(t,e.service,e.output)}).command([`remove <service> <name>`,`rm`],`Forget a server`,e=>e.positional(`service`,{type:`string`,choices:n(),demandOption:!0}).positional(`name`,{type:`string`,demandOption:!0}),async e=>{t.exitCode=await Je(t,e.service,e.name)}).command(`use <service> <name>`,`Make a server the service's default`,e=>e.positional(`service`,{type:`string`,choices:n(),demandOption:!0}).positional(`name`,{type:`string`,demandOption:!0}),async e=>{t.exitCode=await Ye(t,e.service,e.name)}).command(`refresh [service] [name]`,`Ask servers again which version they run`,e=>e.positional(`service`,{type:`string`,choices:n()}).positional(`name`,{type:`string`}),async e=>{t.exitCode=await Xe(t,e.service,e.name)}).demandCommand(1,`Pick a command; see: hl instances --help`)).command(`services`,`List the services hl can drive, and the API versions it has commands for`,e=>e.option(`output`,{alias:`o`,choices:[`table`,`json`],default:`table`}),e=>{let n=t.services.map(n=>({service:n.id,title:n.title,versions:Ze(Object.keys(n.versions).sort(w),e.output),instances:E(t.config,n.id).join(`, `)}));t.io.stdout.write(N(n,{format:e.output,pretty:t.io.stdout.isTTY}))})}async function Ge(e,t){let{io:n}=e,r=e.services.find(e=>e.id===t.service);if(r===void 0)return L(n,`Unknown service ${t.service}`);let i=b.safeParse(t.name);if(!i.success)return L(n,`"${t.name}" can't name an instance: ${i.error.issues[0]?.message??`invalid`}`);if(e.config.instances[r.id]?.[i.data]!==void 0)return L(n,`${r.id}@${i.data} already exists; remove it first to change it`);let a;try{a=new URL(t.url)}catch{return L(n,`--url ${t.url} is not a URL`)}if(a.protocol!==`https:`&&a.protocol!==`http:`)return L(n,`--url must be http or https`);if(t[`base-path`]!==void 0&&!t[`base-path`].startsWith(`/`))return L(n,`--base-path must start with /`);let o=await Ke(e,r,`${r.id}/${i.data}`,t);if(o.status===`failed`)return L(n,o.message);let s={url:a.toString().replace(/\/+$/,``),secret:o.secret,insecure:t.insecure,basePath:t[`base-path`],context:t.site===void 0?{}:{site:t.site},pinnedVersion:t[`pin-version`]},c=``,l=r.probeVersion;if(t[`pin-version`]!==void 0){let{catalog:e,match:n}=await M(r,t[`pin-version`]);c=`: pinned to ${r.title} ${t[`pin-version`]}${n?.kind===`exact`?``:` (commands from ${e.version})`}`}else if(l===void 0){let{catalog:e}=await M(r,void 0);c=`: ${r.title} can't say its version; using ${e.version}'s commands (pin one with --pin-version)`}else if(t.probe){let t=await l(k(r,{name:i.data,config:s},o.value).api);if(t.isErr()){let e=S.is(t.error)?`
|
|
6
|
+
If it uses a self-signed certificate, add --insecure.`:``;return L(n,`${t.error.message}${e}\n Not saved; fix it, or add --no-probe to save it anyway.`)}s={...s,detected:{version:t.value,at:e.now().toISOString()}};let{catalog:a,match:u}=await M(r,t.value);c=`: ${r.title} ${t.value}${u?.kind===`exact`?``:` (commands from ${a.version})`}`}if(o.keyring!==void 0&&o.value!==void 0){let e=await o.keyring.set(`${r.id}/${i.data}`,o.value);if(e.isErr())return L(n,`${e.error.message}\n Not saved; use --api-key-cmd, --api-key-env or --store-in-config instead.`)}let u={...e.config.instances[r.id],[i.data]:s},d=t.default||e.config.defaults[r.id]===void 0,f=await F(e,{instances:{...e.config.instances,[r.id]:u},defaults:d?{...e.config.defaults,[r.id]:i.data}:e.config.defaults});return f.isErr()?L(n,f.error.message):(z(n,`${r.id}@${i.data}${c}${d?` — default`:``}; key: ${de(s.secret)}`),0)}async function Ke(e,t,n,r){let{io:i}=e,a=t.credential??`API key`;if([r[`api-key`]!==void 0,r[`api-key-cmd`]!==void 0,r[`api-key-env`]!==void 0,r[`api-key-stdin`]].filter(e=>e).length>1)return{status:`failed`,message:`Give the ${a} one way: --api-key-cmd, --api-key-env, --api-key-stdin or --api-key`};let o=r[`api-key-cmd`]===void 0?r[`api-key-env`]===void 0?void 0:{kind:`env`,name:r[`api-key-env`]}:{kind:`command`,command:r[`api-key-cmd`]};if(o!==void 0){if(r[`store-in-config`])return{status:`failed`,message:`--store-in-config keeps a key given with --api-key-stdin, --api-key or when asked; not a command or variable`};let t=await ue(o,e);return t.isErr()?{status:`failed`,message:t.error.message}:{status:`ok`,secret:o,value:t.value,keyring:void 0}}if(!r[`api-key-stdin`]&&r[`api-key`]===void 0&&t.authOptional===!0)return{status:`ok`,secret:void 0,value:void 0,keyring:void 0};let s;if(!r[`store-in-config`]){let t=await e.keyring();if(t.isErr())return{status:`failed`,message:`No keyring to keep the key in: ${t.error.message}.\n Use --api-key-cmd or --api-key-env, or --store-in-config to keep it in the config file.`};s=t.value}let c;if(r[`api-key-stdin`])c=(await i.readStdin()).trim();else if(r[`api-key`]!==void 0)R(i,`--api-key stays in your shell history; next time, leave it out and hl asks for the key`),c=r[`api-key`];else if(c=(await i.askSecret(`${t.title} ${a}: `))?.trim(),c===void 0)return{status:`failed`,message:`No terminal to ask for the ${a} on; use --api-key-stdin, --api-key-cmd or --api-key-env`};return c===``?{status:`failed`,message:`No ${a} given`}:{status:`ok`,secret:s===void 0?{kind:`file`,value:c}:{kind:`keyring`,account:n},value:c,keyring:s}}function qe(e,t,n){let r=[];for(let i of e.services)if(t===void 0||i.id===t)for(let t of E(e.config,i.id)){let a=e.config.instances[i.id]?.[t];a!==void 0&&r.push({service:i.id,name:t,default:e.config.defaults[i.id]===t?`*`:``,url:a.url,version:a.pinnedVersion??a.detected?.version??``,key:de(a.secret),checked:a.detected?.at??``,...n===`json`?{insecure:a.insecure,context:a.context}:{}})}return r.length===0&&n===`table`?(e.io.stderr.write(`No instances yet; add one with: hl instances add <service> <name> --url <url>
|
|
7
|
+
`),0):(e.io.stdout.write(N(r,{format:n,pretty:e.io.stdout.isTTY})),0)}async function Je(e,t,n){let r=e.config.instances[t]??{},i=r[n];if(i===void 0)return L(e.io,`No ${t} instance named "${n}"`);if(i.secret?.kind===`keyring`){let t=await e.keyring(),n=t.isErr()?void 0:await t.value.delete(i.secret.account);(n===void 0||n.isErr())&&R(e.io,`Couldn't delete ${i.secret.account}'s key from the keyring; delete it there (service hl)`)}let a=Object.fromEntries(Object.entries(r).filter(([e])=>e!==n)),o=Object.fromEntries(Object.entries(e.config.defaults).filter(([e,r])=>e!==t||r!==n)),s=await F(e,{instances:{...e.config.instances,[t]:a},defaults:o});return s.isErr()?L(e.io,s.error.message):(z(e.io,`Removed ${t}@${n}`),0)}async function Ye(e,t,n){if(e.config.instances[t]?.[n]===void 0)return L(e.io,`No ${t} instance named "${n}"`);let r=await F(e,{...e.config,defaults:{...e.config.defaults,[t]:n}});return r.isErr()?L(e.io,r.error.message):(z(e.io,`${t}@${n} is the default`),0)}async function Xe(e,t,n){let r=0,i=e.services.filter(e=>t===void 0||e.id===t);for(let t of i){let i=n===void 0?E(e.config,t.id):[n];for(let n of i){let i=D(e.config,t,n);if(i.isErr()){r=L(e.io,i.error.message);continue}let a=await O(t,i.value,e);if(a.isErr()){r=L(e.io,a.error.message);continue}let o=await I(e,a.value,!0);if(o.probeError!==void 0){r=L(e.io,`${t.id}@${n}: ${o.probeError.message}`);continue}let{catalog:s,match:c}=await M(t,o.version);z(e.io,`${t.id}@${n}: ${t.title} ${o.version??`?`}${c?.kind===`exact`?``:` (commands from ${s.version})`}`),c?.kind===`server-older`&&R(e.io,`${t.id}@${n} is older than any version hl has commands for`)}}return r}function Ze(e,t){if(t===`json`)return e;let[n]=e,r=e.at(-1);return n===void 0||r===void 0||n===r?n??``:`${e.length}: ${n} – ${r}`}const Qe=/* @__PURE__ */ new Set([`all`,`all-pages`,`body`,`columns`,`dry-run`,`help`,`instance`,`output`,`version`,`yes`]);var B=class extends u(`InvalidArgument`){};function V(e,t){let n=t.params.filter(e=>e.in===`path`),r=e.context.filter(e=>n.some(t=>t.wireName===e.wireName)).map(e=>({flag:e.flag,spec:e})),i=n.filter(e=>!r.some(t=>t.spec.wireName===e.wireName)),a=/* @__PURE__ */ new Set([...Qe,...r.map(e=>e.flag),...i.map(e=>e.flag)]),o=t.params.filter(e=>e.in===`query`).map(e=>({flag:H(e.flag,`query`,a),spec:e})),s=(t.body?.fields??[]).map(e=>({flag:H(e.flag,`body`,a),spec:e})),c=e.pagination;return{positionals:i,context:r,queries:o,bodyFields:s,pages:c!==void 0&&o.some(e=>e.spec.wireName===c.offsetParam)&&o.some(e=>e.spec.wireName===c.limitParam)}}function H(e,t,n){let r=n.has(e)?`${t}-${e}`:e;return n.add(r),r}async function $e(e,t,n,r){let i=V(t.service,n),a=/* @__PURE__ */ new Map;for(let e of i.positionals){let t=r[e.flag];if(typeof t!=`string`&&typeof t!=`number`||t===``)return l.err(new B({flag:e.flag,message:`Missing <${e.flag}>`}));a.set(e.wireName,String(t))}for(let{flag:e,spec:n}of i.context){let i=r[e],o=await n.resolve(t.api,typeof i==`string`?i:void 0,t.config.context[e]);if(o.isErr())return o;a.set(n.wireName,o.value)}let o=n.route.replace(/\{([^}]+)\}/g,(e,t)=>encodeURIComponent(a.get(t)??``)),s={};for(let{flag:e,spec:t}of i.queries){let n=r[e];if(n===void 0){if(t.required)return l.err(new B({flag:e,message:`Missing --${e}`}));continue}let i=U(e,t.type,n);if(i.isErr())return i;s[t.wireName]=Array.isArray(i.value)?i.value.map(nt):[nt(i.value)]}let c=await et(e,n,i,r);return c.isErr()?c:l.ok({method:n.method,route:o,query:s,body:c.value})}async function et(e,t,n,r){if(t.body===void 0)return l.ok(void 0);let i,a=r.body;if(typeof a==`string`){let t=await tt(e,a);if(t.isErr())return t;try{i=JSON.parse(t.value)}catch{return l.err(new B({flag:`body`,message:`--body is not valid JSON`}))}}let o={};for(let{flag:e,spec:t}of n.bodyFields){let n=r[e];if(n===void 0)continue;let i=U(e,t.type,n);if(i.isErr())return i;o[t.wireName]=i.value}if(Object.keys(o).length>0){if(i===void 0)i=o;else if(typeof i==`object`&&i&&!Array.isArray(i))i={...i,...o};else return l.err(new B({flag:`body`,message:`--body must be a JSON object to combine it with field flags`}))}if(i===void 0&&t.body.required){let e=n.bodyFields.length>0?` (or its field flags; see --help)`:``;return l.err(new B({flag:`body`,message:`This command needs a body: pass --body${e}`}))}return l.ok(i)}async function tt(e,t){if(t===`@-`||t===`-`)return l.ok(await e.readStdin());if(!t.startsWith(`@`))return l.ok(t);let n=t.slice(1);try{return l.ok(await r(n,`utf8`))}catch{return l.err(new B({flag:`body`,message:`Could not read ${n}`}))}}function U(e,t,n){let r=t=>l.err(new B({flag:e,message:`--${e} must be ${t}, not ${JSON.stringify(n)}`}));switch(t.kind){case`string`:return l.ok(String(n));case`integer`:return typeof n==`number`&&Number.isInteger(n)?l.ok(n):r(`an integer`);case`number`:return typeof n==`number`&&!Number.isNaN(n)?l.ok(n):r(`a number`);case`boolean`:return typeof n==`boolean`?l.ok(n):r(`true or false`);case`enum`:{let e=t.values.find(e=>String(e)===String(n));return e===void 0?r(`one of ${t.values.join(`, `)}`):l.ok(e)}case`array`:{let r=[];for(let i of Array.isArray(n)?n:[n]){let n=U(e,t.elem,i);if(n.isErr())return n;r.push(n.value)}return l.ok(r)}case`json`:if(typeof n!=`string`)return l.ok(n);try{return l.ok(JSON.parse(n))}catch{return r(`JSON`)}default:return ot(t)}}function nt(e){return typeof e==`string`?e:JSON.stringify(e)}async function rt(e,t){return(await e.http.send({method:t.method,url:A(e.baseUrl,t.route,t.query),headers:t.body===void 0?e.headers:{...e.headers,"Content-Type":`application/json`},body:t.body===void 0?void 0:JSON.stringify(t.body)})).map(e=>e.body)}async function it(e,t){let n=e.service.pagination;if(n===void 0)throw Error(`${e.service.id} has no pagination`);let r=[];for(;;){let i={...t.query,[n.offsetParam]:[String(r.length)],[n.limitParam]:[String(n.maxLimit)]},a=await rt(e,{...t,query:i});if(a.isErr())return a;let o=n.page(a.value);if(o.isErr())return o;r.push(...o.value.items);let s=o.value.total;if(o.value.items.length===0||(s===void 0?o.value.items.length<n.maxLimit:r.length>=s))return l.ok(r)}}function at(e,t){return{instance:`${e.service.id}@${e.name}`,method:t.method,url:A(e.baseUrl,t.route,t.query).toString(),body:t.body}}function ot(e){throw Error(`unexpected case: ${JSON.stringify(e)}`)}async function st(e,t,n){let r=D(e.config,t,n);if(r.isErr())return{choice:await M(t,void 0),instance:void 0};let{config:i}=r.value,a=i.pinnedVersion??i.detected?.version;if(i.pinnedVersion!==void 0||!j(i,e.now()))return{choice:await M(t,a),instance:r.value.name};let o=await O(t,r.value,e);return o.isErr()?{choice:await M(t,a),instance:r.value.name}:{choice:await M(t,(await I(e,o.value)).version),instance:r.value.name}}function ct(e,t,n,r){let{catalog:i,match:a}=r.choice,o=r.instance===void 0?`Commands from ${n.title} ${i.version}.`:`Commands for ${n.id}@${r.instance}, from ${n.title} ${i.version}${a?.kind===`exact`?``:` (${r.instance} runs ${a===void 0?`an unknown version`:`a different version`})`}.`;return e.command(n.id,`${n.title} (also ${n.id}@<instance>)`,e=>(e.usage(`$0 ${n.id}[@<instance>] <command>\n\n${o}`).option(`instance`,{alias:`i`,type:`string`,description:`The instance to use (or write <service>@<instance>)`}).option(`all`,{type:`boolean`,default:!1,description:`Run on every instance of the service`}).option(`output`,{alias:`o`,choices:Le,default:`json`,description:`How to print results`}).option(`columns`,{type:`string`,description:`The columns of a table, comma-separated`}).option(`yes`,{alias:`y`,type:`boolean`,default:!1,description:`Don't ask before destructive commands`}).option(`dry-run`,{type:`boolean`,default:!1,description:`Print the request instead of sending it`}).group([`instance`,`all`,`output`,`columns`,`yes`,`dry-run`],`Instance and output:`),lt(e,t,n,mt(i)),e.demandCommand(1,`Pick a command; see: hl ${n.id} --help`)))}function lt(e,t,n,r){for(let i of r.children.values())e.command(i.name,i.description,e=>(lt(e,t,n,i),e.demandCommand(1,`Pick a command`)));for(let i of r.commands)ut(e,t,n,i)}function ut(e,t,n,r){let i=V(n,r),a=[r.path.at(-1)??``,...i.positionals.map(e=>`<${e.flag}>`)].join(` `),o=r.rpc===void 0?`${r.method} ${r.route}`:`${r.rpc.method} (JSON-RPC${r.rpc.job?`, a job: waits for it to finish`:``})`,s=r.summary||(r.rpc?.method??o);e.command({command:a,describe:!r.hidden&&`${s}${r.deprecated?` (deprecated)`:``}`,builder:e=>{e.usage(`$0 ${n.id} ${r.path.join(` `)}${i.positionals.map(e=>` <${e.flag}>`).join(``)}\n\n${s}\n\n${o}`);for(let t of i.positionals)e.positional(t.flag,gt(t.type,t.description));for(let{flag:t,spec:n}of i.context)e.option(t,{type:`string`,description:n.description});for(let{flag:t,spec:n}of i.queries)e.option(t,{...W(n.type),description:G(n.description),demandOption:n.required});if(i.pages&&e.option(`all-pages`,{type:`boolean`,default:!1,description:`Fetch every page, and print every item`}),r.body!==void 0){e.option(`body`,{type:`string`,description:`The JSON body: JSON, @file, or @- for standard input. Field flags are set over it.`});for(let{flag:t,spec:n}of i.bodyFields)e.option(t,{...W(n.type),description:G(n.description)});i.bodyFields.length>0&&e.group(i.bodyFields.map(e=>e.flag),r.rpc===void 0?`Body fields:`:`Parameters:`)}return r.description!==``&&r.description!==s&&e.epilog(r.description),e},handler:async e=>{t.exitCode=await dt(t,n,r,e)}})}async function dt(e,t,n,r){let{io:i}=e,a=typeof r.instance==`string`?r.instance:void 0,o=r.all===!0,s=r[`dry-run`]===!0,c=r.output===`table`?`table`:`json`,l=typeof r.columns==`string`?r.columns.split(`,`).map(e=>e.trim()).filter(e=>e!==``):void 0,u={format:c,pretty:i.stdout.isTTY,columns:l},d;if(o){if(d=E(e.config,t.id),d.length===0){let n=D(e.config,t,void 0);return L(i,n.isErr()?n.error.message:`No ${t.id} instances`)}}else{let n=D(e.config,t,a);if(n.isErr())return L(i,n.error.message);d=[n.value.name]}if(n.confirmation!==void 0&&!s&&r.yes!==!0){let e=n.confirmation===``?n.rpc?.method??`${n.method} ${n.route}`:n.confirmation,r=d.map(e=>`${t.id}@${e}`).join(`, `),a=await i.confirm(`${e}\nRun \`${n.path.join(` `)}\` on ${r}?`);if(a===void 0)return L(i,`This command needs confirmation; pass --yes to run it without a terminal`);if(!a)return L(i,`Cancelled`)}let f=[],p=!1;for(let a of d){let c=await ft(e,t,n,a,r,s);if(c.kind===`skipped`){R(i,`skipped ${t.id}@${a}: ${c.reason}`);continue}if(c.kind===`failed`){p=!0,L(i,o?`${t.id}@${a}: ${c.message}`:c.message);continue}f.push({instance:a,value:c.value})}return o?i.stdout.write(Re(f,u)):f[0]!==void 0&&i.stdout.write(N(f[0].value,u)),+!!p}async function ft(e,t,n,r,i,a){let o=D(e.config,t,r);if(o.isErr())return{kind:`failed`,message:o.error.message};let s=await O(t,o.value,e);if(s.isErr())return{kind:`failed`,message:s.error.message};let c=await I(e,s.value);c.version===void 0&&c.probeError!==void 0&&R(e.io,`couldn't ask ${t.id}@${r} for its version (${c.probeError.message}); using the newest commands`);let{catalog:l,match:u}=await M(t,c.version);u?.kind===`server-older`&&R(e.io,`${t.id}@${r} runs ${c.version}, older than any ${t.title} version hl has (oldest: ${l.version}); some commands may not exist there`);let d=pt(l,n.path);if(d===void 0)return{kind:`skipped`,reason:`${t.title} ${l.version} has no \`${n.path.join(` `)}\``};let f=await $e(e.io,s.value,d,i);if(f.isErr())return{kind:`failed`,message:f.error.message};if(d.rpc!==void 0){if(a)return{kind:`ok`,value:{instance:`${t.id}@${r}`,method:d.rpc.method,params:f.value.body??{}}};if(t.call===void 0)return{kind:`failed`,message:`${t.title} has no way to call ${d.rpc.method}`};let e=await t.call(s.value.api,d,f.value.body,l.version,u);return e.isErr()?{kind:`failed`,message:e.error.message}:{kind:`ok`,value:e.value}}if(a)return{kind:`ok`,value:at(s.value,f.value)};let p=i[`all-pages`]===!0&&V(t,d).pages?await it(s.value,f.value):await rt(s.value,f.value);if(p.isErr()){let e=p.error,n=we.is(e)&&e.status===404&&u!==void 0&&u.kind!==`exact`?` (${r} runs ${t.title} ${c.version??`?`}; this command comes from ${l.version} and may not exist there)`:``;return{kind:`failed`,message:`${e.message}${n}`}}return{kind:`ok`,value:t.unwrap===void 0?p.value:t.unwrap(p.value)}}function pt(e,t){let n=t.join(` `);return e.commands.find(e=>e.path.join(` `)===n)}function mt(e){let t={name:``,description:``,children:/* @__PURE__ */ new Map,commands:[]},n=new Map(e.groups.map(e=>[e.path.join(` `),e.description]));for(let r of e.commands){let e=t;for(let[t,i]of r.path.slice(0,-1).entries()){let a=e.children.get(i);if(a===void 0){let o=r.path.slice(0,t+1).join(` `);a={name:i,description:n.get(o)??``,children:/* @__PURE__ */ new Map,commands:[]},e.children.set(i,a)}e=a}e.commands.push(r)}return ht(t),t}function ht(e){for(let t of e.children.values())ht(t),t.description===``&&(t.description=[...t.children.keys(),...t.commands.map(e=>e.path.at(-1)??``)].join(`, `))}function W(e){switch(e.kind){case`string`:case`json`:return{type:`string`};case`integer`:case`number`:return{type:`number`};case`boolean`:return{type:`boolean`};case`enum`:return{type:`string`,choices:e.values.map(String)};case`array`:{let t=W(e.elem);return{...t,type:t.type===`boolean`?`boolean`:t.type===`number`?`number`:`string`,array:!0}}default:return _t(e)}}function gt(e,t){return{type:e.kind===`integer`||e.kind===`number`?`number`:`string`,description:G(t),demandOption:!0}}function G(e){return e.split(/\n\s*\n/)[0]?.trim()??``}function _t(e){throw Error(`unexpected case: ${JSON.stringify(e)}`)}async function vt(e,n){let r=yt(e,n.services),i=n.services.find(e=>e.id===r[0]),a=t([...r]).scriptName(`hl`).usage(`$0 <service>[@<instance>] <command>
|
|
8
8
|
|
|
9
|
-
One CLI for the self-hosted services in your homelab.`).parserConfiguration({"camel-case-expansion":!1}).strict().exitProcess(!1).wrap(Math.min(120,process.stdout.columns||100)).help().alias(`h`,`help`).version(re).recommendCommands().demandCommand(1,`Pick a command; see: hl --help`);a=He(a,n);for(let e of n.services)if(e===i){let t=await at(n,e,vt(r));a=ot(a,n,e,t)}else a=a.command(e.id,`${e.title} (also ${e.id}@<instance>)`);let o;a=a.fail((e,t)=>{o=e??(t instanceof Error?t.message:`Invalid command`)});let s=``;return await a.parseAsync([...r],{},(e,t,n)=>{s=n}),o===void 0?(s!==``&&n.io.stdout.write(`${s.replace(/\n*$/,``)}\n`),n.exitCode):(s!==``&&s!==o&&n.io.stderr.write(`${s.replace(/\n*$/,``)}\n\n`),R(n.io,o))}function _t(e,t){let[n,...r]=e;if(n===void 0)return[];let i=n.indexOf(`@`);return i<=0||!t.some(e=>e.id===n.slice(0,i))?[...e]:[n.slice(0,i),`--instance`,n.slice(i+1),...r]}function vt(e){for(let[t,n]of e.entries()){if(n===`--instance`||n===`-i`)return e[t+1];if(n.startsWith(`--instance=`))return n.slice(11)}}var q=class extends u(`UnexpectedResponse`){},J=class extends u(`ContextUnresolved`){};function Y(e){let{version:t}=e;return{id:e.id,title:e.title,basePath:e.basePath,versions:e.versions,credential:e.credential,authOptional:e.authOptional,authHeaders:e.auth,context:e.context??[],pagination:e.pagination,unwrap:e.unwrap,probeVersion:t===void 0?void 0:async e=>{let n=await e.get(t.route);if(n.isErr())return n;let r=t.read(n.value);return r===void 0?l.err(new q({route:t.route,issues:JSON.stringify(n.value)?.slice(0,200)??``,message:`${t.route} sent no version`})):l.ok(r.replace(/^v/i,``))}}}const yt=d.record(d.string(),d.unknown());function X(e,t){let n=e;for(let e of t){let t=yt.safeParse(n);if(!t.success)return;n=t.data[e]}return typeof n==`string`&&n!==``?n:void 0}function Z(e=`X-Api-Key`){return t=>({[e]:t,Accept:`application/json`})}function Q(e){return{Authorization:`Bearer ${e}`,Accept:`application/json`}}function bt(e,t){let n=yt.safeParse(e),r=n.success?n.data[t]:void 0;return typeof r==`number`?r:void 0}const xt=Y({id:`home-assistant`,title:`Home Assistant`,basePath:`/api`,versions:{"2023.1.0":()=>import(`./catalogs-C0RKv40c.mjs`).then(e=>({default:e.catalog(`2023.1.0`)}))},credential:`long-lived access token`,auth:Q,version:{route:`/config`,read:e=>X(e,[`version`])}}),St=Y({id:`jellyfin`,title:`Jellyfin`,basePath:``,versions:{"10.10.0":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.10.0`)})),"10.10.2":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.10.2`)})),"10.10.7":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.10.7`)})),"10.11.0":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.11.0`)})),"10.11.7":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.11.7`)})),"10.9.5":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.9.5`)})),"12.0":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`12.0`)}))},auth:e=>({Authorization:`MediaBrowser Token="${e}"`,Accept:`application/json`}),version:{route:`/System/Info/Public`,read:e=>X(e,[`Version`])}}),Ct=Y({id:`immich`,title:`Immich`,basePath:`/api`,versions:{"2.0.1":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.0.1`)})),"2.1.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.1.0`)})),"2.2.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.2.0`)})),"2.3.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.3.0`)})),"2.4.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.4.0`)})),"2.5.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.5.0`)})),"2.5.3":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.5.3`)})),"2.5.4":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.5.4`)})),"2.6.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.6.0`)})),"2.7.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.7.0`)})),"3.0.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.0.0`)})),"3.0.1":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.0.1`)})),"3.0.2":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.0.2`)})),"3.0.3":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.0.3`)})),"3.1.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.1.0`)})),"3.2.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.2.0`)})),"3.2.1":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.2.1`)})),"3.3.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.3.0`)})),"3.3.1":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.3.1`)}))},auth:Z(`x-api-key`),version:{route:`/server/version`,read:e=>{let t=[`major`,`minor`,`patch`].map(t=>bt(e,t));return t.every(e=>e!==void 0)?t.join(`.`):void 0}}}),wt=Y({id:`sonarr`,title:`Sonarr`,basePath:``,versions:{"4.0.11.2815":()=>import(`./catalogs-C8e3WZh0.mjs`).then(e=>({default:e.catalog(`4.0.11.2815`)})),"4.0.19.3007":()=>import(`./catalogs-C8e3WZh0.mjs`).then(e=>({default:e.catalog(`4.0.19.3007`)}))},auth:Z(),version:{route:`/api/v3/system/status`,read:e=>X(e,[`version`])}}),Tt=Y({id:`radarr`,title:`Radarr`,basePath:``,versions:{"5.23.3.9987":()=>import(`./catalogs-DK9YAXYQ.mjs`).then(e=>({default:e.catalog(`5.23.3.9987`)})),"5.24.1.10017":()=>import(`./catalogs-DK9YAXYQ.mjs`).then(e=>({default:e.catalog(`5.24.1.10017`)})),"5.26.0.10051":()=>import(`./catalogs-DK9YAXYQ.mjs`).then(e=>({default:e.catalog(`5.26.0.10051`)})),"5.26.2.10099":()=>import(`./catalogs-DK9YAXYQ.mjs`).then(e=>({default:e.catalog(`5.26.2.10099`)})),"5.27.1.10122":()=>import(`./catalogs-DK9YAXYQ.mjs`).then(e=>({default:e.catalog(`5.27.1.10122`)}))},auth:Z(),version:{route:`/api/v3/system/status`,read:e=>X(e,[`version`])}}),Et=Y({id:`lidarr`,title:`Lidarr`,basePath:``,versions:{"2.10.1.4589":()=>import(`./catalogs-DLBR621g.mjs`).then(e=>({default:e.catalog(`2.10.1.4589`)})),"2.11.1.4621":()=>import(`./catalogs-DLBR621g.mjs`).then(e=>({default:e.catalog(`2.11.1.4621`)})),"2.14.1.4755":()=>import(`./catalogs-DLBR621g.mjs`).then(e=>({default:e.catalog(`2.14.1.4755`)})),"2.9.3.4527":()=>import(`./catalogs-DLBR621g.mjs`).then(e=>({default:e.catalog(`2.9.3.4527`)}))},auth:Z(),version:{route:`/api/v1/system/status`,read:e=>X(e,[`version`])}}),Dt=Y({id:`prowlarr`,title:`Prowlarr`,basePath:``,versions:{"1.37.0.5076":()=>import(`./catalogs-C55p9F-3.mjs`).then(e=>({default:e.catalog(`1.37.0.5076`)}))},auth:Z(),version:{route:`/api/v1/system/status`,read:e=>X(e,[`version`])}}),Ot={"7.0":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`7.0`)})),"7.1":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`7.1`)})),"7.2":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`7.2`)})),"7.3":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`7.3`)})),"7.4":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`7.4`)})),"8.0":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`8.0`)})),"8.1":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`8.1`)})),"8.2":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`8.2`)})),"8.3":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`8.3`)})),"8.4":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`8.4`)})),"9.0":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`9.0`)})),"9.1":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`9.1`)})),"9.2":()=>import(`./catalogs-kJMRy_jv.mjs`).then(e=>({default:e.catalog(`9.2`)}))},kt=d.looseObject({data:d.array(d.looseObject({node:d.string()}))}),At=Y({id:`proxmox`,title:`Proxmox VE`,basePath:`/api2/json`,versions:Ot,credential:`API token (user@realm!tokenid=secret)`,auth:e=>({Authorization:`PVEAPIToken=${e}`,Accept:`application/json`}),version:{route:`/version`,read:e=>X(e,[`data`,`version`])},unwrap:e=>typeof e==`object`&&e&&`data`in e?e.data:e,context:[{wireName:`node`,flag:`node`,description:`The node. Defaults to the instance's node, or the only one in the cluster.`,async resolve(e,t,n){let r=t??n;if(r!==void 0)return l.ok(r);let i=await e.get(`/nodes`);if(i.isErr())return i;let a=kt.safeParse(i.value);if(!a.success)return l.err(new q({route:`/nodes`,issues:d.prettifyError(a.error),message:`/nodes sent no list of nodes`}));let o=a.data.data.map(e=>e.node).sort(),[s]=o;return s!==void 0&&o.length===1?l.ok(s):l.err(new J({flag:`node`,message:o.length===0?`The cluster has no nodes`:`The cluster has ${o.length} nodes; pass --node with one of: ${o.join(`, `)}`}))}}]}),jt=Y({id:`seerr`,title:`Seerr (Jellyseerr)`,basePath:`/api/v1`,versions:{"1.1.1":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.1.1`)})),"1.2.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.2.0`)})),"1.3.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.3.0`)})),"1.4.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.4.0`)})),"1.5.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.5.0`)})),"1.6.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.6.0`)})),"1.7.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.7.0`)})),"1.8.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.8.0`)})),"1.9.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.9.0`)})),"2.0.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`2.0.0`)})),"2.1.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`2.1.0`)})),"2.2.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`2.2.0`)})),"2.3.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`2.3.0`)})),"3.0.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`3.0.0`)})),"3.2.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`3.2.0`)})),"3.3.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`3.3.0`)})),"3.4.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`3.4.0`)})),"3.5.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`3.5.0`)}))},auth:Z(),version:{route:`/status`,read:e=>X(e,[`version`])}}),Mt=Y({id:`overseerr`,title:`Overseerr`,basePath:`/api/v1`,versions:{"1.14.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.14.0`)})),"1.15.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.15.0`)})),"1.16.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.16.0`)})),"1.17.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.17.0`)})),"1.18.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.18.0`)})),"1.19.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.19.0`)})),"1.20.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.20.0`)})),"1.21.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.21.0`)})),"1.22.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.22.0`)})),"1.23.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.23.0`)})),"1.24.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.24.0`)})),"1.25.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.25.0`)})),"1.26.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.26.0`)})),"1.27.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.27.0`)})),"1.28.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.28.0`)})),"1.29.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.29.0`)})),"1.30.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.30.0`)})),"1.30.1":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.30.1`)})),"1.31.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.31.0`)})),"1.32.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.32.0`)})),"1.32.2":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.32.2`)})),"1.33.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.33.0`)})),"1.34.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.34.0`)})),"1.35.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.35.0`)}))},auth:Z(),version:{route:`/status`,read:e=>X(e,[`version`])}}),Nt=Y({id:`portainer`,title:`Portainer CE`,basePath:`/api`,versions:{"2.27.9":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.27.9`)})),"2.28.1":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.28.1`)})),"2.29.2":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.29.2`)})),"2.30.1":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.30.1`)})),"2.31.3":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.31.3`)})),"2.32.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.32.0`)})),"2.33.5":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.33.5`)})),"2.33.6":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.33.6`)})),"2.33.7":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.33.7`)})),"2.33.8":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.33.8`)})),"2.34.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.34.0`)})),"2.35.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.35.0`)})),"2.36.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.36.0`)})),"2.37.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.37.0`)})),"2.38.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.38.0`)})),"2.38.1":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.38.1`)})),"2.39.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.39.0`)})),"2.39.1":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.39.1`)})),"2.39.2":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.39.2`)})),"2.39.4":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.39.4`)})),"2.39.6":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.39.6`)})),"2.40.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.40.0`)})),"2.41.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.41.0`)})),"2.42.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.42.0`)})),"2.43.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.43.0`)})),"2.44.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.44.0`)})),"2.45.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.45.0`)})),"2.45.2":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.45.2`)}))},credential:`access token`,auth:Z(`X-API-Key`),version:{route:`/system/status`,read:e=>X(e,[`Version`])}}),Pt=Y({id:`audiobookshelf`,title:`Audiobookshelf`,basePath:``,versions:{"2.17.4":()=>import(`./catalogs-CDEFrenJ.mjs`).then(e=>({default:e.catalog(`2.17.4`)}))},auth:Q,version:{route:`/status`,read:e=>X(e,[`serverVersion`])}}),Ft=Y({id:`kavita`,title:`Kavita`,basePath:``,versions:{"0.7.1.4":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.7.1.4`)})),"0.7.10.1":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.7.10.1`)})),"0.7.10.2":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.7.10.2`)})),"0.7.11.1":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.7.11.1`)})),"0.7.3.1":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.7.3.1`)})),"0.8.3.2":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.3.2`)})),"0.8.4.2":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.4.2`)})),"0.8.5.11":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.5.11`)})),"0.8.5.3":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.5.3`)})),"0.8.6.1":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.6.1`)})),"0.8.8.3":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.8.3`)})),"0.8.9.1":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.9.1`)})),"0.9.0.2":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.9.0.2`)})),"0.9.1.0":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.9.1.0`)})),"0.9.1.4":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.9.1.4`)}))},auth:Z(`x-api-key`),version:{route:`/api/Plugin/version`,read:e=>typeof e==`string`&&e.replace(/"/g,``).trim()||void 0}}),It=Y({id:`komga`,title:`Komga`,basePath:``,versions:{"0.153.2":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.153.2`)})),"0.154.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.154.0`)})),"0.154.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.154.1`)})),"0.154.2":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.154.2`)})),"0.154.3":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.154.3`)})),"0.154.4":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.154.4`)})),"0.155.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.155.0`)})),"0.155.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.155.1`)})),"0.155.2":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.155.2`)})),"0.155.3":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.155.3`)})),"0.156.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.156.0`)})),"0.157.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.0`)})),"0.157.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.1`)})),"0.157.2":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.2`)})),"0.157.3":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.3`)})),"0.157.4":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.4`)})),"0.157.5":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.5`)})),"0.158.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.158.0`)})),"0.159.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.159.0`)})),"0.159.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.159.1`)})),"0.160.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.160.0`)})),"0.161.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.161.0`)})),"0.163.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.163.0`)})),"0.164.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.164.0`)})),"0.165.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.165.0`)})),"1.0.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.0.0`)})),"1.1.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.1.0`)})),"1.2.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.2.0`)})),"1.2.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.2.1`)})),"1.3.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.3.0`)})),"1.3.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.3.1`)})),"1.4.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.4.0`)})),"1.5.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.5.0`)})),"1.6.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.6.0`)})),"1.6.2":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.6.2`)})),"1.6.3":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.6.3`)})),"1.6.4":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.6.4`)}))},auth:Z(`X-API-Key`),version:{route:`/actuator/info`,read:e=>X(e,[`build`,`version`])}}),Lt=Y({id:`frigate`,title:`Frigate`,basePath:`/api`,versions:{"0.15.0":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.15.0`)})),"0.16.0":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.16.0`)})),"0.16.1":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.16.1`)})),"0.17.0":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.17.0`)})),"0.18.0":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.18.0`)})),"0.18.1":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.18.1`)}))},auth:Q,credential:`JWT token`,authOptional:!0,version:{route:`/version`,read:e=>typeof e==`string`?e.trim().split(`-`)[0]:void 0}}),Rt=Y({id:`adguard`,title:`AdGuard Home`,basePath:`/control`,versions:{"0.107.40":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.40`)})),"0.107.42":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.42`)})),"0.107.44":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.44`)})),"0.107.53":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.53`)})),"0.107.56":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.56`)})),"0.107.57":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.57`)})),"0.107.58":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.58`)})),"0.107.65":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.65`)})),"0.107.66":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.66`)})),"0.107.68":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.68`)})),"0.107.70":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.70`)})),"0.107.72":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.72`)})),"0.107.74":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.74`)})),"0.107.77":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.77`)})),"0.107.79":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.79`)}))},auth:e=>({Authorization:`Basic ${Buffer.from(e).toString(`base64`)}`,Accept:`application/json`}),credential:`user:password`,version:{route:`/status`,read:e=>X(e,[`version`])}}),zt=Y({id:`grafana`,title:`Grafana`,basePath:`/api`,versions:{"12.0.5":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.0.5`)})),"12.0.7":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.0.7`)})),"12.1.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.1.0`)})),"12.1.4":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.1.4`)})),"12.2.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.2.0`)})),"12.2.2":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.2.2`)})),"12.3.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.3.0`)})),"12.4.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.4.0`)})),"13.0.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`13.0.0`)})),"13.0.2":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`13.0.2`)})),"13.1.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`13.1.0`)})),"13.2.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`13.2.0`)}))},auth:Q,credential:`service account token`,version:{route:`/health`,read:e=>X(e,[`version`])}}),Bt=Y({id:`authentik`,title:`authentik`,basePath:`/api/v3`,versions:{"2026.5.3":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.5.3`)})),"2026.5.5":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.5.5`)})),"2026.5.6":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.5.6`)})),"2026.5.7":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.5.7`)})),"2026.8.0":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.8.0`)})),"2026.8.1":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.8.1`)})),"2026.8.2":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.8.2`)}))},auth:Q,credential:`API token`,version:{route:`/admin/version/`,read:e=>X(e,[`version_current`])}}),Vt=Y({id:`karakeep`,title:`Karakeep`,basePath:`/api/v1`,versions:{"0.24.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.24.0`)})),"0.25.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.25.0`)})),"0.26.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.26.0`)})),"0.27.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.27.0`)})),"0.28.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.28.0`)})),"0.29.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.29.0`)})),"0.30.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.30.0`)})),"0.31.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.31.0`)})),"0.32.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.32.0`)})),"0.33.1":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.33.1`)})),"0.34.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.34.0`)}))},auth:Q}),Ht=Y({id:`speedtest-tracker`,title:`Speedtest Tracker`,basePath:``,versions:{"1.10.0":()=>import(`./catalogs-CYSF9lFW.mjs`).then(e=>({default:e.catalog(`1.10.0`)})),"1.10.1":()=>import(`./catalogs-CYSF9lFW.mjs`).then(e=>({default:e.catalog(`1.10.1`)})),"1.14.7":()=>import(`./catalogs-CYSF9lFW.mjs`).then(e=>({default:e.catalog(`1.14.7`)})),"1.15.0":()=>import(`./catalogs-CYSF9lFW.mjs`).then(e=>({default:e.catalog(`1.15.0`)})),"1.7.2":()=>import(`./catalogs-CYSF9lFW.mjs`).then(e=>({default:e.catalog(`1.7.2`)}))},auth:Q}),Ut={"10.0.162":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.0.162`)})),"10.1.84":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.1.84`)})),"10.3.58":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.3.58`)})),"10.4.57":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.4.57`)})),"10.5.67":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.5.67`)})),"10.6.102":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.6.102`)})),"10.6.106":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.6.106`)})),"9.1.120":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.1.120`)})),"9.2.86":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.2.86`)})),"9.2.87":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.2.87`)})),"9.3.43":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.3.43`)})),"9.3.45":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.3.45`)})),"9.4.17":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.4.17`)})),"9.4.19":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.4.19`)})),"9.5.21":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.5.21`)}))},Wt=d.looseObject({applicationVersion:d.string().min(1)}),Gt=d.looseObject({id:d.string(),internalReference:d.string(),name:d.string()}),Kt=d.looseObject({data:d.array(Gt)}),qt=d.looseObject({data:d.array(d.unknown()),totalCount:d.number().optional()}),Jt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Yt={id:`unifi`,title:`UniFi Network`,basePath:`/proxy/network/integration`,versions:Ut,authHeaders(e){return{"X-API-KEY":e,Accept:`application/json`}},async probeVersion(e){let t=await e.get(`/v1/info`);if(t.isErr())return t;let n=Wt.safeParse(t.value);return n.success?l.ok(n.data.applicationVersion):l.err(new q({route:`/v1/info`,issues:d.prettifyError(n.error),message:`/v1/info sent no applicationVersion`}))},context:[{wireName:`siteId`,flag:`site`,description:"The site: its name, internal reference (such as `default`) or id. Defaults to the instance's site, or the only one.",async resolve(e,t,n){let r=t??n;if(r!==void 0&&Jt.test(r))return l.ok(r);let i=await Xt(e);if(i.isErr())return i;let a=i.value.map(e=>e.internalReference===e.name?e.name:`${e.name} (${e.internalReference})`);if(r===void 0){let[e]=i.value;return e!==void 0&&i.value.length===1?l.ok(e.id):l.err(new J({flag:`site`,message:i.value.length===0?`The console has no sites`:`The console has ${i.value.length} sites; pass --site with one of: ${a.join(`, `)}`}))}let o=r.toLowerCase(),s=i.value.find(e=>e.name.toLowerCase()===o||e.internalReference.toLowerCase()===o);return s===void 0?l.err(new J({flag:`site`,message:`No site named "${r}"; sites: ${a.join(`, `)}`})):l.ok(s.id)}}],pagination:{offsetParam:`offset`,limitParam:`limit`,maxLimit:200,page(e){let t=qt.safeParse(e);return t.success?l.ok({items:t.data.data,total:t.data.totalCount}):l.err(new q({route:``,issues:d.prettifyError(t.error),message:`The response is not a page`}))}}};async function Xt(e){let t=await e.get(`/v1/sites`,{limit:`200`});if(t.isErr())return t;let n=Kt.safeParse(t.value);return n.success?l.ok(n.data.data):l.err(new q({route:`/v1/sites`,issues:d.prettifyError(n.error),message:`/v1/sites sent no list of sites`}))}const Zt=[At,Nt,xt,Yt,Rt,St,Ct,wt,Tt,Et,Dt,jt,Mt,Pt,Ft,It,Lt,zt,Bt,Vt,Ht],Qt={stdout:{write:e=>void process.stdout.write(e),isTTY:process.stdout.isTTY===!0},stderr:{write:e=>void process.stderr.write(e),isTTY:process.stderr.isTTY===!0},async readStdin(){let e=[];for await(let t of process.stdin)e.push(Buffer.isBuffer(t)?t:Buffer.from(String(t)));return Buffer.concat(e).toString(`utf8`)},async askSecret(e){let{stdin:t,stderr:n}=process;if(t.isTTY===!0){n.write(e),t.setRawMode(!0),t.resume(),t.setEncoding(`utf8`);try{return await new Promise(e=>{let r=``,i=a=>{for(let o of a){if(o===`\r`||o===`
|
|
9
|
+
One CLI for the self-hosted services in your homelab.`).parserConfiguration({"camel-case-expansion":!1}).strict().exitProcess(!1).wrap(Math.min(120,process.stdout.columns||100)).help().alias(`h`,`help`).version(ie).recommendCommands().demandCommand(1,`Pick a command; see: hl --help`);a=We(a,n);for(let e of n.services)if(e===i){let t=await st(n,e,bt(r));a=ct(a,n,e,t)}else a=a.command(e.id,`${e.title} (also ${e.id}@<instance>)`);let o;a=a.fail((e,t)=>{o=e??(t instanceof Error?t.message:`Invalid command`)});let s=``;return await a.parseAsync([...r],{},(e,t,n)=>{s=n}),o===void 0?(s!==``&&n.io.stdout.write(`${s.replace(/\n*$/,``)}\n`),n.exitCode):(s!==``&&s!==o&&n.io.stderr.write(`${s.replace(/\n*$/,``)}\n\n`),L(n.io,o))}function yt(e,t){let[n,...r]=e;if(n===void 0)return[];let i=n.indexOf(`@`);return i<=0||!t.some(e=>e.id===n.slice(0,i))?[...e]:[n.slice(0,i),`--instance`,n.slice(i+1),...r]}function bt(e){for(let[t,n]of e.entries()){if(n===`--instance`||n===`-i`)return e[t+1];if(n.startsWith(`--instance=`))return n.slice(11)}}var K=class extends u(`UnexpectedResponse`){},q=class extends u(`ContextUnresolved`){};function J(e){let{version:t}=e;return{id:e.id,title:e.title,basePath:e.basePath,versions:e.versions,credential:e.credential,authOptional:e.authOptional,authHeaders:e.auth,context:e.context??[],pagination:e.pagination,unwrap:e.unwrap,call:e.call,probeVersion:t===void 0?e.probe:async e=>{let n=await e.get(t.route);if(n.isErr())return n;let r=t.read(n.value);return r===void 0?l.err(new K({route:t.route,issues:JSON.stringify(n.value)?.slice(0,200)??``,message:`${t.route} sent no version`})):l.ok(r.replace(/^v/i,``))}}}const xt=d.record(d.string(),d.unknown());function Y(e,t){let n=e;for(let e of t){let t=xt.safeParse(n);if(!t.success)return;n=t.data[e]}return typeof n==`string`&&n!==``?n:void 0}function X(e=`X-Api-Key`){return t=>({[e]:t,Accept:`application/json`})}function Z(e){return{Authorization:`Bearer ${e}`,Accept:`application/json`}}function St(e,t){let n=xt.safeParse(e),r=n.success?n.data[t]:void 0;return typeof r==`number`?r:void 0}const Ct=J({id:`home-assistant`,title:`Home Assistant`,basePath:`/api`,versions:{"2023.1.0":()=>import(`./catalogs-C0RKv40c.mjs`).then(e=>({default:e.catalog(`2023.1.0`)}))},credential:`long-lived access token`,auth:Z,version:{route:`/config`,read:e=>Y(e,[`version`])}}),wt=J({id:`jellyfin`,title:`Jellyfin`,basePath:``,versions:{"10.10.0":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.10.0`)})),"10.10.2":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.10.2`)})),"10.10.7":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.10.7`)})),"10.11.0":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.11.0`)})),"10.11.7":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.11.7`)})),"10.9.5":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`10.9.5`)})),"12.0":()=>import(`./catalogs-B1tppcuM.mjs`).then(e=>({default:e.catalog(`12.0`)}))},auth:e=>({Authorization:`MediaBrowser Token="${e}"`,Accept:`application/json`}),version:{route:`/System/Info/Public`,read:e=>Y(e,[`Version`])}}),Tt=J({id:`immich`,title:`Immich`,basePath:`/api`,versions:{"2.0.1":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.0.1`)})),"2.1.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.1.0`)})),"2.2.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.2.0`)})),"2.3.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.3.0`)})),"2.4.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.4.0`)})),"2.5.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.5.0`)})),"2.5.3":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.5.3`)})),"2.5.4":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.5.4`)})),"2.6.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.6.0`)})),"2.7.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`2.7.0`)})),"3.0.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.0.0`)})),"3.0.1":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.0.1`)})),"3.0.2":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.0.2`)})),"3.0.3":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.0.3`)})),"3.1.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.1.0`)})),"3.2.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.2.0`)})),"3.2.1":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.2.1`)})),"3.3.0":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.3.0`)})),"3.3.1":()=>import(`./catalogs-BSpv8Y85.mjs`).then(e=>({default:e.catalog(`3.3.1`)}))},auth:X(`x-api-key`),version:{route:`/server/version`,read:e=>{let t=[`major`,`minor`,`patch`].map(t=>St(e,t));return t.every(e=>e!==void 0)?t.join(`.`):void 0}}}),Et=J({id:`sonarr`,title:`Sonarr`,basePath:``,versions:{"4.0.11.2815":()=>import(`./catalogs-C8e3WZh0.mjs`).then(e=>({default:e.catalog(`4.0.11.2815`)})),"4.0.19.3007":()=>import(`./catalogs-C8e3WZh0.mjs`).then(e=>({default:e.catalog(`4.0.19.3007`)}))},auth:X(),version:{route:`/api/v3/system/status`,read:e=>Y(e,[`version`])}}),Dt=J({id:`radarr`,title:`Radarr`,basePath:``,versions:{"5.23.3.9987":()=>import(`./catalogs-DK9YAXYQ.mjs`).then(e=>({default:e.catalog(`5.23.3.9987`)})),"5.24.1.10017":()=>import(`./catalogs-DK9YAXYQ.mjs`).then(e=>({default:e.catalog(`5.24.1.10017`)})),"5.26.0.10051":()=>import(`./catalogs-DK9YAXYQ.mjs`).then(e=>({default:e.catalog(`5.26.0.10051`)})),"5.26.2.10099":()=>import(`./catalogs-DK9YAXYQ.mjs`).then(e=>({default:e.catalog(`5.26.2.10099`)})),"5.27.1.10122":()=>import(`./catalogs-DK9YAXYQ.mjs`).then(e=>({default:e.catalog(`5.27.1.10122`)}))},auth:X(),version:{route:`/api/v3/system/status`,read:e=>Y(e,[`version`])}}),Ot=J({id:`lidarr`,title:`Lidarr`,basePath:``,versions:{"2.10.1.4589":()=>import(`./catalogs-DLBR621g.mjs`).then(e=>({default:e.catalog(`2.10.1.4589`)})),"2.11.1.4621":()=>import(`./catalogs-DLBR621g.mjs`).then(e=>({default:e.catalog(`2.11.1.4621`)})),"2.14.1.4755":()=>import(`./catalogs-DLBR621g.mjs`).then(e=>({default:e.catalog(`2.14.1.4755`)})),"2.9.3.4527":()=>import(`./catalogs-DLBR621g.mjs`).then(e=>({default:e.catalog(`2.9.3.4527`)}))},auth:X(),version:{route:`/api/v1/system/status`,read:e=>Y(e,[`version`])}}),kt=J({id:`prowlarr`,title:`Prowlarr`,basePath:``,versions:{"1.37.0.5076":()=>import(`./catalogs-C55p9F-3.mjs`).then(e=>({default:e.catalog(`1.37.0.5076`)}))},auth:X(),version:{route:`/api/v1/system/status`,read:e=>Y(e,[`version`])}}),At={"7.0":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`7.0`)})),"7.1":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`7.1`)})),"7.2":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`7.2`)})),"7.3":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`7.3`)})),"7.4":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`7.4`)})),"8.0":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`8.0`)})),"8.1":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`8.1`)})),"8.2":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`8.2`)})),"8.3":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`8.3`)})),"8.4":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`8.4`)})),"9.0":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`9.0`)})),"9.1":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`9.1`)})),"9.2":()=>import(`./catalogs-Di2RbeRG.mjs`).then(e=>({default:e.catalog(`9.2`)}))},jt=d.looseObject({data:d.array(d.looseObject({node:d.string()}))}),Mt=J({id:`proxmox`,title:`Proxmox VE`,basePath:`/api2/json`,versions:At,credential:`API token (user@realm!tokenid=secret)`,auth:e=>({Authorization:`PVEAPIToken=${e}`,Accept:`application/json`}),version:{route:`/version`,read:e=>Y(e,[`data`,`version`])},unwrap:e=>typeof e==`object`&&e&&`data`in e?e.data:e,context:[{wireName:`node`,flag:`node`,description:`The node. Defaults to the instance's node, or the only one in the cluster.`,async resolve(e,t,n){let r=t??n;if(r!==void 0)return l.ok(r);let i=await e.get(`/nodes`);if(i.isErr())return i;let a=jt.safeParse(i.value);if(!a.success)return l.err(new K({route:`/nodes`,issues:d.prettifyError(a.error),message:`/nodes sent no list of nodes`}));let o=a.data.data.map(e=>e.node).sort(),[s]=o;return s!==void 0&&o.length===1?l.ok(s):l.err(new q({flag:`node`,message:o.length===0?`The cluster has no nodes`:`The cluster has ${o.length} nodes; pass --node with one of: ${o.join(`, `)}`}))}}]}),Nt=J({id:`seerr`,title:`Seerr (Jellyseerr)`,basePath:`/api/v1`,versions:{"1.1.1":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.1.1`)})),"1.2.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.2.0`)})),"1.3.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.3.0`)})),"1.4.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.4.0`)})),"1.5.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.5.0`)})),"1.6.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.6.0`)})),"1.7.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.7.0`)})),"1.8.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.8.0`)})),"1.9.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`1.9.0`)})),"2.0.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`2.0.0`)})),"2.1.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`2.1.0`)})),"2.2.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`2.2.0`)})),"2.3.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`2.3.0`)})),"3.0.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`3.0.0`)})),"3.2.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`3.2.0`)})),"3.3.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`3.3.0`)})),"3.4.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`3.4.0`)})),"3.5.0":()=>import(`./catalogs-C4B2vcNn.mjs`).then(e=>({default:e.catalog(`3.5.0`)}))},auth:X(),version:{route:`/status`,read:e=>Y(e,[`version`])}}),Pt=J({id:`overseerr`,title:`Overseerr`,basePath:`/api/v1`,versions:{"1.14.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.14.0`)})),"1.15.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.15.0`)})),"1.16.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.16.0`)})),"1.17.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.17.0`)})),"1.18.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.18.0`)})),"1.19.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.19.0`)})),"1.20.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.20.0`)})),"1.21.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.21.0`)})),"1.22.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.22.0`)})),"1.23.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.23.0`)})),"1.24.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.24.0`)})),"1.25.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.25.0`)})),"1.26.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.26.0`)})),"1.27.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.27.0`)})),"1.28.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.28.0`)})),"1.29.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.29.0`)})),"1.30.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.30.0`)})),"1.30.1":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.30.1`)})),"1.31.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.31.0`)})),"1.32.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.32.0`)})),"1.32.2":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.32.2`)})),"1.33.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.33.0`)})),"1.34.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.34.0`)})),"1.35.0":()=>import(`./catalogs-Cij49Dwe.mjs`).then(e=>({default:e.catalog(`1.35.0`)}))},auth:X(),version:{route:`/status`,read:e=>Y(e,[`version`])}}),Ft=J({id:`portainer`,title:`Portainer CE`,basePath:`/api`,versions:{"2.27.9":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.27.9`)})),"2.28.1":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.28.1`)})),"2.29.2":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.29.2`)})),"2.30.1":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.30.1`)})),"2.31.3":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.31.3`)})),"2.32.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.32.0`)})),"2.33.5":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.33.5`)})),"2.33.6":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.33.6`)})),"2.33.7":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.33.7`)})),"2.33.8":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.33.8`)})),"2.34.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.34.0`)})),"2.35.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.35.0`)})),"2.36.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.36.0`)})),"2.37.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.37.0`)})),"2.38.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.38.0`)})),"2.38.1":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.38.1`)})),"2.39.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.39.0`)})),"2.39.1":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.39.1`)})),"2.39.2":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.39.2`)})),"2.39.4":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.39.4`)})),"2.39.6":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.39.6`)})),"2.40.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.40.0`)})),"2.41.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.41.0`)})),"2.42.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.42.0`)})),"2.43.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.43.0`)})),"2.44.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.44.0`)})),"2.45.0":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.45.0`)})),"2.45.2":()=>import(`./catalogs-CKXE5Iaf.mjs`).then(e=>({default:e.catalog(`2.45.2`)}))},credential:`access token`,auth:X(`X-API-Key`),version:{route:`/system/status`,read:e=>Y(e,[`Version`])}}),It=J({id:`audiobookshelf`,title:`Audiobookshelf`,basePath:``,versions:{"2.17.4":()=>import(`./catalogs-CDEFrenJ.mjs`).then(e=>({default:e.catalog(`2.17.4`)}))},auth:Z,version:{route:`/status`,read:e=>Y(e,[`serverVersion`])}}),Lt=J({id:`kavita`,title:`Kavita`,basePath:``,versions:{"0.7.1.4":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.7.1.4`)})),"0.7.10.1":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.7.10.1`)})),"0.7.10.2":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.7.10.2`)})),"0.7.11.1":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.7.11.1`)})),"0.7.3.1":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.7.3.1`)})),"0.8.3.2":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.3.2`)})),"0.8.4.2":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.4.2`)})),"0.8.5.11":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.5.11`)})),"0.8.5.3":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.5.3`)})),"0.8.6.1":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.6.1`)})),"0.8.8.3":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.8.3`)})),"0.8.9.1":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.8.9.1`)})),"0.9.0.2":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.9.0.2`)})),"0.9.1.0":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.9.1.0`)})),"0.9.1.4":()=>import(`./catalogs-FGbKrbt9.mjs`).then(e=>({default:e.catalog(`0.9.1.4`)}))},auth:X(`x-api-key`),version:{route:`/api/Plugin/version`,read:e=>typeof e==`string`&&e.replace(/"/g,``).trim()||void 0}}),Rt=J({id:`komga`,title:`Komga`,basePath:``,versions:{"0.153.2":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.153.2`)})),"0.154.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.154.0`)})),"0.154.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.154.1`)})),"0.154.2":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.154.2`)})),"0.154.3":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.154.3`)})),"0.154.4":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.154.4`)})),"0.155.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.155.0`)})),"0.155.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.155.1`)})),"0.155.2":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.155.2`)})),"0.155.3":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.155.3`)})),"0.156.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.156.0`)})),"0.157.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.0`)})),"0.157.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.1`)})),"0.157.2":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.2`)})),"0.157.3":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.3`)})),"0.157.4":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.4`)})),"0.157.5":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.157.5`)})),"0.158.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.158.0`)})),"0.159.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.159.0`)})),"0.159.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.159.1`)})),"0.160.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.160.0`)})),"0.161.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.161.0`)})),"0.163.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.163.0`)})),"0.164.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.164.0`)})),"0.165.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`0.165.0`)})),"1.0.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.0.0`)})),"1.1.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.1.0`)})),"1.2.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.2.0`)})),"1.2.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.2.1`)})),"1.3.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.3.0`)})),"1.3.1":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.3.1`)})),"1.4.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.4.0`)})),"1.5.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.5.0`)})),"1.6.0":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.6.0`)})),"1.6.2":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.6.2`)})),"1.6.3":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.6.3`)})),"1.6.4":()=>import(`./catalogs-CY7Rr9In.mjs`).then(e=>({default:e.catalog(`1.6.4`)}))},auth:X(`X-API-Key`),version:{route:`/actuator/info`,read:e=>Y(e,[`build`,`version`])}}),zt=J({id:`frigate`,title:`Frigate`,basePath:`/api`,versions:{"0.15.0":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.15.0`)})),"0.16.0":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.16.0`)})),"0.16.1":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.16.1`)})),"0.17.0":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.17.0`)})),"0.18.0":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.18.0`)})),"0.18.1":()=>import(`./catalogs-r4bXQtyc.mjs`).then(e=>({default:e.catalog(`0.18.1`)}))},auth:Z,credential:`JWT token`,authOptional:!0,version:{route:`/version`,read:e=>typeof e==`string`?e.trim().split(`-`)[0]:void 0}}),Bt=J({id:`adguard`,title:`AdGuard Home`,basePath:`/control`,versions:{"0.107.40":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.40`)})),"0.107.42":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.42`)})),"0.107.44":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.44`)})),"0.107.53":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.53`)})),"0.107.56":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.56`)})),"0.107.57":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.57`)})),"0.107.58":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.58`)})),"0.107.65":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.65`)})),"0.107.66":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.66`)})),"0.107.68":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.68`)})),"0.107.70":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.70`)})),"0.107.72":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.72`)})),"0.107.74":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.74`)})),"0.107.77":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.77`)})),"0.107.79":()=>import(`./catalogs-BtWNuVo9.mjs`).then(e=>({default:e.catalog(`0.107.79`)}))},auth:e=>({Authorization:`Basic ${Buffer.from(e).toString(`base64`)}`,Accept:`application/json`}),credential:`user:password`,version:{route:`/status`,read:e=>Y(e,[`version`])}}),Vt=J({id:`grafana`,title:`Grafana`,basePath:`/api`,versions:{"12.0.5":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.0.5`)})),"12.0.7":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.0.7`)})),"12.1.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.1.0`)})),"12.1.4":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.1.4`)})),"12.2.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.2.0`)})),"12.2.2":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.2.2`)})),"12.3.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.3.0`)})),"12.4.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`12.4.0`)})),"13.0.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`13.0.0`)})),"13.0.2":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`13.0.2`)})),"13.1.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`13.1.0`)})),"13.2.0":()=>import(`./catalogs-Wi_wA-lM.mjs`).then(e=>({default:e.catalog(`13.2.0`)}))},auth:Z,credential:`service account token`,version:{route:`/health`,read:e=>Y(e,[`version`])}}),Ht=J({id:`authentik`,title:`authentik`,basePath:`/api/v3`,versions:{"2026.5.3":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.5.3`)})),"2026.5.5":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.5.5`)})),"2026.5.6":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.5.6`)})),"2026.5.7":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.5.7`)})),"2026.8.0":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.8.0`)})),"2026.8.1":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.8.1`)})),"2026.8.2":()=>import(`./catalogs-C6mUmDdk.mjs`).then(e=>({default:e.catalog(`2026.8.2`)}))},auth:Z,credential:`API token`,version:{route:`/admin/version/`,read:e=>Y(e,[`version_current`])}}),Ut=J({id:`karakeep`,title:`Karakeep`,basePath:`/api/v1`,versions:{"0.24.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.24.0`)})),"0.25.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.25.0`)})),"0.26.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.26.0`)})),"0.27.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.27.0`)})),"0.28.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.28.0`)})),"0.29.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.29.0`)})),"0.30.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.30.0`)})),"0.31.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.31.0`)})),"0.32.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.32.0`)})),"0.33.1":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.33.1`)})),"0.34.0":()=>import(`./catalogs-DhHPYcM0.mjs`).then(e=>({default:e.catalog(`0.34.0`)}))},auth:Z}),Wt=J({id:`speedtest-tracker`,title:`Speedtest Tracker`,basePath:``,versions:{"1.10.0":()=>import(`./catalogs-CYSF9lFW.mjs`).then(e=>({default:e.catalog(`1.10.0`)})),"1.10.1":()=>import(`./catalogs-CYSF9lFW.mjs`).then(e=>({default:e.catalog(`1.10.1`)})),"1.14.7":()=>import(`./catalogs-CYSF9lFW.mjs`).then(e=>({default:e.catalog(`1.14.7`)})),"1.15.0":()=>import(`./catalogs-CYSF9lFW.mjs`).then(e=>({default:e.catalog(`1.15.0`)})),"1.7.2":()=>import(`./catalogs-CYSF9lFW.mjs`).then(e=>({default:e.catalog(`1.7.2`)}))},auth:Z});var Q=class extends u(`RpcFailed`){};const Gt=d.looseObject({id:d.union([d.number(),d.string()]).optional(),result:d.unknown().optional(),error:d.looseObject({code:d.number().optional(),message:d.string().optional(),data:d.looseObject({reason:d.string().optional(),errname:d.string().optional()}).nullish()}).optional()});function Kt(e,t){return new Promise(n=>{let r=new ne(e,{dispatcher:new te({connect:{rejectUnauthorized:!t.insecure}})}),i=/* @__PURE__ */ new Map,a=1,o=!1,s=setTimeout(()=>{r.close(),n(l.err(new C({url:e.toString(),cause:void 0,message:`Could not reach ${e.host}: timed out`})))},t.timeoutMs);r.addEventListener(`open`,()=>{o=!0,clearTimeout(s),n(l.ok({call(e,n){return new Promise(o=>{if(r.readyState!==ne.OPEN){o(l.err(new Q({method:e,code:void 0,message:`The connection is closed`})));return}let s=a++,c=setTimeout(()=>{i.delete(s),o(l.err(new Q({method:e,code:void 0,message:`${e} timed out`})))},t.timeoutMs);i.set(s,t=>{if(clearTimeout(c),t.error!==void 0){let n=t.error.data?.reason??t.error.message??`failed`;o(l.err(new Q({method:e,code:t.error.code,message:`${e}: ${n.trim()}`})))}else o(l.ok(t.result))}),r.send(JSON.stringify({jsonrpc:`2.0`,id:s,method:e,params:n}))})},close(){r.close()}}))}),r.addEventListener(`message`,e=>{let t;try{t=Gt.parse(JSON.parse(String(e.data)))}catch{return}let n=typeof t.id==`number`?i.get(t.id):void 0;n!==void 0&&typeof t.id==`number`&&(i.delete(t.id),n(t))}),r.addEventListener(`error`,t=>{if(o)return;clearTimeout(s);let r=`error`in t?t.error:void 0,i=r instanceof Error?`${r.message} ${r.cause instanceof Error?r.cause.message:``}`:``,a=/certificate|self[- ]signed|UNABLE_TO_VERIFY|CERT_/i.test(i);n(l.err(a?new S({url:e.toString(),code:`CERT`,cause:r,message:`The certificate of ${e.host} can't be verified`}):new C({url:e.toString(),cause:r,message:`Could not open ${e.toString()}${i.trim()===``?``:`: ${i.trim()}`}`})))}),r.addEventListener(`close`,()=>{for(let[e,t]of i)i.delete(e),t({id:e,error:{message:`The connection closed`}})})})}const qt=d.looseObject({state:d.string(),result:d.unknown().optional(),error:d.string().nullish(),progress:d.looseObject({percent:d.number().nullish(),description:d.string().nullish()}).nullish()});async function Jt(e,t,n){for(;;){let r=await e.call(`core.get_jobs`,[[[`id`,`=`,t]]]);if(r.isErr())return r;let i=d.array(qt).safeParse(r.value),[a]=i.success?i.data:[];if(a===void 0)return l.err(new Q({method:`core.get_jobs`,code:void 0,message:`Job ${t} is gone`}));if(a.state===`SUCCESS`)return l.ok(a.result);if(a.state===`FAILED`||a.state===`ABORTED`)return l.err(new Q({method:`core.get_jobs`,code:void 0,message:`Job ${t} ${a.state.toLowerCase()}: ${a.error??`no reason given`}`}));n.onProgress?.(a.progress?.percent??void 0,a.progress?.description??void 0),await new Promise(e=>setTimeout(e,n.intervalMs))}}const Yt={"25.10.0":()=>import(`./catalogs-BMSq1MuA.mjs`).then(e=>({default:e.catalog(`25.10.0`)})),"27.0.0":()=>import(`./catalogs-BMSq1MuA.mjs`).then(e=>({default:e.catalog(`27.0.0`)})),"28.0.0":()=>import(`./catalogs-BMSq1MuA.mjs`).then(e=>({default:e.catalog(`28.0.0`)}))};async function Xt(e,t){let n=new URL(`/api/${t}`,e.url);n.protocol=n.protocol===`https:`?`wss:`:`ws:`;let r=await Kt(n,{insecure:e.insecure,timeoutMs:3e4});if(r.isErr())return r;let i=r.value;if(e.apiKey===void 0)return i.close(),l.err(new Q({method:`auth.login_with_api_key`,code:void 0,message:`TrueNAS needs an API key`}));let a=await i.call(`auth.login_with_api_key`,[e.apiKey]);return a.isErr()||a.value!==!0?(i.close(),l.err(new Q({method:`auth.login_with_api_key`,code:void 0,message:a.isErr()?a.error.message:`TrueNAS rejected the API key`}))):l.ok(i)}const Zt=J({id:`truenas`,title:`TrueNAS`,basePath:``,versions:Yt,auth:()=>({}),async probe(e){let t=await Xt(e.connection,`current`);if(t.isErr())return l.err(new Q({method:`system.version_short`,code:void 0,message:t.error.message}));let n=await t.value.call(`system.version_short`,[]);return t.value.close(),n.isErr()?n:typeof n.value==`string`?l.ok(n.value):l.err(new Q({method:`system.version_short`,code:void 0,message:`TrueNAS sent no version`}))},async call(e,t,n,r,i){let{rpc:a}=t;if(a===void 0)return l.err({message:`${t.path.join(` `)} isn't a TrueNAS method`});let o=await Xt(e.connection,i?.kind===`server-older`?`current`:`v${r}`);if(o.isErr())return o;try{let e=typeof n==`object`&&n?new Map(Object.entries(n)):/* @__PURE__ */ new Map,t=a.params.map(t=>e.get(t));for(;t.length>0&&t.at(-1)===void 0;)t.pop();let r=t.map((e,t)=>e??a.defaults?.[a.params[t]??``]??null),i=await o.value.call(a.method,r);return i.isErr()||!a.job?i:typeof i.value==`number`?await Jt(o.value,i.value,{intervalMs:1e3}):l.err(new Q({method:a.method,code:void 0,message:`${a.method} started no job`}))}finally{o.value.close()}}}),Qt={"10.0.162":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.0.162`)})),"10.1.84":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.1.84`)})),"10.3.58":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.3.58`)})),"10.4.57":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.4.57`)})),"10.5.67":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.5.67`)})),"10.6.102":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.6.102`)})),"10.6.106":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`10.6.106`)})),"9.1.120":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.1.120`)})),"9.2.86":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.2.86`)})),"9.2.87":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.2.87`)})),"9.3.43":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.3.43`)})),"9.3.45":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.3.45`)})),"9.4.17":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.4.17`)})),"9.4.19":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.4.19`)})),"9.5.21":()=>import(`./catalogs-C_RqTMaw.mjs`).then(e=>({default:e.catalog(`9.5.21`)}))},$t=d.looseObject({applicationVersion:d.string().min(1)}),en=d.looseObject({id:d.string(),internalReference:d.string(),name:d.string()}),tn=d.looseObject({data:d.array(en)}),nn=d.looseObject({data:d.array(d.unknown()),totalCount:d.number().optional()}),rn=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,an={id:`unifi`,title:`UniFi Network`,basePath:`/proxy/network/integration`,versions:Qt,authHeaders(e){return{"X-API-KEY":e,Accept:`application/json`}},async probeVersion(e){let t=await e.get(`/v1/info`);if(t.isErr())return t;let n=$t.safeParse(t.value);return n.success?l.ok(n.data.applicationVersion):l.err(new K({route:`/v1/info`,issues:d.prettifyError(n.error),message:`/v1/info sent no applicationVersion`}))},context:[{wireName:`siteId`,flag:`site`,description:"The site: its name, internal reference (such as `default`) or id. Defaults to the instance's site, or the only one.",async resolve(e,t,n){let r=t??n;if(r!==void 0&&rn.test(r))return l.ok(r);let i=await on(e);if(i.isErr())return i;let a=i.value.map(e=>e.internalReference===e.name?e.name:`${e.name} (${e.internalReference})`);if(r===void 0){let[e]=i.value;return e!==void 0&&i.value.length===1?l.ok(e.id):l.err(new q({flag:`site`,message:i.value.length===0?`The console has no sites`:`The console has ${i.value.length} sites; pass --site with one of: ${a.join(`, `)}`}))}let o=r.toLowerCase(),s=i.value.find(e=>e.name.toLowerCase()===o||e.internalReference.toLowerCase()===o);return s===void 0?l.err(new q({flag:`site`,message:`No site named "${r}"; sites: ${a.join(`, `)}`})):l.ok(s.id)}}],pagination:{offsetParam:`offset`,limitParam:`limit`,maxLimit:200,page(e){let t=nn.safeParse(e);return t.success?l.ok({items:t.data.data,total:t.data.totalCount}):l.err(new K({route:``,issues:d.prettifyError(t.error),message:`The response is not a page`}))}}};async function on(e){let t=await e.get(`/v1/sites`,{limit:`200`});if(t.isErr())return t;let n=tn.safeParse(t.value);return n.success?l.ok(n.data.data):l.err(new K({route:`/v1/sites`,issues:d.prettifyError(n.error),message:`/v1/sites sent no list of sites`}))}const sn=[Mt,Zt,Ft,Ct,an,Bt,wt,Tt,Et,Dt,Ot,kt,Nt,Pt,It,Lt,Rt,zt,Vt,Ht,Ut,Wt],cn={stdout:{write:e=>void process.stdout.write(e),isTTY:process.stdout.isTTY===!0},stderr:{write:e=>void process.stderr.write(e),isTTY:process.stderr.isTTY===!0},async readStdin(){let e=[];for await(let t of process.stdin)e.push(Buffer.isBuffer(t)?t:Buffer.from(String(t)));return Buffer.concat(e).toString(`utf8`)},async askSecret(e){let{stdin:t,stderr:n}=process;if(t.isTTY===!0){n.write(e),t.setRawMode(!0),t.resume(),t.setEncoding(`utf8`);try{return await new Promise(e=>{let r=``,i=a=>{for(let o of a){if(o===`\r`||o===`
|
|
10
10
|
`||o===``){t.off(`data`,i),n.write(`
|
|
11
11
|
`),e(r);return}if(o===``){t.off(`data`,i),n.write(`
|
|
12
|
-
`),e(void 0);return}r=o===``||o===`\b`?r.slice(0,-1):r+o}};t.on(`data`,i)})}finally{t.setRawMode(!1),t.pause()}}},async confirm(t){if(process.stdin.isTTY!==!0)return;let n=e({input:process.stdin,output:process.stderr});try{let e=await n.question(`${t} [y/N] `);return/^y(es)?$/i.test(e.trim())}finally{n.close()}}}
|
|
12
|
+
`),e(void 0);return}r=o===``||o===`\b`?r.slice(0,-1):r+o}};t.on(`data`,i)})}finally{t.setRawMode(!1),t.pause()}}},async confirm(t){if(process.stdin.isTTY!==!0)return;let n=e({input:process.stdin,output:process.stderr});try{let e=await n.question(`${t} [y/N] `);return/^y(es)?$/i.test(e.trim())}finally{n.close()}}},ln=ve(process.env),$=await be(ln);$.isErr()?(cn.stderr.write(`✗ ${$.error.message}\n`),process.exitCode=1):process.exitCode=await vt(process.argv.slice(2),{io:cn,env:process.env,now:()=>/* @__PURE__ */ new Date,configPath:ln,config:$.value,keyring:un(()=>se()),services:sn,exitCode:0});function un(e){let t;return()=>t??=e()}export{};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corrreia/hl",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "One CLI for your homelab's self-hosted services, generated from their OpenAPI specs with Forge",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -60,11 +60,13 @@
|
|
|
60
60
|
"@cloudflare/forge": "https://pkg.pr.new/cloudflare/forge/@cloudflare/forge@7d40705fb61e7eedfe62e547348e0b291555739d",
|
|
61
61
|
"@types/node": "^24.19.2",
|
|
62
62
|
"@types/swagger2openapi": "^7.0.4",
|
|
63
|
+
"@types/ws": "^8.18.2",
|
|
63
64
|
"@types/yargs": "17.0.35",
|
|
64
65
|
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
65
66
|
"swagger2openapi": "7.0.8",
|
|
66
67
|
"tsx": "4.21.0",
|
|
67
68
|
"vite-plus": "1.1.0",
|
|
69
|
+
"ws": "8.21.3",
|
|
68
70
|
"yaml": "2.8.1"
|
|
69
71
|
},
|
|
70
72
|
"engines": {
|