@kubb/ast 5.15.1 → 5.15.2
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 +120 -234
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +48 -202
- package/dist/index.d.ts +48 -202
- package/dist/index.js +120 -230
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -22,14 +22,6 @@ export declare const nodeKinds: {
|
|
|
22
22
|
readonly break: 'Break';
|
|
23
23
|
readonly jsx: 'Jsx';
|
|
24
24
|
};
|
|
25
|
-
/**
|
|
26
|
-
* Traversal depth for AST visitor utilities.
|
|
27
|
-
*
|
|
28
|
-
* - `'shallow'` recurses through every node except nested `Schema` subtrees, which it treats as
|
|
29
|
-
* leaves: a schema node itself is visited, but its children are not.
|
|
30
|
-
* - `'deep'` recursively visits all descendant nodes, including schema subtrees.
|
|
31
|
-
*/
|
|
32
|
-
type VisitorDepth = 'shallow' | 'deep';
|
|
33
25
|
/**
|
|
34
26
|
* Schema type discriminators used by all AST schema nodes.
|
|
35
27
|
*
|
|
@@ -143,6 +135,10 @@ export declare const schemaTypes: {
|
|
|
143
135
|
*/
|
|
144
136
|
readonly never: 'never';
|
|
145
137
|
};
|
|
138
|
+
/**
|
|
139
|
+
* Union of the values of an object type, such as `ValueOf<typeof nodeKinds>` for an `as const` table.
|
|
140
|
+
*/
|
|
141
|
+
type ValueOf<T> = T[keyof T];
|
|
146
142
|
/**
|
|
147
143
|
* `kind` values used by AST nodes.
|
|
148
144
|
*
|
|
@@ -151,7 +147,7 @@ export declare const schemaTypes: {
|
|
|
151
147
|
* const kind: NodeKind = 'Schema'
|
|
152
148
|
* ```
|
|
153
149
|
*/
|
|
154
|
-
type NodeKind =
|
|
150
|
+
type NodeKind = ValueOf<typeof nodeKinds>;
|
|
155
151
|
/**
|
|
156
152
|
* Base shape shared by all AST nodes.
|
|
157
153
|
*
|
|
@@ -221,59 +217,10 @@ type UserPropertyNode = Pick<PropertyNode, 'name' | 'schema'> & Partial<Omit<Pro
|
|
|
221
217
|
* ```
|
|
222
218
|
*/
|
|
223
219
|
declare function createProperty(input: UserPropertyNode): PropertyNode;
|
|
224
|
-
type PrimitiveSchemaType =
|
|
225
|
-
/**
|
|
226
|
-
* Text value.
|
|
227
|
-
*/
|
|
228
|
-
'string' |
|
|
229
|
-
/**
|
|
230
|
-
* Floating-point number.
|
|
231
|
-
*/
|
|
232
|
-
'number' |
|
|
233
220
|
/**
|
|
234
|
-
*
|
|
221
|
+
* Subset of {@link SchemaType} covering the primitives plus `object`, `array`, and `date`; `schemaTypes` documents each.
|
|
235
222
|
*/
|
|
236
|
-
'integer' |
|
|
237
|
-
/**
|
|
238
|
-
* Big integer number.
|
|
239
|
-
*/
|
|
240
|
-
'bigint' |
|
|
241
|
-
/**
|
|
242
|
-
* Boolean value.
|
|
243
|
-
*/
|
|
244
|
-
'boolean' |
|
|
245
|
-
/**
|
|
246
|
-
* Null value.
|
|
247
|
-
*/
|
|
248
|
-
'null' |
|
|
249
|
-
/**
|
|
250
|
-
* Any value.
|
|
251
|
-
*/
|
|
252
|
-
'any' |
|
|
253
|
-
/**
|
|
254
|
-
* Unknown value.
|
|
255
|
-
*/
|
|
256
|
-
'unknown' |
|
|
257
|
-
/**
|
|
258
|
-
* No value (`void`).
|
|
259
|
-
*/
|
|
260
|
-
'void' |
|
|
261
|
-
/**
|
|
262
|
-
* Never value.
|
|
263
|
-
*/
|
|
264
|
-
'never' |
|
|
265
|
-
/**
|
|
266
|
-
* Object value.
|
|
267
|
-
*/
|
|
268
|
-
'object' |
|
|
269
|
-
/**
|
|
270
|
-
* Array value.
|
|
271
|
-
*/
|
|
272
|
-
'array' |
|
|
273
|
-
/**
|
|
274
|
-
* Date value.
|
|
275
|
-
*/
|
|
276
|
-
'date';
|
|
223
|
+
type PrimitiveSchemaType = 'string' | 'number' | 'integer' | 'bigint' | 'boolean' | 'null' | 'any' | 'unknown' | 'void' | 'never' | 'object' | 'array' | 'date';
|
|
277
224
|
/**
|
|
278
225
|
* All schema type strings, one per key of {@link SchemaNodeByType}.
|
|
279
226
|
*/
|
|
@@ -1853,9 +1800,6 @@ type UserFileNode<TMeta extends object = object> = Omit<FileNode<TMeta>, 'kind'
|
|
|
1853
1800
|
* ```
|
|
1854
1801
|
*/
|
|
1855
1802
|
declare function createFile<TMeta extends object = object>(input: UserFileNode<TMeta>): FileNode<TMeta>;
|
|
1856
|
-
/**
|
|
1857
|
-
* A server from the source document, with `{variable}` placeholders filled from their defaults.
|
|
1858
|
-
*/
|
|
1859
1803
|
/**
|
|
1860
1804
|
* A variable declared by a server URL template.
|
|
1861
1805
|
*/
|
|
@@ -1864,6 +1808,9 @@ type InputServerVariable = {
|
|
|
1864
1808
|
enum?: Array<string>;
|
|
1865
1809
|
description?: string;
|
|
1866
1810
|
};
|
|
1811
|
+
/**
|
|
1812
|
+
* A server from the source document, with `{variable}` placeholders filled from their defaults.
|
|
1813
|
+
*/
|
|
1867
1814
|
type InputServer = {
|
|
1868
1815
|
url: string;
|
|
1869
1816
|
description?: string;
|
|
@@ -1887,14 +1834,11 @@ type InputSecurityScheme = {
|
|
|
1887
1834
|
};
|
|
1888
1835
|
/**
|
|
1889
1836
|
* Metadata for an API document, populated by the adapter and available to every generator.
|
|
1890
|
-
*
|
|
1891
|
-
* Computed fields (`circularNames`, `enumNames`) are sets, pre-calculated once during the adapter
|
|
1892
|
-
* pre-scan so generators never need to iterate the full schema list themselves. Every other field
|
|
1893
|
-
* is a plain JSON value.
|
|
1837
|
+
* Every field is a plain JSON value.
|
|
1894
1838
|
*
|
|
1895
1839
|
* @example
|
|
1896
1840
|
* ```ts
|
|
1897
|
-
* const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://api.example.com/v2'
|
|
1841
|
+
* const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://api.example.com/v2' }
|
|
1898
1842
|
* ```
|
|
1899
1843
|
*/
|
|
1900
1844
|
type InputMeta = {
|
|
@@ -1920,28 +1864,6 @@ type InputMeta = {
|
|
|
1920
1864
|
* Vendor extensions (`x-*` keys) from the document root, copied as-is. Absent when the root has none.
|
|
1921
1865
|
*/
|
|
1922
1866
|
extensions?: Record<string, unknown>;
|
|
1923
|
-
/**
|
|
1924
|
-
* Names of schemas that participate in a circular reference chain.
|
|
1925
|
-
* Computed once during the adapter pre-scan, so a generator never has to
|
|
1926
|
-
* call `findCircularSchemas` itself.
|
|
1927
|
-
*
|
|
1928
|
-
* @example Wrap a circular schema in z.lazy()
|
|
1929
|
-
* ```ts
|
|
1930
|
-
* if (meta.circularNames.has(schema.name)) { ... }
|
|
1931
|
-
* ```
|
|
1932
|
-
*/
|
|
1933
|
-
circularNames: ReadonlySet<string>;
|
|
1934
|
-
/**
|
|
1935
|
-
* Names of schemas whose type is `enum`.
|
|
1936
|
-
* Computed once during the adapter pre-scan, so a generator never has to
|
|
1937
|
-
* filter the schema list itself.
|
|
1938
|
-
*
|
|
1939
|
-
* @example Check if a referenced schema is an enum
|
|
1940
|
-
* ```ts
|
|
1941
|
-
* const isEnum = meta.enumNames.has(schemaName)
|
|
1942
|
-
* ```
|
|
1943
|
-
*/
|
|
1944
|
-
enumNames: ReadonlySet<string>;
|
|
1945
1867
|
};
|
|
1946
1868
|
/**
|
|
1947
1869
|
* Input AST node that contains all schemas and operations for one API document.
|
|
@@ -1953,7 +1875,7 @@ type InputMeta = {
|
|
|
1953
1875
|
* kind: 'Input',
|
|
1954
1876
|
* schemas: [],
|
|
1955
1877
|
* operations: [],
|
|
1956
|
-
* meta: {
|
|
1878
|
+
* meta: {},
|
|
1957
1879
|
* }
|
|
1958
1880
|
* ```
|
|
1959
1881
|
*/
|
|
@@ -1976,8 +1898,8 @@ type InputNode = BaseNode & {
|
|
|
1976
1898
|
meta: InputMeta;
|
|
1977
1899
|
};
|
|
1978
1900
|
/**
|
|
1979
|
-
* Creates an `InputNode`, defaulting `schemas`/`operations` to empty arrays and `meta` to empty
|
|
1980
|
-
*
|
|
1901
|
+
* Creates an `InputNode`, defaulting `schemas`/`operations` to empty arrays and `meta` to an empty
|
|
1902
|
+
* object. Every call allocates fresh defaults so no two inputs share them.
|
|
1981
1903
|
*
|
|
1982
1904
|
* @example
|
|
1983
1905
|
* ```ts
|
|
@@ -2008,54 +1930,30 @@ declare namespace index_d_exports$1 {
|
|
|
2008
1930
|
*/
|
|
2009
1931
|
type Node = InputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | RequestBodyNode | ContentNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode;
|
|
2010
1932
|
/**
|
|
2011
|
-
*
|
|
2012
|
-
*
|
|
2013
|
-
* `ParentOf` uses this map to find parent types.
|
|
2014
|
-
*/
|
|
2015
|
-
type ParentNodeMap = [[InputNode, undefined], [OperationNode, InputNode], [RequestBodyNode, OperationNode], [ContentNode, RequestBodyNode | ResponseNode], [SchemaNode, InputNode | ContentNode | SchemaNode | PropertyNode | ParameterNode], [PropertyNode, SchemaNode], [ParameterNode, OperationNode], [ResponseNode, OperationNode]];
|
|
2016
|
-
/**
|
|
2017
|
-
* Resolves the parent node type for a given AST node type.
|
|
2018
|
-
*
|
|
2019
|
-
* Visitor context relies on this so `ctx.parent` is typed for each callback.
|
|
2020
|
-
*
|
|
2021
|
-
* @example
|
|
2022
|
-
* ```ts
|
|
2023
|
-
* type InputParent = ParentOf<InputNode>
|
|
2024
|
-
* // undefined
|
|
2025
|
-
* ```
|
|
2026
|
-
*
|
|
2027
|
-
* @example
|
|
2028
|
-
* ```ts
|
|
2029
|
-
* type PropertyParent = ParentOf<PropertyNode>
|
|
2030
|
-
* // SchemaNode
|
|
2031
|
-
* ```
|
|
1933
|
+
* Traversal depth for AST visitor utilities.
|
|
2032
1934
|
*
|
|
2033
|
-
*
|
|
2034
|
-
*
|
|
2035
|
-
*
|
|
2036
|
-
* // InputNode | ContentNode | SchemaNode | PropertyNode | ParameterNode
|
|
2037
|
-
* ```
|
|
1935
|
+
* - `'shallow'` recurses through every node except nested `Schema` subtrees, which it treats as
|
|
1936
|
+
* leaves: a schema node itself is visited, but its children are not.
|
|
1937
|
+
* - `'deep'` recursively visits all descendant nodes, including schema subtrees.
|
|
2038
1938
|
*/
|
|
2039
|
-
type
|
|
1939
|
+
type VisitorDepth = 'shallow' | 'deep';
|
|
2040
1940
|
/**
|
|
2041
1941
|
* Traversal context passed as the second argument to every visitor callback.
|
|
2042
|
-
* `parent` is typed from the current node type.
|
|
2043
1942
|
*
|
|
2044
1943
|
* @example
|
|
2045
1944
|
* ```ts
|
|
2046
1945
|
* const visitor: Visitor = {
|
|
2047
1946
|
* schema(node, { parent }) {
|
|
2048
|
-
* // parent
|
|
1947
|
+
* // parent is the node that holds this schema, or undefined at the root
|
|
2049
1948
|
* },
|
|
2050
1949
|
* }
|
|
2051
1950
|
* ```
|
|
2052
1951
|
*/
|
|
2053
|
-
type VisitorContext
|
|
1952
|
+
type VisitorContext = {
|
|
2054
1953
|
/**
|
|
2055
|
-
* Parent node of the currently visited node.
|
|
2056
|
-
* For `InputNode`, this is `undefined`.
|
|
1954
|
+
* Parent node of the currently visited node. For the root node, this is `undefined`.
|
|
2057
1955
|
*/
|
|
2058
|
-
parent?:
|
|
1956
|
+
parent?: Node;
|
|
2059
1957
|
};
|
|
2060
1958
|
/**
|
|
2061
1959
|
* Synchronous visitor consumed by `transform`. Each optional callback runs
|
|
@@ -2084,12 +1982,12 @@ type VisitorContext<T extends Node = Node> = {
|
|
|
2084
1982
|
* ```
|
|
2085
1983
|
*/
|
|
2086
1984
|
type Visitor = {
|
|
2087
|
-
input?(node: InputNode, context: VisitorContext
|
|
2088
|
-
operation?(node: OperationNode, context: VisitorContext
|
|
2089
|
-
schema?(node: SchemaNode, context: VisitorContext
|
|
2090
|
-
property?(node: PropertyNode, context: VisitorContext
|
|
2091
|
-
parameter?(node: ParameterNode, context: VisitorContext
|
|
2092
|
-
response?(node: ResponseNode, context: VisitorContext
|
|
1985
|
+
input?(node: InputNode, context: VisitorContext): undefined | null | InputNode;
|
|
1986
|
+
operation?(node: OperationNode, context: VisitorContext): undefined | null | OperationNode;
|
|
1987
|
+
schema?(node: SchemaNode, context: VisitorContext): undefined | null | SchemaNode;
|
|
1988
|
+
property?(node: PropertyNode, context: VisitorContext): undefined | null | PropertyNode;
|
|
1989
|
+
parameter?(node: ParameterNode, context: VisitorContext): undefined | null | ParameterNode;
|
|
1990
|
+
response?(node: ResponseNode, context: VisitorContext): undefined | null | ResponseNode;
|
|
2093
1991
|
};
|
|
2094
1992
|
/**
|
|
2095
1993
|
* The callbacks of {@link Visitor} with every return type replaced by `TResult`. `collect` uses it
|
|
@@ -2140,28 +2038,6 @@ type TransformOptions = Visitor & TraversalOptions;
|
|
|
2140
2038
|
* ```
|
|
2141
2039
|
*/
|
|
2142
2040
|
type CollectOptions<T> = VisitorOf<T> & TraversalOptions;
|
|
2143
|
-
/**
|
|
2144
|
-
* Visits each direct child node in the AST's traversal order.
|
|
2145
|
-
*
|
|
2146
|
-
* @example
|
|
2147
|
-
* ```ts
|
|
2148
|
-
* forEachChild(operationNode, (child) => {
|
|
2149
|
-
* console.log(child.kind)
|
|
2150
|
-
* })
|
|
2151
|
-
* ```
|
|
2152
|
-
*/
|
|
2153
|
-
export declare function forEachChild(node: Node, visit: (child: Node) => void): void;
|
|
2154
|
-
/**
|
|
2155
|
-
* Visits each schema in a node's child tree in depth-first order. Includes `node` when it is a schema.
|
|
2156
|
-
*
|
|
2157
|
-
* @example
|
|
2158
|
-
* ```ts
|
|
2159
|
-
* forEachSchema(operationNode, (schema) => {
|
|
2160
|
-
* console.log(schema.type)
|
|
2161
|
-
* })
|
|
2162
|
-
* ```
|
|
2163
|
-
*/
|
|
2164
|
-
export declare function forEachSchema(node: Node, visit: (schema: SchemaNode) => void): void;
|
|
2165
2041
|
/**
|
|
2166
2042
|
* Finds the first schema that matches `predicate` in depth-first order. Set `followRefs` to include resolved ref targets.
|
|
2167
2043
|
*
|
|
@@ -2237,6 +2113,14 @@ export declare function collectSync<T>(node: Node, options: CollectOptions<T>):
|
|
|
2237
2113
|
* and `undefined` keeps declaration order.
|
|
2238
2114
|
*/
|
|
2239
2115
|
type Enforce = 'pre' | 'post';
|
|
2116
|
+
/**
|
|
2117
|
+
* Compares two `enforce` hints for `Array.prototype.sort`: `pre` first, unmarked next, `post`
|
|
2118
|
+
* last. Equal hints compare as `0`, so a stable sort keeps authored order within a bucket.
|
|
2119
|
+
*
|
|
2120
|
+
* @example
|
|
2121
|
+
* `plugins.sort((a, b) => compareEnforce(a.enforce, b.enforce))`
|
|
2122
|
+
*/
|
|
2123
|
+
export declare function compareEnforce(a?: Enforce, b?: Enforce): number;
|
|
2240
2124
|
/**
|
|
2241
2125
|
* A named, composable transform over the Kubb AST. It carries the same per-kind callbacks as a
|
|
2242
2126
|
* {@link Visitor} (`schema`, `operation`, …), plus a `name`, an optional `enforce` order, and an
|
|
@@ -2274,19 +2158,6 @@ type Macro = Visitor & {
|
|
|
2274
2158
|
* ```
|
|
2275
2159
|
*/
|
|
2276
2160
|
export declare function defineMacro(macro: Macro): Macro;
|
|
2277
|
-
/**
|
|
2278
|
-
* Folds an ordered list of macros into a single {@link Visitor} that `transform` (and the per-plugin
|
|
2279
|
-
* transform layer in `@kubb/core`) can run. Macros are stable-sorted by `enforce`, then applied
|
|
2280
|
-
* sequentially per node so later macros see earlier output. This differs from a plain visitor, which
|
|
2281
|
-
* has no names, ordering, or composition.
|
|
2282
|
-
*
|
|
2283
|
-
* @example
|
|
2284
|
-
* ```ts
|
|
2285
|
-
* const visitor = composeMacros([macroSimplifyUnion, macroDiscriminatorEnum])
|
|
2286
|
-
* const next = transform(root, visitor)
|
|
2287
|
-
* ```
|
|
2288
|
-
*/
|
|
2289
|
-
export declare function composeMacros(macros: ReadonlyArray<Macro>): Visitor;
|
|
2290
2161
|
/**
|
|
2291
2162
|
* Runs a list of macros over a node tree and returns the rewritten tree. Keeps `transform`'s
|
|
2292
2163
|
* structural sharing, so an empty or no-op macro list returns the same reference. Pass
|
|
@@ -2508,14 +2379,9 @@ export declare function createPrinter<T extends PrinterFactoryOptions = PrinterF
|
|
|
2508
2379
|
/**
|
|
2509
2380
|
* Extracts all string content from a `CodeNode` tree recursively.
|
|
2510
2381
|
*
|
|
2511
|
-
* Collects text node
|
|
2512
|
-
* and nested node content. Used to build the full source string for import filtering.
|
|
2382
|
+
* Collects the text fields and nested node content, to build the source string for import filtering.
|
|
2513
2383
|
*/
|
|
2514
2384
|
export declare function extractStringsFromNodes(nodes: Array<CodeNode> | undefined): string;
|
|
2515
|
-
/**
|
|
2516
|
-
* Whether every source of `file` is inline. Other files absorb such a file, so it is never written.
|
|
2517
|
-
*/
|
|
2518
|
-
export declare function isVirtualFile(file: FileNode): boolean;
|
|
2519
2385
|
type InlineFilesResult = {
|
|
2520
2386
|
/**
|
|
2521
2387
|
* Files that imported an inline name, rewritten to hold its definition.
|
|
@@ -2553,7 +2419,7 @@ type InlineFilesOptions = {
|
|
|
2553
2419
|
language: (file: FileNode) => InlineLanguage | undefined;
|
|
2554
2420
|
};
|
|
2555
2421
|
/**
|
|
2556
|
-
* Replaces every name a file imports from a virtual file (
|
|
2422
|
+
* Replaces every name a file imports from a virtual file (one whose sources are all inline, so it is never written) with that name's
|
|
2557
2423
|
* `inline.expression`, until no inline names are left. The definitions' own imports move to the importing file.
|
|
2558
2424
|
*/
|
|
2559
2425
|
export declare function inlineFiles(files: ReadonlyArray<FileNode>, { language }: InlineFilesOptions): InlineFilesResult;
|
|
@@ -2610,9 +2476,8 @@ export declare function mergeRefWithSchema(node: RefSchemaNode): SchemaNode;
|
|
|
2610
2476
|
export declare function isBareRef(node: SchemaNode | null | undefined, keysToOmit?: Array<string> | null): boolean;
|
|
2611
2477
|
/**
|
|
2612
2478
|
* Collects the names of every schema a node's subtree references, resolved with `resolveRefName`.
|
|
2613
|
-
* Each ref contributes its name only, so the schema it points to is never traversed.
|
|
2614
|
-
*
|
|
2615
|
-
* scan per schema.
|
|
2479
|
+
* Each ref contributes its name only, so the schema it points to is never traversed. Memoized by
|
|
2480
|
+
* node identity, which lets `findCircularSchemas` and `containsCircularRef` share one scan per schema.
|
|
2616
2481
|
*
|
|
2617
2482
|
* @example
|
|
2618
2483
|
* ```ts
|
|
@@ -2620,12 +2485,11 @@ export declare function isBareRef(node: SchemaNode | null | undefined, keysToOmi
|
|
|
2620
2485
|
* // Set { 'Category', 'Tag' }
|
|
2621
2486
|
* ```
|
|
2622
2487
|
*/
|
|
2623
|
-
export declare
|
|
2488
|
+
export declare function collectSchemaRefs(node: SchemaNode): ReadonlySet<string>;
|
|
2624
2489
|
/**
|
|
2625
2490
|
* Collects the de-duplicated target names of every pointer-carrying ref in a node's subtree, in
|
|
2626
|
-
* first-occurrence order.
|
|
2627
|
-
*
|
|
2628
|
-
* re-scanning the same schema per plugin.
|
|
2491
|
+
* first-occurrence order. Memoized by node identity, so `resolver.imports` reads the same result
|
|
2492
|
+
* across the ts, zod, and faker plugins instead of re-scanning the same schema per plugin.
|
|
2629
2493
|
*
|
|
2630
2494
|
* Only refs that carry a `$ref` pointer count, so a synthesized ref pointing at a sibling in the
|
|
2631
2495
|
* same file (a union member created by name) is left out. That leaves exactly the set
|
|
@@ -2637,7 +2501,7 @@ export declare const collectSchemaRefs: (key: SchemaNode) => ReadonlySet<string>
|
|
|
2637
2501
|
* // ['Category', 'Tag']
|
|
2638
2502
|
* ```
|
|
2639
2503
|
*/
|
|
2640
|
-
export declare
|
|
2504
|
+
export declare function collectImportedRefNames(node: SchemaNode): ReadonlyArray<string>;
|
|
2641
2505
|
/**
|
|
2642
2506
|
* Collects the names of all top-level schemas transitively used by a set of operations.
|
|
2643
2507
|
*
|
|
@@ -2659,24 +2523,6 @@ export declare const collectImportedRefNames: (key: SchemaNode) => readonly stri
|
|
|
2659
2523
|
* ```
|
|
2660
2524
|
*/
|
|
2661
2525
|
export declare function collectUsedSchemaNames(operations: ReadonlyArray<OperationNode>, schemas: ReadonlyArray<SchemaNode>): Set<string>;
|
|
2662
|
-
/**
|
|
2663
|
-
* Finds every schema that takes part in a circular dependency chain in a schema dependency graph
|
|
2664
|
-
* that maps each schema name to the names it references directly.
|
|
2665
|
-
*
|
|
2666
|
-
* Use this when the graph was already collected during another pass (e.g. the adapter's convert
|
|
2667
|
-
* walk), so the schema nodes are not swept a second time. `findCircularSchemas` builds the graph
|
|
2668
|
-
* from schema nodes and delegates here.
|
|
2669
|
-
*
|
|
2670
|
-
* @example
|
|
2671
|
-
* ```ts
|
|
2672
|
-
* const graph = new Map([
|
|
2673
|
-
* ['Pet', new Set(['Category'])],
|
|
2674
|
-
* ['Category', new Set(['Pet'])],
|
|
2675
|
-
* ])
|
|
2676
|
-
* findCircularSchemasFromGraph(graph) // Set { 'Pet', 'Category' }
|
|
2677
|
-
* ```
|
|
2678
|
-
*/
|
|
2679
|
-
export declare function findCircularSchemasFromGraph(graph: ReadonlyMap<string, ReadonlySet<string>>): Set<string>;
|
|
2680
2526
|
/**
|
|
2681
2527
|
* Finds every schema that takes part in a circular dependency chain, including direct self-loops.
|
|
2682
2528
|
*
|
|
@@ -2805,7 +2651,7 @@ type ParserOptions = {
|
|
|
2805
2651
|
enumSuffix: 'enum' | (string & {});
|
|
2806
2652
|
};
|
|
2807
2653
|
declare namespace index_d_exports {
|
|
2808
|
-
export { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateOnlyTypeValue, DateSchemaNode, DateTimeTypeValue, DateTypeOptions, DatetimeSchemaNode, DistributiveOmit, EncodingNode, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InlineLanguage, InputMeta, InputNode, InputSecurityScheme, InputServer, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeKind, NotSchemaNode, NumberSchemaNode, ObjectSchemaNode, OperationNode, ParameterLocation, ParameterNode, ParameterStyle,
|
|
2654
|
+
export { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateOnlyTypeValue, DateSchemaNode, DateTimeTypeValue, DateTypeOptions, DatetimeSchemaNode, DistributiveOmit, EncodingNode, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InlineLanguage, InputMeta, InputNode, InputSecurityScheme, InputServer, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeKind, NotSchemaNode, NumberSchemaNode, ObjectSchemaNode, OperationNode, ParameterLocation, ParameterNode, ParameterStyle, 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, index_d_exports as ast, collect, collectImportedRefNames, collectSchemaRefs, collectSync, collectUsedSchemaNames, compareEnforce, createPrinter, defineMacro, extractStringsFromNodes, index_d_exports$1 as factory, findCircularSchemas, findSchema, getSchemaLiteralValues, inferDiscriminatorPropertyName, inlineFiles, isBareRef, isHttpOperationNode, mergeRefWithSchema, narrowSchema, nodeKinds, optionality, refName, resolveRef, resolveRefName, resolveSchemaProperties, schemaTypes, transform };
|
|
2809
2655
|
}
|
|
2810
|
-
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 EncodingNode, type Enforce, type EnumSchemaNode, type ExportNode, type FileNode, type FunctionNode, type GenericOperationNode, type HttpMethod, type HttpOperationNode, type ImportNode, type InlineLanguage, type InputMeta, type InputNode, type InputSecurityScheme, type InputServer, type IntersectionSchemaNode, type JSDocNode, type JsxNode, type Macro, type Node, type NodeKind, type NotSchemaNode, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, type ParameterLocation, type ParameterNode, type ParameterStyle, type
|
|
2656
|
+
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 EncodingNode, type Enforce, type EnumSchemaNode, type ExportNode, type FileNode, type FunctionNode, type GenericOperationNode, type HttpMethod, type HttpOperationNode, type ImportNode, type InlineLanguage, type InputMeta, type InputNode, type InputSecurityScheme, type InputServer, type IntersectionSchemaNode, type JSDocNode, type JsxNode, type Macro, type Node, type NodeKind, type NotSchemaNode, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, type ParameterLocation, type ParameterNode, type ParameterStyle, 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, index_d_exports as ast, index_d_exports$1 as factory };
|
|
2811
2657
|
//# sourceMappingURL=index.d.cts.map
|