@redocly/cli 2.62.1 → 2.63.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/THIRD_PARTY_NOTICES +2 -2
- package/lib/chunks/{VXLODB3S.js → 24AVTWC7.js} +1 -1
- package/lib/chunks/{SOI7RTB4.js → 2G2Q42ND.js} +1 -1
- package/lib/chunks/{KRCCY64H.js → 3LGZAJES.js} +1 -1
- package/lib/chunks/3SFDVGEQ.js +7 -0
- package/lib/chunks/{RGU6OZYB.js → 4C44BO5N.js} +1 -1
- package/lib/chunks/4JKMQCWY.js +9 -0
- package/lib/chunks/{UFZ7VJKO.js → 5IIJHGNO.js} +1 -1
- package/lib/chunks/{3M4FKKBI.js → 5VDBZVBF.js} +1 -1
- package/lib/chunks/6AB3BDX4.js +20 -0
- package/lib/chunks/{LRLGVYCG.js → 6LEQ46KS.js} +1 -1
- package/lib/chunks/{GVQMC2WB.js → 6QRNEF7K.js} +1 -1
- package/lib/chunks/{PTNNX4IU.js → 6WESXERF.js} +1 -1
- package/lib/chunks/{PRSNVDUV.js → 7AWM5GPD.js} +1 -1
- package/lib/chunks/{KQ5RN67Y.js → 7LNKXEIU.js} +1 -1
- package/lib/chunks/{5YW5LAGV.js → 7RQW6KPZ.js} +156 -58
- package/lib/chunks/{SLQPKXO2.js → A22GELRX.js} +1 -1
- package/lib/chunks/{VE45GKNY.js → AAPHKNGA.js} +1 -1
- package/lib/chunks/{22EANOP2.js → ACMV5RZA.js} +1 -1
- package/lib/chunks/AU7VOB4V.js +20 -0
- package/lib/chunks/{O7F2NBMC.js → B4ONRSDG.js} +3 -3
- package/lib/chunks/BC3XCWQE.js +11 -0
- package/lib/chunks/{L3H2DSRP.js → BFIZTFWS.js} +1 -1
- package/lib/chunks/{W3G6AQCC.js → BS3AUVYD.js} +1 -1
- package/lib/chunks/{NBI4EQPC.js → C2OCU4E3.js} +1 -1
- package/lib/chunks/{US7X4XPD.js → CQMZF72H.js} +1 -1
- package/lib/chunks/{3C6UUCEW.js → CTPVBOG5.js} +1 -1
- package/lib/chunks/{3JYY42DL.js → CVUPOCX4.js} +1 -1
- package/lib/chunks/{FDMXHRDK.js → DEXQ6S3P.js} +1 -1
- package/lib/chunks/{RPHIT72T.js → DQFNUDOT.js} +1 -1
- package/lib/chunks/{Y5AAEFMH.js → E2D25T4G.js} +1 -1
- package/lib/chunks/{G55KF2JU.js → FCZH3476.js} +1 -1
- package/lib/chunks/{ZNQTCB4Q.js → FRM6TZ42.js} +1 -1
- package/lib/chunks/GKXY6U4S.js +145 -0
- package/lib/chunks/{YINR7LU6.js → HTG3RKCV.js} +1 -1
- package/lib/chunks/{BX2H6D2W.js → HW7ZCN7J.js} +1 -1
- package/lib/chunks/{REIGI2Y7.js → I3M476SQ.js} +1 -1
- package/lib/chunks/{AB2EMYEK.js → IODGA6FG.js} +1 -1
- package/lib/chunks/{5S5OMDQZ.js → ITUUIAOZ.js} +381 -381
- package/lib/chunks/{LWPTRXNP.js → IYKYAJDC.js} +1 -1
- package/lib/chunks/{ZJYDDU5M.js → J373CXCH.js} +1 -1
- package/lib/chunks/{5UYYEBJY.js → J7J4PH3V.js} +7 -7
- package/lib/chunks/{P7MVM2ZA.js → JGBWIR5U.js} +1 -1
- package/lib/chunks/{S6NFOZ34.js → JHK6XIMG.js} +1 -1
- package/lib/chunks/{YDVWNFMS.js → KMP5ZE2D.js} +1 -1
- package/lib/chunks/{6EGJEFXO.js → L2EBKZQZ.js} +1 -1
- package/lib/chunks/{RUIEI3YV.js → LLWU7A5G.js} +1 -1
- package/lib/chunks/{LVGVWPDB.js → LXSCIQFU.js} +1 -1
- package/lib/chunks/{5PG3ST2N.js → NCBLLIQ3.js} +2 -2
- package/lib/chunks/{7YNVVBUW.js → NERCHMVY.js} +1 -1
- package/lib/chunks/{XJE2OFDN.js → NR3R4HFM.js} +45 -18
- package/lib/chunks/{LNYTDBAU.js → OFJ2KV5N.js} +1 -1
- package/lib/chunks/{XVZ7A34Y.js → OYUXHAGQ.js} +1 -1
- package/lib/chunks/{37WWN4MA.js → PHWKGYUT.js} +1 -1
- package/lib/chunks/{6NB3FKVN.js → Q4UGLPO2.js} +1 -1
- package/lib/chunks/{DBBMGF4W.js → QNCKZURN.js} +1 -1
- package/lib/chunks/{WEOCCL26.js → RFGNVCAR.js} +5 -5
- package/lib/chunks/{HBENVUR4.js → SXIFTBZB.js} +1 -1
- package/lib/chunks/{XJTGJYVS.js → TCALQAX5.js} +1 -1
- package/lib/chunks/{TBZEEKTV.js → U52CY34I.js} +1 -1
- package/lib/chunks/VB4PNWOR.js +7 -0
- package/lib/chunks/{SYWAPWW7.js → VSBSD3XZ.js} +1 -1
- package/lib/chunks/{ID2DJAJI.js → WV2NAII3.js} +1 -1
- package/lib/chunks/{YPYZCXVX.js → X2V5QOZP.js} +1 -1
- package/lib/chunks/{SXBAAS4M.js → XNNK5G6V.js} +1 -1
- package/lib/chunks/Y4UTXOI2.js +59 -0
- package/lib/chunks/{6DO6IN4A.js → YKST56C6.js} +1 -1
- package/lib/chunks/{2XK7ML3U.js → YXH72HCU.js} +1 -1
- package/lib/chunks/{MNH2K4WM.js → Z52TEGV5.js} +1 -1
- package/lib/chunks/{3DEJQSYG.js → Z5QYTPVY.js} +1 -1
- package/lib/chunks/{OP7NIAI7.js → Z7J6WWCO.js} +1 -1
- package/lib/chunks/{2OVI7BIW.js → ZK27F53P.js} +1 -1
- package/lib/chunks/{QMIOB64K.js → ZP54RCIQ.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 +2 -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 +2 -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 +2 -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 +56 -9
- 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/eject-assets/skills/tanstack-query-generator/SKILL.md +5 -2
- package/lib/eject-assets/skills/typescript-generator/SKILL.md +5 -0
- package/lib/index.js +25 -25
- package/package.json +1 -1
- package/lib/chunks/23KTTVIR.js +0 -42
- package/lib/chunks/5NOJ76EP.js +0 -9
- package/lib/chunks/B64RMZSV.js +0 -7
- package/lib/chunks/LRUXN6H5.js +0 -59
- package/lib/chunks/QWPV64G2.js +0 -20
- package/lib/chunks/U77FTE2C.js +0 -20
- package/lib/chunks/UWK3L6LB.js +0 -11
- package/lib/chunks/WPIZQQ5C.js +0 -7
|
@@ -4,9 +4,9 @@ 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
|
|
9
|
-
`)}let h=m(g.schema,t.items,n);if(h===void 0)return
|
|
7
|
+
import{c as x,ia as R}from"./ACMV5RZA.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(E=>E.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
|
+
`)}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).
|
|
12
12
|
* The generator emits \`OPERATIONS\` literals typed
|
|
@@ -30,7 +30,7 @@ export type SecuritySpec =
|
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* How to auto-iterate a paginated operation (drives its \`.pages()\`/\`.items()\` members).
|
|
33
|
-
* \`nextCursor\` and \`items\` are RFC 6901 JSON pointers into the page (response) value.
|
|
33
|
+
* \`nextCursor\`, \`nextLink\`, and \`items\` are RFC 6901 JSON pointers into the page (response) value.
|
|
34
34
|
*/
|
|
35
35
|
export type PaginationSpec =
|
|
36
36
|
| {
|
|
@@ -62,6 +62,16 @@ export type PaginationSpec =
|
|
|
62
62
|
limitParam?: string;
|
|
63
63
|
/** Pointer to the page's item array. */
|
|
64
64
|
items: string;
|
|
65
|
+
}
|
|
66
|
+
| {
|
|
67
|
+
/** Follow the next page's URL at \`nextLink\` in the page; stop when it is absent. */
|
|
68
|
+
style: 'body-link';
|
|
69
|
+
/** Optional page-size query param (recorded for tooling; never set by the runtime). */
|
|
70
|
+
limitParam?: string;
|
|
71
|
+
/** Pointer to the next page's URL in the page. */
|
|
72
|
+
nextLink: string;
|
|
73
|
+
/** Pointer to the page's item array. */
|
|
74
|
+
items: string;
|
|
65
75
|
};
|
|
66
76
|
|
|
67
77
|
/** The frozen data contract between generated code and the runtime: one operation's wire shape. */
|
|
@@ -813,6 +823,42 @@ export function middlewareChain(config: ClientConfig): Middleware[] {
|
|
|
813
823
|
return [...single, ...(config.middleware ?? [])];
|
|
814
824
|
}
|
|
815
825
|
|
|
826
|
+
/**
|
|
827
|
+
* \`AbortSignal.timeout()\` where the platform has it, else an \`AbortController\` armed by
|
|
828
|
+
* \`setTimeout\`: Chrome before 103, Safari before 16, and Firefox before 100 lack the
|
|
829
|
+
* static, and every request with a timeout would throw before \`fetch\` runs.
|
|
830
|
+
*/
|
|
831
|
+
function timeoutSignal(ms: number): AbortSignal {
|
|
832
|
+
if (typeof AbortSignal.timeout === 'function') return AbortSignal.timeout(ms);
|
|
833
|
+
const controller = new AbortController();
|
|
834
|
+
setTimeout(() => {
|
|
835
|
+
controller.abort(new DOMException(\`Timed out after \${ms} ms\`, 'TimeoutError'));
|
|
836
|
+
}, ms);
|
|
837
|
+
return controller.signal;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* \`AbortSignal.any()\` where the platform has it, else a controller that follows whichever
|
|
842
|
+
* signal aborts first: Chrome before 116, Safari before 17.4, and Firefox before 124 lack
|
|
843
|
+
* the static. The listeners come off once one signal fires, so a caller's long-lived
|
|
844
|
+
* signal does not keep one per request.
|
|
845
|
+
*/
|
|
846
|
+
function anySignal(signals: AbortSignal[]): AbortSignal {
|
|
847
|
+
if (typeof AbortSignal.any === 'function') return AbortSignal.any(signals);
|
|
848
|
+
const controller = new AbortController();
|
|
849
|
+
const listeners = new Map<AbortSignal, () => void>();
|
|
850
|
+
const abort = (reason: unknown) => {
|
|
851
|
+
for (const [signal, listener] of listeners) signal.removeEventListener('abort', listener);
|
|
852
|
+
controller.abort(reason);
|
|
853
|
+
};
|
|
854
|
+
for (const signal of signals) {
|
|
855
|
+
const listener = () => abort(signal.reason);
|
|
856
|
+
listeners.set(signal, listener);
|
|
857
|
+
signal.addEventListener('abort', listener);
|
|
858
|
+
}
|
|
859
|
+
return controller.signal;
|
|
860
|
+
}
|
|
861
|
+
|
|
816
862
|
/**
|
|
817
863
|
* The fetch core shared by every operation: default + config + per-call headers, the
|
|
818
864
|
* \`onRequest\` chain (BEFORE body serialization, so mutations are sent), body
|
|
@@ -933,11 +979,8 @@ export async function send(
|
|
|
933
979
|
if (signal?.aborted) throw abortError(signal);
|
|
934
980
|
// A fresh timeout budget per attempt; the caller's signal still wins the race.
|
|
935
981
|
// The composed signal also governs reading the response body.
|
|
936
|
-
const
|
|
937
|
-
|
|
938
|
-
? AbortSignal.any([signal, AbortSignal.timeout(timeout)])
|
|
939
|
-
: AbortSignal.timeout(timeout)
|
|
940
|
-
: signal;
|
|
982
|
+
const budget = timeout ? timeoutSignal(timeout) : undefined;
|
|
983
|
+
const attemptSignal = budget && signal ? anySignal([signal, budget]) : (budget ?? signal);
|
|
941
984
|
let response: Response;
|
|
942
985
|
try {
|
|
943
986
|
response = await doFetch(context.url, {
|
|
@@ -950,6 +993,10 @@ export async function send(
|
|
|
950
993
|
body: payload,
|
|
951
994
|
});
|
|
952
995
|
} catch (error) {
|
|
996
|
+
// Decided before any await, when no timer can have fired since \`fetch\` rejected: an
|
|
997
|
+
// aborted budget means this attempt timed out. The abort reason's name is no
|
|
998
|
+
// evidence, because Chrome 103 to 123 abort a timeout with \`AbortError\`.
|
|
999
|
+
const timedOut = timeout !== undefined && budget?.aborted && !signal?.aborted;
|
|
953
1000
|
if (
|
|
954
1001
|
attempt < maxAttempts &&
|
|
955
1002
|
!signal?.aborted &&
|
|
@@ -960,14 +1007,7 @@ export async function send(
|
|
|
960
1007
|
}
|
|
961
1008
|
// Our timeout fired (never the caller's own abort \u2014 that rethrows untouched):
|
|
962
1009
|
// wrap the bare DOMException with the context a log line needs.
|
|
963
|
-
if (
|
|
964
|
-
timeout &&
|
|
965
|
-
!signal?.aborted &&
|
|
966
|
-
error instanceof DOMException &&
|
|
967
|
-
error.name === 'TimeoutError'
|
|
968
|
-
) {
|
|
969
|
-
throw new TimeoutError(op.id, timeout, attempt);
|
|
970
|
-
}
|
|
1010
|
+
if (timedOut) throw new TimeoutError(op.id, timeout, attempt);
|
|
971
1011
|
throw error;
|
|
972
1012
|
}
|
|
973
1013
|
// Reverse order: the last-registered middleware wraps closest to the network (onion).
|
|
@@ -1228,6 +1268,7 @@ export type Capabilities = SendCapabilities & {
|
|
|
1228
1268
|
args?: OperationArgs,
|
|
1229
1269
|
init?: RequestOptions
|
|
1230
1270
|
) => Promise<{ page: unknown; linkHeader: string | null; url: string }>,
|
|
1271
|
+
spec: PaginationSpec,
|
|
1231
1272
|
args?: OperationArgs,
|
|
1232
1273
|
init?: RequestOptions
|
|
1233
1274
|
) => AsyncGenerator<unknown>;
|
|
@@ -1675,11 +1716,12 @@ export function createClientCore<
|
|
|
1675
1716
|
client[name] =
|
|
1676
1717
|
spec === undefined
|
|
1677
1718
|
? method
|
|
1678
|
-
: spec.style === 'link'
|
|
1719
|
+
: spec.style === 'link' || spec.style === 'body-link'
|
|
1679
1720
|
? Object.assign(method, {
|
|
1680
1721
|
pages: (args?: OperationArgs, init?: RequestOptions) =>
|
|
1681
1722
|
paginateCapability(caps, op).pagesByLink(
|
|
1682
1723
|
linkPageCall(config, op, caps),
|
|
1724
|
+
spec,
|
|
1683
1725
|
inputOf(op, args ?? {}, config),
|
|
1684
1726
|
init
|
|
1685
1727
|
),
|
|
@@ -1823,9 +1865,9 @@ export async function* pages<TPage>(
|
|
|
1823
1865
|
}
|
|
1824
1866
|
cursor = next;
|
|
1825
1867
|
}
|
|
1826
|
-
} else if (spec.style === 'link') {
|
|
1827
|
-
//
|
|
1828
|
-
// cannot carry \u2014 the client wires those operations to \`pagesByLink
|
|
1868
|
+
} else if (spec.style === 'link' || spec.style === 'body-link') {
|
|
1869
|
+
// Link iteration needs the response's \`Link\` header and the page URL, which the
|
|
1870
|
+
// parsed-page \`call\` cannot carry \u2014 the client wires those operations to \`pagesByLink\`.
|
|
1829
1871
|
throw new Error('link-style pagination iterates via pagesByLink');
|
|
1830
1872
|
} else {
|
|
1831
1873
|
// Coerce the starting position to a number: a caller may pass \`query[spec.param]\` as a
|
|
@@ -1874,7 +1916,7 @@ export async function* items<TItem>(
|
|
|
1874
1916
|
|
|
1875
1917
|
/**
|
|
1876
1918
|
* The per-page call the \`link\`-style iterators drive: the parsed page plus the raw
|
|
1877
|
-
* \`Link\` header and the page's own URL (for resolving a relative
|
|
1919
|
+
* \`Link\` header and the page's own URL (for resolving a relative next-page target).
|
|
1878
1920
|
*/
|
|
1879
1921
|
export type LinkPageCall = (
|
|
1880
1922
|
args?: OperationArgs,
|
|
@@ -1897,25 +1939,32 @@ export function linkNext(header: string | null): string | undefined {
|
|
|
1897
1939
|
}
|
|
1898
1940
|
|
|
1899
1941
|
/**
|
|
1900
|
-
* Iterate a \`link\`-style operation's pages: follow the
|
|
1901
|
-
*
|
|
1902
|
-
*
|
|
1942
|
+
* Iterate a \`link\`- or \`body-link\`-style operation's pages: follow the next page's URL \u2014
|
|
1943
|
+
* the \`Link\` header's \`rel="next"\` target (\`link\`), or the value at the \`nextLink\` pointer
|
|
1944
|
+
* (\`body-link\`) \u2014 by merging ITS query params into the next call. Every page goes through
|
|
1945
|
+
* the same declared endpoint, so auth, middleware, and \`serverUrl\` handling apply
|
|
1903
1946
|
* unchanged, and credentials can never be handed to a cross-origin \`next\` URL.
|
|
1904
|
-
* Stops when no
|
|
1905
|
-
*
|
|
1947
|
+
* Stops when there is no next URL (\`body-link\`: \`undefined\`/\`null\`/\`''\`); throws when a
|
|
1948
|
+
* \`nextLink\` value is not a string, or when the link does not advance (the same target
|
|
1949
|
+
* twice, or a self-link \u2014 an infinite-loop guard).
|
|
1906
1950
|
*/
|
|
1907
1951
|
export async function* pagesByLink<TPage>(
|
|
1908
1952
|
call: LinkPageCall,
|
|
1953
|
+
spec: PaginationSpec,
|
|
1909
1954
|
args: OperationArgs = {},
|
|
1910
1955
|
init?: RequestOptions
|
|
1911
1956
|
): AsyncGenerator<TPage> {
|
|
1957
|
+
const pointer = spec.style === 'body-link' ? spec.nextLink : undefined;
|
|
1912
1958
|
let query = args.query;
|
|
1913
1959
|
let previous: string | undefined;
|
|
1914
1960
|
while (true) {
|
|
1915
1961
|
const { page, linkHeader, url } = await call({ ...args, query }, init);
|
|
1916
1962
|
yield page as TPage;
|
|
1917
|
-
const target = linkNext(linkHeader);
|
|
1918
|
-
if (target === undefined) return;
|
|
1963
|
+
const target = pointer === undefined ? linkNext(linkHeader) : resolvePointer(page, pointer);
|
|
1964
|
+
if (target === undefined || target === null || target === '') return;
|
|
1965
|
+
if (typeof target !== 'string') {
|
|
1966
|
+
throw new Error(\`Pagination link at \${pointer} is not a string\`);
|
|
1967
|
+
}
|
|
1919
1968
|
// A relative target resolves against the page's own URL (RFC 8288 \xA73.1) \u2014 which may
|
|
1920
1969
|
// itself be relative (relative \`serverUrl\`, mocked fetch), so both resolve against a
|
|
1921
1970
|
// placeholder origin. It never reaches the wire: only the target's query params
|
|
@@ -1946,7 +1995,7 @@ export async function* itemsByLink<TItem>(
|
|
|
1946
1995
|
args?: OperationArgs,
|
|
1947
1996
|
init?: RequestOptions
|
|
1948
1997
|
): AsyncGenerator<TItem> {
|
|
1949
|
-
for await (const page of pagesByLink(call, args, init)) {
|
|
1998
|
+
for await (const page of pagesByLink(call, spec, args, init)) {
|
|
1950
1999
|
const pageItems = resolvePointer(page, spec.items);
|
|
1951
2000
|
if (Array.isArray(pageItems)) yield* pageItems as TItem[];
|
|
1952
2001
|
}
|
|
@@ -2782,7 +2831,7 @@ export type SecuritySpec =
|
|
|
2782
2831
|
|
|
2783
2832
|
/**
|
|
2784
2833
|
* How to auto-iterate a paginated operation (drives its \`.pages()\`/\`.items()\` members).
|
|
2785
|
-
* \`nextCursor\` and \`items\` are RFC 6901 JSON pointers into the page (response) value.
|
|
2834
|
+
* \`nextCursor\`, \`nextLink\`, and \`items\` are RFC 6901 JSON pointers into the page (response) value.
|
|
2786
2835
|
*/
|
|
2787
2836
|
export type PaginationSpec =
|
|
2788
2837
|
| {
|
|
@@ -2814,6 +2863,16 @@ export type PaginationSpec =
|
|
|
2814
2863
|
limitParam?: string;
|
|
2815
2864
|
/** Pointer to the page's item array. */
|
|
2816
2865
|
items: string;
|
|
2866
|
+
}
|
|
2867
|
+
| {
|
|
2868
|
+
/** Follow the next page's URL at \`nextLink\` in the page; stop when it is absent. */
|
|
2869
|
+
style: 'body-link';
|
|
2870
|
+
/** Optional page-size query param (recorded for tooling; never set by the runtime). */
|
|
2871
|
+
limitParam?: string;
|
|
2872
|
+
/** Pointer to the next page's URL in the page. */
|
|
2873
|
+
nextLink: string;
|
|
2874
|
+
/** Pointer to the page's item array. */
|
|
2875
|
+
items: string;
|
|
2817
2876
|
};
|
|
2818
2877
|
|
|
2819
2878
|
/** The frozen data contract between generated code and the runtime: one operation's wire shape. */
|
|
@@ -3535,6 +3594,42 @@ function middlewareChain(config: ClientConfig): Middleware[] {
|
|
|
3535
3594
|
return [...single, ...(config.middleware ?? [])];
|
|
3536
3595
|
}
|
|
3537
3596
|
|
|
3597
|
+
/**
|
|
3598
|
+
* \`AbortSignal.timeout()\` where the platform has it, else an \`AbortController\` armed by
|
|
3599
|
+
* \`setTimeout\`: Chrome before 103, Safari before 16, and Firefox before 100 lack the
|
|
3600
|
+
* static, and every request with a timeout would throw before \`fetch\` runs.
|
|
3601
|
+
*/
|
|
3602
|
+
function timeoutSignal(ms: number): AbortSignal {
|
|
3603
|
+
if (typeof AbortSignal.timeout === 'function') return AbortSignal.timeout(ms);
|
|
3604
|
+
const controller = new AbortController();
|
|
3605
|
+
setTimeout(() => {
|
|
3606
|
+
controller.abort(new DOMException(\`Timed out after \${ms} ms\`, 'TimeoutError'));
|
|
3607
|
+
}, ms);
|
|
3608
|
+
return controller.signal;
|
|
3609
|
+
}
|
|
3610
|
+
|
|
3611
|
+
/**
|
|
3612
|
+
* \`AbortSignal.any()\` where the platform has it, else a controller that follows whichever
|
|
3613
|
+
* signal aborts first: Chrome before 116, Safari before 17.4, and Firefox before 124 lack
|
|
3614
|
+
* the static. The listeners come off once one signal fires, so a caller's long-lived
|
|
3615
|
+
* signal does not keep one per request.
|
|
3616
|
+
*/
|
|
3617
|
+
function anySignal(signals: AbortSignal[]): AbortSignal {
|
|
3618
|
+
if (typeof AbortSignal.any === 'function') return AbortSignal.any(signals);
|
|
3619
|
+
const controller = new AbortController();
|
|
3620
|
+
const listeners = new Map<AbortSignal, () => void>();
|
|
3621
|
+
const abort = (reason: unknown) => {
|
|
3622
|
+
for (const [signal, listener] of listeners) signal.removeEventListener('abort', listener);
|
|
3623
|
+
controller.abort(reason);
|
|
3624
|
+
};
|
|
3625
|
+
for (const signal of signals) {
|
|
3626
|
+
const listener = () => abort(signal.reason);
|
|
3627
|
+
listeners.set(signal, listener);
|
|
3628
|
+
signal.addEventListener('abort', listener);
|
|
3629
|
+
}
|
|
3630
|
+
return controller.signal;
|
|
3631
|
+
}
|
|
3632
|
+
|
|
3538
3633
|
/**
|
|
3539
3634
|
* The fetch core shared by every operation: default + config + per-call headers, the
|
|
3540
3635
|
* \`onRequest\` chain (BEFORE body serialization, so mutations are sent), body
|
|
@@ -3655,11 +3750,8 @@ async function send(
|
|
|
3655
3750
|
if (signal?.aborted) throw abortError(signal);
|
|
3656
3751
|
// A fresh timeout budget per attempt; the caller's signal still wins the race.
|
|
3657
3752
|
// The composed signal also governs reading the response body.
|
|
3658
|
-
const
|
|
3659
|
-
|
|
3660
|
-
? AbortSignal.any([signal, AbortSignal.timeout(timeout)])
|
|
3661
|
-
: AbortSignal.timeout(timeout)
|
|
3662
|
-
: signal;
|
|
3753
|
+
const budget = timeout ? timeoutSignal(timeout) : undefined;
|
|
3754
|
+
const attemptSignal = budget && signal ? anySignal([signal, budget]) : (budget ?? signal);
|
|
3663
3755
|
let response: Response;
|
|
3664
3756
|
try {
|
|
3665
3757
|
response = await doFetch(context.url, {
|
|
@@ -3672,6 +3764,10 @@ async function send(
|
|
|
3672
3764
|
body: payload,
|
|
3673
3765
|
});
|
|
3674
3766
|
} catch (error) {
|
|
3767
|
+
// Decided before any await, when no timer can have fired since \`fetch\` rejected: an
|
|
3768
|
+
// aborted budget means this attempt timed out. The abort reason's name is no
|
|
3769
|
+
// evidence, because Chrome 103 to 123 abort a timeout with \`AbortError\`.
|
|
3770
|
+
const timedOut = timeout !== undefined && budget?.aborted && !signal?.aborted;
|
|
3675
3771
|
if (
|
|
3676
3772
|
attempt < maxAttempts &&
|
|
3677
3773
|
!signal?.aborted &&
|
|
@@ -3682,14 +3778,7 @@ async function send(
|
|
|
3682
3778
|
}
|
|
3683
3779
|
// Our timeout fired (never the caller's own abort \u2014 that rethrows untouched):
|
|
3684
3780
|
// wrap the bare DOMException with the context a log line needs.
|
|
3685
|
-
if (
|
|
3686
|
-
timeout &&
|
|
3687
|
-
!signal?.aborted &&
|
|
3688
|
-
error instanceof DOMException &&
|
|
3689
|
-
error.name === 'TimeoutError'
|
|
3690
|
-
) {
|
|
3691
|
-
throw new TimeoutError(op.id, timeout, attempt);
|
|
3692
|
-
}
|
|
3781
|
+
if (timedOut) throw new TimeoutError(op.id, timeout, attempt);
|
|
3693
3782
|
throw error;
|
|
3694
3783
|
}
|
|
3695
3784
|
// Reverse order: the last-registered middleware wraps closest to the network (onion).
|
|
@@ -3919,6 +4008,7 @@ type Capabilities = SendCapabilities & {
|
|
|
3919
4008
|
args?: OperationArgs,
|
|
3920
4009
|
init?: RequestOptions
|
|
3921
4010
|
) => Promise<{ page: unknown; linkHeader: string | null; url: string }>,
|
|
4011
|
+
spec: PaginationSpec,
|
|
3922
4012
|
args?: OperationArgs,
|
|
3923
4013
|
init?: RequestOptions
|
|
3924
4014
|
) => AsyncGenerator<unknown>;
|
|
@@ -4366,11 +4456,12 @@ function createClientCore<
|
|
|
4366
4456
|
client[name] =
|
|
4367
4457
|
spec === undefined
|
|
4368
4458
|
? method
|
|
4369
|
-
: spec.style === 'link'
|
|
4459
|
+
: spec.style === 'link' || spec.style === 'body-link'
|
|
4370
4460
|
? Object.assign(method, {
|
|
4371
4461
|
pages: (args?: OperationArgs, init?: RequestOptions) =>
|
|
4372
4462
|
paginateCapability(caps, op).pagesByLink(
|
|
4373
4463
|
linkPageCall(config, op, caps),
|
|
4464
|
+
spec,
|
|
4374
4465
|
inputOf(op, args ?? {}, config),
|
|
4375
4466
|
init
|
|
4376
4467
|
),
|
|
@@ -4510,9 +4601,9 @@ async function* pages<TPage>(
|
|
|
4510
4601
|
}
|
|
4511
4602
|
cursor = next;
|
|
4512
4603
|
}
|
|
4513
|
-
} else if (spec.style === 'link') {
|
|
4514
|
-
//
|
|
4515
|
-
// cannot carry \u2014 the client wires those operations to \`pagesByLink
|
|
4604
|
+
} else if (spec.style === 'link' || spec.style === 'body-link') {
|
|
4605
|
+
// Link iteration needs the response's \`Link\` header and the page URL, which the
|
|
4606
|
+
// parsed-page \`call\` cannot carry \u2014 the client wires those operations to \`pagesByLink\`.
|
|
4516
4607
|
throw new Error('link-style pagination iterates via pagesByLink');
|
|
4517
4608
|
} else {
|
|
4518
4609
|
// Coerce the starting position to a number: a caller may pass \`query[spec.param]\` as a
|
|
@@ -4561,7 +4652,7 @@ async function* items<TItem>(
|
|
|
4561
4652
|
|
|
4562
4653
|
/**
|
|
4563
4654
|
* The per-page call the \`link\`-style iterators drive: the parsed page plus the raw
|
|
4564
|
-
* \`Link\` header and the page's own URL (for resolving a relative
|
|
4655
|
+
* \`Link\` header and the page's own URL (for resolving a relative next-page target).
|
|
4565
4656
|
*/
|
|
4566
4657
|
type LinkPageCall = (
|
|
4567
4658
|
args?: OperationArgs,
|
|
@@ -4584,25 +4675,32 @@ function linkNext(header: string | null): string | undefined {
|
|
|
4584
4675
|
}
|
|
4585
4676
|
|
|
4586
4677
|
/**
|
|
4587
|
-
* Iterate a \`link\`-style operation's pages: follow the
|
|
4588
|
-
*
|
|
4589
|
-
*
|
|
4678
|
+
* Iterate a \`link\`- or \`body-link\`-style operation's pages: follow the next page's URL \u2014
|
|
4679
|
+
* the \`Link\` header's \`rel="next"\` target (\`link\`), or the value at the \`nextLink\` pointer
|
|
4680
|
+
* (\`body-link\`) \u2014 by merging ITS query params into the next call. Every page goes through
|
|
4681
|
+
* the same declared endpoint, so auth, middleware, and \`serverUrl\` handling apply
|
|
4590
4682
|
* unchanged, and credentials can never be handed to a cross-origin \`next\` URL.
|
|
4591
|
-
* Stops when no
|
|
4592
|
-
*
|
|
4683
|
+
* Stops when there is no next URL (\`body-link\`: \`undefined\`/\`null\`/\`''\`); throws when a
|
|
4684
|
+
* \`nextLink\` value is not a string, or when the link does not advance (the same target
|
|
4685
|
+
* twice, or a self-link \u2014 an infinite-loop guard).
|
|
4593
4686
|
*/
|
|
4594
4687
|
async function* pagesByLink<TPage>(
|
|
4595
4688
|
call: LinkPageCall,
|
|
4689
|
+
spec: PaginationSpec,
|
|
4596
4690
|
args: OperationArgs = {},
|
|
4597
4691
|
init?: RequestOptions
|
|
4598
4692
|
): AsyncGenerator<TPage> {
|
|
4693
|
+
const pointer = spec.style === 'body-link' ? spec.nextLink : undefined;
|
|
4599
4694
|
let query = args.query;
|
|
4600
4695
|
let previous: string | undefined;
|
|
4601
4696
|
while (true) {
|
|
4602
4697
|
const { page, linkHeader, url } = await call({ ...args, query }, init);
|
|
4603
4698
|
yield page as TPage;
|
|
4604
|
-
const target = linkNext(linkHeader);
|
|
4605
|
-
if (target === undefined) return;
|
|
4699
|
+
const target = pointer === undefined ? linkNext(linkHeader) : resolvePointer(page, pointer);
|
|
4700
|
+
if (target === undefined || target === null || target === '') return;
|
|
4701
|
+
if (typeof target !== 'string') {
|
|
4702
|
+
throw new Error(\`Pagination link at \${pointer} is not a string\`);
|
|
4703
|
+
}
|
|
4606
4704
|
// A relative target resolves against the page's own URL (RFC 8288 \xA73.1) \u2014 which may
|
|
4607
4705
|
// itself be relative (relative \`serverUrl\`, mocked fetch), so both resolve against a
|
|
4608
4706
|
// placeholder origin. It never reaches the wire: only the target's query params
|
|
@@ -4633,7 +4731,7 @@ async function* itemsByLink<TItem>(
|
|
|
4633
4731
|
args?: OperationArgs,
|
|
4634
4732
|
init?: RequestOptions
|
|
4635
4733
|
): AsyncGenerator<TItem> {
|
|
4636
|
-
for await (const page of pagesByLink(call, args, init)) {
|
|
4734
|
+
for await (const page of pagesByLink(call, spec, args, init)) {
|
|
4637
4735
|
const pageItems = resolvePointer(page, spec.items);
|
|
4638
4736
|
if (Array.isArray(pageItems)) yield* pageItems as TItem[];
|
|
4639
4737
|
}
|
|
@@ -5443,4 +5541,4 @@ async function runSingle(
|
|
|
5443
5541
|
}
|
|
5444
5542
|
return fail(1, detail);
|
|
5445
5543
|
}
|
|
5446
|
-
}`},S=["ApiError","ApiErrorLike","AuthCredentials","BodyMethod","Capabilities","CliAuthScheme","CliCommand","CliFlag","CliGlobals","CliInvocation","CliWiring","Client","ClientConfig","ClientCore","CommandContext","CommandSource","CustomCommand","Envelope","EnvelopeResult","EnvelopeResultForKnownInit","FRAME_DELIMITER","GLOBAL_FLAGS","HeadersOf","IDEMPOTENT_METHODS","LAYERS","LAYER_OF","LinkPageCall","Middleware","NoRequiredKeys","OperationArgs","OperationContext","OperationDescriptor","OperationMethodIdentity","OpsShape","PageOf","Paginated","PaginationSpec","ParamSpec","ParseAs","QueryStyle","QueryValue","RequestContext","RequestOptions","ResolvedCommand","ResponseHeaderSpec","Result","RetryConfig","RetryContext","RetryStrategy","SecuritySpec","SendCapabilities","ServerSentEvent","SseOptions","SseParseError","TRANSIENT_STATUS","ThrowMethod","TimeoutError","TokenProvider","abortError","acceptFor","buildUrl","callInputs","coerceResponseHeader","commandContract","constantCase","createClientCore","defaultRetryOn","encodeBase64","encodeReserved","execute","groupSlug","inputOf","invokedName","isConfigured","items","itemsByLink","kindFor","linkNext","linkPageCall","loadBody","mergeSetup","middlewareChain","namespaceArgs","normalizeCommands","oneLine","pageCall","pages","pagesByLink","paginateCapability","parse","parseInvocation","parseSseFrame","prepareRequest","queryStyles","readEnvelopeHeaders","readError","redactHeaders","renderComposedHelp","renderHelp","resolveAuth","resolvePointer","resolveToken","retryDelay","runCli","runSingle","runSources","send","shadowedCommandName","sleep","splitArgs","sse","stringHeaders","substitutePath","toFormData","toHeaderRecord"];var j=["client","OPERATIONS","Ops","OperationId","OperationPath","OperationTag","createClient","mergeSetup","ApiError","TimeoutError","configure","use","auth","defaultRetryOn","ClientConfig","RequestOptions","SseOptions","Middleware","OperationDescriptor","ServerSentEvent","Result","Envelope","EnvelopeResult","TokenProvider","__redoclySetup"],$=["z","http","HttpResponse","handlers","faker","queryOptions","useSWR","useSWRMutation","__Writable"],
|
|
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.6.0",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.63.0"},peerDependencies:{typescript:">=5.5.0"},peerDependenciesMeta:{typescript:{optional:!0}},devDependencies:{typescript:"6.0.2"},files:["lib","eject-assets"]};var ee=A.version;function T(e){let n=/^(\d+)\.(\d+)\.(\d+)(?:[-+].*)?$/.exec(e.trim());return n===null?void 0:[Number(n[1]),Number(n[2]),Number(n[3])]}function v(e,n){return e[0]-n[0]||e[1]-n[1]||e[2]-n[2]}function ne(e,n){let o=/^[\^~]|^>=/.exec(n.trim())?.[0]??"",r=T(n.trim().slice(o.length)),a=T(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,4 +4,4 @@ import { dirname as __pathDirname } from 'node:path';
|
|
|
4
4
|
const require = __createRequire(import.meta.url);
|
|
5
5
|
var __filename = __fileURLToPath(import.meta.url);
|
|
6
6
|
var __dirname = __pathDirname(__filename);
|
|
7
|
-
import{c as r}from"./
|
|
7
|
+
import{c as r}from"./ACMV5RZA.js";var s="components",p="paths",i="webhooks",O="x-webhooks",c="channels",f="operations";function e(o,n){if(r(o)){n(o);for(let t of Object.keys(o))e(o[t],n)}else if(Array.isArray(o))for(let t of o)e(t,n)}function S(o){return o.startsWith(`#/${s}/`)}export{s as a,p as b,i as c,O as d,c as e,f,e as g,S as h};
|