@redocly/cli 2.54.1 → 2.54.3
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/THIRD_PARTY_NOTICES +2 -2
- package/lib/chunks/{KW7NKDOX.js → 2FXTKF3U.js} +1 -1
- package/lib/chunks/{23QBFBKB.js → 32ZHA42N.js} +1 -1
- package/lib/chunks/{IZ2TZVJD.js → 3TYRUZAW.js} +4 -4
- package/lib/chunks/{RVQFQGGH.js → 4R5G4SNU.js} +1 -1
- package/lib/chunks/5OBAGRRJ.js +78 -0
- package/lib/chunks/{AHGQ4BNI.js → 77KV43X2.js} +1 -1
- package/lib/chunks/B6JQC3AM.js +30 -0
- package/lib/chunks/{Q7ARG2G6.js → BABBSLVN.js} +1 -1
- package/lib/chunks/{C27G2ZXO.js → BZWFV3MX.js} +1 -1
- package/lib/chunks/{H4XURXR7.js → CUB5GMHZ.js} +1 -1
- package/lib/chunks/{J7GIHRZA.js → DE4ZFTDG.js} +1 -1
- package/lib/chunks/{UAEEHSSK.js → DFVJG4OO.js} +2 -2
- package/lib/chunks/{KZMFETIJ.js → FDI3NUCB.js} +1 -1
- package/lib/chunks/{XRZ5NMQ5.js → G66T7F2A.js} +1 -1
- package/lib/chunks/{3BJIJBSJ.js → GKBR6HC7.js} +1 -1
- package/lib/chunks/GTBZLPVY.js +7 -0
- package/lib/chunks/{Y6E4JAM3.js → HITQPK62.js} +1 -1
- package/lib/chunks/{ALXOGCUM.js → HNVJYHEV.js} +1 -1
- package/lib/chunks/{3RDMQ5CQ.js → HPJKQNL7.js} +1 -1
- package/lib/chunks/{KEF4233Y.js → HR7ZTPFZ.js} +1 -1
- package/lib/chunks/HYALAA3H.js +7 -0
- package/lib/chunks/{VTKYS75A.js → I44GHHET.js} +1 -1
- package/lib/chunks/{CI4NGJ3I.js → ITRAFA2I.js} +1 -1
- package/lib/chunks/K2PGWUA3.js +9 -0
- package/lib/chunks/{W6X4HEU3.js → KCRCWPLX.js} +3 -3
- package/lib/chunks/KPWZVETN.js +11 -0
- package/lib/chunks/{YDSFHQXH.js → KVPIWPOL.js} +1 -1
- package/lib/chunks/{2MBZI3W3.js → KZPCQAG3.js} +1 -1
- package/lib/chunks/{RW2ESAIF.js → L2EEGRZN.js} +41 -41
- package/lib/chunks/{UYHX7364.js → LFQ7H446.js} +1 -1
- package/lib/chunks/LWDUZ2W4.js +7 -0
- package/lib/chunks/{IW2J6X26.js → LZRNA4HH.js} +1 -1
- package/lib/chunks/{UWNBPAWG.js → NRAZJDJM.js} +1 -1
- package/lib/chunks/{MZCEUZSS.js → NRCWSDXN.js} +1 -1
- package/lib/chunks/{S4H3MC5R.js → OA5XCUEZ.js} +1 -1
- package/lib/chunks/OJUJ2R6B.js +20 -0
- package/lib/chunks/{SAJRBHEI.js → OW3COOIS.js} +1 -1
- package/lib/chunks/{LT2PEIAT.js → OYAP4QAE.js} +1 -1
- package/lib/chunks/{4G34OIRT.js → PZLKJXIF.js} +1 -1
- package/lib/chunks/{ZBK7SJHM.js → PZTYMEH7.js} +1 -1
- package/lib/chunks/{ZDQDZTQ7.js → RAYH3MG6.js} +1 -1
- package/lib/chunks/{2TLIBL23.js → SJCEHWE2.js} +1 -1
- package/lib/chunks/{2NS7AGPD.js → SN3OGJPW.js} +1 -1
- package/lib/chunks/{FUCJM4CG.js → SOTTFVAK.js} +1 -1
- package/lib/chunks/{LLGJ3YMR.js → TH4J5VUW.js} +33 -33
- package/lib/chunks/{SZKF6VFY.js → UJ6WQ2OD.js} +5 -7
- package/lib/chunks/UNBNSCWN.js +20 -0
- package/lib/chunks/{FTDJMTRX.js → UR72TK6I.js} +1 -1
- package/lib/chunks/{FIIFOPJG.js → XY2QUSMZ.js} +1 -1
- package/lib/chunks/{QZBHV7SD.js → XZM2ITNF.js} +1 -1
- package/lib/chunks/{L24E6ZRY.js → YOV4L7V6.js} +1 -1
- package/lib/chunks/{CKJYJBJ6.js → Z2BI77LK.js} +1 -1
- package/lib/eject-assets/AGENTS.md +1 -0
- package/lib/eject-assets/generators/cli/docs.ts +1 -1
- package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
- package/lib/eject-assets/generators/cli/index.ts +2 -2
- package/lib/eject-assets/generators/cli/render.ts +3 -6
- package/lib/eject-assets/generators/go/client.ts +1 -1
- package/lib/eject-assets/generators/go/descriptor.ts +1 -1
- package/lib/eject-assets/generators/go/index.ts +2 -2
- package/lib/eject-assets/generators/go/models.ts +1 -1
- package/lib/eject-assets/generators/go/naming.ts +1 -1
- package/lib/eject-assets/generators/go/operations.ts +1 -1
- package/lib/eject-assets/generators/go/pagination.ts +1 -1
- package/lib/eject-assets/generators/go/types.ts +1 -1
- package/lib/eject-assets/generators/mock/faker.ts +1 -1
- package/lib/eject-assets/generators/mock/index.ts +2 -2
- package/lib/eject-assets/generators/mock/render.ts +1 -1
- package/lib/eject-assets/generators/mock/sample.ts +1 -1
- package/lib/eject-assets/generators/mock/values.ts +1 -1
- package/lib/eject-assets/generators/php/client.ts +1 -1
- package/lib/eject-assets/generators/php/descriptor.ts +1 -1
- package/lib/eject-assets/generators/php/index.ts +2 -2
- package/lib/eject-assets/generators/php/models.ts +1 -1
- package/lib/eject-assets/generators/php/naming.ts +1 -1
- package/lib/eject-assets/generators/php/operations.ts +1 -1
- package/lib/eject-assets/generators/php/pagination.ts +1 -1
- package/lib/eject-assets/generators/php/types.ts +1 -1
- package/lib/eject-assets/generators/python/client.ts +1 -1
- package/lib/eject-assets/generators/python/descriptor.ts +1 -1
- package/lib/eject-assets/generators/python/index.ts +2 -2
- package/lib/eject-assets/generators/python/models.ts +1 -1
- package/lib/eject-assets/generators/python/naming.ts +1 -1
- package/lib/eject-assets/generators/python/operations.ts +1 -1
- package/lib/eject-assets/generators/python/pagination.ts +1 -1
- package/lib/eject-assets/generators/python/types.ts +1 -1
- package/lib/eject-assets/generators/swr/index.ts +2 -2
- package/lib/eject-assets/generators/swr/render.ts +1 -1
- package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
- package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
- package/lib/eject-assets/generators/transformers/index.ts +2 -2
- package/lib/eject-assets/generators/transformers/render.ts +1 -1
- package/lib/eject-assets/generators/typescript/banner.ts +1 -1
- package/lib/eject-assets/generators/typescript/client.ts +1 -1
- package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
- package/lib/eject-assets/generators/typescript/index.ts +2 -2
- package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
- package/lib/eject-assets/generators/typescript/operations.ts +3 -5
- package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
- package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
- package/lib/eject-assets/generators/typescript/types.ts +1 -1
- package/lib/eject-assets/generators/zod/index.ts +2 -2
- package/lib/eject-assets/generators/zod/schemas.ts +1 -1
- package/lib/eject-assets/skills/client-generators/SKILL.md +1 -0
- package/lib/index.js +9 -9
- package/package.json +2 -2
- package/lib/chunks/4JE7GYQB.js +0 -7
- package/lib/chunks/5KMAESVG.js +0 -78
- package/lib/chunks/AM6FT7EB.js +0 -9
- package/lib/chunks/BYIMEGON.js +0 -20
- package/lib/chunks/ENDHNS6Y.js +0 -7
- package/lib/chunks/IPVLUS43.js +0 -30
- package/lib/chunks/JH4AUZLH.js +0 -11
- package/lib/chunks/XFRPQNF6.js +0 -20
- package/lib/chunks/ZDNSHHXT.js +0 -7
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -618,7 +618,7 @@ Packages:
|
|
|
618
618
|
semver@7.8.5 — Copyright (c) Isaac Z. Schlueter and Contributors
|
|
619
619
|
which@2.0.2 — Copyright (c) Isaac Z. Schlueter and Contributors
|
|
620
620
|
y18n@5.0.8 — Copyright (c) 2015, Contributors
|
|
621
|
-
yaml@2.9.
|
|
621
|
+
yaml@2.9.1 — Copyright Eemeli Aro <eemeli@gmail.com>
|
|
622
622
|
yargs-parser@20.2.9 — Copyright (c) 2016, Contributors
|
|
623
623
|
zod-to-json-schema@3.25.2 — Copyright (c) 2020, Stefan Terdell
|
|
624
624
|
|
|
@@ -653,7 +653,7 @@ Packages:
|
|
|
653
653
|
@redocly/ajv@8.18.3 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
654
654
|
@redocly/cli-otel@0.3.5 — Copyright 2025 Redocly Inc, all rights reserved.
|
|
655
655
|
@redocly/config@0.22.0 — Copyright 2024 Redocly Inc.
|
|
656
|
-
@redocly/config@0.
|
|
656
|
+
@redocly/config@0.57.0 — Copyright 2024 Redocly Inc.
|
|
657
657
|
@redocly/openapi-core@1.34.20
|
|
658
658
|
agent-base@7.1.4 — Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
|
659
659
|
ajv-formats@3.0.1 — Copyright (c) 2020 Evgeny Poberezkin
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a}from"./
|
|
7
|
+
import{a}from"./XY2QUSMZ.js";import"./KPWZVETN.js";import"./DFVJG4OO.js";import"./WZXA5XPB.js";import"./L2EEGRZN.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as zodGenerator};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as oe,e as ae,f as ue,g as ce,h as b,i as de,k as H,l as V,m as pe,n as le,v as he,w as me}from"./
|
|
7
|
+
import{a as oe,e as ae,f as ue,g as ce,h as b,i as de,k as H,l as V,m as pe,n as le,v as he,w as me}from"./SOTTFVAK.js";import{I as X,L as Je,M as Z,N as g,O,P as ee,Q as $,R as C,T as S,V as y,X as w,Y as te,Z as ne,_ as re,aa as se,c as l,ca as ie,q as Y,v as Q,y as We}from"./L2EEGRZN.js";import{e as J}from"./RFWIIJFG.js";import fe from"node:path";function R(t){return t?t.trim():""}function T(t){let e=R(t.operationId)||R(t.path);return[R(t.ruleId),R(t.severity),R(t.message),e,R(t.target),R(t.schemaPath)].join("")}var F=t=>Z(S(t));function Ye(t){return t==="error"?"error":t==="warning"?"warning":"note"}function Qe(t){if(t==null)return"";let e=String(t);return!e.includes(",")&&!e.includes('"')&&!e.includes(`
|
|
8
8
|
`)?e:`"${e.replace(/"/g,'""')}"`}function Xe(t){return fe.isAbsolute(t)?fe.relative(process.cwd(),t)||".":t}function Ze(t){if(!t)return null;let e=t.operationPathTemplate;return typeof e=="string"&&e.length>0?e:null}function et(t){return Object.entries(t).sort((e,r)=>{let n=r[1]-e[1];return n!==0?n:e[0].localeCompare(r[0])})}function tt(t){let e=[],r=new Map;for(let n of t){let s=T({ruleId:n.ruleId,severity:n.severity,message:n.message,operationId:n.operationId,path:n.path,target:n.target,schemaPath:n.schemaPath}),i=r.get(s);if(i!==void 0){e[i].occurrences+=1;continue}r.set(s,e.length),e.push({finding:n,occurrences:1})}return e}function nt(t){let e=tt(t.findings).map(n=>({occurrences:n.occurrences,exchangeIndex:n.finding.exchangeIndex,ruleId:n.finding.ruleId,severity:n.finding.severity,category:n.finding.category,message:n.finding.message,operationId:n.finding.operationId,specSource:n.finding.specSource,target:n.finding.target,schemaPath:n.finding.schemaPath,dataPath:n.finding.dataPath,details:n.finding.details,method:n.finding.method,url:n.finding.url,path:n.finding.path,status:n.finding.status})),r={run:{id:t.runId,specSource:t.meta.specSource,trafficPath:t.meta.trafficPath,format:t.meta.format,matchMode:t.meta.matchMode,server:t.meta.server,totalExchanges:t.summary.totalExchanges,documentedExchanges:t.summary.documentedExchanges,undocumentedExchanges:t.summary.undocumentedExchanges,skippedExchanges:t.summary.skippedExchanges,findingsBySeverity:t.summary.findingsBySeverity,findingsByRule:t.summary.findingsByRule,totalProblems:t.summary.totalProblemGroups,durationMs:t.summary.durationMs},problems:e};return`${JSON.stringify(r,null,2)}
|
|
9
9
|
`}function rt(t){let e=["run_id","finding_id","exchange_index","severity","category","rule_id","message","method","path","url","status","operation_id","spec_source","target","schema_path","data_path"],r=t.findings.map(s=>[t.runId,s.id,s.exchangeIndex,s.severity,s.category,s.ruleId,s.message,s.method,s.path,s.url,s.status,s.operationId,s.specSource,s.target,s.schemaPath,s.dataPath]);return`${[e,...r].map(s=>s.map(Qe).join(",")).join(`
|
|
10
10
|
`)}
|
|
@@ -4,17 +4,17 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as O}from"./2U6O26CV.js";import{b as
|
|
7
|
+
import{a as O}from"./2U6O26CV.js";import{b as j,c as N,d as J,f as V,g as Q,h as Z,i as Y}from"./KPWZVETN.js";import{a as H}from"./WZXA5XPB.js";import{a as F,b as T,c as C,d as P,e as W,g as B,h as M,i as _,j as A,k as z,l as U,n as K}from"./UW4UC7ZI.js";var G=C.go,S=class extends F{constructor(){super(" ")}typeName(t){return d(t)}memberName(t){return d(t)}identifier(t){return P(t,{style:"camel",reserved:G})}identifiers(t,n){let r=new Set(n??[]);return t.map(o=>{let s=d(o),a=s;for(let i=2;r.has(a);i++)a=`${s}${i}`;return r.add(a),a})}packageName(t){let n=t.toLowerCase().replace(/[^a-z0-9]/g,"");return n===""||/^[0-9]/.test(n)?"client":n}string(t){let n='"';for(let r of t){let o=r.codePointAt(0);r==="\\"?n+="\\\\":r==='"'?n+='\\"':r===`
|
|
8
8
|
`?n+="\\n":r==="\r"?n+="\\r":r===" "?n+="\\t":o<32||o===127?n+=`\\x${o.toString(16).padStart(2,"0")}`:o>=55296&&o<=57343?n+="\\uFFFD":n+=r}return n+'"'}literal(t){return t==null?"nil":typeof t=="boolean"||typeof t=="number"?String(t):typeof t=="string"?this.string(t):Array.isArray(t)?`[]any{${t.map(r=>this.literal(r)).join(", ")}}`:`map[string]any{${Object.entries(t).map(([r,o])=>`${this.string(r)}: ${this.literal(o)}`).join(", ")}}`}comment(t){for(let n of U(t))this.line(n===""?"//":`// ${n}`);return this}doc(t,n){let r=U(n);if(r.length===0)return this;this.line(`// ${t} \u2014 ${r[0]}`);let o=!1;for(let s of r.slice(1)){if(s===""){o||this.line("//"),o=!0;continue}this.line(`// ${s}`),o=!1}return this}layout(t){return ie(le(t))}toString(){return this.layout(super.toString())}};function d(e){let t=P(e,{style:"pascal",reserved:G});return t.startsWith("_")?`N${t.slice(1)}`:t}function ie(e){return`${e.replace(/\n{3,}/g,`
|
|
9
9
|
|
|
10
10
|
`).trimEnd()}
|
|
11
11
|
`}function le(e){let t=e.split(`
|
|
12
12
|
`),n=[...t],r=/^(\t+)([A-Za-z_]\w*) (\S+)( `[^`]*`)?$/,o=/^(\t+)([A-Za-z_]\w*) (\S+) = (.+)$/,s=/^(\t+)("(?:[^"\\]|\\.)*":) (.+)$/,a=l=>{if(l.length<2)return;let m=[];for(let{parts:f}of l)f.forEach((g,b)=>{b<f.length-1&&(m[b]=Math.max(m[b]??0,g.length))});for(let{index:f,parts:g,indent:b}of l){let $=g.map((y,h)=>h<g.length-1?y.padEnd(m[h]??0):y);n[f]=b+$.join(" ").trimEnd()}},i=[],c;return t.forEach((l,m)=>{let f=s.exec(l),g=f===null?o.exec(l):null,b=f===null&&g===null?r.exec(l):null,$=b!==null&&!G.has(b[2])?b:null,y=f!==null?"entry":g!==null?"const":$!==null?"field":void 0;if((y===void 0||y!==c)&&(a(i),i=[],c=y),f!==null){i.push({index:m,indent:f[1],parts:[f[2],f[3]]});return}if(g!==null){i.push({index:m,indent:g[1],parts:[g[2],g[3],"=",g[4]]});return}if($!==null){let h=[$[2],$[3]];$[4]!==void 0&&h.push($[4].trimStart()),i.push({index:m,indent:$[1],parts:h})}}),a(i),n.join(`
|
|
13
|
-
`)}var u=new S,w=C.go;function X(e){if(e===void 0)return"client";if(!/^[a-z_][a-z0-9_]*$/.test(e)||w.has(e))throw new H(`goPackage "${e}" is not a valid Go package name: use lowercase letters, digits, and underscores, don't start with a digit, and avoid Go keywords.`);return e}function v(e){let t=new Set,n=[];for(let r of e.services)for(let o of r.operations){let s=d(o.name),a=2;for(;t.has(s);)s=`${d(o.name)}${a++}`;t.add(s),n.push({op:o,ident:s})}return n}function ce(e){return Q(e).map(n=>n.kind==="literal"?u.string(n.value):P(n.name,{style:"camel",reserved:w})).join(" + ")}function ee(e,t){let n=t.servers??[];if(n.length===0)return;let r=new Set;n.forEach((o,s)=>{let a=`${d(o.description??`server${s+1}`)}URL`;r.has(a)&&(a=`${a}${s+1}`),r.add(a);let i=o.variables.map(l=>`${P(l.name,{style:"camel",reserved:w})} string`),c=o.variables.map(l=>`${P(l.name,{style:"camel",reserved:w})} default: ${u.string(l.default)}`).join(", ");e.line(`// ${a} returns the ${u.string(o.description??o.url)} base URL${c===""?".":` (${c}).`}`),e.block(`func ${a}(${i.join(", ")}) string {`,()=>{e.line(`return ${ce(o)}`)},"}"),e.blank()})}function ne(e,t){let n=Z(e,t).map(r=>r.map(o=>o.kind==="apiKey"?`{Scheme: ${u.string(o.scheme)}, Kind: "apiKey", Name: ${u.string(o.name)}, In: ${u.string(o.in)}}`:`{Scheme: ${u.string(o.scheme)}, Kind: ${u.string(o.kind)}}`));if(n.length!==0)return`[][]SecuritySpec{${n.map(r=>`{${r.join(", ")}}`).join(", ")}}`}function te(e){return`&PaginationSpec{${[`Style: ${u.string(e.style)}`,...e.param!==void 0?[`Param: ${u.string(e.param)}`]:[],...e.nextCursor!==void 0?[`NextCursor: ${u.string(e.nextCursor)}`]:[],...e.hasMore!==void 0?[`HasMore: ${u.string(e.hasMore)}`]:[],...e.limitParam!==void 0?[`LimitParam: ${u.string(e.limitParam)}`]:[],...e.items!==void 0?[`Items: ${u.string(e.items)}`]:[]].join(", ")}}`}function p(e,t="string"){if(A(e)){let n=p(z(e),t);return n.startsWith("*")||n==="any"?n:`*${n}`}switch(e.kind){case"scalar":if(t==="Date"&&e.scalar==="string"){if(e.metadata?.format==="date-time")return"time.Time";if(e.metadata?.format==="date")return"Date"}return{string:"string",integer:"int64",number:"float64",boolean:"bool"}[e.scalar];case"array":return`[]${p(e.items,t)}`;case"record":return`map[string]${p(e.value,t)}`;case"ref":return d(e.name);case"literal":return typeof e.value=="string"?"string":typeof e.value=="boolean"?"bool":"float64";case"enum":return{string:"string",integer:"int64",number:"float64",boolean:"bool"}[e.scalar];case"omit":return d(e.base);case"union":case"null":case"object":case"intersection":case"unknown":return"any"}}function ue(e,t,n,r,o){e.doc(d(t),o),e.block(`type ${d(t)} struct {`,()=>{for(let s of n){let a=d(s.name),i=p(s.schema,r),c=`\`json:"${s.name}"\``;s.required||(!i.startsWith("*")&&!i.startsWith("[]")&&!i.startsWith("map[")&&i!=="any"&&(i=`*${i}`),c=`\`json:"${s.name},omitempty"\``),e.line(`${a} ${i} ${c}`)}},"}"),e.blank()}function L(e,t="string"){let n=new S;n.line("package client"),n.blank(),e.schemas.some(({schema:s})=>M(s,e)!==void 0)&&(n.line('import "encoding/json"'),n.blank());let o=fe(e,t);return t==="Date"&&o.includes("time.Time")&&(n.line('import "time"'),n.blank()),n.line(o),n.toString()}function fe(e,t){let n=new S;for(let{name:r,schema:o}of e.schemas){let s=K(o);if(s!==void 0){let i=s.scalar==="string"?"string":"int64";n.doc(d(r),o.description),n.line(`type ${d(r)} ${i}`),n.blank(),n.block("const (",()=>{let c=new Set;s.values.forEach(l=>{let m=T.pascal(String(l))||"Value",f="";for(let b=2;c.has(m+f);b++)f=String(b);c.add(m+f);let g=d(r)+m+f;n.line(`${g} ${d(r)} = ${u.literal(l)}`)})},")"),n.blank();continue}if(o.kind==="object"||o.kind==="intersection"){let i=_(o,e);if(i!==void 0){ue(n,r,i.properties,t,i.description??o.description);continue}}let a=M(o,e);if(a!==void 0){let i=d(r),c=a.cases.map(l=>`${l.value} -> ${d(l.schemaName)}`).join(", ");n.line(`// ${i} is a discriminated union ("${a.property}"): ${c}.`),n.line(`type ${i} = any`),n.blank(),n.line(`// Unmarshal${i} decodes into the member selected by "${a.property}".`),n.block(`func Unmarshal${i}(data []byte) (${i}, error) {`,()=>{n.block("var probe struct {",()=>{n.line(`Discriminant string \`json:"${a.property}"\``)},"}"),n.block("if err := json.Unmarshal(data, &probe); err != nil {",()=>{n.line("return nil, err")},"}"),n.line("switch probe.Discriminant {");for(let l of a.cases)n.block(`case ${u.string(l.value)}:`,()=>{n.line(`var value ${d(l.schemaName)}`),n.line("err := json.Unmarshal(data, &value)"),n.line("return value, err")});n.line("}"),n.line("var fallback any"),n.line("err := json.Unmarshal(data, &fallback)"),n.line("return fallback, err")},"}"),n.blank();continue}n.doc(d(r),o.description),n.line(`type ${d(r)} = ${p(o,t)}`),n.blank()}return n.toString()}function R(e,t){if(t==="string")return e;let n=e.startsWith("*")?`(${e})`:e;return t==="time.Time"?`${n}.Format(time.RFC3339)`:t==="Date"?`${n}.Format("2006-01-02")`:t==="int64"?`strconv.FormatInt(${e}, 10)`:t==="float64"?`strconv.FormatFloat(${e}, 'f', -1, 64)`:t==="bool"?`strconv.FormatBool(${e})`:`fmt.Sprint(${e})`}var de=["c","ctx","body","params","out","op"];function I(e,t){let n=W(e.pathParams.map(r=>r.name),{style:"camel",reserved:w,taken:de});return e.pathParams.map((r,o)=>({param:r,go:n[o],type:p(r.schema,t)}))}function me(e,t){let n=new Set;return(e.successResponseHeaders??[]).map(r=>{let o=d(r.name),s=o,a=2;for(;n.has(s);)s=`${o}${a++}`;n.add(s);let i=J(r.schema,t),c={integer:{goType:"*int64",helper:"headerInt64"},number:{goType:"*float64",helper:"headerFloat64"},boolean:{goType:"*bool",helper:"headerBool"},string:{goType:"*string",helper:"headerString"}}[i];return{field:s,name:r.name,...c}})}function E(e,t,n,r,o,s=!1){let a=I(t,r),i=t.queryParams.length>0,c=j(t),l=c===void 0?void 0:p(c,r),m=s?me(t,o):[];s&&(e.line(`// ${n}Headers carries the declared response headers of ${n}WithHeaders (nil when absent or unparsable).`),e.block(`type ${n}Headers struct {`,()=>{for(let h of m)e.line(`${h.field} ${h.goType}`)},"}"),e.blank());let f=["ctx context.Context",...a.map(({go:h,type:x})=>`${h} ${x}`),...t.requestBody?[`body ${p(t.requestBody.schema,r)}`]:[],...i?[`params *${n}Params`]:[]],g=N(t),b=s?l===void 0?`(${n}Headers, error)`:`(${l}, ${n}Headers, error)`:g!==void 0?"func(yield func(ServerSentEvent, error) bool)":l===void 0?"error":`(${l}, error)`,$=h=>s?l===void 0?`return headers, ${h}`:`return out, headers, ${h}`:l===void 0?`return ${h}`:`return out, ${h}`,y=s?`${n}WithHeaders`:n;e.doc(y,s?`Like ${n}, also returning the declared response headers.`:t.summary),e.block(`func (c *Client) ${y}(${f.join(", ")}) ${b} {`,()=>{g===void 0&&l!==void 0&&e.line(`var out ${l}`),s&&e.line(`var headers ${n}Headers`),e.line(`op := operations[${u.string(t.specName??t.name)}]`),e.line("authHeaders, query := resolveAuth(op.Security, c.config.Auth)"),i&&e.block("if params != nil {",()=>{for(let k of t.queryParams){let q=d(k.name);e.block(`if params.${q} != nil {`,()=>{if(k.schema.kind==="array"){let D=p(k.schema.items,r);e.block(`for _, item := range *params.${q} {`,()=>{e.line(`query.Add(${u.string(k.name)}, ${R("item",D)})`)},"}")}else e.line(`query.Set(${u.string(k.name)}, ${R(`*params.${q}`,p(k.schema,r))})`)},"}")}},"}");let h=a.map(({param:k,go:q,type:D})=>`${u.string(k.name)}: ${R(q,D)}`).join(", ");if(e.line(`requestURL := buildURL(c.config.ServerURL, op.Path, map[string]string{${h}})`),g!==void 0){e.block("open := func(extraHeaders map[string]string) (*http.Response, error) {",()=>{e.line("merged := map[string]string{}"),e.block("for key, value := range authHeaders {",()=>{e.line("merged[key] = value")},"}"),e.block("for key, value := range extraHeaders {",()=>{e.line("merged[key] = value")},"}"),e.line("return send(ctx, &c.config, requestSpec{OperationID: op.ID, Method: op.Method, URL: requestURL, Headers: merged, Query: query})")},"}"),e.line(`return iterSSE(open, ${g.schema!==void 0&&g.schema.kind!=="unknown"})`);return}let x=["OperationID: op.ID","Method: op.Method","URL: requestURL","Headers: authHeaders","Query: query"];if(t.requestBody&&V(t)?(e.line("contentType, reader, err := toMultipart(body)"),e.block("if err != nil {",()=>{e.line($("err"))},"}"),x.push("Body: reader"),x.push("ContentType: contentType")):t.requestBody&&(e.line("payload, err := json.Marshal(body)"),e.block("if err != nil {",()=>{e.line($("err"))},"}"),x.push("Body: bytes.NewReader(payload)"),x.push(`ContentType: ${u.string(t.requestBody.contentType)}`)),e.line(`resp, err := send(ctx, &c.config, requestSpec{${x.join(", ")}})`),e.block("if err != nil {",()=>{e.line($("err"))},"}"),e.block("if resp.StatusCode >= 400 {",()=>{e.line($("apiErrorFrom(resp, requestURL)"))},"}"),s){e.block(`if err := decodeJSON(resp, ${l===void 0?"nil":"&out"}); err != nil {`,()=>{e.line($("err"))},"}");for(let k of m)e.line(`headers.${k.field} = ${k.helper}(resp.Header, ${u.string(k.name)})`);e.line(l===void 0?"return headers, nil":"return out, headers, nil")}else l===void 0?e.line("return decodeJSON(resp, nil)"):(e.block("if err := decodeJSON(resp, &out); err != nil {",()=>{e.line("return out, err")},"}"),e.line("return out, nil"))},"}"),e.blank()}function re(e,t,n,r,o,s){let a=I(t,r),i=t.queryParams.length>0,c=["ctx context.Context",...a.map(({go:m,type:f})=>`${m} ${f}`),...i?[`params *${n}Params`]:[]].join(", "),l=()=>{e.line(`op := operations[${u.string(t.specName??t.name)}]`),e.line("base := url.Values{}"),i&&e.block("if params != nil {",()=>{for(let m of t.queryParams){let f=d(m.name);e.block(`if params.${f} != nil {`,()=>{e.line(`base.Set(${u.string(m.name)}, ${R(`*params.${f}`,p(m.schema,r))})`)},"}")}},"}"),e.block("call := func(pageParams url.Values) (any, *http.Response, error) {",()=>{e.line("authHeaders, query := resolveAuth(op.Security, c.config.Auth)"),e.block("for key, values := range pageParams {",()=>{e.block("for _, value := range values {",()=>{e.line("query.Set(key, value)")},"}")},"}");let m=a.map(({param:f,go:g,type:b})=>`${u.string(f.name)}: ${R(g,b)}`).join(", ");e.line(`requestURL := buildURL(c.config.ServerURL, op.Path, map[string]string{${m}})`),e.line("resp, err := send(ctx, &c.config, requestSpec{OperationID: op.ID, Method: op.Method, URL: requestURL, Headers: authHeaders, Query: query})"),e.block("if err != nil {",()=>{e.line("return nil, nil, err")},"}"),e.block("if resp.StatusCode >= 400 {",()=>{e.line("return nil, resp, apiErrorFrom(resp, requestURL)")},"}"),e.line("var raw any"),e.block("if err := decodeJSON(resp, &raw); err != nil {",()=>{e.line("return nil, resp, err")},"}"),e.line("return raw, resp, nil")},"}"),e.line("pages := iterPages(call, *op.Pagination, base)")};e.line(`// ${n}Pages iterates ${n} response pages; use with \`for page, err := range\`.`),e.block(`func (c *Client) ${n}Pages(${c}) func(yield func(${o}, error) bool) {`,()=>{l(),e.block(`return func(yield func(${o}, error) bool) {`,()=>{e.block("pages(func(raw any, err error) bool {",()=>{e.line(`var page ${o}`),e.block("if err == nil {",()=>{e.line("err = reencode(raw, &page)")},"}"),e.line("return yield(page, err)")},"})")},"}")},"}"),e.blank(),e.line(`// ${n}Items iterates the items of every ${n} page.`),e.block(`func (c *Client) ${n}Items(${c}) func(yield func(${s}, error) bool) {`,()=>{l(),e.block(`return func(yield func(${s}, error) bool) {`,()=>{e.block("pages(func(raw any, err error) bool {",()=>{e.block("if err != nil {",()=>{e.line(`var zero ${s}`),e.line("return yield(zero, err)")},"}"),e.line("pageItems, _ := resolvePointer(raw, op.Pagination.Items).([]any)"),e.block("for _, item := range pageItems {",()=>{e.line(`var typed ${s}`),e.block("if err := reencode(item, &typed); err != nil {",()=>{e.line("return yield(typed, err)")},"}"),e.block("if !yield(typed, nil) {",()=>{e.line("return false")},"}")},"}"),e.line("return true")},"})")},"}")},"}"),e.blank()}function oe(e){let t=e.split(`
|
|
13
|
+
`)}var u=new S,w=C.go;function X(e){if(e===void 0)return"client";if(!/^[a-z_][a-z0-9_]*$/.test(e)||w.has(e))throw new H(`goPackage "${e}" is not a valid Go package name: use lowercase letters, digits, and underscores, don't start with a digit, and avoid Go keywords.`);return e}function v(e){let t=new Set,n=[];for(let r of e.services)for(let o of r.operations){let s=d(o.name),a=2;for(;t.has(s);)s=`${d(o.name)}${a++}`;t.add(s),n.push({op:o,ident:s})}return n}function ce(e){return V(e).map(n=>n.kind==="literal"?u.string(n.value):P(n.name,{style:"camel",reserved:w})).join(" + ")}function ee(e,t){let n=t.servers??[];if(n.length===0)return;let r=new Set;n.forEach((o,s)=>{let a=`${d(o.description??`server${s+1}`)}URL`;r.has(a)&&(a=`${a}${s+1}`),r.add(a);let i=o.variables.map(l=>`${P(l.name,{style:"camel",reserved:w})} string`),c=o.variables.map(l=>`${P(l.name,{style:"camel",reserved:w})} default: ${u.string(l.default)}`).join(", ");e.line(`// ${a} returns the ${u.string(o.description??o.url)} base URL${c===""?".":` (${c}).`}`),e.block(`func ${a}(${i.join(", ")}) string {`,()=>{e.line(`return ${ce(o)}`)},"}"),e.blank()})}function ne(e,t){let n=Q(e,t).map(r=>r.map(o=>o.kind==="apiKey"?`{Scheme: ${u.string(o.scheme)}, Kind: "apiKey", Name: ${u.string(o.name)}, In: ${u.string(o.in)}}`:`{Scheme: ${u.string(o.scheme)}, Kind: ${u.string(o.kind)}}`));if(n.length!==0)return`[][]SecuritySpec{${n.map(r=>`{${r.join(", ")}}`).join(", ")}}`}function te(e){return`&PaginationSpec{${[`Style: ${u.string(e.style)}`,...e.param!==void 0?[`Param: ${u.string(e.param)}`]:[],...e.nextCursor!==void 0?[`NextCursor: ${u.string(e.nextCursor)}`]:[],...e.hasMore!==void 0?[`HasMore: ${u.string(e.hasMore)}`]:[],...e.limitParam!==void 0?[`LimitParam: ${u.string(e.limitParam)}`]:[],...e.items!==void 0?[`Items: ${u.string(e.items)}`]:[]].join(", ")}}`}function p(e,t="string"){if(_(e)){let n=p(A(e),t);return n.startsWith("*")||n==="any"?n:`*${n}`}switch(e.kind){case"scalar":if(t==="Date"&&e.scalar==="string"){if(e.metadata?.format==="date-time")return"time.Time";if(e.metadata?.format==="date")return"Date"}return{string:"string",integer:"int64",number:"float64",boolean:"bool"}[e.scalar];case"array":return`[]${p(e.items,t)}`;case"record":return`map[string]${p(e.value,t)}`;case"ref":return d(e.name);case"literal":return typeof e.value=="string"?"string":typeof e.value=="boolean"?"bool":"float64";case"enum":return{string:"string",integer:"int64",number:"float64",boolean:"bool"}[e.scalar];case"omit":return d(e.base);case"union":case"null":case"object":case"intersection":case"unknown":return"any"}}function ue(e,t,n,r,o){e.doc(d(t),o),e.block(`type ${d(t)} struct {`,()=>{for(let s of n){let a=d(s.name),i=p(s.schema,r),c=`\`json:"${s.name}"\``;s.required||(!i.startsWith("*")&&!i.startsWith("[]")&&!i.startsWith("map[")&&i!=="any"&&(i=`*${i}`),c=`\`json:"${s.name},omitempty"\``),e.line(`${a} ${i} ${c}`)}},"}"),e.blank()}function L(e,t="string"){let n=new S;n.line("package client"),n.blank(),e.schemas.some(({schema:s})=>M(s,e)!==void 0)&&(n.line('import "encoding/json"'),n.blank());let o=fe(e,t);return t==="Date"&&o.includes("time.Time")&&(n.line('import "time"'),n.blank()),n.line(o),n.toString()}function fe(e,t){let n=new S;for(let{name:r,schema:o}of e.schemas){let s=z(o);if(s!==void 0){let i=s.scalar==="string"?"string":"int64";n.doc(d(r),o.description),n.line(`type ${d(r)} ${i}`),n.blank(),n.block("const (",()=>{let c=new Set;s.values.forEach(l=>{let m=T.pascal(String(l))||"Value",f="";for(let b=2;c.has(m+f);b++)f=String(b);c.add(m+f);let g=d(r)+m+f;n.line(`${g} ${d(r)} = ${u.literal(l)}`)})},")"),n.blank();continue}if(o.kind==="object"||o.kind==="intersection"){let i=B(o,e);if(i!==void 0){ue(n,r,i.properties,t,i.description??o.description);continue}}let a=M(o,e);if(a!==void 0){let i=d(r),c=a.cases.map(l=>`${l.value} -> ${d(l.schemaName)}`).join(", ");n.line(`// ${i} is a discriminated union ("${a.property}"): ${c}.`),n.line(`type ${i} = any`),n.blank(),n.line(`// Unmarshal${i} decodes into the member selected by "${a.property}".`),n.block(`func Unmarshal${i}(data []byte) (${i}, error) {`,()=>{n.block("var probe struct {",()=>{n.line(`Discriminant string \`json:"${a.property}"\``)},"}"),n.block("if err := json.Unmarshal(data, &probe); err != nil {",()=>{n.line("return nil, err")},"}"),n.line("switch probe.Discriminant {");for(let l of a.cases)n.block(`case ${u.string(l.value)}:`,()=>{n.line(`var value ${d(l.schemaName)}`),n.line("err := json.Unmarshal(data, &value)"),n.line("return value, err")});n.line("}"),n.line("var fallback any"),n.line("err := json.Unmarshal(data, &fallback)"),n.line("return fallback, err")},"}"),n.blank();continue}n.doc(d(r),o.description),n.line(`type ${d(r)} = ${p(o,t)}`),n.blank()}return n.toString()}function R(e,t){if(t==="string")return e;let n=e.startsWith("*")?`(${e})`:e;return t==="time.Time"?`${n}.Format(time.RFC3339)`:t==="Date"?`${n}.Format("2006-01-02")`:t==="int64"?`strconv.FormatInt(${e}, 10)`:t==="float64"?`strconv.FormatFloat(${e}, 'f', -1, 64)`:t==="bool"?`strconv.FormatBool(${e})`:`fmt.Sprint(${e})`}var de=["c","ctx","body","params","out","op"];function I(e,t){let n=W(e.pathParams.map(r=>r.name),{style:"camel",reserved:w,taken:de});return e.pathParams.map((r,o)=>({param:r,go:n[o],type:p(r.schema,t)}))}function me(e,t){let n=new Set;return(e.successResponseHeaders??[]).map(r=>{let o=d(r.name),s=o,a=2;for(;n.has(s);)s=`${o}${a++}`;n.add(s);let i=K(r.schema,t),c={integer:{goType:"*int64",helper:"headerInt64"},number:{goType:"*float64",helper:"headerFloat64"},boolean:{goType:"*bool",helper:"headerBool"},string:{goType:"*string",helper:"headerString"}}[i];return{field:s,name:r.name,...c}})}function E(e,t,n,r,o,s=!1){let a=I(t,r),i=t.queryParams.length>0,c=j(t),l=c===void 0?void 0:p(c,r),m=s?me(t,o):[];s&&(e.line(`// ${n}Headers carries the declared response headers of ${n}WithHeaders (nil when absent or unparsable).`),e.block(`type ${n}Headers struct {`,()=>{for(let h of m)e.line(`${h.field} ${h.goType}`)},"}"),e.blank());let f=["ctx context.Context",...a.map(({go:h,type:x})=>`${h} ${x}`),...t.requestBody?[`body ${p(t.requestBody.schema,r)}`]:[],...i?[`params *${n}Params`]:[]],g=N(t),b=s?l===void 0?`(${n}Headers, error)`:`(${l}, ${n}Headers, error)`:g!==void 0?"func(yield func(ServerSentEvent, error) bool)":l===void 0?"error":`(${l}, error)`,$=h=>s?l===void 0?`return headers, ${h}`:`return out, headers, ${h}`:l===void 0?`return ${h}`:`return out, ${h}`,y=s?`${n}WithHeaders`:n;e.doc(y,s?`Like ${n}, also returning the declared response headers.`:t.summary),e.block(`func (c *Client) ${y}(${f.join(", ")}) ${b} {`,()=>{g===void 0&&l!==void 0&&e.line(`var out ${l}`),s&&e.line(`var headers ${n}Headers`),e.line(`op := operations[${u.string(t.specName??t.name)}]`),e.line("authHeaders, query := resolveAuth(op.Security, c.config.Auth)"),i&&e.block("if params != nil {",()=>{for(let k of t.queryParams){let q=d(k.name);e.block(`if params.${q} != nil {`,()=>{if(k.schema.kind==="array"){let D=p(k.schema.items,r);e.block(`for _, item := range *params.${q} {`,()=>{e.line(`query.Add(${u.string(k.name)}, ${R("item",D)})`)},"}")}else e.line(`query.Set(${u.string(k.name)}, ${R(`*params.${q}`,p(k.schema,r))})`)},"}")}},"}");let h=a.map(({param:k,go:q,type:D})=>`${u.string(k.name)}: ${R(q,D)}`).join(", ");if(e.line(`requestURL := buildURL(c.config.ServerURL, op.Path, map[string]string{${h}})`),g!==void 0){e.block("open := func(extraHeaders map[string]string) (*http.Response, error) {",()=>{e.line("merged := map[string]string{}"),e.block("for key, value := range authHeaders {",()=>{e.line("merged[key] = value")},"}"),e.block("for key, value := range extraHeaders {",()=>{e.line("merged[key] = value")},"}"),e.line("return send(ctx, &c.config, requestSpec{OperationID: op.ID, Method: op.Method, URL: requestURL, Headers: merged, Query: query})")},"}"),e.line(`return iterSSE(open, ${g.schema!==void 0&&g.schema.kind!=="unknown"})`);return}let x=["OperationID: op.ID","Method: op.Method","URL: requestURL","Headers: authHeaders","Query: query"];if(t.requestBody&&J(t)?(e.line("contentType, reader, err := toMultipart(body)"),e.block("if err != nil {",()=>{e.line($("err"))},"}"),x.push("Body: reader"),x.push("ContentType: contentType")):t.requestBody&&(e.line("payload, err := json.Marshal(body)"),e.block("if err != nil {",()=>{e.line($("err"))},"}"),x.push("Body: bytes.NewReader(payload)"),x.push(`ContentType: ${u.string(t.requestBody.contentType)}`)),e.line(`resp, err := send(ctx, &c.config, requestSpec{${x.join(", ")}})`),e.block("if err != nil {",()=>{e.line($("err"))},"}"),e.block("if resp.StatusCode >= 400 {",()=>{e.line($("apiErrorFrom(resp, requestURL)"))},"}"),s){e.block(`if err := decodeJSON(resp, ${l===void 0?"nil":"&out"}); err != nil {`,()=>{e.line($("err"))},"}");for(let k of m)e.line(`headers.${k.field} = ${k.helper}(resp.Header, ${u.string(k.name)})`);e.line(l===void 0?"return headers, nil":"return out, headers, nil")}else l===void 0?e.line("return decodeJSON(resp, nil)"):(e.block("if err := decodeJSON(resp, &out); err != nil {",()=>{e.line("return out, err")},"}"),e.line("return out, nil"))},"}"),e.blank()}function re(e,t,n,r,o,s){let a=I(t,r),i=t.queryParams.length>0,c=["ctx context.Context",...a.map(({go:m,type:f})=>`${m} ${f}`),...i?[`params *${n}Params`]:[]].join(", "),l=()=>{e.line(`op := operations[${u.string(t.specName??t.name)}]`),e.line("base := url.Values{}"),i&&e.block("if params != nil {",()=>{for(let m of t.queryParams){let f=d(m.name);e.block(`if params.${f} != nil {`,()=>{e.line(`base.Set(${u.string(m.name)}, ${R(`*params.${f}`,p(m.schema,r))})`)},"}")}},"}"),e.block("call := func(pageParams url.Values) (any, *http.Response, error) {",()=>{e.line("authHeaders, query := resolveAuth(op.Security, c.config.Auth)"),e.block("for key, values := range pageParams {",()=>{e.block("for _, value := range values {",()=>{e.line("query.Set(key, value)")},"}")},"}");let m=a.map(({param:f,go:g,type:b})=>`${u.string(f.name)}: ${R(g,b)}`).join(", ");e.line(`requestURL := buildURL(c.config.ServerURL, op.Path, map[string]string{${m}})`),e.line("resp, err := send(ctx, &c.config, requestSpec{OperationID: op.ID, Method: op.Method, URL: requestURL, Headers: authHeaders, Query: query})"),e.block("if err != nil {",()=>{e.line("return nil, nil, err")},"}"),e.block("if resp.StatusCode >= 400 {",()=>{e.line("return nil, resp, apiErrorFrom(resp, requestURL)")},"}"),e.line("var raw any"),e.block("if err := decodeJSON(resp, &raw); err != nil {",()=>{e.line("return nil, resp, err")},"}"),e.line("return raw, resp, nil")},"}"),e.line("pages := iterPages(call, *op.Pagination, base)")};e.line(`// ${n}Pages iterates ${n} response pages; use with \`for page, err := range\`.`),e.block(`func (c *Client) ${n}Pages(${c}) func(yield func(${o}, error) bool) {`,()=>{l(),e.block(`return func(yield func(${o}, error) bool) {`,()=>{e.block("pages(func(raw any, err error) bool {",()=>{e.line(`var page ${o}`),e.block("if err == nil {",()=>{e.line("err = reencode(raw, &page)")},"}"),e.line("return yield(page, err)")},"})")},"}")},"}"),e.blank(),e.line(`// ${n}Items iterates the items of every ${n} page.`),e.block(`func (c *Client) ${n}Items(${c}) func(yield func(${s}, error) bool) {`,()=>{l(),e.block(`return func(yield func(${s}, error) bool) {`,()=>{e.block("pages(func(raw any, err error) bool {",()=>{e.block("if err != nil {",()=>{e.line(`var zero ${s}`),e.line("return yield(zero, err)")},"}"),e.line("pageItems, _ := resolvePointer(raw, op.Pagination.Items).([]any)"),e.block("for _, item := range pageItems {",()=>{e.line(`var typed ${s}`),e.block("if err := reencode(item, &typed); err != nil {",()=>{e.line("return yield(typed, err)")},"}"),e.block("if !yield(typed, nil) {",()=>{e.line("return false")},"}")},"}"),e.line("return true")},"})")},"}")},"}"),e.blank()}function oe(e){let t=e.split(`
|
|
14
14
|
`),n=[],r=!1;for(let o of t)if(!o.startsWith("package ")){if(o.startsWith("import (")){r=!0;continue}if(r){o.startsWith(")")&&(r=!1);continue}o.startsWith("import ")||n.push(o)}return n.join(`
|
|
15
|
-
`).trim()}var se=["bytes","context","encoding/base64","encoding/json","errors","fmt","io","math/rand","mime/multipart","net/http","net/url","strconv","strings","time"];function ae(e,t,n,r,o,s){e.line(oe(L(t,r))),e.blank(),ee(e,t),s&&(e.line("// \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator go runtime) \u2500\u2500\u2500"),e.line(oe(O)),e.blank()),e.block("type operationMeta struct {",()=>{e.line("ID string"),e.line("Method string"),e.line("Path string"),e.line("Security [][]SecuritySpec"),e.line("Pagination *PaginationSpec")},"}"),e.blank(),e.block("var operations = map[string]operationMeta{",()=>{for(let{op:a,ident:i}of v(t)){let c=a.specName??a.name,l=ne(a,t),m=o.get(i),f=[`ID: ${u.string(c)}`,`Method: ${u.string(a.method.toUpperCase())}`,`Path: ${u.string(a.path)}`,...l!==void 0?[`Security: ${l}`]:[],...m!==void 0?[`Pagination: ${te(m)}`]:[]];e.line(`${u.string(c)}: {${f.join(", ")}},`)}},"}"),e.blank();for(let{op:a,ident:i}of v(t))a.queryParams.length!==0&&(e.block(`type ${i}Params struct {`,()=>{for(let c of a.queryParams){let l=p(c.schema,r);e.line(`${d(c.name)} ${l.startsWith("*")?l:`*${l}`}`)}},"}"),e.blank());e.doc("Client",`Client for ${t.title} (${t.version}).`),e.block("type Client struct {",()=>{e.line("config Config")},"}"),e.blank(),e.block("func New(config Config) *Client {",()=>{e.block('if config.ServerURL == "" {',()=>{e.line(`config.ServerURL = ${u.string(n.serverUrl??t.serverUrl??"")}`)},"}"),e.line("return &Client{config: config}")},"}"),e.blank();for(let{op:a,ident:i}of v(t)){E(e,a,i,r),N(a)===void 0&&(a.successResponseHeaders?.length??0)>0&&E(e,a,i,r,t,!0);let c=o.get(i);if(c===void 0)continue;let l=j(a),m=l===void 0?"any":p(l,r),f=
|
|
15
|
+
`).trim()}var se=["bytes","context","encoding/base64","encoding/json","errors","fmt","io","math/rand","mime/multipart","net/http","net/url","strconv","strings","time"];function ae(e,t,n,r,o,s){e.line(oe(L(t,r))),e.blank(),ee(e,t),s&&(e.line("// \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator go runtime) \u2500\u2500\u2500"),e.line(oe(O)),e.blank()),e.block("type operationMeta struct {",()=>{e.line("ID string"),e.line("Method string"),e.line("Path string"),e.line("Security [][]SecuritySpec"),e.line("Pagination *PaginationSpec")},"}"),e.blank(),e.block("var operations = map[string]operationMeta{",()=>{for(let{op:a,ident:i}of v(t)){let c=a.specName??a.name,l=ne(a,t),m=o.get(i),f=[`ID: ${u.string(c)}`,`Method: ${u.string(a.method.toUpperCase())}`,`Path: ${u.string(a.path)}`,...l!==void 0?[`Security: ${l}`]:[],...m!==void 0?[`Pagination: ${te(m)}`]:[]];e.line(`${u.string(c)}: {${f.join(", ")}},`)}},"}"),e.blank();for(let{op:a,ident:i}of v(t))a.queryParams.length!==0&&(e.block(`type ${i}Params struct {`,()=>{for(let c of a.queryParams){let l=p(c.schema,r);e.line(`${d(c.name)} ${l.startsWith("*")?l:`*${l}`}`)}},"}"),e.blank());e.doc("Client",`Client for ${t.title} (${t.version}).`),e.block("type Client struct {",()=>{e.line("config Config")},"}"),e.blank(),e.block("func New(config Config) *Client {",()=>{e.block('if config.ServerURL == "" {',()=>{e.line(`config.ServerURL = ${u.string(n.serverUrl??t.serverUrl??"")}`)},"}"),e.line("return &Client{config: config}")},"}"),e.blank();for(let{op:a,ident:i}of v(t)){E(e,a,i,r),N(a)===void 0&&(a.successResponseHeaders?.length??0)>0&&E(e,a,i,r,t,!0);let c=o.get(i);if(c===void 0)continue;let l=j(a),m=l===void 0?"any":p(l,r),f=Z(l,c.items,t);re(e,a,i,r,m,f===void 0?"any":p(f,r))}}var rn=({model:e,output:t,banner:n,emit:r,pagination:o})=>{let s=new S,a=r.dateType??"string",i=X(r.goPackage),c=new Map;for(let{op:$,ident:y}of v(e)){let h=o?.get($.name)?.spec;h!==void 0&&c.set(y,h)}s.line(`// Code generated by @redocly/client-generator (go) from "${e.title}" ${e.version}. DO NOT EDIT.`),s.line("// Regenerate with `redocly generate-client`. Standard library only \u2014 zero dependencies."),s.line(`package ${i}`),s.blank();let l=r.runtime!=="module",m=l?se:(()=>{let $=new S;ae($,e,r,a,c,!1);let y=$.toString();return se.filter(h=>new RegExp(`\\b${h.split("/").pop()}\\.`).test(y))})();s.block("import (",()=>{for(let $ of m)s.line(u.string($))},")"),s.blank(),ae(s,e,r,a,c,l);let f={path:t.path.replace(/\.[^.\\/]+$/,".go"),content:s.toString()};if(l)return[f];let g=n.map($=>`// ${$}`).join(`
|
|
16
16
|
`),b=O.replace(/^package .*$/m,`package ${i}`);return[f,{path:f.path.replace(/[^\\/]+$/,"runtime.go"),content:`${g}
|
|
17
17
|
${b.trimEnd()}
|
|
18
18
|
`}]};function ge(e,t){let n=t.emit.dateType??"string",r=t.emit.goPackage??"client",o=v(t.model).find(c=>c.op.name===e.name)?.ident??d(e.name),s=["ctx",...e.pathParams.map(c=>`"<${P(c.name,{style:"camel",reserved:w})}>"`),...e.requestBody?[`${p(e.requestBody.schema,n)}{ /* \u2026 */ }`]:[],...e.queryParams.length>0?["nil"]:[]],a=`client.${o}(${s.join(", ")})`,i=N(e)!==void 0?`stream := ${a}`:j(e)===void 0?`err := ${a}`:`result, err := ${a}`;return{lang:"go",label:"Go SDK",source:`client := ${r}.New(${r}.Config{})
|
|
19
19
|
${i}
|
|
20
|
-
`}}var on=({model:e,output:t,emit:n,pagination:r})=>[{path:t.path.replace(/\.[^.\\/]+$/,".go.md"),content:
|
|
20
|
+
`}}var on=({model:e,output:t,emit:n,pagination:r})=>[{path:t.path.replace(/\.[^.\\/]+$/,".go.md"),content:Y(e,{title:`${e.title} Go SDK reference`,frontmatter:n.docsFrontmatter===!0,language:{name:"go",label:"Go",fence:"go",requires:"The SDK needs the standard library only."},sample:o=>ge(o,{model:e,emit:n,outputPath:t.path}),paginated:new Set(r?.keys()??[])})}];export{p as a,L as b,rn as c,ge as d,on as e};
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a}from"./
|
|
7
|
+
import{a}from"./OYAP4QAE.js";import"./SN3OGJPW.js";import"./B6JQC3AM.js";import"./KPWZVETN.js";import"./DFVJG4OO.js";import"./WZXA5XPB.js";import"./L2EEGRZN.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as tanstackQueryGenerator};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{h as g}from"./B6JQC3AM.js";import{e as C,l as u,m as p}from"./KPWZVETN.js";import{c as j,d as v}from"./DFVJG4OO.js";import{X as b}from"./L2EEGRZN.js";import{a as S,b as k}from"./UW4UC7ZI.js";import{join as $}from"node:path";function h(r){return(r??"").replace(/\s+/g," ").trim().replace(/\\/g,"\\\\").replace(/\|/g,"\\|")}function w(r){return[r.group===void 0?void 0:u(r.group),r.name].filter(Boolean).join(" ")}function T(r,e){return[r,w(e),...e.positionals.map(o=>`<${o.name}>`),...e.flags.filter(o=>o.required).map(o=>`--${o.name} <${o.type}>`),...e.body?[e.body.required?"--json '<json>'":"[--json '<json>']"]:[]].filter(o=>o!=="").join(" ")}function B(r,e){r.line("| Flag | Type | Required | Description |"),r.line("| ---- | ---- | -------- | ----------- |");for(let n of e){let o=[h(n.description),n.enum===void 0?"":`One of ${n.enum.map(t=>`\`${t}\``).join(", ")}.`,n.type==="array"?"Repeat the flag for multiple values.":""].filter(t=>t!=="").join(" ");r.line(`| \`--${n.name}\` | ${n.type} | ${n.required?"yes":"no"} | ${o} |`)}r.blank()}function D(r,e,n){if(r.line(`### \`${w(e)}\``),r.blank(),e.summary!==void 0&&(r.line(h(e.summary)),r.blank()),r.line(`\`${e.method} ${e.path}\``),r.blank(),r.line("```sh"),r.line(T(n.name,e)),r.line("```"),r.blank(),e.positionals.length>0){r.line("| Argument | Description |"),r.line("| -------- | ----------- |");for(let t of e.positionals)r.line(`| \`<${t.name}>\` | ${h(t.description)} |`);r.blank()}e.flags.length>0&&B(r,e.flags);let o=[e.body===void 0?"":`Takes a JSON body${e.body.required?" (required)":""}: \`--json '<json>'\`, \`--json @file.json\`, or \`--json @-\` for stdin.`,e.unsupportedBody===void 0?"":`Takes a \`${e.unsupportedBody}\` body, which the CLI cannot build \u2014 call this operation through the generated client instead.`,e.paginated===!0?"Paginated: `--page-all` follows every page, printing one JSON page per line.":"",e.sse===!0?"Streams server-sent events as one JSON object per line.":"",e.blob===!0?"Returns binary content, so `--output <path>` is required.":""].filter(t=>t!=="");for(let t of o)r.line(t);o.length>0&&r.blank()}function R(r,e){let n=new S;e.frontmatter&&(n.line("---"),n.line(`title: ${e.title}`),n.line("---"),n.blank()),n.line(`# ${e.title}`),n.blank(),n.line(`Generated command-line reference for \`${e.name}\`, produced from the API description by \`redocly generate-client\`.`),n.line("Re-run generation to update it \u2014 this file is not hand-edited."),n.blank(),n.line("## Usage"),n.blank(),n.line("```sh"),n.line(`${e.name} <command> [flags]`),n.line(`${e.name} --help`),n.line(`${e.name} schema <command> # request/response schemas`),n.line("```"),n.blank(),n.line("Install the file under any `bin` name: the command takes that name, and the credential variables below do not change."),n.blank(),n.line("## Global flags"),n.blank(),n.line("| Flag | Description |"),n.line("| ---- | ----------- |");let o=e.schemes.some(i=>i.kind==="bearer");for(let[i,s]of[["--server-url <url>","Override the server URL included in the client."],["--format <json\\|ndjson>","Output format."],["--dry-run","Print the prepared request, credentials redacted, without sending it."],["--page-all","Follow pagination, printing one JSON page per line."],["--output <path>","Write the response body to a file. Required for binary responses."],...o?[["--token <token>","Bearer token, overriding the environment."]]:[],["--json <json\\|@file\\|@->","Request body, inline or from a file or stdin."]])n.line(`| \`${i}\` | ${s} |`);n.blank();let t=p(e.name);if(n.line("## Credentials"),n.blank(),e.schemes.length===0)n.line("The description declares no security schemes, so no credentials are read.");else{n.line("Credentials come from the environment:"),n.blank(),n.line("| Scheme | Variable |"),n.line("| ------ | -------- |");for(let i of e.schemes){let s=i.kind==="bearer"?`\`${t}_TOKEN\` (or \`--token\`)`:i.kind==="basic"?`\`${t}_USERNAME\` and \`${t}_PASSWORD\``:`\`${t}_API_KEY_${p(i.key)}\``;n.line(`| ${i.kind} (\`${i.key}\`) | ${s} |`)}}n.blank(),n.line("## Exit codes"),n.blank(),n.line("| Code | Meaning |"),n.line("| ---- | ------- |");for(let[i,s]of[[0,"success"],[1,"API error (status other than 401 or 403)"],[2,"auth error (401 or 403)"],[3,"validation error"],[4,"usage error (unknown command or flag, bad `--json`)"]])n.line(`| ${i} | ${s} |`);n.blank(),n.line("Errors print one JSON object to stderr, so stdout stays clean for piping."),n.blank();let a=[...new Set(r.map(i=>i.group))];for(let i of a){let s=r.filter(l=>l.group===i);i===void 0?(n.line("## Commands"),n.blank()):(n.line(`## ${i}`),n.blank(),n.line(`Addressed as \`${e.name} ${u(i)} <command>\`.`),n.blank());for(let l of s)D(n,l,e)}return n.toString().replace(/\n{3,}/g,`
|
|
8
|
+
|
|
9
|
+
`).trimEnd()+`
|
|
10
|
+
`}function x(){return v["cli.ts"]}function E(){return j["cli.ts"]}var q="// Generated by @redocly/client-generator \u2014 do not edit by hand.\n// Source: OpenAPI description. Re-run `redocly generate-client` to update.";function P(r){return k.snake(r).replace(/_/g,"-")}function O(r){let e=r.schema,n=e.kind==="array"?"array":e.kind==="scalar"&&(e.scalar==="integer"||e.scalar==="number")?"number":e.kind==="scalar"&&e.scalar==="boolean"?"boolean":"string";return{name:P(r.name),param:r.name,type:n,required:r.required,...e.kind==="enum"?{enum:e.values.map(String)}:{},...r.description!==void 0?{description:r.description}:{}}}function F(r){let e=r.successResponses;return e.some(n=>n.contentType.toLowerCase().includes("json"))?!1:e.some(n=>C(n.contentType))}function M(r){return r.successResponses.find(e=>e.contentType.toLowerCase().includes("json"))?.schema}function U(r,e,n){if(n!=="flat")return{};let o=g(r,e.schemas);return"mergeBody"in o&&o.mergeBody?{merged:!0}:{}}function _(r,e,n){return n!=="flat"?{}:"collisions"in g(r,e.schemas)?{argsStyle:"grouped"}:{}}function f(r,e){let n=[];for(let o of r.services)for(let t of o.operations){let a=t.requestBody?.contentType.toLowerCase().includes("json")?t.requestBody:void 0,i=M(t);n.push({...t.tags.length>0?{group:t.tags[0]}:{},name:t.name,...t.summary!==void 0?{summary:t.summary}:{},method:t.method.toUpperCase(),path:t.path,positionals:t.pathParams.map(s=>({name:s.name,type:O(s).type,...s.description!==void 0?{description:s.description}:{}})),flags:t.queryParams.map(O),...a?{body:{required:a.required,...U(t,r,e.argsStyle)}}:{},...a===void 0&&t.requestBody!==void 0?{unsupportedBody:t.requestBody.contentType}:{},...e.pagination?.has(t.name)===!0?{paginated:!0}:{},..._(t,r,e.argsStyle),...t.sse!==void 0?{sse:!0}:{},...F(t)?{blob:!0}:{},...a!==void 0||i!==void 0?{schemas:{...a?{request:a.schema}:{},...i!==void 0?{response:i}:{}}}:{}})}return n}var A=`function isProcessEntry(): boolean {
|
|
11
|
+
if (process.argv[1] === undefined) return false;
|
|
12
|
+
try {
|
|
13
|
+
return realpathSync(fileURLToPath(import.meta.url)) === realpathSync(process.argv[1]);
|
|
14
|
+
} catch {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (isProcessEntry()) {
|
|
19
|
+
process.exit(await run());
|
|
20
|
+
}`;function m(r,e){return JSON.stringify(r,null,e).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function y(r){return r.securitySchemes.map(e=>({key:e.key,kind:e.kind==="bearer"||e.kind==="basic"?e.kind:"apiKey"}))}function I(r){return r.group===void 0?`${r.name} (keeps the bare word, so the "${r.name}" group has no help page)`:`${r.name} (run it as "${u(r.group)} ${r.name}")`}function L(r){let e=new Set(r.filter(o=>o.group).map(o=>u(o.group))),n=r.filter(o=>e.has(o.name));n.length!==0&&b.warn(`generate-client: cli reads a leading group name as the group, so ${n.length} operation(s) named after a tag resolve unusually \u2014 rename the operation or the tag: ${n.map(I).join(", ")}.
|
|
21
|
+
`)}function N(r,e){let n=f(r,{pagination:e.pagination,argsStyle:e.argsStyle});L(n);let o=y(r),t=`./${e.stem}.${e.importExt}`,a=["client","configure",...e.zodSelected?["use"]:[]];return["#!/usr/bin/env node",q,`import { readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
22
|
+
import { fileURLToPath } from "node:url";`,[`import { ${a.join(", ")} } from "${t}";`,...e.zodSelected?[`import { zodValidation } from "./${e.stem}.zod.${e.importExt}";`]:[]].join(`
|
|
23
|
+
`),e.runtime==="module"?`import { invokedName, runCli, type CliCommand, type CliWiring } from "./runtime/cli.${e.importExt}";`:`// \u2500\u2500\u2500 Embedded cli engine (@redocly/client-generator) \u2500\u2500\u2500
|
|
24
|
+
`+x(),`export const COMMANDS: CliCommand[] = ${m(n,2)};`,...e.zodSelected?['use(zodValidation(process.argv.includes("--dry-run") ? { response: false } : {}));']:[],`export const wiring: CliWiring = {
|
|
25
|
+
name: invokedName(process.argv[1], ${m(e.stem)}),
|
|
26
|
+
envPrefix: ${m(p(e.stem))},
|
|
27
|
+
client,
|
|
28
|
+
${e.argsStyle==="flat"?` argsStyle: "flat",
|
|
29
|
+
`:""} configure,
|
|
30
|
+
schemes: ${m(o)},
|
|
31
|
+
env: process.env,
|
|
32
|
+
stdin: () => readFileSync(0, "utf-8"),
|
|
33
|
+
readFile: (path: string) => readFileSync(path, "utf-8"),
|
|
34
|
+
writeFile: (path: string, data: Uint8Array) => writeFileSync(path, data),
|
|
35
|
+
stdout: (line: string) => console.log(line),
|
|
36
|
+
stderr: (line: string) => console.error(line),
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/** Run this CLI programmatically; defaults to the process argv. */
|
|
40
|
+
export const run = (argv: string[] = process.argv.slice(2)): Promise<number> =>
|
|
41
|
+
runCli(COMMANDS, wiring, argv);
|
|
42
|
+
|
|
43
|
+
// Re-exported so a composed entry can run these commands without its own runtime copy.
|
|
44
|
+
export { runCli };
|
|
45
|
+
|
|
46
|
+
// Self-execute only as the process entry, so importing this module is side-effect-safe:
|
|
47
|
+
// composed binaries and login-style wrappers import COMMANDS/wiring/run instead of
|
|
48
|
+
// editing this generated file.
|
|
49
|
+
${A}`].join(`
|
|
50
|
+
|
|
51
|
+
`)+`
|
|
52
|
+
`}function Q(r,e){let n=p(e),o=new Map;r.forEach(({alias:s},l)=>{let c=s.replace(/[^A-Za-z0-9]/g,"_"),d=/^[A-Za-z_]/.test(c)?c:`_${c}`;o.set(s,[...o.values()].includes(d)?`${d}_${l}`:d)});let t=s=>o.get(s),a=r.map(({alias:s,modulePath:l},c)=>{let d=t(s);return`import { COMMANDS as ${d}Commands, wiring as ${d}Wiring${c===0?", runCli":""} } from ${JSON.stringify(l)};`}),i=r.map(({alias:s})=>{let l=t(s),c=P(s),d=`${n}_${p(s)}`;return` {
|
|
53
|
+
namespace: ${JSON.stringify(c)},
|
|
54
|
+
commands: ${l}Commands,
|
|
55
|
+
wiring: { ...${l}Wiring, envPrefix: ${JSON.stringify(d)} },
|
|
56
|
+
},`});return["#!/usr/bin/env node",q,['import { realpathSync } from "node:fs";','import { fileURLToPath } from "node:url";',...a].join(`
|
|
57
|
+
`),`/** The composed sources \u2014 import SOURCES to layer custom commands around this binary. */
|
|
58
|
+
export const SOURCES = [
|
|
59
|
+
${i.join(`
|
|
60
|
+
`)}
|
|
61
|
+
];
|
|
62
|
+
|
|
63
|
+
/** Run the composed CLI programmatically; defaults to the process argv. */
|
|
64
|
+
export const run = (argv: string[] = process.argv.slice(2)): Promise<number> =>
|
|
65
|
+
runCli(SOURCES, argv);
|
|
66
|
+
|
|
67
|
+
// Re-exported so a wrapper (a custom \`login\` command) can run these sources itself.
|
|
68
|
+
export { runCli };
|
|
69
|
+
|
|
70
|
+
${A}`].join(`
|
|
71
|
+
|
|
72
|
+
`)+`
|
|
73
|
+
`}var ie=({model:r,output:e,banner:n,emit:o,selected:t,pagination:a})=>{let i=N(r,{stem:e.stem,importExt:o.importExt??"js",zodSelected:t?.includes("zod")??!1,pagination:a,argsStyle:o.argsStyle??"grouped",runtime:o.runtime??"inline"}),s={path:$(e.dir,`${e.stem}.cli.ts`),content:i};if(o.runtime!=="module")return[s];let l=n.map(c=>`// ${c}`).join(`
|
|
74
|
+
`);return[s,{path:$(e.dir,"runtime","cli.ts"),content:`${l}
|
|
75
|
+
|
|
76
|
+
${E().trim()}
|
|
77
|
+
`}]},se=({model:r,output:e,emit:n,pagination:o})=>{let t=R(f(r,{pagination:o}),{title:`${r.title} command-line reference`,frontmatter:n.docsFrontmatter===!0,name:e.stem,schemes:y(r)});return[{path:$(e.dir,`${e.stem}.cli.md`),content:t}]};function ae(r,e){let n=f(e.model,{pagination:e.pagination}).find(t=>t.name===r.name);return n===void 0?void 0:{lang:"shell",label:"CLI",source:`npx tsx client.cli.ts ${["client",...n.group?[u(n.group)]:[],n.name,...n.positionals.map(t=>`<${t.name}>`),...n.flags.filter(t=>t.required).map(t=>`--${t.name} <${t.type}>`),...n.body?["--json '<json>'"]:[]].slice(1).join(" ")}
|
|
78
|
+
`}}export{Q as a,ie as b,se as c,ae as d};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as A,d as E,e as B,g as F,o as O,p as h}from"./
|
|
7
|
+
import{a as A,d as E,e as B,g as F,o as O,p as h}from"./K2PGWUA3.js";import{a as b}from"./HNVJYHEV.js";import{f as I}from"./CUB5GMHZ.js";import{O as P,P as v,Q as i,S as u,T as m,X as a,m as c,na as d}from"./L2EEGRZN.js";var y=class extends Error{};async function X({argv:t,version:e}){let n=performance.now(),s=new b,{organization:o,project:p,pushId:$,wait:g}=t,T=t.domain||F(),w=t["continue-on-deploy-failures"]||!1,U=t["start-time"]||Date.now(),S=[];try{let f=B(),R={domain:T,apiKey:f,organization:o,project:p,pushId:$,version:e,onSunsetWarning:l=>S.push(l)},x={...R,maxExecutionTime:t["max-execution-time"],retryIntervalMs:t["retry-interval"]?t["retry-interval"]*1e3:void 0,startTime:U},D=l=>j=>{let{status:C,url:z}=j.status[l].deploy;s.start(M({status:C,url:z,buildType:l,wait:g}))},r=g?await h({...x,buildType:"preview",onRetry:D("preview")}):await O(R);return W({buildType:"preview",spinner:s,push:r,continueOnDeployFailures:w}),L(r.status.preview.scorecard),g&&r.isMainBranch&&r.status.preview.deploy.status==="success"&&(r=await h({...x,buildType:"production",onRetry:D("production")})),r.isMainBranch&&(W({buildType:"production",spinner:s,push:r,continueOnDeployFailures:w}),L(r.status.production.scorecard)),K({organization:o,project:p,pushId:$,startedAt:n}),{preview:r.status.preview,production:r.isMainBranch?r.status.production:null,commit:r.commit}}catch(f){s.stop(),N("\u2717 Failed to get push status.",f)}finally{s.stop(),k("push-status",S)}}function N(t,e){throw e instanceof y?new d(e.message):e instanceof A?new d(`${t} Reason: ${e.message} (status: ${e.status})
|
|
8
8
|
`):new d(`${t} Reason: ${e.message}
|
|
9
9
|
`)}function k(t,e){let n=E(e);if(!n)return;let s='Update to the latest version by running "npm install @redocly/cli@latest".';n.isSunsetExpired?a.error(`The "${t}" command is not compatible with your version of Redocly CLI. ${s}
|
|
10
10
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{e as R}from"./KPWZVETN.js";import{a as T}from"./DFVJG4OO.js";import{a as x,e as P,f as v,i as H,j as C,k as l,l as M}from"./LD5MEXEL.js";import{n as N}from"./UW4UC7ZI.js";function y(e){let t=new Map(e.pathParams.map(r=>[r.name,r])),n=[];for(let r of e.path.matchAll(/\{([^{}]+)\}/g)){let s=t.get(r[1]);s!==void 0&&n.push(s)}return n}function I(e){let t=y(e),n=e.queryParams.length>0,r=!!e.requestBody,s=e.headerParams.length>0,o=e.cookieParams.length>0;return{hasQuery:n,hasBody:r,hasHeaders:s,hasCookies:o,hasInputs:t.length>0||n||r||s||o,varsRequired:t.length>0||e.queryParams.some(a=>a.required)||(e.requestBody?.required??!1)||e.headerParams.some(a=>a.required)||e.cookieParams.some(a=>a.required),variablesTypeName:`${l(e.name)}Variables`}}var E=" ";function $(e,t,n){let r=C(e,t);return r===void 0?[]:[`${n}/**`,...H(r).split(`
|
|
8
|
+
`).map(s=>`${n} * ${s}`.replace(/ +$/,"")),`${n} */`]}function O(e){return typeof e=="string"?JSON.stringify(e):String(e)}function F(e,t,n){switch(e){case"string":return t?.format==="binary"?"Blob":n==="Date"&&(t?.format==="date-time"||t?.format==="date")?"Date":"string";case"number":case"integer":return"number";case"boolean":return"boolean"}}function B(e){return e.kind==="union"||e.kind==="intersection"||e.kind==="enum"&&e.values.length>1}function c(e,t="string",n=""){switch(e.kind){case"scalar":return F(e.scalar,e.metadata,t);case"ref":return e.name;case"literal":return O(e.value);case"enum":return e.values.map(O).join(" | ");case"null":return"null";case"unknown":return"unknown";case"array":{let r=c(e.items,t,n);return B(e.items)?`(${r})[]`:`${r}[]`}case"record":return`Record<string, ${c(e.value,t,n)}>`;case"object":{if(e.properties.length===0)return"{}";let r=n+E;return`{
|
|
9
|
+
${e.properties.flatMap(o=>K(o,t,r)).join(`
|
|
10
|
+
`)}
|
|
11
|
+
${n}}`}case"union":return e.members.map(r=>{let s=c(r,t,n);return B(r)?`(${s})`:s}).join(" | ");case"intersection":return e.members.map(r=>{let s=c(r,t,n);return B(r)?`(${s})`:s}).join(" & ");case"omit":return`Omit<${e.base}, ${e.keys.map(r=>JSON.stringify(r)).join(" | ")}>`}}function K(e,t,n){let r=P(e.name),s=e.readOnly?"readonly ":"",o=e.required?"":"?",a=c(e.schema,t,n);return[...$(e.description,e.schema.metadata,n),`${n}${s}${r}${o}: ${a};`]}function U(e){let t=e.schema;return t.kind!=="enum"||t.scalar!=="string"?[]:t.values.every(n=>typeof n=="string"&&x(n))?[`export const ${e.name} = {`,...t.values.map((n,r)=>`${E}${n}: ${JSON.stringify(n)}${r===t.values.length-1?"":","}`),"} as const;"]:[]}function te(e,t="string"){let n=[];for(let r of e){let s=[...$(r.schema.description??r.description,r.schema.metadata,""),`export type ${r.name} = ${c(r.schema,t)};`];n.push(s.join(`
|
|
12
|
+
`));let o=U(r);o.length>0&&n.push(o.join(`
|
|
13
|
+
`))}return n.join(`
|
|
14
|
+
|
|
15
|
+
`)}function A(e){return e.contentType==="multipart/form-data"&&e.schema.kind==="object"}var W=" ";function z(e,t=[]){let n=N(e,{schemas:t});return n==="integer"?"number":n}function ce(e,t=[]){let n=D(e,t);if(n.length!==0)return n.map(r=>({name:r.name,key:r.key,type:r.type}))}function j(e,t=[],n=""){let r=n+W,s=D(e,t).map(o=>`${r}${o.key}${o.required===!0?"":"?"}: ${o.type};`);return s.length===0?"{}":`{
|
|
16
|
+
${s.join(`
|
|
17
|
+
`)}
|
|
18
|
+
${n}}`}function D(e,t){let n=new Set;return(e??[]).map(r=>({...r,key:v(M(r.name),n),type:z(r.schema,t)}))}var h=" ";function b(e,t,n=""){if(A(e))return c(e.schema,t,n);switch(e.contentType){case"multipart/form-data":return"FormData";case"application/x-www-form-urlencoded":return"URLSearchParams";case"application/octet-stream":return"Blob | ArrayBuffer";default:return c(e.schema,t,n)}}function p(e,t,n=""){let r=n+h,s=e.flatMap(o=>[...$(o.description,o.schema.metadata,r),`${r}${P(o.name)}${o.required?"":"?"}: ${c(o.schema,t,r)};`]);return s.length===0?"{}":`{
|
|
19
|
+
${s.join(`
|
|
20
|
+
`)}
|
|
21
|
+
${n}}`}function J(e,t,n=""){if(e.length===0)return{type:"void",kind:"void"};let r=e.find(i=>i.contentType.toLowerCase().includes("json"));if(r)return{type:c(r.schema,t,n),kind:"json"};let s=[],o=new Set,a=!1,u=!1;for(let i of e){let m;R(i.contentType)?(m="Blob",a=!0):i.contentType.startsWith("text/")?(m="string",u=!0):m=c(i.schema,t,n),!o.has(m)&&(o.add(m),s.push(m))}return{type:s.join(" | "),kind:a?"blob":u?"text":"json"}}function L(e,t,n=""){let r=new Set,s=[];for(let o of e){let a=c(o.schema,t,n);r.has(a)||(r.add(a),s.push(a))}return s}function G(e,t,n=""){let r=e.sse?.eventSchema;return r?c(r,t,n):"string"}function g(e,t,n,r,s,o){let a=s.has(t)?n():t;return`${o}${e}${r?"":"?"}: ${a};`}function X(e,t){let n=new Set,r=e;for(;r.kind==="ref";){let{name:s}=r;if(n.has(s))return;n.add(s);let o=t?.find(a=>a.name===s);if(o===void 0)return;r=o.schema}return r}function Q(e,t){let n=X(e,t);if(n?.kind==="object")return n.properties.map(s=>s.name);if(n?.kind!=="intersection")return;let r=new Set;for(let s of n.members){let o=Q(s,t);if(o===void 0)return;for(let a of o)r.add(a)}return[...r]}function Y(e,t){let n=[...y(e),...e.queryParams,...e.headerParams,...e.cookieParams],r=(e.requestBody?.required??!1)&&e.requestBody!==void 0?Q(e.requestBody.schema,t):void 0,s=r!==void 0,o=new Map;for(let u of n)o.set(u.name,(o.get(u.name)??0)+1);e.requestBody&&!s&&o.set("body",(o.get("body")??0)+1);for(let u of r??[])o.set(u,(o.get(u)??0)+1);let a=[...o].filter(([,u])=>u>1).map(([u])=>u);return a.length>0?{collisions:a}:{mergeBody:s}}function Z(e,t,n){return e.flatMap(r=>[...$(r.description,r.schema.metadata,n),`${n}${P(r.name)}${r.required?"":"?"}: ${c(r.schema,t.dateType,n)};`])}function V(e,t,n,r=""){let{dateType:s,schemaNames:o}=n,a=r+h,u=n.argsStyle==="flat"?Y(e,n.schemas):void 0;if(u!==void 0&&"mergeBody"in u)return _(e,t,n,u.mergeBody,r);let i=[],m=y(e);return m.length>0&&i.push(g("path",`${t}Path`,()=>p(m,s,a),!0,o,a)),e.queryParams.length>0&&i.push(g("query",`${t}Query`,()=>p(e.queryParams,s,a),e.queryParams.some(d=>d.required),o,a)),e.requestBody&&i.push(g("body",`${t}Body`,()=>b(e.requestBody,s,a),e.requestBody.required,o,a)),e.headerParams.length>0&&i.push(g("headers",`${t}Headers`,()=>p(e.headerParams,s,a),e.headerParams.some(d=>d.required),o,a)),e.cookieParams.length>0&&i.push(g("cookies",`${t}Cookies`,()=>p(e.cookieParams,s,a),e.cookieParams.some(d=>d.required),o,a)),i.length===0?"{}":`{
|
|
22
|
+
${i.join(`
|
|
23
|
+
`)}
|
|
24
|
+
${r}}`}function _(e,t,n,r,s){let o=s+h,a=Z([...y(e),...e.queryParams,...e.headerParams,...e.cookieParams],n,o);e.requestBody&&!r&&a.push(g("body",`${t}Body`,()=>b(e.requestBody,n.dateType,o),e.requestBody.required,n.schemaNames,o));let u=n.schemaNames.has(`${t}Body`)?b(e.requestBody,n.dateType,s):`${t}Body`,i=a.length===0?"{}":`{
|
|
25
|
+
${a.join(`
|
|
26
|
+
`)}
|
|
27
|
+
${s}}`;return r?a.length===0?u:`${i} & ${u}`:i}function S(e,t,n){let r=`${l(e.name)}Result`;return t.schemaNames.has(r)?J(e.successResponses,t.dateType,n).type:r}function ee(e,t,n){let r=L(e.errorResponses,t.dateType,n);if(r.length===0)return"unknown";let s=`${l(e.name)}Error`;return t.schemaNames.has(s)?r.join(" | "):s}function $e(e,t,n){let r=T(e.services);if(r.length===0)return"";let s=r.flatMap(o=>{let a=t.get(o.name),u=l(o.name),i=h+h,m=V(o,u,n,i),d=o.sse!==void 0,q=d?G(o,n.dateType,i):n.errorMode==="result"?`Result<${S(o,n,i)}, ${ee(o,n,i)}>`:S(o,n,i),f=[`${i}args: ${m};`,`${i}result: ${q};`];n.errorMode==="result"&&!d&&f.push(`${i}mode: "result";`);let k=o.successResponseHeaders;k&&k.length>0&&f.push(`${i}headers: ${j(k,n.schemas,i)};`);let w=n.pagination?.get(o.name);return w&&(f.push(`${i}item: ${c(w.itemSchema,n.dateType,i)};`),n.errorMode==="result"&&f.push(`${i}page: ${S(o,n,i)};`)),d&&f.push(`${i}kind: "sse";`),[`${h}${a}: {`,...f,`${h}};`]});return[...$("Per-operation `args`/`result` shapes (plus `kind: 'sse'` for event streams) \u2014 the\ntype-level companion of `OPERATIONS` that gives `createClient<Ops>` its typed methods.",void 0,""),"export type Ops = {",...s,"};"].join(`
|
|
28
|
+
`)}function ge(e,t){let{dateType:n,schemaNames:r}=t,s=l(e.name),o=e.sse!==void 0,{hasInputs:a}=I(e),u=[];if(!o){let d=`${s}Result`;if(r.has(d)||u.push(`export type ${d} = ${J(e.successResponses,n).type};`),t.errorMode==="result"){let q=L(e.errorResponses,n),f=`${s}Error`;q.length>0&&!r.has(f)&&u.push(`export type ${f} = ${q.join(" | ")};`)}}let i=y(e);i.length>0&&!r.has(`${s}Path`)&&u.push(`export type ${s}Path = ${p(i,n)};`),e.queryParams.length>0&&!r.has(`${s}Query`)&&u.push(`export type ${s}Query = ${p(e.queryParams,n)};`),e.requestBody&&!r.has(`${s}Body`)&&u.push(`export type ${s}Body = ${b(e.requestBody,n)};`),e.headerParams.length>0&&!r.has(`${s}Headers`)&&u.push(`export type ${s}Headers = ${p(e.headerParams,n)};`);let m=e.successResponseHeaders;return m&&m.length>0&&!r.has(`${s}ResponseHeaders`)&&u.push(`export type ${s}ResponseHeaders = ${j(m,t.schemas)};`),e.cookieParams.length>0&&!r.has(`${s}Cookies`)&&u.push(`export type ${s}Cookies = ${p(e.cookieParams,n)};`),a&&!r.has(`${s}Variables`)&&u.push(`export type ${s}Variables = ${V(e,s,t)};`),u.join(`
|
|
29
|
+
|
|
30
|
+
`)}function Pe(e,t){let n=new Set,r=s=>{switch(s.kind){case"ref":n.add(s.name);return;case"omit":n.add(s.base);return;case"array":r(s.items);return;case"record":r(s.value);return;case"object":for(let o of s.properties)r(o.schema);return;case"union":case"intersection":for(let o of s.members)r(o);return;default:return}};for(let s of T(e.services)){for(let a of[...s.pathParams,...s.queryParams,...s.headerParams,...s.cookieParams])r(a.schema);s.requestBody&&r(s.requestBody.schema);for(let a of s.successResponses)r(a.schema),a.itemSchema&&r(a.itemSchema);if(t.errorMode==="result")for(let a of s.errorResponses)r(a.schema);let o=t.pagination?.get(s.name);o&&r(o.itemSchema)}return[...n].filter(s=>t.schemaNames.has(s)).sort()}export{I as a,A as b,ce as c,$ as d,c as e,te as f,J as g,Y as h,$e as i,ge as j,Pe as k};
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a}from"./
|
|
7
|
+
import{a}from"./DE4ZFTDG.js";import"./SN3OGJPW.js";import"./B6JQC3AM.js";import"./KPWZVETN.js";import"./DFVJG4OO.js";import"./WZXA5XPB.js";import"./L2EEGRZN.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as swrGenerator};
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a}from"./
|
|
7
|
+
import{a}from"./OA5XCUEZ.js";import"./KPWZVETN.js";import"./DFVJG4OO.js";import"./WZXA5XPB.js";import"./L2EEGRZN.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as mockGenerator};
|