@kubb/ast 5.15.0 → 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 -208
- package/dist/index.d.ts +48 -208
- 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
|
-
* All fields are plain JSON-serializable values, no `Set`, no `Map`, no class instances.
|
|
1892
|
-
* Computed fields (`circularNames`, `enumNames`) are pre-calculated once during the adapter
|
|
1893
|
-
* pre-scan so generators never need to iterate the full schema list themselves.
|
|
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,34 +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
|
-
* Convert to a `Set` once at the start of a generator, not per-schema,
|
|
1929
|
-
* so lookups stay O(1) without repeated allocations.
|
|
1930
|
-
*
|
|
1931
|
-
* @example Wrap a circular schema in z.lazy()
|
|
1932
|
-
* ```ts
|
|
1933
|
-
* const circular = new Set(meta.circularNames)
|
|
1934
|
-
* if (circular.has(schema.name)) { ... }
|
|
1935
|
-
* ```
|
|
1936
|
-
*/
|
|
1937
|
-
circularNames: ReadonlyArray<string>;
|
|
1938
|
-
/**
|
|
1939
|
-
* Names of schemas whose type is `enum`.
|
|
1940
|
-
* Computed once during the adapter pre-scan, so a generator never has to
|
|
1941
|
-
* filter the schema list itself.
|
|
1942
|
-
*
|
|
1943
|
-
* Convert to a `Set` once at the start of a generator when you need repeated
|
|
1944
|
-
* membership checks, so each check stays O(1) instead of an array scan.
|
|
1945
|
-
*
|
|
1946
|
-
* @example Check if a referenced schema is an enum
|
|
1947
|
-
* `const enums = new Set(meta.enumNames)`
|
|
1948
|
-
* `const isEnum = enums.has(schemaName)`
|
|
1949
|
-
*/
|
|
1950
|
-
enumNames: ReadonlyArray<string>;
|
|
1951
1867
|
};
|
|
1952
1868
|
/**
|
|
1953
1869
|
* Input AST node that contains all schemas and operations for one API document.
|
|
@@ -1959,7 +1875,7 @@ type InputMeta = {
|
|
|
1959
1875
|
* kind: 'Input',
|
|
1960
1876
|
* schemas: [],
|
|
1961
1877
|
* operations: [],
|
|
1962
|
-
* meta: {
|
|
1878
|
+
* meta: {},
|
|
1963
1879
|
* }
|
|
1964
1880
|
* ```
|
|
1965
1881
|
*/
|
|
@@ -1982,8 +1898,8 @@ type InputNode = BaseNode & {
|
|
|
1982
1898
|
meta: InputMeta;
|
|
1983
1899
|
};
|
|
1984
1900
|
/**
|
|
1985
|
-
* Creates an `InputNode`, defaulting `schemas`/`operations` to empty arrays and `meta` to empty
|
|
1986
|
-
*
|
|
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.
|
|
1987
1903
|
*
|
|
1988
1904
|
* @example
|
|
1989
1905
|
* ```ts
|
|
@@ -2014,54 +1930,30 @@ declare namespace index_d_exports$1 {
|
|
|
2014
1930
|
*/
|
|
2015
1931
|
type Node = InputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode | RequestBodyNode | ContentNode | FileNode | ImportNode | ExportNode | SourceNode | ConstNode | TypeNode | FunctionNode | ArrowFunctionNode | TextNode | BreakNode | JsxNode;
|
|
2016
1932
|
/**
|
|
2017
|
-
*
|
|
2018
|
-
*
|
|
2019
|
-
* `ParentOf` uses this map to find parent types.
|
|
2020
|
-
*/
|
|
2021
|
-
type ParentNodeMap = [[InputNode, undefined], [OperationNode, InputNode], [RequestBodyNode, OperationNode], [ContentNode, RequestBodyNode | ResponseNode], [SchemaNode, InputNode | ContentNode | SchemaNode | PropertyNode | ParameterNode], [PropertyNode, SchemaNode], [ParameterNode, OperationNode], [ResponseNode, OperationNode]];
|
|
2022
|
-
/**
|
|
2023
|
-
* Resolves the parent node type for a given AST node type.
|
|
2024
|
-
*
|
|
2025
|
-
* Visitor context relies on this so `ctx.parent` is typed for each callback.
|
|
2026
|
-
*
|
|
2027
|
-
* @example
|
|
2028
|
-
* ```ts
|
|
2029
|
-
* type InputParent = ParentOf<InputNode>
|
|
2030
|
-
* // undefined
|
|
2031
|
-
* ```
|
|
2032
|
-
*
|
|
2033
|
-
* @example
|
|
2034
|
-
* ```ts
|
|
2035
|
-
* type PropertyParent = ParentOf<PropertyNode>
|
|
2036
|
-
* // SchemaNode
|
|
2037
|
-
* ```
|
|
1933
|
+
* Traversal depth for AST visitor utilities.
|
|
2038
1934
|
*
|
|
2039
|
-
*
|
|
2040
|
-
*
|
|
2041
|
-
*
|
|
2042
|
-
* // InputNode | ContentNode | SchemaNode | PropertyNode | ParameterNode
|
|
2043
|
-
* ```
|
|
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.
|
|
2044
1938
|
*/
|
|
2045
|
-
type
|
|
1939
|
+
type VisitorDepth = 'shallow' | 'deep';
|
|
2046
1940
|
/**
|
|
2047
1941
|
* Traversal context passed as the second argument to every visitor callback.
|
|
2048
|
-
* `parent` is typed from the current node type.
|
|
2049
1942
|
*
|
|
2050
1943
|
* @example
|
|
2051
1944
|
* ```ts
|
|
2052
1945
|
* const visitor: Visitor = {
|
|
2053
1946
|
* schema(node, { parent }) {
|
|
2054
|
-
* // parent
|
|
1947
|
+
* // parent is the node that holds this schema, or undefined at the root
|
|
2055
1948
|
* },
|
|
2056
1949
|
* }
|
|
2057
1950
|
* ```
|
|
2058
1951
|
*/
|
|
2059
|
-
type VisitorContext
|
|
1952
|
+
type VisitorContext = {
|
|
2060
1953
|
/**
|
|
2061
|
-
* Parent node of the currently visited node.
|
|
2062
|
-
* For `InputNode`, this is `undefined`.
|
|
1954
|
+
* Parent node of the currently visited node. For the root node, this is `undefined`.
|
|
2063
1955
|
*/
|
|
2064
|
-
parent?:
|
|
1956
|
+
parent?: Node;
|
|
2065
1957
|
};
|
|
2066
1958
|
/**
|
|
2067
1959
|
* Synchronous visitor consumed by `transform`. Each optional callback runs
|
|
@@ -2090,12 +1982,12 @@ type VisitorContext<T extends Node = Node> = {
|
|
|
2090
1982
|
* ```
|
|
2091
1983
|
*/
|
|
2092
1984
|
type Visitor = {
|
|
2093
|
-
input?(node: InputNode, context: VisitorContext
|
|
2094
|
-
operation?(node: OperationNode, context: VisitorContext
|
|
2095
|
-
schema?(node: SchemaNode, context: VisitorContext
|
|
2096
|
-
property?(node: PropertyNode, context: VisitorContext
|
|
2097
|
-
parameter?(node: ParameterNode, context: VisitorContext
|
|
2098
|
-
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;
|
|
2099
1991
|
};
|
|
2100
1992
|
/**
|
|
2101
1993
|
* The callbacks of {@link Visitor} with every return type replaced by `TResult`. `collect` uses it
|
|
@@ -2146,28 +2038,6 @@ type TransformOptions = Visitor & TraversalOptions;
|
|
|
2146
2038
|
* ```
|
|
2147
2039
|
*/
|
|
2148
2040
|
type CollectOptions<T> = VisitorOf<T> & TraversalOptions;
|
|
2149
|
-
/**
|
|
2150
|
-
* Visits each direct child node in the AST's traversal order.
|
|
2151
|
-
*
|
|
2152
|
-
* @example
|
|
2153
|
-
* ```ts
|
|
2154
|
-
* forEachChild(operationNode, (child) => {
|
|
2155
|
-
* console.log(child.kind)
|
|
2156
|
-
* })
|
|
2157
|
-
* ```
|
|
2158
|
-
*/
|
|
2159
|
-
export declare function forEachChild(node: Node, visit: (child: Node) => void): void;
|
|
2160
|
-
/**
|
|
2161
|
-
* Visits each schema in a node's child tree in depth-first order. Includes `node` when it is a schema.
|
|
2162
|
-
*
|
|
2163
|
-
* @example
|
|
2164
|
-
* ```ts
|
|
2165
|
-
* forEachSchema(operationNode, (schema) => {
|
|
2166
|
-
* console.log(schema.type)
|
|
2167
|
-
* })
|
|
2168
|
-
* ```
|
|
2169
|
-
*/
|
|
2170
|
-
export declare function forEachSchema(node: Node, visit: (schema: SchemaNode) => void): void;
|
|
2171
2041
|
/**
|
|
2172
2042
|
* Finds the first schema that matches `predicate` in depth-first order. Set `followRefs` to include resolved ref targets.
|
|
2173
2043
|
*
|
|
@@ -2243,6 +2113,14 @@ export declare function collectSync<T>(node: Node, options: CollectOptions<T>):
|
|
|
2243
2113
|
* and `undefined` keeps declaration order.
|
|
2244
2114
|
*/
|
|
2245
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;
|
|
2246
2124
|
/**
|
|
2247
2125
|
* A named, composable transform over the Kubb AST. It carries the same per-kind callbacks as a
|
|
2248
2126
|
* {@link Visitor} (`schema`, `operation`, …), plus a `name`, an optional `enforce` order, and an
|
|
@@ -2280,19 +2158,6 @@ type Macro = Visitor & {
|
|
|
2280
2158
|
* ```
|
|
2281
2159
|
*/
|
|
2282
2160
|
export declare function defineMacro(macro: Macro): Macro;
|
|
2283
|
-
/**
|
|
2284
|
-
* Folds an ordered list of macros into a single {@link Visitor} that `transform` (and the per-plugin
|
|
2285
|
-
* transform layer in `@kubb/core`) can run. Macros are stable-sorted by `enforce`, then applied
|
|
2286
|
-
* sequentially per node so later macros see earlier output. This differs from a plain visitor, which
|
|
2287
|
-
* has no names, ordering, or composition.
|
|
2288
|
-
*
|
|
2289
|
-
* @example
|
|
2290
|
-
* ```ts
|
|
2291
|
-
* const visitor = composeMacros([macroSimplifyUnion, macroDiscriminatorEnum])
|
|
2292
|
-
* const next = transform(root, visitor)
|
|
2293
|
-
* ```
|
|
2294
|
-
*/
|
|
2295
|
-
export declare function composeMacros(macros: ReadonlyArray<Macro>): Visitor;
|
|
2296
2161
|
/**
|
|
2297
2162
|
* Runs a list of macros over a node tree and returns the rewritten tree. Keeps `transform`'s
|
|
2298
2163
|
* structural sharing, so an empty or no-op macro list returns the same reference. Pass
|
|
@@ -2514,14 +2379,9 @@ export declare function createPrinter<T extends PrinterFactoryOptions = PrinterF
|
|
|
2514
2379
|
/**
|
|
2515
2380
|
* Extracts all string content from a `CodeNode` tree recursively.
|
|
2516
2381
|
*
|
|
2517
|
-
* Collects text node
|
|
2518
|
-
* 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.
|
|
2519
2383
|
*/
|
|
2520
2384
|
export declare function extractStringsFromNodes(nodes: Array<CodeNode> | undefined): string;
|
|
2521
|
-
/**
|
|
2522
|
-
* Whether every source of `file` is inline. Other files absorb such a file, so it is never written.
|
|
2523
|
-
*/
|
|
2524
|
-
export declare function isVirtualFile(file: FileNode): boolean;
|
|
2525
2385
|
type InlineFilesResult = {
|
|
2526
2386
|
/**
|
|
2527
2387
|
* Files that imported an inline name, rewritten to hold its definition.
|
|
@@ -2559,7 +2419,7 @@ type InlineFilesOptions = {
|
|
|
2559
2419
|
language: (file: FileNode) => InlineLanguage | undefined;
|
|
2560
2420
|
};
|
|
2561
2421
|
/**
|
|
2562
|
-
* 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
|
|
2563
2423
|
* `inline.expression`, until no inline names are left. The definitions' own imports move to the importing file.
|
|
2564
2424
|
*/
|
|
2565
2425
|
export declare function inlineFiles(files: ReadonlyArray<FileNode>, { language }: InlineFilesOptions): InlineFilesResult;
|
|
@@ -2616,9 +2476,8 @@ export declare function mergeRefWithSchema(node: RefSchemaNode): SchemaNode;
|
|
|
2616
2476
|
export declare function isBareRef(node: SchemaNode | null | undefined, keysToOmit?: Array<string> | null): boolean;
|
|
2617
2477
|
/**
|
|
2618
2478
|
* Collects the names of every schema a node's subtree references, resolved with `resolveRefName`.
|
|
2619
|
-
* Each ref contributes its name only, so the schema it points to is never traversed.
|
|
2620
|
-
*
|
|
2621
|
-
* 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.
|
|
2622
2481
|
*
|
|
2623
2482
|
* @example
|
|
2624
2483
|
* ```ts
|
|
@@ -2626,12 +2485,11 @@ export declare function isBareRef(node: SchemaNode | null | undefined, keysToOmi
|
|
|
2626
2485
|
* // Set { 'Category', 'Tag' }
|
|
2627
2486
|
* ```
|
|
2628
2487
|
*/
|
|
2629
|
-
export declare
|
|
2488
|
+
export declare function collectSchemaRefs(node: SchemaNode): ReadonlySet<string>;
|
|
2630
2489
|
/**
|
|
2631
2490
|
* Collects the de-duplicated target names of every pointer-carrying ref in a node's subtree, in
|
|
2632
|
-
* first-occurrence order.
|
|
2633
|
-
*
|
|
2634
|
-
* 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.
|
|
2635
2493
|
*
|
|
2636
2494
|
* Only refs that carry a `$ref` pointer count, so a synthesized ref pointing at a sibling in the
|
|
2637
2495
|
* same file (a union member created by name) is left out. That leaves exactly the set
|
|
@@ -2643,7 +2501,7 @@ export declare const collectSchemaRefs: (key: SchemaNode) => ReadonlySet<string>
|
|
|
2643
2501
|
* // ['Category', 'Tag']
|
|
2644
2502
|
* ```
|
|
2645
2503
|
*/
|
|
2646
|
-
export declare
|
|
2504
|
+
export declare function collectImportedRefNames(node: SchemaNode): ReadonlyArray<string>;
|
|
2647
2505
|
/**
|
|
2648
2506
|
* Collects the names of all top-level schemas transitively used by a set of operations.
|
|
2649
2507
|
*
|
|
@@ -2665,24 +2523,6 @@ export declare const collectImportedRefNames: (key: SchemaNode) => readonly stri
|
|
|
2665
2523
|
* ```
|
|
2666
2524
|
*/
|
|
2667
2525
|
export declare function collectUsedSchemaNames(operations: ReadonlyArray<OperationNode>, schemas: ReadonlyArray<SchemaNode>): Set<string>;
|
|
2668
|
-
/**
|
|
2669
|
-
* Finds every schema that takes part in a circular dependency chain in a schema dependency graph
|
|
2670
|
-
* that maps each schema name to the names it references directly.
|
|
2671
|
-
*
|
|
2672
|
-
* Use this when the graph was already collected during another pass (e.g. the adapter's convert
|
|
2673
|
-
* walk), so the schema nodes are not swept a second time. `findCircularSchemas` builds the graph
|
|
2674
|
-
* from schema nodes and delegates here.
|
|
2675
|
-
*
|
|
2676
|
-
* @example
|
|
2677
|
-
* ```ts
|
|
2678
|
-
* const graph = new Map([
|
|
2679
|
-
* ['Pet', new Set(['Category'])],
|
|
2680
|
-
* ['Category', new Set(['Pet'])],
|
|
2681
|
-
* ])
|
|
2682
|
-
* findCircularSchemasFromGraph(graph) // Set { 'Pet', 'Category' }
|
|
2683
|
-
* ```
|
|
2684
|
-
*/
|
|
2685
|
-
export declare function findCircularSchemasFromGraph(graph: ReadonlyMap<string, ReadonlySet<string>>): Set<string>;
|
|
2686
2526
|
/**
|
|
2687
2527
|
* Finds every schema that takes part in a circular dependency chain, including direct self-loops.
|
|
2688
2528
|
*
|
|
@@ -2811,7 +2651,7 @@ type ParserOptions = {
|
|
|
2811
2651
|
enumSuffix: 'enum' | (string & {});
|
|
2812
2652
|
};
|
|
2813
2653
|
declare namespace index_d_exports {
|
|
2814
|
-
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 };
|
|
2815
2655
|
}
|
|
2816
|
-
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 };
|
|
2817
2657
|
//# sourceMappingURL=index.d.cts.map
|