@kubb/ast 5.0.0-beta.32 → 5.0.0-beta.33
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 -3
- package/dist/index.cjs +3 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -3727
- package/dist/index.js +4 -85
- package/dist/index.js.map +1 -1
- package/dist/types-CE8VJ5_y.d.ts +3605 -0
- package/dist/types.cjs +0 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.js +1 -0
- package/package.json +5 -1
- package/src/constants.ts +0 -50
- package/src/index.ts +5 -9
- package/src/infer.ts +0 -9
- package/src/refs.ts +0 -7
- package/src/types.ts +1 -2
- package/src/visitor.ts +8 -4
package/dist/index.js
CHANGED
|
@@ -6,25 +6,6 @@ const visitorDepths = {
|
|
|
6
6
|
shallow: "shallow",
|
|
7
7
|
deep: "deep"
|
|
8
8
|
};
|
|
9
|
-
const nodeKinds = {
|
|
10
|
-
input: "Input",
|
|
11
|
-
output: "Output",
|
|
12
|
-
operation: "Operation",
|
|
13
|
-
schema: "Schema",
|
|
14
|
-
property: "Property",
|
|
15
|
-
parameter: "Parameter",
|
|
16
|
-
response: "Response",
|
|
17
|
-
functionParameter: "FunctionParameter",
|
|
18
|
-
parameterGroup: "ParameterGroup",
|
|
19
|
-
functionParameters: "FunctionParameters",
|
|
20
|
-
type: "Type",
|
|
21
|
-
file: "File",
|
|
22
|
-
import: "Import",
|
|
23
|
-
export: "Export",
|
|
24
|
-
source: "Source",
|
|
25
|
-
text: "Text",
|
|
26
|
-
break: "Break"
|
|
27
|
-
};
|
|
28
9
|
/**
|
|
29
10
|
* Schema type discriminators used by all AST schema nodes.
|
|
30
11
|
*
|
|
@@ -173,33 +154,6 @@ const httpMethods = {
|
|
|
173
154
|
options: "OPTIONS",
|
|
174
155
|
trace: "TRACE"
|
|
175
156
|
};
|
|
176
|
-
/**
|
|
177
|
-
* Common MIME types used in request/response content negotiation.
|
|
178
|
-
*
|
|
179
|
-
* Covers JSON, XML, form data, PDFs, images, audio, and video formats.
|
|
180
|
-
* Use these as keys when serializing request/response bodies.
|
|
181
|
-
*/
|
|
182
|
-
const mediaTypes = {
|
|
183
|
-
applicationJson: "application/json",
|
|
184
|
-
applicationXml: "application/xml",
|
|
185
|
-
applicationFormUrlEncoded: "application/x-www-form-urlencoded",
|
|
186
|
-
applicationOctetStream: "application/octet-stream",
|
|
187
|
-
applicationPdf: "application/pdf",
|
|
188
|
-
applicationZip: "application/zip",
|
|
189
|
-
applicationGraphql: "application/graphql",
|
|
190
|
-
multipartFormData: "multipart/form-data",
|
|
191
|
-
textPlain: "text/plain",
|
|
192
|
-
textHtml: "text/html",
|
|
193
|
-
textCsv: "text/csv",
|
|
194
|
-
textXml: "text/xml",
|
|
195
|
-
imagePng: "image/png",
|
|
196
|
-
imageJpeg: "image/jpeg",
|
|
197
|
-
imageGif: "image/gif",
|
|
198
|
-
imageWebp: "image/webp",
|
|
199
|
-
imageSvgXml: "image/svg+xml",
|
|
200
|
-
audioMpeg: "audio/mpeg",
|
|
201
|
-
videoMp4: "video/mp4"
|
|
202
|
-
};
|
|
203
157
|
//#endregion
|
|
204
158
|
//#region ../../internals/utils/src/casing.ts
|
|
205
159
|
/**
|
|
@@ -442,28 +396,6 @@ function isKind(kind) {
|
|
|
442
396
|
return (node) => node.kind === kind;
|
|
443
397
|
}
|
|
444
398
|
/**
|
|
445
|
-
* Returns `true` when the input is an `InputNode`.
|
|
446
|
-
*
|
|
447
|
-
* @example
|
|
448
|
-
* ```ts
|
|
449
|
-
* if (isInputNode(node)) {
|
|
450
|
-
* console.log(node.schemas.length)
|
|
451
|
-
* }
|
|
452
|
-
* ```
|
|
453
|
-
*/
|
|
454
|
-
const isInputNode = isKind("Input");
|
|
455
|
-
/**
|
|
456
|
-
* Returns `true` when the input is an `OutputNode`.
|
|
457
|
-
*
|
|
458
|
-
* @example
|
|
459
|
-
* ```ts
|
|
460
|
-
* if (isOutputNode(node)) {
|
|
461
|
-
* console.log(node.files.length)
|
|
462
|
-
* }
|
|
463
|
-
* ```
|
|
464
|
-
*/
|
|
465
|
-
const isOutputNode = isKind("Output");
|
|
466
|
-
/**
|
|
467
399
|
* Returns `true` when the input is an `OperationNode`.
|
|
468
400
|
*
|
|
469
401
|
* @example
|
|
@@ -654,8 +586,9 @@ async function walk(node, options) {
|
|
|
654
586
|
}
|
|
655
587
|
async function _walk(node, visitor, recurse, limit, parent) {
|
|
656
588
|
await limit(() => applyVisitor(node, visitor, parent));
|
|
657
|
-
const children = getChildren(node, recurse);
|
|
658
|
-
|
|
589
|
+
const children = Array.from(getChildren(node, recurse));
|
|
590
|
+
if (children.length === 0) return;
|
|
591
|
+
await Promise.all(children.map((child) => _walk(child, visitor, recurse, limit, node)));
|
|
659
592
|
}
|
|
660
593
|
function transform(node, options) {
|
|
661
594
|
const { depth, parent, ...visitor } = options;
|
|
@@ -2333,17 +2266,6 @@ function signatureOf(node) {
|
|
|
2333
2266
|
function schemaSignature(node) {
|
|
2334
2267
|
return signatureOf(node);
|
|
2335
2268
|
}
|
|
2336
|
-
/**
|
|
2337
|
-
* Returns `true` when two schema nodes are structurally identical under shape-only equality.
|
|
2338
|
-
*
|
|
2339
|
-
* @example
|
|
2340
|
-
* ```ts
|
|
2341
|
-
* isSchemaEqual(a, b) // a and b produce the same TypeScript type
|
|
2342
|
-
* ```
|
|
2343
|
-
*/
|
|
2344
|
-
function isSchemaEqual(a, b) {
|
|
2345
|
-
return schemaSignature(a) === schemaSignature(b);
|
|
2346
|
-
}
|
|
2347
2269
|
//#endregion
|
|
2348
2270
|
//#region src/dedupe.ts
|
|
2349
2271
|
/**
|
|
@@ -2683,9 +2605,6 @@ function* mergeAdjacentObjectsLazy(members) {
|
|
|
2683
2605
|
}
|
|
2684
2606
|
if (acc !== void 0) yield acc;
|
|
2685
2607
|
}
|
|
2686
|
-
function mergeAdjacentObjects(members) {
|
|
2687
|
-
return [...mergeAdjacentObjectsLazy(members)];
|
|
2688
|
-
}
|
|
2689
2608
|
/**
|
|
2690
2609
|
* Removes enum members that are covered by broader scalar primitives in the same union.
|
|
2691
2610
|
*
|
|
@@ -2725,6 +2644,6 @@ function setEnumName(propNode, parentName, propName, enumSuffix) {
|
|
|
2725
2644
|
return propNode;
|
|
2726
2645
|
}
|
|
2727
2646
|
//#endregion
|
|
2728
|
-
export { applyDedupe, buildDedupePlan, caseParams, childName, collect, collectImports,
|
|
2647
|
+
export { applyDedupe, buildDedupePlan, caseParams, childName, collect, collectImports, collectUsedSchemaNames, containsCircularRef, createArrowFunction, createBreak, createConst, createDiscriminantNode, createExport, createFile, createFunction, createFunctionParameter, createFunctionParameters, createImport, createInput, createJsx, createOperation, createOperationParams, createOutput, createParameter, createParameterGroup, createParamsType, createPrinterFactory, createProperty, createResponse, createSchema, createSource, createStreamInput, createText, createType, definePrinter, defineSchemaDialect, dispatch, enumPropName, extractRefName, extractStringsFromNodes, findCircularSchemas, findDiscriminator, httpMethods, isHttpOperationNode, isOperationNode, isSchemaNode, isStringType, mergeAdjacentObjectsLazy, narrowSchema, schemaSignature, schemaTypes, setDiscriminatorEnum, setEnumName, simplifyUnion, syncOptionality, syncSchemaRef, transform, update, walk };
|
|
2729
2648
|
|
|
2730
2649
|
//# sourceMappingURL=index.js.map
|