@kubb/ast 5.0.0-beta.60 → 5.0.0-beta.61
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 +2 -1
- package/dist/defineMacro-BLIR6k-j.d.ts +475 -0
- package/dist/defineMacro-BTXvS8nI.js +106 -0
- package/dist/defineMacro-BTXvS8nI.js.map +1 -0
- package/dist/defineMacro-Bv9R_9a2.cjs +123 -0
- package/dist/defineMacro-Bv9R_9a2.cjs.map +1 -0
- package/dist/extractStringsFromNodes-Cja-xxx5.js +29 -0
- package/dist/extractStringsFromNodes-Cja-xxx5.js.map +1 -0
- package/dist/extractStringsFromNodes-DKgDjFO0.cjs +34 -0
- package/dist/extractStringsFromNodes-DKgDjFO0.cjs.map +1 -0
- package/dist/extractStringsFromNodes-p4mX1TQD.d.ts +14 -0
- package/dist/{factory-Du7nEP4B.js → factory-CZNOGI-N.js} +3 -2
- package/dist/{factory-Du7nEP4B.js.map → factory-CZNOGI-N.js.map} +1 -1
- package/dist/{factory-Cl8Z7mcc.cjs → factory-DG1CVkEb.cjs} +5 -4
- package/dist/{factory-Cl8Z7mcc.cjs.map → factory-DG1CVkEb.cjs.map} +1 -1
- package/dist/factory.cjs +2 -2
- package/dist/factory.js +2 -2
- package/dist/index.cjs +22 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +18 -17
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/macros.cjs +117 -0
- package/dist/macros.cjs.map +1 -0
- package/dist/macros.d.ts +59 -0
- package/dist/macros.js +115 -0
- package/dist/macros.js.map +1 -0
- package/dist/{response-DKxTr522.js → response-KUdWiDWw.js} +36 -61
- package/dist/response-KUdWiDWw.js.map +1 -0
- package/dist/{response-DS5S3IG4.cjs → response-hnSw2NKE.cjs} +35 -66
- package/dist/response-hnSw2NKE.cjs.map +1 -0
- package/dist/{types-olVl9v5p.d.ts → types-DyDzizSf.d.ts} +3 -403
- package/dist/types.d.ts +4 -3
- package/dist/{utils-D83JA6Xx.cjs → utils-BLJwyza-.cjs} +18 -751
- package/dist/utils-BLJwyza-.cjs.map +1 -0
- package/dist/{utils-Dj_KoXMv.js → utils-CF_-Pn_c.js} +9 -628
- package/dist/utils-CF_-Pn_c.js.map +1 -0
- package/dist/utils.cjs +12 -10
- package/dist/utils.d.ts +28 -2
- package/dist/utils.js +4 -3
- package/dist/visitor-DJ6ZEJvq.js +548 -0
- package/dist/visitor-DJ6ZEJvq.js.map +1 -0
- package/dist/visitor-DpKZ9Tk0.cjs +654 -0
- package/dist/visitor-DpKZ9Tk0.cjs.map +1 -0
- package/package.json +5 -1
- package/src/defineMacro.ts +132 -0
- package/src/index.ts +3 -7
- package/src/macros/index.ts +3 -0
- package/src/macros/macroDiscriminatorEnum.ts +44 -0
- package/src/macros/macroEnumName.ts +25 -0
- package/src/macros/macroSimplifyUnion.ts +50 -0
- package/src/types.ts +2 -1
- package/src/utils/index.ts +2 -2
- package/src/utils/refs.ts +27 -1
- package/src/utils/schemaMerge.ts +34 -0
- package/dist/extractStringsFromNodes-WMYJ8nQL.d.ts +0 -82
- package/dist/response-DKxTr522.js.map +0 -1
- package/dist/response-DS5S3IG4.cjs.map +0 -1
- package/dist/utils-D83JA6Xx.cjs.map +0 -1
- package/dist/utils-Dj_KoXMv.js.map +0 -1
- package/src/transformers.ts +0 -191
|
@@ -1,140 +1,6 @@
|
|
|
1
1
|
import { n as __name } from "./chunk-CNktS9qV.js";
|
|
2
|
-
import {
|
|
2
|
+
import { _t as SchemaNode, f as OperationNode, t as Node, vt as SchemaNodeByType, yt as SchemaType } from "./index-BzjwdK2M.js";
|
|
3
3
|
|
|
4
|
-
//#region src/constants.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Traversal depth for AST visitor utilities.
|
|
7
|
-
*
|
|
8
|
-
* - `'shallow'` visits only the immediate node, skipping children.
|
|
9
|
-
* - `'deep'` recursively visits all descendant nodes.
|
|
10
|
-
*/
|
|
11
|
-
type VisitorDepth = 'shallow' | 'deep';
|
|
12
|
-
/**
|
|
13
|
-
* Schema type discriminators used by all AST schema nodes.
|
|
14
|
-
*
|
|
15
|
-
* Each value is a stable discriminator across the AST (for example `schema.type === schemaTypes.object`).
|
|
16
|
-
* Call `isScalarPrimitive()` to check for the scalar types.
|
|
17
|
-
*/
|
|
18
|
-
declare const schemaTypes: {
|
|
19
|
-
/**
|
|
20
|
-
* Text value.
|
|
21
|
-
*/
|
|
22
|
-
readonly string: "string";
|
|
23
|
-
/**
|
|
24
|
-
* Floating-point number (`float`, `double`).
|
|
25
|
-
*/
|
|
26
|
-
readonly number: "number";
|
|
27
|
-
/**
|
|
28
|
-
* Whole number (`int32`). Use `bigint` for `int64`.
|
|
29
|
-
*/
|
|
30
|
-
readonly integer: "integer";
|
|
31
|
-
/**
|
|
32
|
-
* 64-bit integer (`int64`). Only used when `integerType` is set to `'bigint'`.
|
|
33
|
-
*/
|
|
34
|
-
readonly bigint: "bigint";
|
|
35
|
-
/**
|
|
36
|
-
* Boolean value.
|
|
37
|
-
*/
|
|
38
|
-
readonly boolean: "boolean";
|
|
39
|
-
/**
|
|
40
|
-
* Explicit null value.
|
|
41
|
-
*/
|
|
42
|
-
readonly null: "null";
|
|
43
|
-
/**
|
|
44
|
-
* Any value (no type restriction).
|
|
45
|
-
*/
|
|
46
|
-
readonly any: "any";
|
|
47
|
-
/**
|
|
48
|
-
* Unknown value (must be narrowed before usage).
|
|
49
|
-
*/
|
|
50
|
-
readonly unknown: "unknown";
|
|
51
|
-
/**
|
|
52
|
-
* No return value (`void`).
|
|
53
|
-
*/
|
|
54
|
-
readonly void: "void";
|
|
55
|
-
/**
|
|
56
|
-
* Object with named properties.
|
|
57
|
-
*/
|
|
58
|
-
readonly object: "object";
|
|
59
|
-
/**
|
|
60
|
-
* Sequential list of items.
|
|
61
|
-
*/
|
|
62
|
-
readonly array: "array";
|
|
63
|
-
/**
|
|
64
|
-
* Fixed-length list with position-specific items.
|
|
65
|
-
*/
|
|
66
|
-
readonly tuple: "tuple";
|
|
67
|
-
/**
|
|
68
|
-
* "One of" multiple schema members.
|
|
69
|
-
*/
|
|
70
|
-
readonly union: "union";
|
|
71
|
-
/**
|
|
72
|
-
* "All of" multiple schema members.
|
|
73
|
-
*/
|
|
74
|
-
readonly intersection: "intersection";
|
|
75
|
-
/**
|
|
76
|
-
* Enum schema.
|
|
77
|
-
*/
|
|
78
|
-
readonly enum: "enum";
|
|
79
|
-
/**
|
|
80
|
-
* Reference to another schema.
|
|
81
|
-
*/
|
|
82
|
-
readonly ref: "ref";
|
|
83
|
-
/**
|
|
84
|
-
* Calendar date (for example `2026-03-24`).
|
|
85
|
-
*/
|
|
86
|
-
readonly date: "date";
|
|
87
|
-
/**
|
|
88
|
-
* Date-time value (for example `2026-03-24T09:00:00Z`).
|
|
89
|
-
*/
|
|
90
|
-
readonly datetime: "datetime";
|
|
91
|
-
/**
|
|
92
|
-
* Time-only value (for example `09:00:00`).
|
|
93
|
-
*/
|
|
94
|
-
readonly time: "time";
|
|
95
|
-
/**
|
|
96
|
-
* UUID value.
|
|
97
|
-
*/
|
|
98
|
-
readonly uuid: "uuid";
|
|
99
|
-
/**
|
|
100
|
-
* Email address value.
|
|
101
|
-
*/
|
|
102
|
-
readonly email: "email";
|
|
103
|
-
/**
|
|
104
|
-
* URL value.
|
|
105
|
-
*/
|
|
106
|
-
readonly url: "url";
|
|
107
|
-
/**
|
|
108
|
-
* IPv4 address value.
|
|
109
|
-
*/
|
|
110
|
-
readonly ipv4: "ipv4";
|
|
111
|
-
/**
|
|
112
|
-
* IPv6 address value.
|
|
113
|
-
*/
|
|
114
|
-
readonly ipv6: "ipv6";
|
|
115
|
-
/**
|
|
116
|
-
* Binary/blob value.
|
|
117
|
-
*/
|
|
118
|
-
readonly blob: "blob";
|
|
119
|
-
/**
|
|
120
|
-
* Impossible value (`never`).
|
|
121
|
-
*/
|
|
122
|
-
readonly never: "never";
|
|
123
|
-
};
|
|
124
|
-
/**
|
|
125
|
-
* HTTP method identifiers used by operation nodes.
|
|
126
|
-
*/
|
|
127
|
-
declare const httpMethods: {
|
|
128
|
-
readonly get: "GET";
|
|
129
|
-
readonly post: "POST";
|
|
130
|
-
readonly put: "PUT";
|
|
131
|
-
readonly patch: "PATCH";
|
|
132
|
-
readonly delete: "DELETE";
|
|
133
|
-
readonly head: "HEAD";
|
|
134
|
-
readonly options: "OPTIONS";
|
|
135
|
-
readonly trace: "TRACE";
|
|
136
|
-
};
|
|
137
|
-
//#endregion
|
|
138
4
|
//#region src/dedupe.d.ts
|
|
139
5
|
/**
|
|
140
6
|
* A canonical destination for a deduplicated shape: the shared schema name and
|
|
@@ -290,272 +156,6 @@ type SchemaDialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TSchema,
|
|
|
290
156
|
*/
|
|
291
157
|
declare function defineSchemaDialect<TSchema, TRef, TDiscriminated, TDocument>(dialect: SchemaDialect<TSchema, TRef, TDiscriminated, TDocument>): SchemaDialect<TSchema, TRef, TDiscriminated, TDocument>;
|
|
292
158
|
//#endregion
|
|
293
|
-
//#region src/visitor.d.ts
|
|
294
|
-
/**
|
|
295
|
-
* Ordered mapping of `[NodeType, ParentType]` pairs.
|
|
296
|
-
*
|
|
297
|
-
* `ParentOf` uses this map to find parent types.
|
|
298
|
-
*/
|
|
299
|
-
type ParentNodeMap = [[InputNode, undefined], [OutputNode, undefined], [OperationNode, InputNode], [RequestBodyNode, OperationNode], [ContentNode, RequestBodyNode | ResponseNode], [SchemaNode, InputNode | ContentNode | SchemaNode | PropertyNode | ParameterNode], [PropertyNode, SchemaNode], [ParameterNode, OperationNode], [ResponseNode, OperationNode]];
|
|
300
|
-
/**
|
|
301
|
-
* Resolves the parent node type for a given AST node type.
|
|
302
|
-
*
|
|
303
|
-
* Visitor context relies on this so `ctx.parent` is typed for each callback.
|
|
304
|
-
*
|
|
305
|
-
* @example
|
|
306
|
-
* ```ts
|
|
307
|
-
* type InputParent = ParentOf<InputNode>
|
|
308
|
-
* // undefined
|
|
309
|
-
* ```
|
|
310
|
-
*
|
|
311
|
-
* @example
|
|
312
|
-
* ```ts
|
|
313
|
-
* type PropertyParent = ParentOf<PropertyNode>
|
|
314
|
-
* // SchemaNode
|
|
315
|
-
* ```
|
|
316
|
-
*
|
|
317
|
-
* @example
|
|
318
|
-
* ```ts
|
|
319
|
-
* type SchemaParent = ParentOf<SchemaNode>
|
|
320
|
-
* // InputNode | OperationNode | SchemaNode | PropertyNode | ParameterNode | ResponseNode
|
|
321
|
-
* ```
|
|
322
|
-
*/
|
|
323
|
-
type ParentOf<T extends Node, TEntries extends ReadonlyArray<[Node, unknown]> = ParentNodeMap> = TEntries extends [infer TEntry extends [Node, unknown], ...infer TRest extends ReadonlyArray<[Node, unknown]>] ? T extends TEntry[0] ? TEntry[1] : ParentOf<T, TRest> : Node;
|
|
324
|
-
/**
|
|
325
|
-
* Traversal context passed as the second argument to every visitor callback.
|
|
326
|
-
* `parent` is typed from the current node type.
|
|
327
|
-
*
|
|
328
|
-
* @example
|
|
329
|
-
* ```ts
|
|
330
|
-
* const visitor: Visitor = {
|
|
331
|
-
* schema(node, { parent }) {
|
|
332
|
-
* // parent type is narrowed by node kind
|
|
333
|
-
* },
|
|
334
|
-
* }
|
|
335
|
-
* ```
|
|
336
|
-
*/
|
|
337
|
-
type VisitorContext<T extends Node = Node> = {
|
|
338
|
-
/**
|
|
339
|
-
* Parent node of the currently visited node.
|
|
340
|
-
* For `InputNode`, this is `undefined`.
|
|
341
|
-
*/
|
|
342
|
-
parent?: ParentOf<T>;
|
|
343
|
-
};
|
|
344
|
-
/**
|
|
345
|
-
* Synchronous visitor consumed by `transform`. Each optional callback runs
|
|
346
|
-
* for the matching node type. Return a new node to replace it, or `undefined`
|
|
347
|
-
* to leave it untouched.
|
|
348
|
-
*
|
|
349
|
-
* Plugins typically expose `transformer` so users can supply a `Visitor` that
|
|
350
|
-
* rewrites the AST before printing.
|
|
351
|
-
*
|
|
352
|
-
* @example Prefix every operationId
|
|
353
|
-
* ```ts
|
|
354
|
-
* const visitor: Visitor = {
|
|
355
|
-
* operation(node) {
|
|
356
|
-
* return { ...node, operationId: `api_${node.operationId}` }
|
|
357
|
-
* },
|
|
358
|
-
* }
|
|
359
|
-
* ```
|
|
360
|
-
*
|
|
361
|
-
* @example Strip schema descriptions
|
|
362
|
-
* ```ts
|
|
363
|
-
* const visitor: Visitor = {
|
|
364
|
-
* schema(node) {
|
|
365
|
-
* return { ...node, description: undefined }
|
|
366
|
-
* },
|
|
367
|
-
* }
|
|
368
|
-
* ```
|
|
369
|
-
*/
|
|
370
|
-
type Visitor = {
|
|
371
|
-
input?(node: InputNode, context: VisitorContext<InputNode>): undefined | null | InputNode;
|
|
372
|
-
output?(node: OutputNode, context: VisitorContext<OutputNode>): undefined | null | OutputNode;
|
|
373
|
-
operation?(node: OperationNode, context: VisitorContext<OperationNode>): undefined | null | OperationNode;
|
|
374
|
-
schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): undefined | null | SchemaNode;
|
|
375
|
-
property?(node: PropertyNode, context: VisitorContext<PropertyNode>): undefined | null | PropertyNode;
|
|
376
|
-
parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): undefined | null | ParameterNode;
|
|
377
|
-
response?(node: ResponseNode, context: VisitorContext<ResponseNode>): undefined | null | ResponseNode;
|
|
378
|
-
};
|
|
379
|
-
/**
|
|
380
|
-
* A visitor callback result that may be sync or async.
|
|
381
|
-
*/
|
|
382
|
-
type MaybePromise<T> = T | Promise<T>;
|
|
383
|
-
/**
|
|
384
|
-
* Async visitor for `walk`. Synchronous `Visitor` objects are compatible.
|
|
385
|
-
*
|
|
386
|
-
* @example
|
|
387
|
-
* ```ts
|
|
388
|
-
* const visitor: AsyncVisitor = {
|
|
389
|
-
* async operation(node) {
|
|
390
|
-
* await Promise.resolve(node.operationId)
|
|
391
|
-
* },
|
|
392
|
-
* }
|
|
393
|
-
* ```
|
|
394
|
-
*/
|
|
395
|
-
type AsyncVisitor = {
|
|
396
|
-
input?(node: InputNode, context: VisitorContext<InputNode>): MaybePromise<undefined | null | InputNode>;
|
|
397
|
-
output?(node: OutputNode, context: VisitorContext<OutputNode>): MaybePromise<undefined | null | OutputNode>;
|
|
398
|
-
operation?(node: OperationNode, context: VisitorContext<OperationNode>): MaybePromise<undefined | null | OperationNode>;
|
|
399
|
-
schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): MaybePromise<undefined | null | SchemaNode>;
|
|
400
|
-
property?(node: PropertyNode, context: VisitorContext<PropertyNode>): MaybePromise<undefined | null | PropertyNode>;
|
|
401
|
-
parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): MaybePromise<undefined | null | ParameterNode>;
|
|
402
|
-
response?(node: ResponseNode, context: VisitorContext<ResponseNode>): MaybePromise<undefined | null | ResponseNode>;
|
|
403
|
-
};
|
|
404
|
-
/**
|
|
405
|
-
* Visitor used by `collect`.
|
|
406
|
-
*
|
|
407
|
-
* @example
|
|
408
|
-
* ```ts
|
|
409
|
-
* const visitor: CollectVisitor<string> = {
|
|
410
|
-
* operation(node) {
|
|
411
|
-
* return node.operationId
|
|
412
|
-
* },
|
|
413
|
-
* }
|
|
414
|
-
* ```
|
|
415
|
-
*/
|
|
416
|
-
type CollectVisitor<T> = {
|
|
417
|
-
input?(node: InputNode, context: VisitorContext<InputNode>): T | null | undefined;
|
|
418
|
-
output?(node: OutputNode, context: VisitorContext<OutputNode>): T | null | undefined;
|
|
419
|
-
operation?(node: OperationNode, context: VisitorContext<OperationNode>): T | null | undefined;
|
|
420
|
-
schema?(node: SchemaNode, context: VisitorContext<SchemaNode>): T | null | undefined;
|
|
421
|
-
property?(node: PropertyNode, context: VisitorContext<PropertyNode>): T | null | undefined;
|
|
422
|
-
parameter?(node: ParameterNode, context: VisitorContext<ParameterNode>): T | null | undefined;
|
|
423
|
-
response?(node: ResponseNode, context: VisitorContext<ResponseNode>): T | null | undefined;
|
|
424
|
-
};
|
|
425
|
-
/**
|
|
426
|
-
* Options for `transform`.
|
|
427
|
-
*
|
|
428
|
-
* @example
|
|
429
|
-
* ```ts
|
|
430
|
-
* const options: TransformOptions = { depth: 'deep', schema: (node) => node }
|
|
431
|
-
* ```
|
|
432
|
-
*
|
|
433
|
-
* @example
|
|
434
|
-
* ```ts
|
|
435
|
-
* // Only transform the current node, not nested children
|
|
436
|
-
* const options: TransformOptions = { depth: 'shallow', schema: (node) => node }
|
|
437
|
-
* ```
|
|
438
|
-
*/
|
|
439
|
-
type TransformOptions = Visitor & {
|
|
440
|
-
/**
|
|
441
|
-
* Traversal depth.
|
|
442
|
-
* @default 'deep'
|
|
443
|
-
*/
|
|
444
|
-
depth?: VisitorDepth;
|
|
445
|
-
/**
|
|
446
|
-
* Internal parent override used during recursion.
|
|
447
|
-
*/
|
|
448
|
-
parent?: Node;
|
|
449
|
-
};
|
|
450
|
-
/**
|
|
451
|
-
* Options for `walk`.
|
|
452
|
-
*
|
|
453
|
-
* @example
|
|
454
|
-
* ```ts
|
|
455
|
-
* const options: WalkOptions = { depth: 'deep', concurrency: 10, root: () => {} }
|
|
456
|
-
* ```
|
|
457
|
-
*/
|
|
458
|
-
type WalkOptions = AsyncVisitor & {
|
|
459
|
-
/**
|
|
460
|
-
* Traversal depth.
|
|
461
|
-
* @default 'deep'
|
|
462
|
-
*/
|
|
463
|
-
depth?: VisitorDepth;
|
|
464
|
-
/**
|
|
465
|
-
* Maximum number of sibling nodes visited concurrently.
|
|
466
|
-
* @default 30
|
|
467
|
-
*/
|
|
468
|
-
concurrency?: number;
|
|
469
|
-
};
|
|
470
|
-
/**
|
|
471
|
-
* Options for `collect`.
|
|
472
|
-
*
|
|
473
|
-
* @example
|
|
474
|
-
* ```ts
|
|
475
|
-
* const options: CollectOptions<string> = { depth: 'shallow', schema: () => undefined }
|
|
476
|
-
* ```
|
|
477
|
-
*/
|
|
478
|
-
type CollectOptions<T> = CollectVisitor<T> & {
|
|
479
|
-
/**
|
|
480
|
-
* Traversal depth.
|
|
481
|
-
* @default 'deep'
|
|
482
|
-
*/
|
|
483
|
-
depth?: VisitorDepth;
|
|
484
|
-
/**
|
|
485
|
-
* Internal parent override used during recursion.
|
|
486
|
-
*/
|
|
487
|
-
parent?: Node;
|
|
488
|
-
};
|
|
489
|
-
/**
|
|
490
|
-
* Async depth-first traversal for side effects. Visitor return values are
|
|
491
|
-
* ignored. Use `transform` when you want to rewrite nodes.
|
|
492
|
-
*
|
|
493
|
-
* Sibling nodes at each depth run concurrently up to `options.concurrency`
|
|
494
|
-
* (defaults to `WALK_CONCURRENCY`). Higher values overlap I/O-bound visitor
|
|
495
|
-
* work. Lower values reduce memory pressure.
|
|
496
|
-
*
|
|
497
|
-
* @example Log every operation
|
|
498
|
-
* ```ts
|
|
499
|
-
* await walk(root, {
|
|
500
|
-
* operation(node) {
|
|
501
|
-
* console.log(node.operationId)
|
|
502
|
-
* },
|
|
503
|
-
* })
|
|
504
|
-
* ```
|
|
505
|
-
*
|
|
506
|
-
* @example Only visit the root node
|
|
507
|
-
* ```ts
|
|
508
|
-
* await walk(root, { depth: 'shallow', input: () => {} })
|
|
509
|
-
* ```
|
|
510
|
-
*/
|
|
511
|
-
declare function walk(node: Node, options: WalkOptions): Promise<void>;
|
|
512
|
-
/**
|
|
513
|
-
* Synchronous depth-first transform. Each visitor callback can return a
|
|
514
|
-
* replacement node. Returning `undefined` keeps the original.
|
|
515
|
-
*
|
|
516
|
-
* The original tree is never mutated, a new tree is returned. Pass
|
|
517
|
-
* `depth: 'shallow'` to skip recursion into children.
|
|
518
|
-
*
|
|
519
|
-
* @example Prefix every operationId
|
|
520
|
-
* ```ts
|
|
521
|
-
* const next = transform(root, {
|
|
522
|
-
* operation(node) {
|
|
523
|
-
* return { ...node, operationId: `prefixed_${node.operationId}` }
|
|
524
|
-
* },
|
|
525
|
-
* })
|
|
526
|
-
* ```
|
|
527
|
-
*
|
|
528
|
-
* @example Replace only the root node
|
|
529
|
-
* ```ts
|
|
530
|
-
* const next = transform(root, {
|
|
531
|
-
* depth: 'shallow',
|
|
532
|
-
* input: (node) => ({ ...node, meta: { ...node.meta, title: 'Rewritten' } }),
|
|
533
|
-
* })
|
|
534
|
-
* ```
|
|
535
|
-
*/
|
|
536
|
-
declare function transform(node: InputNode, options: TransformOptions): InputNode;
|
|
537
|
-
declare function transform(node: OutputNode, options: TransformOptions): OutputNode;
|
|
538
|
-
declare function transform(node: OperationNode, options: TransformOptions): OperationNode;
|
|
539
|
-
declare function transform(node: SchemaNode, options: TransformOptions): SchemaNode;
|
|
540
|
-
declare function transform(node: PropertyNode, options: TransformOptions): PropertyNode;
|
|
541
|
-
declare function transform(node: ParameterNode, options: TransformOptions): ParameterNode;
|
|
542
|
-
declare function transform(node: ResponseNode, options: TransformOptions): ResponseNode;
|
|
543
|
-
declare function transform(node: Node, options: TransformOptions): Node;
|
|
544
|
-
/**
|
|
545
|
-
* Eager depth-first collection pass. Gathers every non-null value the visitor
|
|
546
|
-
* callbacks return into an array.
|
|
547
|
-
*
|
|
548
|
-
* @example Collect every operationId
|
|
549
|
-
* ```ts
|
|
550
|
-
* const ids = collect<string>(root, {
|
|
551
|
-
* operation(node) {
|
|
552
|
-
* return node.operationId
|
|
553
|
-
* },
|
|
554
|
-
* })
|
|
555
|
-
* ```
|
|
556
|
-
*/
|
|
557
|
-
declare function collect<T>(node: Node, options: CollectOptions<T>): Array<T>;
|
|
558
|
-
//#endregion
|
|
559
159
|
//#region src/printer.d.ts
|
|
560
160
|
/**
|
|
561
161
|
* Runtime context passed as `this` to printer handlers.
|
|
@@ -760,5 +360,5 @@ declare function createPrinterFactory<TNode, TKey extends string, TNodeByKey ext
|
|
|
760
360
|
print: (node: TNode) => T["printOutput"] | null;
|
|
761
361
|
};
|
|
762
362
|
//#endregion
|
|
763
|
-
export {
|
|
764
|
-
//# sourceMappingURL=types-
|
|
363
|
+
export { definePrinter as a, DedupeCanonical as c, applyDedupe as d, buildDedupePlan as f, createPrinterFactory as i, DedupeLookups as l, PrinterFactoryOptions as n, SchemaDialect as o, PrinterPartial as r, defineSchemaDialect as s, Printer as t, DedupePlan as u };
|
|
364
|
+
//# sourceMappingURL=types-DyDzizSf.d.ts.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { A as FunctionParametersNode, At as InferSchemaNode, Bt as TypeNode, C as ParameterLocation, Ct as UrlSchemaNode, D as FunctionParamKind, Et as PropertyNode, Ft as ConstNode, G as ExportNode, It as FunctionNode, J as SourceNode, K as FileNode, Lt as JSDocNode, M as ObjectBindingPatternNode, Mt as ArrowFunctionNode, N as TypeExpression, Nt as BreakNode, O as FunctionParamNode, P as TypeLiteralNode, Pt as CodeNode, Rt as JsxNode, St as UnionSchemaNode, _t as SchemaNode, a as InputMeta, bt as StringSchemaNode, ct as DatetimeSchemaNode, d as HttpOperationNode, dt as NumberSchemaNode, f as OperationNode, ft as ObjectSchemaNode, gt as ScalarSchemaType, h as ResponseNode, ht as ScalarSchemaNode, j as IndexedAccessTypeNode, jt as ParserOptions, k as FunctionParameterNode, l as GenericOperationNode, lt as EnumSchemaNode, mt as RefSchemaNode, n as OutputNode, nt as ContentNode, o as InputNode, on as NodeKind, ot as ArraySchemaNode, pt as PrimitiveSchemaType, q as ImportNode, st as DateSchemaNode, t as Node, tn as DistributiveOmit, u as HttpMethod, ut as IntersectionSchemaNode, v as StatusCode, vt as SchemaNodeByType, w as ParameterNode, xt as TimeSchemaNode, y as RequestBodyNode, yt as SchemaType, zt as TextNode } from "./index-BzjwdK2M.js";
|
|
1
|
+
import { A as FunctionParametersNode, At as InferSchemaNode, Bt as TypeNode, C as ParameterLocation, Ct as UrlSchemaNode, D as FunctionParamKind, Et as PropertyNode, Ft as ConstNode, G as ExportNode, It as FunctionNode, J as SourceNode, K as FileNode, Lt as JSDocNode, M as ObjectBindingPatternNode, Mt as ArrowFunctionNode, N as TypeExpression, Nt as BreakNode, O as FunctionParamNode, P as TypeLiteralNode, Pt as CodeNode, Rt as JsxNode, St as UnionSchemaNode, _t as SchemaNode, a as InputMeta, bt as StringSchemaNode, ct as DatetimeSchemaNode, d as HttpOperationNode, dt as NumberSchemaNode, f as OperationNode, ft as ObjectSchemaNode, gt as ScalarSchemaType, h as ResponseNode, ht as ScalarSchemaNode, j as IndexedAccessTypeNode, jt as ParserOptions, k as FunctionParameterNode, l as GenericOperationNode, lt as EnumSchemaNode, mt as RefSchemaNode, n as OutputNode, nn as NodeDef, nt as ContentNode, o as InputNode, on as NodeKind, ot as ArraySchemaNode, pt as PrimitiveSchemaType, q as ImportNode, st as DateSchemaNode, t as Node, tn as DistributiveOmit, u as HttpMethod, ut as IntersectionSchemaNode, v as StatusCode, vt as SchemaNodeByType, w as ParameterNode, xt as TimeSchemaNode, y as RequestBodyNode, yt as SchemaType, zt as TextNode } from "./index-BzjwdK2M.js";
|
|
2
2
|
import { UserFileNode } from "./factory.js";
|
|
3
|
-
import {
|
|
3
|
+
import { a as ParentOf, o as Visitor, s as VisitorContext, t as Macro } from "./defineMacro-BLIR6k-j.js";
|
|
4
|
+
import { c as DedupeCanonical, l as DedupeLookups, n as PrinterFactoryOptions, o as SchemaDialect, r as PrinterPartial, t as Printer, u as DedupePlan } from "./types-DyDzizSf.js";
|
|
4
5
|
import { n as OperationParamsResolver } from "./operationParams-BZ07xDm0.js";
|
|
5
|
-
export type { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode, DedupeCanonical, DedupeLookups, DedupePlan, DistributiveOmit, EnumSchemaNode, ExportNode, FileNode, FunctionNode, FunctionParamKind, FunctionParamNode, FunctionParameterNode, FunctionParametersNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, IndexedAccessTypeNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Node, NodeKind, NumberSchemaNode, ObjectBindingPatternNode, ObjectSchemaNode, OperationNode, OperationParamsResolver, OutputNode, ParameterLocation, ParameterNode, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, RequestBodyNode, ResponseNode, ScalarSchemaNode, ScalarSchemaType, SchemaDialect, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeExpression, TypeLiteralNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext };
|
|
6
|
+
export type { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode, DedupeCanonical, DedupeLookups, DedupePlan, DistributiveOmit, EnumSchemaNode, ExportNode, FileNode, FunctionNode, FunctionParamKind, FunctionParamNode, FunctionParameterNode, FunctionParametersNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, IndexedAccessTypeNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeDef, NodeKind, NumberSchemaNode, ObjectBindingPatternNode, ObjectSchemaNode, OperationNode, OperationParamsResolver, OutputNode, ParameterLocation, ParameterNode, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, RequestBodyNode, ResponseNode, ScalarSchemaNode, ScalarSchemaType, SchemaDialect, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeExpression, TypeLiteralNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext };
|