@redocly/cli 2.55.0 → 2.56.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES +17 -33
- package/lib/chunks/{Y66YFAUD.js → 25UBBA3J.js} +1 -1
- package/lib/chunks/{A2ODYHX2.js → 2KLHD2U7.js} +1 -1
- package/lib/chunks/{63QCRU6J.js → 2M6C5LHI.js} +1 -1
- package/lib/chunks/{ASDHVJ5A.js → 2UTQDU6B.js} +1 -1
- package/lib/chunks/{22LQIPY2.js → 35XUUJLG.js} +1 -1
- package/lib/chunks/{5CIDGIXH.js → 3W3OLLTF.js} +1 -1
- package/lib/chunks/4PTNG4EI.js +7 -0
- package/lib/chunks/{3V7S4KRL.js → 5CEXCXYZ.js} +1 -1
- package/lib/chunks/{PZWFBD3A.js → 5TJ3WQMW.js} +11 -11
- package/lib/chunks/64G5RPLP.js +7 -0
- package/lib/chunks/{AYQ35VOB.js → 6BC7FVBU.js} +1 -1
- package/lib/chunks/{VMGY6BKZ.js → 7ARFLNUA.js} +1 -1
- package/lib/chunks/{TEHFMQKM.js → 7QLACFLT.js} +1 -1
- package/lib/chunks/{HFYWZVOK.js → A5VZWAMI.js} +1 -1
- package/lib/chunks/{N7PVTAFM.js → ALAAZCRE.js} +1 -1
- package/lib/chunks/{P2PCNXBE.js → BNT5BXON.js} +1 -1
- package/lib/chunks/CXUJFJ3V.js +11 -0
- package/lib/chunks/{SWK3YGGD.js → D7OG7544.js} +1 -1
- package/lib/chunks/{XRTDDB7G.js → DCVTFQBO.js} +1 -1
- package/lib/chunks/{BAXGMV6A.js → DJ2P263F.js} +1 -1
- package/lib/chunks/DLPIGJ4V.js +14 -0
- package/lib/chunks/{EY2ZN6BT.js → E5XZY3Q2.js} +1 -1
- package/lib/chunks/{QI2D3IAP.js → FUETBXGV.js} +1 -1
- package/lib/chunks/{YMFLZXNF.js → FX2A3GCS.js} +1 -1
- package/lib/chunks/{5VJVFRWZ.js → G47ZYA3C.js} +1 -1
- package/lib/chunks/GHSNC2OX.js +9 -0
- package/lib/chunks/HBUZKWXC.js +7 -0
- package/lib/chunks/HDOITPQ3.js +20 -0
- package/lib/chunks/{3GASF4WI.js → HJZMPHXS.js} +1 -1
- package/lib/chunks/{BL2RHSRD.js → HSBHQBL2.js} +2 -2
- package/lib/chunks/I6CD22RU.js +10 -0
- package/lib/chunks/{IOCKS4AM.js → I7GIWE3P.js} +1 -1
- package/lib/chunks/IGD6TJGQ.js +34 -0
- package/lib/chunks/{Z7FXXAFA.js → IRZBI5PN.js} +1 -1
- package/lib/chunks/ISV7E3WY.js +29 -0
- package/lib/chunks/IXUAYOCK.js +18 -0
- package/lib/chunks/{ITMFCWG4.js → JO2R43LS.js} +1 -1
- package/lib/chunks/LRUXN6H5.js +59 -0
- package/lib/chunks/{2IUJCGSA.js → M3P4YXWZ.js} +1 -1
- package/lib/chunks/{IVQGWJFK.js → MB5P3K2R.js} +1 -1
- package/lib/chunks/MGBZEDQJ.js +45 -0
- package/lib/chunks/{XGSKSQUA.js → MRVYTOFX.js} +1 -1
- package/lib/chunks/{TJ6BPMCF.js → MS356BQ6.js} +1 -1
- package/lib/chunks/{ZZB27P2P.js → MTHNGTMB.js} +1 -1
- package/lib/chunks/{YHGVWNO2.js → MU74CSJJ.js} +2 -2
- package/lib/chunks/{HNPYGEY3.js → NV7DJMMF.js} +1 -1
- package/lib/chunks/{VWDCJNJS.js → OGD5QBKV.js} +1 -1
- package/lib/chunks/{P32DILLK.js → OKP4XLDY.js} +1 -1
- package/lib/chunks/{TFRQNTX4.js → P6LCRZC4.js} +1 -1
- package/lib/chunks/PIMM4UUT.js +9 -0
- package/lib/chunks/{LBF5UJY7.js → PJRRECUU.js} +1 -1
- package/lib/chunks/QAC4XUNG.js +14 -0
- package/lib/chunks/{BLT2564G.js → R5EOHC5A.js} +4 -4
- package/lib/chunks/{KGTQGGCB.js → RAZQQ2DW.js} +1 -1
- package/lib/chunks/SJHPKWSD.js +9 -0
- package/lib/chunks/{FCXOAAZW.js → SRIYNICE.js} +1 -1
- package/lib/chunks/{FTARR2LM.js → T3LLCSAJ.js} +1 -1
- package/lib/chunks/TWIJOWYT.js +7 -0
- package/lib/chunks/U5DIFWGH.js +7 -0
- package/lib/chunks/{7IULUVWX.js → UF2ZCH7W.js} +1 -1
- package/lib/chunks/{PZOJ2P55.js → UVP374Z3.js} +1 -1
- package/lib/chunks/{3MYY3GBQ.js → VCODEISK.js} +2 -2
- package/lib/chunks/VD6XNXNY.js +7 -0
- package/lib/chunks/VMGZLFL4.js +11 -0
- package/lib/chunks/{YASQUPUQ.js → VTGQPPGI.js} +1 -1
- package/lib/chunks/VUKQLVFA.js +10 -0
- package/lib/chunks/W5WXQVTO.js +13 -0
- package/lib/chunks/XACYMDME.js +89 -0
- package/lib/chunks/{FZMIYQXC.js → XJ7LVK2B.js} +1 -1
- package/lib/chunks/XJSNA6VQ.js +119 -0
- package/lib/chunks/{ICZFEEL2.js → XXP75TZV.js} +1 -1
- package/lib/chunks/YW2GBLJX.js +7 -0
- package/lib/chunks/{4N37PAKJ.js → Z22TFV6U.js} +1 -1
- package/lib/chunks/{EQ7EIDJ2.js → ZCIVIBWW.js} +1 -1
- package/lib/chunks/ZOVYQ36P.js +193 -0
- package/lib/eject-assets/generators/cli/docs.ts +1 -1
- package/lib/eject-assets/generators/cli/engine-source.ts +1 -1
- package/lib/eject-assets/generators/cli/index.ts +2 -2
- package/lib/eject-assets/generators/cli/render.ts +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 +1 -1
- package/lib/eject-assets/generators/go/naming.ts +1 -1
- package/lib/eject-assets/generators/go/operations.ts +1 -1
- package/lib/eject-assets/generators/go/pagination.ts +1 -1
- package/lib/eject-assets/generators/go/types.ts +1 -1
- package/lib/eject-assets/generators/mock/faker.ts +1 -1
- package/lib/eject-assets/generators/mock/index.ts +2 -2
- package/lib/eject-assets/generators/mock/render.ts +1 -1
- package/lib/eject-assets/generators/mock/sample.ts +1 -1
- package/lib/eject-assets/generators/mock/values.ts +1 -1
- package/lib/eject-assets/generators/php/client.ts +1 -1
- package/lib/eject-assets/generators/php/descriptor.ts +1 -1
- package/lib/eject-assets/generators/php/index.ts +2 -2
- package/lib/eject-assets/generators/php/models.ts +1 -1
- package/lib/eject-assets/generators/php/naming.ts +1 -1
- package/lib/eject-assets/generators/php/operations.ts +1 -1
- package/lib/eject-assets/generators/php/pagination.ts +1 -1
- package/lib/eject-assets/generators/php/types.ts +1 -1
- package/lib/eject-assets/generators/python/client.ts +1 -1
- package/lib/eject-assets/generators/python/descriptor.ts +1 -1
- package/lib/eject-assets/generators/python/index.ts +2 -2
- package/lib/eject-assets/generators/python/models.ts +1 -1
- package/lib/eject-assets/generators/python/naming.ts +1 -1
- package/lib/eject-assets/generators/python/operations.ts +1 -1
- package/lib/eject-assets/generators/python/pagination.ts +1 -1
- package/lib/eject-assets/generators/python/types.ts +1 -1
- package/lib/eject-assets/generators/swr/index.ts +2 -2
- package/lib/eject-assets/generators/swr/render.ts +1 -1
- package/lib/eject-assets/generators/tanstack-query/index.ts +2 -2
- package/lib/eject-assets/generators/tanstack-query/render.ts +1 -1
- package/lib/eject-assets/generators/transformers/index.ts +2 -2
- package/lib/eject-assets/generators/transformers/render.ts +1 -1
- package/lib/eject-assets/generators/typescript/banner.ts +1 -1
- package/lib/eject-assets/generators/typescript/client.ts +1 -1
- package/lib/eject-assets/generators/typescript/descriptor.ts +1 -1
- package/lib/eject-assets/generators/typescript/index.ts +2 -2
- package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
- package/lib/eject-assets/generators/typescript/operations.ts +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/index.js +78 -293
- package/package.json +1 -1
- package/lib/chunks/2SOGAGWL.js +0 -13
- package/lib/chunks/BXI4SF2U.js +0 -59
- package/lib/chunks/DGKML64B.js +0 -98
- package/lib/chunks/V7XX5H7Y.js +0 -184
- package/lib/chunks/YJG3HGNT.js +0 -47
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -623,19 +623,21 @@ Packages:
|
|
|
623
623
|
zod-to-json-schema@3.25.2 — Copyright (c) 2020, Stefan Terdell
|
|
624
624
|
|
|
625
625
|
License text:
|
|
626
|
-
|
|
626
|
+
The ISC License
|
|
627
627
|
|
|
628
|
-
|
|
629
|
-
with or without fee is hereby granted, provided that the above copyright notice
|
|
630
|
-
and this permission notice appear in all copies.
|
|
628
|
+
Copyright (c) Isaac Z. Schlueter and Contributors
|
|
631
629
|
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
630
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
631
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
632
|
+
copyright notice and this permission notice appear in all copies.
|
|
633
|
+
|
|
634
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
635
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
636
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
637
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
638
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
639
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|
640
|
+
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
639
641
|
|
|
640
642
|
============================================================
|
|
641
643
|
MIT
|
|
@@ -651,9 +653,9 @@ Packages:
|
|
|
651
653
|
@noble/hashes@1.8.0 — Copyright (c) 2022 Paul Miller (https://paulmillr.com)
|
|
652
654
|
@redocly/ajv@8.11.2 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
653
655
|
@redocly/ajv@8.18.3 — Copyright (c) 2015-2021 Evgeny Poberezkin
|
|
654
|
-
@redocly/cli-otel@0.3.
|
|
656
|
+
@redocly/cli-otel@0.3.7 — Copyright 2025 Redocly Inc, all rights reserved.
|
|
655
657
|
@redocly/config@0.22.0 — Copyright 2024 Redocly Inc.
|
|
656
|
-
@redocly/config@0.
|
|
658
|
+
@redocly/config@0.59.0 — Copyright 2024 Redocly Inc.
|
|
657
659
|
@redocly/openapi-core@1.34.20
|
|
658
660
|
agent-base@7.1.4 — Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
|
659
661
|
ajv-formats@3.0.1 — Copyright (c) 2020 Evgeny Poberezkin
|
|
@@ -723,32 +725,14 @@ Packages:
|
|
|
723
725
|
supports-color@7.2.0
|
|
724
726
|
ulid@2.4.0 — Copyright (c) 2017 Alizain Feerasta
|
|
725
727
|
ulid@3.0.2 — Copyright (c) 2017 Alizain Feerasta
|
|
726
|
-
undici@6.
|
|
728
|
+
undici@6.29.0 — Copyright (c) Matteo Collina and Undici contributors
|
|
727
729
|
uri-js-replace@1.0.1
|
|
728
730
|
use-sync-external-store@1.6.0 — Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
729
731
|
yargs@17.0.1 — Copyright 2010 James Halliday (mail@substack.net); Modified work Copyright 2014 Contributors (ben@npmjs.com)
|
|
730
732
|
zod@4.4.3 — Copyright (c) 2025 Colin McDonnell
|
|
731
733
|
|
|
732
734
|
License text:
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
736
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
737
|
-
in the Software without restriction, including without limitation the rights
|
|
738
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
739
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
740
|
-
furnished to do so, subject to the following conditions:
|
|
741
|
-
|
|
742
|
-
The above copyright notice and this permission notice shall be included in
|
|
743
|
-
all copies or substantial portions of the Software.
|
|
744
|
-
|
|
745
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
746
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
747
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
748
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
749
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
750
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
751
|
-
THE SOFTWARE.
|
|
735
|
+
(no license text found)
|
|
752
736
|
|
|
753
737
|
============================================================
|
|
754
738
|
unknown
|
|
@@ -4,5 +4,5 @@ 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{
|
|
7
|
+
import{v as o}from"./MGBZEDQJ.js";import{Q as t}from"./ZOVYQ36P.js";var r=" ",a=" ";function g(i){let p=Math.max(...i.map(n=>o(n).length)),e=p+a.length*2,c=r+t("\u2551"+" ".repeat(e)+"\u2551");return["",r+t("\u2554"+"\u2550".repeat(e)+"\u2557"),c,...i.map(n=>{let h=" ".repeat(p-o(n).length);return`${r}${t("\u2551")}${a}${n}${h}${a}${t("\u2551")}`}),c,r+t("\u255A"+"\u2550".repeat(e)+"\u255D"),"",""].join(`
|
|
8
8
|
`)}export{g as a};
|
|
@@ -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 $,b as a,c,d as i,e as m,f}from"./
|
|
7
|
+
import{a as $,b as a,c,d as i,e as m,f}from"./PJRRECUU.js";import{k as l}from"./LD5MEXEL.js";import{join as p}from"node:path";function k(t,n){let e=$(t,"swr");if(e.length===0)return"";let s=e.some(a),o=e.some(r=>!a(r));return[...s?['import useSWR from "swr";']:[],...o?['import useSWRMutation from "swr/mutation";']:[],f(e,n.sdkModule,s),...e.flatMap(r=>a(r)?g(r):[S(r)])].join(`
|
|
8
8
|
|
|
9
9
|
`)}function y(t,n,e){return`export function use${l(t.name)}(${n}) {
|
|
10
10
|
return ${e};
|
|
@@ -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{c as U}from"./2U6O26CV.js";import{b as R,c as L,d as Y,f as se,g as K,h as oe,i as re}from"./
|
|
7
|
+
import{c as U}from"./2U6O26CV.js";import{b as R,c as L,d as Y,f as se,g as K,h as oe,i as re}from"./NV7DJMMF.js";import{a as X,c as F,d as k,e as D,g as B,h as T,i as Z,j as ee,k as ne,l as H,n as te}from"./UW4UC7ZI.js";var M=F.python,j=class extends X{constructor(){super(" ")}typeName(n){return k(n,{style:"pascal",reserved:M})}memberName(n){let t=k(n,{style:"snake",reserved:M});return{identifier:t,renamed:t!==n}}identifier(n){return k(n,{style:"snake",reserved:M})}identifiers(n,t){return D(n,{style:"snake",reserved:M,taken:t})}constName(n){return k(n,{style:"screaming",reserved:M})}string(n){let t='"';for(let s of n){let r=s.codePointAt(0);s==="\\"?t+="\\\\":s==='"'?t+='\\"':s===`
|
|
8
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 H(n))this.line(t===""?"#":`# ${t}`);return this}doc(n){let t=H(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 N=F.python,f=new j;function O(e){return f.typeName(e)}function q(e){let{identifier:n,renamed:t}=f.memberName(e);return{python:n,renamed:t}}function I(e){let n=e.services.flatMap(s=>s.operations),t=D(n.map(s=>s.name),{style:"snake",reserved:N});return n.map((s,r)=>({op:s,ident:t[r]}))}var W=["self","body","headers","timeout","retry","idempotency_key"];function ae(e){return f.literal(e)}function ie(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.limitParam!==void 0?{limit_param:e.limitParam}:{},...e.items!==void 0?{items:e.items}:{}}}function ce(e,n){let t=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let a=k(r.name,{style:"snake",reserved:N}),c=a,i=2;for(;t.has(c);)c=`${a}_${i++}`;t.add(c);let m=te(r.schema,n);return`(${f.string(r.name)}, ${f.string(c)}, ${f.string(m)})`}).join(", ")}]`}function y(e,n="string"){if(Z(e))return`Optional[${y(ee(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 O(e.name);case"literal":return`Literal[${f.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 O(e.base);case"object":case"intersection":case"unknown":return"Any"}}function G(e,n,t,s,r,a,c,i=!1){let m=D([...n.pathParams,...n.queryParams].map(S=>S.name),{style:"snake",reserved:N,taken:W}),l=n.pathParams.map((S,v)=>({param:S,python:m[v]})),o=n.queryParams.map((S,v)=>({param:S,python:m[n.pathParams.length+v]})),d=l.map(({param:S,python:v})=>`${v}: ${y(S.schema,a)}`),u=n.requestBody?[`body: ${y(n.requestBody.schema,a)}`]:[],$=[...o.map(({param:S,python:v})=>{let A=y(S.schema,a),E=A.startsWith("Optional[")?A:`Optional[${A}]`;return`${v}: ${E} = None`}),"headers: Optional[Dict[str, str]] = None","timeout: Optional[float] = None","retry: Optional[Dict[str, Any]] = None","idempotency_key: Any = None"],h=R(n),g=L(n),x=i?`Envelope[${h===void 0?"None":y(h,a)}]`:g!==void 0?`${r?"AsyncIterator":"Iterator"}[ServerSentEvent]`:s==="result"?"Result":h===void 0?"None":y(h,a),P=r&&g===void 0?"async def":"def",p=r?"await ":"",_=r?"send_async":"send",b=["self",...d,...u,"*",...$].join(", "),w=i?`${t}_with_headers`:t;e.block(`${P} ${w}(${b}) -> ${x}:`,()=>{e.doc(i?`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:E,python:C}of o)e.block(`if ${C} is not None:`,()=>{e.line(`params[${f.string(E.name)}] = encode(${C})`)});let S=l.map(({param:E,python:C})=>`${f.string(E.name)}: ${C}`).join(", ");if(e.line(`url = build_url(self._server_url, op["path"], {${S}})`),g!==void 0){let E=g.schema!==void 0&&g.schema.kind!=="unknown"?"json":"text";e.block("def _open(extra_headers: Dict[str, str]):",()=>{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="${E}")`);return}Y(n)&&e.line("form_data, form_files = to_multipart(body)");let v=n.requestBody?Y(n)?", data=form_data, files=form_files":", json_body=encode(body)":"";e.line(`response = ${p}${_}(self._http, self._config, op, url, method=op["method"], headers={**auth_headers, **(headers or {})}, params=params${v}, timeout=timeout, retry=retry, idempotency_key=idempotency_key)`);let A=h===void 0?"None":`decode(${y(h,a)}, _safe_json(response))`;i?(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=${A}, headers=read_envelope_headers(response, ${ce(n,c)}), 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=${A}, 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(h===void 0?"return None":`return ${A}`))}),e.blank()}function le(e,n,t,s,r,a){let c=R(n),i=c===void 0?"Any":y(c,a),m=D([...n.pathParams,...n.queryParams].map(p=>p.name),{style:"snake",reserved:N,taken:W}),l=n.pathParams.map((p,_)=>({param:p,python:m[_]})),o=n.queryParams.map((p,_)=>({param:p,python:m[n.pathParams.length+_]})),d=l.map(({param:p,python:_})=>`${_}: ${y(p.schema,a)}`),u=[...o.map(({param:p,python:_})=>{let b=y(p.schema,a),w=b.startsWith("Optional[")?b:`Optional[${b}]`;return`${_}: ${w} = None`}),"headers: Optional[Dict[str, str]] = None","timeout: Optional[float] = None","retry: Optional[Dict[str, Any]] = None"],$=["self",...d,"*",...u].join(", "),h=s?"AsyncIterator":"Iterator",g=s?"aiter_pages":"iter_pages",x=s?"aiter_items":"iter_items",P=()=>{e.line("base: Dict[str, Any] = {}");for(let{param:b,python:w}of o)e.block(`if ${w} is not None:`,()=>{e.line(`base[${f.string(b.name)}] = encode(${w})`)});let p=s?"async def":"def",_=s?"await ":"";e.block(`${p} _page(page_params: Dict[str, Any]) -> Tuple[Any, Any]:`,()=>{e.line('auth_headers, auth_query = resolve_auth(op.get("security") or [], self._auth)');let b=l.map(({param:w,python:S})=>`${f.string(w.name)}: ${S}`).join(", ");e.line(`url = build_url(self._server_url, op["path"], {${b}})`),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}[${i}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.block(`async for page in ${g}(_page, op["pagination"], base):`,()=>{e.line(i==="Any"?"yield page":`yield decode(${i}, page)`)})}),e.blank(),e.block(`async def ${t}_items(${$}) -> ${h}[${r}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.block(`async for item in ${x}(_page, op["pagination"], base):`,()=>{e.line(r==="Any"?"yield item":`yield decode(${r}, item)`)})})):(e.block(`def ${t}_pages(${$}) -> ${h}[${i}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.line(i==="Any"?`return ${g}(_page, op["pagination"], base)`:`return (decode(${i}, page) for page in ${g}(_page, op["pagination"], base))`)}),e.blank(),e.block(`def ${t}_items(${$}) -> ${h}[${r}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),P(),e.line(r==="Any"?`return ${x}(_page, op["pagination"], base)`:`return (decode(${r}, item) for item in ${x}(_page, op["pagination"], base))`)})),e.blank()}function me(e){return se(e).map(t=>t.kind==="literal"?f.string(t.value):q(t.name).python).join(" + ")}function de(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 c=k(r.description??`server${a+1}`,{style:"snake",reserved:N});s.has(c)&&(c=`${c}_${a+1}`),s.add(c);let i=r.variables.map(m=>`${q(m.name).python}: str = ${f.string(m.default)}`);a>0&&e.blank(),e.line("@staticmethod"),e.block(`def ${c}(${i.join(", ")}) -> str:`,()=>{e.line(`return ${me(r)}`)})})}),e.blank()}function V(e,n,t,s,r,a,c){let i=s?"AsyncClient":"Client",m=s?"httpx.AsyncClient":"httpx.Client";e.block(`class ${i}:`,()=>{e.doc(`${s?"Async ":""}client for ${n.title} (${n.version}).`),e.block(`def __init__(self, server_url: str = ${f.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[${m}] = 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 ${m}()`)}),e.blank();for(let{op:l,ident:o}of I(n)){G(e,l,o,t,s,c),L(l)===void 0&&(l.successResponseHeaders?.length??0)>0&&G(e,l,o,t,s,c,n,!0);let d=r.get(o);if(d!==void 0){let u=R(l),$=oe(u,typeof d.items=="string"?d.items:void 0,n);le(e,l,o,s,$===void 0?"Any":y($,c),c)}}}),e.blank()}function z(e){let n=new Map,t=new Set,s=[];for(let{name:a,schema:c}of e.schemas){let i=T(c,e);if(!(i===void 0||!i.cases.every(l=>B(l.schema,e)?.properties.some(o=>o.name===i.property)===!0))){for(let l of i.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:i.property,value:l.value})}s.push({name:a,property:i.property,members:i.cases.map(l=>l.schemaName)})}}let r=new Map;for(let a of s)a.members.some(c=>t.has(c))||r.set(a.name,q(a.property).python);for(let a of t)n.delete(a);return{pins:n,unions:r}}function fe(e,n,t,s,r,a,c){let i=r==="pydantic";i||e.line("@dataclass");let m=i?`class ${O(n)}(BaseModel):`:`class ${O(n)}:`;e.block(m,()=>{e.doc(a),i&&(e.line("model_config = ConfigDict(populate_by_name=True)"),e.blank());let l=[...t.filter(d=>d.required),...t.filter(d=>!d.required)],o=[];l.length===0&&e.line("pass");for(let d of l){let{python:u,renamed:$}=q(d.name);$&&!i&&o.push([u,d.name]);let h=$&&i?`alias=${f.string(d.name)}`:void 0,g=c?.property===d.name?`Literal[${f.literal(c.value)}]`:y(d.schema,s);if(d.required){let x=h===void 0?"":` = Field(${h})`;e.line(`${u}: ${g}${x}`)}else{let x=g.startsWith("Optional[")?g:`Optional[${g}]`,P=h===void 0?"None":`Field(default=None, ${h})`;e.line(`${u}: ${x} = ${P}`)}}if(o.length>0){e.blank(),e.line("# Python field name -> wire (JSON) name, for (de)serialization.");let d=o.map(([u,$])=>`"${u}": ${f.string($)}`).join(", ");e.line(`_field_map: ClassVar[Dict[str, str]] = {${d}}`)}}),e.blank(),e.blank()}function J(e,n="string",t="dataclass"){let s=new j,{pins:r,unions:a}=t==="pydantic"?z(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 c=["Any","AsyncIterator","Dict","Iterator","List","Literal","Optional","Tuple","Union"];t==="dataclass"&&c.splice(2,0,"ClassVar"),a.size>0&&c.unshift("Annotated"),s.line(`from typing import ${c.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 i=[];for(let{name:m,schema:l}of e.schemas){let o=ne(l);if(o!==void 0){let d=o.scalar==="string"?"str, Enum":"int, Enum";s.block(`class ${O(m)}(${d}):`,()=>{s.doc(l.description),o.values.forEach((u,$)=>{s.line(`${o.memberNames[$]} = ${f.literal(u)}`)})}),s.blank(),s.blank();continue}if(l.kind==="object"||l.kind==="intersection"){let d=B(l,e);if(d!==void 0){fe(s,m,d.properties,n,t,d.description??l.description,r.get(m));continue}}i.push(()=>{let d=T(l,e);if(d!==void 0){let h=d.cases.map(g=>`${g.value} -> ${O(g.schemaName)}`).join(", ");s.line(`# Discriminated by "${d.property}": ${h}`)}let u=a.get(m),$=u===void 0?y(l,n):`Annotated[${y(l,n)}, Field(discriminator=${f.string(u)})]`;s.line(`${O(m)} = ${$}`),s.blank()})}for(let m of i)m();return s.toString()}function pe(e,n){let t=[];for(let{name:s,schema:r}of e.schemas){if(n.has(s))continue;let a=T(r,e);if(a===void 0)continue;let c=a.cases.map(i=>`${f.string(i.value)}: ${O(i.schemaName)}`).join(", ");t.push(`DISCRIMINATORS[${O(s)}] = (${f.string(a.property)}, {${c}})`)}return t}var nn={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 Q(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}${k(r,{style:"snake",reserved:N})}.py`}var tn=({model:e,output:n,banner:t,emit:s,options:r,pagination:a})=>{let c=s.errorMode??"throw",i=s.dateType??"string",m=r?.models??"dataclass",l=m==="pydantic"?z(e):void 0,o=new j;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(m==="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(J(e,i,m).trimEnd()),o.blank(),o.blank(),de(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 p of Object.keys(U))o.line(`from ${p.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 p of Object.values(U)){let _=p.split(`
|
|
9
9
|
`).filter(b=>!b.startsWith("from __future__")&&!b.startsWith("from ._")).join(`
|
|
10
10
|
`).trim();o.line(_),o.blank()}o.blank()}let d=pe(e,new Set(l?.unions.keys()));if(d.length>0){o.line("# Discriminated unions dispatch by their property inside decode().");for(let p of d)o.line(p);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 u=new Map;for(let{op:p,ident:_}of I(e))u.set(_,ie(a?.get(p.name)?.spec));o.line("_OPERATIONS = {"),o.indent(()=>{for(let{op:p,ident:_}of I(e)){let b={id:p.specName??p.name,method:p.method.toUpperCase(),path:p.path,...K(p,e).length>0?{security:K(p,e)}:{},...u.get(_)!==void 0?{pagination:u.get(_)}:{}};o.line(`"${_}": ${ae(b)},`)}}),o.line("}"),o.blank(),o.blank();let $=s.serverUrl??e.serverUrl??"";V(o,e,c,!1,u,$,i),V(o,e,c,!0,u,$,i);let h={path:Q(n.path),content:o.toString()};if(s.runtime!=="module")return[h];let g=t.map(p=>`# ${p}`).join(`
|
|
@@ -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,b,c,d}from"./
|
|
7
|
+
import{a,b,c,d}from"./HSBHQBL2.js";import"./T3LLCSAJ.js";import"./G47ZYA3C.js";import"./LRUXN6H5.js";import"./MGBZEDQJ.js";import"./ZOVYQ36P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as DeploymentError,b as handlePushStatus,c as handleReuniteError,d as printSunsetWarning};
|
|
@@ -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,b,c,d,e,f}from"./
|
|
7
|
+
import{a,b,c,d,e,f}from"./2M6C5LHI.js";import"./2U6O26CV.js";import"./NV7DJMMF.js";import"./MU74CSJJ.js";import"./WZXA5XPB.js";import"./ZOVYQ36P.js";import"./NEWT5A6S.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{f as pythonDocs,d as pythonGenerator,c as pythonOptions,e as pythonSample,a as pythonType,b as renderPythonModels};
|
|
@@ -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{R as e,X as t}from"./
|
|
7
|
+
import{R as e,X as t}from"./ZOVYQ36P.js";function r({verificationUri:o,userCode:n}){t.output(`Attempting to automatically open the SSO authorization page in your default browser.
|
|
8
8
|
`),t.output(`If the browser does not open or you wish to use a different device to authorize this request, open the following URL:
|
|
9
9
|
|
|
10
10
|
`),t.output(e(o)),t.output(`
|
|
@@ -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
|
+
var e={realm:"@redocly/realm","redoc-revel":"@redocly/redoc-revel","revel-reef":"@redocly/revel-reef","redoc-reef":"@redocly/redoc-reef",redoc:"@redocly/redoc",revel:"@redocly/revel",reef:"@redocly/reef"},r={redoc:"Redoc",revel:"Revel",reef:"Reef",realm:"Realm","redoc-revel":"Redoc + Revel","redoc-reef":"Redoc + Reef","revel-reef":"Revel + Reef"},o=["pro","enterprise"];export{e as a,r as b,o as c};
|
|
@@ -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 c}from"./
|
|
7
|
+
import{a as c}from"./3W3OLLTF.js";import{h as s,l as a}from"./G47ZYA3C.js";import"./LRUXN6H5.js";import{P as t,X as e,ca as i}from"./ZOVYQ36P.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function y({argv:r,config:l,version:d}){let o=s(l,r.residency);try{let n=new a(d);r.verbose&&(e.info(`OAuth client initialized.
|
|
8
8
|
`),e.info(`Local credentials file path: ${n.credentialsFilePath}
|
|
9
9
|
`)),await n.login(o,c),e.output(t(`\u2705 Logged in
|
|
10
10
|
|
|
@@ -4,15 +4,15 @@ 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
|
|
8
|
-
`);let o=t.errorMode??"throw",i=t.dateType??"string";for(let a of e){let c=n.get(a);if(!c)throw new y(`Unknown generator: ${a}`);for(let d of c.requires??[])if(!s.has(d)){let f=[...new Set([d,...e])].map(
|
|
9
|
-
`)}}function
|
|
10
|
-
`),r.set(s,{});continue}r.set(s,
|
|
11
|
-
`),e.set(t.name,{run:t.run,sample:t.sample,docs:t.docs,notApplicable:t.notApplicable,options:t.options,requires:t.requires,errorModes:t.errorModes,dateTypes:t.dateTypes})}async function
|
|
12
|
-
`)}function
|
|
13
|
-
`),n.push({kind:"apiKeyCookie",key:r,cookieName:o.name}))}return n}function
|
|
14
|
-
`);let u=c&&(o||!v(a));return{name:i,schema:O(a,`${t}.${i}`,n),required:s.has(i),description:a.description,...u?{readOnly:!0}:{}}})}function
|
|
7
|
+
import{a as ee,b as te,f as ne,g as E,h as re}from"./MU74CSJJ.js";import{a as y}from"./WZXA5XPB.js";import{D as W,I as V,X as b,Z as Q,c as x,fa as Y,ha as T,oa as Z,r as v,s as H,t as J}from"./ZOVYQ36P.js";import{b as A,c as G,k as D}from"./LD5MEXEL.js";import{mkdir as ct,readFile as ut,writeFile as dt}from"node:fs/promises";import{dirname as ke,parse as ft,resolve as R,sep as pt}from"node:path";function M(e){return{requires:["typescript"],errorModes:["throw"],load:()=>import("./XJ7LVK2B.js").then(t=>({run:t.tanstackQueryGenerator(e)}))}}var U={outputMode:"it always emits one self-contained file",runtime:"the runtime is always embedded in the generated file",argsStyle:"inputs follow the target language's own idiom",importExt:"the generated file has no relative imports"},I={typescript:{load:()=>import("./MB5P3K2R.js").then(e=>({run:e.typescriptGenerator,sample:e.typescriptSample,docs:e.typescriptDocs}))},zod:{load:()=>import("./MS356BQ6.js").then(e=>({run:e.zodGenerator}))},transformers:{requires:["typescript"],dateTypes:["Date"],load:()=>import("./IULINGO6.js").then(e=>({run:e.transformersGenerator}))},"tanstack-query":M("react"),"tanstack-query-vue":M("vue"),"tanstack-query-svelte":M("svelte"),"tanstack-query-solid":M("solid"),swr:{requires:["typescript"],errorModes:["throw"],load:()=>import("./VTGQPPGI.js").then(e=>({run:e.swrGenerator}))},mock:{requires:["typescript"],load:()=>import("./UVP374Z3.js").then(e=>({run:e.mockGenerator}))},cli:{requires:["typescript","zod"],errorModes:["throw"],load:()=>import("./7ARFLNUA.js").then(e=>({run:e.cliGenerator,sample:e.cliSample,docs:e.cliDocs}))},python:{notApplicable:U,load:()=>import("./35XUUJLG.js").then(e=>({run:e.pythonGenerator,sample:e.pythonSample,docs:e.pythonDocs,options:e.pythonOptions}))},go:{errorModes:["throw"],notApplicable:U,load:()=>import("./JO2R43LS.js").then(e=>({run:e.goGenerator,sample:e.goSample,docs:e.goDocs}))},php:{errorModes:["throw"],notApplicable:U,load:()=>import("./BNT5BXON.js").then(e=>({run:e.phpGenerator,sample:e.phpSample,docs:e.phpDocs}))}};function oe(e,t,n,r){let s=new Set(e);t.goPackage!==void 0&&!s.has("go")&&b.warn(`generate-client: goPackage is ignored \u2014 it declares the Go package clause, and no selected generator uses it (add --generator go).
|
|
8
|
+
`);let o=t.errorMode??"throw",i=t.dateType??"string";for(let a of e){let c=n.get(a);if(!c)throw new y(`Unknown generator: ${a}`);for(let d of c.requires??[])if(!s.has(d)){let f=[...new Set([d,...e])].map(m=>`--generator ${m}`).join(" ");throw new y(`The "${a}" generator requires the "${d}" generator. Add it, e.g. ${f}.`)}if(c.errorModes&&!c.errorModes.includes(o))throw new y(`The "${a}" generator does not support --error-mode "${o}" (supported: ${c.errorModes.join(", ")}).`);if(c.dateTypes&&!c.dateTypes.includes(i))throw new y(`The "${a}" generator requires --date-type ${c.dateTypes.join(" or ")} (got "${i}") so the runtime values match the generated types.`);let u={...t,outputMode:r};for(let[d,f]of Object.entries(c.notApplicable??{}))u[d]!==void 0&&b.warn(`generate-client: the "${a}" generator ignores ${d} \u2014 ${f}.
|
|
9
|
+
`)}}function se(e,t,n){let r=new Map;for(let s of e){let o=t.get(s)?.options,i=n?.[s];if(o===void 0){i!==void 0&&b.warn(`generate-client: the "${s}" generator declares no options, so client.options.${s} is ignored.
|
|
10
|
+
`),r.set(s,{});continue}r.set(s,ve(s,o,i))}return r}function ve(e,t,n){if(n!==void 0&&!x(n))throw new y(`The "${e}" generator's options must be a map of option names to values.`);let r=n??{},s=Object.keys(t.properties);if(t.additionalProperties!==!0){for(let i of Object.keys(r))if(!s.includes(i))throw new y(`The "${e}" generator got an unknown option "${i}". Declared options: ${s.join(", ")||"(none)"}.`)}for(let i of t.required??[])if(r[i]===void 0)throw new y(`The "${e}" generator requires the "${i}" option.`);let o={...r};for(let[i,a]of Object.entries(t.properties)){if(o[i]===void 0){a.default!==void 0&&(o[i]=a.default);continue}let c=Se(a,o[i]);if(c!==void 0)throw new y(`The "${e}" generator's "${i}" ${c}.`)}return o}function Se(e,t){if("enum"in e)return e.enum.includes(t)?void 0:`must be one of: ${e.enum.join(", ")}`;if(e.type==="array"){let n=e.items.type;return Array.isArray(t)&&t.every(r=>typeof r===n)?void 0:`must be an array of ${n}`}return typeof t===e.type?void 0:`must be a ${e.type}`}import{isAbsolute as xe,resolve as qe}from"node:path";import{pathToFileURL as Pe}from"node:url";var Oe=function(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,r,s,o,i){return r?t?".jsx":".js":s&&(!o||!i)?n:s+o+"."+i.toLowerCase()+"js"}):e};async function ae(e,t={}){let n=new Map;for(let a of t.customGenerators??[])ce(n,a);let r=[];for(let a of e)r.push(await ie(a,n,t.configDir));let s=[],o=new Set,i=async a=>{if(!(s.includes(a)||o.has(a))){o.add(a);for(let c of n.get(a).requires??[])(n.has(c)||c in I)&&await i(await ie(c,n,t.configDir));o.delete(a),s.push(a)}};for(let a of r)await i(a);return{selected:s,registry:n}}async function ie(e,t,n){if(t.has(e))return e;let r=I[e];if(r!==void 0){let{load:o,...i}=r;return t.set(e,{...i,...await o()}),e}if(e==="sdk")throw new y('The "sdk" generator is now named "typescript". Update the `generators` list or the --generator flag.');let s=await je(e,n??process.cwd());return ce(t,s),s.name}function ce(e,t){if(!x(t)||typeof t.name!="string"||t.name===""||typeof t.run!="function")throw new y("Invalid custom generator: expected an object with a non-empty string `name` and a `run` function (build one with `defineGenerator`).");if(e.has(t.name))throw new y(`Generator name "${t.name}" collides with an existing generator. Rename the custom generator.`);if(t.requiresGenerator!==void 0){let n=re(E,t.requiresGenerator);if(n===void 0)throw new y(`Generator "${t.name}" declares requiresGenerator "${t.requiresGenerator}", which is not a range we read. Use ^1.2.0, ~1.2.0, >=1.2.0, or an exact version.`);if(!n)throw new y(`Generator "${t.name}" needs @redocly/client-generator ${t.requiresGenerator}; this CLI ships ${E}. Upgrade @redocly/cli if the generator is newer, or update the generator \u2014 \`redocly eject-generator <name> --update\` for an ejected file, or upgrade its package.`)}t.name in I&&b.warn(`generate-client: custom generator "${t.name}" takes over the built-in generator of the same name.
|
|
11
|
+
`),e.set(t.name,{run:t.run,sample:t.sample,docs:t.docs,notApplicable:t.notApplicable,options:t.options,requires:t.requires,errorModes:t.errorModes,dateTypes:t.dateTypes})}async function je(e,t){if(J(e))throw new y(`Remote generator modules are not supported \u2014 use a local path or a package name. Got: ${e}`);let n=e.startsWith(".")||xe(e),r=n?Pe(qe(t,e)).href:e;if(n&&e.endsWith(".ts")&&!process.features.typescript)throw new y(`Generator "${e}" is TypeScript, which this Node cannot run directly \u2014 use Node 22.18, 23.6, or newer.`);let s;try{s=await import(Oe(r))}catch(i){throw new y(`Could not load generator "${e}": ${i.message}`)}let o=s.default??s.generator;if(o===void 0)throw new y(`Generator module "${e}" must export a generator (a default export or a \`generator\` export built with \`defineGenerator\`).`);return o}function fe(e){let t=new Set,n=new Set,r=new Map;for(let l of e.securitySchemes){let h=C(l.key,t,n);h!==l.key&&(r.set(l.key,h),L("security scheme",l.key,h,de(l.key,t)),l.key=h)}let s=new Set(ne()),o=new Set(s),i=new Set,a=new Map;for(let l of e.schemas){let h=C(l.name,o,i);h!==l.name&&(a.set(l.name,h),L("schema",l.name,h,de(l.name,s)),l.name=h)}let c=l=>a.get(l)??ue(l),u=l=>r.get(l)??ue(l);for(let l of e.schemas)$(l.schema,c);let d=new Set(o),f=new Set,m=new Set;for(let l of e.services)for(let h of l.operations){let p=m.has(h.name);m.add(h.name);let g=h.name,P=C(h.name,d,f);if(P!==h.name){let j=p?{kind:"duplicate-operation-id"}:s.has(g)?{kind:"reserved"}:o.has(g)?{kind:"schema-collision"}:{kind:"unusable"};L("operation",g,P,j),h.specName=h.name,h.name=P}Ne(h,c),h.security=h.security.map(j=>j.map(u))}}function C(e,t,n){let r=G(e),s=r,o=2;for(;t.has(s)||n.has(D(s));)s=`${r}_${o++}`;return t.add(s),n.add(D(s)),s}function pe(e){for(let t of e.schemas)if(!A(t.name))throw B("schema",t.name);for(let t of e.securitySchemes)if(!A(t.key))throw B("security scheme",t.key);for(let t of e.services)for(let n of t.operations)if(!A(n.name))throw B("operation",n.name)}function B(e,t){return new Error(`Internal error: ${e} name ${JSON.stringify(t)} is not a safe identifier after sanitization.`)}function ue(e){return G(e)}function L(e,t,n,r){let s=JSON.stringify(t),o=JSON.stringify(n),i=r.kind==="duplicate-operation-id"?`two operations share the operationId ${s}; the second is emitted as ${o} \u2014 give each operation a unique operationId to control its method name`:r.kind==="schema-collision"?`${e} ${s} collides with the schema of the same name, so it is emitted as ${o} \u2014 rename the operation or the schema in the description to control its name`:r.kind==="reserved"?`${e} ${s} is a name a generated client already declares, so it is emitted as ${o} \u2014 the reserved set spans every target language, so one schema keeps one name across the SDKs you generate`:`${e} ${s} is not a usable identifier, so it is emitted as ${o}`;b.warn(`generate-client: ${i}.
|
|
12
|
+
`)}function de(e,t){return t.has(e)?{kind:"reserved"}:{kind:"unusable"}}function $(e,t){switch(e.kind){case"ref":e.name=t(e.name);break;case"omit":e.base=t(e.base);break;case"array":$(e.items,t);break;case"record":$(e.value,t);break;case"object":for(let n of e.properties)$(n.schema,t);break;case"union":for(let n of e.members)$(n,t);if(e.discriminator)for(let n of e.discriminator.mapping)n.schemaName=t(n.schemaName);break;case"intersection":for(let n of e.members)$(n,t);break}}function Ne(e,t){for(let n of e.pathParams)$(n.schema,t);for(let n of e.queryParams)$(n.schema,t);for(let n of e.headerParams)$(n.schema,t);for(let n of e.cookieParams)$(n.schema,t);e.requestBody&&$(e.requestBody.schema,t);for(let n of[...e.successResponses,...e.errorResponses])$(n.schema,t),n.itemSchema&&$(n.itemSchema,t)}var Ae=["get","post","put","delete","patch","head","options"];function me(e,t){if(!t.startsWith("#/"))throw new y(`External $ref not supported: ${t}`);let n=t.slice(2).split("/").map(s=>s.replace(/~1/g,"/").replace(/~0/g,"~")),r=e;for(let s of n){if(!x(r)&&!Array.isArray(r))throw new y(`Cannot resolve $ref: ${t}`);r=r[s]}if(r===void 0)throw new y(`Cannot resolve $ref: ${t}`);return r}function S(e,t){return v(t)?me(e,t.$ref):t}function N(e){let t=e.lastIndexOf("/");return t>=0?e.slice(t+1):e}function Me(e){let t=e,n={};return typeof t.minimum=="number"&&(n.minimum=t.minimum),typeof t.maximum=="number"&&(n.maximum=t.maximum),typeof t.exclusiveMinimum=="number"?n.exclusiveMinimum=t.exclusiveMinimum:t.exclusiveMinimum===!0&&typeof t.minimum=="number"&&(n.exclusiveMinimum=t.minimum,delete n.minimum),typeof t.exclusiveMaximum=="number"?n.exclusiveMaximum=t.exclusiveMaximum:t.exclusiveMaximum===!0&&typeof t.maximum=="number"&&(n.exclusiveMaximum=t.maximum,delete n.maximum),typeof t.minLength=="number"&&(n.minLength=t.minLength),typeof t.maxLength=="number"&&(n.maxLength=t.maxLength),typeof t.pattern=="string"&&(n.pattern=t.pattern),typeof t.minItems=="number"&&(n.minItems=t.minItems),typeof t.maxItems=="number"&&(n.maxItems=t.maxItems),t.uniqueItems===!0&&(n.uniqueItems=!0),typeof t.format=="string"&&(n.format=t.format),t.deprecated===!0&&(n.deprecated=!0),t.example!==void 0?n.example=t.example:Array.isArray(t.examples)&&t.examples.length>0&&(n.example=t.examples[0]),t.default!==void 0&&(n.default=t.default),Object.keys(n).length>0?n:void 0}function Ie(e,t){let n=e.discriminator;if(!n||typeof n.propertyName!="string")return;let r=[];if(n.mapping)for(let[s,o]of Object.entries(n.mapping))r.push({value:s,schemaName:N(o)});else for(let s of t)if(v(s)){let o=N(s.$ref);r.push({value:o,schemaName:o})}if(r.length!==0)return{propertyName:n.propertyName,mapping:r}}function k(e,t){return t?{...e,metadata:t}:e}function z(e,t){return e?t?{...e,...t}:e:t}function Re(e){return e?e.url.replace(/\{([^{}]+)\}/g,(t,n)=>e.variables?.[n]?.default??t):""}function he(e){let t=e.info?.title??"Api",n=e.info?.version??"0.0.0",r=e.info?.description,s=Re(e.servers?.[0]),o=(e.servers??[]).map(d=>({url:d.url,description:d.description,variables:Object.entries(d.variables??{}).map(([f,m])=>({name:f,default:m.default,description:m.description}))})),i=Be(e),a=Ue(e),c=Le(e,a),u={title:t,version:n,description:r,serverUrl:s,servers:o,services:c,schemas:i,securitySchemes:a};return fe(u),Te(c,i),pe(u),u}function Te(e,t){let n=new Map(t.map(r=>[r.name,r.schema]));for(let r of e)for(let s of r.operations)s.requestBody&&(s.requestBody.schema=Ge(s.requestBody.schema,n))}function Ee(e){let t=e.filter(n=>n.kind!=="unknown");return t.length>0?t:[{kind:"unknown"}]}function Ge(e,t){if(e.kind==="ref"){let n=De(e,t,new Set);return n.length>0?{kind:"omit",base:e.name,keys:n}:e}if(e.kind==="object"){let n=e.properties.filter(r=>!r.readOnly);return n.length===e.properties.length?e:{...e,properties:n}}return e}function De(e,t,n){let r=[],s=o=>{if(o.kind==="ref"){if(n.has(o.name))return;n.add(o.name);let i=t.get(o.name);i&&s(i)}else if(o.kind==="object")for(let i of o.properties)i.readOnly&&!r.includes(i.name)&&r.push(i.name);else if(o.kind==="intersection")for(let i of o.members)s(i)};return s(e),r}function Ue(e){let t=e.components?.securitySchemes;if(!t)return[];let n=[];for(let[r,s]of Object.entries(t)){let o=S(e,s),i=o.type;i==="oauth2"||i==="openIdConnect"?n.push({kind:"bearer",key:r}):i==="http"&&(o.scheme??"").toLowerCase()==="bearer"?n.push({kind:"bearer",key:r}):i==="http"&&(o.scheme??"").toLowerCase()==="basic"?n.push({kind:"basic",key:r}):i==="apiKey"&&o.in==="header"&&typeof o.name=="string"?n.push({kind:"apiKeyHeader",key:r,headerName:o.name}):i==="apiKey"&&o.in==="query"&&typeof o.name=="string"?n.push({kind:"apiKeyQuery",key:r,paramName:o.name}):i==="apiKey"&&o.in==="cookie"&&typeof o.name=="string"&&(b.warn(`generate-client: security scheme "${r}" sends its credential in the Cookie header, which browsers ignore \u2014 cookie auth works only in server-side clients.
|
|
13
|
+
`),n.push({kind:"apiKeyCookie",key:r,cookieName:o.name}))}return n}function Ce(e,t,n){let r=e.security??t.security;if(!r)return[];let s=[];for(let o of r){let i=Object.keys(o);i.length!==0&&i.every(a=>n.has(a))&&s.push([...new Set(i)])}return s}function Be(e){let t=e.components?.schemas;return t?Object.entries(t).map(([n,r])=>{if(v(r)){let o=me(e,r.$ref);return{name:n,schema:q(o,`components.schemas.${n}`,e),description:o.description}}let s=q(r,`components.schemas.${n}`,e);return{name:n,schema:s,description:r.description}}):[]}function Le(e,t){let n=new Set(t.map(i=>i.key)),r=[],s=new Set;for(let[i,a]of Object.entries(e.paths??{})){if(!a)continue;let c=S(e,a),u=(c.parameters??[]).map(d=>ye(S(e,d),`paths.${i}.parameters`,e));for(let d of Ae){let f=c[d];f&&(r.push({method:d,path:i,operation:f,pathLevelParams:u}),f.operationId&&s.add(f.operationId))}}return[{name:"Default",operations:r.map(i=>{let a=i.operation.operationId??_e(ze(i.method,i.path),s);return Fe(i.method,i.path,i.operation,a,i.pathLevelParams,e,n)})}]}function ze(e,t){let n=t.split("/").filter(Boolean).map(r=>Ke(r.replace(/[{}]/g,"")));return`${e}${n.join("")}`}function Ke(e){return e.split(/[^A-Za-z0-9]+/).filter(Boolean).map(t=>t[0].toUpperCase()+t.slice(1)).join("")}function _e(e,t){let n=e,r=2;for(;t.has(n);)n=`${e}${r++}`;return t.add(n),n}function Fe(e,t,n,r,s,o,i){let a=(n.parameters??[]).map(w=>ye(S(o,w),`paths.${t}.${e}.parameters`,o)),c=new Set,u=[];for(let w of a)c.add(`${w.in}:${w.name}`),u.push(w);for(let w of s)c.has(`${w.in}:${w.name}`)||u.push(w);let d=u.filter(w=>w.in==="path"),f=u.filter(w=>w.in==="query"),m=u.filter(w=>w.in==="header"),l=u.filter(w=>w.in==="cookie"),h=n.requestBody?He(S(o,n.requestBody),`${e} ${t}`,o):void 0,{successResponses:p,successResponseHeaders:g}=Je(n,t,o),P=Ve(n,t,o),j=Ce(n,o,i),F=n["x-redoclyPagination"],X=Xe(p);return{name:r,method:e,path:t,summary:n.summary,description:n.description,pathParams:d,queryParams:f,headerParams:m,cookieParams:l,requestBody:h,successResponses:p,...g===void 0?{}:{successResponseHeaders:g},errorResponses:P,security:j,tags:Array.isArray(n.tags)?n.tags.filter(w=>typeof w=="string"):[],...F!==void 0?{paginationExtension:F}:{},...X===void 0?{}:{sse:X}}}function Xe(e){let t=e.find(s=>s.contentType.split(";")[0].trim().toLowerCase()==="text/event-stream");if(t===void 0)return;let n=t.itemSchema&&t.itemSchema.kind!=="unknown"?t.itemSchema:t.schema.kind!=="unknown"?t.schema:void 0;if(n===void 0)return{dataKind:"text"};let r=n.kind==="object"||n.kind==="ref"||n.kind==="array"||n.kind==="record"||n.kind==="union"||n.kind==="intersection";return{eventSchema:n,dataKind:r?"json":"text"}}function ye(e,t,n){if(!e.in)throw new y(`Parameter ${e.name} at ${t} is missing "in"`);if(!["path","query","header","cookie"].includes(e.in))throw new y(`Unsupported parameter location "${e.in}" for ${e.name} at ${t}`);let r=O(e.schema,`${t}.${e.name}`,n);e.deprecated===!0&&(r={...r,metadata:z(r.metadata,{deprecated:!0})});let s={name:e.name,in:e.in,schema:r,required:!!e.required,description:e.description};if(s.in==="query"){let o=e;(o.style==="form"||o.style==="spaceDelimited"||o.style==="pipeDelimited"||o.style==="deepObject")&&(s.style=o.style),typeof o.explode=="boolean"&&(s.explode=o.explode),typeof o.allowReserved=="boolean"&&(s.allowReserved=o.allowReserved)}return s}function He(e,t,n){let r=e.content??{},s=r["application/json"]??r["application/merge-patch+json"]??r["application/x-www-form-urlencoded"]??r["multipart/form-data"]??Object.values(r)[0];if(!s)return;let o=Object.keys(r).find(a=>r[a]===s),i=O(s.schema,`${t}.requestBody`,n);return{contentType:o,schema:i,required:!!e.required,description:e.description}}function Je(e,t,n){let r=e.responses??{},s=Object.keys(r).filter(m=>/^2\d\d$/.test(m));s.length===0&&(r["2XX"]?s.push("2XX"):r.default&&s.push("default"));let o=s[0];if(!o)return{successResponses:[]};let i=r[o];if(!i)return{successResponses:[]};let a=S(n,i),c=We(a.headers,`paths.${t}.response.${o}`,n),u=a.content;if(!u)return{successResponses:[],...c===void 0?{}:{successResponseHeaders:c}};let d=o==="default"||o==="2XX"?o:Number(o),f=[];for(let[m,l]of Object.entries(u)){let h=O(l.schema,`paths.${t}.response.${o}.${m}`,n),p=l.itemSchema,g=p!==void 0?O(p,`paths.${t}.response.${o}.${m}.itemSchema`,n):void 0;f.push({contentType:m,schema:h,status:d,...g===void 0?{}:{itemSchema:g}})}return{successResponses:f,...c===void 0?{}:{successResponseHeaders:c}}}function We(e,t,n){if(!e)return;let r=[];for(let[s,o]of Object.entries(e)){let i=S(n,o),a={name:s.toLowerCase(),schema:O(i.schema===void 0?void 0:S(n,i.schema),`${t}.headers.${s}`,n)};i.required===!0&&(a.required=!0),r.push(a)}return r.length>0?r:void 0}function Ve(e,t,n){let r=e.responses??{},s=Object.keys(r).filter(a=>/^([45]\d\d|4XX|5XX)$/.test(a));Object.keys(r).some(a=>/^(2\d\d|2XX)$/.test(a))&&r.default&&s.push("default");let i=[];for(let a of s){let c=r[a];if(!c)continue;let d=S(n,c).content;if(!d)continue;let f=a==="default"||a==="4XX"||a==="5XX"?a:Number(a);for(let[m,l]of Object.entries(d)){let h=O(l.schema,`paths.${t}.response.${a}.${m}`,n);i.push({contentType:m,schema:h,status:f})}}return i}function O(e,t,n){return e===void 0||typeof e=="boolean"?{kind:"unknown"}:v(e)?{kind:"ref",name:N(e.$ref)}:q(e,t,n)}function q(e,t,n){let r=Me(e),s=e.oneOf??e.anyOf;if(s){let a=s.map((d,f)=>v(d)?{kind:"ref",name:N(d.$ref)}:q(d,`${t}.[${f}]`,n)),c=Ee(a);if(c.length===1&&c.length<a.length){let d=c[0];return{...d,description:d.description??e.description,metadata:z(r,d.metadata)}}let u=Ie(e,s);return k({kind:"union",members:c,discriminator:u,description:e.description},r)}if(e.allOf){let a=e.allOf.map((u,d)=>v(u)?{kind:"ref",name:N(u.$ref)}:q(u,`${t}.allOf[${d}]`,n)),c=le(e,t,n);if(c.length>0&&a.unshift({kind:"object",properties:c}),a.length===1){let u=a[0];return{...u,description:u.description??e.description,metadata:z(r,u.metadata)}}return k({kind:"intersection",members:a,description:e.description},r)}let o=e.type;if(Array.isArray(o)){let a=o.filter(d=>d!=="null"),c=o.includes("null"),u=a.map(d=>{let f={...e,type:d};if(Array.isArray(f.enum)){let m=f.enum.filter(l=>l!==null);f.enum=m.length>0?m:void 0}return q(f,t,n)});return c&&u.push({kind:"null"}),u.length===1?u[0]:k({kind:"union",members:u,description:e.description},r)}if(e.nullable)return{kind:"union",members:[q({...e,nullable:void 0},t,n),{kind:"null"}],description:e.description};if(e.const!==void 0){let a=e.const;if(typeof a!="string"&&typeof a!="number"&&typeof a!="boolean")throw new y(`Unsupported const value at ${t}: ${JSON.stringify(a)}`);return k({kind:"literal",value:a,description:e.description},r)}if(e.enum){let a=e.enum,c=a.filter(m=>m!==null),u=c.length!==a.length;if(c.length===0)return k({kind:"null",description:e.description},r);let d=Qe(c,t),f=d==="boolean"?{kind:"scalar",scalar:"boolean",description:e.description}:{kind:"enum",values:c,scalar:d,description:e.description};return k(u?{kind:"union",members:[f,{kind:"null"}],description:e.description}:f,r)}let i=o;if(i==="null")return k({kind:"null",description:e.description},r);if(i==="array"){let a=e.items,c=O(a,`${t}.items`,n);return k({kind:"array",items:c,description:e.description},r)}if(i==="object"||e.properties||e.additionalProperties){let a=le(e,t,n),c=e.additionalProperties;if(a.length===0&&c!==!1){let u=O(c,`${t}.additionalProperties`,n);return k({kind:"record",value:u,description:e.description},r)}return k({kind:"object",properties:a,description:e.description},r)}return k(i==="string"||i==="number"||i==="integer"||i==="boolean"?{kind:"scalar",scalar:i,description:e.description}:{kind:"unknown",description:e.description},r)}function Qe(e,t){let n=!1,r=!1,s=!1;for(let o of e)if(typeof o=="string")n=!0;else if(typeof o=="number")r=!0;else if(typeof o=="boolean")s=!0;else throw new y(`Unsupported enum value type at ${t}: ${JSON.stringify(o)}`);return n&&!r&&!s?"string":r&&!n&&!s?"number":s&&!n&&!r?"boolean":"string"}function Ye(e){return!(e.openapi??"").startsWith("3.0")}function le(e,t,n){let r=e.properties??{},s=new Set(e.required??[]),o=Ye(n);return Object.entries(r).map(([i,a])=>{let c=a.readOnly===!0;c&&v(a)&&!o&&b.warn(`generate-client: "${i}" declares readOnly beside a $ref, which OpenAPI ${n.openapi} ignores \u2014 the property stays in request bodies. Inline the schema, wrap the $ref in allOf, or move the description to OpenAPI 3.1.
|
|
14
|
+
`);let u=c&&(o||!v(a));return{name:i,schema:O(a,`${t}.${i}`,n),required:s.has(i),description:a.description,...u?{readOnly:!0}:{}}})}function ge(e){let t=K(e),n={...t};delete n.swagger,delete n.host,delete n.basePath,delete n.schemes,delete n.definitions,delete n.securityDefinitions,delete n.consumes,delete n.produces,delete n.parameters,delete n.responses,n.openapi="3.0.3";let r=Ze(t);return r&&(n.servers=r),n.components=et(t),n.paths=ot(t.paths??{},t.consumes??void 0,t.produces??void 0),n}function Ze(e){let t=e.host,n=e.basePath??"",r=(e.schemes??["https"])[0]??"https";if(t)return[{url:`${r}://${t}${n}`}]}function et(e){let t={};e.definitions&&(t.schemas=e.definitions),e.parameters&&(t.parameters=Object.fromEntries(Object.entries(e.parameters).map(([r,s])=>[r,_(s)]))),e.responses&&(t.responses=be(e.responses,void 0));let n=e.securityDefinitions;if(n){let r={};for(let[s,o]of Object.entries(n))r[s]=tt(o);t.securitySchemes=r}return t}function tt(e){switch(e.type){case"basic":return{type:"http",scheme:"basic"};case"apiKey":return{type:"apiKey",name:e.name,in:e.in};case"oauth2":{let t=e.flow==="accessCode"?"authorizationCode":e.flow==="application"?"clientCredentials":e.flow,n={scopes:e.scopes??{}};return e.authorizationUrl&&(n.authorizationUrl=e.authorizationUrl),e.tokenUrl&&(n.tokenUrl=e.tokenUrl),{type:"oauth2",flows:{[t]:n}}}default:return e}}function K(e){if(Array.isArray(e))return e.map(K);if(x(e)){let t={};for(let[n,r]of Object.entries(e))n==="$ref"&&typeof r=="string"?t.$ref=r.replace("#/definitions/","#/components/schemas/").replace("#/parameters/","#/components/parameters/").replace("#/responses/","#/components/responses/"):t[n]=K(r);return t}return e}var nt="application/json",rt="application/json",we=new Set(["name","in","required","description","deprecated","allowEmptyValue","collectionFormat"]);function ot(e,t,n){let r={};for(let[s,o]of Object.entries(e)){let i=o,a={};for(let[c,u]of Object.entries(i)){if(c==="parameters"&&Array.isArray(u)){a.parameters=u.map(_);continue}if(!st(c)){a[c]=u;continue}a[c]=it(u,t,n)}r[s]=a}return r}function st(e){return["get","put","post","delete","options","head","patch"].includes(e.toLowerCase())}function it(e,t,n){let r=e.consumes??t,s=e.produces??n,o=e.parameters??[],i=o.find(f=>f.in==="body"),a=o.filter(f=>f.in==="formData"),c=o.filter(f=>f.in!=="body"&&f.in!=="formData").map(_),u={...e,parameters:c};delete u.consumes,delete u.produces;let d=r?.[0]??nt;if(i)u.requestBody={required:!!i.required,content:{[d]:{schema:i.schema}}};else if(a.length>0){let f={},m=[];for(let p of a)f[p.name]=at(p),p.required&&m.push(p.name);let l={type:"object",properties:f};m.length>0&&(l.required=m);let h=r?.find(p=>p==="multipart/form-data")??r?.[0]??"application/x-www-form-urlencoded";u.requestBody={required:m.length>0,content:{[h]:{schema:l}}}}return e.responses&&(u.responses=be(e.responses,s)),u}function _(e){if(e.$ref!==void 0||e.in==="body"||e.in==="formData")return e;let t={},n={};for(let[r,s]of Object.entries(e))we.has(r)?t[r]=s:n[r]=s;if(t.schema=n,delete t.collectionFormat,e.in==="query"&&n.type==="array"){let r=e.collectionFormat??"csv";r!=="multi"&&(t.style=r==="ssv"?"spaceDelimited":r==="pipes"?"pipeDelimited":"form",t.explode=!1)}return t}function at(e){let t={};for(let[n,r]of Object.entries(e))we.has(n)||(t[n]=r);return t}function be(e,t){let n=t?.[0]??rt,r={};for(let[s,o]of Object.entries(e)){let i=o;if(i.schema===void 0){r[s]=i;continue}let{schema:a,...c}=i;r[s]={...c,content:{[n]:{schema:a}}}}return r}async function $e(e,t){let n=t??await T({}),r=await Y({ref:e,config:n}),s=await T({rules:{struct:"error"}}),o=await Z({externalRefResolver:new V,document:r.bundle,config:s}),i=[...r.problems,...o].filter(c=>c.severity==="error");if(i.length>0){let c=i.map(u=>`- ${u.message} (at ${u.location?.[0]?.pointer??e})`).join(`
|
|
15
15
|
`);throw new Error(`The API description has ${i.length} error(s):
|
|
16
|
-
${c}`)}let a=r.bundle.parsed;return{document:a,version:
|
|
17
|
-
`),n}function
|
|
18
|
-
`)}}function
|
|
16
|
+
${c}`)}let a=r.bundle.parsed;return{document:a,version:Q(a)}}var lt=["Generated by @redocly/client-generator \u2014 do not edit by hand.","Source: OpenAPI description. Re-run `redocly generate-client` to update."];function mt(e,t){let n=[],r=new Set,s=R(ke(t.outputPath)),{dir:o,name:i,ext:a}=ft(t.outputPath),c={path:t.outputPath,dir:o,stem:i,ext:a},u=lt,d=!1;for(let f of t.generators){let m=t.registry.get(f),l={model:e,output:c,banner:u,outputMode:t.outputMode,emit:t.emit,pagination:t.pagination,selected:t.generators,options:t.generatorOptions?.get(f)??{}},h;try{t.emit.docs===!0&&m.docs!==void 0?(h=[...m.run(l),...m.docs(l)],d=!0):h=m.run(l)}catch(p){let g=p instanceof Error?p.message:String(p);throw new Error(`Generator "${f}" failed: ${g}`)}if(!Array.isArray(h)||h.some(p=>typeof p?.path!="string"||p.path===""||typeof p.content!="string"))throw new Error(`Generator "${f}" failed: run() must return an array of { path, content } files.`);for(let p of h){let g=R(s,p.path);if(g!==s&&!g.startsWith(s+pt))throw new Error(`Generator "${f}" failed: file path escapes the output directory: ${p.path}`);if(r.has(g))throw new Error(`Generator conflict: ${p.path} already emitted by an earlier generator`);r.add(g),n.push({path:g,content:p.content})}}return t.emit.docs===!0&&!d&&b.warn(`generate-client: docs is on, but no selected generator writes documentation (${t.generators.join(", ")}).
|
|
17
|
+
`),n}function ht(e){for(let t of e.services)for(let n of t.operations){let r=new Set,s=new Set;for(let o of[...n.pathParams,...n.queryParams,...n.headerParams,...n.cookieParams])r.has(o.name)&&s.add(o.name),r.add(o.name);s.size!==0&&b.warn(`generate-client: operation "${n.specName??n.name}" uses ${[...s].map(o=>`"${o}"`).join(", ")} in more than one parameter location. Every SDK sends both, and the SDKs whose methods take one argument per parameter give the later one a suffixed name \u2014 rename it in the description to choose the name yourself.
|
|
18
|
+
`)}}function yt(e,t,n,r,s,o,i){let a=[],c=new Set;for(let u of ee(t.services)){let d=gt(e,u.path,u.method);if(c.has(d))continue;c.add(d);let f=r.map(m=>s.get(m)?.sample?.(u,{model:t,emit:n,outputPath:o,pagination:i})).filter(m=>m!==void 0);f.length>0&&a.push({target:d,update:{"x-codeSamples":f}})}if(a.length!==0)return W({overlay:"1.0.0",info:{title:`Code samples for ${t.title}`,version:t.version},actions:a})}function gt(e,t,n){let r=i=>`['${i.replaceAll("\\","\\\\").replaceAll("'","\\'")}']`,s=e.paths?.[t];return`${v(s)&&s.$ref.startsWith("#/")?"$"+s.$ref.slice(2).split("/").map(H).map(r).join(""):`$.paths${r(t)}`}.${n}`}async function nn(e){if(e.output.split(/[\\/]/).some(p=>p==="undefined"||p==="null"))throw new Error(`output path "${e.output}" contains a literal "undefined" or "null" segment \u2014 this looks like an interpolation bug in the caller`);if(e.setup&&/^[a-z][a-z0-9+.-]+:/i.test(e.setup))throw new y(`setup must be a local file path \u2014 remote setup modules are not supported (got: ${e.setup})`);let t=R(e.output),{document:n,version:r}=await $e(e.api,e.config),s=r==="oas2"?ge(n):n,o=he(s);ht(o);let i;if(e.setup){let{bakeSetup:p}=await import("./CQMMUWIJ.js"),g=R(e.configDir??process.cwd(),e.setup);i=p(await ut(g,"utf-8"))}let a=e.generators?.length?e.generators:["typescript"],{selected:c,registry:u}=await ae(a,{customGenerators:e.customGenerators,configDir:e.configDir}),d=te(o,e.pagination),f={serverUrl:e.serverUrl,argsStyle:e.argsStyle,errorMode:e.errorMode,dateType:e.dateType,mockData:e.mockData,mockSeed:e.mockSeed,queryKeyPrefix:e.queryKeyPrefix,setup:i,runtime:e.runtime,importExt:e.importExt,goPackage:e.goPackage,pagination:d,docs:e.docs,docsFrontmatter:e.docsFrontmatter};oe(c,f,u,e.outputMode);let m=se(c,u,e.options),l=mt(o,{outputPath:t,outputMode:e.outputMode??"single",emit:f,pagination:d,generators:c,generatorOptions:m,registry:u});if(e.codeSamples===!0){let p=yt(n,o,f,c,u,t,d);p!==void 0&&l.push({path:t.replace(/\.[^.]+$/,".code-samples.yaml"),content:p})}let h=[];for(let p of l)await ct(ke(p.path),{recursive:!0}),await dt(p.path,p.content,"utf-8"),h.push({path:p.path,bytes:Buffer.byteLength(p.content,"utf-8")});return{outputPath:t,bytes:h.reduce((p,g)=>p+g.bytes,0),files:h}}export{I as a,oe as b,mt as c,nn as d};
|
|
@@ -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
|
+
var e=["get","put","post","delete","options","head","patch","trace","query"],s=["schemas","responses","parameters","examples","headers","requestBodies","links","callbacks","securitySchemes"];export{e as a,s as b};
|