@kubb/ast 5.0.0-alpha.31 → 5.0.0-alpha.32
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 +1556 -1067
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +42 -3
- package/dist/index.js +1519 -1067
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -2
- package/dist/{visitor-z-5U8NoF.d.ts → visitor-DysNCWvh.d.ts} +794 -61
- package/package.json +1 -1
- package/src/constants.ts +7 -1
- package/src/factory.ts +296 -24
- package/src/guards.ts +17 -4
- package/src/index.ts +23 -5
- package/src/mocks.ts +6 -6
- package/src/nodes/base.ts +11 -2
- package/src/nodes/code.ts +237 -0
- package/src/nodes/file.ts +235 -0
- package/src/nodes/function.ts +35 -17
- package/src/nodes/index.ts +32 -7
- package/src/nodes/output.ts +26 -0
- package/src/nodes/root.ts +9 -8
- package/src/refs.ts +5 -5
- package/src/types.ts +14 -2
- package/src/utils.ts +177 -19
- package/src/visitor.ts +52 -25
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as __name } from "./chunk--u3MIqq1.js";
|
|
2
|
-
import { A as
|
|
2
|
+
import { A as createOperation, At as FunctionParametersNode, B as syncOptionality, C as createExport, D as createFunctionParameters, E as createFunctionParameter, F as createProperty, Ft as ImportNode, I as createResponse, It as SourceNode, Jt as httpMethods, K as InputNode, Kt as ScalarPrimitive, L as createSchema, M as createParameter, N as createParameterGroup, Nt as ExportNode, O as createImport, P as createParamsType, Qt as schemaTypes, R as createSource, S as createConst, T as createFunction, U as ParserOptions, Xt as mediaTypes, Y as OperationNode, Yt as isScalarPrimitive, Zt as nodeKinds, _ as PrinterPartial, d as transform, f as walk, g as PrinterFactoryOptions, h as Printer, j as createOutput, jt as ParameterGroupNode, k as createInput, kt as FunctionParameterNode, l as collect, m as extractRefName, q as OutputNode, tt as ParameterNode, u as composeTransformers, v as createPrinterFactory, vt as SchemaNode, w as createFile, x as createArrowFunction, y as definePrinter, yt as SchemaNodeByType, z as createType } from "./visitor-DysNCWvh.js";
|
|
3
3
|
|
|
4
4
|
//#region src/guards.d.ts
|
|
5
5
|
/**
|
|
@@ -12,6 +12,28 @@ import { A as createTypeNode, At as schemaTypes, C as createOperation, D as crea
|
|
|
12
12
|
* ```
|
|
13
13
|
*/
|
|
14
14
|
declare function narrowSchema<T extends SchemaNode['type']>(node: SchemaNode | undefined, type: T): SchemaNodeByType[T] | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Returns `true` when the input is an `InputNode`.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* if (isInputNode(node)) {
|
|
21
|
+
* console.log(node.schemas.length)
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
declare const isInputNode: (node: unknown) => node is InputNode;
|
|
26
|
+
/**
|
|
27
|
+
* Returns `true` when the input is an `OutputNode`.
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* if (isOutputNode(node)) {
|
|
32
|
+
* console.log(node.files.length)
|
|
33
|
+
* }
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
declare const isOutputNode: (node: unknown) => node is OutputNode;
|
|
15
37
|
/**
|
|
16
38
|
* Returns `true` when the input is an `OperationNode`.
|
|
17
39
|
*
|
|
@@ -300,11 +322,28 @@ type CreateOperationParamsOptions = {
|
|
|
300
322
|
* paramsType: 'inline',
|
|
301
323
|
* pathParamsType: 'inline',
|
|
302
324
|
* resolver: tsResolver,
|
|
303
|
-
* extraParams: [createFunctionParameter({ name: 'options', type:
|
|
325
|
+
* extraParams: [createFunctionParameter({ name: 'options', type: createParamsType({ variant: 'reference', name: 'Partial<RequestOptions>' }), default: '{}' })],
|
|
304
326
|
* })
|
|
305
327
|
* ```
|
|
306
328
|
*/
|
|
307
329
|
declare function createOperationParams(node: OperationNode, options: CreateOperationParamsOptions): FunctionParametersNode;
|
|
330
|
+
/**
|
|
331
|
+
* Deduplicates an array of `SourceNode` objects.
|
|
332
|
+
* Named sources are deduplicated by `name + isExportable + isTypeOnly`.
|
|
333
|
+
* Unnamed sources are deduplicated by `value`.
|
|
334
|
+
*/
|
|
335
|
+
declare function combineSources(sources: Array<SourceNode>): Array<SourceNode>;
|
|
336
|
+
/**
|
|
337
|
+
* Deduplicates and merges an array of `ExportNode` objects.
|
|
338
|
+
* Exports with the same path and `isTypeOnly` flag have their names merged.
|
|
339
|
+
*/
|
|
340
|
+
declare function combineExports(exports: Array<ExportNode>): Array<ExportNode>;
|
|
341
|
+
/**
|
|
342
|
+
* Deduplicates and merges an array of `ImportNode` objects.
|
|
343
|
+
* Filters out unused imports (names not referenced in `source` or re-exported).
|
|
344
|
+
* Imports with the same path and `isTypeOnly` flag have their names merged.
|
|
345
|
+
*/
|
|
346
|
+
declare function combineImports(imports: Array<ImportNode>, exports: Array<ExportNode>, source?: string): Array<ImportNode>;
|
|
308
347
|
//#endregion
|
|
309
|
-
export { type OperationParamsResolver, type ParserOptions, type Printer, type PrinterFactoryOptions, type PrinterPartial, type ScalarPrimitive, caseParams, childName, collect, collectImports, composeTransformers, createDiscriminantNode, createFunctionParameter, createFunctionParameters, createOperation, createOperationParams, createParameter, createParameterGroup, createPrinterFactory, createProperty, createResponse,
|
|
348
|
+
export { type OperationParamsResolver, type ParserOptions, type Printer, type PrinterFactoryOptions, type PrinterPartial, type ScalarPrimitive, caseParams, childName, collect, collectImports, combineExports, combineImports, combineSources, composeTransformers, createArrowFunction, createConst, createDiscriminantNode, createExport, createFile, createFunction, createFunctionParameter, createFunctionParameters, createImport, createInput, createOperation, createOperationParams, createOutput, createParameter, createParameterGroup, createParamsType, createPrinterFactory, createProperty, createResponse, createSchema, createSource, createType, definePrinter, enumPropName, extractRefName, findDiscriminator, httpMethods, isInputNode, isOperationNode, isOutputNode, isScalarPrimitive, isSchemaNode, isStringType, mediaTypes, mergeAdjacentObjects, narrowSchema, nodeKinds, schemaTypes, setDiscriminatorEnum, setEnumName, simplifyUnion, syncOptionality, syncSchemaRef, transform, walk };
|
|
310
349
|
//# sourceMappingURL=index.d.ts.map
|