@kubb/ast 5.9.5 → 5.9.6
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 +12 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +16 -3
- package/dist/index.js +12 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -70,6 +70,8 @@ export declare const schemaTypes: {
|
|
|
70
70
|
* "All of" multiple schema members.
|
|
71
71
|
*/
|
|
72
72
|
readonly intersection: "intersection";
|
|
73
|
+
/** "Not" a single schema member. */
|
|
74
|
+
readonly not: "not";
|
|
73
75
|
/**
|
|
74
76
|
* Enum schema.
|
|
75
77
|
*/
|
|
@@ -462,6 +464,11 @@ type IntersectionSchemaNode = CompositeSchemaNodeBase & {
|
|
|
462
464
|
*/
|
|
463
465
|
type: 'intersection';
|
|
464
466
|
};
|
|
467
|
+
/** Negation from `not`: the value must not match its single member. Printers that cannot express it return `null`. */
|
|
468
|
+
type NotSchemaNode = CompositeSchemaNodeBase & {
|
|
469
|
+
/** Schema type discriminator. */
|
|
470
|
+
type: 'not';
|
|
471
|
+
};
|
|
465
472
|
/**
|
|
466
473
|
* One named enum item.
|
|
467
474
|
*/
|
|
@@ -744,6 +751,7 @@ type SchemaNodeByType = {
|
|
|
744
751
|
tuple: ArraySchemaNode;
|
|
745
752
|
union: UnionSchemaNode;
|
|
746
753
|
intersection: IntersectionSchemaNode;
|
|
754
|
+
not: NotSchemaNode;
|
|
747
755
|
enum: EnumSchemaNode;
|
|
748
756
|
ref: RefSchemaNode;
|
|
749
757
|
datetime: DatetimeSchemaNode;
|
|
@@ -769,7 +777,7 @@ type SchemaNodeByType = {
|
|
|
769
777
|
/**
|
|
770
778
|
* Union of all schema node types.
|
|
771
779
|
*/
|
|
772
|
-
type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | ScalarSchemaNode;
|
|
780
|
+
type SchemaNode = ObjectSchemaNode | ArraySchemaNode | UnionSchemaNode | IntersectionSchemaNode | NotSchemaNode | EnumSchemaNode | RefSchemaNode | DatetimeSchemaNode | DateSchemaNode | TimeSchemaNode | StringSchemaNode | NumberSchemaNode | UrlSchemaNode | FormatStringSchemaNode | ScalarSchemaNode;
|
|
773
781
|
type CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & {
|
|
774
782
|
properties?: Array<PropertyNode>;
|
|
775
783
|
primitive?: 'object';
|
|
@@ -845,6 +853,11 @@ type ParameterNode = BaseNode & {
|
|
|
845
853
|
* leaving consumers to apply the default for the style.
|
|
846
854
|
*/
|
|
847
855
|
explode?: boolean;
|
|
856
|
+
/**
|
|
857
|
+
* Whether reserved characters (RFC 3986 `:/?#[]@!$&'()*+,;=`) are sent as-is instead of
|
|
858
|
+
* percent-encoded. Only applies to query parameters. Absent when the source omits it.
|
|
859
|
+
*/
|
|
860
|
+
allowReserved?: boolean;
|
|
848
861
|
};
|
|
849
862
|
type UserParameterNode = Pick<ParameterNode, 'name' | 'in' | 'schema'> & Partial<Omit<ParameterNode, 'kind' | 'name' | 'in' | 'schema'>>;
|
|
850
863
|
/**
|
|
@@ -2645,8 +2658,8 @@ type ParserOptions = {
|
|
|
2645
2658
|
enumSuffix: 'enum' | (string & {});
|
|
2646
2659
|
};
|
|
2647
2660
|
declare namespace index_d_exports {
|
|
2648
|
-
export { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateOnlyTypeValue, DateSchemaNode, DateTimeTypeValue, DateTypeOptions, DatetimeSchemaNode, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InputMeta, InputNode, InputSecurityScheme, InputServer, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeKind, NumberSchemaNode, ObjectSchemaNode, OperationNode, ParameterLocation, ParameterNode, ParameterStyle, ParentOf, 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, composeMacros, createPrinter, defineMacro, extractStringsFromNodes, index_d_exports$1 as factory, findCircularSchemas, findCircularSchemasFromGraph, getSchemaLiteralValues, inferDiscriminatorPropertyName, isBareRef, isHttpOperationNode, mergeRefWithSchema, narrowSchema, optionality, refName, resolveRefName, resolveSchemaProperties, schemaTypes, transform };
|
|
2661
|
+
export { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateOnlyTypeValue, DateSchemaNode, DateTimeTypeValue, DateTypeOptions, DatetimeSchemaNode, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InputMeta, InputNode, InputSecurityScheme, InputServer, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeKind, NotSchemaNode, NumberSchemaNode, ObjectSchemaNode, OperationNode, ParameterLocation, ParameterNode, ParameterStyle, ParentOf, 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, composeMacros, createPrinter, defineMacro, extractStringsFromNodes, index_d_exports$1 as factory, findCircularSchemas, findCircularSchemasFromGraph, getSchemaLiteralValues, inferDiscriminatorPropertyName, isBareRef, isHttpOperationNode, mergeRefWithSchema, narrowSchema, optionality, refName, resolveRefName, resolveSchemaProperties, schemaTypes, transform };
|
|
2649
2662
|
}
|
|
2650
2663
|
//#endregion
|
|
2651
|
-
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 Enforce, type EnumSchemaNode, type ExportNode, type FileNode, type FunctionNode, type GenericOperationNode, type HttpMethod, type HttpOperationNode, type ImportNode, type InputMeta, type InputNode, type InputSecurityScheme, type InputServer, type IntersectionSchemaNode, type JSDocNode, type JsxNode, type Macro, type Node, type NodeKind, type NumberSchemaNode, type ObjectSchemaNode, type OperationNode, type ParameterLocation, type ParameterNode, type ParameterStyle, type ParentOf, 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 };
|
|
2664
|
+
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 Enforce, type EnumSchemaNode, type ExportNode, type FileNode, type FunctionNode, type GenericOperationNode, type HttpMethod, type HttpOperationNode, type ImportNode, 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 ParentOf, 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 };
|
|
2652
2665
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -64,6 +64,8 @@ const schemaTypes = {
|
|
|
64
64
|
* "All of" multiple schema members.
|
|
65
65
|
*/
|
|
66
66
|
intersection: "intersection",
|
|
67
|
+
/** "Not" a single schema member. */
|
|
68
|
+
not: "not",
|
|
67
69
|
/**
|
|
68
70
|
* Enum schema.
|
|
69
71
|
*/
|
|
@@ -1089,16 +1091,17 @@ function mergeByPath(result) {
|
|
|
1089
1091
|
}
|
|
1090
1092
|
/**
|
|
1091
1093
|
* Deduplicates `SourceNode` objects by `name + isExportable + isTypeOnly`, keeping the first of each
|
|
1092
|
-
* key.
|
|
1093
|
-
* the deduplicated array in original order.
|
|
1094
|
+
* key. An unnamed source only drops when the same node appears twice, so markdown can repeat a
|
|
1095
|
+
* paragraph or a table. Returns the deduplicated array in original order.
|
|
1094
1096
|
*/
|
|
1095
1097
|
function combineSources(sources) {
|
|
1096
|
-
const seen = /* @__PURE__ */ new
|
|
1097
|
-
|
|
1098
|
-
const key =
|
|
1099
|
-
if (
|
|
1100
|
-
|
|
1101
|
-
|
|
1098
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1099
|
+
return sources.filter((source) => {
|
|
1100
|
+
const key = source.name != null ? `${source.name}:${source.isExportable ?? false}:${source.isTypeOnly ?? false}` : source;
|
|
1101
|
+
if (seen.has(key)) return false;
|
|
1102
|
+
seen.add(key);
|
|
1103
|
+
return true;
|
|
1104
|
+
});
|
|
1102
1105
|
}
|
|
1103
1106
|
/**
|
|
1104
1107
|
* Deduplicates and merges `ExportNode` objects by path and type.
|
|
@@ -1403,7 +1406,7 @@ function createResponse(props) {
|
|
|
1403
1406
|
/**
|
|
1404
1407
|
* Maps schema `type` to its underlying `primitive`.
|
|
1405
1408
|
* Primitive types map to themselves and special string formats map to `'string'`.
|
|
1406
|
-
* Any type not listed here (such as `ref`, `enum`, `union`, `intersection`, `tuple`, `ipv4`, `ipv6`, `blob`) has no `primitive`.
|
|
1409
|
+
* Any type not listed here (such as `ref`, `enum`, `union`, `intersection`, `not`, `tuple`, `ipv4`, `ipv6`, `blob`) has no `primitive`.
|
|
1407
1410
|
*/
|
|
1408
1411
|
const TYPE_TO_PRIMITIVE = {
|
|
1409
1412
|
string: "string",
|