@kubb/ast 5.5.5 → 5.6.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/dist/index.cjs +254 -262
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +31 -4
- package/dist/index.js +253 -263
- package/dist/index.js.map +1 -1
- package/dist/{types-D10wBFnV.d.ts → types-NNGUervC.d.ts} +928 -959
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __name, t as __exportAll } from "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as createJsx, $t as InferSchemaNode, A as createFile, At as EnumSchemaNode, B as ConstNode, Bt as SchemaType, C as inputDef, Ct as ParameterNode, D as SourceNode, Dt as ArraySchemaNode, E as ImportNode, Et as parameterDef, F as importDef, Ft as RefSchemaNode, G as TypeNode, Gt as createSchema, H as JSDocNode, Ht as TimeSchemaNode, I as sourceDef, It as ScalarSchemaNode, J as constDef, Jt as createProperty, K as arrowFunctionDef, Kt as schemaDef, L as ArrowFunctionNode, Lt as ScalarSchemaType, M as createSource, Mt as NumberSchemaNode, N as exportDef, Nt as ObjectSchemaNode, O as UserFileNode, Ot as DateSchemaNode, P as fileDef, Pt as PrimitiveSchemaType, Q as createFunction, Qt as DateTypeOptions, R as BreakNode, Rt as SchemaNode, S as createInput, St as ParameterLocation, T as FileNode, Tt as createParameter, U as JsxNode, Ut as UnionSchemaNode, V as FunctionNode, Vt as StringSchemaNode, W as TextNode, Wt as UrlSchemaNode, X as createBreak, Xt as DateOnlyTypeValue, Y as createArrowFunction, Yt as propertyDef, Z as createConst, Zt as DateTimeTypeValue, _ as OutputNode, _t as createRequestBody, a as Enforce, an as NodeKind, at as typeDef, b as InputMeta, bt as contentDef, c as composeMacros, ct as HttpOperationNode, d as Visitor, dt as operationDef, en as ParserOptions, et as createText, f as VisitorContext, ft as ResponseNode, g as Node, gt as RequestBodyNode, h as transform, ht as responseDef, i as createPrinter, in as BaseNode, it as textDef, j as createImport, jt as IntersectionSchemaNode, k as createExport, kt as DatetimeSchemaNode, l as defineMacro, lt as OperationNode, m as collectSync, mt as createResponse, n as PrinterFactoryOptions, nn as NodeDef, nt as functionDef, o as Macro, on as schemaTypes, ot as GenericOperationNode, p as collect, pt as StatusCode, q as breakDef, qt as PropertyNode, r as PrinterPartial, rn as defineNode, rt as jsxDef, s as applyMacros, st as HttpMethod, t as Printer, tn as DistributiveOmit, tt as createType, u as ParentOf, ut as createOperation, v as createOutput, vt as requestBodyDef, w as ExportNode, wt as ParameterStyle, x as InputNode, xt as createContent, y as outputDef, yt as ContentNode, z as CodeNode, zt as SchemaNodeByType } from "./types-NNGUervC.js";
|
|
3
3
|
//#region src/guards.d.ts
|
|
4
4
|
/**
|
|
5
5
|
* Narrows a `SchemaNode` to the variant that matches `type`.
|
|
@@ -54,6 +54,21 @@ export declare function extractStringsFromNodes(nodes: Array<CodeNode> | undefin
|
|
|
54
54
|
* `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Order', targetName: 'OrderSchema' }) // 'OrderSchema'`
|
|
55
55
|
*/
|
|
56
56
|
export declare function resolveRefName(node: SchemaNode | null | undefined): string | null;
|
|
57
|
+
/**
|
|
58
|
+
* Merges a ref node with its resolved schema, giving the fields set at the usage site precedence.
|
|
59
|
+
*
|
|
60
|
+
* Every field on the ref except `kind`, `type`, `name`, `ref`, and `schema` overrides the same field
|
|
61
|
+
* of the resolved `schema` (for example `description`, `nullable`, `readOnly`, `deprecated`). Fields
|
|
62
|
+
* left `undefined` on the ref do not shadow the resolved schema. A ref without a resolved `schema`
|
|
63
|
+
* is returned as is.
|
|
64
|
+
*
|
|
65
|
+
* @example
|
|
66
|
+
* ```ts
|
|
67
|
+
* const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A pet', schema: petSchema })
|
|
68
|
+
* mergeRefWithSchema(ref) // petSchema's fields with description 'A pet'
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
export declare function mergeRefWithSchema(node: RefSchemaNode): SchemaNode;
|
|
57
72
|
/**
|
|
58
73
|
* Returns `true` when a schema is a bare ref without modifiers, metadata, or omit keys.
|
|
59
74
|
*
|
|
@@ -63,6 +78,19 @@ export declare function resolveRefName(node: SchemaNode | null | undefined): str
|
|
|
63
78
|
export declare function isBareRef(node: SchemaNode | null | undefined, keysToOmit?: Array<string> | null): boolean;
|
|
64
79
|
//#endregion
|
|
65
80
|
//#region src/utils/schemaGraph.d.ts
|
|
81
|
+
/**
|
|
82
|
+
* Collects the names of every schema a node's subtree references, resolved with `resolveRefName`.
|
|
83
|
+
* Each ref contributes its name only, so the schema it points to is never traversed. The walk is
|
|
84
|
+
* memoized by node identity, which lets `findCircularSchemas` and `containsCircularRef` share one
|
|
85
|
+
* scan per schema.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* collectSchemaRefs(petSchema)
|
|
90
|
+
* // Set { 'Category', 'Tag' }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
export declare const collectSchemaRefs: (key: SchemaNode) => ReadonlySet<string>;
|
|
66
94
|
/**
|
|
67
95
|
* Collects the de-duplicated target names of every pointer-carrying ref in a node's subtree, in
|
|
68
96
|
* first-occurrence order. The walk is memoized by node identity, so the subtree is scanned once and
|
|
@@ -71,8 +99,7 @@ export declare function isBareRef(node: SchemaNode | null | undefined, keysToOmi
|
|
|
71
99
|
*
|
|
72
100
|
* Only refs that carry a `$ref` pointer count, so a synthesized ref pointing at a sibling in the
|
|
73
101
|
* same file (a union member created by name) is left out. That leaves exactly the set
|
|
74
|
-
* `resolver.imports` emits.
|
|
75
|
-
* {@link collectReferencedSchemaNames}, which returns an unordered set for graph analysis.
|
|
102
|
+
* `resolver.imports` emits.
|
|
76
103
|
*
|
|
77
104
|
* @example
|
|
78
105
|
* ```ts
|
|
@@ -278,7 +305,7 @@ export declare const nodeDefs: (NodeDef<InputNode, Partial<Omit<InputNode, "kind
|
|
|
278
305
|
type: "ipv6";
|
|
279
306
|
}) | ScalarSchemaNode, "kind">> | NodeDef<PropertyNode, Pick<PropertyNode, "schema" | "name"> & Partial<Omit<PropertyNode, "schema" | "kind" | "name">>> | NodeDef<ParameterNode, Pick<ParameterNode, "schema" | "name" | "in"> & Partial<Omit<ParameterNode, "schema" | "kind" | "name" | "in">>> | NodeDef<ConstNode, Omit<ConstNode, "kind">> | NodeDef<TypeNode, Omit<TypeNode, "kind">> | NodeDef<FunctionNode, Omit<FunctionNode, "kind">> | NodeDef<ArrowFunctionNode, Omit<ArrowFunctionNode, "kind">> | NodeDef<TextNode, string> | NodeDef<BreakNode, void> | NodeDef<JsxNode, string> | NodeDef<ImportNode, Omit<ImportNode, "kind">> | NodeDef<ExportNode, Omit<ExportNode, "kind">> | NodeDef<SourceNode, Omit<SourceNode, "kind">> | NodeDef<FileNode<object>, Omit<FileNode<object>, "kind">>)[];
|
|
280
307
|
declare namespace exports_d_exports {
|
|
281
|
-
export { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateOnlyTypeValue, DateSchemaNode, DateTimeTypeValue, DateTypeOptions, DatetimeSchemaNode, 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, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext, applyMacros, arrowFunctionDef, breakDef, collect, collectImportedRefNames, collectSync, collectUsedSchemaNames, composeMacros, constDef, contentDef, createPrinter, defineMacro, defineNode, exportDef, extractStringsFromNodes, factory_d_exports as factory, fileDef, findCircularSchemas, findCircularSchemasFromGraph, functionDef, getSchemaLiteralValues, importDef, inferDiscriminatorPropertyName, inputDef, isBareRef, isHttpOperationNode, jsxDef, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, resolveRefName, resolveSchemaProperties, responseDef, schemaDef, schemaTypes, sourceDef, textDef, transform, typeDef };
|
|
308
|
+
export { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateOnlyTypeValue, DateSchemaNode, DateTimeTypeValue, DateTypeOptions, DatetimeSchemaNode, 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, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext, applyMacros, arrowFunctionDef, breakDef, collect, collectImportedRefNames, collectSchemaRefs, collectSync, collectUsedSchemaNames, composeMacros, constDef, contentDef, createPrinter, defineMacro, defineNode, exportDef, extractStringsFromNodes, factory_d_exports as factory, fileDef, findCircularSchemas, findCircularSchemasFromGraph, functionDef, getSchemaLiteralValues, importDef, inferDiscriminatorPropertyName, inputDef, isBareRef, isHttpOperationNode, jsxDef, mergeRefWithSchema, narrowSchema, nodeDefs, operationDef, optionality, outputDef, parameterDef, propertyDef, requestBodyDef, resolveRefName, resolveSchemaProperties, responseDef, schemaDef, schemaTypes, sourceDef, textDef, transform, typeDef };
|
|
282
309
|
}
|
|
283
310
|
//#endregion
|
|
284
311
|
export { type ArraySchemaNode, type ArrowFunctionNode, type BreakNode, type CodeNode, type ConstNode, type ContentNode, type DateOnlyTypeValue, type DateSchemaNode, type DateTimeTypeValue, type DateTypeOptions, type DatetimeSchemaNode, type DistributiveOmit, type Enforce, type EnumSchemaNode, type ExportNode, type FileNode, type FunctionNode, type GenericOperationNode, type HttpMethod, type HttpOperationNode, type ImportNode, type InferSchemaNode, type InputMeta, type InputNode, type IntersectionSchemaNode, type JSDocNode, type JsxNode, type Macro, type Node, type NodeDef, type NodeKind, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, type OutputNode, type ParameterLocation, type ParameterNode, type ParameterStyle, type ParentOf, type ParserOptions, type PrimitiveSchemaType, type Printer, type PrinterFactoryOptions, type PrinterPartial, type PropertyNode, type RefSchemaNode, type RequestBodyNode, type ResponseNode, type ScalarSchemaNode, type ScalarSchemaType, type SchemaNode, type SchemaNodeByType, type SchemaType, type SourceNode, type StatusCode, type StringSchemaNode, type TextNode, type TimeSchemaNode, type TypeNode, type UnionSchemaNode, type UrlSchemaNode, type UserFileNode, type Visitor, type VisitorContext, applyMacros, arrowFunctionDef, exports_d_exports as ast, breakDef, collect, collectSync, composeMacros, constDef, contentDef, createPrinter, defineMacro, defineNode, exportDef, factory_d_exports as factory, fileDef, functionDef, importDef, inputDef, jsxDef, operationDef, outputDef, parameterDef, propertyDef, requestBodyDef, responseDef, schemaDef, schemaTypes, sourceDef, textDef, transform, typeDef };
|