@redocly/cli 2.63.0 → 2.64.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/THIRD_PARTY_NOTICES +1 -1
- package/lib/chunks/{AAPHKNGA.js → 23FVFXSV.js} +1 -1
- package/lib/chunks/{C2OCU4E3.js → 2N5733QR.js} +1 -1
- package/lib/chunks/{LXSCIQFU.js → 2XSAJEYO.js} +1 -1
- package/lib/chunks/{J373CXCH.js → 33LAXFAC.js} +1 -1
- package/lib/chunks/{BS3AUVYD.js → 3BFBASRW.js} +1 -1
- package/lib/chunks/{FCZH3476.js → 3JJ7NFAQ.js} +1 -1
- package/lib/chunks/{QNCKZURN.js → 3TWUZE25.js} +1 -1
- package/lib/chunks/{2G2Q42ND.js → 47H5P7DF.js} +1 -1
- package/lib/chunks/{I3M476SQ.js → 4BWADBBP.js} +1 -1
- package/lib/chunks/{24AVTWC7.js → 4K73EOV3.js} +1 -1
- package/lib/chunks/{OYUXHAGQ.js → 4S35DNJF.js} +1 -1
- package/lib/chunks/{Y4UTXOI2.js → 4XKO52KS.js} +1 -1
- package/lib/chunks/{4JKMQCWY.js → 5BB2E772.js} +1 -1
- package/lib/chunks/{IODGA6FG.js → 5KWYBSEY.js} +1 -1
- package/lib/chunks/{JHK6XIMG.js → 6D6SERR2.js} +1 -1
- package/lib/chunks/{SXIFTBZB.js → 6TFC2OYQ.js} +1 -1
- package/lib/chunks/{YKST56C6.js → 7BZGNWGO.js} +1 -1
- package/lib/chunks/{7RQW6KPZ.js → AC25ILS5.js} +224 -115
- package/lib/chunks/{NERCHMVY.js → AQ5W4E54.js} +1 -1
- package/lib/chunks/{HW7ZCN7J.js → AVOA7IGA.js} +1 -1
- package/lib/chunks/{VSBSD3XZ.js → B6HQPQVF.js} +1 -1
- package/lib/chunks/{X2V5QOZP.js → BWA2MZEG.js} +1 -1
- package/lib/chunks/{L2EBKZQZ.js → C462YNOX.js} +1 -1
- package/lib/chunks/{6LEQ46KS.js → C6QQGZXT.js} +1 -1
- package/lib/chunks/{CQMZF72H.js → CBJ23L7Q.js} +1 -1
- package/lib/chunks/{BC3XCWQE.js → DZLV4HEX.js} +1 -1
- package/lib/chunks/{4C44BO5N.js → EIGOI65B.js} +1 -1
- package/lib/chunks/{Z52TEGV5.js → FGKVDZSD.js} +1 -1
- package/lib/chunks/{6QRNEF7K.js → FRHR2DRO.js} +1 -1
- package/lib/chunks/{NR3R4HFM.js → HAOBCQWB.js} +313 -1
- package/lib/chunks/{A22GELRX.js → HNEOPZAP.js} +1 -1
- package/lib/chunks/{OFJ2KV5N.js → HQSXMF3M.js} +1 -1
- package/lib/chunks/{AU7VOB4V.js → HYTOV6S5.js} +1 -1
- package/lib/chunks/{PHWKGYUT.js → IJJGUPFL.js} +1 -1
- package/lib/chunks/{5IIJHGNO.js → IPZEPCLP.js} +1 -1
- package/lib/chunks/{7AWM5GPD.js → J4MBQ4RQ.js} +1 -1
- package/lib/chunks/{Q4UGLPO2.js → JUZHXP62.js} +1 -1
- package/lib/chunks/{U52CY34I.js → KIY6ZQFM.js} +1 -1
- package/lib/chunks/{5VDBZVBF.js → KXCAMRHJ.js} +1 -1
- package/lib/chunks/{IYKYAJDC.js → LDFG6R4G.js} +1 -1
- package/lib/chunks/{ZK27F53P.js → N7JGYQGR.js} +1 -1
- package/lib/chunks/{Z7J6WWCO.js → OB24ZAXJ.js} +1 -1
- package/lib/chunks/{TCALQAX5.js → OD47UYXG.js} +1 -1
- package/lib/chunks/{ITUUIAOZ.js → PV7QRLRM.js} +1 -1
- package/lib/chunks/Q2CLTRW6.js +69 -0
- package/lib/chunks/{JGBWIR5U.js → QQ3NOFPI.js} +1 -1
- package/lib/chunks/{RFGNVCAR.js → QV24OXH3.js} +2 -2
- package/lib/chunks/{DQFNUDOT.js → S242M5IF.js} +1 -1
- package/lib/chunks/{VB4PNWOR.js → S4LDFBGV.js} +1 -1
- package/lib/chunks/{6AB3BDX4.js → SAQECLWB.js} +1 -1
- package/lib/chunks/{Z5QYTPVY.js → SCB6ZITR.js} +1 -1
- package/lib/chunks/{NCBLLIQ3.js → SDQYWQUI.js} +2 -2
- package/lib/chunks/{KMP5ZE2D.js → SEKSITHZ.js} +1 -1
- package/lib/chunks/{7LNKXEIU.js → SF5X7PGJ.js} +1 -1
- package/lib/chunks/{XNNK5G6V.js → SMBH5JAE.js} +1 -1
- package/lib/chunks/{WV2NAII3.js → T7ZIDP7J.js} +1 -1
- package/lib/chunks/{B4ONRSDG.js → TYTWIWRT.js} +3 -3
- package/lib/chunks/{DEXQ6S3P.js → U2GUGMK3.js} +35 -35
- package/lib/chunks/{3LGZAJES.js → UE7IAPIP.js} +1 -1
- package/lib/chunks/{BFIZTFWS.js → UOPNHN3X.js} +1 -1
- package/lib/chunks/{YXH72HCU.js → UQLM53UV.js} +1 -1
- package/lib/chunks/{HTG3RKCV.js → V4EDWQZH.js} +1 -1
- package/lib/chunks/{ACMV5RZA.js → VAPFU7OM.js} +101 -101
- package/lib/chunks/{J7J4PH3V.js → W2RELNUN.js} +1 -1
- package/lib/chunks/{CTPVBOG5.js → WDTMN7JE.js} +1 -1
- package/lib/chunks/{E2D25T4G.js → XDXN5CNA.js} +3 -2
- package/lib/chunks/{6WESXERF.js → XIQZ6CQT.js} +1 -1
- package/lib/chunks/{ZP54RCIQ.js → YDPANNWI.js} +1 -1
- package/lib/chunks/{CVUPOCX4.js → ZB7MWGMD.js} +1 -1
- package/lib/chunks/{LLWU7A5G.js → ZCLACSBJ.js} +1 -1
- package/lib/chunks/{3SFDVGEQ.js → ZGBAOCP4.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 +29 -3
- package/lib/eject-assets/generators/typescript/inline-runtime.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-signature.ts +1 -1
- package/lib/eject-assets/generators/typescript/operation-types.ts +1 -1
- package/lib/eject-assets/generators/typescript/operations.ts +1 -1
- package/lib/eject-assets/generators/typescript/response-headers.ts +1 -1
- package/lib/eject-assets/generators/typescript/type-guards.ts +1 -1
- package/lib/eject-assets/generators/typescript/types.ts +1 -1
- package/lib/eject-assets/generators/zod/index.ts +2 -2
- package/lib/eject-assets/generators/zod/schemas.ts +1 -1
- package/lib/eject-assets/skills/typescript-generator/SKILL.md +19 -0
- package/lib/index.js +5 -5
- package/package.json +1 -1
- package/lib/chunks/FRM6TZ42.js +0 -67
|
@@ -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{c as x,ia as R}from"./
|
|
8
|
-
- `));return o}function b(e,n,o,r,a){let s=`Pagination for operation "${e.name}" (${r})`,c=q(o);if(c!==void 0)return{error:`${s}: ${c}`};let t=o,i=d=>a?{error:`${s}: ${d}`}:{};if(e.sse!==void 0)return i("the operation is a Server-Sent Events stream");if(t.style!=="link"&&t.style!=="body-link"){let d=t.style==="cursor"?"cursorParam":"offsetParam",l=t.style==="cursor"?t.cursorParam:t.offsetParam,k=e.queryParams.find(u=>u.name===l);if(!k){let u=e.queryParams.map(
|
|
7
|
+
import{c as x,ia as R}from"./VAPFU7OM.js";import{m}from"./UW4UC7ZI.js";function C(e){return e.flatMap(n=>n.operations)}function P(e,n,o){let r=e.specName??e.name;if(o?.exclude?.includes(r))return{};let a=o?.operations?.[r];if(a!==void 0)return b(e,n,a,`pagination.operations["${r}"]`,!0);if(e.paginationExtension!==void 0)return b(e,n,e.paginationExtension,"x-redoclyPagination",!0);if(o?.style!==void 0){let{exclude:s,operations:c,...t}=o;return b(e,n,t,"pagination convention",!1)}return{}}function H(e,n){let o=new Map,r=[];for(let a of C(e.services)){let s=P(a,e,n);s.error!==void 0?r.push(s.error):s.spec!==void 0&&o.set(a.name,{spec:s.spec,itemSchema:s.itemSchema})}if(r.length>0)throw new Error(["Invalid pagination configuration:",...r].join(`
|
|
8
|
+
- `));return o}function b(e,n,o,r,a){let s=`Pagination for operation "${e.name}" (${r})`,c=q(o);if(c!==void 0)return{error:`${s}: ${c}`};let t=o,i=d=>a?{error:`${s}: ${d}`}:{};if(e.sse!==void 0)return i("the operation is a Server-Sent Events stream");if(t.style!=="link"&&t.style!=="body-link"){let d=t.style==="cursor"?"cursorParam":"offsetParam",l=t.style==="cursor"?t.cursorParam:t.offsetParam,k=e.queryParams.find(u=>u.name===l);if(!k){let u=e.queryParams.map(T=>T.name).join(", ");return i(`query parameter "${l}" is not declared on the operation`+(u===""?"":` (declared: ${u})`))}let p=O(k.schema,n);if(!(p!==void 0&&(t.style==="cursor"?y(p,n):p.kind==="scalar"&&(p.scalar==="number"||p.scalar==="integer")))){let u=t.style==="cursor"?"a string":"a number";return i(`the "${d}" query parameter "${l}" must accept ${u} (got ${I(p)})`)}}let g=e.successResponses.find(d=>d.contentType.toLowerCase().includes("json"));if(!g)return i("the operation has no JSON success response");if(t.style==="link"){let d=e.successResponseHeaders?.some(l=>l.name==="link")===!0;if(!d&&!a)return{};d||R.warn(`generate-client: ${s.toLowerCase()} follows the Link header, but the success response does not document one.
|
|
9
9
|
`)}let h=m(g.schema,t.items,n);if(h===void 0)return i(`the "items" pointer "${t.items}" does not resolve in the success response schema`);if(h.kind!=="array")return i(`the "items" pointer "${t.items}" must point at an array (got ${h.kind})`);if(t.style==="body-link"){let d=m(g.schema,t.nextLink,n);if(d===void 0)return i(`the "nextLink" pointer "${t.nextLink}" does not resolve in the success response schema`);if(!y(d,n))return i(`the "nextLink" pointer "${t.nextLink}" must point at a string (got ${d.kind})`)}if(t.style==="cursor"){let d=m(g.schema,t.nextCursor,n);if(d===void 0)return i(`the "nextCursor" pointer "${t.nextCursor}" does not resolve in the success response schema`);if(!y(d,n))return i(`the "nextCursor" pointer "${t.nextCursor}" must point at a string (got ${d.kind})`);if(t.hasMore!==void 0){let l=m(g.schema,t.hasMore,n);if(l===void 0)return i(`the "hasMore" pointer "${t.hasMore}" does not resolve in the success response schema`);if(l.kind!=="scalar"||l.scalar!=="boolean")return i(`the "hasMore" pointer "${t.hasMore}" must point at a boolean (got ${l.kind})`)}}let f=t.limitParam!==void 0?{limitParam:t.limitParam}:{};return{spec:t.style==="cursor"?{style:"cursor",param:t.cursorParam,...f,nextCursor:t.nextCursor,...t.hasMore!==void 0?{hasMore:t.hasMore}:{},items:t.items}:t.style==="link"?{style:"link",...f,items:t.items}:t.style==="body-link"?{style:"body-link",...f,nextLink:t.nextLink,items:t.items}:{style:t.style,param:t.offsetParam,...f,items:t.items},itemSchema:h.items}}function q(e){if(!x(e))return"the rule must be an object";let{style:n,cursorParam:o,nextCursor:r,hasMore:a,offsetParam:s,nextLink:c,limitParam:t,items:i}=e;if(n!=="cursor"&&n!=="offset"&&n!=="page"&&n!=="link"&&n!=="body-link")return`"style" must be one of "cursor" | "offset" | "page" | "link" | "body-link" (got ${JSON.stringify(n)})`;if(typeof i!="string"||i!==""&&!i.startsWith("/"))return'"items" must be a JSON pointer starting with "/" (or "" when the response body is the item array itself)';if(n==="cursor"){if(typeof o!="string"||o==="")return'cursor style requires a "cursorParam" query parameter name';if(typeof r!="string"||!r.startsWith("/"))return'cursor style requires a "nextCursor" JSON pointer starting with "/"';if(a!==void 0&&(typeof a!="string"||!a.startsWith("/")))return'"hasMore" must be a JSON pointer starting with "/"'}else if(n==="offset"||n==="page"){if(typeof s!="string"||s==="")return`${n} style requires an "offsetParam" query parameter name`}else if(n==="body-link"&&(typeof c!="string"||!c.startsWith("/")))return'body-link style requires a "nextLink" JSON pointer starting with "/"';if(t!==void 0&&typeof t!="string")return'"limitParam" must be a query parameter name'}function I(e){return e===void 0?"an unresolvable ref":e.kind==="scalar"||e.kind==="enum"?e.scalar:e.kind}function O(e,n){let o=new Set,r=e;for(;r.kind==="ref";){let{name:a}=r;if(o.has(a))return;o.add(a);let s=n.schemas.find(c=>c.name===a);if(s===void 0)return;r=s.schema}return r}function y(e,n){return e.kind==="scalar"||e.kind==="enum"?e.scalar==="string":e.kind==="literal"?typeof e.value=="string":e.kind==="union"?e.members.every(o=>{let r=O(o,n);return r!==void 0&&(r.kind==="null"||r.kind!=="union"&&y(r,n))}):!1}var G={"types.ts":`/**
|
|
10
10
|
* The public type surface of the client runtime \u2014 \`@redocly/client-generator\`'s
|
|
11
11
|
* app-facing runtime module. Pure types, no runtime code (excluded from coverage).
|
|
@@ -184,7 +184,14 @@ export type ApiErrorLike = globalThis.Error & {
|
|
|
184
184
|
body: unknown;
|
|
185
185
|
};
|
|
186
186
|
|
|
187
|
-
|
|
187
|
+
export type SettledCall = {
|
|
188
|
+
response?: Response;
|
|
189
|
+
error?: unknown;
|
|
190
|
+
attempts: number;
|
|
191
|
+
durationMs: number;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
/** One interceptor: any subset of the four hooks. */
|
|
188
195
|
export type Middleware<Op extends OperationContext = OperationContext> = {
|
|
189
196
|
onRequest?: (ctx: RequestContext<Op>) => void | Promise<void>;
|
|
190
197
|
onResponse?: (
|
|
@@ -197,6 +204,7 @@ export type Middleware<Op extends OperationContext = OperationContext> = {
|
|
|
197
204
|
error: ApiErrorLike,
|
|
198
205
|
ctx: RequestContext<Op>
|
|
199
206
|
) => globalThis.Error | Promise<globalThis.Error>;
|
|
207
|
+
onSettled?: (ctx: RequestContext<Op>, call: SettledCall) => void | Promise<void>;
|
|
200
208
|
};
|
|
201
209
|
|
|
202
210
|
/** Client configuration: transport, defaults, retry policy, middleware, and credentials. */
|
|
@@ -783,6 +791,7 @@ import type {
|
|
|
783
791
|
RequestContext,
|
|
784
792
|
RequestOptions,
|
|
785
793
|
RetryConfig,
|
|
794
|
+
SettledCall,
|
|
786
795
|
} from './types.js';
|
|
787
796
|
|
|
788
797
|
/**
|
|
@@ -865,7 +874,8 @@ function anySignal(signals: AbortSignal[]): AbortSignal {
|
|
|
865
874
|
* serialization (JSON, or FormData via the multipart capability; a stream passes
|
|
866
875
|
* through in one attempt), the retry loop
|
|
867
876
|
* (idempotent-only defaults, \`Retry-After\`, abandoned-body drain), and the reverse
|
|
868
|
-
* \`onResponse\` onion
|
|
877
|
+
* \`onResponse\` onion, then the \`onSettled\` chain once with the final outcome. Returns the
|
|
878
|
+
* final response plus the request context.
|
|
869
879
|
*/
|
|
870
880
|
export async function send(
|
|
871
881
|
config: ClientConfig,
|
|
@@ -973,72 +983,117 @@ export async function send(
|
|
|
973
983
|
const retryOn = retry.retryOn ?? defaultRetryOn;
|
|
974
984
|
const signal = fetchInit.signal ?? undefined;
|
|
975
985
|
|
|
986
|
+
const startedAt = Date.now();
|
|
976
987
|
let attempt = 0;
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
988
|
+
let finalResponse: Response;
|
|
989
|
+
let lastResponse: Response | undefined;
|
|
990
|
+
try {
|
|
991
|
+
while (true) {
|
|
992
|
+
if (signal?.aborted) throw abortError(signal);
|
|
993
|
+
attempt++;
|
|
994
|
+
// A fresh timeout budget per attempt; the caller's signal still wins the race.
|
|
995
|
+
// The composed signal also governs reading the response body.
|
|
996
|
+
const budget = timeout ? timeoutSignal(timeout) : undefined;
|
|
997
|
+
const attemptSignal = budget && signal ? anySignal([signal, budget]) : (budget ?? signal);
|
|
998
|
+
let response: Response;
|
|
999
|
+
try {
|
|
1000
|
+
response = await doFetch(context.url, {
|
|
1001
|
+
...fetchInit,
|
|
1002
|
+
// \`fetch\` requires it for a stream body.
|
|
1003
|
+
...(isStream ? { duplex: 'half' } : {}),
|
|
1004
|
+
signal: attemptSignal,
|
|
1005
|
+
method: context.method,
|
|
1006
|
+
headers: context.headers,
|
|
1007
|
+
body: payload,
|
|
1008
|
+
});
|
|
1009
|
+
} catch (error) {
|
|
1010
|
+
// Decided before any await, when no timer can have fired since \`fetch\` rejected: an
|
|
1011
|
+
// aborted budget means this attempt timed out. The abort reason's name is no
|
|
1012
|
+
// evidence, because Chrome 103 to 123 abort a timeout with \`AbortError\`.
|
|
1013
|
+
const timedOut = timeout !== undefined && budget?.aborted && !signal?.aborted;
|
|
1014
|
+
if (
|
|
1015
|
+
attempt < maxAttempts &&
|
|
1016
|
+
!signal?.aborted &&
|
|
1017
|
+
(await retryOn({ attempt, request: context, error }))
|
|
1018
|
+
) {
|
|
1019
|
+
await sleep(retryDelay(retry, attempt, null), signal);
|
|
1020
|
+
continue;
|
|
1021
|
+
}
|
|
1022
|
+
// Our timeout fired (never the caller's own abort \u2014 that rethrows untouched):
|
|
1023
|
+
// wrap the bare DOMException with the context a log line needs.
|
|
1024
|
+
if (timedOut) throw new TimeoutError(op.id, timeout, attempt);
|
|
1025
|
+
throw error;
|
|
1026
|
+
}
|
|
1027
|
+
lastResponse = response;
|
|
1028
|
+
// Reverse order: the last-registered middleware wraps closest to the network (onion).
|
|
1029
|
+
for (let i = middleware.length - 1; i >= 0; i--) {
|
|
1030
|
+
const onResponse = middleware[i].onResponse;
|
|
1031
|
+
if (onResponse) {
|
|
1032
|
+
const replaced = await onResponse(response, context);
|
|
1033
|
+
if (replaced && replaced !== response) {
|
|
1034
|
+
// Cancel the abandoned original's body \u2014 like the retry path, an unread body
|
|
1035
|
+
// keeps its connection checked out under Node/undici.
|
|
1036
|
+
await response.body?.cancel().catch(() => undefined);
|
|
1037
|
+
response = replaced;
|
|
1038
|
+
lastResponse = replaced;
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
}
|
|
1000
1042
|
if (
|
|
1043
|
+
!response.ok &&
|
|
1001
1044
|
attempt < maxAttempts &&
|
|
1002
1045
|
!signal?.aborted &&
|
|
1003
|
-
(await retryOn({ attempt, request: context,
|
|
1046
|
+
(await retryOn({ attempt, request: context, response }))
|
|
1004
1047
|
) {
|
|
1005
|
-
|
|
1048
|
+
const retryAfter = response.headers.get('retry-after');
|
|
1049
|
+
// Drain the abandoned response body before the next attempt: an unread body
|
|
1050
|
+
// keeps the connection checked out (and can stall the pool) under Node/undici
|
|
1051
|
+
// and other strict HTTP clients. Ignore errors (e.g. a middleware already read it).
|
|
1052
|
+
await response.body?.cancel().catch(() => undefined);
|
|
1053
|
+
lastResponse = undefined;
|
|
1054
|
+
await sleep(retryDelay(retry, attempt, retryAfter), signal);
|
|
1006
1055
|
continue;
|
|
1007
1056
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
if (timedOut) throw new TimeoutError(op.id, timeout, attempt);
|
|
1011
|
-
throw error;
|
|
1057
|
+
finalResponse = response;
|
|
1058
|
+
break;
|
|
1012
1059
|
}
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1060
|
+
} catch (error) {
|
|
1061
|
+
const settled: SettledCall = {
|
|
1062
|
+
response: lastResponse,
|
|
1063
|
+
error,
|
|
1064
|
+
attempts: attempt,
|
|
1065
|
+
durationMs: Date.now() - startedAt,
|
|
1066
|
+
};
|
|
1067
|
+
for (const mw of middleware) {
|
|
1068
|
+
if (!mw.onSettled) continue;
|
|
1069
|
+
try {
|
|
1070
|
+
await mw.onSettled(context, settled);
|
|
1071
|
+
} catch (hookError) {
|
|
1072
|
+
globalThis.console?.warn('onSettled hook failed', hookError);
|
|
1024
1073
|
}
|
|
1025
1074
|
}
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
)
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
await
|
|
1038
|
-
|
|
1075
|
+
throw error;
|
|
1076
|
+
}
|
|
1077
|
+
const settled: SettledCall = {
|
|
1078
|
+
response: finalResponse,
|
|
1079
|
+
attempts: attempt,
|
|
1080
|
+
durationMs: Date.now() - startedAt,
|
|
1081
|
+
};
|
|
1082
|
+
const hookErrors: unknown[] = [];
|
|
1083
|
+
for (const mw of middleware) {
|
|
1084
|
+
if (!mw.onSettled) continue;
|
|
1085
|
+
try {
|
|
1086
|
+
await mw.onSettled(context, settled);
|
|
1087
|
+
} catch (hookError) {
|
|
1088
|
+
hookErrors.push(hookError);
|
|
1039
1089
|
}
|
|
1040
|
-
return { response, context };
|
|
1041
1090
|
}
|
|
1091
|
+
if (hookErrors.length > 0) {
|
|
1092
|
+
// The caller never gets this response, so release its connection.
|
|
1093
|
+
await finalResponse.body?.cancel().catch(() => undefined);
|
|
1094
|
+
throw hookErrors[0];
|
|
1095
|
+
}
|
|
1096
|
+
return { response: finalResponse, context };
|
|
1042
1097
|
}
|
|
1043
1098
|
`,"sse.ts":`import { ApiError } from './errors.js';
|
|
1044
1099
|
import { readError } from './parse.js';
|
|
@@ -2985,7 +3040,14 @@ export type ApiErrorLike = globalThis.Error & {
|
|
|
2985
3040
|
body: unknown;
|
|
2986
3041
|
};
|
|
2987
3042
|
|
|
2988
|
-
|
|
3043
|
+
export type SettledCall = {
|
|
3044
|
+
response?: Response;
|
|
3045
|
+
error?: unknown;
|
|
3046
|
+
attempts: number;
|
|
3047
|
+
durationMs: number;
|
|
3048
|
+
};
|
|
3049
|
+
|
|
3050
|
+
/** One interceptor: any subset of the four hooks. */
|
|
2989
3051
|
export type Middleware<Op extends OperationContext = OperationContext> = {
|
|
2990
3052
|
onRequest?: (ctx: RequestContext<Op>) => void | Promise<void>;
|
|
2991
3053
|
onResponse?: (
|
|
@@ -2998,6 +3060,7 @@ export type Middleware<Op extends OperationContext = OperationContext> = {
|
|
|
2998
3060
|
error: ApiErrorLike,
|
|
2999
3061
|
ctx: RequestContext<Op>
|
|
3000
3062
|
) => globalThis.Error | Promise<globalThis.Error>;
|
|
3063
|
+
onSettled?: (ctx: RequestContext<Op>, call: SettledCall) => void | Promise<void>;
|
|
3001
3064
|
};
|
|
3002
3065
|
|
|
3003
3066
|
/** Client configuration: transport, defaults, retry policy, middleware, and credentials. */
|
|
@@ -3636,7 +3699,8 @@ function anySignal(signals: AbortSignal[]): AbortSignal {
|
|
|
3636
3699
|
* serialization (JSON, or FormData via the multipart capability; a stream passes
|
|
3637
3700
|
* through in one attempt), the retry loop
|
|
3638
3701
|
* (idempotent-only defaults, \`Retry-After\`, abandoned-body drain), and the reverse
|
|
3639
|
-
* \`onResponse\` onion
|
|
3702
|
+
* \`onResponse\` onion, then the \`onSettled\` chain once with the final outcome. Returns the
|
|
3703
|
+
* final response plus the request context.
|
|
3640
3704
|
*/
|
|
3641
3705
|
async function send(
|
|
3642
3706
|
config: ClientConfig,
|
|
@@ -3744,72 +3808,117 @@ async function send(
|
|
|
3744
3808
|
const retryOn = retry.retryOn ?? defaultRetryOn;
|
|
3745
3809
|
const signal = fetchInit.signal ?? undefined;
|
|
3746
3810
|
|
|
3811
|
+
const startedAt = Date.now();
|
|
3747
3812
|
let attempt = 0;
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
|
|
3755
|
-
|
|
3756
|
-
|
|
3757
|
-
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
|
|
3763
|
-
|
|
3764
|
-
|
|
3765
|
-
|
|
3766
|
-
|
|
3767
|
-
|
|
3768
|
-
|
|
3769
|
-
|
|
3770
|
-
|
|
3813
|
+
let finalResponse: Response;
|
|
3814
|
+
let lastResponse: Response | undefined;
|
|
3815
|
+
try {
|
|
3816
|
+
while (true) {
|
|
3817
|
+
if (signal?.aborted) throw abortError(signal);
|
|
3818
|
+
attempt++;
|
|
3819
|
+
// A fresh timeout budget per attempt; the caller's signal still wins the race.
|
|
3820
|
+
// The composed signal also governs reading the response body.
|
|
3821
|
+
const budget = timeout ? timeoutSignal(timeout) : undefined;
|
|
3822
|
+
const attemptSignal = budget && signal ? anySignal([signal, budget]) : (budget ?? signal);
|
|
3823
|
+
let response: Response;
|
|
3824
|
+
try {
|
|
3825
|
+
response = await doFetch(context.url, {
|
|
3826
|
+
...fetchInit,
|
|
3827
|
+
// \`fetch\` requires it for a stream body.
|
|
3828
|
+
...(isStream ? { duplex: 'half' } : {}),
|
|
3829
|
+
signal: attemptSignal,
|
|
3830
|
+
method: context.method,
|
|
3831
|
+
headers: context.headers,
|
|
3832
|
+
body: payload,
|
|
3833
|
+
});
|
|
3834
|
+
} catch (error) {
|
|
3835
|
+
// Decided before any await, when no timer can have fired since \`fetch\` rejected: an
|
|
3836
|
+
// aborted budget means this attempt timed out. The abort reason's name is no
|
|
3837
|
+
// evidence, because Chrome 103 to 123 abort a timeout with \`AbortError\`.
|
|
3838
|
+
const timedOut = timeout !== undefined && budget?.aborted && !signal?.aborted;
|
|
3839
|
+
if (
|
|
3840
|
+
attempt < maxAttempts &&
|
|
3841
|
+
!signal?.aborted &&
|
|
3842
|
+
(await retryOn({ attempt, request: context, error }))
|
|
3843
|
+
) {
|
|
3844
|
+
await sleep(retryDelay(retry, attempt, null), signal);
|
|
3845
|
+
continue;
|
|
3846
|
+
}
|
|
3847
|
+
// Our timeout fired (never the caller's own abort \u2014 that rethrows untouched):
|
|
3848
|
+
// wrap the bare DOMException with the context a log line needs.
|
|
3849
|
+
if (timedOut) throw new TimeoutError(op.id, timeout, attempt);
|
|
3850
|
+
throw error;
|
|
3851
|
+
}
|
|
3852
|
+
lastResponse = response;
|
|
3853
|
+
// Reverse order: the last-registered middleware wraps closest to the network (onion).
|
|
3854
|
+
for (let i = middleware.length - 1; i >= 0; i--) {
|
|
3855
|
+
const onResponse = middleware[i].onResponse;
|
|
3856
|
+
if (onResponse) {
|
|
3857
|
+
const replaced = await onResponse(response, context);
|
|
3858
|
+
if (replaced && replaced !== response) {
|
|
3859
|
+
// Cancel the abandoned original's body \u2014 like the retry path, an unread body
|
|
3860
|
+
// keeps its connection checked out under Node/undici.
|
|
3861
|
+
await response.body?.cancel().catch(() => undefined);
|
|
3862
|
+
response = replaced;
|
|
3863
|
+
lastResponse = replaced;
|
|
3864
|
+
}
|
|
3865
|
+
}
|
|
3866
|
+
}
|
|
3771
3867
|
if (
|
|
3868
|
+
!response.ok &&
|
|
3772
3869
|
attempt < maxAttempts &&
|
|
3773
3870
|
!signal?.aborted &&
|
|
3774
|
-
(await retryOn({ attempt, request: context,
|
|
3871
|
+
(await retryOn({ attempt, request: context, response }))
|
|
3775
3872
|
) {
|
|
3776
|
-
|
|
3873
|
+
const retryAfter = response.headers.get('retry-after');
|
|
3874
|
+
// Drain the abandoned response body before the next attempt: an unread body
|
|
3875
|
+
// keeps the connection checked out (and can stall the pool) under Node/undici
|
|
3876
|
+
// and other strict HTTP clients. Ignore errors (e.g. a middleware already read it).
|
|
3877
|
+
await response.body?.cancel().catch(() => undefined);
|
|
3878
|
+
lastResponse = undefined;
|
|
3879
|
+
await sleep(retryDelay(retry, attempt, retryAfter), signal);
|
|
3777
3880
|
continue;
|
|
3778
3881
|
}
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
if (timedOut) throw new TimeoutError(op.id, timeout, attempt);
|
|
3782
|
-
throw error;
|
|
3882
|
+
finalResponse = response;
|
|
3883
|
+
break;
|
|
3783
3884
|
}
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
3787
|
-
|
|
3788
|
-
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
|
|
3794
|
-
|
|
3885
|
+
} catch (error) {
|
|
3886
|
+
const settled: SettledCall = {
|
|
3887
|
+
response: lastResponse,
|
|
3888
|
+
error,
|
|
3889
|
+
attempts: attempt,
|
|
3890
|
+
durationMs: Date.now() - startedAt,
|
|
3891
|
+
};
|
|
3892
|
+
for (const mw of middleware) {
|
|
3893
|
+
if (!mw.onSettled) continue;
|
|
3894
|
+
try {
|
|
3895
|
+
await mw.onSettled(context, settled);
|
|
3896
|
+
} catch (hookError) {
|
|
3897
|
+
globalThis.console?.warn('onSettled hook failed', hookError);
|
|
3795
3898
|
}
|
|
3796
3899
|
}
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
)
|
|
3803
|
-
|
|
3804
|
-
|
|
3805
|
-
|
|
3806
|
-
|
|
3807
|
-
|
|
3808
|
-
await
|
|
3809
|
-
|
|
3900
|
+
throw error;
|
|
3901
|
+
}
|
|
3902
|
+
const settled: SettledCall = {
|
|
3903
|
+
response: finalResponse,
|
|
3904
|
+
attempts: attempt,
|
|
3905
|
+
durationMs: Date.now() - startedAt,
|
|
3906
|
+
};
|
|
3907
|
+
const hookErrors: unknown[] = [];
|
|
3908
|
+
for (const mw of middleware) {
|
|
3909
|
+
if (!mw.onSettled) continue;
|
|
3910
|
+
try {
|
|
3911
|
+
await mw.onSettled(context, settled);
|
|
3912
|
+
} catch (hookError) {
|
|
3913
|
+
hookErrors.push(hookError);
|
|
3810
3914
|
}
|
|
3811
|
-
return { response, context };
|
|
3812
3915
|
}
|
|
3916
|
+
if (hookErrors.length > 0) {
|
|
3917
|
+
// The caller never gets this response, so release its connection.
|
|
3918
|
+
await finalResponse.body?.cancel().catch(() => undefined);
|
|
3919
|
+
throw hookErrors[0];
|
|
3920
|
+
}
|
|
3921
|
+
return { response: finalResponse, context };
|
|
3813
3922
|
}`,"sse.ts":`/**
|
|
3814
3923
|
* A frame delimiter: two consecutive line terminators (each CR, LF, or CRLF, per the SSE
|
|
3815
3924
|
* spec \u2014 so mixed endings like \`\\n\\r\\n\` are valid boundaries, not just matching pairs).
|
|
@@ -5541,4 +5650,4 @@ async function runSingle(
|
|
|
5541
5650
|
}
|
|
5542
5651
|
return fail(1, detail);
|
|
5543
5652
|
}
|
|
5544
|
-
}`},S=["ApiError","ApiErrorLike","AuthCredentials","BodyMethod","Capabilities","CliAuthScheme","CliCommand","CliFlag","CliGlobals","CliInvocation","CliWiring","Client","ClientConfig","ClientCore","CommandContext","CommandSource","CustomCommand","Envelope","EnvelopeResult","EnvelopeResultForKnownInit","FRAME_DELIMITER","GLOBAL_FLAGS","HeadersOf","IDEMPOTENT_METHODS","LAYERS","LAYER_OF","LinkPageCall","Middleware","NoRequiredKeys","OperationArgs","OperationContext","OperationDescriptor","OperationMethodIdentity","OpsShape","PageOf","Paginated","PaginationSpec","ParamSpec","ParseAs","QueryStyle","QueryValue","RequestContext","RequestOptions","ResolvedCommand","ResponseHeaderSpec","Result","RetryConfig","RetryContext","RetryStrategy","SecuritySpec","SendCapabilities","ServerSentEvent","SseOptions","SseParseError","TRANSIENT_STATUS","ThrowMethod","TimeoutError","TokenProvider","abortError","acceptFor","anySignal","buildUrl","callInputs","coerceResponseHeader","commandContract","constantCase","createClientCore","defaultRetryOn","encodeBase64","encodeReserved","execute","groupSlug","inputOf","invokedName","isConfigured","items","itemsByLink","kindFor","linkNext","linkPageCall","loadBody","mergeSetup","middlewareChain","namespaceArgs","normalizeCommands","oneLine","pageCall","pages","pagesByLink","paginateCapability","parse","parseInvocation","parseSseFrame","prepareRequest","queryStyles","readEnvelopeHeaders","readError","redactHeaders","renderComposedHelp","renderHelp","resolveAuth","resolvePointer","resolveToken","retryDelay","runCli","runSingle","runSources","send","shadowedCommandName","sleep","splitArgs","sse","stringHeaders","substitutePath","timeoutSignal","toFormData","toHeaderRecord"];var j=["client","OPERATIONS","Ops","OperationId","OperationPath","OperationTag","createClient","mergeSetup","ApiError","TimeoutError","configure","use","auth","defaultRetryOn","ClientConfig","RequestOptions","SseOptions","Middleware","OperationDescriptor","ServerSentEvent","Result","Envelope","EnvelopeResult","TokenProvider","__redoclySetup"],$=["z","http","HttpResponse","handlers","faker","queryOptions","useSWR","useSWRMutation","__Writable"],L=["AbortController","AbortSignal","Array","ArrayBuffer","ArrayBufferView","AsyncGenerator","AsyncIterable","Blob","BodyInit","Boolean","DOMException","Date","Error","Extract","FormData","Headers","HeadersInit","JSON","Map","Math","NonNullable","Number","Object","Omit","Partial","Promise","ReadableStream","Record","RegExp","RegExpExecArray","Request","RequestInit","Response","Set","String","Symbol","TextDecoder","TextEncoder","TypeError","Uint8Array","URL","URLSearchParams","btoa","clearTimeout","crypto","decodeURIComponent","document","encodeURIComponent","fetch","globalThis","setTimeout","undefined"],w;function Q(){return w===void 0&&(w=new Set([...j,...$,...L,...S])),w}var A={name:"@redocly/client-generator",version:"0.
|
|
5653
|
+
}`},S=["ApiError","ApiErrorLike","AuthCredentials","BodyMethod","Capabilities","CliAuthScheme","CliCommand","CliFlag","CliGlobals","CliInvocation","CliWiring","Client","ClientConfig","ClientCore","CommandContext","CommandSource","CustomCommand","Envelope","EnvelopeResult","EnvelopeResultForKnownInit","FRAME_DELIMITER","GLOBAL_FLAGS","HeadersOf","IDEMPOTENT_METHODS","LAYERS","LAYER_OF","LinkPageCall","Middleware","NoRequiredKeys","OperationArgs","OperationContext","OperationDescriptor","OperationMethodIdentity","OpsShape","PageOf","Paginated","PaginationSpec","ParamSpec","ParseAs","QueryStyle","QueryValue","RequestContext","RequestOptions","ResolvedCommand","ResponseHeaderSpec","Result","RetryConfig","RetryContext","RetryStrategy","SecuritySpec","SendCapabilities","ServerSentEvent","SettledCall","SseOptions","SseParseError","TRANSIENT_STATUS","ThrowMethod","TimeoutError","TokenProvider","abortError","acceptFor","anySignal","buildUrl","callInputs","coerceResponseHeader","commandContract","constantCase","createClientCore","defaultRetryOn","encodeBase64","encodeReserved","execute","groupSlug","inputOf","invokedName","isConfigured","items","itemsByLink","kindFor","linkNext","linkPageCall","loadBody","mergeSetup","middlewareChain","namespaceArgs","normalizeCommands","oneLine","pageCall","pages","pagesByLink","paginateCapability","parse","parseInvocation","parseSseFrame","prepareRequest","queryStyles","readEnvelopeHeaders","readError","redactHeaders","renderComposedHelp","renderHelp","resolveAuth","resolvePointer","resolveToken","retryDelay","runCli","runSingle","runSources","send","shadowedCommandName","sleep","splitArgs","sse","stringHeaders","substitutePath","timeoutSignal","toFormData","toHeaderRecord"];var j=["client","OPERATIONS","Ops","OperationId","OperationPath","OperationTag","createClient","mergeSetup","ApiError","TimeoutError","configure","use","auth","defaultRetryOn","ClientConfig","RequestOptions","SseOptions","Middleware","OperationDescriptor","ServerSentEvent","Result","Envelope","EnvelopeResult","TokenProvider","__redoclySetup"],$=["z","http","HttpResponse","handlers","faker","queryOptions","useSWR","useSWRMutation","__Writable"],L=["AbortController","AbortSignal","Array","ArrayBuffer","ArrayBufferView","AsyncGenerator","AsyncIterable","Blob","BodyInit","Boolean","DOMException","Date","Error","Extract","FormData","Headers","HeadersInit","JSON","Map","Math","NonNullable","Number","Object","Omit","Partial","Promise","ReadableStream","Record","RegExp","RegExpExecArray","Request","RequestInit","Response","Set","String","Symbol","TextDecoder","TextEncoder","TypeError","Uint8Array","URL","URLSearchParams","btoa","clearTimeout","crypto","decodeURIComponent","document","encodeURIComponent","fetch","globalThis","setTimeout","undefined"],w;function Q(){return w===void 0&&(w=new Set([...j,...$,...L,...S])),w}var A={name:"@redocly/client-generator",version:"0.7.1",description:"Generate typed, zero-dependency TypeScript clients (fetch, auth, retries, middleware, SSE) from OpenAPI descriptions.",type:"module",types:"lib/index.d.ts",sideEffects:!1,exports:{".":{types:"./lib/index.d.ts",import:"./lib/index.js",default:"./lib/index.js"},"./generate":{types:"./lib/generate.d.ts",import:"./lib/generate.js",default:"./lib/generate.js"},"./printers/python":{types:"./lib/printers/python.d.ts",import:"./lib/printers/python.js",default:"./lib/printers/python.js"},"./printers/go":{types:"./lib/printers/go.d.ts",import:"./lib/printers/go.js",default:"./lib/printers/go.js"},"./printers/php":{types:"./lib/printers/php.d.ts",import:"./lib/printers/php.js",default:"./lib/printers/php.js"},"./printers/typescript":{types:"./lib/printers/typescript.d.ts",import:"./lib/printers/typescript.js",default:"./lib/printers/typescript.js"},"./printers":{types:"./lib/printers/index.d.ts",import:"./lib/printers/index.js",default:"./lib/printers/index.js"},"./contracts/typescript":{types:"./lib/contracts/typescript.d.ts",import:"./lib/contracts/typescript.js",default:"./lib/contracts/typescript.js"},"./runtime-sources":{types:"./lib/runtime-sources.d.ts",import:"./lib/runtime-sources.js",default:"./lib/runtime-sources.js"},"./package.json":"./package.json"},engines:{node:">=22.12.0 || >=20.19.0 <21.0.0",npm:">=10"},engineStrict:!0,scripts:{"examples:regen":"node scripts/regenerate-examples.mjs",prepare:"node scripts/generate-runtime-sources.mjs && node scripts/generate-eject-assets.mjs","typecheck:examples":"node scripts/typecheck-examples.mjs"},license:"MIT",repository:{type:"git",url:"git+https://github.com/Redocly/redocly-cli.git"},homepage:"https://github.com/Redocly/redocly-cli",keywords:["OpenAPI","Swagger","TypeScript","client","generator","codegen","fetch"],contributors:["Roman Marshevskyi <roman.marshevskyy@redocly.com> (https://redocly.com/)"],dependencies:{"@redocly/openapi-core":"2.64.1"},peerDependencies:{typescript:">=5.5.0"},peerDependenciesMeta:{typescript:{optional:!0}},devDependencies:{typescript:"6.0.2"},files:["lib","eject-assets"]};var ee=A.version;function E(e){let n=/^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e.trim());return n===null?void 0:[Number(n[1]),Number(n[2]),Number(n[3])]}function v(e,n){return e[0]-n[0]||e[1]-n[1]||e[2]-n[2]}function ne(e,n){let o=/^[\^~]|^>=/.exec(n.trim())?.[0]??"",r=E(n.trim().slice(o.length)),a=E(e);if(!(r===void 0||a===void 0))return v(a,r)<0?!1:o===">="?!0:o===""?v(a,r)===0:o==="~"?a[0]===r[0]&&a[1]===r[1]:r[0]!==0?a[0]===r[0]:r[1]!==0?a[0]===0&&a[1]===r[1]:v(a,r)===0}export{C as a,H as b,G as c,W as d,j as e,Q as f,ee as g,ne as h};
|
|
@@ -4,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"./AC25ILS5.js";import{c as w}from"./VAPFU7OM.js";import{a as H,e as q,g as P,h as g,k as E}from"./LD5MEXEL.js";import{join as ae}from"node:path";var j=class{code;constructor(r){this.code=r}};function A(e,r,n={}){let t=new Map(r.map(s=>[s.name,s.schema])),o=k(e,t,new Set,n.dateType??"string");return o===b?null:o}var b=Symbol("cycle");function J(e,r){if(e.kind==="union"){for(let t of e.members){let o=J(t,r);if(o)return o}return}if(e.kind!=="scalar")return;let n=e.metadata?.format;if(n==="binary")return new j("new Blob([])");if(r==="Date"){if(n==="date-time")return new j('new Date("2024-01-01T00:00:00Z")');if(n==="date")return new j('new Date("2024-01-01")')}}function I(e,r){let n=new Map,t=[],o=!1;for(let s of e){if(s.kind==="unknown")continue;let i=G(s,r);if(i?.kind!=="object"){t.push(s);continue}o=!0;for(let a of i.properties){let u=O(a.schema,r,new Set),c=n.get(a.name);(c===void 0||u>=c.rank)&&n.set(a.name,{schema:a.schema,required:a.required||(c?.required??!1),rank:u})}}return o?{merged:{kind:"object",properties:[...n.entries()].map(([s,i])=>({name:s,schema:i.schema,required:i.required}))},rest:t}:{merged:void 0,rest:t}}function G(e,r){let n=new Set,t=e;for(;t?.kind==="ref";){if(n.has(t.name))return;n.add(t.name),t=r.get(t.name)}return t}function O(e,r,n){switch(e.kind){case"literal":return 40;case"enum":return e.values.length===1?40:30;case"union":return Math.max(0,...e.members.map(t=>O(t,r,n)))-1;case"ref":{if(n.has(e.name))return 20;let t=r.get(e.name);return t===void 0?20:O(t,r,new Set(n).add(e.name))}case"null":case"unknown":return 10;default:return 20}}function k(e,r,n,t){let o=J(e,t);if(o)return o;let s=e.metadata,i=a=>a===null?e.kind==="null"||e.kind==="union"&&e.members.some(u=>u.kind==="null"):e.kind==="enum"?e.values.includes(a):e.kind==="literal"?a===e.value:!0;if(s?.example!==void 0&&i(s.example))return s.example;if(s?.default!==void 0&&i(s.default))return s.default;switch(e.kind){case"scalar":return K(e.scalar,s);case"array":{let a=k(e.items,r,n,t);return a===b?[]:[a]}case"object":return Object.fromEntries(e.properties.flatMap(a=>{let u=k(a.schema,r,n,t);return u===b?a.required?[[a.name,null]]:[]:[[a.name,u]]}));case"record":{let a=k(e.value,r,n,t);return a===b?{}:{key:a}}case"enum":return e.values[0];case"literal":return e.value;case"union":{for(let a of e.members){let u=k(a,r,n,t);if(u!==b)return u}return e.members.length>0?b:null}case"intersection":{let{merged:a,rest:u}=I(e.members,r),c=u.map(m=>k(m,r,n,t)).filter(m=>m!==b);if(a){let m=k(a,r,n,t),M=w(m)?m:{};for(let V of c)w(V)&&Object.assign(M,V);return M}let h=c.filter(w);return h.length>0?h.reduce((m,M)=>Object.assign(m,M),{}):c.length>0?c[0]:{}}case"omit":{let a=r.get(e.base);if(!a)return null;let u=k(a,r,n,t);if(w(u)){let c={...u};for(let h of e.keys)delete c[h];return c}return u}case"ref":{if(n.has(e.name))return b;let a=r.get(e.name);if(!a)return null;n.add(e.name);let u=k(a,r,n,t);return n.delete(e.name),u}case"null":case"unknown":return null}}function K(e,r){if(e==="boolean")return!0;if(e==="integer"||e==="number")return 0;switch(r?.format){case"email":return"user@example.com";case"uuid":return"00000000-0000-4000-8000-000000000000";case"date-time":return"2024-01-01T00:00:00Z";case"date":return"2024-01-01";case"uri":case"url":return"https://example.com";default:return"string"}}var f=e=>({kind:"expr",text:e}),d=e=>({kind:"object",entries:e});function l(e){return e.kind==="object"}function D(e,r){return l(e)?d([...e.entries,{spread:r}]):e}var L=" ";function x(e,r){switch(e.kind){case"expr":return e.text;case"wrap":return`${e.before}${x(e.value,r)}${e.after}`;case"array":{if(e.items.length===0)return"[]";let n=r+L;return`[
|
|
8
8
|
${e.items.map((o,s)=>`${n}${x(o,n)}${s===e.items.length-1?"":","}`).join(`
|
|
9
9
|
`)}
|
|
10
10
|
${r}]`}case"object":{if(e.entries.length===0)return"{}";let n=r+L;return`{
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a}from"./
|
|
7
|
+
import{a}from"./SF5X7PGJ.js";import"./DZLV4HEX.js";import"./AC25ILS5.js";import"./WZXA5XPB.js";import"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./LD5MEXEL.js";import"./UW4UC7ZI.js";import"./RFWIIJFG.js";export{a as zodGenerator};
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{c as p}from"./HBUZKWXC.js";import{a as i,b as s}from"./4PTNG4EI.js";import{ia as t}from"./
|
|
7
|
+
import{c as p}from"./HBUZKWXC.js";import{a as i,b as s}from"./4PTNG4EI.js";import{ia as t}from"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as g}from"node:child_process";import{existsSync as l,readFileSync as P}from"node:fs";import w from"node:path";var S=async({argv:r})=>{let{plan:e,port:a}=r,n=r["project-dir"],o=r.product||h(n);if(!j(o))throw t.info(`Invalid product ${o}.`),new Error("Project preview launch failed.");let c=s[o],d=i[o];t.info(`
|
|
8
8
|
Launching preview of ${c} ${e} using NPX.
|
|
9
9
|
|
|
10
10
|
`);let{npxExecutableName:m,shell:f}=p();g(m,["-y",d,"preview",`--plan=${e}`,`--port=${a||4e3}`],{stdio:"inherit",cwd:n,shell:f}).on("error",u=>{throw t.info(`Project preview launch failed: ${u.message}`),new Error("Project preview launch failed.")})},j=r=>r?!!s[r]:!1,h=r=>{let e=w.join(process.cwd(),r,"package.json");if(l(e))try{let n=JSON.parse(P(e,"utf-8")).dependencies||{};for(let[o,c]of Object.entries(i))if(n[c])return t.info(`
|
|
@@ -4,7 +4,7 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{b as A,c as F,d as S,e as l}from"./
|
|
7
|
+
import{b as A,c as F,d as S,e as l}from"./4BWADBBP.js";import"./CBJ23L7Q.js";import{e as $,g as x,n as I,o as P}from"./5BB2E772.js";import{f as p}from"./JUZHXP62.js";import"./GKXY6U4S.js";import{aa as w,ia as n,l as u}from"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";async function O({argv:t,config:o,version:c}){let h=performance.now(),j=Date.now(),{organization:g,project:d,"mount-path":z,verbose:D}=t,f=t.domain||x(),e,r,y,b,s=[];try{let i=$();if(e=P(t.files,(a,T)=>{n.warn(`File ${a} is overwritten by ${T}
|
|
8
8
|
`)}),!e.length)return p("push",h,"No files to upload");let m=await I({domain:f,apiKey:i,organization:g,project:d,mountPath:z,files:e,defaultBranch:t["default-branch"],commit:{message:t.message,branchName:t.branch,sha:t["commit-sha"],url:t["commit-url"],createdAt:t["created-at"],namespace:t.namespace,repository:t.repository,author:U(t.author)},version:c,replace:t.replace,onUploadStart:a=>{n.info(`Uploading to ${a.mountPath} ${e.length} ${u("file",e.length)}:
|
|
9
9
|
`)},onSunsetWarning:a=>s.push(a),onSlugDeprecated:S});r=m.pushId,y=m.organizationId,b=m.projectId}catch(i){l("push",s),F("\u2717 File upload failed.",i)}for(let i of e)n.info(w(`\u2713 ${i.name}
|
|
10
10
|
`));return n.info(`
|
|
@@ -4,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{a,b}from"./
|
|
7
|
+
import{a,b}from"./6TFC2OYQ.js";import"./JUZHXP62.js";import"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{a as bundleTelemetry,b as handleBundle};
|
|
@@ -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 o,b as t,c as e}from"./HBUZKWXC.js";import{ia as r}from"./
|
|
7
|
+
import{a as o,b as t,c as e}from"./HBUZKWXC.js";import{ia as r}from"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";import{spawn as p}from"node:child_process";var u=async({argv:n})=>{r.info(`
|
|
8
8
|
Launching translate using NPX.
|
|
9
9
|
|
|
10
10
|
`);let{npxExecutableName:s,sanitize:a,shell:i}=e(),l=a(n["project-dir"],o),c=a(n.locale,t);p(s,["-y","@redocly/realm","translate",c,`-d=${l}`],{stdio:"inherit",shell:i}).on("error",m=>{throw r.info(`Translate launch failed: ${m.message}`),new Error("Translate launch failed.")})};export{u as handleTranslations};
|
|
@@ -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{ia as t}from"./
|
|
7
|
+
import{ia as t}from"./VAPFU7OM.js";import*as e from"node:process";var o=["\u280B","\u2819","\u2839","\u2838","\u283C","\u2834","\u2826","\u2827","\u2807","\u280F"],n=class{frames;currentFrame;intervalId;message;constructor(){this.frames=o,this.currentFrame=0,this.intervalId=null,this.message=""}showFrame(){t.info("\r"+this.frames[this.currentFrame]+" "+this.message),this.currentFrame=(this.currentFrame+1)%this.frames.length}start(r){if(this.message!==r){if(this.message=r,!e.stderr.isTTY){t.info(`${r}...
|
|
8
8
|
`);return}this.intervalId===null&&(this.intervalId=setInterval(()=>{this.showFrame()},100))}}stop(){this.intervalId!==null&&(clearInterval(this.intervalId),this.intervalId=null,t.info("\r")),this.message=""}};function h(i){i.stop(),e.stderr.isTTY&&t.info("\x1B[2K")}function m(i,r){let[s]=r.inFlight;if(!s)return;let a=r.inFlight.size>1?` (+${r.inFlight.size-1} more)`:"";i.start(`[${r.position}/${r.total}] ${r.action} ${s}${a}`)}export{n as a,h as b,m as c};
|
|
@@ -8,4 +8,4 @@ import{a as p,f,j as d,m as u}from"./UW4UC7ZI.js";function m(e,t,n){let i=t??{},
|
|
|
8
8
|
`))e.line(l);e.line("```"),e.blank()}let s=[...n.pathParams,...n.queryParams,...n.headerParams];s.length>0&&w(e,s),n.requestBody!==void 0&&e.line(`Body: \`${n.requestBody.contentType}\`${n.requestBody.required?", required":", optional"}, of type ${c(n.requestBody.schema)}.`);let r=n.successResponses[0];e.line(r===void 0?"Returns no content.":`Returns \`${r.contentType}\`, of type ${c(r.schema)}.`),(i.paginated!==void 0?i.paginated.has(n.name):m(n,i.pagination,t)!==void 0)&&e.line("This operation is paginated, so the SDK gives it page and item iterators."),n.successResponses.some(l=>l.contentType==="text/event-stream")&&e.line("This operation streams server-sent events, so the SDK iterates the events."),N(n)&&e.line("This operation returns binary content."),e.blank()}function E(e,t){let n=new p;if(t.frontmatter&&(n.line("---"),n.line(`title: ${t.title}`),n.line("---"),n.blank()),n.line(`# ${t.title}`),n.blank(),n.line(`Generated reference for the ${t.language.label} SDK, produced from the API description by \`redocly generate-client\`.`),n.line("Re-run generation to update it \u2014 this file is not hand-edited."),n.blank(),n.line(t.language.requires),n.blank(),n.line("## Authentication"),n.blank(),e.securitySchemes.length===0)n.line("The description declares no security schemes.");else{n.line("The description declares these schemes, which you pass to the client:"),n.blank(),n.line("| Scheme | Kind | Sent as |"),n.line("| ------ | ---- | ------- |");for(let s of e.securitySchemes){let r=s.kind==="bearer"?"`Authorization: Bearer <token>`":s.kind==="basic"?"`Authorization: Basic <base64>`":s.kind==="apiKeyHeader"?`the \`${s.headerName}\` header`:s.kind==="apiKeyQuery"?`the \`${s.paramName}\` query parameter`:`the \`${s.cookieName}\` cookie`;n.line(`| \`${s.key}\` | ${s.kind} | ${r} |`)}}n.blank();let i=e.services.flatMap(s=>s.operations),a=[...new Set(i.map(s=>s.tags[0]))];for(let s of a){n.line(s===void 0?"## Operations":`## ${s}`),n.blank();for(let r of i.filter(o=>o.tags[0]===s))B(n,e,r,t)}return n.toString().replace(/\n{3,}/g,`
|
|
9
9
|
|
|
10
10
|
`).trimEnd()+`
|
|
11
|
-
`}var ne=["Printer","casing","identifierFor","uniqueIdentifiers","RESERVED_WORDS","flattenAllOf","deref","discriminatorCases","jsonSuccessSchema","sseResponse","isMultipartBody","isUntypedMultipartBody","isBinaryContentType","serverUrlParts","securityRequirements","paginationItemSchema","isNullable","unwrapNullable","enumValues","docText","headerCoerceType","schemaAtPointer","paginationRuleFor","renderReferencePage","NotSupportedError"];function A(e){return e}function q(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-")}function j(e){return e.replace(/[^A-Za-z0-9]+/g,"_").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()}function L(e,t){let n={...e};for(let[i,a]of Object.entries(t))a!==void 0&&(n[i]=a);return n}function ye(e){return e}async function be(e){return(await import("./
|
|
11
|
+
`}var ne=["Printer","casing","identifierFor","uniqueIdentifiers","RESERVED_WORDS","flattenAllOf","deref","discriminatorCases","jsonSuccessSchema","sseResponse","isMultipartBody","isUntypedMultipartBody","isBinaryContentType","serverUrlParts","securityRequirements","paginationItemSchema","isNullable","unwrapNullable","enumValues","docText","headerCoerceType","schemaAtPointer","paginationRuleFor","renderReferencePage","NotSupportedError"];function A(e){return e}function q(e){return e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean).join("-")}function j(e){return e.replace(/[^A-Za-z0-9]+/g,"_").replace(/([a-z0-9])([A-Z])/g,"$1_$2").toUpperCase()}function L(e,t){let n={...e};for(let[i,a]of Object.entries(t))a!==void 0&&(n[i]=a);return n}function ye(e){return e}async function be(e){return(await import("./J4MBQ4RQ.js")).generateClient(e)}export{m as a,b,R as c,x as d,S as e,y as f,P as g,T as h,C as i,E as j,ne as k,A as l,q as m,j as n,L as o,ye as p,be as q};
|
|
@@ -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"./4BWADBBP.js";import"./CBJ23L7Q.js";import"./5BB2E772.js";import"./JUZHXP62.js";import"./GKXY6U4S.js";import"./VAPFU7OM.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,b,c,d,e,f,g}from"./
|
|
7
|
+
import{a,b,c,d,e,f,g}from"./U2GUGMK3.js";import"./UF2ZCH7W.js";import"./VAPFU7OM.js";import"./NEWT5A6S.js";import"./RFWIIJFG.js";export{d as RESET_ESCAPE_CODE,c as calculateTotals,f as conditionallyMaskSecrets,b as generate,e as maskSecrets,a as parseRuntimeExpression,g as run};
|