@redocly/cli 2.61.0 → 2.62.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 +22 -1
- package/lib/chunks/{FAIK7Y6U.js → 23KTTVIR.js} +1 -1
- package/lib/chunks/{B6HOY6AV.js → 2XK7ML3U.js} +1 -1
- package/lib/chunks/{7FLYZDPU.js → 37WWN4MA.js} +1 -1
- package/lib/chunks/{3VI3PRNZ.js → 3C6UUCEW.js} +1 -1
- package/lib/chunks/{ZOE6CZ74.js → 3DEJQSYG.js} +1 -1
- package/lib/chunks/{47H7SS4U.js → 3JYY42DL.js} +1 -1
- package/lib/chunks/{FAZWASU6.js → 3M4FKKBI.js} +1 -1
- package/lib/chunks/5NOJ76EP.js +9 -0
- package/lib/chunks/{IKDYY4XW.js → 5S5OMDQZ.js} +1 -1
- package/lib/chunks/{6ETCN64B.js → 5UYYEBJY.js} +1 -1
- package/lib/chunks/{V5CIDI6D.js → 5YW5LAGV.js} +1 -1
- package/lib/chunks/{WSOBFTCE.js → 6EGJEFXO.js} +1 -1
- package/lib/chunks/{F6IXS3RL.js → 6NB3FKVN.js} +8 -8
- package/lib/chunks/{DNQSGL2N.js → 7YNVVBUW.js} +1 -1
- package/lib/chunks/{SFNDGMJM.js → AB2EMYEK.js} +1 -1
- package/lib/chunks/{MXOINKB2.js → B64RMZSV.js} +1 -1
- package/lib/chunks/{PSEWUH36.js → BX2H6D2W.js} +1 -1
- package/lib/chunks/{OXA7GLZA.js → DBBMGF4W.js} +1 -1
- package/lib/chunks/{GJDVFWVH.js → G55KF2JU.js} +1 -1
- package/lib/chunks/{HHJX3B7U.js → GVQMC2WB.js} +1 -1
- package/lib/chunks/{GGRILIN6.js → HBENVUR4.js} +1 -1
- package/lib/chunks/{6NGWHZCB.js → ID2DJAJI.js} +1 -1
- package/lib/chunks/{QFJ6QZPG.js → KQ5RN67Y.js} +1 -1
- package/lib/chunks/{GZ7EDJXV.js → L3H2DSRP.js} +1 -1
- package/lib/chunks/LNYTDBAU.js +12 -0
- package/lib/chunks/{MK6X55UC.js → LVGVWPDB.js} +1 -1
- package/lib/chunks/{2KG4GEMM.js → LWPTRXNP.js} +1 -1
- package/lib/chunks/{YEOWW3LR.js → NBI4EQPC.js} +1 -1
- package/lib/chunks/{SZVRKEMY.js → O7F2NBMC.js} +3 -3
- package/lib/chunks/{6GH5BRNP.js → P7MVM2ZA.js} +1 -1
- package/lib/chunks/{7RZON3J3.js → PRSNVDUV.js} +1 -1
- package/lib/chunks/{ZH5HJBCG.js → QMIOB64K.js} +1 -1
- package/lib/chunks/{DDAZZC3I.js → QWPV64G2.js} +1 -1
- package/lib/chunks/{E5BMYA7V.js → REIGI2Y7.js} +1 -1
- package/lib/chunks/{LR2FZ43E.js → RGU6OZYB.js} +1 -1
- package/lib/chunks/{2WJSVZYJ.js → RUIEI3YV.js} +1 -1
- package/lib/chunks/{LXU55G2P.js → S6NFOZ34.js} +1 -1
- package/lib/chunks/SOI7RTB4.js +8 -0
- package/lib/chunks/{JP2RKFML.js → SXBAAS4M.js} +1 -1
- package/lib/chunks/{WCWEP2X5.js → U77FTE2C.js} +1 -1
- package/lib/chunks/{6L6AYZQS.js → UFZ7VJKO.js} +1 -1
- package/lib/chunks/{ERFYZ47T.js → UWK3L6LB.js} +1 -1
- package/lib/chunks/{6ZVVKLZR.js → VE45GKNY.js} +1 -1
- package/lib/chunks/{RPQMBRTA.js → VXLODB3S.js} +1 -1
- package/lib/chunks/{KVXNE2UB.js → W3G6AQCC.js} +1 -1
- package/lib/chunks/{45DZYRBQ.js → WPIZQQ5C.js} +1 -1
- package/lib/chunks/{HBPMIV7U.js → XJTGJYVS.js} +1 -1
- package/lib/chunks/{MAHMSXK6.js → XVZ7A34Y.js} +1 -1
- package/lib/chunks/{IMYWYFYT.js → Y5AAEFMH.js} +1 -1
- package/lib/chunks/YDVWNFMS.js +24 -0
- package/lib/chunks/{GLOLLUKD.js → YINR7LU6.js} +1 -1
- package/lib/chunks/{FUH5ZFZ2.js → YPYZCXVX.js} +1 -1
- package/lib/chunks/{3QZ3M2JX.js → ZJYDDU5M.js} +1 -1
- package/lib/chunks/{MUKYSFRK.js → ZNQTCB4Q.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 +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 +31 -31
- package/package.json +1 -1
- package/lib/chunks/3TBVUHVH.js +0 -9
- package/lib/chunks/IRHTRVFK.js +0 -22
|
@@ -5443,4 +5443,4 @@ async function runSingle(
|
|
|
5443
5443
|
}
|
|
5444
5444
|
return fail(1, detail);
|
|
5445
5445
|
}
|
|
5446
|
-
}`},S=["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","SseOptions","SseParseError","TRANSIENT_STATUS","ThrowMethod","TimeoutError","TokenProvider","abortError","acceptFor","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","toFormData","toHeaderRecord"];var j=["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"],N=["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"],w;function Q(){return w===void 0&&(w=new Set([...j,...$,...N,...S])),w}var A={name:"@redocly/client-generator",version:"0.5.
|
|
5446
|
+
}`},S=["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","SseOptions","SseParseError","TRANSIENT_STATUS","ThrowMethod","TimeoutError","TokenProvider","abortError","acceptFor","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","toFormData","toHeaderRecord"];var j=["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"],N=["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"],w;function Q(){return w===void 0&&(w=new Set([...j,...$,...N,...S])),w}var A={name:"@redocly/client-generator",version:"0.5.2",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.62.1"},peerDependencies:{typescript:">=5.5.0"},peerDependenciesMeta:{typescript:{optional:!0}},devDependencies:{typescript:"6.0.2"},files:["lib","eject-assets"]};var ee=A.version;function T(e){let n=/^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e.trim());return n===null?void 0:[Number(n[1]),Number(n[2]),Number(n[3])]}function v(e,n){return e[0]-n[0]||e[1]-n[1]||e[2]-n[2]}function ne(e,n){let s=/^[\^~]|^>=/.exec(n.trim())?.[0]??"",r=T(n.trim().slice(s.length)),a=T(e);if(!(r===void 0||a===void 0))return v(a,r)<0?!1:s===">="?!0:s===""?v(a,r)===0:s==="~"?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]:v(a,r)===0}export{C as a,H as b,G as c,W as d,j as e,Q as f,ee as g,ne as h};
|
|
@@ -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}from"./
|
|
7
|
+
import{a,b}from"./HBENVUR4.js";import"./6NB3FKVN.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as bundleTelemetry,b as handleBundle};
|
|
@@ -4,31 +4,31 @@ 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{$ as
|
|
8
|
-
${q(s)} ${
|
|
7
|
+
import{$ as P,O as D,P as h,Q as O,U as C,aa as j,ba as S,ca as f,d as E,e as A,f as $,ga as b,ia as o,l,oa as a,u}from"./22EANOP2.js";var y=["json","yaml","yml"];import*as i from"node:fs";import{basename as T,dirname as d,extname as g,join as N,resolve as m,relative as R}from"node:path";import*as p from"node:process";import{performance as F}from"perf_hooks";async function te(e,n){let r=!A(e)&&$(n.resolvedConfig.apis)?G(n):await W(e,n),c=r.filter(({path:s})=>!z(s));if(A(c)){for(let{path:s}of c)o.warn(`
|
|
8
|
+
${q(s)} ${P(`does not exist or is invalid.
|
|
9
9
|
|
|
10
|
-
`)}`);throw new a("Please provide a valid path.")}if(r.length===0)throw new a("No APIs were provided. Specify an API via the command argument or define one in your config.");return r}function w(e){return e.configPath?d(e.configPath):
|
|
10
|
+
`)}`);throw new a("Please provide a valid path.")}if(r.length===0)throw new a("No APIs were provided. Specify an API via the command argument or define one in your config.");return r}function w(e){return e.configPath?d(e.configPath):p.cwd()}function z(e){if(!e.trim())throw new a("Path cannot be empty.");return i.existsSync(e)||u(e)?e:void 0}function G(e){return Object.entries(e.resolvedConfig.apis||{}).map(([n,{root:t,output:r}])=>({path:u(t)?t:m(w(e),t),alias:n,output:r&&m(w(e),r)}))}function k(e,n){let t=w(e),r=e.resolvedConfig.apis?.[n];return r?{path:u(r.root)?r.root:m(t,r.root),alias:n,output:r.output&&m(t,r.output)}:{path:n,alias:Object.entries(e.resolvedConfig.apis||{}).find(([c,s])=>m(t,s.root)===m(n))?.[0]??void 0}}async function W(e,n){let{hasMagic:t,glob:r}=await import("./SJHPKWSD.js");return(await Promise.all(e.map(async c=>t(c)&&!u(c)?(await r(c,{cwd:w(n)})).map(I=>k(n,I)):k(n,c)))).flat()}function L(e){return p.env.NODE_ENV==="test"?"<test>ms":`${Math.ceil(F.now()-e)}ms`}function oe(e,n,t){let r=L(n);o.info(b(`
|
|
11
11
|
${t}: ${e} processed in ${r}
|
|
12
12
|
|
|
13
|
-
`))}function se(e,n){return e==="/"?n:e.replaceAll("~1","/").replaceAll("~0","~").replace(/^\//,"").replaceAll("/",n)}function ie(e){return e.replace(/#/g,"_sharp").replace(/\//,"_").replace(/\s/g,"")}function ae(e){return{php:".php","c#":".cs",shell:".sh",curl:".sh",bash:".sh",javascript:".js",js:".js",python:".py",c:".c","c++":".cpp",coffeescript:".litcoffee",dart:".dart",elixir:".ex",go:".go",groovy:".groovy",java:".java",kotlin:".kt","objective-c":".m",perl:".pl",powershell:".ps1",ruby:".rb",rust:".rs",scala:".sc",swift:".swift",typescript:".ts",tsx:".tsx","visual basic":".vb","c/al":".al"}[e.toLowerCase()]??""}var
|
|
13
|
+
`))}function se(e,n){return e==="/"?n:e.replaceAll("~1","/").replaceAll("~0","~").replace(/^\//,"").replaceAll("/",n)}function ie(e){return e.replace(/#/g,"_sharp").replace(/\//,"_").replace(/\s/g,"")}function ae(e){return{php:".php","c#":".cs",shell:".sh",curl:".sh",bash:".sh",javascript:".js",js:".js",python:".py",c:".c","c++":".cpp",coffeescript:".litcoffee",dart:".dart",elixir:".ex",go:".go",groovy:".groovy",java:".java",kotlin:".kt","objective-c":".m",perl:".pl",powershell:".ps1",ruby:".rb",rust:".rs",scala:".sc",swift:".swift",typescript:".ts",tsx:".tsx","visual basic":".vb","c/al":".al"}[e.toLowerCase()]??""}var x=class e extends Error{constructor(t){super(t.message);this.originalError=t;Object.setPrototypeOf(this,e.prototype)}originalError};function ce(e,n,t){if(n==="json")try{return JSON.stringify(e,null,2)}catch(r){throw r.message.indexOf("circular")>-1?new x(r):r}else return h(e,{noRefs:!t,lineWidth:-1})}function pe(e,n){i.mkdirSync(d(e),{recursive:!0}),i.writeFileSync(e,n)}function le(e){return D(i.readFileSync(e,"utf-8"),{filename:e})}function ue(e,n,t){if(_(n)==="json"){Y(e,n);return}V(e,n,t)}function V(e,n,t=!1){let r=h(e,{noRefs:t});if(p.env.NODE_ENV==="test"){o.info(r);return}i.mkdirSync(d(n),{recursive:!0}),i.writeFileSync(n,r)}function Y(e,n){let t=JSON.stringify(e,null,2);if(p.env.NODE_ENV==="test"){o.info(t);return}i.mkdirSync(d(n),{recursive:!0}),i.writeFileSync(n,t)}function _(e){let n=e.split(".").pop();return y.includes(n)?n:(o.warn(`Unsupported file extension: ${n}. Using yaml.
|
|
14
14
|
`),"yaml")}function fe(e,n){switch(e.constructor){case a:throw e;case C:throw new a(`Failed to resolve API description at ${n}:
|
|
15
15
|
|
|
16
16
|
- ${e.message}`);case O:throw new a(`Failed to parse API description at ${n}:
|
|
17
17
|
|
|
18
|
-
- ${e.message}`);case
|
|
18
|
+
- ${e.message}`);case x:throw new a(`Detected circular reference which can't be converted to JSON.
|
|
19
19
|
Try to use ${f("yaml")} output or remove ${f("--dereferenced")}.`);case SyntaxError:throw new a(`Syntax error: ${e.message} ${e.stack?.split(`
|
|
20
20
|
|
|
21
21
|
`)?.[0]}`);default:throw new a(`Something went wrong when processing ${n}:
|
|
22
22
|
|
|
23
|
-
- ${e.message}`)}}function me(e,n){let t=e.ignored?
|
|
23
|
+
- ${e.message}`)}}function me(e,n){let t=e.ignored?S(`${e.ignored} ${l("problem is",e.ignored)} explicitly ignored.
|
|
24
24
|
|
|
25
25
|
`):"";e.errors>0?o.error(`\u274C Validation failed with ${e.errors} ${l("error",e.errors)}${e.warnings>0?` and ${e.warnings} ${l("warning",e.warnings)}`:""}.
|
|
26
26
|
${t}`):e.warnings>0?(o.info(j(`Woohoo! Your API ${l("description is",n)} valid. \u{1F389}
|
|
27
27
|
`)),o.warn(`You have ${e.warnings} ${l("warning",e.warnings)}.
|
|
28
28
|
${t}`)):o.info(j(`Woohoo! Your API ${l("description is",n)} valid. \u{1F389}
|
|
29
29
|
${t}`)),e.errors>0&&o.info(b("run `redocly lint --generate-ignore-file` to add all problems to the ignore file.\n")),o.info(`
|
|
30
|
-
`)}function ge({entrypoint:e,output:n,argvOutput:t,ext:r,entries:
|
|
30
|
+
`)}function ge({entrypoint:e,output:n,argvOutput:t,ext:r,entries:c}){let s=n||t;if(!s)return{ext:r||"yaml"};if(c>1&&t){if(r=r||g(e).substring(1),!y.includes(r))throw new Error(`Invalid file extension: ${r}.`);s=N(t,T(e,g(e)))+"."+r}else{if(r=r||g(s).substring(1)||g(e).substring(1),!y.includes(r))throw new Error(`Invalid file extension: ${r}.`);s=N(d(s),T(s,g(s)))+"."+r}return{outputFile:s,ext:r}}function de(e){let{preprocessors:n,rules:t,decorators:r}=e.getUnusedRules();t.length&&o.warn(`[WARNING] Unused rules found in ${f(e.configPath||"")}: ${t.join(", ")}.
|
|
31
31
|
`),n.length&&o.warn(`[WARNING] Unused preprocessors found in ${f(e.configPath||"")}: ${n.join(", ")}.
|
|
32
32
|
`),r.length&&o.warn(`[WARNING] Unused decorators found in ${f(e.configPath||"")}: ${r.join(", ")}.
|
|
33
33
|
`),(t.length||n.length)&&o.warn(`Check the spelling and verify the added plugin prefix.
|
|
34
|
-
`)}function B(e){return e.asyncapi?.startsWith("2")}var U=["swagger","info","host","basePath","schemes","consumes","produces","security","tags","externalDocs","paths","definitions","parameters","responses","securityDefinitions"],K=["openapi","info","jsonSchemaDialect","servers","security","tags","externalDocs","paths","webhooks","x-webhooks","components"],J=["asyncapi","id","info","externalDocs","tags","defaultContentType","servers","channels","components"],M=["asyncapi","info","defaultContentType","servers","channels","operations","components"];function ye(e){return"asyncapi"in e?B(e)?v(e,J):v(e,M):"swagger"in e?v(e,U):v(e,K)}function v(e,n){let t={};for(let r of n)e.hasOwnProperty(r)&&(t[r]=e[r]);return Object.assign(t,e)}function ve(e){let n={...e.oas2,...e.oas3_0,...e.oas3_1,...e.oas3_2,...e.async2,...e.async3,...e.arazzo1,...e.overlay1,...e.openrpc1,...e.graphql};if(E(n))throw new a("\u26A0\uFE0F No rules were configured. Learn how to configure rules: https://redocly.com/docs/cli/rules/")}function we(e){return e.replace(/\x1b\[\d+m/g,"")}function q(e){return u(e)?e:R(
|
|
34
|
+
`)}function B(e){return e.asyncapi?.startsWith("2")}var U=["swagger","info","host","basePath","schemes","consumes","produces","security","tags","externalDocs","paths","definitions","parameters","responses","securityDefinitions"],K=["openapi","info","jsonSchemaDialect","servers","security","tags","externalDocs","paths","webhooks","x-webhooks","components"],J=["asyncapi","id","info","externalDocs","tags","defaultContentType","servers","channels","components"],M=["asyncapi","info","defaultContentType","servers","channels","operations","components"];function ye(e){return"asyncapi"in e?B(e)?v(e,J):v(e,M):"swagger"in e?v(e,U):v(e,K)}function v(e,n){let t={};for(let r of n)e.hasOwnProperty(r)&&(t[r]=e[r]);return Object.assign(t,e)}function ve(e){let n={...e.oas2,...e.oas3_0,...e.oas3_1,...e.oas3_2,...e.async2,...e.async3,...e.arazzo1,...e.overlay1,...e.openrpc1,...e.graphql};if(E(n))throw new a("\u26A0\uFE0F No rules were configured. Learn how to configure rules: https://redocly.com/docs/cli/rules/")}function we(e){return e.replace(/\x1b\[\d+m/g,"")}function q(e){return u(e)?e:R(p.cwd(),e)}export{y as a,te as b,w as c,k as d,L as e,oe as f,se as g,ie as h,ae as i,ce as j,pe as k,le as l,ue as m,_ as n,fe as o,me as p,ge as q,de as r,ye as s,ve as t,we as u,q as v};
|
|
@@ -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"./5YW5LAGV.js";import{c as w}from"./22EANOP2.js";import{a as H,e as q,g as P,h as g,k as E}from"./LD5MEXEL.js";import{join as ae}from"node:path";var j=class{code;constructor(r){this.code=r}};function A(e,r,n={}){let t=new Map(r.map(s=>[s.name,s.schema])),o=k(e,t,new Set,n.dateType??"string");return o===b?null:o}var b=Symbol("cycle");function J(e,r){if(e.kind==="union"){for(let t of e.members){let o=J(t,r);if(o)return o}return}if(e.kind!=="scalar")return;let n=e.metadata?.format;if(n==="binary")return new j("new Blob([])");if(r==="Date"){if(n==="date-time")return new j('new Date("2024-01-01T00:00:00Z")');if(n==="date")return new j('new Date("2024-01-01")')}}function I(e,r){let n=new Map,t=[],o=!1;for(let s of e){if(s.kind==="unknown")continue;let i=G(s,r);if(i?.kind!=="object"){t.push(s);continue}o=!0;for(let a of i.properties){let u=O(a.schema,r,new Set),c=n.get(a.name);(c===void 0||u>=c.rank)&&n.set(a.name,{schema:a.schema,required:a.required||(c?.required??!1),rank:u})}}return o?{merged:{kind:"object",properties:[...n.entries()].map(([s,i])=>({name:s,schema:i.schema,required:i.required}))},rest:t}:{merged:void 0,rest:t}}function G(e,r){let n=new Set,t=e;for(;t?.kind==="ref";){if(n.has(t.name))return;n.add(t.name),t=r.get(t.name)}return t}function O(e,r,n){switch(e.kind){case"literal":return 40;case"enum":return e.values.length===1?40:30;case"union":return Math.max(0,...e.members.map(t=>O(t,r,n)))-1;case"ref":{if(n.has(e.name))return 20;let t=r.get(e.name);return t===void 0?20:O(t,r,new Set(n).add(e.name))}case"null":case"unknown":return 10;default:return 20}}function k(e,r,n,t){let o=J(e,t);if(o)return o;let s=e.metadata,i=a=>a===null?e.kind==="null"||e.kind==="union"&&e.members.some(u=>u.kind==="null"):e.kind==="enum"?e.values.includes(a):e.kind==="literal"?a===e.value:!0;if(s?.example!==void 0&&i(s.example))return s.example;if(s?.default!==void 0&&i(s.default))return s.default;switch(e.kind){case"scalar":return K(e.scalar,s);case"array":{let a=k(e.items,r,n,t);return a===b?[]:[a]}case"object":return Object.fromEntries(e.properties.flatMap(a=>{let u=k(a.schema,r,n,t);return u===b?a.required?[[a.name,null]]:[]:[[a.name,u]]}));case"record":{let a=k(e.value,r,n,t);return a===b?{}:{key:a}}case"enum":return e.values[0];case"literal":return e.value;case"union":{for(let a of e.members){let u=k(a,r,n,t);if(u!==b)return u}return e.members.length>0?b:null}case"intersection":{let{merged:a,rest:u}=I(e.members,r),c=u.map(m=>k(m,r,n,t)).filter(m=>m!==b);if(a){let m=k(a,r,n,t),M=w(m)?m:{};for(let V of c)w(V)&&Object.assign(M,V);return M}let h=c.filter(w);return h.length>0?h.reduce((m,M)=>Object.assign(m,M),{}):c.length>0?c[0]:{}}case"omit":{let a=r.get(e.base);if(!a)return null;let u=k(a,r,n,t);if(w(u)){let c={...u};for(let h of e.keys)delete c[h];return c}return u}case"ref":{if(n.has(e.name))return b;let a=r.get(e.name);if(!a)return null;n.add(e.name);let u=k(a,r,n,t);return n.delete(e.name),u}case"null":case"unknown":return null}}function K(e,r){if(e==="boolean")return!0;if(e==="integer"||e==="number")return 0;switch(r?.format){case"email":return"user@example.com";case"uuid":return"00000000-0000-4000-8000-000000000000";case"date-time":return"2024-01-01T00:00:00Z";case"date":return"2024-01-01";case"uri":case"url":return"https://example.com";default:return"string"}}var f=e=>({kind:"expr",text:e}),d=e=>({kind:"object",entries:e});function l(e){return e.kind==="object"}function D(e,r){return l(e)?d([...e.entries,{spread:r}]):e}var L=" ";function x(e,r){switch(e.kind){case"expr":return e.text;case"wrap":return`${e.before}${x(e.value,r)}${e.after}`;case"array":{if(e.items.length===0)return"[]";let n=r+L;return`[
|
|
8
8
|
${e.items.map((o,s)=>`${n}${x(o,n)}${s===e.items.length-1?"":","}`).join(`
|
|
9
9
|
`)}
|
|
10
10
|
${r}]`}case"object":{if(e.entries.length===0)return"{}";let n=r+L;return`{
|
|
@@ -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,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w}from"./
|
|
7
|
+
import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w}from"./5NOJ76EP.js";import"./LRUXN6H5.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{j as InvalidReuniteUrlError,f as REUNITE_URLS,l as RedoclyOAuthClient,k as RedoclyOAuthDeviceFlow,c as ReuniteApi,b as ReuniteApiClient,a as ReuniteApiError,o as collectFilesToPush,u as evaluatePluginsFromCode,r as fetchRemoteScorecardAndPlugins,e as getApiKeys,g as getDomain,d as getMostUrgentSunsetWarning,p as getPushStatus,h as getReuniteUrl,t as getTarget,v as isAllowedScorecardProjectUrl,i as isValidReuniteUrl,n as pushFiles,s as resolveConfigForTarget,m as resolveProjectRef,w as validateScorecard,q as waitForDeployment};
|
|
@@ -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 g,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A,m as D,n as E,o as F,p as H,q as I}from"./
|
|
7
|
+
import{a as g,b as q,c as r,d as s,e as t,f as u,g as v,h as w,i as x,j as y,k as z,l as A,m as D,n as E,o as F,p as H,q as I}from"./UWK3L6LB.js";import{a as B,e as C,g as G}from"./5YW5LAGV.js";import{a}from"./WZXA5XPB.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import{a as b,b as c,c as d,d as e,e as f,f as h,g as i,h as j,i as k,j as l,k as m,l as n,m as o,n as p}from"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{z as AUTHORING_HELPER_NAMES,G as GENERATOR_VERSION,a as NotSupportedError,b as Printer,d as RESERVED_WORDS,C as WIRING_NAMES,B as allOperations,c as casing,E as constantCase,A as defineClientSetup,H as defineGenerator,h as deref,j as discriminatorCases,n as docText,m as enumValues,i as flattenAllOf,I as generateClient,D as groupSlug,p as headerCoerceType,e as identifierFor,u as isBinaryContentType,s as isMultipartBody,k as isNullable,t as isUntypedMultipartBody,q as jsonSuccessSchema,F as mergeConfig,x as paginationItemSchema,g as paginationRuleFor,y as renderReferencePage,o as resolveSchemaPointer,o as schemaAtPointer,w as securityRequirements,v as serverUrlParts,r as sseResponse,f as uniqueIdentifiers,l as unwrapNullable};
|
|
@@ -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"./KQ5RN67Y.js";import"./UWK3L6LB.js";import"./5YW5LAGV.js";import"./WZXA5XPB.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as zodGenerator};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as $,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"./XVZ7A34Y.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,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{b as a,c as b,d as c}from"./
|
|
7
|
+
import{b as a,c as b,d as c}from"./P7MVM2ZA.js";import"./XJE2OFDN.js";import"./XVZ7A34Y.js";import"./UFZ7VJKO.js";import"./UWK3L6LB.js";import"./5YW5LAGV.js";import"./WZXA5XPB.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as cliDocs,a as cliGenerator,c as cliSample};
|
|
@@ -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 T,b as O,c as A,d as E}from"./
|
|
7
|
+
import{a as T,b as O,c as A,d as E}from"./YDVWNFMS.js";import{c as m,k as C,r as $}from"./KRCCY64H.js";import{a as q}from"./LRUXN6H5.js";import{c as H,ia as u,oa as y,pa as R}from"./22EANOP2.js";import"./NEWT5A6S.js";import{e as z}from"./RFWIIJFG.js";import{createReadStream as F,createWriteStream as k,existsSync as N}from"node:fs";import{appendFile as V,mkdir as _,rm as j,writeFile as W}from"node:fs/promises";import B from"node:path";import{createInterface as G}from"node:readline";var w=class{outputPath;entriesPath;creatorVersion;writeChain=Promise.resolve();directoryEnsured=!1;started=!1;count=0;constructor(t,r){this.outputPath=B.resolve(process.cwd(),t),this.entriesPath=`${this.outputPath}.entries.tmp`,this.creatorVersion=r}get entryCount(){return this.count}add(t){let r=`${JSON.stringify(t)}
|
|
8
8
|
`,n=this.writeChain.catch(()=>{}).then(()=>this.append(r)).then(()=>{this.count+=1});return this.writeChain=n.catch(()=>{}),n}async finalize(){await this.writeChain.catch(()=>{}),await this.ensureDirectory(),await this.writeDocument(),await j(this.entriesPath,{force:!0})}async append(t){if(await this.ensureDirectory(),!this.started){await W(this.entriesPath,t,"utf8"),this.started=!0;return}await V(this.entriesPath,t,"utf8")}async ensureDirectory(){this.directoryEnsured||(await _(B.dirname(this.outputPath),{recursive:!0}),this.directoryEnsured=!0)}async writeDocument(){let t=k(this.outputPath,{encoding:"utf8"}),r=n=>new Promise((o,s)=>{t.write(n,i=>i?s(i):o())});try{let n=JSON.stringify({name:"redocly-cli proxy",version:this.creatorVersion});await r(`{
|
|
9
9
|
"log": {
|
|
10
10
|
"version": "1.2",
|
|
@@ -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{b as S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./
|
|
7
|
+
import{b as S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./6NB3FKVN.js";import{aa as y,ba as $,ca as i,ga as u,ia as n,pa as k,ra as T,u as O,va as B,wa as E}from"./22EANOP2.js";import{writeFileSync as L}from"fs";import{resolve as j}from"path";import{performance as q}from"perf_hooks";var P={};async function Y({argv:e,config:l,version:W,collectSpecData:G}){let A=await S(e.apis,l),a={errors:0,warnings:0,ignored:0},I=N(l);for(let{path:o,alias:c,output:J}of A)try{let d=q.now(),p=l.forAlias(c);p.skipPreprocessors(e["skip-preprocessor"]),p.skipDecorators(e["skip-decorator"]);let m=e.overlay??p.resolvedConfig.overlays?.map(t=>O(t)?t:j(I,t));m?.length&&(P.bundle_overlays_count=(P.bundle_overlays_count??0)+m.length),c===void 0?n.info(u(`bundling ${s(o)}...
|
|
8
8
|
`)):n.info(u(`bundling ${s(o)} using configuration for api '${c}'...
|
|
9
9
|
`));let{bundle:D,problems:w,...x}=await T({ref:o,config:p,dereference:e.dereferenced,removeUnusedComponents:e["remove-unused-components"],keepUrlRefs:e["keep-url-references"],componentRenamingConflicts:e["component-renaming-conflicts-severity"],componentNamesStrategy:e["component-names-strategy"],overlays:m,collectSpecData:G}),r=B(w),{outputFile:f,ext:K}=F({entrypoint:o,output:J,argvOutput:e.output,ext:e.ext,entries:e?.apis?.length||0});if(r.errors===0||e.force)if(f){let t=g(b(D.parsed),K,e.dereferenced);_(f,t)}else{let t=g(b(D.parsed),e.ext||"yaml",e.dereferenced);n.output(t)}a.errors+=r.errors,a.warnings+=r.warnings,a.ignored+=r.ignored,E(w,{format:"codeframe",totals:r,version:W,command:"bundle"}),e.metafile&&(A.length>1&&n.warn('[WARNING] "--metafile" cannot be used with multiple apis. Skipping...'),L(e.metafile,JSON.stringify(x),"utf-8"));let h=R(d);r.errors>0?e.force?n.info(`\u2753 Created a bundle for ${i(s(o))} at ${i(f||"stdout")} with errors ${y(h)}.
|
|
10
10
|
${$("Errors ignored because of --force")}.
|
|
@@ -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}from"./
|
|
7
|
+
import{a,b,c,d,e}from"./QWPV64G2.js";import"./XJE2OFDN.js";import"./UWK3L6LB.js";import"./5YW5LAGV.js";import"./WZXA5XPB.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{e as phpDocs,c as phpGenerator,d as phpSample,a as phpType,b as renderPhpModels};
|
|
@@ -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 h}from"./
|
|
7
|
+
import{a as h}from"./5YW5LAGV.js";import{e as g,h as p,k as $}from"./LD5MEXEL.js";import{join as R}from"node:path";var a=" ";function m(e){return`${$(e)}Schema`}var y=new Map;function u(e,r=y,t=""){return j(w(e,r,t),e)}function w(e,r,t){switch(e.kind){case"scalar":return z(e.scalar,e.metadata);case"object":return b(e.properties,r,t);case"array":return`z.array(${u(e.items,r,t)})`;case"record":return`z.record(z.string(), ${u(e.value,r,t)})`;case"ref":return`z.lazy(() => ${m(e.name)})`;case"literal":return`z.literal(${p(e.value)})`;case"enum":return q(e.values);case"union":return k(e.members,r,t);case"intersection":return e.members.map(n=>u(n,r,t)).reduce((n,o)=>`${n}.and(${o})`);case"null":return"z.null()";case"unknown":return"z.unknown()";case"omit":return E(e.base,e.keys,r,t)}}function z(e,r){switch(e){case"string":return r?.format==="binary"?"z.instanceof(Blob)":"z.string()";case"integer":return"z.number().int()";case"number":return"z.number()";case"boolean":return"z.boolean()"}}function c(e){return g(e)===e?e:JSON.stringify(e)}function b(e,r,t){if(e.length===0)return"z.object({})";let n=t+a;return`z.object({
|
|
8
8
|
${e.map((s,i)=>{let d=u(s.schema,r,n),l=s.required?d:`${d}.optional()`,x=i===e.length-1?"":",";return`${n}${c(s.name)}: ${l}${x}`}).join(`
|
|
9
9
|
`)}
|
|
10
10
|
${t}})`}function q(e){return e.every(r=>typeof r=="string")?`z.enum([${e.map(r=>JSON.stringify(r)).join(", ")}])`:`z.union([${e.map(r=>`z.literal(${p(r)})`).join(", ")}])`}function k(e,r,t){let n=e.map(o=>u(o,r,t));return n.length===1?n[0]:`z.union([${n.join(", ")}])`}function E(e,r,t,n){let o=t.get(e);if(o&&o.kind!=="object")return u(f(o,r,t,new Set([e])),t,n);let s=r.map(i=>`${c(i)}: true`).join(", ");return`${m(e)}.omit({ ${s} })`}function f(e,r,t,n){switch(e.kind){case"object":return{...e,properties:e.properties.filter(o=>!r.includes(o.name))};case"union":case"intersection":return{...e,members:e.members.map(o=>f(o,r,t,n))};case"ref":{if(n.has(e.name))return e;let o=t.get(e.name);if(!o)return e;if(o.kind==="object"){let s=r.filter(i=>o.properties.some(d=>d.name===i));return s.length>0?{kind:"omit",base:e.name,keys:s}:e}return f(o,r,t,new Set([...n,e.name]))}default:return e}}function j(e,r){let t=r.metadata;if(!t)return e;let n=e;return r.kind==="scalar"&&r.scalar==="string"&&(t.minLength!==void 0&&(n=`${n}.min(${t.minLength})`),t.maxLength!==void 0&&(n=`${n}.max(${t.maxLength})`),t.pattern!==void 0&&(n=`${n}.regex(new RegExp(${JSON.stringify(t.pattern)}))`)),r.kind==="scalar"&&(r.scalar==="number"||r.scalar==="integer")&&(t.minimum!==void 0&&(n=`${n}.min(${t.minimum})`),t.maximum!==void 0&&(n=`${n}.max(${t.maximum})`),t.exclusiveMinimum!==void 0&&(n=`${n}.gt(${t.exclusiveMinimum})`),t.exclusiveMaximum!==void 0&&(n=`${n}.lt(${t.exclusiveMaximum})`)),r.kind==="array"&&(t.minItems!==void 0&&(n=`${n}.min(${t.minItems})`),t.maxItems!==void 0&&(n=`${n}.max(${t.maxItems})`)),n}function Z(e,r){let t=[];for(let n of h(e.services)){if(n.sse!==void 0)continue;let o=n.requestBody,s=o&&o.contentType.toLowerCase().includes("json")?u(o.schema,r,a):void 0,i=n.successResponses.find(l=>l.contentType.toLowerCase().includes("json")),d=i?u(i.schema,r,a):void 0;!s&&!d||t.push({name:n.specName??n.name,request:s,response:d})}return t}function I(e){let r=e.flatMap(n=>[`${a}${c(n.name)}: {`,...n.request?[`${a}${a}request: z.ZodType;`]:[],...n.response?[`${a}${a}response: z.ZodType;`]:[],`${a}};`]),t=e.map((n,o)=>{let s=[...n.request?[`request: ${n.request}`]:[],...n.response?[`response: ${n.response}`]:[]].join(", "),i=o===e.length-1?"":",";return`${a}${c(n.name)}: { ${s} }${i}`});return["/**"," * Request/response validators by operationId \u2014 powers `zodValidation`, or import one directly."," */","export const operationSchemas: {",...r,"} = {",...t,"};"].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,e}from"./
|
|
7
|
+
import{a,b,c,d,e}from"./5UYYEBJY.js";import"./XJE2OFDN.js";import"./UWK3L6LB.js";import"./5YW5LAGV.js";import"./WZXA5XPB.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{e as goDocs,c as goGenerator,d as goSample,a as goType,b as renderGoModels};
|
|
@@ -0,0 +1,12 @@
|
|
|
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{i as c,l as a}from"./5NOJ76EP.js";import"./LRUXN6H5.js";import{ia as s}from"./22EANOP2.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function g({operation:i,input:r,version:n}){let t=await l(r),e=`${t.protocol}://${t.host}`;if(i!=="get"||!c(e))return"";let o=process.env.REDOCLY_AUTHORIZATION||await new a(n).getAccessToken(e);return o?`username=redocly
|
|
8
|
+
password=${o}
|
|
9
|
+
`:(s.error(`You are not logged in to ${e}. Run \`redocly login --residency ${e}\` or set the REDOCLY_AUTHORIZATION environment variable.
|
|
10
|
+
`),`quit=1
|
|
11
|
+
`)}async function l(i){let r="";for await(let t of i)r+=t.toString();let n={};for(let t of r.split(`
|
|
12
|
+
`)){let[,e,o]=t.match(/^([^=]+)=(.*)$/)??[];e&&(n[e]=o)}return n}export{g as handleProjectGitCredentials};
|
|
@@ -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{b as k,f as v}from"./
|
|
7
|
+
import{b as k,f as v}from"./6NB3FKVN.js";import{L as A,M as S,N as y,V as f,W as w,da as d,ha as l,ia as n,ka as x,la as h,ma as O,oa as g,q as u,ra as b,w as p}from"./22EANOP2.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as F}from"perf_hooks";function I(o){let t=Object.fromEntries(Object.entries(o).map(([s,{metric:e,total:r,counts:a}])=>[s,{metric:e,total:r,counts:a}]));n.output(JSON.stringify(t,null,2))}function P(o){let t=`| Feature | Count |
|
|
8
8
|
| --- | --- |
|
|
9
9
|
`,s=[];for(let{metric:e,total:r,counts:a}of Object.values(o)){t+=`| ${e} | ${r} |
|
|
10
10
|
`;let c=Object.entries(a??{});c.length&&s.push(`
|
|
@@ -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"./23KTTVIR.js";import"./XVZ7A34Y.js";import"./UFZ7VJKO.js";import"./UWK3L6LB.js";import"./5YW5LAGV.js";import"./WZXA5XPB.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as tanstackQueryGenerator};
|
|
@@ -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{l as t}from"./
|
|
7
|
+
import{l as t}from"./5NOJ76EP.js";import"./LRUXN6H5.js";import{ia as o}from"./22EANOP2.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function i({version:n}){new t(n).logout(),o.output(`Logged out from the Redocly account. \u270B
|
|
8
8
|
`)}export{i as handleLogout};
|
|
@@ -4,10 +4,10 @@ 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 l,b as v,c as U,d as F,e as R}from"./U5DIFWGH.js";import{b as O}from"./
|
|
7
|
+
import{a as l,b as v,c as U,d as F,e as R}from"./U5DIFWGH.js";import{b as O}from"./6NB3FKVN.js";import{ba as k,c as G,ca as $,ga as S,ia as b,l as P,oa as g}from"./22EANOP2.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{readFileSync as z}from"node:fs";import{mkdir as H,writeFile as B}from"node:fs/promises";import{basename as T,dirname as A,extname as I,isAbsolute as N,relative as j,resolve as f}from"node:path";var V=/^[a-z][a-z0-9+.-]+:/i;function L(e,n){let{setup:o}=e;if(typeof o!="string")return e;if(V.test(o))throw new g(`
|
|
8
8
|
\u274C \`client.setup\` must be a local file path \u2014 remote setup modules are not supported.
|
|
9
9
|
Got: ${o}
|
|
10
|
-
`);return N(o)?e:{...e,setup:f(n,o)}}function q(e){return`${e.replace(/[\\/]/g,"_")}.client.ts`}function D(e){if(e.startsWith("//"))return!1;if(e.startsWith("/"))return!0;try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}async function ie({argv:e,config:n}){let{AUTHORING_HELPER_NAMES:o,generateClient:c,mergeConfig:m}=await import("./
|
|
10
|
+
`);return N(o)?e:{...e,setup:f(n,o)}}function q(e){return`${e.replace(/[\\/]/g,"_")}.client.ts`}function D(e){if(e.startsWith("//"))return!1;if(e.startsWith("/"))return!0;try{let n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}async function ie({argv:e,config:n}){let{AUTHORING_HELPER_NAMES:o,generateClient:c,mergeConfig:m}=await import("./B64RMZSV.js"),t=n.configPath?A(n.configPath):process.cwd(),s={serverUrl:e["server-url"],outputMode:e["output-mode"],runtime:e.runtime,importExt:e["import-ext"],goPackage:e["go-package"],argsStyle:e["args-style"],errorMode:e["error-mode"],dateType:e["date-type"],mockData:e["mock-data"],mockSeed:e["mock-seed"],docs:e.docs,generators:e.generator?.map(a=>a.startsWith(".")?f(a):a),setup:e.setup===void 0?void 0:L({setup:e.setup},process.cwd()).setup},r=n.resolvedConfig.apis??{},i=Object.keys(r).filter(a=>G(r[a].client)||r[a].clientOutput!==void 0);if(e.api===void 0){if(e.output)throw new g("\n\u274C --output can't target multiple APIs. Set `clientOutput` under each api in redocly.yaml, or pass a single <api>.\n");if(i.length===0)throw new g("\n\u274C No API to generate. Add a `client` block or `clientOutput` under an `apis:` entry, or pass <api> (a file/URL or an `apis:` alias).\n")}let u=await O(e.api===void 0?i:[e.api],n),p={config:n,configDir:t,cliFlags:s,outputFlag:e.output,toolkit:{generateClient:c,mergeConfig:m,helperNames:o},seenOutputs:new Set,composable:[]};for(let a of u)await J(a,p);let y=G(n.resolvedConfig.client)?n.resolvedConfig.client:{};y.cliOutput!==void 0&&e.api===void 0&&p.composable.length>0&&await K(y.cliOutput,p)}async function J(e,{config:n,configDir:o,cliFlags:c,outputFlag:m,toolkit:t,seenOutputs:s,composable:r}){let{path:i,alias:u}=e,p=u??T(i,I(i)),y=n.forAlias(u),{client:a,clientOutput:E}=y.resolvedConfig,W=L(G(a)?a:{},o),h=t.mergeConfig(W,c);Q(h.generators??[],t.helperNames,o);let C=m!==void 0?f(m):E!==void 0?f(o,E):f(o,q(p));if(!C.endsWith(".ts"))throw new g(`
|
|
11
11
|
\u274C output must point at a TypeScript file (ending in .ts).
|
|
12
12
|
Got: ${C}
|
|
13
13
|
`);if(s.has(C))throw new g(`
|
|
@@ -23,7 +23,7 @@ import{a as l,b as v,c as U,d as F,e as R}from"./U5DIFWGH.js";import{b as O}from
|
|
|
23
23
|
`)}catch(d){let w=d instanceof Error?d.message:String(d);throw l.generate_client_error_category=R(w),new g(`
|
|
24
24
|
\u274C Failed to generate client for ${p}.
|
|
25
25
|
${w}
|
|
26
|
-
`)}}async function K(e,{configDir:n,seenOutputs:o,composable:c}){let{renderComposedCliEntry:m}=await import("./
|
|
26
|
+
`)}}async function K(e,{configDir:n,seenOutputs:o,composable:c}){let{renderComposedCliEntry:m}=await import("./WPIZQQ5C.js"),t=f(n,e);if(!t.endsWith(".ts"))throw new g(`
|
|
27
27
|
\u274C client.cliOutput must point at a TypeScript file (ending in .ts).
|
|
28
28
|
Got: ${t}
|
|
29
29
|
`);if(o.has(t))throw new g(`
|
|
@@ -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{h as g}from"./
|
|
7
|
+
import{h as g}from"./UFZ7VJKO.js";import{f as C,m as u,n as p}from"./UWK3L6LB.js";import{c as j,d as v}from"./5YW5LAGV.js";import{ia as b}from"./22EANOP2.js";import{a as S,b as k}from"./UW4UC7ZI.js";import{join as $}from"node:path";function h(r){return(r??"").replace(/\s+/g," ").trim().replace(/\\/g,"\\\\").replace(/\|/g,"\\|")}function w(r){return[r.group===void 0?void 0:u(r.group),r.name].filter(Boolean).join(" ")}function T(r,e){return[r,w(e),...e.positionals.map(o=>`<${o.name}>`),...e.flags.filter(o=>o.required).map(o=>`--${o.name} <${o.type}>`),...e.body?[e.body.required?"--json '<json>'":"[--json '<json>']"]:[]].filter(o=>o!=="").join(" ")}function B(r,e){r.line("| Flag | Type | Required | Description |"),r.line("| ---- | ---- | -------- | ----------- |");for(let n of e){let o=[h(n.description),n.enum===void 0?"":`One of ${n.enum.map(t=>`\`${t}\``).join(", ")}.`,n.type==="array"?"Repeat the flag for multiple values.":""].filter(t=>t!=="").join(" ");r.line(`| \`--${n.name}\` | ${n.type} | ${n.required?"yes":"no"} | ${o} |`)}r.blank()}function D(r,e,n){if(r.line(`### \`${w(e)}\``),r.blank(),e.summary!==void 0&&(r.line(h(e.summary)),r.blank()),r.line(`\`${e.method} ${e.path}\``),r.blank(),r.line("```sh"),r.line(T(n.name,e)),r.line("```"),r.blank(),e.positionals.length>0){r.line("| Argument | Description |"),r.line("| -------- | ----------- |");for(let t of e.positionals)r.line(`| \`<${t.name}>\` | ${h(t.description)} |`);r.blank()}e.flags.length>0&&B(r,e.flags);let o=[e.body===void 0?"":`Takes a JSON body${e.body.required?" (required)":""}: \`--json '<json>'\`, \`--json @file.json\`, or \`--json @-\` for stdin.`,e.unsupportedBody===void 0?"":`Takes a \`${e.unsupportedBody}\` body, which the CLI cannot build \u2014 call this operation through the generated client instead.`,e.paginated===!0?"Paginated: `--page-all` follows every page, printing one JSON page per line.":"",e.sse===!0?"Streams server-sent events as one JSON object per line.":"",e.blob===!0?"Returns binary content, so `--output <path>` is required.":""].filter(t=>t!=="");for(let t of o)r.line(t);o.length>0&&r.blank()}function R(r,e){let n=new S;e.frontmatter&&(n.line("---"),n.line(`title: ${e.title}`),n.line("---"),n.blank()),n.line(`# ${e.title}`),n.blank(),n.line(`Generated command-line reference for \`${e.name}\`, produced from the API description by \`redocly generate-client\`.`),n.line("Re-run generation to update it \u2014 this file is not hand-edited."),n.blank(),n.line("## Usage"),n.blank(),n.line("```sh"),n.line(`${e.name} <command> [flags]`),n.line(`${e.name} --help`),n.line(`${e.name} schema <command> # request/response schemas`),n.line("```"),n.blank(),n.line("Install the file under any `bin` name: the command takes that name, and the credential variables below do not change."),n.blank(),n.line("## Global flags"),n.blank(),n.line("| Flag | Description |"),n.line("| ---- | ----------- |");let o=e.schemes.some(i=>i.kind==="bearer");for(let[i,s]of[["--server-url <url>","Override the server URL included in the client."],["--format <json\\|ndjson>","Output format."],["--dry-run","Print the prepared request, credentials redacted, without sending it."],["--page-all","Follow pagination, printing one JSON page per line."],["--output <path>","Write the response body to a file. Required for binary responses."],...o?[["--token <token>","Bearer token, overriding the environment."]]:[],["--json <json\\|@file\\|@->","Request body, inline or from a file or stdin."]])n.line(`| \`${i}\` | ${s} |`);n.blank();let t=p(e.name);if(n.line("## Credentials"),n.blank(),e.schemes.length===0)n.line("The description declares no security schemes, so no credentials are read.");else{n.line("Credentials come from the environment:"),n.blank(),n.line("| Scheme | Variable |"),n.line("| ------ | -------- |");for(let i of e.schemes){let s=i.kind==="bearer"?`\`${t}_TOKEN\` (or \`--token\`)`:i.kind==="basic"?`\`${t}_USERNAME\` and \`${t}_PASSWORD\``:`\`${t}_API_KEY_${p(i.key)}\``;n.line(`| ${i.kind} (\`${i.key}\`) | ${s} |`)}}n.blank(),n.line("## Exit codes"),n.blank(),n.line("| Code | Meaning |"),n.line("| ---- | ------- |");for(let[i,s]of[[0,"success"],[1,"API error (status other than 401 or 403)"],[2,"auth error (401 or 403)"],[3,"validation error"],[4,"usage error (unknown command or flag, bad `--json`)"]])n.line(`| ${i} | ${s} |`);n.blank(),n.line("Errors print one JSON object to stderr, so stdout stays clean for piping."),n.blank();let a=[...new Set(r.map(i=>i.group))];for(let i of a){let s=r.filter(l=>l.group===i);i===void 0?(n.line("## Commands"),n.blank()):(n.line(`## ${i}`),n.blank(),n.line(`Addressed as \`${e.name} ${u(i)} <command>\`.`),n.blank());for(let l of s)D(n,l,e)}return n.toString().replace(/\n{3,}/g,`
|
|
8
8
|
|
|
9
9
|
`).trimEnd()+`
|
|
10
10
|
`}function x(){return v["cli.ts"]}function E(){return j["cli.ts"]}var q="// Generated by @redocly/client-generator \u2014 do not edit by hand.\n// Source: OpenAPI description. Re-run `redocly generate-client` to update.";function P(r){return k.snake(r).replace(/_/g,"-")}function O(r){let e=r.schema,n=e.kind==="array"?"array":e.kind==="scalar"&&(e.scalar==="integer"||e.scalar==="number")?"number":e.kind==="scalar"&&e.scalar==="boolean"?"boolean":"string";return{name:P(r.name),param:r.name,type:n,required:r.required,...e.kind==="enum"?{enum:e.values.map(String)}:{},...r.description!==void 0?{description:r.description}:{}}}function F(r){let e=r.successResponses;return e.some(n=>n.contentType.toLowerCase().includes("json"))?!1:e.some(n=>C(n.contentType))}function M(r){return r.successResponses.find(e=>e.contentType.toLowerCase().includes("json"))?.schema}function U(r,e,n){if(n!=="flat")return{};let o=g(r,e.schemas);return"mergeBody"in o&&o.mergeBody?{merged:!0}:{}}function _(r,e,n){return n!=="flat"?{}:"collisions"in g(r,e.schemas)?{argsStyle:"grouped"}:{}}function f(r,e){let n=[];for(let o of r.services)for(let t of o.operations){let a=t.requestBody?.contentType.toLowerCase().includes("json")?t.requestBody:void 0,i=M(t);n.push({...t.tags.length>0?{group:t.tags[0]}:{},name:t.name,...t.summary!==void 0?{summary:t.summary}:{},method:t.method.toUpperCase(),path:t.path,positionals:t.pathParams.map(s=>({name:s.name,type:O(s).type,...s.description!==void 0?{description:s.description}:{}})),flags:t.queryParams.map(O),...a?{body:{required:a.required,...U(t,r,e.argsStyle)}}:{},...a===void 0&&t.requestBody!==void 0?{unsupportedBody:t.requestBody.contentType}:{},...e.pagination?.has(t.name)===!0?{paginated:!0}:{},..._(t,r,e.argsStyle),...t.sse!==void 0?{sse:!0}:{},...F(t)?{blob:!0}:{},...a!==void 0||i!==void 0?{schemas:{...a?{request:a.schema}:{},...i!==void 0?{response:i}:{}}}:{}})}return n}var A=`function isProcessEntry(): boolean {
|
|
@@ -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{c as a,d as b}from"./
|
|
7
|
+
import{c as a,d as b}from"./Y5AAEFMH.js";import"./5YW5LAGV.js";import"./WZXA5XPB.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as generateClient,a as runGenerators};
|
|
@@ -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"./U77FTE2C.js";import"./XJE2OFDN.js";import"./UWK3L6LB.js";import"./5YW5LAGV.js";import"./WZXA5XPB.js";import"./22EANOP2.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{b as G}from"./XJE2OFDN.js";import{b as E,c as I,d as F,e as W,f as ne,g as te,h as re,i as ie,j as se}from"./ERFYZ47T.js";import{a as X,c as C,d as p,e as S,f as N,g as R,h as B,i as Z,j,k as D,l as O,n as ee}from"./UW4UC7ZI.js";var U=C.php,w=class extends X{constructor(){super(" ")}typeName(n){return p(n,{style:"pascal",reserved:U})}memberName(n){return p(n,{style:"camel",reserved:U})}identifier(n){return p(n,{style:"camel",reserved:U})}identifiers(n,s){return S(n,{style:"camel",reserved:U,taken:s})}string(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}literal(n){return n==null?"null":typeof n=="boolean"||typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(i=>this.literal(i)).join(", ")}]`:`[${Object.entries(n).map(([i,r])=>`${this.string(i)} => ${this.literal(r)}`).join(", ")}]`}comment(n){for(let s of O(n))this.line(s===""?"//":`// ${s}`);return this}doc(n,s,i=[]){let r=O(s);if(r.length===0&&i.length===0)return this;let t=r.length===0?n:`${n} \u2014 ${r.join(" ")}`;if(i.length===0)return this.line(`/** ${t} */`);this.line("/**"),this.line(` * ${t}`),this.line(" *");for(let a of i)this.line(` * ${a}`);return this.line(" */")}};var h=C.php,K=new w;function y(e){return K.typeName(e)}function k(e){return K.memberName(e)}function o(e){return K.string(e)}function ae(e){return p(e.name,{style:"camel",reserved:h})}function L(e){let n=e.services.flatMap(i=>i.operations),s=S(n.map(i=>i.name),{style:"camel",reserved:h});return new Map(n.map((i,r)=>[i.name,s[r]]))}function he(e){return te(e).map(s=>s.kind==="literal"?o(s.value):`$${k(s.name)}`).join(" . ")}function oe(e,n){let s=n.servers??[];if(s.length===0)return;let i=new Set;e.line("/** The declared servers; variables default to the values from the description. */"),e.line("final class Servers"),e.block("{",()=>{s.forEach((r,t)=>{let a=p(r.description??`server${t+1}`,{style:"camel",reserved:h});i.has(a)&&(a=`${a}${t+1}`),i.add(a);let c=r.variables.map(l=>`string $${k(l.name)} = ${o(l.default)}`);t>0&&e.blank(),e.line(`public static function ${a}(${c.join(", ")}): string`),e.block("{",()=>{e.line(`return ${he(r)};`)},"}")})},"}"),e.blank()}function ce(e,n){let s=re(e,n).map(i=>`[${i.map(t=>t.kind==="apiKey"?`['kind' => 'apiKey', 'scheme' => ${o(t.scheme)}, 'name' => ${o(t.name)}, 'in' => ${o(t.in)}]`:`['kind' => ${o(t.kind)}, 'scheme' => ${o(t.scheme)}]`).join(", ")}]`);if(s.length!==0)return`[${s.join(", ")}]`}function le(e){return`[${[`'style' => ${o(e.style)}`,...e.param!==void 0?[`'param' => ${o(e.param)}`]:[],...e.nextCursor!==void 0?[`'nextCursor' => ${o(e.nextCursor)}`]:[],...e.hasMore!==void 0?[`'hasMore' => ${o(e.hasMore)}`]:[],...e.limitParam!==void 0?[`'limitParam' => ${o(e.limitParam)}`]:[],...e.items!==void 0?[`'items' => ${o(e.items)}`]:[]].join(", ")}]`}function ue(e,n){let s=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let t=p(r.name,{style:"camel",reserved:h}),a=2;for(;s.has(t);)t=`${p(r.name,{style:"camel",reserved:h})}_${a++}`;s.add(t);let c=ee(r.schema,n);return`[${o(r.name)}, ${o(t)}, ${o(c)}]`}).join(", ")}]`}function _(e,n){let s=n.schemas.find(t=>t.name===e);if(s===void 0)return"other";let i=s.schema,r=D(i);return r!==void 0&&(r.scalar==="string"||r.scalar==="integer")?"enum":(i.kind==="object"||i.kind==="intersection")&&R(i,n)!==void 0?"class":"other"}function m(e,n,s="string"){if(Z(e)){let i=m(j(e),n,s);return A(i)}switch(e.kind){case"scalar":return s==="Date"&&e.scalar==="string"&&J(e)?"\\DateTimeImmutable":{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":case"record":return"array";case"ref":{let i=_(e.name,n);if(i==="class"||i==="enum")return y(e.name);let r=N(e,n);return r===void 0?"mixed":m(r,n,s)}case"enum":return{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"literal":return typeof e.value=="string"?"string":typeof e.value=="boolean"?"bool":"float";case"omit":return y(e.base);case"union":return ye(e.members,n,s);case"null":case"object":case"intersection":case"unknown":return"mixed"}}function J(e){let n=e.metadata?.format;return n==="date"||n==="date-time"}function A(e){return e==="mixed"||e.startsWith("?")||e.endsWith("|null")?e:e.includes("|")?`${e}|null`:`?${e}`}function ye(e,n,s){let i=[];for(let r of e){if(r.kind==="null")continue;let t=m(r,n,s);if(t==="mixed")return"mixed";let a=t.startsWith("?")?t.slice(1):t;i.includes(a)||i.push(a),t.startsWith("?")&&!i.includes("null")&&i.push("null")}return i.length===0?"mixed":i.join("|")}function V(e,n,s){if(e===void 0)return;let i=j(e);if(i.kind==="ref"){let t=N(i,n);return _(i.name,n)==="other"?V(t,n,s):void 0}if(i.kind!=="array")return;let r=m(i.items,n,s);return r==="mixed"?void 0:r}function $e(e,n){let s=n.schemas.find(i=>i.name===e);return s!==void 0&&B(s.schema,n)!==void 0}function q(e,n,s,i){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"&&J(r))return`new \\DateTimeImmutable(${n})`;if(r.kind==="omit")return q({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${y(r.name)}::fromArray(${n})`;if(t==="enum")return`${y(r.name)}::from(${n})`;if($e(r.name,s))return`unmarshal${y(r.name)}(${n})`;let a=N(r,s);return a===void 0?void 0:q(a,n,s,i)}if(r.kind==="array"){let t=q(r.items,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}if(r.kind==="record"){let t=q(r.value,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}}function x(e,n,s,i="string"){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"){if(r.metadata?.format==="date")return`${n}->format('Y-m-d')`;if(r.metadata?.format==="date-time")return`${n}->format(\\DateTimeInterface::ATOM)`}if(r.kind==="omit")return x({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${n}->toArray()`;if(t==="enum")return`${n}->value`;if($e(r.name,s))return`is_object(${n}) ? ${n}->toArray() : ${n}`;let a=N(r,s);return a===void 0?void 0:x(a,n,s,i)}if(r.kind==="array"||r.kind==="record"){let t=r.kind==="array"?r.items:r.value,a=x(t,"$item",s,i);return a===void 0?void 0:`array_map(static fn ($item) => ${a}, ${n})`}}function ge(e,n,s,i,r,t){let a=[...s.filter(c=>c.required),...s.filter(c=>!c.required)];e.doc(y(n),t),e.line(`final class ${y(n)}`),e.block("{",()=>{e.block("public function __construct(",()=>{for(let c of a){let l=m(c.schema,i,r);if(c.required)e.line(`public ${l} $${k(c.name)},`);else{let u=A(l);e.line(`public ${u} $${k(c.name)} = null,`)}}},") {"),e.line("}"),e.blank(),e.line("public static function fromArray(array $data): self"),e.block("{",()=>{e.block("return new self(",()=>{for(let c of a){let l=`$data[${o(c.name)}]`,u=q(c.schema,l,i,r),d=k(c.name);c.required?e.line(`${d}: ${u??l},`):u===void 0?e.line(`${d}: ${l} ?? null,`):e.line(`${d}: isset(${l}) ? ${u} : null,`)}},");")},"}"),e.blank(),e.line("public function toArray(): array"),e.block("{",()=>{e.line("$data = [];");for(let c of a){let l=`$this->${k(c.name)}`,u=x(c.schema,l,i,r)??l;c.required?e.line(`$data[${o(c.name)}] = ${u};`):e.block(`if (${l} !== null) {`,()=>{e.line(`$data[${o(c.name)}] = ${u};`)},"}")}e.line("return $data;")},"}")},"}"),e.blank()}function z(e,n="string"){let s=new w;for(let{name:i,schema:r}of e.schemas){let t=D(r);if(t!==void 0&&(t.scalar==="string"||t.scalar==="integer")){let c=t.scalar==="string"?"string":"int";s.doc(y(i),r.description),s.line(`enum ${y(i)}: ${c}`),s.block("{",()=>{let l=S(t.values.map(u=>String(u)),{style:"pascal",reserved:h});t.values.forEach((u,d)=>{let b=typeof u=="string"?o(u):String(u);s.line(`case ${l[d]} = ${b};`)})},"}"),s.blank();continue}if(r.kind==="object"||r.kind==="intersection"){let c=R(r,e);if(c!==void 0){ge(s,i,c.properties,e,n,c.description??r.description);continue}}let a=B(r,e);if(a!==void 0){let c=y(i),l=a.cases.map(u=>`${u.value} -> ${y(u.schemaName)}`).join(", ");s.line(`/** ${c} is a discriminated union (${o(a.property)}): ${l}. */`),s.line(`function unmarshal${c}(array $data): mixed`),s.block("{",()=>{s.block(`return match ($data[${o(a.property)}] ?? null) {`,()=>{for(let u of a.cases)s.line(`${o(u.value)} => ${y(u.schemaName)}::fromArray($data),`);s.line("default => $data,")},"};")},"}"),s.blank();continue}}return s.toString()}var de=new Set(["post","put","patch"]),be=["body","headers","idempotencyKey"];function fe(e){return W(e)||e.requestBody!==void 0&&ne(e.requestBody.contentType)}function Q(e,n,s,i){let r=S([...e.pathParams,...e.queryParams].map(l=>l.name),{style:"camel",reserved:h,taken:be}),t=e.pathParams.map((l,u)=>({php:r[u],wire:l.name,type:m(l.schema,n,i)})),a=e.queryParams.map((l,u)=>{let d=r[e.pathParams.length+u];return{php:d,wire:l.name,type:m(l.schema,n,i),value:x(l.schema,`$${d}`,n,i)??`$${d}`}}),c=[...t.map(({php:l,type:u})=>`${u} $${l}`),...s&&e.requestBody?[`${fe(e)?"mixed":F(e)?"array":m(e.requestBody.schema,n,i)} $body`]:[],...a.map(({php:l,type:u})=>`${A(u)} $${l} = null`),"?array $headers = null",...s&&de.has(e.method.toLowerCase())?["?string $idempotencyKey = null"]:[]];return{pathArgs:t,queryArgs:a,signature:c}}function ke(e,n,s){e.line(`$op = self::OPERATIONS[${o(n.specName??n.name)}];`),e.line("[$authHeaders, $query, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);");for(let{php:r,wire:t,value:a}of s.queryArgs)e.block(`if ($${r} !== null) {`,()=>{e.line(`$query[${o(t)}] = ${a};`)},"}");let i=s.pathArgs.map(({php:r,wire:t})=>`${o(t)} => $${r}`).join(", ");e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${i}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}")}function Y(e,n,s,i,r,t=!1){let a=Q(n,i,!0,r),c=I(n),l=E(n),u=c===void 0&&l===void 0&&n.successResponses.some(g=>g.contentType!==""),d=t?"Envelope":c!==void 0?"\\Generator":l!==void 0?m(l,i,r):u?"string":"void",b=t?`${s}WithHeaders`:s,H=t?void 0:V(l,i,r);e.doc(b,t?`Like ${s}(), returning an Envelope with the declared response headers.`:n.summary??`${n.method.toUpperCase()} ${n.path}`,H===void 0?[]:[`@return ${H}[]`]),e.line(`public function ${b}(${a.signature.join(", ")}): ${d}`),e.block("{",()=>{if(ke(e,n,a),c!==void 0){let f=c.schema!==void 0&&c.schema.kind!=="unknown";e.line("$url = appendQuery($url, $query);"),e.block("$open = function (array $extraHeaders) use ($url, $requestHeaders): \\CurlHandle {",()=>{e.line("$handle = curl_init($url);"),e.line("$lines = [];"),e.block("foreach (array_merge($requestHeaders, $extraHeaders) as $name => $value) {",()=>{e.line("$lines[] = $name . ': ' . $value;")},"}"),e.line("curl_setopt($handle, CURLOPT_HTTPHEADER, $lines);"),e.line("return $handle;")},"};"),e.line(`yield from iterSse($open, ${f?"true":"false"});`);return}let g=["'operationId' => $op['id']","'method' => $op['method']","'url' => $url","'headers' => $requestHeaders","'query' => $query"];if(W(n))e.line("[$contentType, $encoded] = multipartBody($body);"),g.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody&&fe(n))g.push("'body' => binaryBody($body)",`'contentType' => ${o(n.requestBody.contentType)}`);else if(n.requestBody&&F(n))e.line("[$contentType, $encoded] = toMultipart($body);"),g.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody){let f=x(n.requestBody.schema,"$body",i,r)??"$body";e.line(`$payload = json_encode(${f});`),g.push("'body' => $payload",`'contentType' => ${o(n.requestBody.contentType)}`)}de.has(n.method.toLowerCase())&&n.requestBody&&g.push("'idempotencyKey' => $idempotencyKey"),e.line(`$response = send($this->config, [${g.join(", ")}]);`),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}");let $=u?"$response['body']":(l===void 0?void 0:q(l,"decodeJson($response)",i,r))??"decodeJson($response)";if(t){e.line(`$data = ${$};`),e.line(`return new Envelope(data: $data, headers: readEnvelopeHeaders($response, ${ue(n,i)}), status: $response['status']);`);return}if(u){e.line("return $response['body'];");return}if(d==="void"){e.line("decodeJson($response);");return}e.line(`return ${$};`)},"}"),e.blank()}function me(e,n,s,i,r,t,a,c,l){let u=Q(n,i,!1,r),d=s,b=()=>{e.line(`$op = self::OPERATIONS[${o(n.specName??n.name)}];`),e.line("$base = [];");for(let{php:f,wire:P,value:v}of u.queryArgs)e.block(`if ($${f} !== null) {`,()=>{e.line(`$base[${o(P)}] = ${v};`)},"}");let $=u.pathArgs.map(({php:f,wire:P})=>`${o(P)} => $${f}`).join(", ");e.block("$call = function (array $params) use ($op, $headers): array {",()=>{e.line("[$authHeaders, $authQuery, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);"),e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${$}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}"),e.line("$response = send($this->config, ['operationId' => $op['id'], 'method' => $op['method'], 'url' => $url, 'headers' => $requestHeaders, 'query' => array_merge($params, $authQuery)]);"),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}"),e.line("return [decodeJson($response), $response];")},"};")},H=m(E(n)??{kind:"unknown"},i,r),g=H==="mixed"?"mixed":H;e.line("/**"),e.line(` * ${d} response pages, following the pagination rule automatically.`),e.line(" *"),e.line(` * @return \\Generator<int, ${g}>`),e.line(" */"),e.line(`public function ${d}Pages(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{b(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`yield ${t??"$page"};`)},"}")},"}"),e.blank(),e.line("/**"),e.line(` * The items of every ${d} page.`),e.line(" *"),e.line(` * @return \\Generator<int, ${l}>`),e.line(" */"),e.line(`public function ${d}Items(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{b(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`$items = resolvePointer($page, ${o(c??"")});`),e.block("foreach (is_array($items) ? $items : [] as $item) {",()=>{e.line(`yield ${a??"$item"};`)},"}")},"}")},"}"),e.blank()}function Pe(e){let n=e.split(`
|
|
7
|
+
import{b as G}from"./XJE2OFDN.js";import{b as E,c as I,d as F,e as W,f as ne,g as te,h as re,i as ie,j as se}from"./UWK3L6LB.js";import{a as X,c as C,d as p,e as S,f as N,g as R,h as B,i as Z,j,k as D,l as O,n as ee}from"./UW4UC7ZI.js";var U=C.php,w=class extends X{constructor(){super(" ")}typeName(n){return p(n,{style:"pascal",reserved:U})}memberName(n){return p(n,{style:"camel",reserved:U})}identifier(n){return p(n,{style:"camel",reserved:U})}identifiers(n,s){return S(n,{style:"camel",reserved:U,taken:s})}string(n){return`'${n.replace(/\\/g,"\\\\").replace(/'/g,"\\'")}'`}literal(n){return n==null?"null":typeof n=="boolean"||typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(i=>this.literal(i)).join(", ")}]`:`[${Object.entries(n).map(([i,r])=>`${this.string(i)} => ${this.literal(r)}`).join(", ")}]`}comment(n){for(let s of O(n))this.line(s===""?"//":`// ${s}`);return this}doc(n,s,i=[]){let r=O(s);if(r.length===0&&i.length===0)return this;let t=r.length===0?n:`${n} \u2014 ${r.join(" ")}`;if(i.length===0)return this.line(`/** ${t} */`);this.line("/**"),this.line(` * ${t}`),this.line(" *");for(let a of i)this.line(` * ${a}`);return this.line(" */")}};var h=C.php,K=new w;function y(e){return K.typeName(e)}function k(e){return K.memberName(e)}function o(e){return K.string(e)}function ae(e){return p(e.name,{style:"camel",reserved:h})}function L(e){let n=e.services.flatMap(i=>i.operations),s=S(n.map(i=>i.name),{style:"camel",reserved:h});return new Map(n.map((i,r)=>[i.name,s[r]]))}function he(e){return te(e).map(s=>s.kind==="literal"?o(s.value):`$${k(s.name)}`).join(" . ")}function oe(e,n){let s=n.servers??[];if(s.length===0)return;let i=new Set;e.line("/** The declared servers; variables default to the values from the description. */"),e.line("final class Servers"),e.block("{",()=>{s.forEach((r,t)=>{let a=p(r.description??`server${t+1}`,{style:"camel",reserved:h});i.has(a)&&(a=`${a}${t+1}`),i.add(a);let c=r.variables.map(l=>`string $${k(l.name)} = ${o(l.default)}`);t>0&&e.blank(),e.line(`public static function ${a}(${c.join(", ")}): string`),e.block("{",()=>{e.line(`return ${he(r)};`)},"}")})},"}"),e.blank()}function ce(e,n){let s=re(e,n).map(i=>`[${i.map(t=>t.kind==="apiKey"?`['kind' => 'apiKey', 'scheme' => ${o(t.scheme)}, 'name' => ${o(t.name)}, 'in' => ${o(t.in)}]`:`['kind' => ${o(t.kind)}, 'scheme' => ${o(t.scheme)}]`).join(", ")}]`);if(s.length!==0)return`[${s.join(", ")}]`}function le(e){return`[${[`'style' => ${o(e.style)}`,...e.param!==void 0?[`'param' => ${o(e.param)}`]:[],...e.nextCursor!==void 0?[`'nextCursor' => ${o(e.nextCursor)}`]:[],...e.hasMore!==void 0?[`'hasMore' => ${o(e.hasMore)}`]:[],...e.limitParam!==void 0?[`'limitParam' => ${o(e.limitParam)}`]:[],...e.items!==void 0?[`'items' => ${o(e.items)}`]:[]].join(", ")}]`}function ue(e,n){let s=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let t=p(r.name,{style:"camel",reserved:h}),a=2;for(;s.has(t);)t=`${p(r.name,{style:"camel",reserved:h})}_${a++}`;s.add(t);let c=ee(r.schema,n);return`[${o(r.name)}, ${o(t)}, ${o(c)}]`}).join(", ")}]`}function _(e,n){let s=n.schemas.find(t=>t.name===e);if(s===void 0)return"other";let i=s.schema,r=D(i);return r!==void 0&&(r.scalar==="string"||r.scalar==="integer")?"enum":(i.kind==="object"||i.kind==="intersection")&&R(i,n)!==void 0?"class":"other"}function m(e,n,s="string"){if(Z(e)){let i=m(j(e),n,s);return A(i)}switch(e.kind){case"scalar":return s==="Date"&&e.scalar==="string"&&J(e)?"\\DateTimeImmutable":{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":case"record":return"array";case"ref":{let i=_(e.name,n);if(i==="class"||i==="enum")return y(e.name);let r=N(e,n);return r===void 0?"mixed":m(r,n,s)}case"enum":return{string:"string",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"literal":return typeof e.value=="string"?"string":typeof e.value=="boolean"?"bool":"float";case"omit":return y(e.base);case"union":return ye(e.members,n,s);case"null":case"object":case"intersection":case"unknown":return"mixed"}}function J(e){let n=e.metadata?.format;return n==="date"||n==="date-time"}function A(e){return e==="mixed"||e.startsWith("?")||e.endsWith("|null")?e:e.includes("|")?`${e}|null`:`?${e}`}function ye(e,n,s){let i=[];for(let r of e){if(r.kind==="null")continue;let t=m(r,n,s);if(t==="mixed")return"mixed";let a=t.startsWith("?")?t.slice(1):t;i.includes(a)||i.push(a),t.startsWith("?")&&!i.includes("null")&&i.push("null")}return i.length===0?"mixed":i.join("|")}function V(e,n,s){if(e===void 0)return;let i=j(e);if(i.kind==="ref"){let t=N(i,n);return _(i.name,n)==="other"?V(t,n,s):void 0}if(i.kind!=="array")return;let r=m(i.items,n,s);return r==="mixed"?void 0:r}function $e(e,n){let s=n.schemas.find(i=>i.name===e);return s!==void 0&&B(s.schema,n)!==void 0}function q(e,n,s,i){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"&&J(r))return`new \\DateTimeImmutable(${n})`;if(r.kind==="omit")return q({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${y(r.name)}::fromArray(${n})`;if(t==="enum")return`${y(r.name)}::from(${n})`;if($e(r.name,s))return`unmarshal${y(r.name)}(${n})`;let a=N(r,s);return a===void 0?void 0:q(a,n,s,i)}if(r.kind==="array"){let t=q(r.items,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}if(r.kind==="record"){let t=q(r.value,"$item",s,i);return t===void 0?void 0:`array_map(static fn ($item) => ${t}, ${n})`}}function x(e,n,s,i="string"){let r=j(e);if(i==="Date"&&r.kind==="scalar"&&r.scalar==="string"){if(r.metadata?.format==="date")return`${n}->format('Y-m-d')`;if(r.metadata?.format==="date-time")return`${n}->format(\\DateTimeInterface::ATOM)`}if(r.kind==="omit")return x({kind:"ref",name:r.base},n,s,i);if(r.kind==="ref"){let t=_(r.name,s);if(t==="class")return`${n}->toArray()`;if(t==="enum")return`${n}->value`;if($e(r.name,s))return`is_object(${n}) ? ${n}->toArray() : ${n}`;let a=N(r,s);return a===void 0?void 0:x(a,n,s,i)}if(r.kind==="array"||r.kind==="record"){let t=r.kind==="array"?r.items:r.value,a=x(t,"$item",s,i);return a===void 0?void 0:`array_map(static fn ($item) => ${a}, ${n})`}}function ge(e,n,s,i,r,t){let a=[...s.filter(c=>c.required),...s.filter(c=>!c.required)];e.doc(y(n),t),e.line(`final class ${y(n)}`),e.block("{",()=>{e.block("public function __construct(",()=>{for(let c of a){let l=m(c.schema,i,r);if(c.required)e.line(`public ${l} $${k(c.name)},`);else{let u=A(l);e.line(`public ${u} $${k(c.name)} = null,`)}}},") {"),e.line("}"),e.blank(),e.line("public static function fromArray(array $data): self"),e.block("{",()=>{e.block("return new self(",()=>{for(let c of a){let l=`$data[${o(c.name)}]`,u=q(c.schema,l,i,r),d=k(c.name);c.required?e.line(`${d}: ${u??l},`):u===void 0?e.line(`${d}: ${l} ?? null,`):e.line(`${d}: isset(${l}) ? ${u} : null,`)}},");")},"}"),e.blank(),e.line("public function toArray(): array"),e.block("{",()=>{e.line("$data = [];");for(let c of a){let l=`$this->${k(c.name)}`,u=x(c.schema,l,i,r)??l;c.required?e.line(`$data[${o(c.name)}] = ${u};`):e.block(`if (${l} !== null) {`,()=>{e.line(`$data[${o(c.name)}] = ${u};`)},"}")}e.line("return $data;")},"}")},"}"),e.blank()}function z(e,n="string"){let s=new w;for(let{name:i,schema:r}of e.schemas){let t=D(r);if(t!==void 0&&(t.scalar==="string"||t.scalar==="integer")){let c=t.scalar==="string"?"string":"int";s.doc(y(i),r.description),s.line(`enum ${y(i)}: ${c}`),s.block("{",()=>{let l=S(t.values.map(u=>String(u)),{style:"pascal",reserved:h});t.values.forEach((u,d)=>{let b=typeof u=="string"?o(u):String(u);s.line(`case ${l[d]} = ${b};`)})},"}"),s.blank();continue}if(r.kind==="object"||r.kind==="intersection"){let c=R(r,e);if(c!==void 0){ge(s,i,c.properties,e,n,c.description??r.description);continue}}let a=B(r,e);if(a!==void 0){let c=y(i),l=a.cases.map(u=>`${u.value} -> ${y(u.schemaName)}`).join(", ");s.line(`/** ${c} is a discriminated union (${o(a.property)}): ${l}. */`),s.line(`function unmarshal${c}(array $data): mixed`),s.block("{",()=>{s.block(`return match ($data[${o(a.property)}] ?? null) {`,()=>{for(let u of a.cases)s.line(`${o(u.value)} => ${y(u.schemaName)}::fromArray($data),`);s.line("default => $data,")},"};")},"}"),s.blank();continue}}return s.toString()}var de=new Set(["post","put","patch"]),be=["body","headers","idempotencyKey"];function fe(e){return W(e)||e.requestBody!==void 0&&ne(e.requestBody.contentType)}function Q(e,n,s,i){let r=S([...e.pathParams,...e.queryParams].map(l=>l.name),{style:"camel",reserved:h,taken:be}),t=e.pathParams.map((l,u)=>({php:r[u],wire:l.name,type:m(l.schema,n,i)})),a=e.queryParams.map((l,u)=>{let d=r[e.pathParams.length+u];return{php:d,wire:l.name,type:m(l.schema,n,i),value:x(l.schema,`$${d}`,n,i)??`$${d}`}}),c=[...t.map(({php:l,type:u})=>`${u} $${l}`),...s&&e.requestBody?[`${fe(e)?"mixed":F(e)?"array":m(e.requestBody.schema,n,i)} $body`]:[],...a.map(({php:l,type:u})=>`${A(u)} $${l} = null`),"?array $headers = null",...s&&de.has(e.method.toLowerCase())?["?string $idempotencyKey = null"]:[]];return{pathArgs:t,queryArgs:a,signature:c}}function ke(e,n,s){e.line(`$op = self::OPERATIONS[${o(n.specName??n.name)}];`),e.line("[$authHeaders, $query, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);");for(let{php:r,wire:t,value:a}of s.queryArgs)e.block(`if ($${r} !== null) {`,()=>{e.line(`$query[${o(t)}] = ${a};`)},"}");let i=s.pathArgs.map(({php:r,wire:t})=>`${o(t)} => $${r}`).join(", ");e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${i}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}")}function Y(e,n,s,i,r,t=!1){let a=Q(n,i,!0,r),c=I(n),l=E(n),u=c===void 0&&l===void 0&&n.successResponses.some(g=>g.contentType!==""),d=t?"Envelope":c!==void 0?"\\Generator":l!==void 0?m(l,i,r):u?"string":"void",b=t?`${s}WithHeaders`:s,H=t?void 0:V(l,i,r);e.doc(b,t?`Like ${s}(), returning an Envelope with the declared response headers.`:n.summary??`${n.method.toUpperCase()} ${n.path}`,H===void 0?[]:[`@return ${H}[]`]),e.line(`public function ${b}(${a.signature.join(", ")}): ${d}`),e.block("{",()=>{if(ke(e,n,a),c!==void 0){let f=c.schema!==void 0&&c.schema.kind!=="unknown";e.line("$url = appendQuery($url, $query);"),e.block("$open = function (array $extraHeaders) use ($url, $requestHeaders): \\CurlHandle {",()=>{e.line("$handle = curl_init($url);"),e.line("$lines = [];"),e.block("foreach (array_merge($requestHeaders, $extraHeaders) as $name => $value) {",()=>{e.line("$lines[] = $name . ': ' . $value;")},"}"),e.line("curl_setopt($handle, CURLOPT_HTTPHEADER, $lines);"),e.line("return $handle;")},"};"),e.line(`yield from iterSse($open, ${f?"true":"false"});`);return}let g=["'operationId' => $op['id']","'method' => $op['method']","'url' => $url","'headers' => $requestHeaders","'query' => $query"];if(W(n))e.line("[$contentType, $encoded] = multipartBody($body);"),g.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody&&fe(n))g.push("'body' => binaryBody($body)",`'contentType' => ${o(n.requestBody.contentType)}`);else if(n.requestBody&&F(n))e.line("[$contentType, $encoded] = toMultipart($body);"),g.push("'body' => $encoded","'contentType' => $contentType");else if(n.requestBody){let f=x(n.requestBody.schema,"$body",i,r)??"$body";e.line(`$payload = json_encode(${f});`),g.push("'body' => $payload",`'contentType' => ${o(n.requestBody.contentType)}`)}de.has(n.method.toLowerCase())&&n.requestBody&&g.push("'idempotencyKey' => $idempotencyKey"),e.line(`$response = send($this->config, [${g.join(", ")}]);`),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}");let $=u?"$response['body']":(l===void 0?void 0:q(l,"decodeJson($response)",i,r))??"decodeJson($response)";if(t){e.line(`$data = ${$};`),e.line(`return new Envelope(data: $data, headers: readEnvelopeHeaders($response, ${ue(n,i)}), status: $response['status']);`);return}if(u){e.line("return $response['body'];");return}if(d==="void"){e.line("decodeJson($response);");return}e.line(`return ${$};`)},"}"),e.blank()}function me(e,n,s,i,r,t,a,c,l){let u=Q(n,i,!1,r),d=s,b=()=>{e.line(`$op = self::OPERATIONS[${o(n.specName??n.name)}];`),e.line("$base = [];");for(let{php:f,wire:P,value:v}of u.queryArgs)e.block(`if ($${f} !== null) {`,()=>{e.line(`$base[${o(P)}] = ${v};`)},"}");let $=u.pathArgs.map(({php:f,wire:P})=>`${o(P)} => $${f}`).join(", ");e.block("$call = function (array $params) use ($op, $headers): array {",()=>{e.line("[$authHeaders, $authQuery, $cookies] = resolveAuth($op['security'] ?? [], $this->config->auth);"),e.line(`$url = buildUrl($this->config->serverUrl, $op['path'], [${$}]);`),e.line("$requestHeaders = array_merge($authHeaders, $headers ?? []);"),e.block("if ($cookies !== []) {",()=>{e.line("$requestHeaders['Cookie'] = implode('; ', $cookies);")},"}"),e.line("$response = send($this->config, ['operationId' => $op['id'], 'method' => $op['method'], 'url' => $url, 'headers' => $requestHeaders, 'query' => array_merge($params, $authQuery)]);"),e.block("if ($response['status'] >= 400) {",()=>{e.line("throw apiErrorFrom($response);")},"}"),e.line("return [decodeJson($response), $response];")},"};")},H=m(E(n)??{kind:"unknown"},i,r),g=H==="mixed"?"mixed":H;e.line("/**"),e.line(` * ${d} response pages, following the pagination rule automatically.`),e.line(" *"),e.line(` * @return \\Generator<int, ${g}>`),e.line(" */"),e.line(`public function ${d}Pages(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{b(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`yield ${t??"$page"};`)},"}")},"}"),e.blank(),e.line("/**"),e.line(` * The items of every ${d} page.`),e.line(" *"),e.line(` * @return \\Generator<int, ${l}>`),e.line(" */"),e.line(`public function ${d}Items(${u.signature.join(", ")}): \\Generator`),e.block("{",()=>{b(),e.block("foreach (iterPages($call, $op['pagination'], $base) as $page) {",()=>{e.line(`$items = resolvePointer($page, ${o(c??"")});`),e.block("foreach (is_array($items) ? $items : [] as $item) {",()=>{e.line(`yield ${a??"$item"};`)},"}")},"}")},"}"),e.blank()}function Pe(e){let n=e.split(`
|
|
8
8
|
`),s=0;for(let i=0;i<n.length;i++)if(n[i].trim().startsWith("namespace ")){s=i+1;break}return n.slice(s).join(`
|
|
9
9
|
`).trim()}var dn=({model:e,output:n,banner:s,emit:i,pagination:r})=>{let t=new w,a=i.dateType??"string",c=p(e.title,{style:"pascal",reserved:h});t.line("<?php"),t.blank(),t.line(`// Code generated by @redocly/client-generator (php) from ${o(e.title)} ${e.version}. DO NOT EDIT.`),t.line("// Regenerate with `redocly generate-client`. PHP >= 8.1, curl extension \u2014 zero Composer dependencies."),t.blank(),t.line("declare(strict_types=1);"),t.blank(),t.line(`namespace ${c};`),t.blank(),t.line(z(e,a)),oe(t,e),i.runtime==="module"?(t.line("// \u2500\u2500\u2500 Runtime (a real file beside this one, written by the same run) \u2500\u2500\u2500"),t.line("require_once __DIR__ . '/runtime.php';"),t.blank()):(t.line("// \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator php runtime) \u2500\u2500\u2500"),t.line(Pe(G)),t.blank());let l=e.services.flatMap($=>$.operations),u=L(e),d=new Map;for(let $ of l){let f=r?.get($.name)?.spec;f!==void 0&&d.set($.name,f)}t.doc("Client",`Client for ${e.title} (${e.version}).`),t.line("class Client"),t.block("{",()=>{t.block("public const OPERATIONS = [",()=>{for(let $ of l){let f=$.specName??$.name,P=ce($,e),v=d.get($.name),M=[`'id' => ${o(f)}`,`'method' => ${o($.method.toUpperCase())}`,`'path' => ${o($.path)}`,...P!==void 0?[`'security' => ${P}`]:[],...v!==void 0?[`'pagination' => ${le(v)}`]:[]];t.line(`${o(f)} => [${M.join(", ")}],`)}},"];"),t.blank(),t.line("public function __construct(private Config $config)"),t.block("{",()=>{t.block("if ($this->config->serverUrl === '') {",()=>{t.line(`$this->config->serverUrl = ${o(i.serverUrl??e.serverUrl??"")};`)},"}")},"}"),t.blank();for(let $ of l){let f=u.get($.name);Y(t,$,f,e,a),I($)===void 0&&($.successResponseHeaders?.length??0)>0&&Y(t,$,f,e,a,!0);let P=d.get($.name);if(P===void 0)continue;let v=E($),M=v===void 0?void 0:q(v,"$page",e,a),T=ie(v,P.items,e),pe=T===void 0?void 0:q(T,"$item",e,a);me(t,$,f,e,a,M,pe,P.items,T===void 0?"mixed":m(T,e,a))}},"}");let b={path:n.path.replace(/\.[^.\\/]+$/,".php"),content:t.toString()};if(i.runtime!=="module")return[b];let H=s.map($=>`// ${$}`).join(`
|
|
10
10
|
`),g=G.replace(/^namespace .*$/m,`namespace ${c};`).replace(/^<\?php\n/,`<?php
|
|
@@ -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 F}from"./US7X4XPD.js";import{a as b,d as A,e as E,g as O,p as B,q as h}from"./
|
|
7
|
+
import{a as F}from"./US7X4XPD.js";import{a as b,d as A,e as E,g as O,p as B,q as h}from"./5NOJ76EP.js";import{f as I}from"./6NB3FKVN.js";import{$ as v,aa as j,ba as u,da as c,ea as d,ia as a,m as l,oa as m}from"./22EANOP2.js";var y=class extends Error{};async function Z({argv:t,version:e}){let n=performance.now(),o=new F,{organization:s,project:p,pushId:w,wait:g}=t,U=t.domain||O(),S=t["continue-on-deploy-failures"]||!1,M=t["start-time"]||Date.now(),R=[],f={organization:s,project:p};try{let $=E(),P={domain:U,apiKey:$,...f,pushId:w,version:e,onSunsetWarning:i=>R.push(i),onSlugDeprecated:i=>{K(i),f={organization:i.organizationId,project:i.projectId}}},D={...P,maxExecutionTime:t["max-execution-time"],retryIntervalMs:t["retry-interval"]?t["retry-interval"]*1e3:void 0,startTime:M},x=i=>T=>{let{status:C,url:N}=T.status[i].deploy;o.start(L({status:C,url:N,buildType:i,wait:g}))},r=g?await h({...D,buildType:"preview",onRetry:x("preview")}):await B(P);return W({buildType:"preview",spinner:o,push:r,continueOnDeployFailures:S}),z(r.status.preview.scorecard),g&&r.isMainBranch&&r.status.preview.deploy.status==="success"&&(r=await h({...D,...f,buildType:"production",onRetry:x("production")})),r.isMainBranch&&(W({buildType:"production",spinner:o,push:r,continueOnDeployFailures:S}),z(r.status.production.scorecard)),V({organization:s,project:p,pushId:w,startedAt:n}),{preview:r.status.preview,production:r.isMainBranch?r.status.production:null,commit:r.commit}}catch($){o.stop(),k("\u2717 Failed to get push status.",$)}finally{o.stop(),H("push-status",R)}}function k(t,e){throw e instanceof y?new m(e.message):e instanceof b?new m(`${t} Reason: ${e.message} (status: ${e.status})
|
|
8
8
|
`):new m(`${t} Reason: ${e.message}
|
|
9
9
|
`)}function K({organizationId:t,projectId:e}){a.warn(`Organization and project slugs are deprecated. Use the ids instead: --organization ${t} --project ${e}
|
|
10
10
|
`)}function H(t,e){let n=A(e);if(!n)return;let o='Update to the latest version by running "npm install @redocly/cli@latest".';n.isSunsetExpired?a.error(`The "${t}" command is not compatible with your version of Redocly CLI. ${o}
|
|
@@ -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}from"./
|
|
7
|
+
import{a,b,c,d,e}from"./REIGI2Y7.js";import"./US7X4XPD.js";import"./5NOJ76EP.js";import"./6NB3FKVN.js";import"./LRUXN6H5.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as DeploymentError,b as handlePushStatus,c as handleReuniteError,d as printSlugDeprecation,e as printSunsetWarning};
|
|
@@ -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 q}from"./6DO6IN4A.js";import{h as H,l as B,r as z,t as K,u as V,v as Z,w as _}from"./
|
|
7
|
+
import{a as q}from"./6DO6IN4A.js";import{h as H,l as B,r as z,t as K,u as V,v as Z,w as _}from"./5NOJ76EP.js";import{b as J,d as M,e as Y,v as L}from"./6NB3FKVN.js";import"./LRUXN6H5.js";import{$ as O,V as N,Z as v,aa as A,ba as j,ca as b,ea as y,fa as C,ga as R,ia as e,l as h,oa as w,pa as D,ua as S,xa as g}from"./22EANOP2.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{dirname as le}from"node:path";function W(r,t,o,n){n&&e.info(C(v(`
|
|
8
8
|
\u2611\uFE0F Achieved Level: ${y(o)}
|
|
9
9
|
|
|
10
10
|
`))),e.output(`<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -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{b as $,e as T,o as E,p as F,r as I,t as L,v as m}from"./
|
|
7
|
+
import{b as $,e as T,o as E,p as F,r as I,t as L,v as m}from"./6NB3FKVN.js";import{ca as w,ga as l,ia as n,l as x,pa as h,va as A,wa as g,ya as k}from"./22EANOP2.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as O}from"perf_hooks";async function X({argv:e,config:t,version:u,collectSpecData:P,collectResults:R}){let c=await $(e.apis,t),r={errors:0,warnings:0,ignored:0},p=0,b=e.format==="checkstyle"||e.format==="junit",y=[];for(let{path:o,alias:f}of c)try{let d=O.now(),s=t.forAlias(f);L(s.rules),s.skipRules(e["skip-rule"]),s.skipPreprocessors(e["skip-preprocessor"]),typeof t.document?.parsed>"u"&&!e.extends&&n.info(`No configurations were provided -- using built in ${w("recommended")} configuration by default.
|
|
8
8
|
|
|
9
9
|
`),f===void 0?n.info(l(`validating ${m(o)}...
|
|
10
10
|
`)):n.info(l(`validating ${m(o)} using lint rules for api '${f}'...
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{h as l}from"./5NOJ76EP.js";import"./LRUXN6H5.js";import{ia as p,oa as i}from"./22EANOP2.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as C}from"node:child_process";import{existsSync as x}from"node:fs";import*as s from"node:path";var P=/[\\/](_npx|dlx)[\\/]/;function a(r,t,e){return`${r}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}/git`}function m(r,t){let e=`credential.${r}/.helper`,o=!P.test(process.argv[1]??"")&&j("redocly")?"redocly":`npx --yes @redocly/cli@${t}`;return[`${e}=`,`${e}=!REDOCLY_SUPPRESS_UPDATE_NOTICE=true ${o} project git-credentials`]}async function d(r){return new Promise((t,e)=>{let n=C("git",r,{stdio:"inherit",env:{...process.env,GIT_TERMINAL_PROMPT:"0"}});n.on("error",o=>e(E(o))),n.on("close",o=>t(o??1))})}function j(r){let t=process.platform==="win32"?[".cmd",".exe"]:[""];return(process.env.PATH??"").split(s.delimiter).some(e=>e&&t.some(n=>x(s.join(e,r+n))))}function E(r){return r.code==="ENOENT"?new i("git is not installed or not on PATH."):r}async function U({argv:r,config:t,version:e}){let[n,o,...g]=r.project.split("/");if(!n||!o||g.length>0)throw new i(`Specify the project as \`<organization>/<project>\`, for example \`acme/developer-portal\`. Got: \`${r.project}\`.`);let c=l(t,r.residency),f=a(c,n,o),u=m(c,e);if(p.info(`Cloning ${n}/${o} from ${c}
|
|
8
|
+
`),await d(["clone",...u.flatMap(y=>["--config",y]),f,r.directory??o])!==0)throw new i("git clone failed.")}export{U as handleProjectClone};
|