@redocly/cli 2.62.1 → 2.62.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES +2 -2
- package/lib/chunks/{O7F2NBMC.js → 2OBVZIAW.js} +2 -2
- package/lib/chunks/{GVQMC2WB.js → 2OQM5ARW.js} +1 -1
- package/lib/chunks/{DBBMGF4W.js → 36IHQANV.js} +1 -1
- package/lib/chunks/{YPYZCXVX.js → 3FXYWWTJ.js} +1 -1
- package/lib/chunks/{UFZ7VJKO.js → 3JYQOGV3.js} +1 -1
- package/lib/chunks/{YINR7LU6.js → 3WHXM4DJ.js} +1 -1
- package/lib/chunks/{RGU6OZYB.js → 4AM55DEH.js} +1 -1
- package/lib/chunks/{G55KF2JU.js → 4OEXH5EV.js} +1 -1
- package/lib/chunks/{23KTTVIR.js → 5SIJI5LC.js} +1 -1
- package/lib/chunks/{PRSNVDUV.js → 5X35UU2C.js} +1 -1
- package/lib/chunks/{3M4FKKBI.js → 6MH5ZWLD.js} +1 -1
- package/lib/chunks/{XVZ7A34Y.js → 6WZUCZGV.js} +1 -1
- package/lib/chunks/{7YNVVBUW.js → 73RBZL53.js} +1 -1
- package/lib/chunks/{Y5AAEFMH.js → 7WM6VLB3.js} +1 -1
- package/lib/chunks/{ZNQTCB4Q.js → 7WTV5KH3.js} +1 -1
- package/lib/chunks/{LWPTRXNP.js → CIDSJFJO.js} +1 -1
- package/lib/chunks/{KQ5RN67Y.js → CQKQB4PJ.js} +1 -1
- package/lib/chunks/DS4SCWID.js +9 -0
- package/lib/chunks/{QWPV64G2.js → EDQ6QRIB.js} +1 -1
- package/lib/chunks/{LNYTDBAU.js → ENSYM7KY.js} +1 -1
- package/lib/chunks/{5YW5LAGV.js → FDGP3ZYZ.js} +1 -1
- package/lib/chunks/GKXY6U4S.js +145 -0
- package/lib/chunks/{WEOCCL26.js → GWXT3QO6.js} +5 -5
- package/lib/chunks/{VE45GKNY.js → HUWKDZPP.js} +1 -1
- package/lib/chunks/{W3G6AQCC.js → HWTYAU4Y.js} +1 -1
- package/lib/chunks/{VXLODB3S.js → HYE4U6V5.js} +1 -1
- package/lib/chunks/{REIGI2Y7.js → I5CGSLGR.js} +1 -1
- package/lib/chunks/{P7MVM2ZA.js → IUSSBOYO.js} +1 -1
- package/lib/chunks/{5UYYEBJY.js → JLVGRO3I.js} +1 -1
- package/lib/chunks/{AB2EMYEK.js → KOR5TUJG.js} +1 -1
- package/lib/chunks/{WPIZQQ5C.js → LCFG5N4V.js} +1 -1
- package/lib/chunks/{BX2H6D2W.js → M3XPS7UF.js} +1 -1
- package/lib/chunks/{B64RMZSV.js → PWGFZ5ZK.js} +1 -1
- package/lib/chunks/{UWK3L6LB.js → RU7T4CKG.js} +1 -1
- package/lib/chunks/{RUIEI3YV.js → SHZZKTDE.js} +1 -1
- package/lib/chunks/{SOI7RTB4.js → TKLMYBPI.js} +1 -1
- package/lib/chunks/{QMIOB64K.js → V2YF33JL.js} +1 -1
- package/lib/chunks/{ID2DJAJI.js → V3ILUN2S.js} +1 -1
- package/lib/chunks/{L3H2DSRP.js → VXONEXYX.js} +1 -1
- package/lib/chunks/{5S5OMDQZ.js → WX24BERR.js} +381 -381
- package/lib/chunks/{ZJYDDU5M.js → XFBJHVYU.js} +1 -1
- package/lib/chunks/{U77FTE2C.js → Z6GHMX6Z.js} +1 -1
- package/lib/chunks/{NBI4EQPC.js → ZCVUIIPU.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 +25 -25
- package/package.json +1 -1
- package/lib/chunks/5NOJ76EP.js +0 -9
- package/lib/chunks/LRUXN6H5.js +0 -59
package/THIRD_PARTY_NOTICES
CHANGED
|
@@ -697,7 +697,7 @@ Packages:
|
|
|
697
697
|
foreach@2.0.6 — Copyright (c) 2013 Manuel Stofer
|
|
698
698
|
get-east-asian-width@1.7.0
|
|
699
699
|
graphql@16.14.2 — Copyright (c) GraphQL Contributors
|
|
700
|
-
handlebars@4.7.
|
|
700
|
+
handlebars@4.7.10 — Copyright (C) 2011-2019 by Yehuda Katz
|
|
701
701
|
has-flag@4.0.0
|
|
702
702
|
https-proxy-agent@7.0.6 — Copyright (c) 2013 Nathan Rajlich <nathan@tootallnate.net>
|
|
703
703
|
is-buffer@2.0.5 — Copyright (c) Feross Aboukhadijeh
|
|
@@ -767,7 +767,7 @@ Packages:
|
|
|
767
767
|
supports-color@7.2.0
|
|
768
768
|
ulid@2.4.0 — Copyright (c) 2017 Alizain Feerasta
|
|
769
769
|
ulid@3.0.2 — Copyright (c) 2017 Alizain Feerasta
|
|
770
|
-
undici@
|
|
770
|
+
undici@7.30.0 — Copyright (c) Matteo Collina and Undici contributors
|
|
771
771
|
uri-js-replace@1.0.1
|
|
772
772
|
use-sync-external-store@1.6.0 — Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
773
773
|
yargs@17.0.1 — Copyright 2010 James Halliday (mail@substack.net); Modified work Copyright 2014 Contributors (ben@npmjs.com)
|
|
@@ -7,7 +7,7 @@ var __dirname = __pathDirname(__filename);
|
|
|
7
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("./PWGFZ5ZK.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("./LCFG5N4V.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{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"./
|
|
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"./GKXY6U4S.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{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"./6WZUCZGV.js";import{k as l}from"./LD5MEXEL.js";import{join as p}from"node:path";function k(t,n){let e=$(t,"swr");if(e.length===0)return"";let s=e.some(a),o=e.some(r=>!a(r));return[...s?['import useSWR from "swr";']:[],...o?['import useSWRMutation from "swr/mutation";']:[],f(e,n.sdkModule,s),...e.flatMap(r=>a(r)?g(r):[S(r)])].join(`
|
|
8
8
|
|
|
9
9
|
`)}function y(t,n,e){return`export function use${l(t.name)}(${n}) {
|
|
10
10
|
return ${e};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{b as A,c as F,d as S,e as l}from"./
|
|
7
|
+
import{b as A,c as F,d as S,e as l}from"./I5CGSLGR.js";import"./US7X4XPD.js";import{e as $,g as x,n as I,o as P}from"./DS4SCWID.js";import{f as p}from"./6NB3FKVN.js";import"./GKXY6U4S.js";import{aa as w,ia as n,l as u}from"./22EANOP2.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function O({argv:t,config:o,version:c}){let h=performance.now(),j=Date.now(),{organization:g,project:d,"mount-path":z,verbose:D}=t,f=t.domain||x(),e,r,y,b,s=[];try{let i=$();if(e=P(t.files,(a,T)=>{n.warn(`File ${a} is overwritten by ${T}
|
|
8
8
|
`)}),!e.length)return p("push",h,"No files to upload");let m=await I({domain:f,apiKey:i,organization:g,project:d,mountPath:z,files:e,defaultBranch:t["default-branch"],commit:{message:t.message,branchName:t.branch,sha:t["commit-sha"],url:t["commit-url"],createdAt:t["created-at"],namespace:t.namespace,repository:t.repository,author:U(t.author)},version:c,replace:t.replace,onUploadStart:a=>{n.info(`Uploading to ${a.mountPath} ${e.length} ${u("file",e.length)}:
|
|
9
9
|
`)},onSunsetWarning:a=>s.push(a),onSlugDeprecated:S});r=m.pushId,y=m.organizationId,b=m.projectId}catch(i){l("push",s),F("\u2717 File upload failed.",i)}for(let i of e)n.info(w(`\u2713 ${i.name}
|
|
10
10
|
`));return n.info(`
|
|
@@ -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{f as k}from"./
|
|
7
|
+
import{f as k}from"./RU7T4CKG.js";import{a as B}from"./FDGP3ZYZ.js";import{a as x,e as P,f as v,i as H,j as C,k as p,l as M}from"./LD5MEXEL.js";import{n as N}from"./UW4UC7ZI.js";function y(e){let t=new Map(e.pathParams.map(r=>[r.name,r])),n=[];for(let r of e.path.matchAll(/\{([^{}]+)\}/g)){let s=t.get(r[1]);s!==void 0&&n.push(s)}return n}function I(e){let t=y(e),n=e.queryParams.length>0,r=!!e.requestBody,s=e.headerParams.length>0,o=e.cookieParams.length>0;return{hasQuery:n,hasBody:r,hasHeaders:s,hasCookies:o,hasInputs:t.length>0||n||r||s||o,varsRequired:t.length>0||e.queryParams.some(a=>a.required)||(e.requestBody?.required??!1)||e.headerParams.some(a=>a.required)||e.cookieParams.some(a=>a.required),variablesTypeName:`${p(e.name)}Variables`}}var E=" ";function $(e,t,n){let r=C(e,t);return r===void 0?[]:[`${n}/**`,...H(r).split(`
|
|
8
8
|
`).map(s=>`${n} * ${s}`.replace(/ +$/,"")),`${n} */`]}function O(e){return typeof e=="string"?JSON.stringify(e):String(e)}function F(e,t,n){switch(e){case"string":return t?.format==="binary"?"Blob":n==="Date"&&(t?.format==="date-time"||t?.format==="date")?"Date":"string";case"number":case"integer":return"number";case"boolean":return"boolean"}}function j(e){return e.kind==="union"||e.kind==="intersection"||e.kind==="enum"&&e.values.length>1}function c(e,t="string",n=""){switch(e.kind){case"scalar":return F(e.scalar,e.metadata,t);case"ref":return e.name;case"literal":return O(e.value);case"enum":return e.values.map(O).join(" | ");case"null":return"null";case"unknown":return"unknown";case"array":{let r=c(e.items,t,n);return j(e.items)?`(${r})[]`:`${r}[]`}case"record":return`Record<string, ${c(e.value,t,n)}>`;case"object":{if(e.properties.length===0)return"{}";let r=n+E;return`{
|
|
9
9
|
${e.properties.flatMap(o=>K(o,t,r)).join(`
|
|
10
10
|
`)}
|
|
@@ -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}from"./
|
|
7
|
+
import{a,b,c}from"./7WTV5KH3.js";import"./XJE2OFDN.js";import"./3JYQOGV3.js";import"./RU7T4CKG.js";import"./FDGP3ZYZ.js";import"./WZXA5XPB.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{b as typescriptDocs,a as typescriptGenerator,c as typescriptSample};
|
|
@@ -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"./I5CGSLGR.js";import"./US7X4XPD.js";import"./DS4SCWID.js";import"./6NB3FKVN.js";import"./GKXY6U4S.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,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"./IUSSBOYO.js";import"./XJE2OFDN.js";import"./6WZUCZGV.js";import"./3JYQOGV3.js";import"./RU7T4CKG.js";import"./FDGP3ZYZ.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 x,b as f,c as m,d}from"./
|
|
7
|
+
import{a as x,b as f,c as m,d}from"./6WZUCZGV.js";import{b as y,d as h,e as l}from"./LD5MEXEL.js";import{m as P}from"./UW4UC7ZI.js";import{join as E}from"node:path";function q(e,t){let n=x(e,"tanstack-query");if(n.length===0)return"";let r=t.pagination??new Map;return[j(n,t,r),...n.filter(f).map(i=>K(i,t.queryKeyPrefix)),Q(e,n,r,t.queryKeyPrefix,t.argsStyle),...R(n,r)].join(`
|
|
8
8
|
`)}function b(e,t){if(!f(e))return!1;let n=t.get(e.name);return n!==void 0&&n.spec.style!=="link"}function j(e,t,n){let r=[...e.some(a=>b(a,n))?["infiniteQueryOptions"]:[],...e.some(f)?["queryOptions"]:[]],s=[...e.filter(m).map(d),"RequestOptions"].sort().map(a=>`type ${a}`),i=[];return r.length>0&&i.push(`import { ${r.join(", ")} } from "@tanstack/${t.framework}-query";`),i.push(`import { client, ${s.join(", ")} } from "${t.sdkModule}";`),i.join(`
|
|
9
9
|
`)}function K(e,t){let n=M(e,t);return m(e)?`export const ${e.name}QueryKey = (vars?: ${d(e)}) =>
|
|
10
10
|
vars === undefined ? ([${n}] as const) : ([${n}, vars] as const);`:`export const ${e.name}QueryKey = () => [${n}] as const;`}function M(e,t){return t===void 0?`"${e.name}"`:`${h(t)}, "${e.name}"`}function Q(e,t,n,r,s){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{c as a,d as b}from"./
|
|
7
|
+
import{c as a,d as b}from"./7WM6VLB3.js";import"./FDGP3ZYZ.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}from"./
|
|
7
|
+
import{a}from"./36IHQANV.js";import"./6WZUCZGV.js";import"./3JYQOGV3.js";import"./RU7T4CKG.js";import"./FDGP3ZYZ.js";import"./WZXA5XPB.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as swrGenerator};
|
|
@@ -4,6 +4,6 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a}from"./
|
|
7
|
+
import{a}from"./3JYQOGV3.js";import{ia as p}from"./22EANOP2.js";function g(t,r){let n=t.services.flatMap(e=>e.operations),s=n.filter(e=>e.sse!==void 0);s.length>0&&p.warn(`generate-client: ${r} skipped ${s.length} server-sent-events operation(s) \u2014 iterate the sdk's exported async generators directly: ${s.map(e=>e.name).join(", ")}.
|
|
8
8
|
`);let i=new Set(t.schemas.map(e=>e.name)),o=n.filter(e=>e.sse===void 0&&m(e,i));return o.length>0&&p.warn(`generate-client: ${r} skipped ${o.length} operation(s) whose variables type name collides with a schema \u2014 rename the schema or the operation: ${o.map(e=>e.name).join(", ")}.
|
|
9
9
|
`),n.filter(e=>e.sse===void 0&&!m(e,i))}function m(t,r){let n=a(t);return n.hasInputs&&r.has(n.variablesTypeName)}function x(t){return t.method==="get"||t.method==="head"}function u(t){return a(t).hasInputs}function f(t){return a(t).variablesTypeName}function $(t,r,n){let s=[];return a(t).hasInputs?s.push(r):n&&s.push("{}"),n&&s.push("{ ...init, envelope: undefined }"),`${t.name}(${s.join(", ")})`}function v(t,r,n){let s=t.map(e=>e.name).sort(),i=t.filter(u).map(f).sort();return n&&i.push("RequestOptions"),`import { ${[...s,...i.map(e=>`type ${e}`)].join(", ")} } from ${JSON.stringify(r)};`}export{g as a,x as b,u as c,f as d,$ as e,v as f};
|
|
@@ -4,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"./FDGP3ZYZ.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,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 ee,b as te,f as ne,g as E,h as re}from"./
|
|
7
|
+
import{a as ee,b as te,f as ne,g as E,h as re}from"./FDGP3ZYZ.js";import{a as y}from"./WZXA5XPB.js";import{Aa as Z,P as W,V,c as x,ia as b,ka as Q,r as v,ra as Y,s as H,ta as T,u as J}from"./22EANOP2.js";import{b as A,c as G,k as D}from"./LD5MEXEL.js";import{mkdir as ct,readFile as ut,writeFile as dt}from"node:fs/promises";import{dirname as ke,parse as ft,resolve as R,sep as pt}from"node:path";function M(e){return{requires:["typescript"],errorModes:["throw"],load:()=>import("./CIDSJFJO.js").then(t=>({run:t.tanstackQueryGenerator(e)}))}}var U={outputMode:"it always emits one self-contained file",runtime:"the runtime is always embedded in the generated file",argsStyle:"inputs follow the target language's own idiom",importExt:"the generated file has no relative imports"},I={typescript:{load:()=>import("./3WHXM4DJ.js").then(e=>({run:e.typescriptGenerator,sample:e.typescriptSample,docs:e.typescriptDocs}))},zod:{load:()=>import("./M3XPS7UF.js").then(e=>({run:e.zodGenerator}))},transformers:{requires:["typescript"],dateTypes:["Date"],load:()=>import("./IULINGO6.js").then(e=>({run:e.transformersGenerator}))},"tanstack-query":M("react"),"tanstack-query-vue":M("vue"),"tanstack-query-svelte":M("svelte"),"tanstack-query-solid":M("solid"),swr:{requires:["typescript"],errorModes:["throw"],load:()=>import("./6MH5ZWLD.js").then(e=>({run:e.swrGenerator}))},mock:{requires:["typescript"],load:()=>import("./XFBJHVYU.js").then(e=>({run:e.mockGenerator}))},cli:{requires:["typescript","zod"],errorModes:["throw"],load:()=>import("./4OEXH5EV.js").then(e=>({run:e.cliGenerator,sample:e.cliSample,docs:e.cliDocs}))},python:{notApplicable:U,load:()=>import("./V2YF33JL.js").then(e=>({run:e.pythonGenerator,sample:e.pythonSample,docs:e.pythonDocs,options:e.pythonOptions}))},go:{errorModes:["throw"],notApplicable:U,load:()=>import("./VXONEXYX.js").then(e=>({run:e.goGenerator,sample:e.goSample,docs:e.goDocs}))},php:{errorModes:["throw"],notApplicable:U,load:()=>import("./V3ILUN2S.js").then(e=>({run:e.phpGenerator,sample:e.phpSample,docs:e.phpDocs}))}};function oe(e,t,n,r){let s=new Set(e);t.goPackage!==void 0&&!s.has("go")&&b.warn(`generate-client: goPackage is ignored \u2014 it declares the Go package clause, and no selected generator uses it (add --generator go).
|
|
8
8
|
`);let o=t.errorMode??"throw",i=t.dateType??"string";for(let a of e){let c=n.get(a);if(!c)throw new y(`Unknown generator: ${a}`);for(let d of c.requires??[])if(!s.has(d)){let f=[...new Set([d,...e])].map(m=>`--generator ${m}`).join(" ");throw new y(`The "${a}" generator requires the "${d}" generator. Add it, e.g. ${f}.`)}if(c.errorModes&&!c.errorModes.includes(o))throw new y(`The "${a}" generator does not support --error-mode "${o}" (supported: ${c.errorModes.join(", ")}).`);if(c.dateTypes&&!c.dateTypes.includes(i))throw new y(`The "${a}" generator requires --date-type ${c.dateTypes.join(" or ")} (got "${i}") so the runtime values match the generated types.`);let u={...t,outputMode:r};for(let[d,f]of Object.entries(c.notApplicable??{}))u[d]!==void 0&&b.warn(`generate-client: the "${a}" generator ignores ${d} \u2014 ${f}.
|
|
9
9
|
`)}}function se(e,t,n){let r=new Map;for(let s of e){let o=t.get(s)?.options,i=n?.[s];if(o===void 0){i!==void 0&&b.warn(`generate-client: the "${s}" generator declares no options, so client.options.${s} is ignored.
|
|
10
10
|
`),r.set(s,{});continue}r.set(s,ve(s,o,i))}return r}function ve(e,t,n){if(n!==void 0&&!x(n))throw new y(`The "${e}" generator's options must be a map of option names to values.`);let r=n??{},s=Object.keys(t.properties);if(t.additionalProperties!==!0){for(let i of Object.keys(r))if(!s.includes(i))throw new y(`The "${e}" generator got an unknown option "${i}". Declared options: ${s.join(", ")||"(none)"}.`)}for(let i of t.required??[])if(r[i]===void 0)throw new y(`The "${e}" generator requires the "${i}" option.`);let o={...r};for(let[i,a]of Object.entries(t.properties)){if(o[i]===void 0){a.default!==void 0&&(o[i]=a.default);continue}let c=Se(a,o[i]);if(c!==void 0)throw new y(`The "${e}" generator's "${i}" ${c}.`)}return o}function Se(e,t){if("enum"in e)return e.enum.includes(t)?void 0:`must be one of: ${e.enum.join(", ")}`;if(e.type==="array"){let n=e.items.type;return Array.isArray(t)&&t.every(r=>typeof r===n)?void 0:`must be an array of ${n}`}return typeof t===e.type?void 0:`must be a ${e.type}`}import{isAbsolute as xe,resolve as qe}from"node:path";import{pathToFileURL as Pe}from"node:url";var Oe=function(e,t){return typeof e=="string"&&/^\.\.?\//.test(e)?e.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i,function(n,r,s,o,i){return r?t?".jsx":".js":s&&(!o||!i)?n:s+o+"."+i.toLowerCase()+"js"}):e};async function ae(e,t={}){let n=new Map;for(let a of t.customGenerators??[])ce(n,a);let r=[];for(let a of e)r.push(await ie(a,n,t.configDir));let s=[],o=new Set,i=async a=>{if(!(s.includes(a)||o.has(a))){o.add(a);for(let c of n.get(a).requires??[])(n.has(c)||c in I)&&await i(await ie(c,n,t.configDir));o.delete(a),s.push(a)}};for(let a of r)await i(a);return{selected:s,registry:n}}async function ie(e,t,n){if(t.has(e))return e;let r=I[e];if(r!==void 0){let{load:o,...i}=r;return t.set(e,{...i,...await o()}),e}if(e==="sdk")throw new y('The "sdk" generator is now named "typescript". Update the `generators` list or the --generator flag.');let s=await je(e,n??process.cwd());return ce(t,s),s.name}function ce(e,t){if(!x(t)||typeof t.name!="string"||t.name===""||typeof t.run!="function")throw new y("Invalid custom generator: expected an object with a non-empty string `name` and a `run` function (build one with `defineGenerator`).");if(e.has(t.name))throw new y(`Generator name "${t.name}" collides with an existing generator. Rename the custom generator.`);if(t.requiresGenerator!==void 0){let n=re(E,t.requiresGenerator);if(n===void 0)throw new y(`Generator "${t.name}" declares requiresGenerator "${t.requiresGenerator}", which is not a range we read. Use ^1.2.0, ~1.2.0, >=1.2.0, or an exact version.`);if(!n)throw new y(`Generator "${t.name}" needs @redocly/client-generator ${t.requiresGenerator}; this CLI ships ${E}. Upgrade @redocly/cli if the generator is newer, or update the generator \u2014 \`redocly eject-generator <name> --update\` for an ejected file, or upgrade its package.`)}t.name in I&&b.warn(`generate-client: custom generator "${t.name}" takes over the built-in generator of the same name.
|
|
@@ -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 E,d as w,f as A,g as M,h as q,i as D,j as B,k as F}from"./
|
|
7
|
+
import{b as S,c as E,d as w,f as A,g as M,h as q,i as D,j as B,k as F}from"./3JYQOGV3.js";import{h as b,j as T}from"./RU7T4CKG.js";import{a as f,c as R,d as v,e as k}from"./FDGP3ZYZ.js";import{d as I,f as N,h as P,i as j,m as C}from"./LD5MEXEL.js";import{join as Y}from"node:path";var y="// Generated by @redocly/client-generator \u2014 do not edit by hand.\n// Source: OpenAPI description. Re-run `redocly generate-client` to update.";function $(e){return e.filter(t=>t.length>0).join(`
|
|
8
8
|
|
|
9
9
|
`)+`
|
|
10
10
|
`}function O(e){let t=["/**",` * ${j(`${e.title} (v${e.version})`)}`];if(e.description)for(let n of C(j(e.description)))t.push(` * ${n}`.replace(/ +$/,""));return t.push(" */"),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}from"./
|
|
7
|
+
import{a}from"./5SIJI5LC.js";import"./6WZUCZGV.js";import"./3JYQOGV3.js";import"./RU7T4CKG.js";import"./FDGP3ZYZ.js";import"./WZXA5XPB.js";import"./22EANOP2.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as tanstackQueryGenerator};
|
|
@@ -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"./FDGP3ZYZ.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(`
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as K}from"./GKXY6U4S.js";import{Aa as V,j as z,l as I,o as H,oa as m,p as q,ta as Y}from"./22EANOP2.js";import{e as b}from"./RFWIIJFG.js";var Q=b(K(),1);var T=b(K(),1);function G(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function X(n){let t=process.env.NO_PROXY||process.env.no_proxy;if(!t)return!1;let e=t.split(",").map(s=>s.trim().toLowerCase()).filter(Boolean);if(e.length===0)return!1;let r;try{r=new URL(n).hostname.toLowerCase()}catch{return!1}return e.some(s=>!!(s==="*"||r===s||s.startsWith(".")&&r.endsWith(s)||!s.startsWith(".")&&r.endsWith("."+s)))}var Z=async(n,{timeout:t,...e}={})=>{let r=G(),s=r&&!X(n),o;s?o=new T.ProxyAgent({uri:r}):t&&(o=new T.Agent({connect:{timeout:t}}));try{return await(0,T.fetch)(n,{signal:t?AbortSignal.timeout(t):void 0,...e,dispatcher:o})}catch(i){throw await o?.destroy(),i}};var de=/^[\x21-\x7e]+( [\x21-\x7e]+)*$/;function J(){let n=process.env.REDOCLY_ENVIRONMENT?.trim();return n&&de.test(n)?n:void 0}var u=class extends Error{status;constructor(t,e){super(t),this.status=e}},x=class{command;version;sunsetWarnings=[];constructor(t,e="2.0"){this.command=t,this.version=e}async request(t,e){let r=J(),s={...e.headers,"user-agent":`redocly-cli/${this.version} ${this.command}${r?` ${r}`:""}`};try{let o=await Z(t,{...e,headers:s});return this.collectSunsetWarning(o),o}catch(o){let i=o.cause??o,a=`Failed to fetch. Caused by ${i.message||i.name}.`;throw typeof i.code=="string"&&(a+=` Code: ${i.code}`),new Error(a)}}collectSunsetWarning(t){let e=this.getSunsetDate(t);if(!e)return;let r=new Date(e);e>Date.now()?this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!1}):this.sunsetWarnings.push({sunsetDate:r,isSunsetExpired:!0})}getSunsetDate(t){let{headers:e}=t;if(!e)return;let r=e.get("sunset")||e.get("Sunset");if(r)return Date.parse(r)}},U=class{client;domain;apiKey;constructor(t,e,r){this.client=t,this.domain=e,this.apiKey=r}async getParsedResponse(t){let e=await t.json();if(t.ok)return e;throw new u(`${e.title||t.statusText||"Unknown error"}.`,t.status)}},N=class extends U{async find(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return r.status===404?void 0:await this.getParsedResponse(r)}catch(r){let s=`Failed to fetch project. ${r.message}`;throw r instanceof u?new u(s,r.status):new Error(s)}}},j=class extends U{async getDefaultBranch(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/source`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return(await this.getParsedResponse(r)).branchName}catch(r){let s=`Failed to fetch default branch. ${r.message}`;throw r instanceof u?new u(s,r.status):new Error(s)}}async upsert(t,e,r){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/remotes`,{timeout:6e3,method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`},body:JSON.stringify({mountPath:r.mountPath,mountBranchName:r.mountBranchName,type:"CICD",autoMerge:!0})});return await this.getParsedResponse(s)}catch(s){let o=`Failed to upsert remote. ${s.message}`;throw s instanceof u?new u(o,s.status):new Error(o)}}async push(t,e,r,s){let o=new Q.FormData;o.append("remoteId",r.remoteId),o.append("commit[message]",r.commit.message),o.append("commit[author][name]",r.commit.author.name),o.append("commit[author][email]",r.commit.author.email),o.append("commit[branchName]",r.commit.branchName),r.commit.url&&o.append("commit[url]",r.commit.url),r.commit.namespace&&o.append("commit[namespaceId]",r.commit.namespace),r.commit.sha&&o.append("commit[sha]",r.commit.sha),r.commit.repository&&o.append("commit[repositoryId]",r.commit.repository),r.commit.createdAt&&o.append("commit[createdAt]",r.commit.createdAt);for(let i of s){let a=Buffer.isBuffer(i.stream)?new Blob([i.stream]):new Blob([await he(i.stream)]);o.append(`files[${i.path}]`,a,i.path)}r.isMainBranch&&o.append("isMainBranch","true"),r.replace&&o.append("replace","true");try{let i=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes`,{method:"POST",headers:{Authorization:`Bearer ${this.apiKey}`},body:o});return await this.getParsedResponse(i)}catch(i){let a=`Failed to push. ${i.message}`;throw i instanceof u?new u(a,i.status):new Error(a)}}async getPush({organizationId:t,projectId:e,pushId:r}){try{let s=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes/${r}`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.apiKey}`}});return await this.getParsedResponse(s)}catch(s){let o=`Failed to get push status. ${s.message}`;throw s instanceof u?new u(o,s.status):new Error(o)}}},g=class{apiClient;projects;remotes;constructor({domain:t,apiKey:e,command:r,version:s}){this.apiClient=new x(r,s),this.projects=new N(this.apiClient,t,e),this.remotes=new j(this.apiClient,t,e)}getSunsetWarning(){return ee(this.apiClient.sunsetWarnings)}};function ee(n){let[t]=[...n].sort((e,r)=>e.isSunsetExpired!==r.isSunsetExpired?e.isSunsetExpired?-1:1:e.sunsetDate>r.sunsetDate?1:-1);return t}async function he(n){let t=[];for await(let e of n)t.push(e);return Buffer.concat(t)}function fe(){if(process.env.REDOCLY_AUTHORIZATION)return process.env.REDOCLY_AUTHORIZATION;throw new Error("No api key provided, please use environment variable REDOCLY_AUTHORIZATION.")}var pe=/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/,R={us:"https://app.cloud.redocly.com",eu:"https://app.cloud.eu.redocly.com"};function me(){return process.env.REDOCLY_DOMAIN||R.us}var te=ge((n,t)=>{try{let e=t||n?.resolvedConfig.residency;return we(e)?R[e]:e?new URL(e).origin:n?.resolvedConfig.scorecard?.fromProjectUrl?new URL(n.resolvedConfig.scorecard.fromProjectUrl).origin:R.us}catch{throw new E}});function D(n){try{te(void 0,n)}catch{return!1}return!0}function ge(n){return(...t)=>{let e=n(...t);if(!e.startsWith("https://")&&!pe.test(e))throw new E;return e}}var E=class extends Error{constructor(){super("Invalid Reunite URL")}};function we(n){return typeof n=="string"&&n in R}import{Buffer as O}from"node:buffer";import F from"node:crypto";import{mkdirSync as ye,existsSync as ne,writeFileSync as ve,readFileSync as Te,rmSync as xe}from"node:fs";import{homedir as Ce}from"node:os";import se from"node:path";import*as re from"node:child_process";var w=class{baseUrl;apiClient;clientName="redocly-cli";constructor(t,e){this.baseUrl=t,this.apiClient=new x("login",e)}async run(t){let e=await this.getDeviceCode();t?.({verificationUri:e.verificationUri,verificationUriComplete:e.verificationUriComplete,userCode:e.userCode}),this.openBrowser(e.verificationUriComplete);let r=await this.pollingAccessToken(e.deviceCode,e.interval,e.expiresIn);return this.withResidency(r)}openBrowser(t){if(!/^https?:\/\//.test(t))return;let[e,r]=process.platform==="win32"?["rundll32",["url.dll,FileProtocolHandler",t]]:process.platform==="darwin"?["open",[t]]:["xdg-open",[t]];re.spawn(e,r,{stdio:"ignore",detached:!0}).on("error",()=>{}).unref()}async verifyToken(t){try{return!!(await this.sendRequest("/session","GET",void 0,{Cookie:`accessToken=${t};`})).user}catch{return!1}}async verifyApiKey(t){try{return!!(await this.sendRequest("/api-keys-verify","POST",{apiKey:t})).success}catch{return!1}}async refreshToken(t){let e=await this.sendRequest("/device-rotate-token","POST",{grant_type:"refresh_token",client_name:this.clientName,refresh_token:t});if(!e.access_token)throw new Error("Failed to refresh token");return this.withResidency({access_token:e.access_token,refresh_token:e.refresh_token,expires_in:e.expires_in})}async pollingAccessToken(t,e,r){return new Promise((s,o)=>{let i=setInterval(async()=>{let c=await this.getAccessToken(t);c.access_token&&(clearInterval(i),clearTimeout(a),s(c)),c.error&&c.error!=="authorization_pending"&&(clearInterval(i),clearTimeout(a),o(c.error_description))},e*1e3),a=setTimeout(async()=>{clearInterval(i),clearTimeout(a),o("Authorization has expired. Please try again.")},r*1e3)})}async getAccessToken(t){return await this.sendRequest("/device-token","POST",{client_name:this.clientName,device_code:t,grant_type:"urn:ietf:params:oauth:grant-type:device_code"})}async getDeviceCode(){let{device_code:t,user_code:e,verification_uri:r,verification_uri_complete:s,interval:o=10,expires_in:i=300}=await this.sendRequest("/device-authorize","POST",{client_name:this.clientName});return{deviceCode:t,userCode:e,verificationUri:r,verificationUriComplete:s,interval:o,expiresIn:i}}async sendRequest(t,e="GET",r=void 0,s={}){let o=`${this.baseUrl}/api${t}`,i=await this.apiClient.request(o,{body:r&&JSON.stringify(r),method:e,headers:{"Content-Type":"application/json",...s},timeout:6e3});return i.status===204?{success:!0}:await i.json()}withResidency(t){return{...t,residency:this.baseUrl}}};var Pe="4618dbc9-8aed-4e27-aaf0-225f4603e5a4",oe="aes-256-cbc",k=class{version;credentialsFolderPath;credentialsFilePath;credentialsFileName;key;iv;constructor(t){this.version=t;let e=Ce();this.credentialsFolderPath=se.join(e,".redocly"),this.credentialsFileName="credentials",this.credentialsFilePath=se.join(this.credentialsFolderPath,this.credentialsFileName),this.key=F.createHash("sha256").update(`${this.credentialsFolderPath}${Pe}`).digest(),this.iv=F.createHash("md5").update(this.credentialsFolderPath).digest(),ye(this.credentialsFolderPath,{recursive:!0})}async login(t,e){let s=await new w(t,this.version).run(e);if(!s)throw new Error("Failed to login. No credentials received.");await this.saveCredentials(s)}async logout(){try{this.removeCredentials()}catch{}}async isAuthorized(t,e){return e?new w(t,this.version).verifyApiKey(e):!!await this.getAccessToken(t)}getAccessToken=async t=>{let e=new w(t,this.version),r=await this.readCredentials();if(!r||!D(t)||r.residency&&r.residency!==t)return null;if(await e.verifyToken(r.access_token))return r.access_token;try{let o=await e.refreshToken(r.refresh_token);return await this.saveCredentials(o),o.access_token}catch{return null}};async saveCredentials(t){try{let e=this.encryptCredentials(t);ve(this.credentialsFilePath,e,"utf8")}catch(e){throw new Error(`Failed to save credentials: ${e.message}`)}}async readCredentials(){if(!ne(this.credentialsFilePath))return null;try{let t=Te(this.credentialsFilePath,"utf8");return this.decryptCredentials(t)}catch{return null}}async removeCredentials(){ne(this.credentialsFilePath)&&xe(this.credentialsFilePath)}encryptCredentials(t){let e=F.createCipheriv(oe,this.key,this.iv);return O.concat([e.update(JSON.stringify(t),"utf8"),e.final()]).toString("hex")}decryptCredentials(t){let e=F.createDecipheriv(oe,this.key,this.iv),r=O.concat([e.update(O.from(t,"hex")),e.final()]);return JSON.parse(r.toString("utf8"))}};import*as y from"node:fs";import*as h from"node:path";var Re=/\/orgs\/([^/]+)\/projects\//,Ee=[401,403];async function C(n,{organization:t,project:e,onSlugDeprecated:r}){let s=await $e(n,t,e);if(!s)return{organizationId:t,projectId:e};let o={organizationId:_e(s.uri),projectId:s.id};return(o.organizationId!==t||o.projectId!==e)&&r?.(o),o}async function $e(n,t,e){try{let r=await n.projects.find(t,e);if(!r)throw new u(`Project "${e}" was not found in organization "${t}". Use the IDs from the organization and project settings in Reunite.`,404);return r}catch(r){if(r instanceof u&&Ee.includes(r.status))return;throw r}}function _e(n){let t=n.match(Re)?.[1];if(!t)throw new Error(`Could not read the organization ID from the project URI "${n}".`);return t}async function Se({domain:n,apiKey:t,organization:e,project:r,mountPath:s,files:o,defaultBranch:i,commit:a,version:c,replace:$,onUploadStart:_,onSunsetWarning:v,onSlugDeprecated:A}){let f=new g({domain:n,apiKey:t,command:"push",version:c});try{let{organizationId:d,projectId:l}=await C(f,{organization:e,project:r,onSlugDeprecated:A}),M=await f.remotes.getDefaultBranch(d,l),p=await f.remotes.upsert(d,l,{mountBranchName:M,mountPath:s});_?.(p);let{id:P}=await f.remotes.push(d,l,{remoteId:p.id,commit:a,isMainBranch:i===a.branchName,replace:$},o.map(W=>({path:H(W.name),stream:y.createReadStream(W.path)})));return{pushId:P,organizationId:d,projectId:l}}finally{let d=f.getSunsetWarning();d&&v?.(d)}}function Ue(n,t){let e={};for(let s of n)if(y.statSync(s).isDirectory()){let o=s;ie(o,[]).forEach(a=>r(a,o))}else r(s,h.dirname(s));function r(s,o){let i=h.relative(o,s);e[i]&&t?.(e[i],s),e[i]=s}return Object.entries(e).map(([s,o])=>({name:s,path:h.resolve(o)}))}function ie(n,t){let e=y.readdirSync(n);for(let r of e){let s=h.join(n,r);y.statSync(s).isDirectory()?t=ie(s,t):t.push(s)}return t}async function ae({operation:n,condition:t,onConditionNotMet:e,startTime:r=Date.now(),retryTimeoutMs:s=6e5,retryIntervalMs:o=5e3}){async function i(){let a=await n();if(t(a))return a;if(Date.now()-r>s)throw new Error("Timeout exceeded.");return await e?.(a),await z(o),i()}return i()}var Fe=1200,Ae=5e3,Ie=["pending","running"];async function Ne(n){let t=ce(n);try{let e=await C(t,n);return await le(t,e,n.pushId)}finally{ue(t,n)}}async function je({buildType:n,maxExecutionTime:t=Fe,retryIntervalMs:e=Ae,startTime:r=Date.now(),onRetry:s,...o}){let i=ce(o);try{let a=await C(i,o);return await ae({operation:()=>le(i,a,o.pushId),condition:c=>!Ie.includes(c.status[n].deploy.status),onConditionNotMet:s,startTime:r,retryTimeoutMs:t*1e3,retryIntervalMs:e})}finally{ue(i,o)}}function ce({domain:n,apiKey:t,version:e}){return new g({domain:n,apiKey:t,command:"push-status",version:e})}function ue(n,{onSunsetWarning:t}){let e=n.getSunsetWarning();e&&t?.(e)}function le(n,{organizationId:t,projectId:e},r){return n.remotes.getPush({organizationId:t,projectId:e,pushId:r})}async function De({projectUrl:n,auth:t,isApiKey:e=!1,onDebug:r}){let s=Oe(n);if(!s)throw new m(`Invalid project URL format: ${n}`);try{let o=await ke({...s,auth:t,isApiKey:e,onDebug:r}),i=o.config.scorecardClassic||o.config.scorecard;if(!i)throw new Error("No scorecard configuration found.");let a=o.config.pluginsUrl,c=a?await Le(a,r):void 0;return{scorecard:i,plugins:c,pluginsUrl:a}}catch(o){throw new m(o instanceof Error?o.message:String(o))}}function Oe(n){let t=new URL(n),e=t.pathname.match(/\/org\/(?<orgSlug>[^/]+)\/project\/(?<projectSlug>[^/]+)/);if(!e?.groups)return;let{orgSlug:r,projectSlug:s}=e.groups;return{residency:t.origin,orgSlug:r,projectSlug:s}}async function ke({residency:n,orgSlug:t,projectSlug:e,auth:r,isApiKey:s,onDebug:o}){let i=new URL(`${n}/api/orgs/${t}/projects/${e}`),a=await fetch(i,{headers:Be(r,s)});if(o?.(`Project fetch response status: ${a.status}`),a.status===401||a.status===403)throw o?.(`Authentication failed with status ${a.status}.`),o?.("Check that your credentials are valid and have the necessary permissions."),new Error(`Unauthorized access to project: ${e}. Please check your credentials.`);if(a.status!==200)throw new Error(`Failed to fetch project: ${e}. Status: ${a.status}`);return o?.("Successfully received project configuration."),a.json()}async function Le(n,t){t?.(`Fetching plugins from: ${n}`);try{let e=await fetch(n);if(t?.(`Plugins fetch response status: ${e.status}`),e.status!==200){t?.("Failed to fetch plugins");return}return e.text()}catch(e){t?.(`Error fetching plugins: ${e instanceof Error?e.message:String(e)}`);return}}function Be(n,t){return t?{Authorization:`Bearer ${n}`}:{Cookie:`accessToken=${n}`}}async function L(n,t,e=[],r=[],s){let o={};for(let i of e){let a={[i.name]:{root:n,rules:t}},c=await Y({apis:a,...i,plugins:r},{configPath:s});o[i.name]=c.forAlias(i.name)}return o}function B(n,t){if(n){for(let e of n)if(Object.entries(e.where?.metadata||{}).every(([s,o])=>Me(s,o,t)))return e}}function Me(n,t,e){if(t.match(/^\d{4}-\d{2}-\d{2}(T\d{2}:\d{2}:\d{2}Z)?\/(\d{4}-\d{2}-\d{2})?$/)){if(!e[n])return!1;let[r,s]=t.split("/"),o=new Date(e[n]);return!(o<new Date(r)||s&&o>new Date(s))}else if(t.match(/^\/.*\//)){if(!e[n])return!1;try{return q(t).test(e[n])}catch{throw new m(`Invalid regex in scorecard target "${n}": ${t}`)}}return e[n]===t}import{pathToFileURL as We}from"node:url";async function be(n,t){if(!n)return[];let e=We(t??process.cwd()).href+"/",r=n.replaceAll("__redocly_dirname",`"${e}"`);return(await import(`data:text/javascript;base64,${btoa(r)}`)).default.map(i=>i())}var ze=".redocly.com";function He(n){try{return new URL(n).hostname.toLowerCase().endsWith(ze)}catch{return!1}}async function qe({apiPath:n,document:t,externalRefResolver:e,scorecardConfig:r,configPath:s,plugins:o=[],targetLevel:i,metadata:a={},onDebug:c}){let $=[],_=new Map,v=r.levels||[];if(i&&!v.some(l=>l.name===i))throw new m(`Target level "${i}" not found in the scorecard configuration levels.
|
|
8
|
+
`);let A=B(r.targets,a)?.rules,f=await L(n,A,v,o,s||"");for(let l of v){c?.(`
|
|
9
|
+
Validating level: "${l.name}"`),o.length>0&&c?.(`Using ${o.length} ${I("plugin",o.length)} for this level.`),c?.("Linting document against level rules...");let p=(await V({document:t,externalRefResolver:e,config:f[l.name]})).filter(({ignored:P})=>!P).map(P=>({...P,scorecardLevel:l.name}));c?.(`Found ${p.length} ${I("problem",p.length)} for level "${l.name}".`),_.set(l.name,p),$.push(...p)}let d=Ye(_,v,i);return{problems:$,achievedLevel:d,targetLevelAchieved:i?d===i:!0}}function Ye(n,t,e){let r=null;for(let s of t){if((n.get(s.name)||[]).some(a=>a.severity==="error"))return r||"Non Conformant";if(r=s.name,e&&s.name===e)return s.name}return r||"Non Conformant"}export{u as a,x as b,g as c,ee as d,fe as e,R as f,me as g,te as h,D as i,E as j,w as k,k as l,C as m,Se as n,Ue as o,Ne as p,je as q,De as r,L as s,B as t,be as u,He as v,qe as w};
|
|
@@ -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"./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(`
|
|
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"./RU7T4CKG.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{i as c,l as a}from"./
|
|
7
|
+
import{i as c,l as a}from"./DS4SCWID.js";import"./GKXY6U4S.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
8
|
password=${o}
|
|
9
9
|
`:(s.error(`You are not logged in to ${e}. Run \`redocly login --residency ${e}\` or set the REDOCLY_AUTHORIZATION environment variable.
|
|
10
10
|
`),`quit=1
|
|
@@ -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.3",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.2"},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};
|