@kubb/ast 5.0.0-beta.32 → 5.0.0-beta.34
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 +17 -8
- package/dist/index.cjs +3 -72
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -3705
- package/dist/index.js +4 -63
- 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 +4 -8
- 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
|
/**
|
|
@@ -654,8 +608,9 @@ async function walk(node, options) {
|
|
|
654
608
|
}
|
|
655
609
|
async function _walk(node, visitor, recurse, limit, parent) {
|
|
656
610
|
await limit(() => applyVisitor(node, visitor, parent));
|
|
657
|
-
const children = getChildren(node, recurse);
|
|
658
|
-
|
|
611
|
+
const children = Array.from(getChildren(node, recurse));
|
|
612
|
+
if (children.length === 0) return;
|
|
613
|
+
await Promise.all(children.map((child) => _walk(child, visitor, recurse, limit, node)));
|
|
659
614
|
}
|
|
660
615
|
function transform(node, options) {
|
|
661
616
|
const { depth, parent, ...visitor } = options;
|
|
@@ -2333,17 +2288,6 @@ function signatureOf(node) {
|
|
|
2333
2288
|
function schemaSignature(node) {
|
|
2334
2289
|
return signatureOf(node);
|
|
2335
2290
|
}
|
|
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
2291
|
//#endregion
|
|
2348
2292
|
//#region src/dedupe.ts
|
|
2349
2293
|
/**
|
|
@@ -2683,9 +2627,6 @@ function* mergeAdjacentObjectsLazy(members) {
|
|
|
2683
2627
|
}
|
|
2684
2628
|
if (acc !== void 0) yield acc;
|
|
2685
2629
|
}
|
|
2686
|
-
function mergeAdjacentObjects(members) {
|
|
2687
|
-
return [...mergeAdjacentObjectsLazy(members)];
|
|
2688
|
-
}
|
|
2689
2630
|
/**
|
|
2690
2631
|
* Removes enum members that are covered by broader scalar primitives in the same union.
|
|
2691
2632
|
*
|
|
@@ -2725,6 +2666,6 @@ function setEnumName(propNode, parentName, propName, enumSuffix) {
|
|
|
2725
2666
|
return propNode;
|
|
2726
2667
|
}
|
|
2727
2668
|
//#endregion
|
|
2728
|
-
export { applyDedupe, buildDedupePlan, caseParams, childName, collect, collectImports,
|
|
2669
|
+
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, isInputNode, isOperationNode, isOutputNode, isSchemaNode, isStringType, mergeAdjacentObjectsLazy, narrowSchema, schemaSignature, schemaTypes, setDiscriminatorEnum, setEnumName, simplifyUnion, syncOptionality, syncSchemaRef, transform, update, walk };
|
|
2729
2670
|
|
|
2730
2671
|
//# sourceMappingURL=index.js.map
|