@kubb/ast 5.0.0-beta.82 → 5.0.0-beta.85
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/README.md +11 -8
- package/dist/index.cjs +178 -180
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +138 -116
- package/dist/index.js +176 -181
- package/dist/index.js.map +1 -1
- package/dist/{types-XcYJovdT.d.ts → types-BvAfoVB3.d.ts} +11 -45
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1720,12 +1720,12 @@ type FileNode<TMeta extends object = object> = BaseNode & {
|
|
|
1720
1720
|
meta?: TMeta;
|
|
1721
1721
|
/**
|
|
1722
1722
|
* Optional banner prepended to the generated file content.
|
|
1723
|
-
* Accepts `null` so `resolver.
|
|
1723
|
+
* Accepts `null` so `resolver.default.banner()` results can be passed directly.
|
|
1724
1724
|
*/
|
|
1725
1725
|
banner?: string | null;
|
|
1726
1726
|
/**
|
|
1727
1727
|
* Optional footer appended to the generated file content.
|
|
1728
|
-
* Accepts `null` so `resolver.
|
|
1728
|
+
* Accepts `null` so `resolver.default.footer()` results can be passed directly.
|
|
1729
1729
|
*/
|
|
1730
1730
|
footer?: string | null;
|
|
1731
1731
|
/**
|
|
@@ -1830,22 +1830,6 @@ type UserFileNode<TMeta extends object = object> = Omit<FileNode<TMeta>, 'kind'
|
|
|
1830
1830
|
*/
|
|
1831
1831
|
declare function createFile<TMeta extends object = object>(input: UserFileNode<TMeta>): FileNode<TMeta>;
|
|
1832
1832
|
//#endregion
|
|
1833
|
-
//#region ../../internals/utils/src/promise.d.ts
|
|
1834
|
-
/**
|
|
1835
|
-
* Container that switches between an eager `Array<T>` and a lazy `AsyncIterable<T>`.
|
|
1836
|
-
*
|
|
1837
|
-
* `Array<T>` by default. With `Stream` set to `true` it becomes `AsyncIterable<T>`, so large
|
|
1838
|
-
* collections can be produced lazily without holding every item in memory. Pairs with
|
|
1839
|
-
* {@link arrayToAsyncIterable}, which lifts a plain array into the streaming form.
|
|
1840
|
-
*
|
|
1841
|
-
* @example
|
|
1842
|
-
* ```ts
|
|
1843
|
-
* type Eager = Streamable<number> // Array<number>
|
|
1844
|
-
* type Lazy = Streamable<number, true> // AsyncIterable<number>
|
|
1845
|
-
* ```
|
|
1846
|
-
*/
|
|
1847
|
-
type Streamable<T, Stream extends boolean = false> = Stream extends true ? AsyncIterable<T> : Array<T>;
|
|
1848
|
-
//#endregion
|
|
1849
1833
|
//#region src/nodes/parameter.d.ts
|
|
1850
1834
|
type ParameterLocation = 'path' | 'query' | 'header' | 'cookie';
|
|
1851
1835
|
/**
|
|
@@ -2243,9 +2227,6 @@ type InputMeta = {
|
|
|
2243
2227
|
* Input AST node that contains all schemas and operations for one API document.
|
|
2244
2228
|
* Produced by the adapter and consumed by all Kubb plugins.
|
|
2245
2229
|
*
|
|
2246
|
-
* `Stream` switches `schemas` and `operations` between eager `Array`s (the default) and lazy
|
|
2247
|
-
* `AsyncIterable`s. The streaming variant `InputNode<true>` yields nodes one at a time.
|
|
2248
|
-
*
|
|
2249
2230
|
* @example
|
|
2250
2231
|
* ```ts
|
|
2251
2232
|
* const input: InputNode = {
|
|
@@ -2255,15 +2236,8 @@ type InputMeta = {
|
|
|
2255
2236
|
* meta: { circularNames: [], enumNames: [] },
|
|
2256
2237
|
* }
|
|
2257
2238
|
* ```
|
|
2258
|
-
*
|
|
2259
|
-
* @example Streaming variant for large specs
|
|
2260
|
-
* ```ts
|
|
2261
|
-
* for await (const schema of inputNode.schemas) {
|
|
2262
|
-
* // only this one SchemaNode is live here. Previous ones are GC-eligible
|
|
2263
|
-
* }
|
|
2264
|
-
* ```
|
|
2265
2239
|
*/
|
|
2266
|
-
type InputNode
|
|
2240
|
+
type InputNode = BaseNode & {
|
|
2267
2241
|
/**
|
|
2268
2242
|
* Node kind.
|
|
2269
2243
|
*/
|
|
@@ -2271,11 +2245,11 @@ type InputNode<Stream extends boolean = false> = BaseNode & {
|
|
|
2271
2245
|
/**
|
|
2272
2246
|
* All schema nodes in the document.
|
|
2273
2247
|
*/
|
|
2274
|
-
schemas:
|
|
2248
|
+
schemas: Array<SchemaNode>;
|
|
2275
2249
|
/**
|
|
2276
2250
|
* All operation nodes in the document.
|
|
2277
2251
|
*/
|
|
2278
|
-
operations:
|
|
2252
|
+
operations: Array<OperationNode>;
|
|
2279
2253
|
/**
|
|
2280
2254
|
* Document metadata populated by the adapter.
|
|
2281
2255
|
*/
|
|
@@ -2284,26 +2258,18 @@ type InputNode<Stream extends boolean = false> = BaseNode & {
|
|
|
2284
2258
|
/**
|
|
2285
2259
|
* Definition for the {@link InputNode}.
|
|
2286
2260
|
*/
|
|
2287
|
-
declare const inputDef: NodeDef<InputNode
|
|
2261
|
+
declare const inputDef: NodeDef<InputNode, Partial<Omit<InputNode, "kind">>>;
|
|
2288
2262
|
/**
|
|
2289
|
-
* Creates an `InputNode
|
|
2290
|
-
*
|
|
2291
|
-
* `schemas`/`operations`. Both variants get the defaulted `meta`.
|
|
2263
|
+
* Creates an `InputNode`, defaulting `schemas`/`operations` to empty arrays and `meta` per
|
|
2264
|
+
* {@link inputDef}.
|
|
2292
2265
|
*
|
|
2293
|
-
* @example
|
|
2266
|
+
* @example
|
|
2294
2267
|
* ```ts
|
|
2295
2268
|
* const input = createInput()
|
|
2296
2269
|
* // { kind: 'Input', schemas: [], operations: [] }
|
|
2297
2270
|
* ```
|
|
2298
|
-
*
|
|
2299
|
-
* @example Streaming
|
|
2300
|
-
* ```ts
|
|
2301
|
-
* const node = createInput({ stream: true, schemas: schemasIterable, operations: operationsIterable, meta: { title: 'My API' } })
|
|
2302
|
-
* ```
|
|
2303
2271
|
*/
|
|
2304
|
-
declare function createInput
|
|
2305
|
-
stream?: Stream;
|
|
2306
|
-
}): InputNode<Stream>;
|
|
2272
|
+
declare function createInput(overrides?: Partial<Omit<InputNode, 'kind'>>): InputNode;
|
|
2307
2273
|
//#endregion
|
|
2308
2274
|
//#region src/nodes/output.d.ts
|
|
2309
2275
|
/**
|
|
@@ -2900,4 +2866,4 @@ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) =
|
|
|
2900
2866
|
declare function createPrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T>;
|
|
2901
2867
|
//#endregion
|
|
2902
2868
|
export { importDef as $, DistributiveOmit as $t, ResponseNode as A, ArrowFunctionNode as At, createParameter as B, breakDef as Bt, inputDef as C, schemaDef as Ct, OperationNode as D, propertyDef as Dt, HttpOperationNode as E, createProperty as Et, createRequestBody as F, JSDocNode as Ft, SourceNode as G, createFunction as Gt, ExportNode as H, createArrowFunction as Ht, requestBodyDef as I, JsxNode as It, createFile as J, createType as Jt, UserFileNode as K, createJsx as Kt, ParameterLocation as L, TextNode as Lt, createResponse as M, CodeNode as Mt, responseDef as N, ConstNode as Nt, createOperation as O, InferSchemaNode as Ot, RequestBodyNode as P, FunctionNode as Pt, fileDef as Q, typeDef as Qt, ParameterNode as R, TypeNode as Rt, createInput as S, createSchema as St, HttpMethod as T, UserPropertyNode as Tt, FileNode as U, createBreak as Ut, parameterDef as V, constDef as Vt, ImportNode as W, createConst as Wt, createSource as X, jsxDef as Xt, createImport as Y, functionDef as Yt, exportDef as Z, textDef as Zt, OutputNode as _, SchemaType as _t, Enforce as a, SchemaDialect as an, DateSchemaNode as at, InputMeta as b, UnionSchemaNode as bt, composeMacros as c, IntersectionSchemaNode as ct, Visitor as d, PrimitiveSchemaType as dt, NodeDef as en, sourceDef as et, VisitorContext as f, RefSchemaNode as ft, Node as g, SchemaNodeByType as gt, walk as h, SchemaNode as ht, createPrinter as i, Dialect as in, ArraySchemaNode as it, StatusCode as j, BreakNode as jt, operationDef as k, ParserOptions as kt, defineMacro as l, NumberSchemaNode as lt, transform as m, ScalarSchemaType as mt, PrinterFactoryOptions as n, BaseNode as nn, contentDef as nt, Macro as o, defineDialect as on, DatetimeSchemaNode as ot, collect as p, ScalarSchemaNode as pt, createExport as q, createText as qt, PrinterPartial as r, NodeKind as rn, createContent as rt, applyMacros as s, schemaTypes as sn, EnumSchemaNode as st, Printer as t, defineNode as tn, ContentNode as tt, ParentOf as u, ObjectSchemaNode as ut, createOutput as v, StringSchemaNode as vt, GenericOperationNode as w, PropertyNode as wt, InputNode as x, UrlSchemaNode as xt, outputDef as y, TimeSchemaNode as yt, ParameterStyle as z, arrowFunctionDef as zt };
|
|
2903
|
-
//# sourceMappingURL=types-
|
|
2869
|
+
//# sourceMappingURL=types-BvAfoVB3.d.ts.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $t as DistributiveOmit, A as ResponseNode, At as ArrowFunctionNode, D as OperationNode, E as HttpOperationNode, Ft as JSDocNode, G as SourceNode, H as ExportNode, It as JsxNode, K as UserFileNode, L as ParameterLocation, Lt as TextNode, Mt as CodeNode, Nt as ConstNode, Ot as InferSchemaNode, P as RequestBodyNode, Pt as FunctionNode, R as ParameterNode, Rt as TypeNode, T as HttpMethod, U as FileNode, W as ImportNode, _ as OutputNode, _t as SchemaType, a as Enforce, an as SchemaDialect, at as DateSchemaNode, b as InputMeta, bt as UnionSchemaNode, ct as IntersectionSchemaNode, d as Visitor, dt as PrimitiveSchemaType, en as NodeDef, f as VisitorContext, ft as RefSchemaNode, g as Node, gt as SchemaNodeByType, ht as SchemaNode, in as Dialect, it as ArraySchemaNode, j as StatusCode, jt as BreakNode, kt as ParserOptions, lt as NumberSchemaNode, mt as ScalarSchemaType, n as PrinterFactoryOptions, o as Macro, ot as DatetimeSchemaNode, pt as ScalarSchemaNode, r as PrinterPartial, rn as NodeKind, st as EnumSchemaNode, t as Printer, tt as ContentNode, u as ParentOf, ut as ObjectSchemaNode, vt as StringSchemaNode, w as GenericOperationNode, wt as PropertyNode, x as InputNode, xt as UrlSchemaNode, yt as TimeSchemaNode, z as ParameterStyle } from "./types-
|
|
1
|
+
import { $t as DistributiveOmit, A as ResponseNode, At as ArrowFunctionNode, D as OperationNode, E as HttpOperationNode, Ft as JSDocNode, G as SourceNode, H as ExportNode, It as JsxNode, K as UserFileNode, L as ParameterLocation, Lt as TextNode, Mt as CodeNode, Nt as ConstNode, Ot as InferSchemaNode, P as RequestBodyNode, Pt as FunctionNode, R as ParameterNode, Rt as TypeNode, T as HttpMethod, U as FileNode, W as ImportNode, _ as OutputNode, _t as SchemaType, a as Enforce, an as SchemaDialect, at as DateSchemaNode, b as InputMeta, bt as UnionSchemaNode, ct as IntersectionSchemaNode, d as Visitor, dt as PrimitiveSchemaType, en as NodeDef, f as VisitorContext, ft as RefSchemaNode, g as Node, gt as SchemaNodeByType, ht as SchemaNode, in as Dialect, it as ArraySchemaNode, j as StatusCode, jt as BreakNode, kt as ParserOptions, lt as NumberSchemaNode, mt as ScalarSchemaType, n as PrinterFactoryOptions, o as Macro, ot as DatetimeSchemaNode, pt as ScalarSchemaNode, r as PrinterPartial, rn as NodeKind, st as EnumSchemaNode, t as Printer, tt as ContentNode, u as ParentOf, ut as ObjectSchemaNode, vt as StringSchemaNode, w as GenericOperationNode, wt as PropertyNode, x as InputNode, xt as UrlSchemaNode, yt as TimeSchemaNode, z as ParameterStyle } from "./types-BvAfoVB3.js";
|
|
2
2
|
export type { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode, Dialect, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeDef, NodeKind, NumberSchemaNode, ObjectSchemaNode, OperationNode, OutputNode, ParameterLocation, ParameterNode, ParameterStyle, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, RequestBodyNode, ResponseNode, ScalarSchemaNode, ScalarSchemaType, SchemaDialect, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/ast",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.85",
|
|
4
4
|
"description": "Spec-agnostic AST layer for Kubb. Defines the node tree, visitor pattern, factory functions, and type guards used across all code generation plugins.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ast",
|