@redocly/cli 2.70.0 → 2.71.0
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/lib/chunks/{FXHPWQD4.js → 2UAA6O26.js} +1 -1
- package/lib/chunks/{23VRM4VC.js → 3DMXMP4K.js} +1 -1
- package/lib/chunks/{YNBDXA7I.js → 5ECOOGVW.js} +1 -1
- package/lib/chunks/{CKDLDSPG.js → 6TE6AFQ3.js} +1 -1
- package/lib/chunks/B5KSRXXW.js +10 -0
- package/lib/chunks/{AFZIICGE.js → BCRM4BTA.js} +1 -1
- package/lib/chunks/{KGWCBODF.js → BPDHBW3N.js} +1 -1
- package/lib/chunks/{LG6FRFOY.js → CN2ZOHYL.js} +1 -1
- package/lib/chunks/{RWKEGTOO.js → CZS2ZXJ7.js} +1 -1
- package/lib/chunks/{IPDHEEHQ.js → E3FBSKNS.js} +1 -1
- package/lib/chunks/{57DEU3FG.js → E4MPGN3Z.js} +1 -1
- package/lib/chunks/{BD5WLGAJ.js → EFB2YVY2.js} +1 -1
- package/lib/chunks/{EK7EYCIE.js → EHQY7ZOF.js} +1 -1
- package/lib/chunks/{AHEGLURA.js → EWU57NBY.js} +1 -1
- package/lib/chunks/{U6PNFV4R.js → G2M6SQCS.js} +2 -2
- package/lib/chunks/{MOK3JA6R.js → GMGZQR6Q.js} +1 -1
- package/lib/chunks/{BXUA6AY4.js → JCP37EY3.js} +1 -1
- package/lib/chunks/{JKDUUCNL.js → K6VR5YNF.js} +1 -1
- package/lib/chunks/{ACLT4ABL.js → L4F2ERUL.js} +1 -1
- package/lib/chunks/{UW36CSXE.js → LNEXTJNF.js} +1 -1
- package/lib/chunks/{LAML5K4D.js → M6UVHV6D.js} +1 -1
- package/lib/chunks/MQUZ5IJ2.js +8 -0
- package/lib/chunks/{YQZIKJQK.js → MV3ZJ5HR.js} +1 -1
- package/lib/chunks/{ODGGZDFZ.js → MYOQDPQZ.js} +1 -1
- package/lib/chunks/{6P2KU7XN.js → MYSYBBIO.js} +1 -1
- package/lib/chunks/{K4NCFIYY.js → N37OGNC4.js} +3 -3
- package/lib/chunks/{U32PWLWM.js → NBMSBQEL.js} +1 -1
- package/lib/chunks/NCDX4IGX.js +7 -0
- package/lib/chunks/O37B7ABT.js +9 -0
- package/lib/chunks/{EIXR5LCC.js → O6NMXFEP.js} +1 -1
- package/lib/chunks/{S6P42X5N.js → O72R3AD4.js} +1 -1
- package/lib/chunks/{NOS4FCD7.js → P7LM57HK.js} +1 -1
- package/lib/chunks/{636S3S3W.js → QAPQYNI3.js} +1 -1
- package/lib/chunks/{EV2R6OHD.js → QB6CQ2CV.js} +1 -1
- package/lib/chunks/{SV2XHB2S.js → QMS4UKIK.js} +3 -3
- package/lib/chunks/{LT6WLL3O.js → QTGTCBFK.js} +1 -1
- package/lib/chunks/{6RKDRRBP.js → RIGQPR2I.js} +1 -1
- package/lib/chunks/{QKUESS2C.js → RZ3FGCBT.js} +1 -1
- package/lib/chunks/{7PKQV3SS.js → SBHCUK5I.js} +1 -1
- package/lib/chunks/{S56YFLS5.js → SBT63VHF.js} +1 -1
- package/lib/chunks/{7R4MBJSO.js → STAMDB3P.js} +1 -1
- package/lib/chunks/SXIMN47K.js +7 -0
- package/lib/chunks/{BMAUX474.js → TR67FYLT.js} +1 -1
- package/lib/chunks/{PL7WHX67.js → TXSBWL3Y.js} +1 -1
- package/lib/chunks/{7CBQD5PF.js → V6VNRABV.js} +1 -1
- package/lib/chunks/{YYPD75S5.js → VJHJJBVN.js} +1 -1
- package/lib/chunks/{DQDJVO3X.js → VQRJE4I2.js} +1 -1
- package/lib/chunks/{Q43RV27Q.js → VXD5O25A.js} +1 -1
- package/lib/chunks/{ERYWHU32.js → WACZWFKN.js} +1 -1
- package/lib/chunks/{RGVTUA3V.js → WJXIZZA6.js} +1 -1
- package/lib/chunks/{27HOIIUB.js → YDGFDJ2K.js} +1 -1
- package/lib/chunks/{MKYAX4HH.js → YDQCJP4F.js} +1 -1
- package/lib/chunks/{EHJFDQN5.js → YLRH4RVF.js} +1 -1
- package/lib/chunks/{7GM5RHYD.js → YUEIHUPX.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 +37 -37
- package/package.json +1 -1
- package/lib/chunks/GBN5W6T3.js +0 -9
- package/lib/chunks/HJWQEB7Y.js +0 -7
- package/lib/chunks/JUWXQD7B.js +0 -8
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as C}from"./
|
|
7
|
+
import{a as C}from"./JCP37EY3.js";import{c as w}from"./WBWCX3LS.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{i as c,l as a}from"./
|
|
7
|
+
import{i as c,l as a}from"./O37B7ABT.js";import"./GKXY6U4S.js";import{fa as s}from"./WBWCX3LS.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
|
|
@@ -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"./YDQCJP4F.js";import"./RLJVKAOL.js";import"./O37B7ABT.js";import"./GKXY6U4S.js";import"./QMS4UKIK.js";import"./WBWCX3LS.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{a}from"./
|
|
7
|
+
import{a}from"./YLRH4RVF.js";import"./QB6CQ2CV.js";import"./3DMXMP4K.js";import"./EFB2YVY2.js";import"./JCP37EY3.js";import"./WZXA5XPB.js";import"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as tanstackQueryGenerator};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{a as p,b as a}from"./NCDX4IGX.js";import{h as c,m as l}from"./O37B7ABT.js";import"./GKXY6U4S.js";import{fa as i,la as n}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function w({argv:e,config:s,version:f}){let[r,o,...g]=e.project.split("/");if(!r||!o||g.length>0)throw new n(`Specify the project as \`<organization>/<project>\`, for example \`acme/developer-portal\`. Got: \`${e.project}\`.`);let t=c(s,e.residency),m=l(t,r,o),d=p(t,f);i.info(`Cloning ${r}/${o} from ${t}
|
|
8
|
+
`);let{code:j}=await a(["clone",...d.flatMap(C=>["--config",C]),"--",m,e.directory??o]);if(j!==0)throw new n("git clone failed.")}export{w as handleProjectClone};
|
|
@@ -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 V}from"./LS3G7CUH.js";import{c as I,d as N,e as fe,h as G,j as _,k as ue,v as B,w as H}from"./LRMOPAZ4.js";import{a as
|
|
7
|
+
import{a as ae,b as W,c as ce,d as pe}from"./BU4AMVHN.js";import{a as V}from"./LS3G7CUH.js";import{c as I,d as N,e as fe,h as G,j as _,k as ue,v as B,w as H}from"./LRMOPAZ4.js";import{a as ie}from"./64G5RPLP.js";import"./RLJVKAOL.js";import{L as oe,M as v,c as y,fa as S,k as O,la as C,qa as se}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{mkdir as At,writeFile as jt}from"node:fs/promises";import kt from"node:path";var Ve=/^[a-zA-Z][a-zA-Z0-9]*(?:[_\-.][a-zA-Z0-9]+)*$/,Be=/^[0-9a-f-]{8,}$/i,He=[["uuid",/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i],["date-time",/^\d{4}-\d{2}-\d{2}[Tt]\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:[Zz]|[+-]\d{2}:\d{2})$/],["date",/^\d{4}-\d{2}-\d{2}$/],["email",/^[^\s@]+@[^\s@]+\.[^\s@]+$/],["uri",/^https?:\/\/\S+$/],["ipv4",/^(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)$/]],M=new WeakMap;function z(e){return{formats:He.filter(([,t])=>t.test(e)).map(([t])=>t),values:[e],count:1,overflow:!1}}function x(e,t){if(!e)return t;if(!t)return e;let n={formats:e.formats.filter(r=>t.formats.includes(r)),values:[],count:e.count+t.count,overflow:e.overflow||t.overflow};if(!n.overflow){let r=[...e.values];for(let s of t.values)r.includes(s)||r.push(s);r.length>10?n.overflow=!0:n.values=r}return n}function D(e,t){M.set(e,t)}function U(e){return M.get(e)}function F(e,t){let n=M.get(e);n&&M.set(t,n)}function ze(e){return e.length<=30&&!Be.test(e)&&Ve.test(e)}function X(e,t){return e.formats.length>0?{format:e.formats[0]}:t&&!e.overflow&&e.count>=4&&e.values.length>0&&e.values.length<=5&&e.values.length*2<=e.count&&e.values.every(ze)?{enum:[...e.values].sort()}:{}}function $(e){let t=M.get(e);if(t){let n=typeof e.type=="string"?[e.type]:e.type??[];n.includes("string")&&Object.assign(e,X(t,n.length===1))}for(let n of Object.values(e.properties??{}))$(n);e.additionalProperties&&$(e.additionalProperties),e.items&&$(e.items);for(let n of e.oneOf??[])$(n)}function me(e){for(let t of Object.values(e.paths))for(let n of Object.values(t)){for(let r of Object.values(n.requestBody?.content??{}))$(r.schema);for(let r of Object.values(n.responses))for(let s of Object.values(r.content??{}))$(s.schema)}for(let t of Object.values(e.components?.schemas??{}))$(t);return e}var be=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,Y=/^\d+$/,De=/^[0-9a-hjkmnp-tv-z]{26}$/i,Ue=/^[a-z][a-z0-9]*_(?=[0-9a-z]*\d)[0-9a-z]{10,}$/i,Fe=/^[a-z](?=[a-z0-9]*\d)[a-z0-9]{23,24}$/,Q=new Set(ie),Le=new Set(["get","head"]),de="application/x-www-form-urlencoded",le="multipart/form-data";function Ye(e){return e?Y.test(e)||be.test(e)||De.test(e)||Ue.test(e)||Fe.test(e)?!0:/^[0-9a-f]{16,}$/i.test(e):!1}function ee(e){let t=e.split("/"),n=[],r=new Set;return{template:t.map((o,a)=>{if(!Ye(o))return o;let i=t[a-1],c=i?`${O(i,1)}Id`:"id",p=1;for(;r.has(c);)p+=1,c=i?`${O(i,1)}Id${p}`:`id${p}`;return r.add(c),n.push({name:c,value:o}),`{${c}}`}).join("/")||"/",params:n}}function T(e){if(e===null)return{type:"null"};if(Array.isArray(e)){if(e.length===0)return{type:"array"};let t=e.slice(0,20).map(T);return{type:"array",items:E(t)}}switch(typeof e){case"string":{let t={type:"string"};return D(t,z(e)),t}case"boolean":return{type:"boolean"};case"number":return Number.isInteger(e)?{type:"integer"}:{type:"number"};case"object":{let t=Object.entries(e);if(t.length>0&&(t.every(([a])=>Y.test(a))||t.every(([a])=>be.test(a))))return{type:"object",additionalProperties:E(t.map(([,a])=>T(a)))};let n={},r=[];for(let[o,a]of t)n[o]=T(a),r.push(o);let s={type:"object",properties:n};return r.length>0&&(s.required=r),s}default:return{}}}function E(e){if(e.length===0)return{};let[t,...n]=e,r=t;for(let s of n)r=L(r,s);return r}function he(e){return Object.keys(e).length===0}function A(e){return e.additionalProperties?"map":e.type==="object"?"object":e.type==="array"?"array":"scalar"}function Z(e){return e.oneOf?e.oneOf.flatMap(Z):Array.isArray(e.type)?e.type.map(t=>{if(t==="object"){let r={type:"object"};return e.properties&&(r.properties=e.properties),e.required&&(r.required=e.required),e.additionalProperties&&(r.additionalProperties=e.additionalProperties),r}if(t==="array")return e.items?{type:"array",items:e.items}:{type:"array"};let n={type:t};return t==="string"&&F(e,n),n}):[e]}var Ke=.5,We=3;function Oe(e,t){let n=Object.keys(e.properties??{}),r=Object.keys(t.properties??{});if(n.length===0||r.length===0)return 1;let s=new Set(r),o=n.filter(a=>s.has(a)).length;return o/(n.length+r.length-o)}function Xe(e,t){let n=A(e);if(n!==A(t))return!1;switch(n){case"scalar":return e.type===t.type||e.type==="integer"&&t.type==="number"||e.type==="number"&&t.type==="integer";case"object":return Oe(e,t)>=Ke;default:return!0}}function ve(e,t){switch(A(e)){case"scalar":{if(e.type!==t.type)return{type:"number"};if(e.type==="string"){let n=x(U(e),U(t));if(n){let r={type:"string"};return D(r,n),r}}return e}case"map":return{type:"object",additionalProperties:L(e.additionalProperties??{},t.additionalProperties??{})};case"object":{let n={...e.properties??{}};for(let[a,i]of Object.entries(t.properties??{}))n[a]=n[a]?L(n[a],i):i;let r=new Set(t.required??[]),s=(e.required??[]).filter(a=>r.has(a)),o={type:"object",properties:n};return s.length>0&&(o.required=s),o}case"array":{if(!e.items||!t.items){let n=e.items??t.items;return n?{type:"array",items:n}:{type:"array"}}return{type:"array",items:L(e.items,t.items)}}}}function Ze(e){let t=[...e],n=()=>t.filter(r=>A(r)==="object").length;for(;n()>We;){let r=-1,s=-1,o=-1;for(let a=0;a<t.length;a++)if(A(t[a])==="object")for(let i=a+1;i<t.length;i++){if(A(t[i])!=="object")continue;let c=Oe(t[a],t[i]);c>o&&(o=c,r=a,s=i)}t[r]=ve(t[r],t[s]),t.splice(s,1)}return t}var Qe=["boolean","integer","number","string","null"];function et(e){if(e.length===1)return e[0];let t=[],n=new Set,r;for(let i of e)A(i)==="scalar"&&typeof i.type=="string"?(n.add(i.type),i.type==="string"&&(r=x(r,U(i)))):t.push(i);let s=Qe.filter(i=>n.has(i)),o=i=>{let c={type:i};return(typeof i=="string"?i==="string":i.includes("string"))&&r&&D(c,r),c};if(t.length===0)return s.length===1?o(s[0]):o(s);if(t.length===1&&s.length===1&&s[0]==="null"&&typeof t[0].type=="string")return{...t[0],type:[t[0].type,"null"]};let a=[...t];return s.length===1?a.push(o(s[0])):s.length>1&&a.push(o(s)),{oneOf:a}}function L(e,t){if(he(e)||he(t))return{};let n=Z(e);for(let r of Z(t)){let s=n.findIndex(o=>Xe(o,r));s===-1?n.push(r):n[s]=ve(n[s],r)}return et(Ze(n))}function tt(e){if(!e)return;let t=e.trim();if(!(!t.startsWith("{")&&!t.startsWith("[")))try{return JSON.parse(t)}catch{return}}function nt(e,t){let n=t?.match(/boundary="?([^";,]+)"?/i)?.[1];if(!n)return;let r={};for(let s of e.split(`--${n}`)){let o=s.match(/^\r?\n([\s\S]*?)\r?\n\r?\n([\s\S]*)\r?\n$/);if(!o)continue;let[,a,i]=o,c=a.match(/\bname="([^"]*)"/i)?.[1];c!==void 0&&(r[c]=/\bfilename="/i.test(a)?{type:"string",format:"binary"}:T(i))}if(Object.keys(r).length!==0)return{type:"object",properties:r,required:Object.keys(r)}}function ge(e){let t=_(e.contentType);if(e.bodyJson!==void 0)return{mime:ue(t)?t:"application/json",schema:T(e.bodyJson)};if(t===de&&e.bodyText){let r={};for(let[s,o]of new URLSearchParams(e.bodyText))r[s]=o;return Object.keys(r).length===0?void 0:{mime:de,schema:T(r)}}if(t===le&&e.bodyText){let r=nt(e.bodyText,e.contentType);return r?{mime:le,schema:r}:void 0}let n=tt(e.bodyText);if(n!==void 0)return{mime:"application/json",schema:T(n)}}function ye(e,t,n){let r=e.get(t);e.set(t,r?E([r,n]):n)}async function we(e){let t=await N(e.trafficPath);if(t.length===0)throw new Error("No traffic files found in the provided traffic path.");let n=B(e.server),r=new Map,s=new Set,o=0,a=0,i=p=>{let f=p.request.method.toLowerCase();if(!Q.has(f))return;let u=p.request.path||"/";if(n){let d=H(p.request,n);if(d===void 0)return;u=d}if(f==="query"&&e.openapiVersion==="3.1"){a+=1;return}!n&&p.request.host&&!fe(p.request.host)&&s.add(`${p.request.protocol}//${p.request.host}`);let{template:m,params:k}=ee(G(u)),P=`${f} ${m}`,l=r.get(P);l||(l={method:f,template:m,pathParams:new Map,queryParams:new Map,requestBodies:new Map,responses:new Map},r.set(P,l));for(let{name:d,value:g}of k){let h=l.pathParams.get(d);l.pathParams.set(d,{numeric:(h?.numeric??!0)&&Y.test(g),observations:x(h?.observations,z(g))})}for(let d of new Set(p.request.query.keys())){let g=p.request.query.getAll(d),h=l.queryParams.get(d),q=g.length>0&&g.every(R=>Y.test(R)),b=h?.observations;for(let R of g)b=x(b,z(R));l.queryParams.set(d,{numeric:(h?.numeric??!0)&&q,observations:b})}if(!Le.has(f)){let d=ge(p.request);d&&ye(l.requestBodies,d.mime,d.schema)}if(p.response&&p.response.status>=100){let d=String(p.response.status),g=l.responses.get(d);g||(g={bodies:new Map},l.responses.set(d,g)),g.statusText??=p.response.statusText||void 0;let h=ge(p.response);h&&ye(g.bodies,h.mime,h.schema)}};for(let p of t){let f=await V(p,e.format);if(!f){S.warn(`Skipping traffic file with unrecognized format: ${p}
|
|
8
8
|
`);continue}o+=1;for await(let u of f.parse(p))i(u)}if(o===0)throw new Error("No supported traffic files found to generate an OpenAPI description from.");if(r.size===0&&a>0)throw new C("All observed HTTP exchanges use the QUERY method, which OpenAPI 3.1 does not support. Use --openapi-version 3.2 to include them.");if(r.size===0)throw new Error(n?`No HTTP exchanges in the traffic matched the server "${n}".`:"No HTTP exchanges were observed in the traffic. Cannot generate an OpenAPI description.");let c=n?[n]:Array.from(s).sort();return rt(r,e.openapiVersion,e.title??"Generated API",c)}function Pe(e){return Object.values(e.paths).reduce((t,n)=>t+Object.keys(n).length,0)}function Se(e,t){if(e.numeric)return{type:"integer"};let n={type:"string"};return e.observations&&Object.assign(n,X(e.observations,t)),n}function rt(e,t,n,r){let s={};for(let o of e.values()){let a=s[o.template]??={},i=[...Array.from(o.pathParams).map(([p,f])=>({name:p,in:"path",required:!0,schema:Se(f,!1)})),...Array.from(o.queryParams).map(([p,f])=>({name:p,in:"query",required:!1,schema:Se(f,!0)}))],c={operationId:ot(o.method,o.template),responses:{}};if(i.length>0&&(c.parameters=i),o.requestBodies.size>0){let p={};for(let[f,u]of o.requestBodies)p[f]={schema:u};c.requestBody={content:p}}if(o.responses.size===0)c.responses.default={description:"Observed response"};else for(let[p,f]of o.responses){let u={description:f.statusText||"Observed response"};if(f.bodies.size>0){let m={};for(let[k,P]of f.bodies)m[k]={schema:P};u.content=m}c.responses[p]=u}a[o.method]=c}return{openapi:`${t}.0`,info:{title:n,version:"1.0.0"},...r.length>0?{servers:r.map(o=>({url:o}))}:{},paths:s}}function ot(e,t){let n=t.split("/").filter(Boolean).map(r=>r.replace(/[{}]/g,"")).join("-");return`${e}-${n||"root"}`}function K(e,t){return`${e.toUpperCase()} ${t}`}function $e(e,t){let n;if(e.bodyJson!==void 0)try{n=JSON.stringify(e.bodyJson)}catch{n=void 0}if(n??=e.bodyText,!n)return;let r=n.trim();if(r)return r.length>t?`${r.slice(0,t)}\u2026[truncated]`:r}function Te(e){if(!e)return"";let t=e.bodyJson;return t===void 0?e.bodyText?_(e.contentType)||"text":"":t===null?"null":Array.isArray(t)?`array<${t.length>0?Ae(t[0]):""}>`:Ae(t)}function Ae(e){return y(e)?Object.keys(e).sort().join(","):e===null?"null":typeof e}async function je(e){let t=e.perGroup??2,n=e.perOperation??4,r=e.maxBodyChars??2e3,s=B(e.server),o=await N(e.trafficPath),a=new Map;for(let c of o){let p=await V(c,e.format);if(p)for await(let f of p.parse(c)){let u=f.request.method.toUpperCase();if(!Q.has(u.toLowerCase()))continue;let m=f.request.path||"/";if(s){let R=H(f.request,s);if(R===void 0)continue;m=R}let k=G(m),{template:P}=ee(k),l=f.response&&f.response.status>=100?f.response:void 0,d=l?.status,g=`${Te(f.request)}\u2192${Te(l)}`,h=a.get(K(u,P));h||(h=new Map,a.set(K(u,P),h));let q=`${d??""} ${g}`,b=h.get(q);b||(b=[],h.set(q,b)),!(b.length>=t)&&b.push({method:u,path:k,query:f.request.query.toString(),status:d,requestContentType:f.request.contentType,requestBody:$e(f.request,r),responseContentType:l?.contentType,responseBody:l?$e(l,r):void 0})}}let i=new Map;for(let[c,p]of a){let f=[];for(let u=0;u<t&&f.length<n;u++)for(let m of p.values()){if(f.length>=n)break;m[u]&&f.push(m[u])}i.set(c,f)}return i}var st=e=>`You are an expert API designer. You are given one operation from an OpenAPI ${e} description that was inferred mechanically from recorded HTTP traffic, the component schemas it references, and a sample of the real recorded HTTP exchanges for that operation. The inferred description is only a hypothesis: types are coarse, every observed property is marked required, and descriptions are missing. Alternative body shapes observed in the traffic appear as "oneOf" variants or type unions. Common string formats (uuid, date-time, date, email, uri, ipv4) and small closed enums are detected conservatively from the observed values.
|
|
9
9
|
|
|
10
10
|
Refine the operation into the most accurate OpenAPI ${e} definition you can justify from the evidence, while staying conservative:
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as q}from"./FKKC7G6X.js";import{h as H,l as B,
|
|
7
|
+
import{a as q}from"./FKKC7G6X.js";import{A as _,h as H,l as B,v as z,x as K,y as V,z as Z}from"./O37B7ABT.js";import"./GKXY6U4S.js";import{b as J,d as M,e as Y,v as L}from"./QMS4UKIK.js";import{$ as b,S as N,W as v,Y as O,Z as A,_ as j,ba as y,ca as C,da as R,fa as e,k as h,la as w,ma as D,ra as S,ua as g}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{dirname as le}from"node:path";function W(r,t,o,n){n&&e.info(C(v(`
|
|
8
8
|
\u2611\uFE0F Achieved Level: ${y(o)}
|
|
9
9
|
|
|
10
10
|
`))),e.output(`<?xml version="1.0" encoding="UTF-8"?>
|
|
@@ -4,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"./2UAA6O26.js";import"./QB6CQ2CV.js";import"./3DMXMP4K.js";import"./EFB2YVY2.js";import"./JCP37EY3.js";import"./WZXA5XPB.js";import"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as swrGenerator};
|
|
@@ -4,10 +4,10 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as p,b as U,c as F,d as R,e as j}from"./U5DIFWGH.js";import{b as O}from"./
|
|
7
|
+
import{a as p,b as U,c as F,d as R,e as j}from"./U5DIFWGH.js";import{b as O}from"./QMS4UKIK.js";import{$ as A,_ as $,c as b,da as v,fa as k,k as P,la as d}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{readFileSync as H}from"node:fs";import{mkdir as B,writeFile as D}from"node:fs/promises";import{basename as I,dirname as S,extname as N,isAbsolute as L,relative as x,resolve as f}from"node:path";var V=/^[a-z][a-z0-9+.-]+:/i;function W(e,t){let{setup:i}=e;if(typeof i!="string")return e;if(V.test(i))throw new d(`
|
|
8
8
|
\u274C \`client.setup\` must be a local file path \u2014 remote setup modules are not supported.
|
|
9
9
|
Got: ${i}
|
|
10
|
-
`);return L(i)?e:{...e,setup:f(t,i)}}function q(e){return`${e.replace(/[\\/]/g,"_")}.client.ts`}function J(e){if(e.startsWith("//"))return!1;if(e.startsWith("/"))return!0;try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}async function se({argv:e,config:t,collectSpecData:i}){let{AUTHORING_HELPER_NAMES:r,generateClient:m,mergeConfig:n}=await import("./
|
|
10
|
+
`);return L(i)?e:{...e,setup:f(t,i)}}function q(e){return`${e.replace(/[\\/]/g,"_")}.client.ts`}function J(e){if(e.startsWith("//"))return!1;if(e.startsWith("/"))return!0;try{let t=new URL(e);return t.protocol==="http:"||t.protocol==="https:"}catch{return!1}}async function se({argv:e,config:t,collectSpecData:i}){let{AUTHORING_HELPER_NAMES:r,generateClient:m,mergeConfig:n}=await import("./WJXIZZA6.js"),l=t.configPath?S(t.configPath):process.cwd(),o={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(c=>c.startsWith(".")?f(c):c),setup:e.setup===void 0?void 0:W({setup:e.setup},process.cwd()).setup},s=t.resolvedConfig.apis??{},a=Object.keys(s).filter(c=>b(s[c].client)||s[c].clientOutput!==void 0);if(e.api===void 0){if(e.output)throw new d("\n\u274C --output can't target multiple APIs. Set `clientOutput` under each api in redocly.yaml, or pass a single <api>.\n");if(a.length===0)throw new d("\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 h=await O(e.api===void 0?a:[e.api],t),g={config:t,collectSpecData:i,configDir:l,cliFlags:o,outputFlag:e.output,toolkit:{generateClient:m,mergeConfig:n,helperNames:r},seenOutputs:new Set,composable:[]};for(let c of h)await K(c,g);let w=b(t.resolvedConfig.client)?t.resolvedConfig.client:{};w.cliOutput!==void 0&&e.api===void 0&&g.composable.length>0&&await Q(w.cliOutput,g)}async function K(e,{config:t,collectSpecData:i,configDir:r,cliFlags:m,outputFlag:n,toolkit:l,seenOutputs:o,composable:s}){let{path:a,alias:h}=e,g=h??I(a,N(a)),w=t.forAlias(h),{client:c,clientOutput:E}=w.resolvedConfig,M=W(b(c)?c:{},r),C=l.mergeConfig(M,m);X(C.generators??[],l.helperNames,r);let y=n!==void 0?f(n):E!==void 0?f(r,E):f(r,q(g));if(!y.endsWith(".ts"))throw new d(`
|
|
11
11
|
\u274C output must point at a TypeScript file (ending in .ts).
|
|
12
12
|
Got: ${y}
|
|
13
13
|
`);if(o.has(y))throw new d(`
|
|
@@ -23,7 +23,7 @@ import{a as p,b as U,c as F,d as R,e as j}from"./U5DIFWGH.js";import{b as O}from
|
|
|
23
23
|
`)}catch(u){let _=u instanceof Error?u.message:String(u);throw p.generate_client_error_category=j(_),new d(`
|
|
24
24
|
\u274C Failed to generate client for ${g}.
|
|
25
25
|
${_}
|
|
26
|
-
`)}}async function Q(e,{configDir:t,seenOutputs:i,composable:r}){let{renderComposedCliEntry:m}=await import("./
|
|
26
|
+
`)}}async function Q(e,{configDir:t,seenOutputs:i,composable:r}){let{renderComposedCliEntry:m}=await import("./SBT63VHF.js"),n=f(t,e);if(!n.endsWith(".ts"))throw new d(`
|
|
27
27
|
\u274C client.cliOutput must point at a TypeScript file (ending in .ts).
|
|
28
28
|
Got: ${n}
|
|
29
29
|
`);if(i.has(n))throw new d(`
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a as Ate,b as Ote}from"./U6PNFV4R.js";import{d as Rte}from"./Q43RV27Q.js";import{b as Ete,e as Tte}from"./SV2XHB2S.js";import{O as xte,S as wte,ba as wP,c as bte,fa as o1,ga as Cte,ha as kte,la as k2,oa as Ste,t as yte}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import{a as ru,b as vte,c as ar,d as Mqe,e as yl,f as Dqe}from"./RFWIIJFG.js";var Ute=ar(tn=>{"use strict";var SP=Symbol.for("react.transitional.element"),Fqe=Symbol.for("react.portal"),zqe=Symbol.for("react.fragment"),Bqe=Symbol.for("react.strict_mode"),Uqe=Symbol.for("react.profiler"),Hqe=Symbol.for("react.consumer"),Vqe=Symbol.for("react.context"),Wqe=Symbol.for("react.forward_ref"),Gqe=Symbol.for("react.suspense"),jqe=Symbol.for("react.memo"),Lte=Symbol.for("react.lazy"),Yqe=Symbol.for("react.activity"),Ite=Symbol.iterator;function qqe(i){return i===null||typeof i!="object"?null:(i=Ite&&i[Ite]||i["@@iterator"],typeof i=="function"?i:null)}var Mte={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Dte=Object.assign,Fte={};function E2(i,s,u){this.props=i,this.context=s,this.refs=Fte,this.updater=u||Mte}E2.prototype.isReactComponent={};E2.prototype.setState=function(i,s){if(typeof i!="object"&&typeof i!="function"&&i!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,i,s,"setState")};E2.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function zte(){}zte.prototype=E2.prototype;function EP(i,s,u){this.props=i,this.context=s,this.refs=Fte,this.updater=u||Mte}var TP=EP.prototype=new zte;TP.constructor=EP;Dte(TP,E2.prototype);TP.isPureReactComponent=!0;var _te=Array.isArray;function kP(){}var Yi={H:null,A:null,T:null,S:null},Bte=Object.prototype.hasOwnProperty;function AP(i,s,u){var h=u.ref;return{$$typeof:SP,type:i,key:s,ref:h!==void 0?h:null,props:u}}function Zqe(i,s){return AP(i.type,s,i.props)}function RP(i){return typeof i=="object"&&i!==null&&i.$$typeof===SP}function Kqe(i){var s={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(u){return s[u]})}var Pte=/\/+/g;function CP(i,s){return typeof i=="object"&&i!==null&&i.key!=null?Kqe(""+i.key):s.toString(36)}function Xqe(i){switch(i.status){case"fulfilled":return i.value;case"rejected":throw i.reason;default:switch(typeof i.status=="string"?i.then(kP,kP):(i.status="pending",i.then(function(s){i.status==="pending"&&(i.status="fulfilled",i.value=s)},function(s){i.status==="pending"&&(i.status="rejected",i.reason=s)})),i.status){case"fulfilled":return i.value;case"rejected":throw i.reason}}throw i}function S2(i,s,u,h,m){var S=typeof i;(S==="undefined"||S==="boolean")&&(i=null);var v=!1;if(i===null)v=!0;else switch(S){case"bigint":case"string":case"number":v=!0;break;case"object":switch(i.$$typeof){case SP:case Fqe:v=!0;break;case Lte:return v=i._init,S2(v(i._payload),s,u,h,m)}}if(v)return m=m(i),v=h===""?"."+CP(i,0):h,_te(m)?(u="",v!=null&&(u=v.replace(Pte,"$&/")+"/"),S2(m,s,u,"",function(I){return I})):m!=null&&(RP(m)&&(m=Zqe(m,u+(m.key==null||i&&i.key===m.key?"":(""+m.key).replace(Pte,"$&/")+"/")+v)),s.push(m)),1;v=0;var N=h===""?".":h+":";if(_te(i))for(var O=0;O<i.length;O++)h=i[O],S=N+CP(h,O),v+=S2(h,s,u,S,m);else if(O=qqe(i),typeof O=="function")for(i=O.call(i),O=0;!(h=i.next()).done;)h=h.value,S=N+CP(h,O++),v+=S2(h,s,u,S,m);else if(S==="object"){if(typeof i.then=="function")return S2(Xqe(i),s,u,h,m);throw s=String(i),Error("Objects are not valid as a React child (found: "+(s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)+"). If you meant to render a collection of children, use an array instead.")}return v}function s6(i,s,u){if(i==null)return i;var h=[],m=0;return S2(i,h,"","",function(S){return s.call(u,S,m++)}),h}function Jqe(i){if(i._status===-1){var s=i._result;s=s(),s.then(function(u){(i._status===0||i._status===-1)&&(i._status=1,i._result=u)},function(u){(i._status===0||i._status===-1)&&(i._status=2,i._result=u)}),i._status===-1&&(i._status=0,i._result=s)}if(i._status===1)return i._result.default;throw i._result}var Nte=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Qqe={map:s6,forEach:function(i,s,u){s6(i,function(){s.apply(this,arguments)},u)},count:function(i){var s=0;return s6(i,function(){s++}),s},toArray:function(i){return s6(i,function(s){return s})||[]},only:function(i){if(!RP(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};tn.Activity=Yqe;tn.Children=Qqe;tn.Component=E2;tn.Fragment=zqe;tn.Profiler=Uqe;tn.PureComponent=EP;tn.StrictMode=Bqe;tn.Suspense=Gqe;tn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Yi;tn.__COMPILER_RUNTIME={__proto__:null,c:function(i){return Yi.H.useMemoCache(i)}};tn.cache=function(i){return function(){return i.apply(null,arguments)}};tn.cacheSignal=function(){return null};tn.cloneElement=function(i,s,u){if(i==null)throw Error("The argument must be a React element, but you passed "+i+".");var h=Dte({},i.props),m=i.key;if(s!=null)for(S in s.key!==void 0&&(m=""+s.key),s)!Bte.call(s,S)||S==="key"||S==="__self"||S==="__source"||S==="ref"&&s.ref===void 0||(h[S]=s[S]);var S=arguments.length-2;if(S===1)h.children=u;else if(1<S){for(var v=Array(S),N=0;N<S;N++)v[N]=arguments[N+2];h.children=v}return AP(i.type,m,h)};tn.createContext=function(i){return i={$$typeof:Vqe,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null},i.Provider=i,i.Consumer={$$typeof:Hqe,_context:i},i};tn.createElement=function(i,s,u){var h,m={},S=null;if(s!=null)for(h in s.key!==void 0&&(S=""+s.key),s)Bte.call(s,h)&&h!=="key"&&h!=="__self"&&h!=="__source"&&(m[h]=s[h]);var v=arguments.length-2;if(v===1)m.children=u;else if(1<v){for(var N=Array(v),O=0;O<v;O++)N[O]=arguments[O+2];m.children=N}if(i&&i.defaultProps)for(h in v=i.defaultProps,v)m[h]===void 0&&(m[h]=v[h]);return AP(i,S,m)};tn.createRef=function(){return{current:null}};tn.forwardRef=function(i){return{$$typeof:Wqe,render:i}};tn.isValidElement=RP;tn.lazy=function(i){return{$$typeof:Lte,_payload:{_status:-1,_result:i},_init:Jqe}};tn.memo=function(i,s){return{$$typeof:jqe,type:i,compare:s===void 0?null:s}};tn.startTransition=function(i){var s=Yi.T,u={};Yi.T=u;try{var h=i(),m=Yi.S;m!==null&&m(u,h),typeof h=="object"&&h!==null&&typeof h.then=="function"&&h.then(kP,Nte)}catch(S){Nte(S)}finally{s!==null&&u.types!==null&&(s.types=u.types),Yi.T=s}};tn.unstable_useCacheRefresh=function(){return Yi.H.useCacheRefresh()};tn.use=function(i){return Yi.H.use(i)};tn.useActionState=function(i,s,u){return Yi.H.useActionState(i,s,u)};tn.useCallback=function(i,s){return Yi.H.useCallback(i,s)};tn.useContext=function(i){return Yi.H.useContext(i)};tn.useDebugValue=function(){};tn.useDeferredValue=function(i,s){return Yi.H.useDeferredValue(i,s)};tn.useEffect=function(i,s){return Yi.H.useEffect(i,s)};tn.useEffectEvent=function(i){return Yi.H.useEffectEvent(i)};tn.useId=function(){return Yi.H.useId()};tn.useImperativeHandle=function(i,s,u){return Yi.H.useImperativeHandle(i,s,u)};tn.useInsertionEffect=function(i,s){return Yi.H.useInsertionEffect(i,s)};tn.useLayoutEffect=function(i,s){return Yi.H.useLayoutEffect(i,s)};tn.useMemo=function(i,s){return Yi.H.useMemo(i,s)};tn.useOptimistic=function(i,s){return Yi.H.useOptimistic(i,s)};tn.useReducer=function(i,s,u){return Yi.H.useReducer(i,s,u)};tn.useRef=function(i){return Yi.H.useRef(i)};tn.useState=function(i){return Yi.H.useState(i)};tn.useSyncExternalStore=function(i,s,u){return Yi.H.useSyncExternalStore(i,s,u)};tn.useTransition=function(){return Yi.H.useTransition()};tn.version="19.2.7"});var Hte=ar((Jr,l6)=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function i(ee,Ee){Object.defineProperty(h.prototype,ee,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",Ee[0],Ee[1])}})}function s(ee){return ee===null||typeof ee!="object"?null:(ee=Nr&&ee[Nr]||ee["@@iterator"],typeof ee=="function"?ee:null)}function u(ee,Ee){ee=(ee=ee.constructor)&&(ee.displayName||ee.name)||"ReactClass";var tt=ee+"."+Ee;yn[tt]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",Ee,ee),yn[tt]=!0)}function h(ee,Ee,tt){this.props=ee,this.context=Ee,this.refs=Pn,this.updater=tt||ur}function m(){}function S(ee,Ee,tt){this.props=ee,this.context=Ee,this.refs=Pn,this.updater=tt||ur}function v(){}function N(ee){return""+ee}function O(ee){try{N(ee);var Ee=!1}catch{Ee=!0}if(Ee){Ee=console;var tt=Ee.error,ht=typeof Symbol=="function"&&Symbol.toStringTag&&ee[Symbol.toStringTag]||ee.constructor.name||"Object";return tt.call(Ee,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",ht),N(ee)}}function I(ee){if(ee==null)return null;if(typeof ee=="function")return ee.$$typeof===$n?null:ee.displayName||ee.name||null;if(typeof ee=="string")return ee;switch(ee){case _n:return"Fragment";case Me:return"Profiler";case cr:return"StrictMode";case Gt:return"Suspense";case Mt:return"SuspenseList";case hr:return"Activity"}if(typeof ee=="object")switch(typeof ee.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),ee.$$typeof){case kr:return"Portal";case wt:return ee.displayName||"Context";case nt:return(ee._context.displayName||"Context")+".Consumer";case or:var Ee=ee.render;return ee=ee.displayName,ee||(ee=Ee.displayName||Ee.name||"",ee=ee!==""?"ForwardRef("+ee+")":"ForwardRef"),ee;case yt:return Ee=ee.displayName||null,Ee!==null?Ee:I(ee.type)||"Memo";case er:Ee=ee._payload,ee=ee._init;try{return I(ee(Ee))}catch{}}return null}function H(ee){if(ee===_n)return"<>";if(typeof ee=="object"&&ee!==null&&ee.$$typeof===er)return"<...>";try{var Ee=I(ee);return Ee?"<"+Ee+">":"<...>"}catch{return"<...>"}}function M(){var ee=br.A;return ee===null?null:ee.getOwner()}function Y(){return Error("react-stack-top-frame")}function J(ee){if(lo.call(ee,"key")){var Ee=Object.getOwnPropertyDescriptor(ee,"key").get;if(Ee&&Ee.isReactWarning)return!1}return ee.key!==void 0}function we(ee,Ee){function tt(){Un||(Un=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Ee))}tt.isReactWarning=!0,Object.defineProperty(ee,"key",{get:tt,configurable:!0})}function ke(){var ee=I(this.type);return Eo[ee]||(Eo[ee]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),ee=this.props.ref,ee!==void 0?ee:null}function pe(ee,Ee,tt,ht,_t,qt){var Kt=tt.ref;return ee={$$typeof:lr,type:ee,key:Ee,props:tt,_owner:ht},(Kt!==void 0?Kt:null)!==null?Object.defineProperty(ee,"ref",{enumerable:!1,get:ke}):Object.defineProperty(ee,"ref",{enumerable:!1,value:null}),ee._store={},Object.defineProperty(ee._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(ee,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(ee,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:_t}),Object.defineProperty(ee,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:qt}),Object.freeze&&(Object.freeze(ee.props),Object.freeze(ee)),ee}function Fe(ee,Ee){return Ee=pe(ee.type,Ee,ee.props,ee._owner,ee._debugStack,ee._debugTask),ee._store&&(Ee._store.validated=ee._store.validated),Ee}function ze(ee){ft(ee)?ee._store&&(ee._store.validated=1):typeof ee=="object"&&ee!==null&&ee.$$typeof===er&&(ee._payload.status==="fulfilled"?ft(ee._payload.value)&&ee._payload.value._store&&(ee._payload.value._store.validated=1):ee._store&&(ee._store.validated=1))}function ft(ee){return typeof ee=="object"&&ee!==null&&ee.$$typeof===lr}function St(ee){var Ee={"=":"=0",":":"=2"};return"$"+ee.replace(/[=:]/g,function(tt){return Ee[tt]})}function mt(ee,Ee){return typeof ee=="object"&&ee!==null&&ee.key!=null?(O(ee.key),St(""+ee.key)):Ee.toString(36)}function Ve(ee){switch(ee.status){case"fulfilled":return ee.value;case"rejected":throw ee.reason;default:switch(typeof ee.status=="string"?ee.then(v,v):(ee.status="pending",ee.then(function(Ee){ee.status==="pending"&&(ee.status="fulfilled",ee.value=Ee)},function(Ee){ee.status==="pending"&&(ee.status="rejected",ee.reason=Ee)})),ee.status){case"fulfilled":return ee.value;case"rejected":throw ee.reason}}throw ee}function Lt(ee,Ee,tt,ht,_t){var qt=typeof ee;(qt==="undefined"||qt==="boolean")&&(ee=null);var Kt=!1;if(ee===null)Kt=!0;else switch(qt){case"bigint":case"string":case"number":Kt=!0;break;case"object":switch(ee.$$typeof){case lr:case kr:Kt=!0;break;case er:return Kt=ee._init,Lt(Kt(ee._payload),Ee,tt,ht,_t)}}if(Kt){Kt=ee,_t=_t(Kt);var Pr=ht===""?"."+mt(Kt,0):ht;return xn(_t)?(tt="",Pr!=null&&(tt=Pr.replace(Bo,"$&/")+"/"),Lt(_t,Ee,tt,"",function(Dr){return Dr})):_t!=null&&(ft(_t)&&(_t.key!=null&&(Kt&&Kt.key===_t.key||O(_t.key)),tt=Fe(_t,tt+(_t.key==null||Kt&&Kt.key===_t.key?"":(""+_t.key).replace(Bo,"$&/")+"/")+Pr),ht!==""&&Kt!=null&&ft(Kt)&&Kt.key==null&&Kt._store&&!Kt._store.validated&&(tt._store.validated=2),_t=tt),Ee.push(_t)),1}if(Kt=0,Pr=ht===""?".":ht+":",xn(ee))for(var yr=0;yr<ee.length;yr++)ht=ee[yr],qt=Pr+mt(ht,yr),Kt+=Lt(ht,Ee,tt,qt,_t);else if(yr=s(ee),typeof yr=="function")for(yr===ee.entries&&(kn||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),kn=!0),ee=yr.call(ee),yr=0;!(ht=ee.next()).done;)ht=ht.value,qt=Pr+mt(ht,yr++),Kt+=Lt(ht,Ee,tt,qt,_t);else if(qt==="object"){if(typeof ee.then=="function")return Lt(Ve(ee),Ee,tt,ht,_t);throw Ee=String(ee),Error("Objects are not valid as a React child (found: "+(Ee==="[object Object]"?"object with keys {"+Object.keys(ee).join(", ")+"}":Ee)+"). If you meant to render a collection of children, use an array instead.")}return Kt}function It(ee,Ee,tt){if(ee==null)return ee;var ht=[],_t=0;return Lt(ee,ht,"","",function(qt){return Ee.call(tt,qt,_t++)}),ht}function Pt(ee){if(ee._status===-1){var Ee=ee._ioInfo;Ee!=null&&(Ee.start=Ee.end=performance.now()),Ee=ee._result;var tt=Ee();if(tt.then(function(_t){if(ee._status===0||ee._status===-1){ee._status=1,ee._result=_t;var qt=ee._ioInfo;qt!=null&&(qt.end=performance.now()),tt.status===void 0&&(tt.status="fulfilled",tt.value=_t)}},function(_t){if(ee._status===0||ee._status===-1){ee._status=2,ee._result=_t;var qt=ee._ioInfo;qt!=null&&(qt.end=performance.now()),tt.status===void 0&&(tt.status="rejected",tt.reason=_t)}}),Ee=ee._ioInfo,Ee!=null){Ee.value=tt;var ht=tt.displayName;typeof ht=="string"&&(Ee.name=ht)}ee._status===-1&&(ee._status=0,ee._result=tt)}if(ee._status===1)return Ee=ee._result,Ee===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
7
|
+
import{a as Ate,b as Ote}from"./G2M6SQCS.js";import{d as Rte}from"./VXD5O25A.js";import{b as Ete,e as Tte}from"./QMS4UKIK.js";import{O as xte,S as wte,ba as wP,c as bte,fa as o1,ga as Cte,ha as kte,la as k2,oa as Ste,t as yte}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import{a as ru,b as vte,c as ar,d as Mqe,e as yl,f as Dqe}from"./RFWIIJFG.js";var Ute=ar(tn=>{"use strict";var SP=Symbol.for("react.transitional.element"),Fqe=Symbol.for("react.portal"),zqe=Symbol.for("react.fragment"),Bqe=Symbol.for("react.strict_mode"),Uqe=Symbol.for("react.profiler"),Hqe=Symbol.for("react.consumer"),Vqe=Symbol.for("react.context"),Wqe=Symbol.for("react.forward_ref"),Gqe=Symbol.for("react.suspense"),jqe=Symbol.for("react.memo"),Lte=Symbol.for("react.lazy"),Yqe=Symbol.for("react.activity"),Ite=Symbol.iterator;function qqe(i){return i===null||typeof i!="object"?null:(i=Ite&&i[Ite]||i["@@iterator"],typeof i=="function"?i:null)}var Mte={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},Dte=Object.assign,Fte={};function E2(i,s,u){this.props=i,this.context=s,this.refs=Fte,this.updater=u||Mte}E2.prototype.isReactComponent={};E2.prototype.setState=function(i,s){if(typeof i!="object"&&typeof i!="function"&&i!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,i,s,"setState")};E2.prototype.forceUpdate=function(i){this.updater.enqueueForceUpdate(this,i,"forceUpdate")};function zte(){}zte.prototype=E2.prototype;function EP(i,s,u){this.props=i,this.context=s,this.refs=Fte,this.updater=u||Mte}var TP=EP.prototype=new zte;TP.constructor=EP;Dte(TP,E2.prototype);TP.isPureReactComponent=!0;var _te=Array.isArray;function kP(){}var Yi={H:null,A:null,T:null,S:null},Bte=Object.prototype.hasOwnProperty;function AP(i,s,u){var h=u.ref;return{$$typeof:SP,type:i,key:s,ref:h!==void 0?h:null,props:u}}function Zqe(i,s){return AP(i.type,s,i.props)}function RP(i){return typeof i=="object"&&i!==null&&i.$$typeof===SP}function Kqe(i){var s={"=":"=0",":":"=2"};return"$"+i.replace(/[=:]/g,function(u){return s[u]})}var Pte=/\/+/g;function CP(i,s){return typeof i=="object"&&i!==null&&i.key!=null?Kqe(""+i.key):s.toString(36)}function Xqe(i){switch(i.status){case"fulfilled":return i.value;case"rejected":throw i.reason;default:switch(typeof i.status=="string"?i.then(kP,kP):(i.status="pending",i.then(function(s){i.status==="pending"&&(i.status="fulfilled",i.value=s)},function(s){i.status==="pending"&&(i.status="rejected",i.reason=s)})),i.status){case"fulfilled":return i.value;case"rejected":throw i.reason}}throw i}function S2(i,s,u,h,m){var S=typeof i;(S==="undefined"||S==="boolean")&&(i=null);var v=!1;if(i===null)v=!0;else switch(S){case"bigint":case"string":case"number":v=!0;break;case"object":switch(i.$$typeof){case SP:case Fqe:v=!0;break;case Lte:return v=i._init,S2(v(i._payload),s,u,h,m)}}if(v)return m=m(i),v=h===""?"."+CP(i,0):h,_te(m)?(u="",v!=null&&(u=v.replace(Pte,"$&/")+"/"),S2(m,s,u,"",function(I){return I})):m!=null&&(RP(m)&&(m=Zqe(m,u+(m.key==null||i&&i.key===m.key?"":(""+m.key).replace(Pte,"$&/")+"/")+v)),s.push(m)),1;v=0;var N=h===""?".":h+":";if(_te(i))for(var O=0;O<i.length;O++)h=i[O],S=N+CP(h,O),v+=S2(h,s,u,S,m);else if(O=qqe(i),typeof O=="function")for(i=O.call(i),O=0;!(h=i.next()).done;)h=h.value,S=N+CP(h,O++),v+=S2(h,s,u,S,m);else if(S==="object"){if(typeof i.then=="function")return S2(Xqe(i),s,u,h,m);throw s=String(i),Error("Objects are not valid as a React child (found: "+(s==="[object Object]"?"object with keys {"+Object.keys(i).join(", ")+"}":s)+"). If you meant to render a collection of children, use an array instead.")}return v}function s6(i,s,u){if(i==null)return i;var h=[],m=0;return S2(i,h,"","",function(S){return s.call(u,S,m++)}),h}function Jqe(i){if(i._status===-1){var s=i._result;s=s(),s.then(function(u){(i._status===0||i._status===-1)&&(i._status=1,i._result=u)},function(u){(i._status===0||i._status===-1)&&(i._status=2,i._result=u)}),i._status===-1&&(i._status=0,i._result=s)}if(i._status===1)return i._result.default;throw i._result}var Nte=typeof reportError=="function"?reportError:function(i){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var s=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof i=="object"&&i!==null&&typeof i.message=="string"?String(i.message):String(i),error:i});if(!window.dispatchEvent(s))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",i);return}console.error(i)},Qqe={map:s6,forEach:function(i,s,u){s6(i,function(){s.apply(this,arguments)},u)},count:function(i){var s=0;return s6(i,function(){s++}),s},toArray:function(i){return s6(i,function(s){return s})||[]},only:function(i){if(!RP(i))throw Error("React.Children.only expected to receive a single React element child.");return i}};tn.Activity=Yqe;tn.Children=Qqe;tn.Component=E2;tn.Fragment=zqe;tn.Profiler=Uqe;tn.PureComponent=EP;tn.StrictMode=Bqe;tn.Suspense=Gqe;tn.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=Yi;tn.__COMPILER_RUNTIME={__proto__:null,c:function(i){return Yi.H.useMemoCache(i)}};tn.cache=function(i){return function(){return i.apply(null,arguments)}};tn.cacheSignal=function(){return null};tn.cloneElement=function(i,s,u){if(i==null)throw Error("The argument must be a React element, but you passed "+i+".");var h=Dte({},i.props),m=i.key;if(s!=null)for(S in s.key!==void 0&&(m=""+s.key),s)!Bte.call(s,S)||S==="key"||S==="__self"||S==="__source"||S==="ref"&&s.ref===void 0||(h[S]=s[S]);var S=arguments.length-2;if(S===1)h.children=u;else if(1<S){for(var v=Array(S),N=0;N<S;N++)v[N]=arguments[N+2];h.children=v}return AP(i.type,m,h)};tn.createContext=function(i){return i={$$typeof:Vqe,_currentValue:i,_currentValue2:i,_threadCount:0,Provider:null,Consumer:null},i.Provider=i,i.Consumer={$$typeof:Hqe,_context:i},i};tn.createElement=function(i,s,u){var h,m={},S=null;if(s!=null)for(h in s.key!==void 0&&(S=""+s.key),s)Bte.call(s,h)&&h!=="key"&&h!=="__self"&&h!=="__source"&&(m[h]=s[h]);var v=arguments.length-2;if(v===1)m.children=u;else if(1<v){for(var N=Array(v),O=0;O<v;O++)N[O]=arguments[O+2];m.children=N}if(i&&i.defaultProps)for(h in v=i.defaultProps,v)m[h]===void 0&&(m[h]=v[h]);return AP(i,S,m)};tn.createRef=function(){return{current:null}};tn.forwardRef=function(i){return{$$typeof:Wqe,render:i}};tn.isValidElement=RP;tn.lazy=function(i){return{$$typeof:Lte,_payload:{_status:-1,_result:i},_init:Jqe}};tn.memo=function(i,s){return{$$typeof:jqe,type:i,compare:s===void 0?null:s}};tn.startTransition=function(i){var s=Yi.T,u={};Yi.T=u;try{var h=i(),m=Yi.S;m!==null&&m(u,h),typeof h=="object"&&h!==null&&typeof h.then=="function"&&h.then(kP,Nte)}catch(S){Nte(S)}finally{s!==null&&u.types!==null&&(s.types=u.types),Yi.T=s}};tn.unstable_useCacheRefresh=function(){return Yi.H.useCacheRefresh()};tn.use=function(i){return Yi.H.use(i)};tn.useActionState=function(i,s,u){return Yi.H.useActionState(i,s,u)};tn.useCallback=function(i,s){return Yi.H.useCallback(i,s)};tn.useContext=function(i){return Yi.H.useContext(i)};tn.useDebugValue=function(){};tn.useDeferredValue=function(i,s){return Yi.H.useDeferredValue(i,s)};tn.useEffect=function(i,s){return Yi.H.useEffect(i,s)};tn.useEffectEvent=function(i){return Yi.H.useEffectEvent(i)};tn.useId=function(){return Yi.H.useId()};tn.useImperativeHandle=function(i,s,u){return Yi.H.useImperativeHandle(i,s,u)};tn.useInsertionEffect=function(i,s){return Yi.H.useInsertionEffect(i,s)};tn.useLayoutEffect=function(i,s){return Yi.H.useLayoutEffect(i,s)};tn.useMemo=function(i,s){return Yi.H.useMemo(i,s)};tn.useOptimistic=function(i,s){return Yi.H.useOptimistic(i,s)};tn.useReducer=function(i,s,u){return Yi.H.useReducer(i,s,u)};tn.useRef=function(i){return Yi.H.useRef(i)};tn.useState=function(i){return Yi.H.useState(i)};tn.useSyncExternalStore=function(i,s,u){return Yi.H.useSyncExternalStore(i,s,u)};tn.useTransition=function(){return Yi.H.useTransition()};tn.version="19.2.7"});var Hte=ar((Jr,l6)=>{"use strict";process.env.NODE_ENV!=="production"&&(function(){function i(ee,Ee){Object.defineProperty(h.prototype,ee,{get:function(){console.warn("%s(...) is deprecated in plain JavaScript React classes. %s",Ee[0],Ee[1])}})}function s(ee){return ee===null||typeof ee!="object"?null:(ee=Nr&&ee[Nr]||ee["@@iterator"],typeof ee=="function"?ee:null)}function u(ee,Ee){ee=(ee=ee.constructor)&&(ee.displayName||ee.name)||"ReactClass";var tt=ee+"."+Ee;yn[tt]||(console.error("Can't call %s on a component that is not yet mounted. This is a no-op, but it might indicate a bug in your application. Instead, assign to `this.state` directly or define a `state = {};` class property with the desired state in the %s component.",Ee,ee),yn[tt]=!0)}function h(ee,Ee,tt){this.props=ee,this.context=Ee,this.refs=Pn,this.updater=tt||ur}function m(){}function S(ee,Ee,tt){this.props=ee,this.context=Ee,this.refs=Pn,this.updater=tt||ur}function v(){}function N(ee){return""+ee}function O(ee){try{N(ee);var Ee=!1}catch{Ee=!0}if(Ee){Ee=console;var tt=Ee.error,ht=typeof Symbol=="function"&&Symbol.toStringTag&&ee[Symbol.toStringTag]||ee.constructor.name||"Object";return tt.call(Ee,"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",ht),N(ee)}}function I(ee){if(ee==null)return null;if(typeof ee=="function")return ee.$$typeof===$n?null:ee.displayName||ee.name||null;if(typeof ee=="string")return ee;switch(ee){case _n:return"Fragment";case Me:return"Profiler";case cr:return"StrictMode";case Gt:return"Suspense";case Mt:return"SuspenseList";case hr:return"Activity"}if(typeof ee=="object")switch(typeof ee.tag=="number"&&console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),ee.$$typeof){case kr:return"Portal";case wt:return ee.displayName||"Context";case nt:return(ee._context.displayName||"Context")+".Consumer";case or:var Ee=ee.render;return ee=ee.displayName,ee||(ee=Ee.displayName||Ee.name||"",ee=ee!==""?"ForwardRef("+ee+")":"ForwardRef"),ee;case yt:return Ee=ee.displayName||null,Ee!==null?Ee:I(ee.type)||"Memo";case er:Ee=ee._payload,ee=ee._init;try{return I(ee(Ee))}catch{}}return null}function H(ee){if(ee===_n)return"<>";if(typeof ee=="object"&&ee!==null&&ee.$$typeof===er)return"<...>";try{var Ee=I(ee);return Ee?"<"+Ee+">":"<...>"}catch{return"<...>"}}function M(){var ee=br.A;return ee===null?null:ee.getOwner()}function Y(){return Error("react-stack-top-frame")}function J(ee){if(lo.call(ee,"key")){var Ee=Object.getOwnPropertyDescriptor(ee,"key").get;if(Ee&&Ee.isReactWarning)return!1}return ee.key!==void 0}function we(ee,Ee){function tt(){Un||(Un=!0,console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",Ee))}tt.isReactWarning=!0,Object.defineProperty(ee,"key",{get:tt,configurable:!0})}function ke(){var ee=I(this.type);return Eo[ee]||(Eo[ee]=!0,console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release.")),ee=this.props.ref,ee!==void 0?ee:null}function pe(ee,Ee,tt,ht,_t,qt){var Kt=tt.ref;return ee={$$typeof:lr,type:ee,key:Ee,props:tt,_owner:ht},(Kt!==void 0?Kt:null)!==null?Object.defineProperty(ee,"ref",{enumerable:!1,get:ke}):Object.defineProperty(ee,"ref",{enumerable:!1,value:null}),ee._store={},Object.defineProperty(ee._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:0}),Object.defineProperty(ee,"_debugInfo",{configurable:!1,enumerable:!1,writable:!0,value:null}),Object.defineProperty(ee,"_debugStack",{configurable:!1,enumerable:!1,writable:!0,value:_t}),Object.defineProperty(ee,"_debugTask",{configurable:!1,enumerable:!1,writable:!0,value:qt}),Object.freeze&&(Object.freeze(ee.props),Object.freeze(ee)),ee}function Fe(ee,Ee){return Ee=pe(ee.type,Ee,ee.props,ee._owner,ee._debugStack,ee._debugTask),ee._store&&(Ee._store.validated=ee._store.validated),Ee}function ze(ee){ft(ee)?ee._store&&(ee._store.validated=1):typeof ee=="object"&&ee!==null&&ee.$$typeof===er&&(ee._payload.status==="fulfilled"?ft(ee._payload.value)&&ee._payload.value._store&&(ee._payload.value._store.validated=1):ee._store&&(ee._store.validated=1))}function ft(ee){return typeof ee=="object"&&ee!==null&&ee.$$typeof===lr}function St(ee){var Ee={"=":"=0",":":"=2"};return"$"+ee.replace(/[=:]/g,function(tt){return Ee[tt]})}function mt(ee,Ee){return typeof ee=="object"&&ee!==null&&ee.key!=null?(O(ee.key),St(""+ee.key)):Ee.toString(36)}function Ve(ee){switch(ee.status){case"fulfilled":return ee.value;case"rejected":throw ee.reason;default:switch(typeof ee.status=="string"?ee.then(v,v):(ee.status="pending",ee.then(function(Ee){ee.status==="pending"&&(ee.status="fulfilled",ee.value=Ee)},function(Ee){ee.status==="pending"&&(ee.status="rejected",ee.reason=Ee)})),ee.status){case"fulfilled":return ee.value;case"rejected":throw ee.reason}}throw ee}function Lt(ee,Ee,tt,ht,_t){var qt=typeof ee;(qt==="undefined"||qt==="boolean")&&(ee=null);var Kt=!1;if(ee===null)Kt=!0;else switch(qt){case"bigint":case"string":case"number":Kt=!0;break;case"object":switch(ee.$$typeof){case lr:case kr:Kt=!0;break;case er:return Kt=ee._init,Lt(Kt(ee._payload),Ee,tt,ht,_t)}}if(Kt){Kt=ee,_t=_t(Kt);var Pr=ht===""?"."+mt(Kt,0):ht;return xn(_t)?(tt="",Pr!=null&&(tt=Pr.replace(Bo,"$&/")+"/"),Lt(_t,Ee,tt,"",function(Dr){return Dr})):_t!=null&&(ft(_t)&&(_t.key!=null&&(Kt&&Kt.key===_t.key||O(_t.key)),tt=Fe(_t,tt+(_t.key==null||Kt&&Kt.key===_t.key?"":(""+_t.key).replace(Bo,"$&/")+"/")+Pr),ht!==""&&Kt!=null&&ft(Kt)&&Kt.key==null&&Kt._store&&!Kt._store.validated&&(tt._store.validated=2),_t=tt),Ee.push(_t)),1}if(Kt=0,Pr=ht===""?".":ht+":",xn(ee))for(var yr=0;yr<ee.length;yr++)ht=ee[yr],qt=Pr+mt(ht,yr),Kt+=Lt(ht,Ee,tt,qt,_t);else if(yr=s(ee),typeof yr=="function")for(yr===ee.entries&&(kn||console.warn("Using Maps as children is not supported. Use an array of keyed ReactElements instead."),kn=!0),ee=yr.call(ee),yr=0;!(ht=ee.next()).done;)ht=ht.value,qt=Pr+mt(ht,yr++),Kt+=Lt(ht,Ee,tt,qt,_t);else if(qt==="object"){if(typeof ee.then=="function")return Lt(Ve(ee),Ee,tt,ht,_t);throw Ee=String(ee),Error("Objects are not valid as a React child (found: "+(Ee==="[object Object]"?"object with keys {"+Object.keys(ee).join(", ")+"}":Ee)+"). If you meant to render a collection of children, use an array instead.")}return Kt}function It(ee,Ee,tt){if(ee==null)return ee;var ht=[],_t=0;return Lt(ee,ht,"","",function(qt){return Ee.call(tt,qt,_t++)}),ht}function Pt(ee){if(ee._status===-1){var Ee=ee._ioInfo;Ee!=null&&(Ee.start=Ee.end=performance.now()),Ee=ee._result;var tt=Ee();if(tt.then(function(_t){if(ee._status===0||ee._status===-1){ee._status=1,ee._result=_t;var qt=ee._ioInfo;qt!=null&&(qt.end=performance.now()),tt.status===void 0&&(tt.status="fulfilled",tt.value=_t)}},function(_t){if(ee._status===0||ee._status===-1){ee._status=2,ee._result=_t;var qt=ee._ioInfo;qt!=null&&(qt.end=performance.now()),tt.status===void 0&&(tt.status="rejected",tt.reason=_t)}}),Ee=ee._ioInfo,Ee!=null){Ee.value=tt;var ht=tt.displayName;typeof ht=="string"&&(Ee.name=ht)}ee._status===-1&&(ee._status=0,ee._result=tt)}if(ee._status===1)return Ee=ee._result,Ee===void 0&&console.error(`lazy: Expected the result of a dynamic import() call. Instead received: %s
|
|
8
8
|
|
|
9
9
|
Your code should look like:
|
|
10
10
|
const MyComponent = lazy(() => import('./MyComponent'))
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createRequire as __createRequire } from 'node:module';
|
|
2
|
+
import { fileURLToPath as __fileURLToPath } from 'node:url';
|
|
3
|
+
import { dirname as __pathDirname } from 'node:path';
|
|
4
|
+
const require = __createRequire(import.meta.url);
|
|
5
|
+
var __filename = __fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __pathDirname(__filename);
|
|
7
|
+
import{la as p}from"./WBWCX3LS.js";import{spawn as l}from"node:child_process";import{existsSync as a}from"node:fs";import*as s from"node:path";var m=/[\\/](_npx|dlx)[\\/]/;function T(t,r){let o=`credential.${t}/.helper`,e=!m.test(process.argv[1]??"")&&d("redocly")?"redocly":`npx --yes @redocly/cli@${r}`;return[`${o}=`,`${o}=!REDOCLY_SUPPRESS_UPDATE_NOTICE=true ${e} project git-credentials`]}async function P(t,{capture:r=!1}={}){return new Promise((o,i)=>{let e=l("git",t,{stdio:r?["ignore","pipe","ignore"]:"inherit",env:{...process.env,GIT_TERMINAL_PROMPT:"0"}}),c="";e.stdout?.on("data",n=>c+=n.toString()),e.on("error",n=>i(u(n))),e.on("close",n=>o({code:n??1,output:c.trim()}))})}function d(t){let r=process.platform==="win32"?[".cmd",".exe"]:[""];return(process.env.PATH??"").split(s.delimiter).some(o=>o&&r.some(i=>a(s.join(o,t+i))))}function u(t){return t.code==="ENOENT"?new p("git is not installed or not on PATH."):t}export{T as a,P as b};
|
|
@@ -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 X}from"./GKXY6U4S.js";import{j as z,k as O,la as g,n as G,o as V,qa as Y,xa as J}from"./WBWCX3LS.js";import{e as W}from"./RFWIIJFG.js";var te=W(X(),1);var C=W(X(),1);function Z(){return process.env.HTTPS_PROXY||process.env.HTTP_PROXY||process.env.http_proxy||process.env.https_proxy}function K(o){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(o).hostname.toLowerCase()}catch{return!1}return e.some(s=>!!(s==="*"||r===s||s.startsWith(".")&&r.endsWith(s)||!s.startsWith(".")&&r.endsWith("."+s)))}var Q=async(o,{timeout:t,...e}={})=>{let r=Z(),s=r&&!K(o),n;s?n=new C.ProxyAgent({uri:r}):t&&(n=new C.Agent({connect:{timeout:t}}));try{return await(0,C.fetch)(o,{signal:t?AbortSignal.timeout(t):void 0,...e,dispatcher:n})}catch(i){throw await n?.destroy(),i}};var fe=/^[\x21-\x7e]+( [\x21-\x7e]+)*$/;function ee(){let o=process.env.REDOCLY_ENVIRONMENT?.trim();return o&&fe.test(o)?o:void 0}var u=class extends Error{status;constructor(t,e){super(t),this.status=e}},h=class{command;version;sunsetWarnings=[];constructor(t,e="2.0"){this.command=t,this.version=e}async request(t,e){let r=ee(),s={...e.headers,"user-agent":`redocly-cli/${this.version} ${this.command}${r?` ${r}`:""}`};try{let n=await Q(t,{...e,headers:s});return this.collectSunsetWarning(n),n}catch(n){let i=n.cause??n,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)}},P=class{client;domain;authHeaders;constructor(t,e,r){this.client=t,this.domain=e,this.authHeaders=r}projectUrl(t,e){return`${this.domain}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}`}async fetchJson(t,e,r){try{let s=await this.client.request(t,{...e,headers:{"Content-Type":"application/json",...this.authHeaders}});return await this.getParsedResponse(s)}catch(s){let n=`${r}. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async getParsedResponse(t){let e=await t.json();if(t.ok)return e;throw new u(`${e.title||t.statusText||"Unknown error"}.`,t.status)}},k=class extends P{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",...this.authHeaders}});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)}}},D=class extends P{async getDefaultBranch(t,e){try{let r=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/sources`,{timeout:6e3,method:"GET",headers:{"Content-Type":"application/json",...this.authHeaders}}),s=await this.getParsedResponse(r),[n]=s.data;if(!n)throw new Error("Project source not found.");return n.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",...this.authHeaders},body:JSON.stringify({mountPath:r.mountPath,mountBranchName:r.mountBranchName,type:"CICD",autoMerge:!0})});return await this.getParsedResponse(s)}catch(s){let n=`Failed to upsert remote. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}async push(t,e,r,s){let n=new te.FormData;n.append("remoteId",r.remoteId),n.append("commit[message]",r.commit.message),n.append("commit[author][name]",r.commit.author.name),n.append("commit[author][email]",r.commit.author.email),n.append("commit[branchName]",r.commit.branchName),r.commit.url&&n.append("commit[url]",r.commit.url),r.commit.namespace&&n.append("commit[namespaceId]",r.commit.namespace),r.commit.sha&&n.append("commit[sha]",r.commit.sha),r.commit.repository&&n.append("commit[repositoryId]",r.commit.repository),r.commit.createdAt&&n.append("commit[createdAt]",r.commit.createdAt);for(let i of s){let a=Buffer.isBuffer(i.stream)?new Blob([i.stream]):new Blob([await me(i.stream)]);n.append(`files[${i.path}]`,a,i.path)}r.isMainBranch&&n.append("isMainBranch","true"),r.replace&&n.append("replace","true");try{let i=await this.client.request(`${this.domain}/api/orgs/${t}/projects/${e}/pushes`,{method:"POST",headers:{...this.authHeaders},body:n});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",...this.authHeaders}});return await this.getParsedResponse(s)}catch(s){let n=`Failed to get push status. ${s.message}`;throw s instanceof u?new u(n,s.status):new Error(n)}}},F=class extends P{create(t,e,r){return this.fetchJson(`${this.projectUrl(t,e)}/pull-requests`,{method:"POST",body:JSON.stringify(r)},"Failed to open a pull request")}async findLatest(t,e,r){let s=new URLSearchParams({branchName:r,limit:"1"}),{data:n}=await this.fetchJson(`${this.projectUrl(t,e)}/pull-requests?${s}`,{method:"GET",timeout:6e3},"Failed to get the pull request");return n[0]}listChecks(t,e,r){return this.fetchJson(`${this.projectUrl(t,e)}/pull-requests/${encodeURIComponent(r)}/checks`,{method:"GET",timeout:6e3},"Failed to get the checks")}},j=class extends P{async findLatestByCommit(t,e,r){let s=new URLSearchParams({limit:"1",filter:`commitHash:${r}`}),{data:n}=await this.fetchJson(`${this.projectUrl(t,e)}/builds?${s}`,{method:"GET",timeout:6e3},"Failed to get the build");return n[0]}},y=class{apiClient;projects;remotes;constructor({domain:t,apiKey:e,command:r,version:s}){this.apiClient=new h(r,s);let n={Authorization:`Bearer ${e}`};this.projects=new k(this.apiClient,t,n),this.remotes=new D(this.apiClient,t,n)}getSunsetWarning(){return re(this.apiClient.sunsetWarnings)}};function re(o){let[t]=[...o].sort((e,r)=>e.isSunsetExpired!==r.isSunsetExpired?e.isSunsetExpired?-1:1:e.sunsetDate>r.sunsetDate?1:-1);return t}async function me(o){let t=[];for await(let e of o)t.push(e);return Buffer.concat(t)}function ge(){if(process.env.REDOCLY_AUTHORIZATION)return process.env.REDOCLY_AUTHORIZATION;throw new Error("No api key provided, please use environment variable REDOCLY_AUTHORIZATION.")}var we=/^http:\/\/(localhost|127\.0\.0\.1)(:\d+)?$/,E={us:"https://app.cloud.redocly.com",eu:"https://app.cloud.eu.redocly.com"};function ye(){return process.env.REDOCLY_DOMAIN||E.us}var ne=ve((o,t)=>{try{let e=t||o?.resolvedConfig.residency;return Te(e)?E[e]:e?new URL(e).origin:o?.resolvedConfig.scorecard?.fromProjectUrl?new URL(o.resolvedConfig.scorecard.fromProjectUrl).origin:E.us}catch{throw new $}});function S(o){try{ne(void 0,o)}catch{return!1}return!0}function ve(o){return(...t)=>{let e=o(...t);if(!e.startsWith("https://")&&!we.test(e))throw new $;return e}}var $=class extends Error{constructor(){super("Invalid Reunite URL")}};function Te(o){return typeof o=="string"&&o in E}import{Buffer as L}from"node:buffer";import A from"node:crypto";import{mkdirSync as Re,existsSync as oe,writeFileSync as Ce,readFileSync as Pe,rmSync as xe}from"node:fs";import{homedir as Ue}from"node:os";import ie from"node:path";import*as se from"node:child_process";var v=class{baseUrl;apiClient;clientName="redocly-cli";constructor(t,e){this.baseUrl=t,this.apiClient=new h("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]];se.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,n)=>{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),n(c.error_description))},e*1e3),a=setTimeout(async()=>{clearInterval(i),clearTimeout(a),n("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:n=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:n,expiresIn:i}}async sendRequest(t,e="GET",r=void 0,s={}){let n=`${this.baseUrl}/api${t}`,i=await this.apiClient.request(n,{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 Ee="4618dbc9-8aed-4e27-aaf0-225f4603e5a4",ae="aes-256-cbc",H=class{version;credentialsFolderPath;credentialsFilePath;credentialsFileName;key;iv;constructor(t){this.version=t;let e=Ue();this.credentialsFolderPath=ie.join(e,".redocly"),this.credentialsFileName="credentials",this.credentialsFilePath=ie.join(this.credentialsFolderPath,this.credentialsFileName),this.key=A.createHash("sha256").update(`${this.credentialsFolderPath}${Ee}`).digest(),this.iv=A.createHash("md5").update(this.credentialsFolderPath).digest(),Re(this.credentialsFolderPath,{recursive:!0})}async login(t,e){let s=await new v(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 v(t,this.version).verifyApiKey(e):!!await this.getAccessToken(t)}getAccessToken=async t=>{let e=new v(t,this.version),r=await this.readCredentials();if(!r||!S(t)||r.residency&&r.residency!==t)return null;if(await e.verifyToken(r.access_token))return r.access_token;try{let n=await e.refreshToken(r.refresh_token);return await this.saveCredentials(n),n.access_token}catch{return null}};async saveCredentials(t){try{let e=this.encryptCredentials(t);Ce(this.credentialsFilePath,e,"utf8")}catch(e){throw new Error(`Failed to save credentials: ${e.message}`)}}async readCredentials(){if(!oe(this.credentialsFilePath))return null;try{let t=Pe(this.credentialsFilePath,"utf8");return this.decryptCredentials(t)}catch{return null}}async removeCredentials(){oe(this.credentialsFilePath)&&xe(this.credentialsFilePath)}encryptCredentials(t){let e=A.createCipheriv(ae,this.key,this.iv);return L.concat([e.update(JSON.stringify(t),"utf8"),e.final()]).toString("hex")}decryptCredentials(t){let e=A.createDecipheriv(ae,this.key,this.iv),r=L.concat([e.update(L.from(t,"hex")),e.final()]);return JSON.parse(r.toString("utf8"))}};var $e=/^(https?:\/\/[^/]+)\/api\/orgs\/([^/]+)\/projects\/([^/]+)\/git\/?$/;function Se(o,t,e){return`${o}/api/orgs/${encodeURIComponent(t)}/projects/${encodeURIComponent(e)}/git`}function _e(o){let[,t,e,r]=o.match($e)??[];if(!(!t||!e||!r||!S(t)))return{reuniteUrl:t,organization:decodeURIComponent(e),project:decodeURIComponent(r)}}async function Ie({branch:o,title:t,description:e,base:r,draft:s,...n}){let{pullRequests:i}=ce(n,"project pr create");return i.create(n.organization,n.project,{branchName:o,title:t,description:e,targetBranchName:r,isDraft:s})}async function Fe({branch:o,...t}){let{pullRequests:e,builds:r}=ce(t,"project pr status"),{organization:s,project:n}=t,i=await e.findLatest(s,n,o);if(!i)return;let[a,c]=await Promise.all([e.listChecks(s,n,i.id),i.headCommitHash?r.findLatestByCommit(s,n,i.headCommitHash):void 0]);return{pullRequest:i,checks:a,previewUrl:c?.deploymentStatus==="SUCCESS"?c.url:void 0}}function ce({reuniteUrl:o,accessToken:t,version:e},r){let s=new h(r,e),n={Cookie:`accessToken=${t}`};return{pullRequests:new F(s,o,n),builds:new j(s,o,n)}}import*as T from"node:fs";import*as p from"node:path";var je=/\/orgs\/([^/]+)\/projects\//,Ae=[401,403];async function x(o,{organization:t,project:e,onSlugDeprecated:r}){let s=await Ne(o,t,e);if(!s)return{organizationId:t,projectId:e};let n={organizationId:Oe(s.uri),projectId:s.id};return(n.organizationId!==t||n.projectId!==e)&&r?.(n),n}async function Ne(o,t,e){try{let r=await o.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&&Ae.includes(r.status))return;throw r}}function Oe(o){let t=o.match(je)?.[1];if(!t)throw new Error(`Could not read the organization ID from the project URI "${o}".`);return t}async function ke({domain:o,apiKey:t,organization:e,project:r,mountPath:s,files:n,defaultBranch:i,commit:a,version:c,replace:_,onUploadStart:I,onSunsetWarning:R,onSlugDeprecated:N}){let f=new y({domain:o,apiKey:t,command:"push",version:c});try{let{organizationId:d,projectId:l}=await x(f,{organization:e,project:r,onSlugDeprecated:N}),b=await f.remotes.getDefaultBranch(d,l),m=await f.remotes.upsert(d,l,{mountBranchName:b,mountPath:s});I?.(m);let{id:U}=await f.remotes.push(d,l,{remoteId:m.id,commit:a,isMainBranch:i===a.branchName,replace:_},n.map(M=>({path:G(M.name),stream:T.createReadStream(M.path)})));return{pushId:U,organizationId:d,projectId:l}}finally{let d=f.getSunsetWarning();d&&R?.(d)}}function De(o,t){let e={};for(let s of o)if(T.statSync(s).isDirectory()){let n=s;ue(n,[]).forEach(a=>r(a,n))}else r(s,p.dirname(s));function r(s,n){let i=p.relative(n,s);e[i]&&t?.(e[i],s),e[i]=s}return Object.entries(e).map(([s,n])=>({name:s,path:p.resolve(n)}))}function ue(o,t){let e=T.readdirSync(o);for(let r of e){let s=p.join(o,r);T.statSync(s).isDirectory()?t=ue(s,t):t.push(s)}return t}async function le({operation:o,condition:t,onConditionNotMet:e,startTime:r=Date.now(),retryTimeoutMs:s=6e5,retryIntervalMs:n=5e3}){async function i(){let a=await o();if(t(a))return a;if(Date.now()-r>s)throw new Error("Timeout exceeded.");return await e?.(a),await z(n),i()}return i()}var Le=1200,He=5e3,qe=["pending","running"];async function Be(o){let t=de(o);try{let e=await x(t,o);return await pe(t,e,o.pushId)}finally{he(t,o)}}async function be({buildType:o,maxExecutionTime:t=Le,retryIntervalMs:e=He,startTime:r=Date.now(),onRetry:s,...n}){let i=de(n);try{let a=await x(i,n);return await le({operation:()=>pe(i,a,n.pushId),condition:c=>!qe.includes(c.status[o].deploy.status),onConditionNotMet:s,startTime:r,retryTimeoutMs:t*1e3,retryIntervalMs:e})}finally{he(i,n)}}function de({domain:o,apiKey:t,version:e}){return new y({domain:o,apiKey:t,command:"push-status",version:e})}function he(o,{onSunsetWarning:t}){let e=o.getSunsetWarning();e&&t?.(e)}function pe(o,{organizationId:t,projectId:e},r){return o.remotes.getPush({organizationId:t,projectId:e,pushId:r})}async function Me({projectUrl:o,auth:t,isApiKey:e=!1,onDebug:r}){let s=We(o);if(!s)throw new g(`Invalid project URL format: ${o}`);try{let n=await ze({...s,auth:t,isApiKey:e,onDebug:r}),i=n.config.scorecardClassic||n.config.scorecard;if(!i)throw new Error("No scorecard configuration found.");let a=n.config.pluginsUrl,c=a?await Ge(a,r):void 0;return{scorecard:i,plugins:c,pluginsUrl:a}}catch(n){throw new g(n instanceof Error?n.message:String(n))}}function We(o){let t=new URL(o),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 ze({residency:o,orgSlug:t,projectSlug:e,auth:r,isApiKey:s,onDebug:n}){let i=new URL(`${o}/api/orgs/${t}/projects/${e}`),a=await fetch(i,{headers:Ve(r,s)});if(n?.(`Project fetch response status: ${a.status}`),a.status===401||a.status===403)throw n?.(`Authentication failed with status ${a.status}.`),n?.("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 n?.("Successfully received project configuration."),a.json()}async function Ge(o,t){t?.(`Fetching plugins from: ${o}`);try{let e=await fetch(o);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 Ve(o,t){return t?{Authorization:`Bearer ${o}`}:{Cookie:`accessToken=${o}`}}async function q(o,t,e=[],r=[],s){let n={};for(let i of e){let a={[i.name]:{root:o,rules:t}},c=await Y({apis:a,...i,plugins:r},{configPath:s});n[i.name]=c.forAlias(i.name)}return n}function B(o,t){if(o){for(let e of o)if(Object.entries(e.where?.metadata||{}).every(([s,n])=>Ye(s,n,t)))return e}}function Ye(o,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[o])return!1;let[r,s]=t.split("/"),n=new Date(e[o]);return!(n<new Date(r)||s&&n>new Date(s))}else if(t.match(/^\/.*\//)){if(!e[o])return!1;try{return V(t).test(e[o])}catch{throw new g(`Invalid regex in scorecard target "${o}": ${t}`)}}return e[o]===t}import{pathToFileURL as Je}from"node:url";async function Xe(o,t){if(!o)return[];let e=Je(t??process.cwd()).href+"/",r=o.replaceAll("__redocly_dirname",`"${e}"`);return(await import(`data:text/javascript;base64,${btoa(r)}`)).default.map(i=>i())}var Ze=".redocly.com";function Ke(o){try{return new URL(o).hostname.toLowerCase().endsWith(Ze)}catch{return!1}}async function Qe({apiPath:o,document:t,externalRefResolver:e,scorecardConfig:r,configPath:s,plugins:n=[],targetLevel:i,metadata:a={},onDebug:c}){let _=[],I=new Map,R=r.levels||[];if(i&&!R.some(l=>l.name===i))throw new g(`Target level "${i}" not found in the scorecard configuration levels.
|
|
8
|
+
`);let N=B(r.targets,a)?.rules,f=await q(o,N,R,n,s||"");for(let l of R){c?.(`
|
|
9
|
+
Validating level: "${l.name}"`),n.length>0&&c?.(`Using ${n.length} ${O("plugin",n.length)} for this level.`),c?.("Linting document against level rules...");let m=(await J({document:t,externalRefResolver:e,config:f[l.name]})).filter(({ignored:U})=>!U).map(U=>({...U,scorecardLevel:l.name}));c?.(`Found ${m.length} ${O("problem",m.length)} for level "${l.name}".`),I.set(l.name,m),_.push(...m)}let d=et(I,R,i);return{problems:_,achievedLevel:d,targetLevelAchieved:i?d===i:!0}}function et(o,t,e){let r=null;for(let s of t){if((o.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,h as b,y as c,re as d,ge as e,E as f,ye as g,ne as h,S as i,$ as j,v as k,H as l,Se as m,_e as n,Ie as o,Fe as p,x as q,ke as r,De as s,Be as t,be as u,Me as v,q as w,B as x,Xe as y,Ke as z,Qe as A};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{b as $,e as T,o as E,p as F,r as I,t as L,v as m}from"./
|
|
7
|
+
import{b as $,e as T,o as E,p as F,r as I,t as L,v as m}from"./QMS4UKIK.js";import{$ as w,da as l,fa as n,k as x,ma as h,sa as A,ta as g,va as k}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as O}from"perf_hooks";async function X({argv:e,config:t,version:u,collectSpecData:P,collectResults:R}){let c=await $(e.apis,t),r={errors:0,warnings:0,ignored:0},p=0,b=e.format==="checkstyle"||e.format==="junit",y=[];for(let{path:o,alias:f}of c)try{let d=O.now(),s=t.forAlias(f);L(s.rules),s.skipRules(e["skip-rule"]),s.skipPreprocessors(e["skip-preprocessor"]),typeof t.document?.parsed>"u"&&!e.extends&&n.info(`No configurations were provided -- using built in ${w("recommended")} configuration by default.
|
|
8
8
|
|
|
9
9
|
`),f===void 0?n.info(l(`validating ${m(o)}...
|
|
10
10
|
`)):n.info(l(`validating ${m(o)} using lint rules for api '${f}'...
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{c as U}from"./HAOBCQWB.js";import{b as E,c as F,d as V,e as L,f as z,g as ie,h as J,i as ce,j as le}from"./
|
|
7
|
+
import{c as U}from"./HAOBCQWB.js";import{b as E,c as F,d as V,e as L,f as z,g as ie,h as J,i as ce,j as le}from"./EFB2YVY2.js";import{a as te,c as T,d as N,e as A,g as K,h as B,i as se,j as oe,k as re,l as G,n as ae}from"./UW4UC7ZI.js";var I=T.python,D=class extends te{constructor(){super(" ")}typeName(n){return N(n,{style:"pascal",reserved:I})}memberName(n){let t=N(n,{style:"snake",reserved:I});return{identifier:t,renamed:t!==n}}identifier(n){return N(n,{style:"snake",reserved:I})}identifiers(n,t){return A(n,{style:"snake",reserved:I,taken:t})}constName(n){return N(n,{style:"screaming",reserved:I})}string(n){let t='"';for(let s of n){let r=s.codePointAt(0);s==="\\"?t+="\\\\":s==='"'?t+='\\"':s===`
|
|
8
8
|
`?t+="\\n":s==="\r"?t+="\\r":s===" "?t+="\\t":r<32||r===127?t+=`\\x${r.toString(16).padStart(2,"0")}`:r>=55296&&r<=57343?t+=`\\u${r.toString(16).padStart(4,"0")}`:t+=s}return t+'"'}literal(n){return n==null?"None":n===!0?"True":n===!1?"False":typeof n=="number"?String(n):typeof n=="string"?this.string(n):Array.isArray(n)?`[${n.map(s=>this.literal(s)).join(", ")}]`:`{${Object.entries(n).map(([s,r])=>`${this.string(s)}: ${this.literal(r)}`).join(", ")}}`}comment(n){for(let t of G(n))this.line(t===""?"#":`# ${t}`);return this}doc(n){let t=G(n);if(t.length===0)return this;if(t.length===1)return this.line(`"""${t[0]}"""`);this.line(`"""${t[0]}`);for(let s of t.slice(1))this.line(s);return this.line('"""')}};var x=T.python,m=new D;function O(e){return m.typeName(e)}function q(e){let{identifier:n,renamed:t}=m.memberName(e);return{python:n,renamed:t}}function M(e){let n=e.services.flatMap(s=>s.operations),t=A(n.map(s=>s.name),{style:"snake",reserved:x});return n.map((s,r)=>({op:s,ident:t[r]}))}var W=["self","body","headers","timeout","retry","idempotency_key"];function de(e){return m.literal(e)}function fe(e){if(e!==void 0)return{style:e.style,...e.param!==void 0?{param:e.param}:{},...e.nextCursor!==void 0?{next_cursor:e.nextCursor}:{},...e.hasMore!==void 0?{has_more:e.hasMore}:{},...e.nextLink!==void 0?{next_link:e.nextLink}:{},...e.limitParam!==void 0?{limit_param:e.limitParam}:{},...e.items!==void 0?{items:e.items}:{}}}function pe(e,n){let t=new Set;return`[${(e.successResponseHeaders??[]).map(r=>{let a=N(r.name,{style:"snake",reserved:x}),i=a,c=2;for(;t.has(i);)i=`${a}_${c++}`;t.add(i);let p=ae(r.schema,n);return`(${m.string(r.name)}, ${m.string(i)}, ${m.string(p)})`}).join(", ")}]`}function u(e,n="string"){if(se(e))return`Optional[${u(oe(e),n)}]`;switch(e.kind){case"scalar":if(n==="Date"&&e.scalar==="string"){if(e.metadata?.format==="date-time")return"datetime";if(e.metadata?.format==="date")return"date"}return{string:"str",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"array":return`List[${u(e.items,n)}]`;case"record":return`Dict[str, ${u(e.value,n)}]`;case"ref":return O(e.name);case"literal":return`Literal[${m.literal(e.value)}]`;case"enum":return{string:"str",integer:"int",number:"float",boolean:"bool"}[e.scalar];case"union":return`Union[${e.members.map(t=>u(t,n)).join(", ")}]`;case"null":return"None";case"omit":return O(e.base);case"object":case"intersection":case"unknown":return"Any"}}function Q(e,n,t,s,r,a,i,c=!1){let p=A([...n.pathParams,...n.queryParams].map(S=>S.name),{style:"snake",reserved:x,taken:W}),l=n.pathParams.map((S,P)=>({param:S,python:p[P]})),o=n.queryParams.map((S,P)=>({param:S,python:p[n.pathParams.length+P]})),d=l.map(({param:S,python:P})=>`${P}: ${u(S.schema,a)}`),y=L(n)||n.requestBody!==void 0&&z(n.requestBody.contentType),h=n.requestBody?[`body: ${y?"Any":u(n.requestBody.schema,a)}`]:[],b=[...o.map(({param:S,python:P})=>{let j=u(S.schema,a),R=j.startsWith("Optional[")?j:`Optional[${j}]`;return`${P}: ${R} = None`}),"headers: Optional[Dict[str, str]] = None","timeout: Optional[float] = None","retry: Optional[Dict[str, Any]] = None","idempotency_key: Any = None"],_=E(n),k=F(n),v=c?`Envelope[${_===void 0?"None":u(_,a)}]`:k!==void 0?`${r?"AsyncIterator":"Iterator"}[ServerSentEvent]`:s==="result"?"Result":_===void 0?"None":u(_,a),f=r&&k===void 0?"async def":"def",$=r?"await ":"",g=r?"send_async":"send",w=["self",...d,...h,"*",...b].join(", "),Y=c?`${t}_with_headers`:t;e.block(`${f} ${Y}(${w}) -> ${v}:`,()=>{e.doc(c?`Like ${t}(), returning an Envelope with the declared response headers.`:n.summary),e.line(`op = _OPERATIONS["${t}"]`),e.line('auth_headers, auth_query = resolve_auth(op.get("security") or [], self._auth)'),e.line("params: Dict[str, Any] = dict(auth_query)");for(let{param:R,python:C}of o)e.block(`if ${C} is not None:`,()=>{e.line(`params[${m.string(R.name)}] = encode(${C})`)});let S=l.map(({param:R,python:C})=>`${m.string(R.name)}: ${C}`).join(", ");if(e.line(`url = build_url(self._server_url, op["path"], {${S}})`),k!==void 0){let R=k.schema!==void 0&&k.schema.kind!=="unknown"?"json":"text";e.block("def _open(extra_headers: Dict[str, str]):",()=>{e.line('return self._http.stream(op["method"], url, headers={**auth_headers, **(headers or {}), **extra_headers}, params=params, timeout=timeout)')}),e.line(`return ${r?"aiter_sse":"iter_sse"}(_open, data_kind="${R}")`);return}V(n)&&!L(n)&&e.line("form_data, form_files = to_multipart(body)");let P=n.requestBody?L(n)?", **multipart_arguments(body)":V(n)?", data=form_data, files=form_files":z(n.requestBody.contentType)?`, content=body, content_type=${m.string(n.requestBody.contentType)}`:", json_body=encode(body)":"";e.line(`response = ${$}${g}(self._http, self._config, op, url, method=op["method"], headers={**auth_headers, **(headers or {})}, params=params${P}, timeout=timeout, retry=retry, idempotency_key=idempotency_key)`);let j=_===void 0?"None":`decode(${u(_,a)}, _safe_json(response))`;c?(e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line(`return Envelope(data=${j}, headers=read_envelope_headers(response, ${pe(n,i)}), response=response)`)):s==="result"?(e.block("if not response.is_success:",()=>{e.line("return Result(data=None, error=_safe_json(response), response=response)")}),e.line(`return Result(data=${j}, error=None, response=response)`)):(e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line(_===void 0?"return None":`return ${j}`))}),e.blank()}function me(e,n,t,s,r,a){let i=E(n),c=i===void 0?"Any":u(i,a),p=A([...n.pathParams,...n.queryParams].map(f=>f.name),{style:"snake",reserved:x,taken:W}),l=n.pathParams.map((f,$)=>({param:f,python:p[$]})),o=n.queryParams.map((f,$)=>({param:f,python:p[n.pathParams.length+$]})),d=l.map(({param:f,python:$})=>`${$}: ${u(f.schema,a)}`),y=[...o.map(({param:f,python:$})=>{let g=u(f.schema,a),w=g.startsWith("Optional[")?g:`Optional[${g}]`;return`${$}: ${w} = None`}),"headers: Optional[Dict[str, str]] = None","timeout: Optional[float] = None","retry: Optional[Dict[str, Any]] = None"],h=["self",...d,"*",...y].join(", "),b=s?"AsyncIterator":"Iterator",_=s?"aiter_pages":"iter_pages",k=s?"aiter_items":"iter_items",v=()=>{e.line("base: Dict[str, Any] = {}");for(let{param:g,python:w}of o)e.block(`if ${w} is not None:`,()=>{e.line(`base[${m.string(g.name)}] = encode(${w})`)});let f=s?"async def":"def",$=s?"await ":"";e.block(`${f} _page(page_params: Dict[str, Any]) -> Tuple[Any, Any]:`,()=>{e.line('auth_headers, auth_query = resolve_auth(op.get("security") or [], self._auth)');let g=l.map(({param:w,python:Y})=>`${m.string(w.name)}: ${Y}`).join(", ");e.line(`url = build_url(self._server_url, op["path"], {${g}})`),e.line(`response = ${$}${s?"send_async":"send"}(self._http, self._config, op, url, method=op["method"], headers={**auth_headers, **(headers or {})}, params={**page_params, **auth_query}, timeout=timeout, retry=retry)`),e.block("if not response.is_success:",()=>{e.line("raise ApiError(url, response.status_code, response.reason_phrase, _safe_json(response))")}),e.line("return _safe_json(response), response")})};s?(e.block(`async def ${t}_pages(${h}) -> ${b}[${c}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),v(),e.block(`async for page in ${_}(_page, op["pagination"], base):`,()=>{e.line(c==="Any"?"yield page":`yield decode(${c}, page)`)})}),e.blank(),e.block(`async def ${t}_items(${h}) -> ${b}[${r}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),v(),e.block(`async for item in ${k}(_page, op["pagination"], base):`,()=>{e.line(r==="Any"?"yield item":`yield decode(${r}, item)`)})})):(e.block(`def ${t}_pages(${h}) -> ${b}[${c}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),v(),e.line(c==="Any"?`return ${_}(_page, op["pagination"], base)`:`return (decode(${c}, page) for page in ${_}(_page, op["pagination"], base))`)}),e.blank(),e.block(`def ${t}_items(${h}) -> ${b}[${r}]:`,()=>{e.line(`op = _OPERATIONS["${t}"]`),v(),e.line(r==="Any"?`return ${k}(_page, op["pagination"], base)`:`return (decode(${r}, item) for item in ${k}(_page, op["pagination"], base))`)})),e.blank()}function he(e){return ie(e).map(t=>t.kind==="literal"?m.string(t.value):q(t.name).python).join(" + ")}function ue(e,n){let t=n.servers??[];if(t.length===0)return;let s=new Set;e.block("class Servers:",()=>{e.line('"""The declared servers; variables default to the values from the description."""'),e.blank(),t.forEach((r,a)=>{let i=N(r.description??`server${a+1}`,{style:"snake",reserved:x});s.has(i)&&(i=`${i}_${a+1}`),s.add(i);let c=r.variables.map(p=>`${q(p.name).python}: str = ${m.string(p.default)}`);a>0&&e.blank(),e.line("@staticmethod"),e.block(`def ${i}(${c.join(", ")}) -> str:`,()=>{e.line(`return ${he(r)}`)})})}),e.blank()}function X(e,n,t,s,r,a,i){let c=s?"AsyncClient":"Client",p=s?"httpx.AsyncClient":"httpx.Client";e.block(`class ${c}:`,()=>{e.doc(`${s?"Async ":""}client for ${n.title} (${n.version}).`),e.block(`def __init__(self, server_url: str = ${m.string(a)}, *, auth: Optional[Dict[str, Any]] = None, headers: Optional[Dict[str, str]] = None, timeout: Optional[float] = None, retry: Optional[Dict[str, Any]] = None, middleware: Optional[List[Any]] = None, idempotency_key: Any = None, http_client: Optional[${p}] = None) -> None:`,()=>{e.line("self._server_url = server_url"),e.line("self._auth = auth or {}"),e.line("self._config: Dict[str, Any] = {"),e.indent(()=>{e.line('"headers": headers or {},'),e.line('"timeout": timeout,'),e.line('"retry": retry or {},'),e.line('"middleware": middleware or [],'),e.line('"idempotency_key": idempotency_key,')}),e.line("}"),e.line(`self._http = http_client or ${p}()`)}),e.blank();for(let{op:l,ident:o}of M(n)){Q(e,l,o,t,s,i),F(l)===void 0&&(l.successResponseHeaders?.length??0)>0&&Q(e,l,o,t,s,i,n,!0);let d=r.get(o);if(d!==void 0){let y=E(l),h=ce(y,typeof d.items=="string"?d.items:void 0,n);me(e,l,o,s,h===void 0?"Any":u(h,i),i)}}}),e.blank()}function Z(e){let n=new Map,t=new Set,s=[];for(let{name:a,schema:i}of e.schemas){let c=B(i,e);if(!(c===void 0||!c.cases.every(l=>K(l.schema,e)?.properties.some(o=>o.name===c.property)===!0))){for(let l of c.cases){let o=n.get(l.schemaName);if(o!==void 0&&o.value!==l.value){t.add(l.schemaName);continue}n.set(l.schemaName,{property:c.property,value:l.value})}s.push({name:a,property:c.property,members:c.cases.map(l=>l.schemaName)})}}let r=new Map;for(let a of s)a.members.some(i=>t.has(i))||r.set(a.name,q(a.property).python);for(let a of t)n.delete(a);return{pins:n,unions:r}}function $e(e,n,t,s,r,a,i){let c=r==="pydantic";c||e.line("@dataclass");let p=c?`class ${O(n)}(BaseModel):`:`class ${O(n)}:`;e.block(p,()=>{e.doc(a),c&&(e.line("model_config = ConfigDict(populate_by_name=True)"),e.blank());let l=[...t.filter(d=>d.required),...t.filter(d=>!d.required)],o=[];l.length===0&&e.line("pass");for(let d of l){let{python:y,renamed:h}=q(d.name);h&&!c&&o.push([y,d.name]);let b=h&&c?`alias=${m.string(d.name)}`:void 0,_=i?.property===d.name?`Literal[${m.literal(i.value)}]`:u(d.schema,s);if(d.required){let k=b===void 0?"":` = Field(${b})`;e.line(`${y}: ${_}${k}`)}else{let k=_.startsWith("Optional[")?_:`Optional[${_}]`,v=b===void 0?"None":`Field(default=None, ${b})`;e.line(`${y}: ${k} = ${v}`)}}if(o.length>0){e.blank(),e.line("# Python field name -> wire (JSON) name, for (de)serialization.");let d=o.map(([y,h])=>`"${y}": ${m.string(h)}`).join(", ");e.line(`_field_map: ClassVar[Dict[str, str]] = {${d}}`)}}),e.blank(),e.blank()}function ee(e,n="string",t="dataclass"){let s=new D,{pins:r,unions:a}=t==="pydantic"?Z(e):{pins:new Map,unions:new Map};s.line("from __future__ import annotations"),s.blank(),t==="dataclass"&&s.line("from dataclasses import dataclass"),s.line("from enum import Enum");let i=["Any","AsyncIterator","Dict","Iterator","List","Literal","Optional","Tuple","Union"];t==="dataclass"&&i.splice(2,0,"ClassVar"),a.size>0&&i.unshift("Annotated"),s.line(`from typing import ${i.join(", ")}`),t==="pydantic"&&s.line("from pydantic import BaseModel, ConfigDict, Field"),n==="Date"&&s.line("from datetime import date, datetime"),s.blank(),s.blank();let c=new Map;for(let{name:p,schema:l}of e.schemas){let o=re(l);if(o!==void 0){let d=o.scalar==="string"?"str, Enum":"int, Enum";s.block(`class ${O(p)}(${d}):`,()=>{s.doc(l.description),o.values.forEach((y,h)=>{s.line(`${o.memberNames[h]} = ${m.literal(y)}`)})}),s.blank(),s.blank();continue}if(l.kind==="object"||l.kind==="intersection"){let d=K(l,e);if(d!==void 0){$e(s,p,d.properties,n,t,d.description??l.description,r.get(p));continue}}c.set(p,l)}for(let[p,l]of _e(c)){let o=B(l,e);if(o!==void 0){let h=o.cases.map(b=>`${b.value} -> ${O(b.schemaName)}`).join(", ");s.line(`# Discriminated by "${o.property}": ${h}`)}let d=a.get(p),y=d===void 0?u(l,n):`Annotated[${u(l,n)}, Field(discriminator=${m.string(d)})]`;s.line(`${O(p)} = ${y}`),s.blank()}return s.toString()}function _e(e){let n=[],t=new Set,s=r=>{let a=e.get(r);if(!(a===void 0||t.has(r))){t.add(r);for(let i of H(a))s(i);n.push([r,a])}};for(let r of e.keys())s(r);return n}function H(e){return e.kind==="ref"?[e.name]:e.kind==="array"?H(e.items):e.kind==="record"?H(e.value):e.kind==="union"?e.members.flatMap(H):[]}function ye(e,n){let t=[];for(let{name:s,schema:r}of e.schemas){if(n.has(s))continue;let a=B(r,e);if(a===void 0)continue;let i=a.cases.map(c=>`${m.string(c.value)}: ${O(c.schemaName)}`).join(", ");t.push(`DISCRIMINATORS[${O(s)}] = (${m.string(a.property)}, {${i}})`)}return t}var an={type:"object",properties:{models:{enum:["dataclass","pydantic"],default:"dataclass",description:"Model style: standard-library dataclasses (default, httpx is the only dependency), or pydantic BaseModel classes (adds pydantic)."}},additionalProperties:!1};function ne(e){let n=e.lastIndexOf("/")>=0?"/":"\\",t=e.lastIndexOf(n),s=t>=0?e.slice(0,t+1):"",r=(t>=0?e.slice(t+1):e).replace(/\.[^.]+$/,"");return`${s}${N(r,{style:"snake",reserved:x})}.py`}var cn=({model:e,output:n,banner:t,emit:s,options:r,pagination:a})=>{let i=s.errorMode??"throw",c=s.dateType??"string",p=r?.models??"dataclass",l=p==="pydantic"?Z(e):void 0,o=new D;if(o.line(`# Generated by @redocly/client-generator (python) from "${e.title}" ${e.version}.`),o.line("# Do not edit by hand \u2014 regenerate with `redocly generate-client`."),o.line(p==="pydantic"?"# Requires Python >= 3.9, httpx, and pydantic: pip install httpx pydantic":"# Requires Python >= 3.9 and httpx: pip install httpx"),o.blank(),o.line(ee(e,c,p).trimEnd()),o.blank(),o.blank(),ue(o,e),s.runtime==="module"){o.line("# \u2500\u2500\u2500 Runtime (real modules beside this file, written by the same run) \u2500\u2500\u2500");for(let f of Object.keys(U))o.line(`from ${f.replace(/\.py$/,"")} import *`);o.blank(),o.blank()}else{o.line("# \u2500\u2500\u2500 Embedded runtime (@redocly/client-generator python runtime) \u2500\u2500\u2500");for(let f of Object.values(U)){let $=f.split(`
|
|
9
9
|
`).filter(g=>!g.startsWith("from __future__")&&!g.startsWith("from ._")).join(`
|
|
10
10
|
`).trim();o.line($),o.blank()}o.blank()}let d=ye(e,new Set(l?.unions.keys()));if(d.length>0){o.line("# Discriminated unions dispatch by their property inside decode().");for(let f of d)o.line(f);o.blank()}o.block("def _safe_json(response: httpx.Response) -> Any:",()=>{o.block("try:",()=>{o.line("return response.json()")}),o.block("except Exception:",()=>{o.line("return None")})}),o.blank();let y=new Map;for(let{op:f,ident:$}of M(e))y.set($,fe(a?.get(f.name)?.spec));o.line("_OPERATIONS = {"),o.indent(()=>{for(let{op:f,ident:$}of M(e)){let g={id:f.specName??f.name,method:f.method.toUpperCase(),path:f.path,...J(f,e).length>0?{security:J(f,e)}:{},...y.get($)!==void 0?{pagination:y.get($)}:{}};o.line(`"${$}": ${de(g)},`)}}),o.line("}"),o.blank(),o.blank();let h=s.serverUrl??e.serverUrl??"";X(o,e,i,!1,y,h,c),X(o,e,i,!0,y,h,c);let b={path:ne(n.path),content:o.toString()};if(s.runtime!=="module")return[b];let _=t.map(f=>`# ${f}`).join(`
|
|
@@ -4,5 +4,5 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{l as t}from"./
|
|
7
|
+
import{l as t}from"./O37B7ABT.js";import"./GKXY6U4S.js";import{fa as o}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function i({version:n}){new t(n).logout(),o.output(`Logged out from the Redocly account. \u270B
|
|
8
8
|
`)}export{i as handleLogout};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{b as S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./
|
|
7
|
+
import{b as S,c as N,e as R,j as g,k as _,o as v,q as F,r as U,s as b,v as s}from"./QMS4UKIK.js";import{$ as i,Z as y,_ as $,da as u,fa as n,ma as k,oa as T,sa as B,t as O,ta as E}from"./WBWCX3LS.js";import{writeFileSync as L}from"fs";import{resolve as j}from"path";import{performance as q}from"perf_hooks";var P={};async function Y({argv:e,config:l,version:W,collectSpecData:G}){let A=await S(e.apis,l),a={errors:0,warnings:0,ignored:0},I=N(l);for(let{path:o,alias:c,output:J}of A)try{let d=q.now(),p=l.forAlias(c);p.skipPreprocessors(e["skip-preprocessor"]),p.skipDecorators(e["skip-decorator"]);let m=e.overlay??p.resolvedConfig.overlays?.map(t=>O(t)?t:j(I,t));m?.length&&(P.bundle_overlays_count=(P.bundle_overlays_count??0)+m.length),c===void 0?n.info(u(`bundling ${s(o)}...
|
|
8
8
|
`)):n.info(u(`bundling ${s(o)} using configuration for api '${c}'...
|
|
9
9
|
`));let{bundle:D,problems:w,...x}=await T({ref:o,config:p,dereference:e.dereferenced,removeUnusedComponents:e["remove-unused-components"],keepUrlRefs:e["keep-url-references"],componentRenamingConflicts:e["component-renaming-conflicts-severity"],componentNamesStrategy:e["component-names-strategy"],overlays:m,collectSpecData:G}),r=B(w),{outputFile:f,ext:K}=F({entrypoint:o,output:J,argvOutput:e.output,ext:e.ext,entries:e?.apis?.length||0});if(r.errors===0||e.force)if(f){let t=g(b(D.parsed),K,e.dereferenced);_(f,t)}else{let t=g(b(D.parsed),e.ext||"yaml",e.dereferenced);n.output(t)}a.errors+=r.errors,a.warnings+=r.warnings,a.ignored+=r.ignored,E(w,{format:"codeframe",totals:r,version:W,command:"bundle"}),e.metafile&&(A.length>1&&n.warn('[WARNING] "--metafile" cannot be used with multiple apis. Skipping...'),L(e.metafile,JSON.stringify(x),"utf-8"));let h=R(d);r.errors>0?e.force?n.info(`\u2753 Created a bundle for ${i(s(o))} at ${i(f||"stdout")} with errors ${y(h)}.
|
|
10
10
|
${$("Errors ignored because of --force")}.
|
|
@@ -4,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"./3DMXMP4K.js";import{fa as p}from"./WBWCX3LS.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,8 +4,8 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{$ as f,L as D,M as h,N as O,R as C,Y as
|
|
8
|
-
${q(s)} ${
|
|
7
|
+
import{$ as f,L as D,M as h,N as O,R as C,Y as P,Z as j,_ as S,d as E,da as b,e as x,f as $,fa as o,k as l,la as a,t as u}from"./WBWCX3LS.js";var y=["json","yaml","yml"];import*as i from"node:fs";import{basename as k,dirname as d,extname as g,join as T,resolve as m,relative as R}from"node:path";import*as c from"node:process";import{performance as F}from"perf_hooks";async function te(e,n){let r=!x(e)&&$(n.resolvedConfig.apis)?G(n):await W(e,n),p=r.filter(({path:s})=>!z(s));if(x(p)){for(let{path:s}of p)o.warn(`
|
|
8
|
+
${q(s)} ${P(`does not exist or is invalid.
|
|
9
9
|
|
|
10
10
|
`)}`);throw new a("Please provide a valid path.")}if(r.length===0)throw new a("No APIs were provided. Specify an API via the command argument or define one in your config.");return r}function w(e){return e.configPath?d(e.configPath):c.cwd()}function z(e){if(!e.trim())throw new a("Path cannot be empty.");return i.existsSync(e)||u(e)?e:void 0}function G(e){return Object.entries(e.resolvedConfig.apis||{}).map(([n,{root:t,output:r}])=>({path:u(t)?t:m(w(e),t),alias:n,output:r&&m(w(e),r)}))}function N(e,n){let t=w(e),r=e.resolvedConfig.apis?.[n];return r?{path:u(r.root)?r.root:m(t,r.root),alias:n,output:r.output&&m(t,r.output)}:{path:n,alias:Object.entries(e.resolvedConfig.apis||{}).find(([p,s])=>m(t,s.root)===m(n))?.[0]??void 0}}async function W(e,n){let{hasMagic:t,glob:r}=await import("./SJHPKWSD.js");return(await Promise.all(e.map(async p=>t(p)&&!u(p)?(await r(p,{cwd:w(n)})).map(I=>N(n,I)):N(n,p)))).flat()}function L(e){return c.env.NODE_ENV==="test"?"<test>ms":`${Math.ceil(F.now()-e)}ms`}function oe(e,n,t){let r=L(n);o.info(b(`
|
|
11
11
|
${t}: ${e} processed in ${r}
|
|
@@ -20,7 +20,7 @@ Try to use ${f("yaml")} output or remove ${f("--dereferenced")}.`);case SyntaxEr
|
|
|
20
20
|
|
|
21
21
|
`)?.[0]}`);default:throw new a(`Something went wrong when processing ${n}:
|
|
22
22
|
|
|
23
|
-
- ${e.message}`)}}function me(e,n){let t=e.ignored?
|
|
23
|
+
- ${e.message}`)}}function me(e,n){let t=e.ignored?S(`${e.ignored} ${l("problem is",e.ignored)} explicitly ignored.
|
|
24
24
|
|
|
25
25
|
`):"";e.errors>0?o.error(`\u274C Validation failed with ${e.errors} ${l("error",e.errors)}${e.warnings>0?` and ${e.warnings} ${l("warning",e.warnings)}`:""}.
|
|
26
26
|
${t}`):e.warnings>0?(o.info(j(`Woohoo! Your API ${l("description is",n)} valid. \u{1F389}
|
|
@@ -4,6 +4,6 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{b as xe,f as Pe}from"./SV2XHB2S.js";import{S as le,T as he,W as b,Y as fe,Z as de,_ as j,aa as ye,ba as U,c as L,ca as A,f as ie,fa as k,ga as Se,ha as ge,ia as Q,ja as K,la as Ce,oa as be,p as ae,q as pe,r as ce,u as me,v as ue}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as mt}from"perf_hooks";var D={thresholds:{maxParamsGood:5,maxDepthGood:4,maxPolymorphismGood:2,maxDependencyDepthGood:3,maxAmbiguousGood:0,maxOperationsForDiscoverability:1e3},weights:{parameterSimplicity:.1,schemaSimplicity:.1,documentationQuality:.18,constraintClarity:.12,exampleCoverage:.18,errorClarity:.12,dependencyClarity:.1,identifierClarity:.05,polymorphismClarity:.05,anyOfPenaltyMultiplier:2,discoverabilityWeight:.1},hotspotLimit:10},Oe=new Set(["id","name","type","value","data","key","status","state","code","result","item","object","resource","entity","input","output","payload","body","content","info"]);function B(e){if(e.length===0)return 0;let r=[...e].sort((o,n)=>o-n),t=Math.floor(r.length/2);return r.length%2!==0?r[t]:(r[t-1]+r[t])/2}function He(e,r,t=D){let{thresholds:o,weights:n}=t,s=x(1-e.parameterCount/(o.maxParamsGood*2)),a=Math.max(e.maxRequestSchemaDepth,e.maxResponseSchemaDepth)/(o.maxDepthGood*2),c=De(e,n.anyOfPenaltyMultiplier)/(o.maxPolymorphismGood*3),h=x(1-a-c),u=(e.operationDescriptionPresent?1:0)+e.paramsWithDescription+e.schemaPropertiesWithDescription,f=1+e.parameterCount+e.totalSchemaProperties,$=f>0?x(u/f):1,O=e.totalSchemaProperties>0?x(e.constraintCount/e.totalSchemaProperties):1,y=(e.requestExamplePresent?1:0)+(e.responseExamplePresent?1:0),g=(e.requestBodyPresent?1:0)+1,M=x(y/g),T=e.totalErrorResponses>0?x(e.structuredErrorResponseCount/e.totalErrorResponses):1,I=x(1-r/(o.maxDependencyDepthGood*2)),l=x(1-e.ambiguousIdentifierCount/Math.max(o.maxAmbiguousGood+3,1)),m=De(e,n.anyOfPenaltyMultiplier),d=m===0?1:e.hasDiscriminator?x(1-m/(o.maxPolymorphismGood*4)):x(1-m/(o.maxPolymorphismGood*2));return{parameterSimplicity:s,schemaSimplicity:h,documentationQuality:$,constraintClarity:O,exampleCoverage:M,errorClarity:T,dependencyClarity:I,identifierClarity:l,polymorphismClarity:d}}function ze(e,r=D){let t=r.weights,o=e.parameterSimplicity*t.parameterSimplicity+e.schemaSimplicity*t.schemaSimplicity+e.documentationQuality*t.documentationQuality+e.constraintClarity*t.constraintClarity+e.exampleCoverage*t.exampleCoverage+e.errorClarity*t.errorClarity+e.dependencyClarity*t.dependencyClarity+e.identifierClarity*t.identifierClarity+e.polymorphismClarity*t.polymorphismClarity;return $e(x(o)*100)}function Re(e,r,t=D){let o=new Map;for(let[n,s]of e.operations){let i=r.get(n)??0,a=He(s,i,t);o.set(n,{agentReadiness:ze(a,t),subscores:a})}return o}function Me(e,r=D){return x(1-e/r.thresholds.maxOperationsForDiscoverability)}function ve(e,r,t=D){if(e.size===0)return{agentReadiness:100};let o=[];for(let i of e.values())o.push(i.agentReadiness);let n=t.weights.discoverabilityWeight,s=r*100;return{agentReadiness:$e(B(o)*(1-n)+s*n)}}function J(e,r,t){return e-r+r*t}function De(e,r){return J(e.polymorphismCount,e.anyOfCount,r)}function x(e){return Math.max(0,Math.min(1,e))}function Ee(e){let r=e.size||1,t={parameterSimplicity:0,schemaSimplicity:0,documentationQuality:0,constraintClarity:0,exampleCoverage:0,errorClarity:0,dependencyClarity:0,identifierClarity:0,polymorphismClarity:0};for(let o of e.values())t.parameterSimplicity+=o.subscores.parameterSimplicity,t.schemaSimplicity+=o.subscores.schemaSimplicity,t.documentationQuality+=o.subscores.documentationQuality,t.constraintClarity+=o.subscores.constraintClarity,t.exampleCoverage+=o.subscores.exampleCoverage,t.errorClarity+=o.subscores.errorClarity,t.dependencyClarity+=o.subscores.dependencyClarity,t.identifierClarity+=o.subscores.identifierClarity,t.polymorphismClarity+=o.subscores.polymorphismClarity;return t.parameterSimplicity/=r,t.schemaSimplicity/=r,t.documentationQuality/=r,t.constraintClarity/=r,t.exampleCoverage/=r,t.errorClarity/=r,t.dependencyClarity/=r,t.identifierClarity/=r,t.polymorphismClarity/=r,t}function $e(e){return Math.round(e*10)/10}function we(e,r,t){let o=Math.max(1,e);return r/o+t/o}function Qe(e,r){return r.totalSchemaProperties>e.totalSchemaProperties?!0:r.totalSchemaProperties<e.totalSchemaProperties?!1:we(r.totalSchemaProperties,r.schemaPropertiesWithDescription,r.constraintCount)>we(e.totalSchemaProperties,e.schemaPropertiesWithDescription,e.constraintCount)}var Ke=["enum","const","format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties","multipleOf","exclusiveMinimum","exclusiveMaximum","uniqueItems"];function Y(){return{depth:-1,maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[],debugEntries:null,pendingRef:null}}function Ie(e){Object.assign(e,Y())}function Le(e){return{ref:{enter(r){typeof r?.$ref=="string"&&(e.refsUsed.push(r.$ref),e.pendingRef=r.$ref)}},Schema:{enter(r,t){e.depth++,e.maxDepth=Math.max(e.maxDepth,e.depth);let o=0;for(let i of Ke)r[i]!==void 0&&(e.constraintCount++,o++);r.discriminator?.propertyName&&(e.hasDiscriminator=!0);let n={};for(let i of["oneOf","anyOf","allOf"]){let a=r[i];Array.isArray(a)&&(e.polymorphismCount+=a.length,i==="anyOf"&&(e.anyOfCount+=a.length),n[i]=a.length)}let s=[];if(L(r.properties)){let i=Object.entries(r.properties);e.totalSchemaProperties+=i.length;for(let[a,c]of i){s.push(a);let h=c&&"$ref"in c&&c.$ref?t.resolve(c)?.node??c:c;h?.description&&e.schemaPropertiesWithDescription++,(h?.example!==void 0||h?.examples)&&(e.hasPropertyExamples=!0),h?.readOnly||e.writableTopLevelFields++}}e.debugEntries!==null&&e.debugEntries.push({ref:e.pendingRef,depth:e.depth,propertyNames:s,polymorphism:Object.keys(n).length>0?n:{},constraintCount:o}),e.pendingRef=null},leave(){e.depth--}}}}function qe(e,r,t){return{operations:new Map,currentPath:"",pathLevelParams:[],current:null,walkSchema:e,anyOfPenaltyMultiplier:r,debugOperationId:t,debugLogs:[]}}function Je(e,r,t){return{path:e,method:r,operationId:t.operationId,operationDescriptionPresent:!!t.description,parameterCount:0,requiredParameterCount:0,paramsWithDescription:0,ambiguousIdentifierCount:0,maxRequestSchemaDepth:0,maxResponseSchemaDepth:0,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,topLevelWritableFieldCount:0,requestBodyPresent:!1,requestExamplePresent:!1,responseExamplePresent:!1,structuredErrorResponseCount:0,totalErrorResponses:0,inRequestBody:!1,inResponse:!1,currentResponseCode:"",errorStructuredCounted:!1,maxEffectivePolymorphism:-1,refsUsed:new Set}}function Ye(e){let{inRequestBody:r,inResponse:t,currentResponseCode:o,errorStructuredCounted:n,maxEffectivePolymorphism:s,...i}=e;return i}function We(e){return{RequestBody:{enter(){e.current&&(e.current.requestBodyPresent=!0,e.current.inRequestBody=!0)},leave(){e.current&&(e.current.inRequestBody=!1)}},Response:{enter(r,t){let o=e.current;if(!o)return;let n=String(t.key);o.inResponse=!0,o.currentResponseCode=n,o.errorStructuredCounted=!1,Te(n)&&(o.totalErrorResponses++,!r.content&&r.description&&(o.structuredErrorResponseCount++,o.errorStructuredCounted=!0))},leave(){e.current&&(e.current.inResponse=!1)}},MediaType:{enter(r){let t=e.current;if(t&&(Ze(r)&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inResponse&&Te(t.currentResponseCode)&&!t.errorStructuredCounted&&(t.structuredErrorResponseCount++,t.errorStructuredCounted=!0),r.schema)){let o=!!e.debugOperationId&&(t.operationId===e.debugOperationId||`${t.method.toUpperCase()} ${t.path}`===e.debugOperationId),n=e.walkSchema(r.schema,o);Qe(t,n)&&(t.totalSchemaProperties=n.totalSchemaProperties,t.schemaPropertiesWithDescription=n.schemaPropertiesWithDescription,t.constraintCount=n.constraintCount);let s=J(n.polymorphismCount,n.anyOfCount,e.anyOfPenaltyMultiplier);s>t.maxEffectivePolymorphism&&(t.maxEffectivePolymorphism=s,t.polymorphismCount=n.polymorphismCount,t.anyOfCount=n.anyOfCount),n.hasDiscriminator&&(t.hasDiscriminator=!0);for(let i of n.refsUsed)t.refsUsed.add(i);if(n.hasPropertyExamples&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inRequestBody&&(t.maxRequestSchemaDepth=Math.max(t.maxRequestSchemaDepth,n.maxDepth),t.topLevelWritableFieldCount=Math.max(t.topLevelWritableFieldCount,n.writableTopLevelFields)),t.inResponse&&(t.maxResponseSchemaDepth=Math.max(t.maxResponseSchemaDepth,n.maxDepth)),o&&n.debugEntries){let i=t.inRequestBody?"REQUEST BODY":`RESPONSE ${t.currentResponseCode}`;e.debugLogs.push({context:i,entries:n.debugEntries,totalProperties:n.totalSchemaProperties,totalPolymorphism:n.polymorphismCount,totalConstraints:n.constraintCount,maxDepth:n.maxDepth})}}}},Paths:{PathItem:{enter(r,t){e.currentPath=String(t.key),e.pathLevelParams=r.parameters??[]},Operation:{enter(r,t){let o=String(t.key),n=Je(e.currentPath,o,r);e.current=n;let s=Xe(e.pathLevelParams,r.parameters??[],t.resolve);for(let i of s.values())n.parameterCount++,i.required&&n.requiredParameterCount++,i.description&&n.paramsWithDescription++,et(i)&&n.ambiguousIdentifierCount++},leave(r){let t=e.current;if(!t)return;let o=r.operationId??`${t.method.toUpperCase()} ${t.path}`;e.operations.set(o,Ye(t)),e.current=null}}}}}}function Ue(e){return{operationCount:e.operations.size,operations:e.operations}}function Ae(e,r){return r(e).node}function Xe(e,r,t){let o=new Map;for(let n of e){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}for(let n of r){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}return o}function Ze(e){return e.example!==void 0||ie(e.examples)}function et(e){if(e.description)return!1;let r=(e.name??"").toLowerCase();return Oe.has(r)}function Te(e){if(e==="default"||/^4xx$/i.test(e)||/^5xx$/i.test(e))return!0;let r=parseInt(e,10);return r>=400&&r<600}function tt(e,r){if(!r.startsWith("#/"))return;let t=e;for(let o of r.slice(2).split("/"))t=t?.[ce(o)];return t}function ke({document:e,types:r,resolvedRefMap:t,ctx:o,debugOperationId:n,scoringConstants:s}){let i=s?.weights.anyOfPenaltyMultiplier??D.weights.anyOfPenaltyMultiplier,a=Y(),c=Le(a),h=Q([{severity:"warn",ruleId:"score-schema",visitor:c}],r),u=(l,m)=>{Ie(a),m&&(a.debugEntries=[]),K({document:{...e,parsed:l},rootType:r.Schema,normalizedVisitors:h,resolvedRefMap:t,ctx:o});let{depth:d,pendingRef:w,debugEntries:_,...N}=a;return{...N,refsUsed:[...a.refsUsed],debugEntries:m?a.debugEntries??void 0:void 0}},f=new Map,$=new WeakSet,O={maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[]};function y(l,m){return{maxDepth:Math.max(l.maxDepth,m.maxDepth),polymorphismCount:l.polymorphismCount+m.polymorphismCount,anyOfCount:l.anyOfCount+m.anyOfCount,hasDiscriminator:l.hasDiscriminator||m.hasDiscriminator,totalSchemaProperties:l.totalSchemaProperties+m.totalSchemaProperties,schemaPropertiesWithDescription:l.schemaPropertiesWithDescription+m.schemaPropertiesWithDescription,constraintCount:l.constraintCount+m.constraintCount,hasPropertyExamples:l.hasPropertyExamples||m.hasPropertyExamples,writableTopLevelFields:l.writableTopLevelFields+m.writableTopLevelFields,refsUsed:[...l.refsUsed,...m.refsUsed],debugEntries:l.debugEntries||m.debugEntries?[...l.debugEntries??[],...m.debugEntries??[]]:void 0}}let g=(l,m=!1)=>{let d=l,w=pe(l)?l.$ref:void 0;if(w){if(!m){let S=f.get(w);if(S)return S}d=tt(e.parsed,w)??l}if(L(d)&&$.has(d))return{...O};L(d)&&$.add(d);let _=d?.oneOf,N=d?.anyOf,Z=Array.isArray(_)&&_.length>1,ee=Array.isArray(N)&&N.length>1,G=Z||ee,te=Array.isArray(d?.allOf)&&d.allOf.length>0,V=d?.discriminator,q=!G&&L(V?.mapping)?Object.values(V.mapping).filter(S=>typeof S=="string"&&me(S)).map(S=>({$ref:S})):null,re=Array.isArray(q)&&q.length>0,C;if(G||te||re){let S={...d},F=null,oe=P=>{F=F?y(F,P):P},ne=(P,v)=>{let E=g(v[0],m);for(let z=1;z<v.length;z++){let se=g(v[z],m);se.totalSchemaProperties>E.totalSchemaProperties&&(E=se)}return{...E,polymorphismCount:E.polymorphismCount+v.length,anyOfCount:E.anyOfCount+(P==="anyOf"?v.length:0),hasDiscriminator:E.hasDiscriminator||!!V}};G&&delete S.discriminator,Z&&(delete S.oneOf,oe(ne("oneOf",_))),ee&&(delete S.anyOf,oe(ne("anyOf",N)));let H=null;if(re){delete S.discriminator;let P=g(q[0],m);for(let v=1;v<q.length;v++){let E=g(q[v],m);E.totalSchemaProperties>P.totalSchemaProperties&&(P=E)}H={...P,polymorphismCount:P.polymorphismCount+q.length,hasDiscriminator:!0}}let W=null;if(te){delete S.allOf,W={...O};for(let P of d.allOf)W=y(W,g(P,m));W.polymorphismCount+=d.allOf.length}C=u(S,m),W&&(C=y(C,W)),F&&(C=y(C,F)),H&&(C=y(C,H)),w&&(C={...C,refsUsed:[w,...C.refsUsed]})}else C=u(l,m);return L(d)&&$.delete(d),w&&!m&&f.set(w,C),C},M=qe(g,i,n),T=We(M),I=Q([{severity:"warn",ruleId:"score",visitor:T}],r);return K({document:e,rootType:r.Root,normalizedVisitors:I,resolvedRefMap:t,ctx:o}),{metrics:Ue(M),debugLogs:M.debugLogs}}function Ne(e){let r=new Map;for(let[n,s]of e)for(let i of s.refsUsed){let a=r.get(i);a||(a=new Set,r.set(i,a)),a.add(n)}let t=new Map;for(let n of e.keys())t.set(n,new Set);for(let n of r.values()){if(n.size<2)continue;let s=Array.from(n);for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++)t.get(s[i]).add(s[a]),t.get(s[a]).add(s[i])}let o=new Map;for(let n of e.keys()){let s=rt(n,t);o.set(n,s)}return o}function rt(e,r){let t=new Set([e]),o=[e],n=0;for(;o.length>0;){let s=[];for(let i of o)for(let a of r.get(i)??[])t.has(a)||(t.add(a),s.push(a));s.length>0&&n++,o=s}return n}function Fe(e){let r={agentReadiness:e.agentReadiness,discoverability:Math.round(e.discoverability*100),subscores:e.subscores,rawMetrics:{operationCount:e.rawMetrics.operationCount,operations:Object.fromEntries(Array.from(e.rawMetrics.operations.entries()).map(([t,o])=>{let{refsUsed:n,...s}=o;return[t,s]}))},operationScores:Object.fromEntries(e.operationScores),dependencyDepths:Object.fromEntries(e.dependencyDepths),hotspots:e.hotspots};k.output(JSON.stringify(r,null,2))}function je(e,r=!1){ot(e),nt(e),it(e),r&&at(e),pt(e)}function _e(e){return e>=80?de:e>=50?j:fe}function Be(e){return _e(e)(b(e.toFixed(1)))}function p(e){k.output(e+`
|
|
7
|
+
import{b as xe,f as Pe}from"./QMS4UKIK.js";import{S as le,T as he,W as b,Y as fe,Z as de,_ as j,aa as ye,ba as U,c as L,ca as A,f as ie,fa as k,ga as Se,ha as ge,ia as Q,ja as K,la as Ce,oa as be,p as ae,q as pe,r as ce,u as me,v as ue}from"./WBWCX3LS.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{performance as mt}from"perf_hooks";var D={thresholds:{maxParamsGood:5,maxDepthGood:4,maxPolymorphismGood:2,maxDependencyDepthGood:3,maxAmbiguousGood:0,maxOperationsForDiscoverability:1e3},weights:{parameterSimplicity:.1,schemaSimplicity:.1,documentationQuality:.18,constraintClarity:.12,exampleCoverage:.18,errorClarity:.12,dependencyClarity:.1,identifierClarity:.05,polymorphismClarity:.05,anyOfPenaltyMultiplier:2,discoverabilityWeight:.1},hotspotLimit:10},Oe=new Set(["id","name","type","value","data","key","status","state","code","result","item","object","resource","entity","input","output","payload","body","content","info"]);function B(e){if(e.length===0)return 0;let r=[...e].sort((o,n)=>o-n),t=Math.floor(r.length/2);return r.length%2!==0?r[t]:(r[t-1]+r[t])/2}function He(e,r,t=D){let{thresholds:o,weights:n}=t,s=x(1-e.parameterCount/(o.maxParamsGood*2)),a=Math.max(e.maxRequestSchemaDepth,e.maxResponseSchemaDepth)/(o.maxDepthGood*2),c=De(e,n.anyOfPenaltyMultiplier)/(o.maxPolymorphismGood*3),h=x(1-a-c),u=(e.operationDescriptionPresent?1:0)+e.paramsWithDescription+e.schemaPropertiesWithDescription,f=1+e.parameterCount+e.totalSchemaProperties,$=f>0?x(u/f):1,O=e.totalSchemaProperties>0?x(e.constraintCount/e.totalSchemaProperties):1,y=(e.requestExamplePresent?1:0)+(e.responseExamplePresent?1:0),g=(e.requestBodyPresent?1:0)+1,M=x(y/g),T=e.totalErrorResponses>0?x(e.structuredErrorResponseCount/e.totalErrorResponses):1,I=x(1-r/(o.maxDependencyDepthGood*2)),l=x(1-e.ambiguousIdentifierCount/Math.max(o.maxAmbiguousGood+3,1)),m=De(e,n.anyOfPenaltyMultiplier),d=m===0?1:e.hasDiscriminator?x(1-m/(o.maxPolymorphismGood*4)):x(1-m/(o.maxPolymorphismGood*2));return{parameterSimplicity:s,schemaSimplicity:h,documentationQuality:$,constraintClarity:O,exampleCoverage:M,errorClarity:T,dependencyClarity:I,identifierClarity:l,polymorphismClarity:d}}function ze(e,r=D){let t=r.weights,o=e.parameterSimplicity*t.parameterSimplicity+e.schemaSimplicity*t.schemaSimplicity+e.documentationQuality*t.documentationQuality+e.constraintClarity*t.constraintClarity+e.exampleCoverage*t.exampleCoverage+e.errorClarity*t.errorClarity+e.dependencyClarity*t.dependencyClarity+e.identifierClarity*t.identifierClarity+e.polymorphismClarity*t.polymorphismClarity;return $e(x(o)*100)}function Re(e,r,t=D){let o=new Map;for(let[n,s]of e.operations){let i=r.get(n)??0,a=He(s,i,t);o.set(n,{agentReadiness:ze(a,t),subscores:a})}return o}function Me(e,r=D){return x(1-e/r.thresholds.maxOperationsForDiscoverability)}function ve(e,r,t=D){if(e.size===0)return{agentReadiness:100};let o=[];for(let i of e.values())o.push(i.agentReadiness);let n=t.weights.discoverabilityWeight,s=r*100;return{agentReadiness:$e(B(o)*(1-n)+s*n)}}function J(e,r,t){return e-r+r*t}function De(e,r){return J(e.polymorphismCount,e.anyOfCount,r)}function x(e){return Math.max(0,Math.min(1,e))}function Ee(e){let r=e.size||1,t={parameterSimplicity:0,schemaSimplicity:0,documentationQuality:0,constraintClarity:0,exampleCoverage:0,errorClarity:0,dependencyClarity:0,identifierClarity:0,polymorphismClarity:0};for(let o of e.values())t.parameterSimplicity+=o.subscores.parameterSimplicity,t.schemaSimplicity+=o.subscores.schemaSimplicity,t.documentationQuality+=o.subscores.documentationQuality,t.constraintClarity+=o.subscores.constraintClarity,t.exampleCoverage+=o.subscores.exampleCoverage,t.errorClarity+=o.subscores.errorClarity,t.dependencyClarity+=o.subscores.dependencyClarity,t.identifierClarity+=o.subscores.identifierClarity,t.polymorphismClarity+=o.subscores.polymorphismClarity;return t.parameterSimplicity/=r,t.schemaSimplicity/=r,t.documentationQuality/=r,t.constraintClarity/=r,t.exampleCoverage/=r,t.errorClarity/=r,t.dependencyClarity/=r,t.identifierClarity/=r,t.polymorphismClarity/=r,t}function $e(e){return Math.round(e*10)/10}function we(e,r,t){let o=Math.max(1,e);return r/o+t/o}function Qe(e,r){return r.totalSchemaProperties>e.totalSchemaProperties?!0:r.totalSchemaProperties<e.totalSchemaProperties?!1:we(r.totalSchemaProperties,r.schemaPropertiesWithDescription,r.constraintCount)>we(e.totalSchemaProperties,e.schemaPropertiesWithDescription,e.constraintCount)}var Ke=["enum","const","format","pattern","minimum","maximum","minLength","maxLength","minItems","maxItems","minProperties","maxProperties","multipleOf","exclusiveMinimum","exclusiveMaximum","uniqueItems"];function Y(){return{depth:-1,maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[],debugEntries:null,pendingRef:null}}function Ie(e){Object.assign(e,Y())}function Le(e){return{ref:{enter(r){typeof r?.$ref=="string"&&(e.refsUsed.push(r.$ref),e.pendingRef=r.$ref)}},Schema:{enter(r,t){e.depth++,e.maxDepth=Math.max(e.maxDepth,e.depth);let o=0;for(let i of Ke)r[i]!==void 0&&(e.constraintCount++,o++);r.discriminator?.propertyName&&(e.hasDiscriminator=!0);let n={};for(let i of["oneOf","anyOf","allOf"]){let a=r[i];Array.isArray(a)&&(e.polymorphismCount+=a.length,i==="anyOf"&&(e.anyOfCount+=a.length),n[i]=a.length)}let s=[];if(L(r.properties)){let i=Object.entries(r.properties);e.totalSchemaProperties+=i.length;for(let[a,c]of i){s.push(a);let h=c&&"$ref"in c&&c.$ref?t.resolve(c)?.node??c:c;h?.description&&e.schemaPropertiesWithDescription++,(h?.example!==void 0||h?.examples)&&(e.hasPropertyExamples=!0),h?.readOnly||e.writableTopLevelFields++}}e.debugEntries!==null&&e.debugEntries.push({ref:e.pendingRef,depth:e.depth,propertyNames:s,polymorphism:Object.keys(n).length>0?n:{},constraintCount:o}),e.pendingRef=null},leave(){e.depth--}}}}function qe(e,r,t){return{operations:new Map,currentPath:"",pathLevelParams:[],current:null,walkSchema:e,anyOfPenaltyMultiplier:r,debugOperationId:t,debugLogs:[]}}function Je(e,r,t){return{path:e,method:r,operationId:t.operationId,operationDescriptionPresent:!!t.description,parameterCount:0,requiredParameterCount:0,paramsWithDescription:0,ambiguousIdentifierCount:0,maxRequestSchemaDepth:0,maxResponseSchemaDepth:0,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,topLevelWritableFieldCount:0,requestBodyPresent:!1,requestExamplePresent:!1,responseExamplePresent:!1,structuredErrorResponseCount:0,totalErrorResponses:0,inRequestBody:!1,inResponse:!1,currentResponseCode:"",errorStructuredCounted:!1,maxEffectivePolymorphism:-1,refsUsed:new Set}}function Ye(e){let{inRequestBody:r,inResponse:t,currentResponseCode:o,errorStructuredCounted:n,maxEffectivePolymorphism:s,...i}=e;return i}function We(e){return{RequestBody:{enter(){e.current&&(e.current.requestBodyPresent=!0,e.current.inRequestBody=!0)},leave(){e.current&&(e.current.inRequestBody=!1)}},Response:{enter(r,t){let o=e.current;if(!o)return;let n=String(t.key);o.inResponse=!0,o.currentResponseCode=n,o.errorStructuredCounted=!1,Te(n)&&(o.totalErrorResponses++,!r.content&&r.description&&(o.structuredErrorResponseCount++,o.errorStructuredCounted=!0))},leave(){e.current&&(e.current.inResponse=!1)}},MediaType:{enter(r){let t=e.current;if(t&&(Ze(r)&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inResponse&&Te(t.currentResponseCode)&&!t.errorStructuredCounted&&(t.structuredErrorResponseCount++,t.errorStructuredCounted=!0),r.schema)){let o=!!e.debugOperationId&&(t.operationId===e.debugOperationId||`${t.method.toUpperCase()} ${t.path}`===e.debugOperationId),n=e.walkSchema(r.schema,o);Qe(t,n)&&(t.totalSchemaProperties=n.totalSchemaProperties,t.schemaPropertiesWithDescription=n.schemaPropertiesWithDescription,t.constraintCount=n.constraintCount);let s=J(n.polymorphismCount,n.anyOfCount,e.anyOfPenaltyMultiplier);s>t.maxEffectivePolymorphism&&(t.maxEffectivePolymorphism=s,t.polymorphismCount=n.polymorphismCount,t.anyOfCount=n.anyOfCount),n.hasDiscriminator&&(t.hasDiscriminator=!0);for(let i of n.refsUsed)t.refsUsed.add(i);if(n.hasPropertyExamples&&(t.inRequestBody&&(t.requestExamplePresent=!0),t.inResponse&&(t.responseExamplePresent=!0)),t.inRequestBody&&(t.maxRequestSchemaDepth=Math.max(t.maxRequestSchemaDepth,n.maxDepth),t.topLevelWritableFieldCount=Math.max(t.topLevelWritableFieldCount,n.writableTopLevelFields)),t.inResponse&&(t.maxResponseSchemaDepth=Math.max(t.maxResponseSchemaDepth,n.maxDepth)),o&&n.debugEntries){let i=t.inRequestBody?"REQUEST BODY":`RESPONSE ${t.currentResponseCode}`;e.debugLogs.push({context:i,entries:n.debugEntries,totalProperties:n.totalSchemaProperties,totalPolymorphism:n.polymorphismCount,totalConstraints:n.constraintCount,maxDepth:n.maxDepth})}}}},Paths:{PathItem:{enter(r,t){e.currentPath=String(t.key),e.pathLevelParams=r.parameters??[]},Operation:{enter(r,t){let o=String(t.key),n=Je(e.currentPath,o,r);e.current=n;let s=Xe(e.pathLevelParams,r.parameters??[],t.resolve);for(let i of s.values())n.parameterCount++,i.required&&n.requiredParameterCount++,i.description&&n.paramsWithDescription++,et(i)&&n.ambiguousIdentifierCount++},leave(r){let t=e.current;if(!t)return;let o=r.operationId??`${t.method.toUpperCase()} ${t.path}`;e.operations.set(o,Ye(t)),e.current=null}}}}}}function Ue(e){return{operationCount:e.operations.size,operations:e.operations}}function Ae(e,r){return r(e).node}function Xe(e,r,t){let o=new Map;for(let n of e){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}for(let n of r){let s=Ae(n,t);s?.name&&s.in&&o.set(`${s.in}:${s.name}`,s)}return o}function Ze(e){return e.example!==void 0||ie(e.examples)}function et(e){if(e.description)return!1;let r=(e.name??"").toLowerCase();return Oe.has(r)}function Te(e){if(e==="default"||/^4xx$/i.test(e)||/^5xx$/i.test(e))return!0;let r=parseInt(e,10);return r>=400&&r<600}function tt(e,r){if(!r.startsWith("#/"))return;let t=e;for(let o of r.slice(2).split("/"))t=t?.[ce(o)];return t}function ke({document:e,types:r,resolvedRefMap:t,ctx:o,debugOperationId:n,scoringConstants:s}){let i=s?.weights.anyOfPenaltyMultiplier??D.weights.anyOfPenaltyMultiplier,a=Y(),c=Le(a),h=Q([{severity:"warn",ruleId:"score-schema",visitor:c}],r),u=(l,m)=>{Ie(a),m&&(a.debugEntries=[]),K({document:{...e,parsed:l},rootType:r.Schema,normalizedVisitors:h,resolvedRefMap:t,ctx:o});let{depth:d,pendingRef:w,debugEntries:_,...N}=a;return{...N,refsUsed:[...a.refsUsed],debugEntries:m?a.debugEntries??void 0:void 0}},f=new Map,$=new WeakSet,O={maxDepth:0,polymorphismCount:0,anyOfCount:0,hasDiscriminator:!1,totalSchemaProperties:0,schemaPropertiesWithDescription:0,constraintCount:0,hasPropertyExamples:!1,writableTopLevelFields:0,refsUsed:[]};function y(l,m){return{maxDepth:Math.max(l.maxDepth,m.maxDepth),polymorphismCount:l.polymorphismCount+m.polymorphismCount,anyOfCount:l.anyOfCount+m.anyOfCount,hasDiscriminator:l.hasDiscriminator||m.hasDiscriminator,totalSchemaProperties:l.totalSchemaProperties+m.totalSchemaProperties,schemaPropertiesWithDescription:l.schemaPropertiesWithDescription+m.schemaPropertiesWithDescription,constraintCount:l.constraintCount+m.constraintCount,hasPropertyExamples:l.hasPropertyExamples||m.hasPropertyExamples,writableTopLevelFields:l.writableTopLevelFields+m.writableTopLevelFields,refsUsed:[...l.refsUsed,...m.refsUsed],debugEntries:l.debugEntries||m.debugEntries?[...l.debugEntries??[],...m.debugEntries??[]]:void 0}}let g=(l,m=!1)=>{let d=l,w=pe(l)?l.$ref:void 0;if(w){if(!m){let S=f.get(w);if(S)return S}d=tt(e.parsed,w)??l}if(L(d)&&$.has(d))return{...O};L(d)&&$.add(d);let _=d?.oneOf,N=d?.anyOf,Z=Array.isArray(_)&&_.length>1,ee=Array.isArray(N)&&N.length>1,G=Z||ee,te=Array.isArray(d?.allOf)&&d.allOf.length>0,V=d?.discriminator,q=!G&&L(V?.mapping)?Object.values(V.mapping).filter(S=>typeof S=="string"&&me(S)).map(S=>({$ref:S})):null,re=Array.isArray(q)&&q.length>0,C;if(G||te||re){let S={...d},F=null,oe=P=>{F=F?y(F,P):P},ne=(P,v)=>{let E=g(v[0],m);for(let z=1;z<v.length;z++){let se=g(v[z],m);se.totalSchemaProperties>E.totalSchemaProperties&&(E=se)}return{...E,polymorphismCount:E.polymorphismCount+v.length,anyOfCount:E.anyOfCount+(P==="anyOf"?v.length:0),hasDiscriminator:E.hasDiscriminator||!!V}};G&&delete S.discriminator,Z&&(delete S.oneOf,oe(ne("oneOf",_))),ee&&(delete S.anyOf,oe(ne("anyOf",N)));let H=null;if(re){delete S.discriminator;let P=g(q[0],m);for(let v=1;v<q.length;v++){let E=g(q[v],m);E.totalSchemaProperties>P.totalSchemaProperties&&(P=E)}H={...P,polymorphismCount:P.polymorphismCount+q.length,hasDiscriminator:!0}}let W=null;if(te){delete S.allOf,W={...O};for(let P of d.allOf)W=y(W,g(P,m));W.polymorphismCount+=d.allOf.length}C=u(S,m),W&&(C=y(C,W)),F&&(C=y(C,F)),H&&(C=y(C,H)),w&&(C={...C,refsUsed:[w,...C.refsUsed]})}else C=u(l,m);return L(d)&&$.delete(d),w&&!m&&f.set(w,C),C},M=qe(g,i,n),T=We(M),I=Q([{severity:"warn",ruleId:"score",visitor:T}],r);return K({document:e,rootType:r.Root,normalizedVisitors:I,resolvedRefMap:t,ctx:o}),{metrics:Ue(M),debugLogs:M.debugLogs}}function Ne(e){let r=new Map;for(let[n,s]of e)for(let i of s.refsUsed){let a=r.get(i);a||(a=new Set,r.set(i,a)),a.add(n)}let t=new Map;for(let n of e.keys())t.set(n,new Set);for(let n of r.values()){if(n.size<2)continue;let s=Array.from(n);for(let i=0;i<s.length;i++)for(let a=i+1;a<s.length;a++)t.get(s[i]).add(s[a]),t.get(s[a]).add(s[i])}let o=new Map;for(let n of e.keys()){let s=rt(n,t);o.set(n,s)}return o}function rt(e,r){let t=new Set([e]),o=[e],n=0;for(;o.length>0;){let s=[];for(let i of o)for(let a of r.get(i)??[])t.has(a)||(t.add(a),s.push(a));s.length>0&&n++,o=s}return n}function Fe(e){let r={agentReadiness:e.agentReadiness,discoverability:Math.round(e.discoverability*100),subscores:e.subscores,rawMetrics:{operationCount:e.rawMetrics.operationCount,operations:Object.fromEntries(Array.from(e.rawMetrics.operations.entries()).map(([t,o])=>{let{refsUsed:n,...s}=o;return[t,s]}))},operationScores:Object.fromEntries(e.operationScores),dependencyDepths:Object.fromEntries(e.dependencyDepths),hotspots:e.hotspots};k.output(JSON.stringify(r,null,2))}function je(e,r=!1){ot(e),nt(e),it(e),r&&at(e),pt(e)}function _e(e){return e>=80?de:e>=50?j:fe}function Be(e){return _e(e)(b(e.toFixed(1)))}function p(e){k.output(e+`
|
|
8
8
|
`)}function ot(e){p(""),p(b(A(" Scores"))),p(""),p(` Agent Readiness: ${Be(e.agentReadiness)}/100`),p("")}function nt(e){p(b(A(" Subscores"))),p("");let r=e.subscores;R("Parameter Simplicity",r.parameterSimplicity),R("Schema Simplicity",r.schemaSimplicity),R("Documentation Quality",r.documentationQuality),R("Constraint Clarity",r.constraintClarity),R("Example Coverage",r.exampleCoverage),R("Error Clarity",r.errorClarity),R("Dependency Clarity",r.dependencyClarity),R("Identifier Clarity",r.identifierClarity),R("Polymorphism Clarity",r.polymorphismClarity),R("Discoverability",e.discoverability),p("")}function R(e,r){let t=Math.round(r*100),o=st(r);p(` ${e.padEnd(24)} ${o} ${_e(t)(t+"%")}`)}function st(e){let t=Math.round(e*20);return U("["+"\u2588".repeat(t)+"\u2591".repeat(20-t)+"]")}function it(e){if(p(b(A(" Raw Metrics Summary"))),p(""),p(` Total operations: ${e.rawMetrics.operationCount}`),e.rawMetrics.operationCount===0){p("");return}let r=[],t=[],o=[],n=[],s=0,i=0,a=0;for(let u of e.rawMetrics.operations.values())r.push(u.parameterCount),t.push(Math.max(u.maxRequestSchemaDepth,u.maxResponseSchemaDepth)),o.push(u.polymorphismCount),n.push(u.totalSchemaProperties),u.requestExamplePresent&&s++,u.responseExamplePresent&&i++,u.operationDescriptionPresent&&a++;let c=e.rawMetrics.operationCount;function h(u,f){let O=(f.reduce((T,I)=>T+I,0)/c).toFixed(1),y=B(f).toFixed(1),g=Math.min(...f),M=Math.max(...f);p(` ${u.padEnd(26)} avg ${O.padStart(6)} median ${y.padStart(6)} min ${String(g).padStart(5)} max ${String(M).padStart(5)}`)}h("Parameters/operation:",r),h("Schema depth:",t),h("Polymorphism/operation:",o),h("Properties/operation:",n),p(` Operations with request examples: ${s}/${c} (${X(s,c)})`),p(` Operations with response examples: ${i}/${c} (${X(i,c)})`),p(` Operations with description: ${a}/${c} (${X(a,c)})`),p("")}function X(e,r){return r>0?`${Math.round(e/r*100)}%`:"N/A"}function at(e){p(b(A(" Per-Operation Metrics"))),p("");let r=" "+"Operation".padEnd(50)+"Props".padStart(7)+"Poly".padStart(7)+"Depth".padStart(7)+"Params".padStart(8)+"Constr".padStart(8);p(U(r)),p(U(" "+"\u2500".repeat(r.length-2)));let t=[...e.rawMetrics.operations.entries()].sort(([,o],[,n])=>n.totalSchemaProperties-o.totalSchemaProperties);for(let[,o]of t){let n=(o.operationId??`${o.method.toUpperCase()} ${o.path}`).slice(0,48),s=Math.max(o.maxRequestSchemaDepth,o.maxResponseSchemaDepth),i=" "+n.padEnd(50)+String(o.totalSchemaProperties).padStart(7)+String(o.polymorphismCount).padStart(7)+String(s).padStart(7)+String(o.parameterCount).padStart(8)+String(o.constraintCount).padStart(8);p(i)}p("")}function Ge(e,r){if(p(""),p(b(A(` Debug: ${e} schema breakdown`))),p(""),r.length===0){p(j(` No schemas found for operation "${e}".`)),p(j(' Make sure the value matches an operationId or "METHOD /path" exactly.')),p("");return}for(let t of r){p(b(U(` ${t.context}`))),p(U(" "+"\u2500".repeat(70)));let o=new Map;for(let s of t.entries){let i=s.ref??`(inline depth ${s.depth})`,a=o.get(i);if(a){a.count++,a.totalProps+=s.propertyNames.length;for(let c of s.propertyNames)a.propNames.includes(c)||a.propNames.push(c)}else o.set(i,{count:1,totalProps:s.propertyNames.length,propNames:[...s.propertyNames]})}for(let s of t.entries){let i=s.ref??"(inline)",a=" ".repeat(Math.min(s.depth,6)),c=s.propertyNames.length,h=` ${a}${i}`;c>0&&(h+=` (${c} properties)`);let u=[];if(s.polymorphism.oneOf&&u.push(`oneOf:${s.polymorphism.oneOf}`),s.polymorphism.anyOf&&u.push(`anyOf:${s.polymorphism.anyOf}`),s.polymorphism.allOf&&u.push(`allOf:${s.polymorphism.allOf}`),u.length>0&&(h+=` [${u.join(", ")}]`),s.constraintCount>0&&(h+=` {${s.constraintCount} constraints}`),p(h),c>0&&c<=20)p(` ${a} properties: ${s.propertyNames.join(", ")}`);else if(c>20){let f=s.propertyNames.slice(0,15).join(", ");p(` ${a} properties: ${f}, ... +${c-15} more`)}}p(""),p(` Totals: ${t.totalProperties} properties, ${t.totalPolymorphism} polymorphism items, ${t.totalConstraints} constraints, max depth ${t.maxDepth}`);let n=[...o.entries()].filter(([,s])=>s.totalProps>0).sort(([,s],[,i])=>i.totalProps-s.totalProps).slice(0,10);if(n.length>0){p(""),p(b(" Top schemas by property count:"));for(let[s,i]of n)p(` ${s}: ${i.totalProps} properties`)}p("")}}function pt(e){if(e.hotspots.length===0){p(b(A(" No hotspot operations found."))),p("");return}p(b(A(` Top ${e.hotspots.length} Hotspot Operations`))),p("");for(let r of e.hotspots){let t=r.operationId?`${r.method.toUpperCase()} ${r.path} (${r.operationId})`:`${r.method.toUpperCase()} ${r.path}`;p(b(` ${t}`)),p(` Agent Readiness: ${Be(r.agentReadinessScore)}`);for(let o of r.reasons)p(j(` - ${o}`));p("")}}function Ve(e,r,t,o=D){let n=[];for(let[s,i]of r){let a=e.operations.get(s);if(!a)continue;let c=ct(a,t.get(s)??0,o);c.length!==0&&n.push({path:a.path,method:a.method,operationId:a.operationId,agentReadinessScore:i.agentReadiness,reasons:c})}return n.sort((s,i)=>s.reasons.length!==i.reasons.length?i.reasons.length-s.reasons.length:s.agentReadinessScore-i.agentReadinessScore),n.slice(0,o.hotspotLimit)}function ct(e,r,t){let{thresholds:o}=t,n=[];e.parameterCount>o.maxParamsGood&&n.push(`High parameter count (${e.parameterCount})`);let s=Math.max(e.maxRequestSchemaDepth,e.maxResponseSchemaDepth);s>o.maxDepthGood&&n.push(`Deep schema nesting (depth ${s})`),e.anyOfCount>0&&!e.hasDiscriminator?n.push(`Polymorphism (anyOf) without discriminator (${e.anyOfCount} anyOf)`):e.polymorphismCount>o.maxPolymorphismGood&&n.push(`High polymorphism count (${e.polymorphismCount})`);let i=e.requestBodyPresent&&!e.requestExamplePresent,a=!e.responseExamplePresent;return i&&a?n.push("Missing request and response examples"):i?n.push("Missing request body examples"):a&&n.push("Missing response examples"),e.totalErrorResponses>0&&e.structuredErrorResponseCount===0&&n.push("No structured error responses (4xx/5xx)"),e.operationDescriptionPresent||n.push("Missing operation description"),e.parameterCount>0&&e.paramsWithDescription===0&&n.push("No parameter descriptions"),r>o.maxDependencyDepthGood&&n.push(`High dependency depth (${r})`),e.ambiguousIdentifierCount>o.maxAmbiguousGood&&n.push(`Ambiguous identifiers (${e.ambiguousIdentifierCount})`),n}async function Vt({argv:e,config:r,collectSpecData:t}){let[{path:o}]=await xe(e.api?[e.api]:[],r),n=new le(r.resolve),{bundle:s}=await be({config:r,ref:o});t?.(s);let i=ge(s.parsed);if(Se(i)!=="oas3")throw new Ce(`The score command currently supports only OpenAPI 3.x. Detected: ${i}`);let a=mt.now(),c=ae(r.extendTypes(ue(i),i),r),h=await he({rootDocument:s,rootType:c.Root,externalRefResolver:n}),u=e["debug-operation-id"],{metrics:f,debugLogs:$}=ke({document:s,types:c,resolvedRefMap:h,ctx:{problems:[],specVersion:i,config:r,visitorsData:{}},debugOperationId:u}),O=Ne(f.operations),y=Re(f,O),g=Me(f.operationCount),{agentReadiness:M}=ve(y,g),T=Ve(f,y,O),I={agentReadiness:M,discoverability:g,subscores:Ee(y),rawMetrics:f,hotspots:T,operationScores:y,dependencyDepths:O};ut(I,o,a,e.format,!!e["operation-details"],u?{operationId:u,logs:$}:void 0)}function ut(e,r,t,o,n,s){k.info(`Document: ${ye(r)} score:
|
|
9
9
|
`),o==="json"?Fe(e):je(e,n),s&&Ge(s.operationId,s.logs),Pe("score",t,r)}export{Vt as handleScore};
|