@redocly/cli 2.71.0 → 2.71.2
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 +3 -3
- package/lib/chunks/{V6VNRABV.js → 2TG3DP4I.js} +1 -1
- package/lib/chunks/{BU4AMVHN.js → 2ZEKFWJQ.js} +1 -1
- package/lib/chunks/{LS3G7CUH.js → 3EQNI6CT.js} +1 -1
- package/lib/chunks/{TXSBWL3Y.js → 3FR3456Q.js} +1 -1
- package/lib/chunks/{VXD5O25A.js → 3VOQMXIZ.js} +1 -1
- package/lib/chunks/4H3DPQDW.js +7 -0
- package/lib/chunks/4S6LRPCX.js +20 -0
- package/lib/chunks/{QB6CQ2CV.js → 5AVTCY6F.js} +1 -1
- package/lib/chunks/{JCP37EY3.js → 5CR6AOLY.js} +59 -25
- package/lib/chunks/{G2M6SQCS.js → 5HPO77VR.js} +2 -2
- package/lib/chunks/6X42UQ3O.js +20 -0
- package/lib/chunks/{QTGTCBFK.js → 7GADNOVY.js} +1 -1
- package/lib/chunks/{SXIMN47K.js → 7JS7JGWP.js} +1 -1
- package/lib/chunks/{EH6VW7JO.js → ADACRYTN.js} +1 -1
- package/lib/chunks/{PF43QQZA.js → AXGFQS75.js} +2 -2
- package/lib/chunks/{BCRM4BTA.js → AZ5LIJEO.js} +1 -1
- package/lib/chunks/{QMS4UKIK.js → BH4FA7AH.js} +5 -5
- package/lib/chunks/{MQUZ5IJ2.js → BIS2ZFGS.js} +1 -1
- package/lib/chunks/{IULINGO6.js → BOTTA3HA.js} +1 -1
- package/lib/chunks/{L4F2ERUL.js → BPJTNQBC.js} +1 -1
- package/lib/chunks/CER2D6ZD.js +20 -0
- package/lib/chunks/{NZE22F7Q.js → CR5TYFBN.js} +2 -2
- package/lib/chunks/{NCDX4IGX.js → CRJEY7P3.js} +1 -1
- package/lib/chunks/CZX7WE2R.js +7 -0
- package/lib/chunks/{EFB2YVY2.js → DM4EUYBB.js} +2 -2
- package/lib/chunks/{NBMSBQEL.js → DWXDCKZ7.js} +1 -1
- package/lib/chunks/DZT5NLUB.js +22 -0
- package/lib/chunks/{STAMDB3P.js → EHJ3FMW6.js} +1 -1
- package/lib/chunks/{O37B7ABT.js → FAFMGLT6.js} +1 -1
- package/lib/chunks/{YDQCJP4F.js → FDKY4PGX.js} +1 -1
- package/lib/chunks/FRQHCFKP.js +199 -0
- package/lib/chunks/{SBHCUK5I.js → GFSMOHUE.js} +1 -1
- package/lib/chunks/{YUEIHUPX.js → HMYFTLS7.js} +1 -1
- package/lib/chunks/{LNEXTJNF.js → HP7UD4BA.js} +1 -1
- package/lib/chunks/{YLRH4RVF.js → HRZLSSOF.js} +2 -2
- package/lib/chunks/{TR67FYLT.js → HTFKP5HH.js} +1 -1
- package/lib/chunks/{E3FBSKNS.js → I4TK6NG7.js} +1 -1
- package/lib/chunks/{VJHJJBVN.js → IQLQH23V.js} +1 -1
- package/lib/chunks/{DHP4BBTH.js → J2EPFEBO.js} +1 -1
- package/lib/chunks/{RIGQPR2I.js → JO76DPXR.js} +1 -1
- package/lib/chunks/{2UAA6O26.js → JOUEVI3E.js} +1 -1
- package/lib/chunks/{B5KSRXXW.js → JRVXIEVC.js} +1 -1
- package/lib/chunks/{MV3ZJ5HR.js → JZATGVUO.js} +5 -5
- package/lib/chunks/KFQC57GK.js +145 -0
- package/lib/chunks/{N37OGNC4.js → KJNBOXDI.js} +3 -3
- package/lib/chunks/{CN2ZOHYL.js → KLGUZBJO.js} +1 -1
- package/lib/chunks/KNMNSDHR.js +7 -0
- package/lib/chunks/{3DMXMP4K.js → L325HIGK.js} +1 -1
- package/lib/chunks/{MT4W54PL.js → LET2MPMU.js} +1 -1
- package/lib/chunks/{2CMKIFTE.js → LKNL5LEV.js} +1 -1
- package/lib/chunks/LY6BDOEF.js +7 -0
- package/lib/chunks/MJ2NI6MR.js +20 -0
- package/lib/chunks/N4GCIKY4.js +8 -0
- package/lib/chunks/NXREEI2S.js +98 -0
- package/lib/chunks/{6TE6AFQ3.js → OFIQ2EST.js} +1 -1
- package/lib/chunks/{CZS2ZXJ7.js → ORWIUECT.js} +1 -1
- package/lib/chunks/{T55LQK2H.js → P5T6BIKW.js} +1 -1
- package/lib/chunks/{2NVGTELR.js → QTSECOQB.js} +1 -1
- package/lib/chunks/{HHCU6T2V.js → QXBSAWH3.js} +1 -1
- package/lib/chunks/{EHQY7ZOF.js → QXXAC25O.js} +1 -1
- package/lib/chunks/{LD5MEXEL.js → R32HBYOH.js} +1 -1
- package/lib/chunks/SSEMMWPY.js +7 -0
- package/lib/chunks/T77BOGYV.js +14 -0
- package/lib/chunks/{QAPQYNI3.js → TH44RKLO.js} +1 -1
- package/lib/chunks/{FKKC7G6X.js → U2F3JOT2.js} +1 -1
- package/lib/chunks/{P7LM57HK.js → U4MI7HDM.js} +1 -1
- package/lib/chunks/{MYSYBBIO.js → UTEOWLD5.js} +1 -1
- package/lib/chunks/{B3GE7EIX.js → UVKUPD4U.js} +1 -1
- package/lib/chunks/{HAOBCQWB.js → VJZDR6KS.js} +84 -20
- package/lib/chunks/VPTYPV6P.js +7 -0
- package/lib/chunks/{E4MPGN3Z.js → W7TN2XCW.js} +1 -1
- package/lib/chunks/{2R2CXBRH.js → WO6IIVA3.js} +1 -1
- package/lib/chunks/{RLJVKAOL.js → XQEXWC5L.js} +1 -1
- package/lib/chunks/{YDGFDJ2K.js → XVS7B4RZ.js} +1 -1
- package/lib/chunks/{5ECOOGVW.js → YF4FMOTE.js} +1 -1
- package/lib/chunks/{WKDC6LN3.js → YWRFPTTI.js} +1 -1
- package/lib/chunks/{MYOQDPQZ.js → Z6GFQV2Y.js} +1 -1
- package/lib/chunks/{O6NMXFEP.js → ZXOX7NF2.js} +1 -1
- 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 +1 -1
- 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 +7 -2
- 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 +17 -9
- package/lib/eject-assets/generators/mock/index.ts +4 -3
- package/lib/eject-assets/generators/mock/render.ts +128 -9
- package/lib/eject-assets/generators/mock/sample.ts +87 -4
- 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 +10 -1
- package/lib/eject-assets/generators/php/index.ts +2 -2
- package/lib/eject-assets/generators/php/models.ts +8 -3
- package/lib/eject-assets/generators/php/naming.ts +1 -1
- package/lib/eject-assets/generators/php/operations.ts +11 -6
- package/lib/eject-assets/generators/php/pagination.ts +3 -2
- package/lib/eject-assets/generators/php/types.ts +12 -2
- 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 +3 -3
- package/lib/eject-assets/generators/python/models.ts +9 -3
- package/lib/eject-assets/generators/python/naming.ts +1 -1
- package/lib/eject-assets/generators/python/operations.ts +6 -5
- 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 +6 -5
- package/lib/eject-assets/generators/transformers/index.ts +2 -2
- package/lib/eject-assets/generators/transformers/render.ts +34 -7
- 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 +1 -1
- 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/go-generator/SKILL.md +3 -0
- package/lib/eject-assets/skills/mock-generator/SKILL.md +22 -0
- package/lib/eject-assets/skills/php-generator/SKILL.md +9 -2
- package/lib/eject-assets/skills/python-generator/SKILL.md +6 -0
- package/lib/eject-assets/skills/tanstack-query-generator/SKILL.md +2 -1
- package/lib/eject-assets/skills/transformers-generator/SKILL.md +4 -0
- package/lib/eject-assets/skills/typescript-generator/SKILL.md +5 -0
- package/lib/index.js +5 -5
- package/lib/skills/redocly-cli/SKILL.md +20 -1
- package/package.json +1 -1
- package/lib/chunks/2Y7MGFQS.js +0 -105
- package/lib/chunks/BPDHBW3N.js +0 -7
- package/lib/chunks/EWU57NBY.js +0 -20
- package/lib/chunks/GKXY6U4S.js +0 -145
- package/lib/chunks/GMGZQR6Q.js +0 -7
- package/lib/chunks/JM7BMZLD.js +0 -13
- package/lib/chunks/K6VR5YNF.js +0 -22
- package/lib/chunks/LRMOPAZ4.js +0 -8
- package/lib/chunks/M6UVHV6D.js +0 -7
- package/lib/chunks/O72R3AD4.js +0 -20
- package/lib/chunks/RZ3FGCBT.js +0 -20
- package/lib/chunks/SBT63VHF.js +0 -7
- package/lib/chunks/UW4UC7ZI.js +0 -9
- package/lib/chunks/VQRJE4I2.js +0 -7
- package/lib/chunks/WACZWFKN.js +0 -19
- package/lib/chunks/WBWCX3LS.js +0 -199
- package/lib/chunks/WJXIZZA6.js +0 -7
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -340,7 +340,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
340
340
|
BSD-3-Clause
|
|
341
341
|
|
|
342
342
|
Packages:
|
|
343
|
-
fast-uri@3.1.
|
|
343
|
+
fast-uri@3.1.9 — Copyright (c) 2011-2021, Gary Court until https://github.com/garycourt/uri-js/commit/a1acf730b4bba3f1097c9f52e7d9d3aba8cdcaae
|
|
344
344
|
source-map@0.6.1 — Copyright (c) 2009-2011, Mozilla Foundation and contributors
|
|
345
345
|
|
|
346
346
|
License text:
|
|
@@ -495,9 +495,9 @@ Packages:
|
|
|
495
495
|
supports-color@7.2.0
|
|
496
496
|
ulid@2.4.0 — Copyright (c) 2017 Alizain Feerasta
|
|
497
497
|
ulid@3.0.2 — Copyright (c) 2017 Alizain Feerasta
|
|
498
|
-
undici@7.30.
|
|
498
|
+
undici@7.30.1 — Copyright (c) Matteo Collina and Undici contributors
|
|
499
499
|
yargs@17.0.1 — Copyright 2010 James Halliday (mail@substack.net); Modified work Copyright 2014 Contributors (ben@npmjs.com)
|
|
500
|
-
zod@4.
|
|
500
|
+
zod@4.6.7 — Copyright (c) 2025 Colin McDonnell
|
|
501
501
|
|
|
502
502
|
License text:
|
|
503
503
|
(no license text found)
|
|
@@ -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 $,g as xt,h as et}from"./
|
|
7
|
+
import{a as $,g as xt,h as et}from"./YWRFPTTI.js";import{a as wt}from"./64G5RPLP.js";import{b as lt,f as ut,m as gt,n as ht,s as yt}from"./BH4FA7AH.js";import{$ as v,S as Z,Y as D,Z as G,_ as k,b as N,c as M,d as it,fa as T,g as at,ha as tt,i as U,la as w,na as ft,q as E,sa as ct,ta as mt,v as pt}from"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import*as Nt from"node:path";import{performance as jt}from"node:perf_hooks";import*as Ot from"node:path";function dt(t,e){xt(t,o=>{if(E(o)&&et(o.$ref)){let r=Ot.basename(o.$ref);o.$ref=o.$ref.replace(r,e+"_"+r)}else if(M(o.discriminator)&&M(o.discriminator.mapping)){let{mapping:r}=o.discriminator;for(let i of Object.keys(r)){let c=r[i];typeof c=="string"&&et(c)&&(r[i]=c.split("/").map((O,s,p)=>p.length-1===s&&!O.startsWith(e+"_")?e+"_"+O:O).join("/"))}}})}function j(t,e,o){if(!e)return"";if(!t)throw new w("Info section is not found in specification.");if(!t[e])throw new w(`${k(`prefix-${o}-with-info-prop`)} argument value is not found in info section.`);if(!at(t[e]))throw new w(`${k(`prefix-${o}-with-info-prop`)} argument value should be string.`);if(t[e].length>50)throw new w(`${k(`prefix-${o}-with-info-prop`)} argument value length should not exceed 50 characters.`);return t[e].replaceAll(/\s/g,"_")}function ot(t,e){return e?t?.map(o=>{let r={};for(let[i,c]of Object.entries(o))Object.assign(r,{[e+"_"+i]:c});return r}):t}function C(t,e){return e?e+"_"+t:t}import*as Pt from"node:path";function H(t,e){return t.replace(/"(#\/components\/.*?)"/g,o=>{let r=Pt.basename(o);return o.replace(r,C(r,e))})}function B(t){return t.map(e=>({name:e}))}import*as q from"node:path";function bt(t){return q.basename(t,q.extname(t))}function vt(t){return Object.entries(t).filter(([e,o])=>o.length>1)}function rt(t,e){for(let[o,r]of e)T.warn(`Conflict on ${t} : ${D(o)} in files: ${v(r)}
|
|
8
8
|
`)}function Tt(t){T.info(G(`
|
|
9
9
|
${t} conflict(s) on tags.
|
|
10
10
|
Suggestion: please use ${v("prefix-tags-with-filename")}, ${v("prefix-tags-with-info-prop")} or ${v("without-x-tag-groups")} to prevent naming conflicts.
|
|
@@ -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 P,b as y,c as $}from"./
|
|
7
|
+
import{a as P,b as y,c as $}from"./XQEXWC5L.js";import{fa as h,wa as x}from"./FRQHCFKP.js";function N(t){let e=t.trim(),n=e.match(/^```(?:ya?ml|json)?\s*\n([\s\S]*?)\n```$/);return n?n[1]:e}async function O(t,e){let r=(await x({source:t,config:e})).filter(o=>o.severity==="error");if(r.length>0){let o=r.slice(0,5).map(s=>`${s.ruleId}: ${s.message}`).join("; ");throw new Error(`the result has ${r.length} validation problem(s): ${o}`)}}import{spawn as T}from"node:child_process";import{mkdtemp as v}from"node:fs/promises";import{tmpdir as R}from"node:os";import S from"node:path";var I=3e5,a=class extends Error{},C;function L(){return C??=v(S.join(R(),"redocly-ai-")),C}async function w(t,e,n,r){let o=await L();return new Promise((s,u)=>{let i=T(t,e,{stdio:["pipe","pipe","pipe"],cwd:o,env:{...process.env,...r}}),l="",f="",g=!1,d=setTimeout(()=>{g=!0,i.kill("SIGKILL")},I);i.stdout.on("data",c=>{l+=c.toString()}),i.stderr.on("data",c=>{f+=c.toString()}),i.on("error",c=>{if(clearTimeout(d),c.code==="ENOENT"){u(new a(`Could not find the "${t}" CLI on PATH. Is it installed?`));return}u(c)}),i.on("close",c=>{if(clearTimeout(d),g){u(new Error(`The "${t}" CLI did not respond within ${I/1e3} seconds.`));return}s({stdout:l,stderr:f,code:c})}),i.stdin.on("error",()=>{}),i.stdin.end(n)})}async function A(t){let e=["-p","--output-format","text","--tools","","--strict-mcp-config","--setting-sources","","--no-session-persistence","--append-system-prompt",t.system];t.model&&e.push("--model",t.model);let{stdout:n,stderr:r,code:o}=await w("claude",e,t.user,{CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC:"1"});if(o!==0)throw new Error(`claude CLI exited with code ${o}: ${r.trim()||n.trim()}`);if(!n.trim())throw new Error("claude CLI returned no output.");return{text:n}}async function b(t){let e=["exec","--skip-git-repo-check","--sandbox","read-only","-c","mcp_servers={}","-c","project_doc_max_bytes=0"];t.model&&e.push("--model",t.model),e.push("-");let n=`${t.system}
|
|
8
8
|
|
|
9
9
|
${t.user}`,{stdout:r,stderr:o,code:s}=await w("codex",e,n);if(s!==0)throw new Error(`codex CLI exited with code ${s}: ${o.trim()||r.trim()}`);if(!r.trim())throw new Error("codex CLI returned no output.");return{text:r}}async function _(t){let e=["-p","--output-format","text","--trust"];t.model&&e.push("--model",t.model);let n=`${t.system}
|
|
10
10
|
|
|
@@ -4,6 +4,6 @@ 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{b as m,j as C,o as a,p,q as T,r as l,s as h,t as f,u as d}from"./
|
|
7
|
+
import{b as m,j as C,o as a,p,q as T,r as l,s as h,t as f,u as d}from"./N4GCIKY4.js";import{c as g}from"./FRQHCFKP.js";import A from"node:path";function L(e,n){if(C(e)!=="application/x-www-form-urlencoded"||!Array.isArray(n))return;let o=new URLSearchParams;for(let s of n){if(!g(s))continue;let t=a(s.name);t!==void 0&&o.append(t,a(s.value)??"")}return o.size>0?o.toString():void 0}function K(e,n,o){let s=e?.request,t=e?.response;if(!s)return null;let r=s?.postData,i=a(r?.mimeType),u=r?.text??L(i,r?.params),c=a(r?.encoding),y=t?.content?.text,S=a(t?.content?.encoding),q=p(t?.status);return l({method:a(s?.method),url:a(s?.url),requestHeaders:s?.headers,requestBody:T(u,c),requestContentType:i,responseStatus:q===0?void 0:q,responseStatusText:a(t?.statusText),responseHeaders:t?.headers,responseBody:T(y,S),responseContentType:a(t?.content?.mimeType),startedAt:a(e?.startedDateTime),raw:e},n,o)}var b=class{id="har";canParse(n,o){if(A.extname(n).toLowerCase()===".har")return!0;let t=o.toLowerCase();return t.includes('"log"')&&t.includes('"entries"')}async*parse(n){let o=0;for await(let s of f(n,"log.entries")){let t=K(s,o,n);t&&(yield t),o+=1}}};import $ from"node:path";function H(e){let n=a(e.url??e.uri);if(n)return{url:n};let o=a(e.host??e.headers?.host),s=a(e.path??e.request_uri),t=a(e.scheme??e.forwarded_proto);return o&&s?{url:`${t??"http"}://${o}${s}`,schemeKnown:!!t}:{url:s,schemeKnown:!!t}}function z(e,n,o){let s=e?.request??e?.req??e?.http?.request;if(!s)return null;let t=e?.response??e?.res??e?.http?.response,r=t?.body??t?.raw_body??t?.payload??t?.data,i=s?.body??s?.raw_body??s?.payload??s?.data,{url:u,schemeKnown:c}=H(s);return l({method:a(s?.method??s?.http_method),url:u,schemeKnown:c,requestHeaders:s?.headers,requestBody:i,requestContentType:d(s?.headers),responseStatus:p(t?.status??t?.statusCode),responseHeaders:t?.headers,responseBody:r,responseContentType:d(t?.headers),startedAt:a(e?.started_at??e?.startedAt??e?.timestamp),raw:e},n,o)}var x=class{id="kong";canParse(n,o){if($.extname(n).toLowerCase()===".kong")return!0;let t=o.toLowerCase();return t.includes('"latencies"')||t.includes('"request"')&&t.includes('"response"')&&t.includes('"route"')}async*parse(n){let o=(await m(n,16)).trim().slice(0,1),s=0;if(o==="["){for await(let t of f(n)){let r=z(t,s,n);r&&(yield r),s+=1}return}for await(let t of h(n)){let r=z(t,s,n);r&&(yield r),s+=1}}};import R from"node:path";function U(e){return e?.request??e?.req??e?.httpRequest??e?.http?.request??e}function I(e){return e?.response??e?.res??e?.httpResponse??e?.http?.response}function O(e,n){let o=a(n?.url??n?.uri??n?.requestUrl??e?.url);if(o)return{url:o};let s=a(n?.host??n?.headers?.host??e?.host),t=a(n?.path??e?.path??n?.pathname),r=a(n?.scheme??e?.scheme);return s&&t?{url:`${r??"http"}://${s}${t}`,schemeKnown:!!r}:{url:t,schemeKnown:!!r}}function k(e,n,o){let s=U(e),t=I(e),r=s?.body??s?.bodyText??s?.payload??s?.data??s?.rawBody,i=t?.body??t?.bodyText??t?.payload??t?.data??t?.rawBody,{url:u,schemeKnown:c}=O(e,s);return l({method:a(s?.method??s?.httpMethod??e?.method??e?.httpMethod),url:u,schemeKnown:c,requestHeaders:s?.headers,requestBody:r,requestContentType:d(s?.headers),responseStatus:p(t?.status??t?.statusCode??e?.status??e?.statusCode),responseHeaders:t?.headers,responseBody:i,responseContentType:d(t?.headers),startedAt:a(e?.startedAt??e?.timestamp??e?.time),raw:e},n,o)}var w=class{id="ndjson";canParse(n,o){let s=R.extname(n).toLowerCase();if(s===".ndjson"||s===".jsonl"||s===".jsonlines")return!0;let t=o.lastIndexOf(`
|
|
8
8
|
`),i=(t===-1?o:o.slice(0,t)).split(`
|
|
9
9
|
`).map(u=>u.trim()).find(Boolean);if(!i?.startsWith("{")||!i.endsWith("}"))return!1;try{return JSON.parse(i),!0}catch{return!1}}async*parse(n){let o=0;for await(let s of h(n)){let t=k(s,o,n);t&&(yield t),o+=1}}};import J from"node:path";function P(e){if(!e)return{};let n=e.trim().split(/\s+/);return n.length<2?{}:{method:n[0],path:n[1],protocol:n[2]}}function W(e,n){let o=a(n?.url??n?.request_uri??n?.uri??e?.url??e?.request_url??e?.absolute_uri),s=P(a(e?.request??n?.request_line)),t=a(n?.request_uri??n?.uri??n?.path??e?.request_uri??e?.uri)??s.path;if(o?.startsWith("http://")||o?.startsWith("https://"))return{url:o};let r=a(n?.host??n?.headers?.host??e?.host??e?.http_host??e?.server_name??e?.vhost),i=a(e?.scheme??n?.scheme??e?.request_scheme),u=!!i;if(r&&(o||t)){let c=i??"http",y=o??t;return y?.startsWith("/")?{url:`${c}://${r}${y}`,schemeKnown:u}:{url:`${c}://${r}/${y}`,schemeKnown:u}}return{url:o??t,schemeKnown:u}}function E(e,n,o){let s=g(e?.request)?e.request:e,t=g(e?.response)?e.response:void 0,r=P(a(e?.request)),i=a(s?.method??s?.request_method??e?.request_method??e?.method)??r.method,{url:u,schemeKnown:c}=W(e,s);return l({method:i,url:u,schemeKnown:c,requestHeaders:s?.headers??s?.request_headers??e?.request_headers??e?.headers,requestBody:s?.body??s?.request_body??e?.request_body??e?.body,requestContentType:d(s?.headers??s?.request_headers??e?.request_headers),responseStatus:p(t?.status??t?.status_code??e?.status??e?.status_code??e?.response_status),responseHeaders:t?.headers??t?.response_headers??e?.response_headers??e?.headers_out,responseBody:t?.body??t?.response_body??e?.response_body,responseContentType:d(t?.headers??t?.response_headers??e?.response_headers),startedAt:a(e?.time_iso8601??e?.timestamp??e?.time??e?.time_local??e?.["@timestamp"]),raw:e},n,o)}async function*j(e){if((await m(e,16)).trim().slice(0,1)==="["){yield*f(e);return}for await(let o of h(e))yield o}var N=class{id="nginx-json";canParse(n,o){let s=J.extname(n).toLowerCase(),t=n.toLowerCase();if(s===".ndjson"&&t.includes("nginx"))return!0;let r=o.toLowerCase();return r.includes('"request_uri"')||r.includes('"time_iso8601"')||r.includes('"upstream_response_time"')||r.includes('"remote_addr"')}async*parse(n){let o=0;for await(let s of j(n)){let t=E(s,o,n);t&&(yield t),o+=1}}},_=class{id="apache-json";canParse(n,o){let s=J.extname(n).toLowerCase(),t=n.toLowerCase();if(s===".ndjson"&&t.includes("apache"))return!0;let r=o.toLowerCase();return r.includes('"request_method"')||r.includes('"request_uri"')||r.includes('"vhost"')||r.includes('"response_status"')}async*parse(n){let o=0;for await(let s of j(n)){let t=E(s,o,n);t&&(yield t),o+=1}}};var B=[new b,new x,new N,new _,new w];async function le(e,n){if(n!=="auto"){let s=B.find(t=>t.id===n);if(!s)throw new Error(`Unsupported parser format: ${n}`);return s}let o=await m(e);return B.find(s=>s.canParse(e,o))}export{le as a};
|
|
@@ -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"./T77BOGYV.js";import"./R32HBYOH.js";import"./DM4EUYBB.js";import"./5CR6AOLY.js";import"./WZXA5XPB.js";import"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as transformersGenerator};
|
|
@@ -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 as ee,c as te,e as ne}from"./RFWIIJFG.js";var F=te((N,k)=>{(function(e,t){typeof N=="object"&&typeof k<"u"?t(N):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.ULID={}))})(N,(function(e){"use strict";function t(r){let c=new Error(r);return c.source="ulid",c}let n="0123456789ABCDEFGHJKMNPQRSTVWXYZ",o=n.length,i=Math.pow(2,48)-1,a=10,u=16;function m(r,c,s){return c>r.length-1?r:r.substr(0,c)+s+r.substr(c+1)}function p(r){let c,s=r.length,d,l,g=o-1;for(;!c&&s-->=0;){if(d=r[s],l=n.indexOf(d),l===-1)throw t("incorrectly encoded string");if(l===g){r=m(r,s,n[0]);continue}c=m(r,s,n[l+1])}if(typeof c=="string")return c;throw t("cannot increment this string")}function f(r){let c=Math.floor(r()*o);return c===o&&(c=o-1),n.charAt(c)}function v(r,c){if(isNaN(r))throw new Error(r+" must be a number");if(r>i)throw t("cannot encode time greater than "+i);if(r<0)throw t("time must be positive");if(Number.isInteger(Number(r))===!1)throw t("time must be an integer");let s,d="";for(;c>0;c--)s=r%o,d=n.charAt(s)+d,r=(r-s)/o;return d}function y(r,c){let s="";for(;r>0;r--)s=f(c)+s;return s}function E(r){if(r.length!==a+u)throw t("malformed ulid");var c=r.substr(0,a).split("").reverse().reduce((s,d,l)=>{let g=n.indexOf(d);if(g===-1)throw t("invalid character found: "+d);return s+=g*Math.pow(o,l)},0);if(c>i)throw t("malformed ulid, timestamp too large");return c}function I(r=!1,c){c||(c=typeof window<"u"?window:null);let s=c&&(c.crypto||c.msCrypto);if(s)return()=>{let d=new Uint8Array(1);return s.getRandomValues(d),d[0]/255};try{let d=ee("crypto");return()=>d.randomBytes(1).readUInt8()/255}catch{}if(r){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return()=>Math.random()}throw t("secure crypto unusable, insecure Math.random not allowed")}function j(r){return r||(r=I()),function(s){return isNaN(s)&&(s=Date.now()),v(s,a)+y(u,r)}}function R(r){r||(r=I());let c=0,s;return function(l){if(isNaN(l)&&(l=Date.now()),l<=c){let A=s=p(s);return v(c,a)+A}c=l;let g=s=y(u,r);return v(l,a)+g}}let M=j();e.decodeTime=E,e.detectPrng=I,e.encodeRandom=y,e.encodeTime=v,e.factory=j,e.incrementBase32=p,e.monotonicFactory=R,e.randomChar=f,e.replaceCharAt=m,e.ulid=M}))});var $={name:"@redocly/cli",version:"2.71.0",description:"",license:"MIT",bin:{redocly:"bin/cli.js",openapi:"bin/cli.js"},type:"module",engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{build:"node ./scripts/build.mjs","prepare:publish-dir":"node ./scripts/prepare-publish-dir.mjs","clean:publish-dir":`node -e "require('fs').rmSync('.publish', {recursive:true, force:true})"`},publishConfig:{directory:".publish"},repository:{type:"git",url:"git+https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["linter","OpenAPI","Swagger","OpenAPI linter","Swagger linter","AsyncAPI linter","Arazzo linter","oas"],contributors:["Roman Hotsiy <roman@redocly.com> (https://redocly.com/)"],devDependencies:{"@modelcontextprotocol/sdk":"^1.32.1","@opentelemetry/exporter-trace-otlp-http":"0.219.0","@opentelemetry/resources":"2.8.0","@opentelemetry/sdk-trace-node":"2.8.0","@opentelemetry/semantic-conventions":"1.41.1","@redocly/cli-otel":"0.3.7","@redocly/client-generator":"0.7.11","@redocly/openapi-core":"2.71.0","@redocly/recheck":"2.71.0","@redocly/respect-core":"2.71.0","@redocly/reunite-integration":"2.71.0","@types/cookie":"0.6.0","@types/har-format":"^1.2.16","@types/react":"^17.0.0 || ^18.2.21 || ^19.2.16","@types/react-dom":"^17.0.0 || ^18.2.7 || ^19.2.3","@types/semver":"^7.5.0","@types/set-cookie-parser":"2.4.10","@types/yargs":"17.0.32",colorette:"^1.2.0",cookie:"^0.7.2",dotenv:"16.4.7",esbuild:"^0.28.0",glob:"^13.0.5",handlebars:"^4.7.10",react:"^18.3.0 || ^19.2.7","react-dom":"^18.3.0 || ^19.2.7","react-router":"^7.18.4",redoc:"3.0.1",semver:"^7.5.2","set-cookie-parser":"^2.3.5","styled-components":"6.4.2",typescript:"6.0.2",ulid:"^3.0.1",undici:"^7.30.0",yargs:"17.0.1"}};var{version:we,name:De,engines:Te}=$,Ue=$.devDependencies.redoc;var re="https://otel.cloud.redocly.com",Re=process.env.OTEL_TRACES_URL||`${re}/v1/traces`,Me=6e3,Oe="redocly-cli-anonymous-id";var Z=ne(F(),1),ie=Object.defineProperty,ce=(e,t)=>{for(var n in t)ie(e,n,{get:t[n],enumerable:!0})},se={};ce(se,{CLOUD_EVENT_STANDARD_KEYS:()=>X,mapToCloudEvent:()=>ae});var X=["id","specversion","object","datacontenttype","type","time","origin","env","category","signal","source","subject","subjects","data","actor","requestId","clientIp","organizationId","organizationSlug","projectId","projectSlug","osPlatform","userAgent","sessionId"];function ae(e){let{type:t,data:n,actor:o,requestId:i,clientIp:a,origin:u,env:m,source:p,organizationId:f,organizationSlug:v,projectId:y,projectSlug:E,category:I="product",signal:j="log",osPlatform:R,userAgent:M,sessionId:r}=e,c=!!(n&&Array.isArray(n)),s=o?{id:o.id??`ann_${(0,Z.ulid)()}`,object:o.object??"user",uri:o.uri??""}:null,d=`evt_${(0,Z.ulid)()}`.toLowerCase(),l=new Date,g=p??s?.uri??null,A={...f!==void 0&&{organizationId:f},...v!==void 0&&{organizationSlug:v},...y!==void 0&&{projectId:y},...E!==void 0&&{projectSlug:E}},O={specversion:"1.0",object:"event",datacontenttype:"application/json; charset=utf-8",origin:u,env:m,category:I,signal:j,osPlatform:R,userAgent:M,clientIp:a,sessionId:r};if(c){let _=n,Y=_.map(S=>({id:S.id??"",object:S.object??"",uri:S.uri??""})),Q=_[0]?.id??null;Object.assign(O,{...A,id:d,type:t,time:l,source:g,actor:s,subject:Q,subjects:Y,data:_,requestId:i??""})}else{let _=(Array.isArray(n)?n[0]:n)?.id??null;Object.assign(O,{...A,id:d,type:t,time:l,source:g,actor:s,subject:_,requestId:i??"",data:n,...p!=null&&{request:{source:p}}})}return O}function T(e){return e.replace(/([A-Z])/g,"_$1").toLowerCase()}function L(e){return e!=null}function x(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function G(e,t,n,o=!0,i){let a=i?.length?new Set(i):null;for(let[u,m]of Object.entries(e))if(!a?.has(u)&&m!==void 0){let p=o?T(u):u;n[`${t}${p}`]=m}}function w(e,t,n,o){let i=o?.currentDepth??0,a=o?.useSnakeCase??!0,u=o?.maxNestingLevels??3,m=t.endsWith(".")?t.slice(0,-1):t;for(let[p,f]of Object.entries(e)){if(!L(f))continue;let v=a?T(p):p,y=`${m}.${v}`;typeof f=="object"&&!Array.isArray(f)?i<u&&w(f,y,n,{currentDepth:i+1,useSnakeCase:a,maxNestingLevels:u}):x(f)&&(n[y]=f)}}var V="context",P=[V];function q(e){let t={updated:[],notUpdated:[]};for(let n of e){if(!n||typeof n!="object")continue;let o=n.object;if(typeof o!="string")continue;let i=n,a=t.notUpdated.find(u=>u.object===o);a?(t.updated=[a,i],t.notUpdated=t.notUpdated.filter(u=>u.object!==o)):t.updated.some(u=>u.object===o)||t.notUpdated.push(i)}return t}function D(e,t,n){let o=n?`${n}.`:"",i=t===""?"":`${T(t)}.`;return`${e}.${o}${i}`}function H(e,t){let n=e[V];return n==="before"||n==="after"?n:t===0?"after":"before"}function B(e){let{[V]:t,...n}=e;return n}function z(e){return e.endsWith(".")?e:`${e}.`}function ue(e,t,n){let o=t instanceof Date?t.toISOString():new Date(t).toISOString();return{"cloudevents.event_id":e.id,"cloudevents.event_type":e.type,"cloudevents.event_source":e.source??void 0,"cloudevents.event_spec_version":e.specversion,"cloudevents.event_data_content_type":e.datacontenttype??"application/json; charset=utf-8","cloudevents.event_time":o,"cloudevents.event_subject":e.subject??"","cloudevents.event_version":n?.version,"cloudevents.event_origin":e.origin??n?.serviceName,"cloudevents.event_env":e.env,"cloudevents.event_client_ip":e.clientIp,"cloudevents.event_object":e.object||"event","cloudevents.event_category":e.category,"cloudevents.event_signal":e.signal,"cloudevents.event_actor.id":e.actor?.id??void 0,"cloudevents.event_actor.object":e.actor?.object??void 0,"cloudevents.event_actor.uri":e.actor?.uri??void 0,"cloudevents.event_organization_id":e.organizationId,"cloudevents.event_organization_slug":e.organizationSlug,"cloudevents.event_project_id":e.projectId,"cloudevents.event_project_slug":e.projectSlug,"cloudevents.event_request_id":e.requestId,"cloudevents.event_os_platform":e.osPlatform,"cloudevents.event_user_agent":e.userAgent,"cloudevents.event_session_id":e.sessionId}}function $e(e,t,n){let o=e.data,i={...ue(e,t,n)};return de(o,i),ve(e,i),ye(e,i),i}function de(e,t){!e||typeof e!="object"||(Array.isArray(e)?le(e,t):me(e,t))}function le(e,t){e.some(n=>n&&typeof n=="object"&&typeof n.object=="string")?fe(e,t):pe(e,t)}function fe(e,t){let n=q(e);n.updated.forEach((o,i)=>{let a=D("cloudevents.event_data",o.object,H(o,i));w(B(o),z(a),t)}),n.notUpdated.forEach(o=>{let i=D("cloudevents.event_data",o.object,void 0);w(B(o),z(i),t)})}function pe(e,t){for(let n of e)!n||typeof n!="object"||w(n,"cloudevents.event_data.",t)}function me(e,t){for(let[n,o]of Object.entries(e)){if(!L(o))continue;let i=T(n);if(typeof o=="object"&&!Array.isArray(o))for(let[a,u]of Object.entries(o))L(u)&&x(u)&&(t[`cloudevents.event_data.${i}.${a}`]=u);else x(o)&&(t[`cloudevents.event_data.${i}`]=o)}}function ve(e,t){if(!e.subjects||!Array.isArray(e.subjects))return;let n=q(e.subjects);n.updated.forEach((o,i)=>{let a=D("cloudevents.event_subjects",o.object,H(o,i));G(o,a,t,!1,P)}),n.notUpdated.forEach(o=>{let i=D("cloudevents.event_subjects",o.object,void 0);G(o,i,t,!1,P)})}function ye(e,t){for(let[n,o]of Object.entries(e))if(!(X.includes(n)||o===void 0))if(o instanceof Object)for(let[i,a]of Object.entries(o))a!==void 0&&(t[`cloudevents.${n}.${i}`]=a);else t[`cloudevents.${n}`]=o}import U from"node:crypto";var J="0123456789ABCDEFGHJKMNPQRSTVWXYZ",C=32;var ge=16,K=10,W=0xffffffffffff;var b;(function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"})(b||(b={}));var h=class extends Error{constructor(t,n){super(`${n} (${t})`),this.name="ULIDError",this.code=t}};function be(e){let t=Math.floor(e()*C)%C;return J.charAt(t)}function he(e){let t=Ie(),n=t&&(t.crypto||t.msCrypto)||(typeof U<"u"?U:null);if(typeof n?.getRandomValues=="function")return()=>{let o=new Uint8Array(1);return n.getRandomValues(o),o[0]/256};if(typeof n?.randomBytes=="function")return()=>n.randomBytes(1).readUInt8()/256;if(U?.randomBytes)return()=>U.randomBytes(1).readUInt8()/256;throw new h(b.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Ie(){return je()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function _e(e,t){let n="";for(;e>0;e--)n=be(t)+n;return n}function Ee(e,t=K){if(isNaN(e))throw new h(b.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>W)throw new h(b.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${W}: ${e}`);if(e<0)throw new h(b.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new h(b.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let n,o="";for(let i=t;i>0;i--)n=e%C,o=J.charAt(n)+o,e=(e-n)/C;return o}function je(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function xe(e,t){let n=t||he(),o=!e||isNaN(e)?Date.now():e;return Ee(o,K)+_e(ge,n)}export{we as a,De as b,Te as c,Ue as d,re as e,Re as f,Me as g,Oe as h,se as i,$e as j,xe as k};
|
|
7
|
+
import{a as ee,c as te,e as ne}from"./RFWIIJFG.js";var F=te((N,k)=>{(function(e,t){typeof N=="object"&&typeof k<"u"?t(N):typeof define=="function"&&define.amd?define(["exports"],t):(e=typeof globalThis<"u"?globalThis:e||self,t(e.ULID={}))})(N,(function(e){"use strict";function t(r){let c=new Error(r);return c.source="ulid",c}let n="0123456789ABCDEFGHJKMNPQRSTVWXYZ",o=n.length,i=Math.pow(2,48)-1,a=10,u=16;function m(r,c,s){return c>r.length-1?r:r.substr(0,c)+s+r.substr(c+1)}function p(r){let c,s=r.length,d,l,g=o-1;for(;!c&&s-->=0;){if(d=r[s],l=n.indexOf(d),l===-1)throw t("incorrectly encoded string");if(l===g){r=m(r,s,n[0]);continue}c=m(r,s,n[l+1])}if(typeof c=="string")return c;throw t("cannot increment this string")}function f(r){let c=Math.floor(r()*o);return c===o&&(c=o-1),n.charAt(c)}function v(r,c){if(isNaN(r))throw new Error(r+" must be a number");if(r>i)throw t("cannot encode time greater than "+i);if(r<0)throw t("time must be positive");if(Number.isInteger(Number(r))===!1)throw t("time must be an integer");let s,d="";for(;c>0;c--)s=r%o,d=n.charAt(s)+d,r=(r-s)/o;return d}function y(r,c){let s="";for(;r>0;r--)s=f(c)+s;return s}function E(r){if(r.length!==a+u)throw t("malformed ulid");var c=r.substr(0,a).split("").reverse().reduce((s,d,l)=>{let g=n.indexOf(d);if(g===-1)throw t("invalid character found: "+d);return s+=g*Math.pow(o,l)},0);if(c>i)throw t("malformed ulid, timestamp too large");return c}function I(r=!1,c){c||(c=typeof window<"u"?window:null);let s=c&&(c.crypto||c.msCrypto);if(s)return()=>{let d=new Uint8Array(1);return s.getRandomValues(d),d[0]/255};try{let d=ee("crypto");return()=>d.randomBytes(1).readUInt8()/255}catch{}if(r){try{console.error("secure crypto unusable, falling back to insecure Math.random()!")}catch{}return()=>Math.random()}throw t("secure crypto unusable, insecure Math.random not allowed")}function j(r){return r||(r=I()),function(s){return isNaN(s)&&(s=Date.now()),v(s,a)+y(u,r)}}function R(r){r||(r=I());let c=0,s;return function(l){if(isNaN(l)&&(l=Date.now()),l<=c){let A=s=p(s);return v(c,a)+A}c=l;let g=s=y(u,r);return v(l,a)+g}}let M=j();e.decodeTime=E,e.detectPrng=I,e.encodeRandom=y,e.encodeTime=v,e.factory=j,e.incrementBase32=p,e.monotonicFactory=R,e.randomChar=f,e.replaceCharAt=m,e.ulid=M}))});var $={name:"@redocly/cli",version:"2.71.2",description:"",license:"MIT",bin:{redocly:"bin/cli.js",openapi:"bin/cli.js"},type:"module",engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{build:"node ./scripts/build.mjs","prepare:publish-dir":"node ./scripts/prepare-publish-dir.mjs","clean:publish-dir":`node -e "require('fs').rmSync('.publish', {recursive:true, force:true})"`},publishConfig:{directory:".publish"},repository:{type:"git",url:"git+https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["linter","OpenAPI","Swagger","OpenAPI linter","Swagger linter","AsyncAPI linter","Arazzo linter","oas"],contributors:["Roman Hotsiy <roman@redocly.com> (https://redocly.com/)"],devDependencies:{"@modelcontextprotocol/sdk":"^1.32.1","@opentelemetry/exporter-trace-otlp-http":"0.219.0","@opentelemetry/resources":"2.8.0","@opentelemetry/sdk-trace-node":"2.8.0","@opentelemetry/semantic-conventions":"1.41.1","@redocly/cli-otel":"0.3.7","@redocly/client-generator":"0.7.13","@redocly/openapi-core":"2.71.2","@redocly/recheck":"2.71.2","@redocly/respect-core":"2.71.2","@redocly/reunite-integration":"2.71.2","@types/cookie":"0.6.0","@types/har-format":"^1.2.16","@types/react":"^17.0.0 || ^18.2.21 || ^19.2.16","@types/react-dom":"^17.0.0 || ^18.2.7 || ^19.2.3","@types/semver":"^7.5.0","@types/set-cookie-parser":"2.4.10","@types/yargs":"17.0.32",colorette:"^1.2.0",cookie:"^0.7.2",dotenv:"16.4.7",esbuild:"^0.28.0",glob:"^13.0.5",handlebars:"^4.7.10",react:"^18.3.0 || ^19.2.7","react-dom":"^18.3.0 || ^19.2.7","react-router":"^7.18.4",redoc:"3.0.1",semver:"^7.5.2","set-cookie-parser":"^2.3.5","styled-components":"6.4.2",typescript:"6.0.2",ulid:"^3.0.1",undici:"^7.30.0",yargs:"17.0.1"}};var{version:we,name:De,engines:Te}=$,Ue=$.devDependencies.redoc;var re="https://otel.cloud.redocly.com",Re=process.env.OTEL_TRACES_URL||`${re}/v1/traces`,Me=6e3,Oe="redocly-cli-anonymous-id";var Z=ne(F(),1),ie=Object.defineProperty,ce=(e,t)=>{for(var n in t)ie(e,n,{get:t[n],enumerable:!0})},se={};ce(se,{CLOUD_EVENT_STANDARD_KEYS:()=>X,mapToCloudEvent:()=>ae});var X=["id","specversion","object","datacontenttype","type","time","origin","env","category","signal","source","subject","subjects","data","actor","requestId","clientIp","organizationId","organizationSlug","projectId","projectSlug","osPlatform","userAgent","sessionId"];function ae(e){let{type:t,data:n,actor:o,requestId:i,clientIp:a,origin:u,env:m,source:p,organizationId:f,organizationSlug:v,projectId:y,projectSlug:E,category:I="product",signal:j="log",osPlatform:R,userAgent:M,sessionId:r}=e,c=!!(n&&Array.isArray(n)),s=o?{id:o.id??`ann_${(0,Z.ulid)()}`,object:o.object??"user",uri:o.uri??""}:null,d=`evt_${(0,Z.ulid)()}`.toLowerCase(),l=new Date,g=p??s?.uri??null,A={...f!==void 0&&{organizationId:f},...v!==void 0&&{organizationSlug:v},...y!==void 0&&{projectId:y},...E!==void 0&&{projectSlug:E}},O={specversion:"1.0",object:"event",datacontenttype:"application/json; charset=utf-8",origin:u,env:m,category:I,signal:j,osPlatform:R,userAgent:M,clientIp:a,sessionId:r};if(c){let _=n,Y=_.map(S=>({id:S.id??"",object:S.object??"",uri:S.uri??""})),Q=_[0]?.id??null;Object.assign(O,{...A,id:d,type:t,time:l,source:g,actor:s,subject:Q,subjects:Y,data:_,requestId:i??""})}else{let _=(Array.isArray(n)?n[0]:n)?.id??null;Object.assign(O,{...A,id:d,type:t,time:l,source:g,actor:s,subject:_,requestId:i??"",data:n,...p!=null&&{request:{source:p}}})}return O}function T(e){return e.replace(/([A-Z])/g,"_$1").toLowerCase()}function L(e){return e!=null}function x(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function G(e,t,n,o=!0,i){let a=i?.length?new Set(i):null;for(let[u,m]of Object.entries(e))if(!a?.has(u)&&m!==void 0){let p=o?T(u):u;n[`${t}${p}`]=m}}function w(e,t,n,o){let i=o?.currentDepth??0,a=o?.useSnakeCase??!0,u=o?.maxNestingLevels??3,m=t.endsWith(".")?t.slice(0,-1):t;for(let[p,f]of Object.entries(e)){if(!L(f))continue;let v=a?T(p):p,y=`${m}.${v}`;typeof f=="object"&&!Array.isArray(f)?i<u&&w(f,y,n,{currentDepth:i+1,useSnakeCase:a,maxNestingLevels:u}):x(f)&&(n[y]=f)}}var V="context",P=[V];function q(e){let t={updated:[],notUpdated:[]};for(let n of e){if(!n||typeof n!="object")continue;let o=n.object;if(typeof o!="string")continue;let i=n,a=t.notUpdated.find(u=>u.object===o);a?(t.updated=[a,i],t.notUpdated=t.notUpdated.filter(u=>u.object!==o)):t.updated.some(u=>u.object===o)||t.notUpdated.push(i)}return t}function D(e,t,n){let o=n?`${n}.`:"",i=t===""?"":`${T(t)}.`;return`${e}.${o}${i}`}function H(e,t){let n=e[V];return n==="before"||n==="after"?n:t===0?"after":"before"}function B(e){let{[V]:t,...n}=e;return n}function z(e){return e.endsWith(".")?e:`${e}.`}function ue(e,t,n){let o=t instanceof Date?t.toISOString():new Date(t).toISOString();return{"cloudevents.event_id":e.id,"cloudevents.event_type":e.type,"cloudevents.event_source":e.source??void 0,"cloudevents.event_spec_version":e.specversion,"cloudevents.event_data_content_type":e.datacontenttype??"application/json; charset=utf-8","cloudevents.event_time":o,"cloudevents.event_subject":e.subject??"","cloudevents.event_version":n?.version,"cloudevents.event_origin":e.origin??n?.serviceName,"cloudevents.event_env":e.env,"cloudevents.event_client_ip":e.clientIp,"cloudevents.event_object":e.object||"event","cloudevents.event_category":e.category,"cloudevents.event_signal":e.signal,"cloudevents.event_actor.id":e.actor?.id??void 0,"cloudevents.event_actor.object":e.actor?.object??void 0,"cloudevents.event_actor.uri":e.actor?.uri??void 0,"cloudevents.event_organization_id":e.organizationId,"cloudevents.event_organization_slug":e.organizationSlug,"cloudevents.event_project_id":e.projectId,"cloudevents.event_project_slug":e.projectSlug,"cloudevents.event_request_id":e.requestId,"cloudevents.event_os_platform":e.osPlatform,"cloudevents.event_user_agent":e.userAgent,"cloudevents.event_session_id":e.sessionId}}function $e(e,t,n){let o=e.data,i={...ue(e,t,n)};return de(o,i),ve(e,i),ye(e,i),i}function de(e,t){!e||typeof e!="object"||(Array.isArray(e)?le(e,t):me(e,t))}function le(e,t){e.some(n=>n&&typeof n=="object"&&typeof n.object=="string")?fe(e,t):pe(e,t)}function fe(e,t){let n=q(e);n.updated.forEach((o,i)=>{let a=D("cloudevents.event_data",o.object,H(o,i));w(B(o),z(a),t)}),n.notUpdated.forEach(o=>{let i=D("cloudevents.event_data",o.object,void 0);w(B(o),z(i),t)})}function pe(e,t){for(let n of e)!n||typeof n!="object"||w(n,"cloudevents.event_data.",t)}function me(e,t){for(let[n,o]of Object.entries(e)){if(!L(o))continue;let i=T(n);if(typeof o=="object"&&!Array.isArray(o))for(let[a,u]of Object.entries(o))L(u)&&x(u)&&(t[`cloudevents.event_data.${i}.${a}`]=u);else x(o)&&(t[`cloudevents.event_data.${i}`]=o)}}function ve(e,t){if(!e.subjects||!Array.isArray(e.subjects))return;let n=q(e.subjects);n.updated.forEach((o,i)=>{let a=D("cloudevents.event_subjects",o.object,H(o,i));G(o,a,t,!1,P)}),n.notUpdated.forEach(o=>{let i=D("cloudevents.event_subjects",o.object,void 0);G(o,i,t,!1,P)})}function ye(e,t){for(let[n,o]of Object.entries(e))if(!(X.includes(n)||o===void 0))if(o instanceof Object)for(let[i,a]of Object.entries(o))a!==void 0&&(t[`cloudevents.${n}.${i}`]=a);else t[`cloudevents.${n}`]=o}import U from"node:crypto";var J="0123456789ABCDEFGHJKMNPQRSTVWXYZ",C=32;var ge=16,K=10,W=0xffffffffffff;var b;(function(e){e.Base32IncorrectEncoding="B32_ENC_INVALID",e.DecodeTimeInvalidCharacter="DEC_TIME_CHAR",e.DecodeTimeValueMalformed="DEC_TIME_MALFORMED",e.EncodeTimeNegative="ENC_TIME_NEG",e.EncodeTimeSizeExceeded="ENC_TIME_SIZE_EXCEED",e.EncodeTimeValueMalformed="ENC_TIME_MALFORMED",e.PRNGDetectFailure="PRNG_DETECT",e.ULIDInvalid="ULID_INVALID",e.Unexpected="UNEXPECTED",e.UUIDInvalid="UUID_INVALID"})(b||(b={}));var h=class extends Error{constructor(t,n){super(`${n} (${t})`),this.name="ULIDError",this.code=t}};function be(e){let t=Math.floor(e()*C)%C;return J.charAt(t)}function he(e){let t=Ie(),n=t&&(t.crypto||t.msCrypto)||(typeof U<"u"?U:null);if(typeof n?.getRandomValues=="function")return()=>{let o=new Uint8Array(1);return n.getRandomValues(o),o[0]/256};if(typeof n?.randomBytes=="function")return()=>n.randomBytes(1).readUInt8()/256;if(U?.randomBytes)return()=>U.randomBytes(1).readUInt8()/256;throw new h(b.PRNGDetectFailure,"Failed to find a reliable PRNG")}function Ie(){return je()?self:typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:null}function _e(e,t){let n="";for(;e>0;e--)n=be(t)+n;return n}function Ee(e,t=K){if(isNaN(e))throw new h(b.EncodeTimeValueMalformed,`Time must be a number: ${e}`);if(e>W)throw new h(b.EncodeTimeSizeExceeded,`Cannot encode a time larger than ${W}: ${e}`);if(e<0)throw new h(b.EncodeTimeNegative,`Time must be positive: ${e}`);if(Number.isInteger(e)===!1)throw new h(b.EncodeTimeValueMalformed,`Time must be an integer: ${e}`);let n,o="";for(let i=t;i>0;i--)n=e%C,o=J.charAt(n)+o,e=(e-n)/C;return o}function je(){return typeof WorkerGlobalScope<"u"&&self instanceof WorkerGlobalScope}function xe(e,t){let n=t||he(),o=!e||isNaN(e)?Date.now():e;return Ee(o,K)+_e(ge,n)}export{we as a,De as b,Te as c,Ue as d,re as e,Re as f,Me as g,Oe as h,se as i,$e as j,xe as k};
|
|
@@ -0,0 +1,7 @@
|
|
|
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{a,b,c,d,e}from"./MJ2NI6MR.js";import"./VJZDR6KS.js";import"./DM4EUYBB.js";import"./5CR6AOLY.js";import"./WZXA5XPB.js";import"./FRQHCFKP.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{e as goDocs,c as goGenerator,d as goSample,a as goType,b as renderGoModels};
|
|
@@ -0,0 +1,20 @@
|
|
|
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{c as W}from"./VJZDR6KS.js";import{b as R,c as L,d as z,e as U,f as J,g as ce,h as Q,i as le,j as de}from"./DM4EUYBB.js";import{a as se,c as B,d as N,e as A,g as G,h as F,i as oe,j as re,k as ae,l as V,n as ie}from"./5CR6AOLY.js";var C=B.python,D=class extends se{constructor(){super(" ")}typeName(n){return N(n,{style:"pascal",reserved:C})}memberName(n){let t=N(n,{style:"snake",reserved:C});return{identifier:t,renamed:t!==n}}identifier(n){return N(n,{style:"snake",reserved:C})}identifiers(n,t){return A(n,{style:"snake",reserved:C,taken:t})}constName(n){return N(n,{style:"screaming",reserved:C})}string(n){let t='"';for(let s of n){let r=s.codePointAt(0);s==="\\"?t+="\\\\":s==='"'?t+='\\"':s===`
|
|
8
|
+
`?t+="\\n":s==="\r"?t+="\\r":s===" "?t+="\\t":r<32||r===127?t+=`\\x${r.toString(16).padStart(2,"0")}`:r>=55296&&r<=57343?t+=`\\u${r.toString(16).padStart(4,"0")}`:t+=s}return t+'"'}literal(n){return n==null?"None":n===!0?"True":n===!1?"False":typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(s=>this.literal(s)).join(", ")}]`:`{${Object.entries(n).map(([s,r])=>`${this.string(s)}: ${this.literal(r)}`).join(", ")}}`}comment(n){for(let t of V(n))this.line(t===""?"#":`# ${t}`);return this}doc(n){let t=V(n);if(t.length===0)return this;if(t.length===1)return this.line(`"""${t[0]}"""`);this.line(`"""${t[0]}`);for(let s of t.slice(1))this.line(s);return this.line('"""')}};var x=B.python,m=new D;function v(e){return m.typeName(e)}function E(e){let{identifier:n,renamed:t}=m.memberName(e);return{python:n,renamed:t}}function q(e){let n=e.services.flatMap(s=>s.operations),t=A(n.map(s=>s.name),{style:"snake",reserved:x});return n.map((s,r)=>({op:s,ident:t[r]}))}var H=["self","body","headers","timeout","retry","idempotency_key"];function fe(e){return m.literal(e)}function pe(e){if(e!==void 0)return{style:e.style,...e.param!==void 0?{param:e.param}:{},...e.nextCursor!==void 0?{next_cursor:e.nextCursor}:{},...e.hasMore!==void 0?{has_more:e.hasMore}:{},...e.nextLink!==void 0?{next_link:e.nextLink}:{},...e.limitParam!==void 0?{limit_param:e.limitParam}:{},...e.items!==void 0?{items:e.items}:{}}}function me(e,n){let t=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let a=N(r.name,{style:"snake",reserved:x}),i=a,c=2;for(;t.has(i);)i=`${a}_${c++}`;t.add(i);let f=ie(r.schema,n);return`(${m.string(r.name)}, ${m.string(i)}, ${m.string(f)})`}).join(", ")}]`}function y(e,n="string"){if(oe(e))return`Optional[${y(re(e),n)}]`;switch(e.kind){case"scalar":if(n==="Date"&&e.scalar==="string"){if(e.metadata?.format==="date-time")return"datetime";if(e.metadata?.format==="date")return"date"}return{string:"str",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":return`List[${y(e.items,n)}]`;case"record":return`Dict[str, ${y(e.value,n)}]`;case"ref":return v(e.name);case"literal":return`Literal[${m.literal(e.value)}]`;case"enum":return{string:"str",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"union":return`Union[${e.members.map(t=>y(t,n)).join(", ")}]`;case"null":return"None";case"omit":return v(e.base);case"object":case"intersection":case"unknown":return"Any"}}function X(e,n,t,s,r,a,i,c=!1){let f=A([...n.pathParams,...n.queryParams].map(O=>O.name),{style:"snake",reserved:x,taken:H}),l=n.pathParams.map((O,w)=>({param:O,python:f[w]})),o=n.queryParams.map((O,w)=>({param:O,python:f[n.pathParams.length+w]})),u=l.map(({param:O,python:w})=>`${w}: ${y(O.schema,a)}`),p=U(n)||n.requestBody!==void 0&&J(n.requestBody.contentType),h=n.requestBody?[`body: ${p?"Any":y(n.requestBody.schema,a)}`]:[],b=[...o.map(({param:O,python:w})=>{let j=y(O.schema,a),M=j.startsWith("Optional[")?j:`Optional[${j}]`;return`${w}: ${M} = None`}),"headers: Optional[Dict[str, str]] = None","timeout: Optional[float] = None","retry: Optional[Dict[str, Any]] = None","idempotency_key: Any = None"],_=R(n),k=L(n),S=c?`Envelope[${_===void 0?"None":y(_,a)}]`:k!==void 0?`${r?"AsyncIterator":"Iterator"}[ServerSentEvent]`:s==="result"?`Result[${_===void 0?"None":y(_,a)}, Any]`:_===void 0?"None":y(_,a),d=r&&k===void 0?"async def":"def",$=r?"await ":"",g=r?"send_async":"send",P=["self",...u,...h,"*",...b].join(", "),K=c?`${t}_with_headers`:t;e.block(`${d} ${K}(${P}) -> ${S}:`,()=>{e.doc(c?`Like ${t}(), returning an Envelope with the declared response headers.`:n.summary),e.line(`op = _OPERATIONS["${t}"]`),e.line('auth_headers, auth_query = resolve_auth(op.get("security") or [], self._auth)'),e.line("params: Dict[str, Any] = dict(auth_query)");for(let{param:I,python:T}of o)e.block(`if ${T} is not None:`,()=>{e.line(`params[${m.string(I.name)}] = encode(${T})`)});let O=l.map(({param:I,python:T})=>`${m.string(I.name)}: ${T}`).join(", ");if(e.line(`url = build_url(self._server_url, op["path"], {${O}})`),k!==void 0){let I=k.schema!==void 0&&k.schema.kind!=="unknown"?"json":"text";e.block("def _open(extra_headers: Dict[str, str]) -> Any:",()=>{e.line('return self._http.stream(op["method"], url, headers={**auth_headers, **(headers or {}), **extra_headers}, params=params, timeout=timeout)')}),e.line(`return ${r?"aiter_sse":"iter_sse"}(_open, data_kind="${I}")`);return}z(n)&&!U(n)&&e.line("form_data, form_files = to_multipart(body)");let w=n.requestBody?U(n)?", **multipart_arguments(body)":z(n)?", data=form_data, files=form_files":J(n.requestBody.contentType)?`, content=body, content_type=${m.string(n.requestBody.contentType)}`:", json_body=encode(body)":"";e.line(`response = ${$}${g}(self._http, self._config, op, url, method=op["method"], headers={**auth_headers, **(headers or {})}, params=params${w}, timeout=timeout, retry=retry, idempotency_key=idempotency_key)`);let j=_===void 0?void 0:y(_,a),M=j===void 0?"None":`cast(${j}, decode(${j}, _safe_json(response)))`;c?(e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line(`return Envelope(data=${M}, headers=read_envelope_headers(response, ${me(n,i)}), response=response)`)):s==="result"?(e.block("if not response.is_success:",()=>{e.line("return Result(data=None, error=_safe_json(response), response=response)")}),e.line(`return Result(data=${M}, error=None, response=response)`)):(e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line(_===void 0?"return None":`return ${M}`))}),e.blank()}function ue(e,n,t,s,r,a){let i=R(n),c=i===void 0?"Any":y(i,a),f=A([...n.pathParams,...n.queryParams].map(d=>d.name),{style:"snake",reserved:x,taken:H}),l=n.pathParams.map((d,$)=>({param:d,python:f[$]})),o=n.queryParams.map((d,$)=>({param:d,python:f[n.pathParams.length+$]})),u=l.map(({param:d,python:$})=>`${$}: ${y(d.schema,a)}`),p=[...o.map(({param:d,python:$})=>{let g=y(d.schema,a),P=g.startsWith("Optional[")?g:`Optional[${g}]`;return`${$}: ${P} = None`}),"headers: Optional[Dict[str, str]] = None","timeout: Optional[float] = None","retry: Optional[Dict[str, Any]] = None"],h=["self",...u,"*",...p].join(", "),b=s?"AsyncIterator":"Iterator",_=s?"aiter_pages":"iter_pages",k=s?"aiter_items":"iter_items",S=()=>{e.line("base: Dict[str, Any] = {}");for(let{param:g,python:P}of o)e.block(`if ${P} is not None:`,()=>{e.line(`base[${m.string(g.name)}] = encode(${P})`)});let d=s?"async def":"def",$=s?"await ":"";e.block(`${d} _page(page_params: Dict[str, Any]) -> Tuple[Any, Any]:`,()=>{e.line('auth_headers, auth_query = resolve_auth(op.get("security") or [], self._auth)');let g=l.map(({param:P,python:K})=>`${m.string(P.name)}: ${K}`).join(", ");e.line(`url = build_url(self._server_url, op["path"], {${g}})`),e.line(`response = ${$}${s?"send_async":"send"}(self._http, self._config, op, url, method=op["method"], headers={**auth_headers, **(headers or {})}, params={**page_params, **auth_query}, timeout=timeout, retry=retry)`),e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line("return _safe_json(response), response")})};s?(e.block(`async def ${t}_pages(${h}) -> ${b}[${c}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),S(),e.block(`async for page in ${_}(_page, op["pagination"], base):`,()=>{e.line(c==="Any"?"yield page":`yield decode(${c}, page)`)})}),e.blank(),e.block(`async def ${t}_items(${h}) -> ${b}[${r}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),S(),e.block(`async for item in ${k}(_page, op["pagination"], base):`,()=>{e.line(r==="Any"?"yield item":`yield decode(${r}, item)`)})})):(e.block(`def ${t}_pages(${h}) -> ${b}[${c}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),S(),e.line(c==="Any"?`return ${_}(_page, op["pagination"], base)`:`return (decode(${c}, page) for page in ${_}(_page, op["pagination"], base))`)}),e.blank(),e.block(`def ${t}_items(${h}) -> ${b}[${r}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),S(),e.line(r==="Any"?`return ${k}(_page, op["pagination"], base)`:`return (decode(${r}, item) for item in ${k}(_page, op["pagination"], base))`)})),e.blank()}function $e(e){return ce(e).map(t=>t.kind==="literal"?m.string(t.value):E(t.name).python).join(" + ")}function ye(e,n){let t=n.servers??[];if(t.length===0)return;let s=new Set;e.block("class Servers:",()=>{e.line('"""The declared servers; variables default to the values from the description."""'),e.blank(),t.forEach((r,a)=>{let i=N(r.description??`server${a+1}`,{style:"snake",reserved:x});s.has(i)&&(i=`${i}_${a+1}`),s.add(i);let c=r.variables.map(f=>`${E(f.name).python}: str = ${m.string(f.default)}`);a>0&&e.blank(),e.line("@staticmethod"),e.block(`def ${i}(${c.join(", ")}) -> str:`,()=>{e.line(`return ${$e(r)}`)})})}),e.blank()}function Z(e,n,t,s,r,a,i){let c=s?"AsyncClient":"Client",f=s?"httpx.AsyncClient":"httpx.Client";e.block(`class ${c}:`,()=>{e.doc(`${s?"Async ":""}client for ${n.title} (${n.version}).`),e.block(`def __init__(self, server_url: str = ${m.string(a)}, *, auth: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, timeout: Optional[float] = None, retry: Optional[Dict[str, Any]] = None, middleware: Optional[List[Any]] = None, idempotency_key: Any = None, http_client: Optional[${f}] = None) -> None:`,()=>{e.line("self._server_url = server_url"),e.line("self._auth = auth or {}"),e.line("self._config: Dict[str, Any] = {"),e.indent(()=>{e.line('"headers": headers or {},'),e.line('"timeout": timeout,'),e.line('"retry": retry or {},'),e.line('"middleware": middleware or [],'),e.line('"idempotency_key": idempotency_key,')}),e.line("}"),e.line(`self._http = http_client or ${f}()`)}),e.blank();for(let{op:l,ident:o}of q(n)){X(e,l,o,t,s,i),L(l)===void 0&&(l.successResponseHeaders?.length??0)>0&&X(e,l,o,t,s,i,n,!0);let u=r.get(o);if(u!==void 0){let p=R(l),h=le(p,typeof u.items=="string"?u.items:void 0,n);ue(e,l,o,s,h===void 0?"Any":y(h,i),i)}}}),e.blank()}function ee(e){let n=new Map,t=new Set,s=[];for(let{name:a,schema:i}of e.schemas){let c=F(i,e);if(!(c===void 0||!c.cases.every(l=>G(l.schema,e)?.properties.some(o=>o.name===c.property)===!0))){for(let l of c.cases){let o=n.get(l.schemaName);if(o!==void 0&&o.value!==l.value){t.add(l.schemaName);continue}n.set(l.schemaName,{property:c.property,value:l.value})}s.push({name:a,property:c.property,members:c.cases.map(l=>l.schemaName)})}}let r=new Map;for(let a of s)a.members.some(i=>t.has(i))||r.set(a.name,E(a.property).python);for(let a of t)n.delete(a);return{pins:n,unions:r}}function _e(e,n,t,s,r,a,i){let c=t.map(o=>o.writeOnly?{...o,required:!1}:o),f=r==="pydantic";f||e.line("@dataclass");let l=f?`class ${v(n)}(BaseModel):`:`class ${v(n)}:`;e.block(l,()=>{e.doc(a),f&&(e.line("model_config = ConfigDict(populate_by_name=True)"),e.blank());let o=[...c.filter(p=>p.required),...c.filter(p=>!p.required)],u=[];o.length===0&&e.line("pass");for(let p of o){let{python:h,renamed:b}=E(p.name);b&&!f&&u.push([h,p.name]);let _=b&&f?`alias=${m.string(p.name)}`:void 0,k=i?.property===p.name?`Literal[${m.literal(i.value)}]`:y(p.schema,s);if(p.required){let S=_===void 0?"":` = Field(${_})`;e.line(`${h}: ${k}${S}`)}else{let S=k.startsWith("Optional[")?k:`Optional[${k}]`,d=_===void 0?"None":`Field(default=None, ${_})`;e.line(`${h}: ${S} = ${d}`)}}if(u.length>0){e.blank(),e.line("# Python field name -> wire (JSON) name, for (de)serialization.");let p=u.map(([h,b])=>`"${h}": ${m.string(b)}`).join(", ");e.line(`_field_map: ClassVar[Dict[str, str]] = {${p}}`)}}),e.blank(),e.blank()}function ne(e,n="string",t="dataclass"){let s=new D,{pins:r,unions:a}=t==="pydantic"?ee(e):{pins:new Map,unions:new Map};s.line("from __future__ import annotations"),s.blank(),t==="dataclass"&&s.line("from dataclasses import dataclass"),s.line("from enum import Enum");let i=["Any","AsyncIterator","Dict","Iterator","List","Literal","Optional","Tuple","Union","cast"];t==="dataclass"&&i.splice(2,0,"ClassVar"),a.size>0&&i.unshift("Annotated"),s.line(`from typing import ${i.join(", ")}`),t==="pydantic"&&s.line("from pydantic import BaseModel, ConfigDict, Field"),n==="Date"&&s.line("from datetime import date, datetime"),s.blank(),s.blank();let c=new Map;for(let{name:f,schema:l}of e.schemas){let o=ae(l);if(o!==void 0){let u=o.scalar==="string"?"str, Enum":"int, Enum";s.block(`class ${v(f)}(${u}):`,()=>{s.doc(l.description),o.values.forEach((p,h)=>{s.line(`${o.memberNames[h]} = ${m.literal(p)}`)})}),s.blank(),s.blank();continue}if(l.kind==="object"||l.kind==="intersection"){let u=G(l,e);if(u!==void 0){_e(s,f,u.properties,n,t,u.description??l.description,r.get(f));continue}}c.set(f,l)}for(let[f,l]of ge(c)){let o=F(l,e);if(o!==void 0){let h=o.cases.map(b=>`${b.value} -> ${v(b.schemaName)}`).join(", ");s.line(`# Discriminated by "${o.property}": ${h}`)}let u=a.get(f),p=u===void 0?y(l,n):`Annotated[${y(l,n)}, Field(discriminator=${m.string(u)})]`;s.line(`${v(f)} = ${p}`),s.blank()}return s.toString()}function ge(e){let n=[],t=new Set,s=r=>{let a=e.get(r);if(!(a===void 0||t.has(r))){t.add(r);for(let i of Y(a))s(i);n.push([r,a])}};for(let r of e.keys())s(r);return n}function Y(e){return e.kind==="ref"?[e.name]:e.kind==="array"?Y(e.items):e.kind==="record"?Y(e.value):e.kind==="union"?e.members.flatMap(Y):[]}function he(e,n){let t=[];for(let{name:s,schema:r}of e.schemas){if(n.has(s))continue;let a=F(r,e);if(a===void 0)continue;let i=a.cases.map(c=>`${m.string(c.value)}: ${v(c.schemaName)}`).join(", ");t.push(`DISCRIMINATORS[${v(s)}] = (${m.string(a.property)}, {${i}})`)}return t}var cn={type:"object",properties:{models:{enum:["dataclass","pydantic"],default:"dataclass",description:"Model style: standard-library dataclasses (default, httpx is the only dependency), or pydantic BaseModel classes (adds pydantic)."}},additionalProperties:!1};function te(e){let n=e.lastIndexOf("/")>=0?"/":"\\",t=e.lastIndexOf(n),s=t>=0?e.slice(0,t+1):"",r=(t>=0?e.slice(t+1):e).replace(/\.[^.]+$/,"");return`${s}${N(r,{style:"snake",reserved:x})}.py`}var ln=({model:e,output:n,banner:t,emit:s,options:r,pagination:a})=>{let i=s.errorMode??"throw",c=s.dateType??"string",f=r?.models??"dataclass",l=f==="pydantic"?ee(e):void 0,o=new D;if(o.line(`# Generated by @redocly/client-generator (python) from "${e.title}" ${e.version}.`),o.line("# Do not edit by hand \u2014 regenerate with `redocly generate-client`."),o.line(f==="pydantic"?"# Requires Python >= 3.9, httpx, and pydantic: pip install httpx pydantic":"# Requires Python >= 3.9 and httpx: pip install httpx"),o.blank(),o.line(ne(e,c,f).trimEnd()),o.blank(),o.blank(),ye(o,e),s.runtime==="module"){o.line("# \u2500\u2500\u2500 Runtime (real modules beside this file, written by the same run) \u2500\u2500\u2500");for(let d of Object.keys(W))o.line(`from ${d.replace(/\.py$/,"")} import *`);o.blank(),o.blank()}else{o.line("# \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator python runtime) \u2500\u2500\u2500");for(let d of Object.values(W)){let $=d.split(`
|
|
9
|
+
`).filter(g=>!g.startsWith("from __future__")&&!g.startsWith("from ._")).join(`
|
|
10
|
+
`).trim();o.line($),o.blank()}o.blank()}let u=he(e,new Set(l?.unions.keys()));if(u.length>0){o.line("# Discriminated unions dispatch by their property inside decode().");for(let d of u)o.line(d);o.blank()}o.block("def _safe_json(response: httpx.Response) -> Any:",()=>{o.block("try:",()=>{o.line("return response.json()")}),o.block("except Exception:",()=>{o.line("return None")})}),o.blank();let p=new Map;for(let{op:d,ident:$}of q(e))p.set($,pe(a?.get(d.name)?.spec));o.line("_OPERATIONS: Dict[str, Dict[str, Any]] = {"),o.indent(()=>{for(let{op:d,ident:$}of q(e)){let g={id:d.specName??d.name,method:d.method.toUpperCase(),path:d.path,...Q(d,e).length>0?{security:Q(d,e)}:{},...p.get($)!==void 0?{pagination:p.get($)}:{}};o.line(`"${$}": ${fe(g)},`)}}),o.line("}"),o.blank(),o.blank();let h=s.serverUrl??e.serverUrl??"";Z(o,e,i,!1,p,h,c),Z(o,e,i,!0,p,h,c);let b={path:te(n.path),content:o.toString()};if(s.runtime!=="module")return[b];let _=t.map(d=>`# ${d}`).join(`
|
|
11
|
+
`),k=te(n.path).replace(/[^\\/]+$/,""),S=Object.entries(W).map(([d,$])=>({path:`${k}${d}`,content:`${_}
|
|
12
|
+
|
|
13
|
+
${$.split(`
|
|
14
|
+
`).map(g=>g.startsWith("from ._")?g.replace("from ._","from _"):g).join(`
|
|
15
|
+
`).trim()}
|
|
16
|
+
`}));return[b,...S]};function be(e,n){let t=te(n.outputPath).replace(/^.*[\\/]/,"").replace(/\.py$/,""),s=q(n.model).find(a=>a.op.name===e.name)?.ident??N(e.name,{style:"snake",reserved:x}),r=[...e.pathParams.map(a=>{let i=N(a.name,{style:"snake",reserved:x});return`${i}="<${i}>"`}),...e.queryParams.filter(a=>a.required).map(a=>`${N(a.name,{style:"snake",reserved:x})}=...`),...e.requestBody?["body=..."]:[]];return{lang:"python",label:"Python SDK",source:`from ${t} import Client
|
|
17
|
+
|
|
18
|
+
client = Client()
|
|
19
|
+
result = client.${s}(${r.join(", ")})
|
|
20
|
+
`}}var dn=({model:e,output:n,emit:t,pagination:s})=>[{path:n.path.replace(/\.[^.\\/]+$/,".python.md"),content:de(e,{title:`${e.title} Python SDK reference`,frontmatter:t.docsFrontmatter===!0,language:{name:"python",label:"Python",fence:"python",requires:"The SDK needs `httpx`."},sample:r=>be(r,{model:e,emit:t,outputPath:n.path}),paginated:new Set(s?.keys()??[])})}];export{y as a,ne as b,cn as c,ln as d,be as e,dn as f};
|
|
@@ -4,6 +4,6 @@ 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"./L325HIGK.js";import{fa as p}from"./FRQHCFKP.js";function g(t,r){let n=t.services.flatMap(e=>e.operations),s=n.filter(e=>e.sse!==void 0);s.length>0&&p.warn(`generate-client: ${r} skipped ${s.length} server-sent-events operation(s) \u2014 iterate the sdk's exported async generators directly: ${s.map(e=>e.name).join(", ")}.
|
|
8
8
|
`);let i=new Set(t.schemas.map(e=>e.name)),o=n.filter(e=>e.sse===void 0&&m(e,i));return o.length>0&&p.warn(`generate-client: ${r} skipped ${o.length} operation(s) whose variables type name collides with a schema \u2014 rename the schema or the operation: ${o.map(e=>e.name).join(", ")}.
|
|
9
9
|
`),n.filter(e=>e.sse===void 0&&!m(e,i))}function m(t,r){let n=a(t);return n.hasInputs&&r.has(n.variablesTypeName)}function x(t){return t.method==="get"||t.method==="head"}function u(t){return a(t).hasInputs}function f(t){return a(t).variablesTypeName}function $(t,r,n){let s=[];return a(t).hasInputs?s.push(r):n&&s.push("{}"),n&&s.push("{ ...init, envelope: undefined }"),`${t.name}(${s.join(", ")})`}function v(t,r,n){let s=t.map(e=>e.name).sort(),i=t.filter(u).map(f).sort();return n&&i.push("RequestOptions"),`import { ${[...s,...i.map(e=>`type ${e}`)].join(", ")} } from ${JSON.stringify(r)};`}export{g as a,x as b,u as c,f as d,$ as e,v as f};
|
|
@@ -4,9 +4,11 @@ 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{c as
|
|
8
|
-
|
|
9
|
-
`
|
|
7
|
+
import{c as S,fa as A}from"./FRQHCFKP.js";var E=class{indentUnit;lines=[];depth=0;constructor(n=" "){this.indentUnit=n}line(n=""){return this.lines.push(n===""?"":this.indentUnit.repeat(this.depth)+n),this}blank(){return this.line()}indent(n){return this.depth++,n(),this.depth--,this}block(n,t,r){return this.line(n),this.indent(t),r===void 0?this:this.line(r)}toString(){return this.lines.join(`
|
|
8
|
+
`)+`
|
|
9
|
+
`}};function b(e){return e.replace(/^\+(?=\d)/,"plus ").replace(/^-(?=\d)/,"minus ").replace(/([A-Z]{2,})s(?![a-z])/g,"$1S").replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1 $2").split(/[^A-Za-z0-9]+/).filter(n=>n!=="").map(n=>n.toLowerCase())}var T=e=>e.charAt(0).toUpperCase()+e.slice(1),w={camel:e=>{let[n,...t]=b(e);return(n??"")+t.map(T).join("")},pascal:e=>b(e).map(T).join(""),snake:e=>b(e).join("_"),screaming:e=>b(e).join("_").toUpperCase()},Y={typescript:new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","implements","interface","let","package","private","protected","public","static","yield","await"]),python:new Set(["false","none","true","and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield","match","case","type"]),go:new Set(["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"]),php:new Set(["abstract","and","array","as","break","callable","case","catch","class","clone","const","continue","declare","default","die","do","echo","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","exit","extends","final","finally","fn","for","foreach","function","global","goto","if","implements","include","instanceof","insteadof","interface","isset","list","match","namespace","new","or","print","private","protected","public","readonly","require","return","static","switch","throw","trait","try","unset","use","var","while","xor","yield","true","false","null","int","float","bool","string","void","iterable","object","mixed","never","self","parent"])};function U(e,n={}){let t=w[n.style??"camel"](e),r=t===""?"_":/^[0-9]/.test(t)?`_${t}`:t;return n.reserved?.has(r.toLowerCase())?`${r}_`:r}function P(e,n={}){let t=new Set(n.taken??[]),r=n.style==="snake"||n.style==="screaming"?"_":"";return e.map(a=>{let s=U(a,n),i=s;for(let o=2;t.has(i);o++)i=`${s}${r}${o}`;return t.add(i),i})}function m(e,n){let t=new Set,r=e;for(;r.kind==="ref";){let{name:a}=r;if(t.has(a))return;t.add(a);let s=n.schemas.find(i=>i.name===a);if(s===void 0)return;r=s.schema}return r}function F(e,n){let t=m(e,n);if(t===void 0)return;if(t.kind==="object")return{properties:t.properties,description:t.description};if(t.kind!=="intersection")return;let r=new Map;for(let a of t.members){let s=F(a,n);if(s===void 0)return;for(let i of s.properties)r.set(i.name,i)}return{properties:[...r.values()],description:t.description}}function ee(e,n){let t=m(e,n);if(t?.kind!=="union"||t.discriminator===void 0)return;let r=[];for(let{value:a,schemaName:s}of t.discriminator.mapping){let i=m({kind:"ref",name:s},n);if(i===void 0)return;r.push({value:a,schemaName:s,schema:i})}return{property:t.discriminator.propertyName,cases:r}}function K(e){return e.kind==="union"&&e.members.some(n=>n.kind==="null")}function ne(e){if(e.kind!=="union"||!K(e))return e;let n=e.members.filter(t=>t.kind!=="null");return n.length===1?n[0]:{...e,members:n}}function te(e){if(e.kind!=="enum")return;let n=P(e.values.map(t=>typeof t=="string"?w.screaming(t):`VALUE_${w.screaming(String(t))}`),{style:"screaming"});return{values:e.values,scalar:e.scalar,memberNames:n}}function re(e){if(!e)return[];let n=e.split(/\r\n|\n|\r/).map(t=>t.trim());for(;n.length>0&&n[0]==="";)n.shift();for(;n.length>0&&n[n.length-1]==="";)n.pop();return n}function q(e,n,t){if(e.kind==="object")return e.properties.find(r=>r.name===n)?.schema;if(e.kind==="record")return e.value;if(e.kind==="array"&&/^(0|[1-9]\d*)$/.test(n))return e.items;if(e.kind==="intersection"){let r;for(let a of e.members){let s=m(a,t);s!==void 0&&(r=q(s,n,t)??r)}return r}}function g(e,n,t){let r=e.kind==="omit"?{kind:"ref",name:e.base}:e,a=m(r,t);if(!(a===void 0||n!==""&&!n.startsWith("/"))){if(n==="")return a;for(let s of n.slice(1).split("/")){let i=s.replaceAll("~1","/").replaceAll("~0","~"),o=q(a,i,t);if(o===void 0||(a=m(o,t),a===void 0))return}return a}}function v(e,n,t=new Set){if(e.kind==="ref"){if(t.has(e.name))return"string";t.add(e.name);let r=n.schemas.find(a=>a.name===e.name);return r===void 0?"string":v(r.schema,n,t)}if(e.kind==="intersection"){let r=e.members.filter(s=>s.kind!=="unknown");if(r.length===1)return v(r[0],n,t);let a=[...new Set(r.map(s=>v(s,n,new Set(t))))];return a.length===1?a[0]:a.every(s=>s==="integer"||s==="number")?"number":"string"}if(e.kind==="union"){let r=e.members.filter(a=>a.kind!=="null");return r.length===1?v(r[0],n,t):"string"}if(e.kind==="scalar"||e.kind==="enum"){if(e.scalar==="integer")return"integer";if(e.scalar==="number")return"number";if(e.scalar==="boolean")return"boolean"}if(e.kind==="literal"){if(typeof e.value=="number")return Number.isInteger(e.value)?"integer":"number";if(typeof e.value=="boolean")return"boolean"}return"string"}function I(e){return e.flatMap(n=>n.operations)}function M(e,n,t){let r=e.specName??e.name;if(t?.exclude?.includes(r))return{};let a=t?.operations?.[r];if(a!==void 0)return x(e,n,a,`pagination.operations["${r}"]`,!0);if(e.paginationExtension!==void 0)return x(e,n,e.paginationExtension,"x-redoclyPagination",!0);if(t?.style!==void 0){let{exclude:s,operations:i,...o}=t;return x(e,n,o,"pagination convention",!1)}return{}}function le(e,n){let t=new Map,r=[];for(let a of I(e.services)){let s=M(a,e,n);s.error!==void 0?r.push(s.error):s.spec!==void 0&&t.set(a.name,{spec:s.spec,itemSchema:s.itemSchema})}if(r.length>0)throw new Error(["Invalid pagination configuration:",...r].join(`
|
|
10
|
+
- `));return t}function x(e,n,t,r,a){let s=`Pagination for operation "${e.name}" (${r})`,i=B(t);if(i!==void 0)return{error:`${s}: ${i}`};let o=t,d=l=>a?{error:`${s}: ${l}`}:{};if(e.sse!==void 0)return d("the operation is a Server-Sent Events stream");if(o.style!=="link"&&o.style!=="body-link"){let l=o.style==="cursor"?"cursorParam":"offsetParam",c=o.style==="cursor"?o.cursorParam:o.offsetParam,O=e.queryParams.find(u=>u.name===c);if(!O){let u=e.queryParams.map(D=>D.name).join(", ");return d(`query parameter "${c}" is not declared on the operation`+(u===""?"":` (declared: ${u})`))}let p=j(O.schema,n);if(!(p!==void 0&&(o.style==="cursor"?k(p,n):p.kind==="scalar"&&(p.scalar==="number"||p.scalar==="integer")))){let u=o.style==="cursor"?"a string":"a number";return d(`the "${l}" query parameter "${c}" must accept ${u} (got ${H(p)})`)}}let h=e.successResponses.find(l=>l.contentType.toLowerCase().includes("json"));if(!h)return d("the operation has no JSON success response");if(o.style==="link"){let l=e.successResponseHeaders?.some(c=>c.name==="link")===!0;if(!l&&!a)return{};l||A.warn(`generate-client: ${s.toLowerCase()} follows the Link header, but the success response does not document one.
|
|
11
|
+
`)}let f=g(h.schema,o.items,n);if(f===void 0)return d(`the "items" pointer "${o.items}" does not resolve in the success response schema`);if(f.kind!=="array")return d(`the "items" pointer "${o.items}" must point at an array (got ${f.kind})`);if(o.style==="body-link"){let l=g(h.schema,o.nextLink,n);if(l===void 0)return d(`the "nextLink" pointer "${o.nextLink}" does not resolve in the success response schema`);if(!k(l,n))return d(`the "nextLink" pointer "${o.nextLink}" must point at a string (got ${l.kind})`)}if(o.style==="cursor"){let l=g(h.schema,o.nextCursor,n);if(l===void 0)return d(`the "nextCursor" pointer "${o.nextCursor}" does not resolve in the success response schema`);if(!k(l,n))return d(`the "nextCursor" pointer "${o.nextCursor}" must point at a string (got ${l.kind})`);if(o.hasMore!==void 0){let c=g(h.schema,o.hasMore,n);if(c===void 0)return d(`the "hasMore" pointer "${o.hasMore}" does not resolve in the success response schema`);if(c.kind!=="scalar"||c.scalar!=="boolean")return d(`the "hasMore" pointer "${o.hasMore}" must point at a boolean (got ${c.kind})`)}}let y=o.limitParam!==void 0?{limitParam:o.limitParam}:{};return{spec:o.style==="cursor"?{style:"cursor",param:o.cursorParam,...y,nextCursor:o.nextCursor,...o.hasMore!==void 0?{hasMore:o.hasMore}:{},items:o.items}:o.style==="link"?{style:"link",...y,items:o.items}:o.style==="body-link"?{style:"body-link",...y,nextLink:o.nextLink,items:o.items}:{style:o.style,param:o.offsetParam,...y,items:o.items},itemSchema:f.items}}function B(e){if(!S(e))return"the rule must be an object";let{style:n,cursorParam:t,nextCursor:r,hasMore:a,offsetParam:s,nextLink:i,limitParam:o,items:d}=e;if(n!=="cursor"&&n!=="offset"&&n!=="page"&&n!=="link"&&n!=="body-link")return`"style" must be one of "cursor" | "offset" | "page" | "link" | "body-link" (got ${JSON.stringify(n)})`;if(typeof d!="string"||d!==""&&!d.startsWith("/"))return'"items" must be a JSON pointer starting with "/" (or "" when the response body is the item array itself)';if(n==="cursor"){if(typeof t!="string"||t==="")return'cursor style requires a "cursorParam" query parameter name';if(typeof r!="string"||!r.startsWith("/"))return'cursor style requires a "nextCursor" JSON pointer starting with "/"';if(a!==void 0&&(typeof a!="string"||!a.startsWith("/")))return'"hasMore" must be a JSON pointer starting with "/"'}else if(n==="offset"||n==="page"){if(typeof s!="string"||s==="")return`${n} style requires an "offsetParam" query parameter name`}else if(n==="body-link"&&(typeof i!="string"||!i.startsWith("/")))return'body-link style requires a "nextLink" JSON pointer starting with "/"';if(o!==void 0&&typeof o!="string")return'"limitParam" must be a query parameter name'}function H(e){return e===void 0?"an unresolvable ref":e.kind==="scalar"||e.kind==="enum"?e.scalar:e.kind}function j(e,n){let t=new Set,r=e;for(;r.kind==="ref";){let{name:a}=r;if(t.has(a))return;t.add(a);let s=n.schemas.find(i=>i.name===a);if(s===void 0)return;r=s.schema}return r}function k(e,n){return e.kind==="scalar"||e.kind==="enum"?e.scalar==="string":e.kind==="literal"?typeof e.value=="string":e.kind==="union"?e.members.every(t=>{let r=j(t,n);return r!==void 0&&(r.kind==="null"||r.kind!=="union"&&k(r,n))}):!1}var ue={"types.ts":`/**
|
|
10
12
|
* The public type surface of the client runtime \u2014 \`@redocly/client-generator\`'s
|
|
11
13
|
* app-facing runtime module. Pure types, no runtime code (excluded from coverage).
|
|
12
14
|
* The generator emits \`OPERATIONS\` literals typed
|
|
@@ -185,7 +187,8 @@ export type ApiErrorLike = globalThis.Error & {
|
|
|
185
187
|
};
|
|
186
188
|
|
|
187
189
|
export type SettledCall = {
|
|
188
|
-
response
|
|
190
|
+
// \`| undefined\`, so the runtime can pass an unset response under \`exactOptionalPropertyTypes\`.
|
|
191
|
+
response?: Response | undefined;
|
|
189
192
|
error?: unknown;
|
|
190
193
|
attempts: number;
|
|
191
194
|
durationMs: number;
|
|
@@ -827,7 +830,13 @@ export function toHeaderRecord(headers: HeadersInit | undefined): Record<string,
|
|
|
827
830
|
export function middlewareChain(config: ClientConfig): Middleware[] {
|
|
828
831
|
const single =
|
|
829
832
|
config.onRequest || config.onResponse || config.onError
|
|
830
|
-
? [
|
|
833
|
+
? [
|
|
834
|
+
{
|
|
835
|
+
...(config.onRequest ? { onRequest: config.onRequest } : {}),
|
|
836
|
+
...(config.onResponse ? { onResponse: config.onResponse } : {}),
|
|
837
|
+
...(config.onError ? { onError: config.onError } : {}),
|
|
838
|
+
},
|
|
839
|
+
]
|
|
831
840
|
: [];
|
|
832
841
|
return [...single, ...(config.middleware ?? [])];
|
|
833
842
|
}
|
|
@@ -1001,10 +1010,10 @@ export async function send(
|
|
|
1001
1010
|
...fetchInit,
|
|
1002
1011
|
// \`fetch\` requires it for a stream body.
|
|
1003
1012
|
...(isStream ? { duplex: 'half' } : {}),
|
|
1004
|
-
signal: attemptSignal,
|
|
1013
|
+
signal: attemptSignal ?? null,
|
|
1005
1014
|
method: context.method,
|
|
1006
1015
|
headers: context.headers,
|
|
1007
|
-
body: payload,
|
|
1016
|
+
body: payload ?? null,
|
|
1008
1017
|
});
|
|
1009
1018
|
} catch (error) {
|
|
1010
1019
|
// Decided before any await, when no timer can have fired since \`fetch\` rejected: an
|
|
@@ -1027,7 +1036,7 @@ export async function send(
|
|
|
1027
1036
|
lastResponse = response;
|
|
1028
1037
|
// Reverse order: the last-registered middleware wraps closest to the network (onion).
|
|
1029
1038
|
for (let i = middleware.length - 1; i >= 0; i--) {
|
|
1030
|
-
const onResponse = middleware[i]
|
|
1039
|
+
const onResponse = middleware[i]?.onResponse;
|
|
1031
1040
|
if (onResponse) {
|
|
1032
1041
|
const replaced = await onResponse(response, context);
|
|
1033
1042
|
if (replaced && replaced !== response) {
|
|
@@ -1260,7 +1269,12 @@ export function parseSseFrame(
|
|
|
1260
1269
|
);
|
|
1261
1270
|
}
|
|
1262
1271
|
}
|
|
1263
|
-
return {
|
|
1272
|
+
return {
|
|
1273
|
+
...(event === undefined ? {} : { event }),
|
|
1274
|
+
data,
|
|
1275
|
+
...(id === undefined ? {} : { id }),
|
|
1276
|
+
...(retry === undefined ? {} : { retry }),
|
|
1277
|
+
};
|
|
1264
1278
|
}
|
|
1265
1279
|
`,"create-client.ts":`import { ApiError } from './errors.js';
|
|
1266
1280
|
import { parse, readError } from './parse.js';
|
|
@@ -1475,7 +1489,7 @@ function queryStyles(op: OperationDescriptor): Record<string, QueryStyle> | unde
|
|
|
1475
1489
|
styles[param.name] = {
|
|
1476
1490
|
style: param.style ?? 'form',
|
|
1477
1491
|
explode: param.explode ?? true,
|
|
1478
|
-
allowReserved: param.allowReserved,
|
|
1492
|
+
...(param.allowReserved === undefined ? {} : { allowReserved: param.allowReserved }),
|
|
1479
1493
|
};
|
|
1480
1494
|
}
|
|
1481
1495
|
return styles;
|
|
@@ -1986,9 +2000,10 @@ export function linkNext(header: string | null): string | undefined {
|
|
|
1986
2000
|
for (const entry of header.split(/,\\s*(?=<)/)) {
|
|
1987
2001
|
const target = /^\\s*<([^>]*)>(.*)$/.exec(entry);
|
|
1988
2002
|
if (!target) continue;
|
|
1989
|
-
const
|
|
2003
|
+
const [, url = '', params = ''] = target;
|
|
2004
|
+
const rel = /;\\s*rel\\s*=\\s*"?([^";]+)"?/i.exec(params);
|
|
1990
2005
|
// \`rel\` may carry several space-separated relation types (RFC 8288 \xA73.3).
|
|
1991
|
-
if (rel
|
|
2006
|
+
if (rel?.[1]?.split(/\\s+/).includes('next')) return url;
|
|
1992
2007
|
}
|
|
1993
2008
|
return undefined;
|
|
1994
2009
|
}
|
|
@@ -2013,7 +2028,10 @@ export async function* pagesByLink<TPage>(
|
|
|
2013
2028
|
let query = args.query;
|
|
2014
2029
|
let previous: string | undefined;
|
|
2015
2030
|
while (true) {
|
|
2016
|
-
const { page, linkHeader, url } = await call(
|
|
2031
|
+
const { page, linkHeader, url } = await call(
|
|
2032
|
+
{ ...args, ...(query === undefined ? {} : { query }) },
|
|
2033
|
+
init
|
|
2034
|
+
);
|
|
2017
2035
|
yield page as TPage;
|
|
2018
2036
|
const target = pointer === undefined ? linkNext(linkHeader) : resolvePointer(page, pointer);
|
|
2019
2037
|
if (target === undefined || target === null || target === '') return;
|
|
@@ -2862,7 +2880,7 @@ async function runSingle(
|
|
|
2862
2880
|
return fail(1, detail);
|
|
2863
2881
|
}
|
|
2864
2882
|
}
|
|
2865
|
-
`},
|
|
2883
|
+
`},me={"types.ts":`/**
|
|
2866
2884
|
* The public type surface of the client runtime \u2014 \`@redocly/client-generator\`'s
|
|
2867
2885
|
* app-facing runtime module. Pure types, no runtime code (excluded from coverage).
|
|
2868
2886
|
* The generator emits \`OPERATIONS\` literals typed
|
|
@@ -3041,7 +3059,8 @@ export type ApiErrorLike = globalThis.Error & {
|
|
|
3041
3059
|
};
|
|
3042
3060
|
|
|
3043
3061
|
export type SettledCall = {
|
|
3044
|
-
response
|
|
3062
|
+
// \`| undefined\`, so the runtime can pass an unset response under \`exactOptionalPropertyTypes\`.
|
|
3063
|
+
response?: Response | undefined;
|
|
3045
3064
|
error?: unknown;
|
|
3046
3065
|
attempts: number;
|
|
3047
3066
|
durationMs: number;
|
|
@@ -3652,7 +3671,13 @@ function toHeaderRecord(headers: HeadersInit | undefined): Record<string, string
|
|
|
3652
3671
|
function middlewareChain(config: ClientConfig): Middleware[] {
|
|
3653
3672
|
const single =
|
|
3654
3673
|
config.onRequest || config.onResponse || config.onError
|
|
3655
|
-
? [
|
|
3674
|
+
? [
|
|
3675
|
+
{
|
|
3676
|
+
...(config.onRequest ? { onRequest: config.onRequest } : {}),
|
|
3677
|
+
...(config.onResponse ? { onResponse: config.onResponse } : {}),
|
|
3678
|
+
...(config.onError ? { onError: config.onError } : {}),
|
|
3679
|
+
},
|
|
3680
|
+
]
|
|
3656
3681
|
: [];
|
|
3657
3682
|
return [...single, ...(config.middleware ?? [])];
|
|
3658
3683
|
}
|
|
@@ -3826,10 +3851,10 @@ async function send(
|
|
|
3826
3851
|
...fetchInit,
|
|
3827
3852
|
// \`fetch\` requires it for a stream body.
|
|
3828
3853
|
...(isStream ? { duplex: 'half' } : {}),
|
|
3829
|
-
signal: attemptSignal,
|
|
3854
|
+
signal: attemptSignal ?? null,
|
|
3830
3855
|
method: context.method,
|
|
3831
3856
|
headers: context.headers,
|
|
3832
|
-
body: payload,
|
|
3857
|
+
body: payload ?? null,
|
|
3833
3858
|
});
|
|
3834
3859
|
} catch (error) {
|
|
3835
3860
|
// Decided before any await, when no timer can have fired since \`fetch\` rejected: an
|
|
@@ -3852,7 +3877,7 @@ async function send(
|
|
|
3852
3877
|
lastResponse = response;
|
|
3853
3878
|
// Reverse order: the last-registered middleware wraps closest to the network (onion).
|
|
3854
3879
|
for (let i = middleware.length - 1; i >= 0; i--) {
|
|
3855
|
-
const onResponse = middleware[i]
|
|
3880
|
+
const onResponse = middleware[i]?.onResponse;
|
|
3856
3881
|
if (onResponse) {
|
|
3857
3882
|
const replaced = await onResponse(response, context);
|
|
3858
3883
|
if (replaced && replaced !== response) {
|
|
@@ -4078,7 +4103,12 @@ function parseSseFrame(
|
|
|
4078
4103
|
);
|
|
4079
4104
|
}
|
|
4080
4105
|
}
|
|
4081
|
-
return {
|
|
4106
|
+
return {
|
|
4107
|
+
...(event === undefined ? {} : { event }),
|
|
4108
|
+
data,
|
|
4109
|
+
...(id === undefined ? {} : { id }),
|
|
4110
|
+
...(retry === undefined ? {} : { retry }),
|
|
4111
|
+
};
|
|
4082
4112
|
}`,"create-client.ts":`/**
|
|
4083
4113
|
* The optional behaviors \`createClientCore\` can dispatch to but never statically
|
|
4084
4114
|
* imports. The package's public \`createClient\` wires the full set; the future
|
|
@@ -4269,7 +4299,7 @@ function queryStyles(op: OperationDescriptor): Record<string, QueryStyle> | unde
|
|
|
4269
4299
|
styles[param.name] = {
|
|
4270
4300
|
style: param.style ?? 'form',
|
|
4271
4301
|
explode: param.explode ?? true,
|
|
4272
|
-
allowReserved: param.allowReserved,
|
|
4302
|
+
...(param.allowReserved === undefined ? {} : { allowReserved: param.allowReserved }),
|
|
4273
4303
|
};
|
|
4274
4304
|
}
|
|
4275
4305
|
return styles;
|
|
@@ -4776,9 +4806,10 @@ function linkNext(header: string | null): string | undefined {
|
|
|
4776
4806
|
for (const entry of header.split(/,\\s*(?=<)/)) {
|
|
4777
4807
|
const target = /^\\s*<([^>]*)>(.*)$/.exec(entry);
|
|
4778
4808
|
if (!target) continue;
|
|
4779
|
-
const
|
|
4809
|
+
const [, url = '', params = ''] = target;
|
|
4810
|
+
const rel = /;\\s*rel\\s*=\\s*"?([^";]+)"?/i.exec(params);
|
|
4780
4811
|
// \`rel\` may carry several space-separated relation types (RFC 8288 \xA73.3).
|
|
4781
|
-
if (rel
|
|
4812
|
+
if (rel?.[1]?.split(/\\s+/).includes('next')) return url;
|
|
4782
4813
|
}
|
|
4783
4814
|
return undefined;
|
|
4784
4815
|
}
|
|
@@ -4803,7 +4834,10 @@ async function* pagesByLink<TPage>(
|
|
|
4803
4834
|
let query = args.query;
|
|
4804
4835
|
let previous: string | undefined;
|
|
4805
4836
|
while (true) {
|
|
4806
|
-
const { page, linkHeader, url } = await call(
|
|
4837
|
+
const { page, linkHeader, url } = await call(
|
|
4838
|
+
{ ...args, ...(query === undefined ? {} : { query }) },
|
|
4839
|
+
init
|
|
4840
|
+
);
|
|
4807
4841
|
yield page as TPage;
|
|
4808
4842
|
const target = pointer === undefined ? linkNext(linkHeader) : resolvePointer(page, pointer);
|
|
4809
4843
|
if (target === undefined || target === null || target === '') return;
|
|
@@ -5650,4 +5684,4 @@ async function runSingle(
|
|
|
5650
5684
|
}
|
|
5651
5685
|
return fail(1, detail);
|
|
5652
5686
|
}
|
|
5653
|
-
}`}
|
|
5687
|
+
}`},$=["ApiError","ApiErrorLike","AuthCredentials","BodyMethod","Capabilities","CliAuthScheme","CliCommand","CliFlag","CliGlobals","CliInvocation","CliWiring","Client","ClientConfig","ClientCore","CommandContext","CommandSource","CustomCommand","Envelope","EnvelopeResult","EnvelopeResultForKnownInit","FRAME_DELIMITER","GLOBAL_FLAGS","HeadersOf","IDEMPOTENT_METHODS","LAYERS","LAYER_OF","LinkPageCall","Middleware","NoRequiredKeys","OperationArgs","OperationContext","OperationDescriptor","OperationMethodIdentity","OpsShape","PageOf","Paginated","PaginationSpec","ParamSpec","ParseAs","QueryStyle","QueryValue","RequestContext","RequestOptions","ResolvedCommand","ResponseHeaderSpec","Result","RetryConfig","RetryContext","RetryStrategy","SecuritySpec","SendCapabilities","ServerSentEvent","SettledCall","SseOptions","SseParseError","TRANSIENT_STATUS","ThrowMethod","TimeoutError","TokenProvider","abortError","acceptFor","anySignal","buildUrl","callInputs","coerceResponseHeader","commandContract","constantCase","createClientCore","defaultRetryOn","encodeBase64","encodeReserved","execute","groupSlug","inputOf","invokedName","isConfigured","items","itemsByLink","kindFor","linkNext","linkPageCall","loadBody","mergeSetup","middlewareChain","namespaceArgs","normalizeCommands","oneLine","pageCall","pages","pagesByLink","paginateCapability","parse","parseInvocation","parseSseFrame","prepareRequest","queryStyles","readEnvelopeHeaders","readError","redactHeaders","renderComposedHelp","renderHelp","resolveAuth","resolvePointer","resolveToken","retryDelay","runCli","runSingle","runSources","send","shadowedCommandName","sleep","splitArgs","sse","stringHeaders","substitutePath","timeoutSignal","toFormData","toHeaderRecord"];var z=["client","OPERATIONS","Ops","OperationId","OperationPath","OperationTag","createClient","mergeSetup","ApiError","TimeoutError","configure","use","auth","defaultRetryOn","ClientConfig","RequestOptions","SseOptions","Middleware","OperationDescriptor","ServerSentEvent","Result","Envelope","EnvelopeResult","TokenProvider","__redoclySetup"],_=["z","http","HttpResponse","handlers","faker","queryOptions","useSWR","useSWRMutation","__Writable"],G=["AbortController","AbortSignal","Array","ArrayBuffer","ArrayBufferView","AsyncGenerator","AsyncIterable","Blob","BodyInit","Boolean","DOMException","Date","Error","Extract","FormData","Headers","HeadersInit","JSON","Map","Math","NonNullable","Number","Object","Omit","Partial","Promise","ReadableStream","Record","RegExp","RegExpExecArray","Request","RequestInit","Response","Set","String","Symbol","TextDecoder","TextEncoder","TypeError","Uint8Array","URL","URLSearchParams","btoa","clearTimeout","crypto","decodeURIComponent","document","encodeURIComponent","fetch","globalThis","setTimeout","undefined"],R;function fe(){return R===void 0&&(R=new Set([...z,..._,...G,...$])),R}var L={name:"@redocly/client-generator",version:"0.7.13",description:"Generate typed, zero-dependency TypeScript clients (fetch, auth, retries, middleware, SSE) from OpenAPI descriptions.",type:"module",types:"lib/index.d.ts",sideEffects:!1,exports:{".":{types:"./lib/index.d.ts",import:"./lib/index.js",default:"./lib/index.js"},"./generate":{types:"./lib/generate.d.ts",import:"./lib/generate.js",default:"./lib/generate.js"},"./printers/python":{types:"./lib/printers/python.d.ts",import:"./lib/printers/python.js",default:"./lib/printers/python.js"},"./printers/go":{types:"./lib/printers/go.d.ts",import:"./lib/printers/go.js",default:"./lib/printers/go.js"},"./printers/php":{types:"./lib/printers/php.d.ts",import:"./lib/printers/php.js",default:"./lib/printers/php.js"},"./printers/typescript":{types:"./lib/printers/typescript.d.ts",import:"./lib/printers/typescript.js",default:"./lib/printers/typescript.js"},"./printers":{types:"./lib/printers/index.d.ts",import:"./lib/printers/index.js",default:"./lib/printers/index.js"},"./contracts/typescript":{types:"./lib/contracts/typescript.d.ts",import:"./lib/contracts/typescript.js",default:"./lib/contracts/typescript.js"},"./runtime-sources":{types:"./lib/runtime-sources.d.ts",import:"./lib/runtime-sources.js",default:"./lib/runtime-sources.js"},"./package.json":"./package.json"},engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{"examples:regen":"node scripts/regenerate-examples.mjs",prepare:"node scripts/generate-runtime-sources.mjs && node scripts/generate-eject-assets.mjs","typecheck:examples":"node scripts/typecheck-examples.mjs"},license:"MIT",repository:{type:"git",url:"git+https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["OpenAPI","Swagger","TypeScript","client","generator","codegen","fetch"],contributors:["Roman Marshevskyi <roman.marshevskyy@redocly.com> (https://redocly.com/)"],dependencies:{"@redocly/openapi-core":"2.71.2"},peerDependencies:{typescript:">=5.5.0"},peerDependenciesMeta:{typescript:{optional:!0}},devDependencies:{typescript:"6.0.2"},files:["lib","eject-assets"]};var ve=L.version;function N(e){let n=/^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e.trim());return n===null?void 0:[Number(n[1]),Number(n[2]),Number(n[3])]}function C(e,n){return e[0]-n[0]||e[1]-n[1]||e[2]-n[2]}function ke(e,n){let t=/^[\^~]|^>=/.exec(n.trim())?.[0]??"",r=N(n.trim().slice(t.length)),a=N(e);if(!(r===void 0||a===void 0))return C(a,r)<0?!1:t===">="?!0:t===""?C(a,r)===0:t==="~"?a[0]===r[0]&&a[1]===r[1]:r[0]!==0?a[0]===r[0]:r[1]!==0?a[0]===0&&a[1]===r[1]:C(a,r)===0}export{E as a,w as b,Y as c,U as d,P as e,m as f,F as g,ee as h,K as i,ne as j,te as k,re as l,g as m,v as n,I as o,le as p,ue as q,me as r,z as s,fe as t,ve as u,ke as v};
|