@kubb/ast 5.0.0-beta.68 → 5.0.0-beta.69
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/{defineMacro-DoMJxLWT.cjs → defineMacro-Bh5E_Il6.cjs} +4 -4
- package/dist/{defineMacro-DoMJxLWT.cjs.map → defineMacro-Bh5E_Il6.cjs.map} +1 -1
- package/dist/{defineMacro-_xJf504Y.js → defineMacro-CVrU3ajV.js} +2 -2
- package/dist/{defineMacro-_xJf504Y.js.map → defineMacro-CVrU3ajV.js.map} +1 -1
- package/dist/index.cjs +97 -354
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +17 -33
- package/dist/index.js +3 -259
- package/dist/index.js.map +1 -1
- package/dist/macros.cjs +10 -9
- package/dist/macros.cjs.map +1 -1
- package/dist/macros.js +3 -2
- package/dist/macros.js.map +1 -1
- package/dist/refs-8IwpesXW.cjs +157 -0
- package/dist/refs-8IwpesXW.cjs.map +1 -0
- package/dist/refs-D2qwT5ck.js +117 -0
- package/dist/refs-D2qwT5ck.js.map +1 -0
- package/dist/{types-BOsOrEZf.d.ts → types-Df1jVmRy.d.ts} +7 -24
- package/dist/types.d.ts +2 -2
- package/dist/utils.cjs +800 -27
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.js +776 -2
- package/dist/utils.js.map +1 -0
- package/dist/{refs-DLBwxlrG.cjs → visitor-CLLDwBvv.cjs} +7 -155
- package/dist/visitor-CLLDwBvv.cjs.map +1 -0
- package/dist/{refs-CQNBUfBU.js → visitor-DG5ROqRx.js} +2 -114
- package/dist/visitor-DG5ROqRx.js.map +1 -0
- package/package.json +1 -1
- package/dist/refs-CQNBUfBU.js.map +0 -1
- package/dist/refs-DLBwxlrG.cjs.map +0 -1
- package/dist/utils-BjyHu4VI.cjs +0 -918
- package/dist/utils-BjyHu4VI.cjs.map +0 -1
- package/dist/utils-BlvDdD8y.js +0 -776
- package/dist/utils-BlvDdD8y.js.map +0 -1
package/dist/macros.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const require_defineMacro = require("./defineMacro-
|
|
2
|
+
const require_visitor = require("./visitor-CLLDwBvv.cjs");
|
|
3
|
+
const require_defineMacro = require("./defineMacro-Bh5E_Il6.cjs");
|
|
4
|
+
const require_refs = require("./refs-8IwpesXW.cjs");
|
|
4
5
|
//#region src/macros/macroDiscriminatorEnum.ts
|
|
5
6
|
/**
|
|
6
7
|
* Builds a macro that replaces a discriminator property's schema with a string enum of the given
|
|
@@ -16,16 +17,16 @@ function macroDiscriminatorEnum({ propertyName, values, enumName }) {
|
|
|
16
17
|
return require_defineMacro.defineMacro({
|
|
17
18
|
name: "discriminator-enum",
|
|
18
19
|
schema(node) {
|
|
19
|
-
const objectNode =
|
|
20
|
+
const objectNode = require_visitor.narrowSchema(node, "object");
|
|
20
21
|
if (!objectNode?.properties?.length) return void 0;
|
|
21
22
|
if (!objectNode.properties.some((prop) => prop.name === propertyName)) return void 0;
|
|
22
|
-
return
|
|
23
|
+
return require_visitor.createSchema({
|
|
23
24
|
...objectNode,
|
|
24
25
|
properties: objectNode.properties.map((prop) => {
|
|
25
26
|
if (prop.name !== propertyName) return prop;
|
|
26
|
-
return
|
|
27
|
+
return require_visitor.createProperty({
|
|
27
28
|
...prop,
|
|
28
|
-
schema:
|
|
29
|
+
schema: require_visitor.createSchema({
|
|
29
30
|
type: "enum",
|
|
30
31
|
primitive: "string",
|
|
31
32
|
enumValues: values,
|
|
@@ -55,7 +56,7 @@ function macroEnumName({ parentName, propName, enumSuffix }) {
|
|
|
55
56
|
return require_defineMacro.defineMacro({
|
|
56
57
|
name: "enum-name",
|
|
57
58
|
schema(node) {
|
|
58
|
-
const enumNode =
|
|
59
|
+
const enumNode = require_visitor.narrowSchema(node, "enum");
|
|
59
60
|
if (enumNode?.primitive === "boolean") return {
|
|
60
61
|
...node,
|
|
61
62
|
name: null
|
|
@@ -89,7 +90,7 @@ function simplifyUnionMembers(members) {
|
|
|
89
90
|
const scalarPrimitives = new Set(members.filter((member) => isScalarPrimitive(member.type)).map((m) => m.type));
|
|
90
91
|
if (!scalarPrimitives.size) return members;
|
|
91
92
|
return members.filter((member) => {
|
|
92
|
-
const enumNode =
|
|
93
|
+
const enumNode = require_visitor.narrowSchema(member, "enum");
|
|
93
94
|
if (!enumNode) return true;
|
|
94
95
|
const primitive = enumNode.primitive;
|
|
95
96
|
if (!primitive) return true;
|
|
@@ -111,7 +112,7 @@ function simplifyUnionMembers(members) {
|
|
|
111
112
|
const macroSimplifyUnion = require_defineMacro.defineMacro({
|
|
112
113
|
name: "simplify-union",
|
|
113
114
|
schema(node) {
|
|
114
|
-
const unionNode =
|
|
115
|
+
const unionNode = require_visitor.narrowSchema(node, "union");
|
|
115
116
|
if (!unionNode?.members?.length) return void 0;
|
|
116
117
|
const simplified = simplifyUnionMembers(unionNode.members);
|
|
117
118
|
if (simplified.length === unionNode.members.length) return void 0;
|
package/dist/macros.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macros.cjs","names":["defineMacro","narrowSchema","createSchema","createProperty","defineMacro","narrowSchema","enumPropName","narrowSchema","defineMacro"],"sources":["../src/macros/macroDiscriminatorEnum.ts","../src/macros/macroEnumName.ts","../src/macros/macroSimplifyUnion.ts"],"sourcesContent":["import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { createProperty } from '../nodes/property.ts'\nimport { createSchema } from '../nodes/schema.ts'\n\ntype Props = {\n propertyName: string\n values: Array<string>\n enumName?: string\n}\n\n/**\n * Builds a macro that replaces a discriminator property's schema with a string enum of the given\n * values. Object schemas that lack the property are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroDiscriminatorEnum({ propertyName: 'type', values: ['dog', 'cat'] })\n * const next = applyMacros(objectSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroDiscriminatorEnum({ propertyName, values, enumName }: Props) {\n return defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = narrowSchema(node, 'object')\n if (!objectNode?.properties?.length) return undefined\n if (!objectNode.properties.some((prop) => prop.name === propertyName)) return undefined\n\n return createSchema({\n ...objectNode,\n properties: objectNode.properties.map((prop) => {\n if (prop.name !== propertyName) return prop\n\n return createProperty({\n ...prop,\n schema: createSchema({\n type: 'enum',\n primitive: 'string',\n enumValues: values,\n name: enumName,\n readOnly: prop.schema.readOnly,\n writeOnly: prop.schema.writeOnly,\n }),\n })\n }),\n })\n },\n })\n}\n","import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { enumPropName } from '../utils/refs.ts'\n\ntype Props = {\n parentName: string | null | undefined\n propName: string\n enumSuffix: string\n}\n\n/**\n * Builds a macro that names an inline enum schema from its parent and property name. Boolean enums\n * are left anonymous. Non-enum nodes are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroEnumName({ parentName: 'Pet', propName: 'status', enumSuffix: 'enum' })\n * const named = applyMacros(propSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroEnumName({ parentName, propName, enumSuffix }: Props) {\n return defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = narrowSchema(node, 'enum')\n\n if (enumNode?.primitive === 'boolean') return { ...node, name: null }\n if (enumNode) return { ...node, name: enumPropName(parentName, propName, enumSuffix) }\n\n return undefined\n },\n })\n}\n","import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\n\ntype ScalarPrimitive = 'string' | 'number' | 'integer' | 'bigint' | 'boolean'\n\n/**\n * Scalar primitive schema types used for union simplification and type narrowing.\n */\nconst SCALAR_PRIMITIVE_TYPES = new Set<ScalarPrimitive>(['string', 'number', 'integer', 'bigint', 'boolean'])\n\nfunction isScalarPrimitive(type: string): type is ScalarPrimitive {\n return SCALAR_PRIMITIVE_TYPES.has(type as ScalarPrimitive)\n}\n\n/**\n * Filters union members, dropping enum members that a broader scalar primitive already covers.\n */\nfunction simplifyUnionMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const scalarPrimitives = new Set(members.filter((member) => isScalarPrimitive(member.type)).map((m) => m.type))\n if (!scalarPrimitives.size) return members\n\n return members.filter((member) => {\n const enumNode = narrowSchema(member, 'enum')\n if (!enumNode) return true\n\n const primitive = enumNode.primitive\n if (!primitive) return true\n\n const enumValueCount = enumNode.namedEnumValues?.length ?? enumNode.enumValues?.length ?? 0\n if (enumValueCount <= 1) return true\n\n if (scalarPrimitives.has(primitive)) return false\n if ((primitive === 'integer' || primitive === 'number') && (scalarPrimitives.has('integer') || scalarPrimitives.has('number'))) return false\n\n return true\n })\n}\n\n/**\n * Removes union members a broader scalar primitive already covers, such as a multi-value string enum\n * sitting next to a plain `string`. Single-value enums are kept.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroSimplifyUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroSimplifyUnion = defineMacro({\n name: 'simplify-union',\n schema(node) {\n const unionNode = narrowSchema(node, 'union')\n if (!unionNode?.members?.length) return undefined\n\n const simplified = simplifyUnionMembers(unionNode.members)\n if (simplified.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: simplified }\n },\n})\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"macros.cjs","names":["defineMacro","narrowSchema","createSchema","createProperty","defineMacro","narrowSchema","enumPropName","narrowSchema","defineMacro"],"sources":["../src/macros/macroDiscriminatorEnum.ts","../src/macros/macroEnumName.ts","../src/macros/macroSimplifyUnion.ts"],"sourcesContent":["import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { createProperty } from '../nodes/property.ts'\nimport { createSchema } from '../nodes/schema.ts'\n\ntype Props = {\n propertyName: string\n values: Array<string>\n enumName?: string\n}\n\n/**\n * Builds a macro that replaces a discriminator property's schema with a string enum of the given\n * values. Object schemas that lack the property are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroDiscriminatorEnum({ propertyName: 'type', values: ['dog', 'cat'] })\n * const next = applyMacros(objectSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroDiscriminatorEnum({ propertyName, values, enumName }: Props) {\n return defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = narrowSchema(node, 'object')\n if (!objectNode?.properties?.length) return undefined\n if (!objectNode.properties.some((prop) => prop.name === propertyName)) return undefined\n\n return createSchema({\n ...objectNode,\n properties: objectNode.properties.map((prop) => {\n if (prop.name !== propertyName) return prop\n\n return createProperty({\n ...prop,\n schema: createSchema({\n type: 'enum',\n primitive: 'string',\n enumValues: values,\n name: enumName,\n readOnly: prop.schema.readOnly,\n writeOnly: prop.schema.writeOnly,\n }),\n })\n }),\n })\n },\n })\n}\n","import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { enumPropName } from '../utils/refs.ts'\n\ntype Props = {\n parentName: string | null | undefined\n propName: string\n enumSuffix: string\n}\n\n/**\n * Builds a macro that names an inline enum schema from its parent and property name. Boolean enums\n * are left anonymous. Non-enum nodes are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroEnumName({ parentName: 'Pet', propName: 'status', enumSuffix: 'enum' })\n * const named = applyMacros(propSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroEnumName({ parentName, propName, enumSuffix }: Props) {\n return defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = narrowSchema(node, 'enum')\n\n if (enumNode?.primitive === 'boolean') return { ...node, name: null }\n if (enumNode) return { ...node, name: enumPropName(parentName, propName, enumSuffix) }\n\n return undefined\n },\n })\n}\n","import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\n\ntype ScalarPrimitive = 'string' | 'number' | 'integer' | 'bigint' | 'boolean'\n\n/**\n * Scalar primitive schema types used for union simplification and type narrowing.\n */\nconst SCALAR_PRIMITIVE_TYPES = new Set<ScalarPrimitive>(['string', 'number', 'integer', 'bigint', 'boolean'])\n\nfunction isScalarPrimitive(type: string): type is ScalarPrimitive {\n return SCALAR_PRIMITIVE_TYPES.has(type as ScalarPrimitive)\n}\n\n/**\n * Filters union members, dropping enum members that a broader scalar primitive already covers.\n */\nfunction simplifyUnionMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const scalarPrimitives = new Set(members.filter((member) => isScalarPrimitive(member.type)).map((m) => m.type))\n if (!scalarPrimitives.size) return members\n\n return members.filter((member) => {\n const enumNode = narrowSchema(member, 'enum')\n if (!enumNode) return true\n\n const primitive = enumNode.primitive\n if (!primitive) return true\n\n const enumValueCount = enumNode.namedEnumValues?.length ?? enumNode.enumValues?.length ?? 0\n if (enumValueCount <= 1) return true\n\n if (scalarPrimitives.has(primitive)) return false\n if ((primitive === 'integer' || primitive === 'number') && (scalarPrimitives.has('integer') || scalarPrimitives.has('number'))) return false\n\n return true\n })\n}\n\n/**\n * Removes union members a broader scalar primitive already covers, such as a multi-value string enum\n * sitting next to a plain `string`. Single-value enums are kept.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroSimplifyUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroSimplifyUnion = defineMacro({\n name: 'simplify-union',\n schema(node) {\n const unionNode = narrowSchema(node, 'union')\n if (!unionNode?.members?.length) return undefined\n\n const simplified = simplifyUnionMembers(unionNode.members)\n if (simplified.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: simplified }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,SAAgB,uBAAuB,EAAE,cAAc,QAAQ,YAAmB;CAChF,OAAOA,oBAAAA,YAAY;EACjB,MAAM;EACN,OAAO,MAAM;GACX,MAAM,aAAaC,gBAAAA,aAAa,MAAM,QAAQ;GAC9C,IAAI,CAAC,YAAY,YAAY,QAAQ,OAAO,KAAA;GAC5C,IAAI,CAAC,WAAW,WAAW,MAAM,SAAS,KAAK,SAAS,YAAY,GAAG,OAAO,KAAA;GAE9E,OAAOC,gBAAAA,aAAa;IAClB,GAAG;IACH,YAAY,WAAW,WAAW,KAAK,SAAS;KAC9C,IAAI,KAAK,SAAS,cAAc,OAAO;KAEvC,OAAOC,gBAAAA,eAAe;MACpB,GAAG;MACH,QAAQD,gBAAAA,aAAa;OACnB,MAAM;OACN,WAAW;OACX,YAAY;OACZ,MAAM;OACN,UAAU,KAAK,OAAO;OACtB,WAAW,KAAK,OAAO;MACzB,CAAC;KACH,CAAC;IACH,CAAC;GACH,CAAC;EACH;CACF,CAAC;AACH;;;;;;;;;;;;;AC7BA,SAAgB,cAAc,EAAE,YAAY,UAAU,cAAqB;CACzE,OAAOE,oBAAAA,YAAY;EACjB,MAAM;EACN,OAAO,MAAM;GACX,MAAM,WAAWC,gBAAAA,aAAa,MAAM,MAAM;GAE1C,IAAI,UAAU,cAAc,WAAW,OAAO;IAAE,GAAG;IAAM,MAAM;GAAK;GACpE,IAAI,UAAU,OAAO;IAAE,GAAG;IAAM,MAAMC,aAAAA,aAAa,YAAY,UAAU,UAAU;GAAE;EAGvF;CACF,CAAC;AACH;;;;;;ACvBA,MAAM,yBAAyB,IAAI,IAAqB;CAAC;CAAU;CAAU;CAAW;CAAU;AAAS,CAAC;AAE5G,SAAS,kBAAkB,MAAuC;CAChE,OAAO,uBAAuB,IAAI,IAAuB;AAC3D;;;;AAKA,SAAS,qBAAqB,SAA+C;CAC3E,MAAM,mBAAmB,IAAI,IAAI,QAAQ,QAAQ,WAAW,kBAAkB,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,IAAI,CAAC;CAC9G,IAAI,CAAC,iBAAiB,MAAM,OAAO;CAEnC,OAAO,QAAQ,QAAQ,WAAW;EAChC,MAAM,WAAWC,gBAAAA,aAAa,QAAQ,MAAM;EAC5C,IAAI,CAAC,UAAU,OAAO;EAEtB,MAAM,YAAY,SAAS;EAC3B,IAAI,CAAC,WAAW,OAAO;EAGvB,KADuB,SAAS,iBAAiB,UAAU,SAAS,YAAY,UAAU,MACpE,GAAG,OAAO;EAEhC,IAAI,iBAAiB,IAAI,SAAS,GAAG,OAAO;EAC5C,KAAK,cAAc,aAAa,cAAc,cAAc,iBAAiB,IAAI,SAAS,KAAK,iBAAiB,IAAI,QAAQ,IAAI,OAAO;EAEvI,OAAO;CACT,CAAC;AACH;;;;;;;;;;AAWA,MAAa,qBAAqBC,oBAAAA,YAAY;CAC5C,MAAM;CACN,OAAO,MAAM;EACX,MAAM,YAAYD,gBAAAA,aAAa,MAAM,OAAO;EAC5C,IAAI,CAAC,WAAW,SAAS,QAAQ,OAAO,KAAA;EAExC,MAAM,aAAa,qBAAqB,UAAU,OAAO;EACzD,IAAI,WAAW,WAAW,UAAU,QAAQ,QAAQ,OAAO,KAAA;EAE3D,OAAO;GAAE,GAAG;GAAW,SAAS;EAAW;CAC7C;AACF,CAAC"}
|
package/dist/macros.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
-
import {
|
|
3
|
-
import { r as defineMacro } from "./defineMacro-
|
|
2
|
+
import { lt as narrowSchema, o as createSchema, u as createProperty } from "./visitor-DG5ROqRx.js";
|
|
3
|
+
import { r as defineMacro } from "./defineMacro-CVrU3ajV.js";
|
|
4
|
+
import { n as enumPropName } from "./refs-D2qwT5ck.js";
|
|
4
5
|
//#region src/macros/macroDiscriminatorEnum.ts
|
|
5
6
|
/**
|
|
6
7
|
* Builds a macro that replaces a discriminator property's schema with a string enum of the given
|
package/dist/macros.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"macros.js","names":[],"sources":["../src/macros/macroDiscriminatorEnum.ts","../src/macros/macroEnumName.ts","../src/macros/macroSimplifyUnion.ts"],"sourcesContent":["import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { createProperty } from '../nodes/property.ts'\nimport { createSchema } from '../nodes/schema.ts'\n\ntype Props = {\n propertyName: string\n values: Array<string>\n enumName?: string\n}\n\n/**\n * Builds a macro that replaces a discriminator property's schema with a string enum of the given\n * values. Object schemas that lack the property are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroDiscriminatorEnum({ propertyName: 'type', values: ['dog', 'cat'] })\n * const next = applyMacros(objectSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroDiscriminatorEnum({ propertyName, values, enumName }: Props) {\n return defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = narrowSchema(node, 'object')\n if (!objectNode?.properties?.length) return undefined\n if (!objectNode.properties.some((prop) => prop.name === propertyName)) return undefined\n\n return createSchema({\n ...objectNode,\n properties: objectNode.properties.map((prop) => {\n if (prop.name !== propertyName) return prop\n\n return createProperty({\n ...prop,\n schema: createSchema({\n type: 'enum',\n primitive: 'string',\n enumValues: values,\n name: enumName,\n readOnly: prop.schema.readOnly,\n writeOnly: prop.schema.writeOnly,\n }),\n })\n }),\n })\n },\n })\n}\n","import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { enumPropName } from '../utils/refs.ts'\n\ntype Props = {\n parentName: string | null | undefined\n propName: string\n enumSuffix: string\n}\n\n/**\n * Builds a macro that names an inline enum schema from its parent and property name. Boolean enums\n * are left anonymous. Non-enum nodes are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroEnumName({ parentName: 'Pet', propName: 'status', enumSuffix: 'enum' })\n * const named = applyMacros(propSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroEnumName({ parentName, propName, enumSuffix }: Props) {\n return defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = narrowSchema(node, 'enum')\n\n if (enumNode?.primitive === 'boolean') return { ...node, name: null }\n if (enumNode) return { ...node, name: enumPropName(parentName, propName, enumSuffix) }\n\n return undefined\n },\n })\n}\n","import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\n\ntype ScalarPrimitive = 'string' | 'number' | 'integer' | 'bigint' | 'boolean'\n\n/**\n * Scalar primitive schema types used for union simplification and type narrowing.\n */\nconst SCALAR_PRIMITIVE_TYPES = new Set<ScalarPrimitive>(['string', 'number', 'integer', 'bigint', 'boolean'])\n\nfunction isScalarPrimitive(type: string): type is ScalarPrimitive {\n return SCALAR_PRIMITIVE_TYPES.has(type as ScalarPrimitive)\n}\n\n/**\n * Filters union members, dropping enum members that a broader scalar primitive already covers.\n */\nfunction simplifyUnionMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const scalarPrimitives = new Set(members.filter((member) => isScalarPrimitive(member.type)).map((m) => m.type))\n if (!scalarPrimitives.size) return members\n\n return members.filter((member) => {\n const enumNode = narrowSchema(member, 'enum')\n if (!enumNode) return true\n\n const primitive = enumNode.primitive\n if (!primitive) return true\n\n const enumValueCount = enumNode.namedEnumValues?.length ?? enumNode.enumValues?.length ?? 0\n if (enumValueCount <= 1) return true\n\n if (scalarPrimitives.has(primitive)) return false\n if ((primitive === 'integer' || primitive === 'number') && (scalarPrimitives.has('integer') || scalarPrimitives.has('number'))) return false\n\n return true\n })\n}\n\n/**\n * Removes union members a broader scalar primitive already covers, such as a multi-value string enum\n * sitting next to a plain `string`. Single-value enums are kept.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroSimplifyUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroSimplifyUnion = defineMacro({\n name: 'simplify-union',\n schema(node) {\n const unionNode = narrowSchema(node, 'union')\n if (!unionNode?.members?.length) return undefined\n\n const simplified = simplifyUnionMembers(unionNode.members)\n if (simplified.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: simplified }\n },\n})\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"macros.js","names":[],"sources":["../src/macros/macroDiscriminatorEnum.ts","../src/macros/macroEnumName.ts","../src/macros/macroSimplifyUnion.ts"],"sourcesContent":["import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { createProperty } from '../nodes/property.ts'\nimport { createSchema } from '../nodes/schema.ts'\n\ntype Props = {\n propertyName: string\n values: Array<string>\n enumName?: string\n}\n\n/**\n * Builds a macro that replaces a discriminator property's schema with a string enum of the given\n * values. Object schemas that lack the property are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroDiscriminatorEnum({ propertyName: 'type', values: ['dog', 'cat'] })\n * const next = applyMacros(objectSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroDiscriminatorEnum({ propertyName, values, enumName }: Props) {\n return defineMacro({\n name: 'discriminator-enum',\n schema(node) {\n const objectNode = narrowSchema(node, 'object')\n if (!objectNode?.properties?.length) return undefined\n if (!objectNode.properties.some((prop) => prop.name === propertyName)) return undefined\n\n return createSchema({\n ...objectNode,\n properties: objectNode.properties.map((prop) => {\n if (prop.name !== propertyName) return prop\n\n return createProperty({\n ...prop,\n schema: createSchema({\n type: 'enum',\n primitive: 'string',\n enumValues: values,\n name: enumName,\n readOnly: prop.schema.readOnly,\n writeOnly: prop.schema.writeOnly,\n }),\n })\n }),\n })\n },\n })\n}\n","import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport { enumPropName } from '../utils/refs.ts'\n\ntype Props = {\n parentName: string | null | undefined\n propName: string\n enumSuffix: string\n}\n\n/**\n * Builds a macro that names an inline enum schema from its parent and property name. Boolean enums\n * are left anonymous. Non-enum nodes are returned unchanged.\n *\n * @example\n * ```ts\n * const macro = macroEnumName({ parentName: 'Pet', propName: 'status', enumSuffix: 'enum' })\n * const named = applyMacros(propSchema, [macro], { depth: 'shallow' })\n * ```\n */\nexport function macroEnumName({ parentName, propName, enumSuffix }: Props) {\n return defineMacro({\n name: 'enum-name',\n schema(node) {\n const enumNode = narrowSchema(node, 'enum')\n\n if (enumNode?.primitive === 'boolean') return { ...node, name: null }\n if (enumNode) return { ...node, name: enumPropName(parentName, propName, enumSuffix) }\n\n return undefined\n },\n })\n}\n","import { defineMacro } from '../defineMacro.ts'\nimport { narrowSchema } from '../guards.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\n\ntype ScalarPrimitive = 'string' | 'number' | 'integer' | 'bigint' | 'boolean'\n\n/**\n * Scalar primitive schema types used for union simplification and type narrowing.\n */\nconst SCALAR_PRIMITIVE_TYPES = new Set<ScalarPrimitive>(['string', 'number', 'integer', 'bigint', 'boolean'])\n\nfunction isScalarPrimitive(type: string): type is ScalarPrimitive {\n return SCALAR_PRIMITIVE_TYPES.has(type as ScalarPrimitive)\n}\n\n/**\n * Filters union members, dropping enum members that a broader scalar primitive already covers.\n */\nfunction simplifyUnionMembers(members: Array<SchemaNode>): Array<SchemaNode> {\n const scalarPrimitives = new Set(members.filter((member) => isScalarPrimitive(member.type)).map((m) => m.type))\n if (!scalarPrimitives.size) return members\n\n return members.filter((member) => {\n const enumNode = narrowSchema(member, 'enum')\n if (!enumNode) return true\n\n const primitive = enumNode.primitive\n if (!primitive) return true\n\n const enumValueCount = enumNode.namedEnumValues?.length ?? enumNode.enumValues?.length ?? 0\n if (enumValueCount <= 1) return true\n\n if (scalarPrimitives.has(primitive)) return false\n if ((primitive === 'integer' || primitive === 'number') && (scalarPrimitives.has('integer') || scalarPrimitives.has('number'))) return false\n\n return true\n })\n}\n\n/**\n * Removes union members a broader scalar primitive already covers, such as a multi-value string enum\n * sitting next to a plain `string`. Single-value enums are kept.\n *\n * @example\n * ```ts\n * const next = applyMacros(unionSchema, [macroSimplifyUnion], { depth: 'shallow' })\n * ```\n */\nexport const macroSimplifyUnion = defineMacro({\n name: 'simplify-union',\n schema(node) {\n const unionNode = narrowSchema(node, 'union')\n if (!unionNode?.members?.length) return undefined\n\n const simplified = simplifyUnionMembers(unionNode.members)\n if (simplified.length === unionNode.members.length) return undefined\n\n return { ...unionNode, members: simplified }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;AAqBA,SAAgB,uBAAuB,EAAE,cAAc,QAAQ,YAAmB;CAChF,OAAO,YAAY;EACjB,MAAM;EACN,OAAO,MAAM;GACX,MAAM,aAAa,aAAa,MAAM,QAAQ;GAC9C,IAAI,CAAC,YAAY,YAAY,QAAQ,OAAO,KAAA;GAC5C,IAAI,CAAC,WAAW,WAAW,MAAM,SAAS,KAAK,SAAS,YAAY,GAAG,OAAO,KAAA;GAE9E,OAAO,aAAa;IAClB,GAAG;IACH,YAAY,WAAW,WAAW,KAAK,SAAS;KAC9C,IAAI,KAAK,SAAS,cAAc,OAAO;KAEvC,OAAO,eAAe;MACpB,GAAG;MACH,QAAQ,aAAa;OACnB,MAAM;OACN,WAAW;OACX,YAAY;OACZ,MAAM;OACN,UAAU,KAAK,OAAO;OACtB,WAAW,KAAK,OAAO;MACzB,CAAC;KACH,CAAC;IACH,CAAC;GACH,CAAC;EACH;CACF,CAAC;AACH;;;;;;;;;;;;;AC7BA,SAAgB,cAAc,EAAE,YAAY,UAAU,cAAqB;CACzE,OAAO,YAAY;EACjB,MAAM;EACN,OAAO,MAAM;GACX,MAAM,WAAW,aAAa,MAAM,MAAM;GAE1C,IAAI,UAAU,cAAc,WAAW,OAAO;IAAE,GAAG;IAAM,MAAM;GAAK;GACpE,IAAI,UAAU,OAAO;IAAE,GAAG;IAAM,MAAM,aAAa,YAAY,UAAU,UAAU;GAAE;EAGvF;CACF,CAAC;AACH;;;;;;ACvBA,MAAM,yBAAyB,IAAI,IAAqB;CAAC;CAAU;CAAU;CAAW;CAAU;AAAS,CAAC;AAE5G,SAAS,kBAAkB,MAAuC;CAChE,OAAO,uBAAuB,IAAI,IAAuB;AAC3D;;;;AAKA,SAAS,qBAAqB,SAA+C;CAC3E,MAAM,mBAAmB,IAAI,IAAI,QAAQ,QAAQ,WAAW,kBAAkB,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,IAAI,CAAC;CAC9G,IAAI,CAAC,iBAAiB,MAAM,OAAO;CAEnC,OAAO,QAAQ,QAAQ,WAAW;EAChC,MAAM,WAAW,aAAa,QAAQ,MAAM;EAC5C,IAAI,CAAC,UAAU,OAAO;EAEtB,MAAM,YAAY,SAAS;EAC3B,IAAI,CAAC,WAAW,OAAO;EAGvB,KADuB,SAAS,iBAAiB,UAAU,SAAS,YAAY,UAAU,MACpE,GAAG,OAAO;EAEhC,IAAI,iBAAiB,IAAI,SAAS,GAAG,OAAO;EAC5C,KAAK,cAAc,aAAa,cAAc,cAAc,iBAAiB,IAAI,SAAS,KAAK,iBAAiB,IAAI,QAAQ,IAAI,OAAO;EAEvI,OAAO;CACT,CAAC;AACH;;;;;;;;;;AAWA,MAAa,qBAAqB,YAAY;CAC5C,MAAM;CACN,OAAO,MAAM;EACX,MAAM,YAAY,aAAa,MAAM,OAAO;EAC5C,IAAI,CAAC,WAAW,SAAS,QAAQ,OAAO,KAAA;EAExC,MAAM,aAAa,qBAAqB,UAAU,OAAO;EACzD,IAAI,WAAW,WAAW,UAAU,QAAQ,QAAQ,OAAO,KAAA;EAE3D,OAAO;GAAE,GAAG;GAAW,SAAS;EAAW;CAC7C;AACF,CAAC"}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
const require_visitor = require("./visitor-CLLDwBvv.cjs");
|
|
2
|
+
//#region src/utils/refs.ts
|
|
3
|
+
const plainStringTypes = new Set([
|
|
4
|
+
"string",
|
|
5
|
+
"uuid",
|
|
6
|
+
"email",
|
|
7
|
+
"url",
|
|
8
|
+
"datetime"
|
|
9
|
+
]);
|
|
10
|
+
/**
|
|
11
|
+
* Returns the last path segment of a reference string.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* `extractRefName('#/components/schemas/Pet') // 'Pet'`
|
|
15
|
+
*/
|
|
16
|
+
function extractRefName(ref) {
|
|
17
|
+
return ref.split("/").at(-1) ?? ref;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Resolves the schema name of a ref node. Uses the last segment of `ref` when set, otherwise falls
|
|
21
|
+
* back to `name` then nested `schema.name`.
|
|
22
|
+
*
|
|
23
|
+
* Returns `null` for non-ref nodes or when no name resolves.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'`
|
|
27
|
+
*/
|
|
28
|
+
function resolveRefName(node) {
|
|
29
|
+
if (!node || node.type !== "ref") return null;
|
|
30
|
+
if (node.ref) return extractRefName(node.ref) ?? node.name ?? node.schema?.name ?? null;
|
|
31
|
+
return node.name ?? node.schema?.name ?? null;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Builds a PascalCase child schema name by joining a parent name and property name.
|
|
35
|
+
* Returns `null` when there is no parent to nest under.
|
|
36
|
+
*
|
|
37
|
+
* @example Nested under a parent
|
|
38
|
+
* `childName('Order', 'shipping_address') // 'OrderShippingAddress'`
|
|
39
|
+
*
|
|
40
|
+
* @example No parent
|
|
41
|
+
* `childName(undefined, 'params') // null`
|
|
42
|
+
*/
|
|
43
|
+
function childName(parentName, propName) {
|
|
44
|
+
return parentName ? require_visitor.pascalCase([parentName, propName].join(" ")) : null;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any
|
|
48
|
+
* empty parts.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`
|
|
52
|
+
*/
|
|
53
|
+
function enumPropName(parentName, propName, enumSuffix) {
|
|
54
|
+
return require_visitor.pascalCase([
|
|
55
|
+
parentName,
|
|
56
|
+
propName,
|
|
57
|
+
enumSuffix
|
|
58
|
+
].filter(Boolean).join(" "));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Merges a ref node with its resolved schema, giving usage-site fields precedence.
|
|
62
|
+
*
|
|
63
|
+
* Every field set on the ref node except `kind`, `type`, `name`, `ref`, and `schema` overrides the
|
|
64
|
+
* same field in the resolved `node.schema` (for example `description`, `nullable`, `readOnly`,
|
|
65
|
+
* `deprecated`). Fields left `undefined` on the ref do not shadow the resolved schema. Non-ref
|
|
66
|
+
* nodes and refs without a resolved `schema` are returned unchanged.
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```ts
|
|
70
|
+
* const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })
|
|
71
|
+
* const merged = syncSchemaRef(ref) // merges with resolved Pet schema
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
function syncSchemaRef(node) {
|
|
75
|
+
const ref = require_visitor.narrowSchema(node, "ref");
|
|
76
|
+
if (!ref) return node;
|
|
77
|
+
if (!ref.schema) return node;
|
|
78
|
+
const { kind: _kind, type: _type, name: _name, ref: _ref, schema: _schema, ...overrides } = ref;
|
|
79
|
+
const definedOverrides = Object.fromEntries(Object.entries(overrides).filter(([, v]) => v !== void 0));
|
|
80
|
+
return require_visitor.createSchema({
|
|
81
|
+
...ref.schema,
|
|
82
|
+
...definedOverrides
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Type guard that returns `true` when a schema emits as a plain `string` type.
|
|
87
|
+
*
|
|
88
|
+
* Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`
|
|
89
|
+
* types, returns `true` only when `representation` is `'string'` rather than `'date'`.
|
|
90
|
+
*/
|
|
91
|
+
function isStringType(node) {
|
|
92
|
+
if (plainStringTypes.has(node.type)) return true;
|
|
93
|
+
const temporal = require_visitor.narrowSchema(node, "date") ?? require_visitor.narrowSchema(node, "time");
|
|
94
|
+
if (temporal) return temporal.representation !== "date";
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Derives a {@link ParamGroupType} for a query or header group from the resolver.
|
|
99
|
+
*
|
|
100
|
+
* Returns `null` when there is no resolver, no params, or the group name equals the
|
|
101
|
+
* individual param name (so there is no real group to emit).
|
|
102
|
+
*/
|
|
103
|
+
function resolveGroupType({ node, params, group, resolver }) {
|
|
104
|
+
if (!resolver || !params.length) return null;
|
|
105
|
+
const firstParam = params[0];
|
|
106
|
+
const groupName = (group === "query" ? resolver.resolveQueryParamsName : resolver.resolveHeaderParamsName).call(resolver, node, firstParam);
|
|
107
|
+
if (groupName === resolver.resolveParamName(node, firstParam)) return null;
|
|
108
|
+
return {
|
|
109
|
+
type: groupName,
|
|
110
|
+
optional: params.every((p) => !p.required)
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
Object.defineProperty(exports, "childName", {
|
|
115
|
+
enumerable: true,
|
|
116
|
+
get: function() {
|
|
117
|
+
return childName;
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
Object.defineProperty(exports, "enumPropName", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
get: function() {
|
|
123
|
+
return enumPropName;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
Object.defineProperty(exports, "extractRefName", {
|
|
127
|
+
enumerable: true,
|
|
128
|
+
get: function() {
|
|
129
|
+
return extractRefName;
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
Object.defineProperty(exports, "isStringType", {
|
|
133
|
+
enumerable: true,
|
|
134
|
+
get: function() {
|
|
135
|
+
return isStringType;
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
Object.defineProperty(exports, "resolveGroupType", {
|
|
139
|
+
enumerable: true,
|
|
140
|
+
get: function() {
|
|
141
|
+
return resolveGroupType;
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
Object.defineProperty(exports, "resolveRefName", {
|
|
145
|
+
enumerable: true,
|
|
146
|
+
get: function() {
|
|
147
|
+
return resolveRefName;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
Object.defineProperty(exports, "syncSchemaRef", {
|
|
151
|
+
enumerable: true,
|
|
152
|
+
get: function() {
|
|
153
|
+
return syncSchemaRef;
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
//# sourceMappingURL=refs-8IwpesXW.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs-8IwpesXW.cjs","names":["pascalCase","narrowSchema","createSchema"],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { narrowSchema } from '../guards.ts'\nimport type { OperationNode, ParameterNode, SchemaNode } from '../nodes/index.ts'\nimport { createSchema, type SchemaType } from '../nodes/schema.ts'\nimport type { OperationParamsResolver, ParamGroupType } from './operationParams.ts'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/**\n * Returns the last path segment of a reference string.\n *\n * @example\n * `extractRefName('#/components/schemas/Pet') // 'Pet'`\n */\nexport function extractRefName(ref: string): string {\n return ref.split('/').at(-1) ?? ref\n}\n\n/**\n * Resolves the schema name of a ref node. Uses the last segment of `ref` when set, otherwise falls\n * back to `name` then nested `schema.name`.\n *\n * Returns `null` for non-ref nodes or when no name resolves.\n *\n * @example\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'`\n */\nexport function resolveRefName(node: SchemaNode | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.ref) return extractRefName(node.ref) ?? node.name ?? node.schema?.name ?? null\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Builds a PascalCase child schema name by joining a parent name and property name.\n * Returns `null` when there is no parent to nest under.\n *\n * @example Nested under a parent\n * `childName('Order', 'shipping_address') // 'OrderShippingAddress'`\n *\n * @example No parent\n * `childName(undefined, 'params') // null`\n */\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\n/**\n * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any\n * empty parts.\n *\n * @example\n * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`\n */\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n\n/**\n * Merges a ref node with its resolved schema, giving usage-site fields precedence.\n *\n * Every field set on the ref node except `kind`, `type`, `name`, `ref`, and `schema` overrides the\n * same field in the resolved `node.schema` (for example `description`, `nullable`, `readOnly`,\n * `deprecated`). Fields left `undefined` on the ref do not shadow the resolved schema. Non-ref\n * nodes and refs without a resolved `schema` are returned unchanged.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })\n * const merged = syncSchemaRef(ref) // merges with resolved Pet schema\n * ```\n */\nexport function syncSchemaRef(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n\n if (!ref) return node\n if (!ref.schema) return node\n\n const { kind: _kind, type: _type, name: _name, ref: _ref, schema: _schema, ...overrides } = ref\n\n // Filter out undefined override values so they don't shadow the resolved schema's fields.\n const definedOverrides = Object.fromEntries(Object.entries(overrides).filter(([, v]) => v !== undefined))\n\n return createSchema({ ...ref.schema, ...definedOverrides })\n}\n\n/**\n * Type guard that returns `true` when a schema emits as a plain `string` type.\n *\n * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`\n * types, returns `true` only when `representation` is `'string'` rather than `'date'`.\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n\n/**\n * Derives a {@link ParamGroupType} for a query or header group from the resolver.\n *\n * Returns `null` when there is no resolver, no params, or the group name equals the\n * individual param name (so there is no real group to emit).\n */\nexport function resolveGroupType({\n node,\n params,\n group,\n resolver,\n}: {\n node: OperationNode\n params: Array<ParameterNode>\n group: 'query' | 'header'\n resolver: OperationParamsResolver | undefined\n}): ParamGroupType | null {\n if (!resolver || !params.length) {\n return null\n }\n const firstParam = params[0]!\n const groupMethod = group === 'query' ? resolver.resolveQueryParamsName : resolver.resolveHeaderParamsName\n const groupName = groupMethod.call(resolver, node, firstParam)\n if (groupName === resolver.resolveParamName(node, firstParam)) {\n return null\n }\n return { type: groupName, optional: params.every((p) => !p.required) }\n}\n"],"mappings":";;AAMA,MAAM,mBAAmB,IAAI,IAAgB;CAAC;CAAU;CAAQ;CAAS;CAAO;AAAU,CAAU;;;;;;;AAQpG,SAAgB,eAAe,KAAqB;CAClD,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;AAClC;;;;;;;;;;AAWA,SAAgB,eAAe,MAA6C;CAC1E,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,KAAK,OAAO,eAAe,KAAK,GAAG,KAAK,KAAK,QAAQ,KAAK,QAAQ,QAAQ;CAEnF,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;;;AAYA,SAAgB,UAAU,YAAuC,UAAiC;CAChG,OAAO,aAAaA,gBAAAA,WAAW,CAAC,YAAY,QAAQ,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI;AACrE;;;;;;;;AASA,SAAgB,aAAa,YAAuC,UAAkB,YAA4B;CAChH,OAAOA,gBAAAA,WAAW;EAAC;EAAY;EAAU;CAAU,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC;AAChF;;;;;;;;;;;;;;;AAgBA,SAAgB,cAAc,MAA8B;CAC1D,MAAM,MAAMC,gBAAAA,aAAa,MAAM,KAAK;CAEpC,IAAI,CAAC,KAAK,OAAO;CACjB,IAAI,CAAC,IAAI,QAAQ,OAAO;CAExB,MAAM,EAAE,MAAM,OAAO,MAAM,OAAO,MAAM,OAAO,KAAK,MAAM,QAAQ,SAAS,GAAG,cAAc;CAG5F,MAAM,mBAAmB,OAAO,YAAY,OAAO,QAAQ,SAAS,CAAC,CAAC,QAAQ,GAAG,OAAO,MAAM,KAAA,CAAS,CAAC;CAExG,OAAOC,gBAAAA,aAAa;EAAE,GAAG,IAAI;EAAQ,GAAG;CAAiB,CAAC;AAC5D;;;;;;;AAQA,SAAgB,aAAa,MAA2B;CACtD,IAAI,iBAAiB,IAAI,KAAK,IAAI,GAChC,OAAO;CAGT,MAAM,WAAWD,gBAAAA,aAAa,MAAM,MAAM,KAAKA,gBAAAA,aAAa,MAAM,MAAM;CACxE,IAAI,UACF,OAAO,SAAS,mBAAmB;CAGrC,OAAO;AACT;;;;;;;AAQA,SAAgB,iBAAiB,EAC/B,MACA,QACA,OACA,YAMwB;CACxB,IAAI,CAAC,YAAY,CAAC,OAAO,QACvB,OAAO;CAET,MAAM,aAAa,OAAO;CAE1B,MAAM,aADc,UAAU,UAAU,SAAS,yBAAyB,SAAS,wBAAA,CACrD,KAAK,UAAU,MAAM,UAAU;CAC7D,IAAI,cAAc,SAAS,iBAAiB,MAAM,UAAU,GAC1D,OAAO;CAET,OAAO;EAAE,MAAM;EAAW,UAAU,OAAO,OAAO,MAAM,CAAC,EAAE,QAAQ;CAAE;AACvE"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
+
import { U as pascalCase, lt as narrowSchema, o as createSchema } from "./visitor-DG5ROqRx.js";
|
|
3
|
+
//#region src/utils/refs.ts
|
|
4
|
+
const plainStringTypes = new Set([
|
|
5
|
+
"string",
|
|
6
|
+
"uuid",
|
|
7
|
+
"email",
|
|
8
|
+
"url",
|
|
9
|
+
"datetime"
|
|
10
|
+
]);
|
|
11
|
+
/**
|
|
12
|
+
* Returns the last path segment of a reference string.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* `extractRefName('#/components/schemas/Pet') // 'Pet'`
|
|
16
|
+
*/
|
|
17
|
+
function extractRefName(ref) {
|
|
18
|
+
return ref.split("/").at(-1) ?? ref;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resolves the schema name of a ref node. Uses the last segment of `ref` when set, otherwise falls
|
|
22
|
+
* back to `name` then nested `schema.name`.
|
|
23
|
+
*
|
|
24
|
+
* Returns `null` for non-ref nodes or when no name resolves.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'`
|
|
28
|
+
*/
|
|
29
|
+
function resolveRefName(node) {
|
|
30
|
+
if (!node || node.type !== "ref") return null;
|
|
31
|
+
if (node.ref) return extractRefName(node.ref) ?? node.name ?? node.schema?.name ?? null;
|
|
32
|
+
return node.name ?? node.schema?.name ?? null;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Builds a PascalCase child schema name by joining a parent name and property name.
|
|
36
|
+
* Returns `null` when there is no parent to nest under.
|
|
37
|
+
*
|
|
38
|
+
* @example Nested under a parent
|
|
39
|
+
* `childName('Order', 'shipping_address') // 'OrderShippingAddress'`
|
|
40
|
+
*
|
|
41
|
+
* @example No parent
|
|
42
|
+
* `childName(undefined, 'params') // null`
|
|
43
|
+
*/
|
|
44
|
+
function childName(parentName, propName) {
|
|
45
|
+
return parentName ? pascalCase([parentName, propName].join(" ")) : null;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any
|
|
49
|
+
* empty parts.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`
|
|
53
|
+
*/
|
|
54
|
+
function enumPropName(parentName, propName, enumSuffix) {
|
|
55
|
+
return pascalCase([
|
|
56
|
+
parentName,
|
|
57
|
+
propName,
|
|
58
|
+
enumSuffix
|
|
59
|
+
].filter(Boolean).join(" "));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Merges a ref node with its resolved schema, giving usage-site fields precedence.
|
|
63
|
+
*
|
|
64
|
+
* Every field set on the ref node except `kind`, `type`, `name`, `ref`, and `schema` overrides the
|
|
65
|
+
* same field in the resolved `node.schema` (for example `description`, `nullable`, `readOnly`,
|
|
66
|
+
* `deprecated`). Fields left `undefined` on the ref do not shadow the resolved schema. Non-ref
|
|
67
|
+
* nodes and refs without a resolved `schema` are returned unchanged.
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```ts
|
|
71
|
+
* const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })
|
|
72
|
+
* const merged = syncSchemaRef(ref) // merges with resolved Pet schema
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
function syncSchemaRef(node) {
|
|
76
|
+
const ref = narrowSchema(node, "ref");
|
|
77
|
+
if (!ref) return node;
|
|
78
|
+
if (!ref.schema) return node;
|
|
79
|
+
const { kind: _kind, type: _type, name: _name, ref: _ref, schema: _schema, ...overrides } = ref;
|
|
80
|
+
const definedOverrides = Object.fromEntries(Object.entries(overrides).filter(([, v]) => v !== void 0));
|
|
81
|
+
return createSchema({
|
|
82
|
+
...ref.schema,
|
|
83
|
+
...definedOverrides
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Type guard that returns `true` when a schema emits as a plain `string` type.
|
|
88
|
+
*
|
|
89
|
+
* Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`
|
|
90
|
+
* types, returns `true` only when `representation` is `'string'` rather than `'date'`.
|
|
91
|
+
*/
|
|
92
|
+
function isStringType(node) {
|
|
93
|
+
if (plainStringTypes.has(node.type)) return true;
|
|
94
|
+
const temporal = narrowSchema(node, "date") ?? narrowSchema(node, "time");
|
|
95
|
+
if (temporal) return temporal.representation !== "date";
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Derives a {@link ParamGroupType} for a query or header group from the resolver.
|
|
100
|
+
*
|
|
101
|
+
* Returns `null` when there is no resolver, no params, or the group name equals the
|
|
102
|
+
* individual param name (so there is no real group to emit).
|
|
103
|
+
*/
|
|
104
|
+
function resolveGroupType({ node, params, group, resolver }) {
|
|
105
|
+
if (!resolver || !params.length) return null;
|
|
106
|
+
const firstParam = params[0];
|
|
107
|
+
const groupName = (group === "query" ? resolver.resolveQueryParamsName : resolver.resolveHeaderParamsName).call(resolver, node, firstParam);
|
|
108
|
+
if (groupName === resolver.resolveParamName(node, firstParam)) return null;
|
|
109
|
+
return {
|
|
110
|
+
type: groupName,
|
|
111
|
+
optional: params.every((p) => !p.required)
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
//#endregion
|
|
115
|
+
export { resolveGroupType as a, isStringType as i, enumPropName as n, resolveRefName as o, extractRefName as r, syncSchemaRef as s, childName as t };
|
|
116
|
+
|
|
117
|
+
//# sourceMappingURL=refs-D2qwT5ck.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"refs-D2qwT5ck.js","names":[],"sources":["../src/utils/refs.ts"],"sourcesContent":["import { pascalCase } from '@internals/utils'\nimport { narrowSchema } from '../guards.ts'\nimport type { OperationNode, ParameterNode, SchemaNode } from '../nodes/index.ts'\nimport { createSchema, type SchemaType } from '../nodes/schema.ts'\nimport type { OperationParamsResolver, ParamGroupType } from './operationParams.ts'\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'] as const)\n\n/**\n * Returns the last path segment of a reference string.\n *\n * @example\n * `extractRefName('#/components/schemas/Pet') // 'Pet'`\n */\nexport function extractRefName(ref: string): string {\n return ref.split('/').at(-1) ?? ref\n}\n\n/**\n * Resolves the schema name of a ref node. Uses the last segment of `ref` when set, otherwise falls\n * back to `name` then nested `schema.name`.\n *\n * Returns `null` for non-ref nodes or when no name resolves.\n *\n * @example\n * `resolveRefName({ kind: 'Schema', type: 'ref', ref: '#/components/schemas/Pet' }) // 'Pet'`\n */\nexport function resolveRefName(node: SchemaNode | undefined): string | null {\n if (!node || node.type !== 'ref') return null\n if (node.ref) return extractRefName(node.ref) ?? node.name ?? node.schema?.name ?? null\n\n return node.name ?? node.schema?.name ?? null\n}\n\n/**\n * Builds a PascalCase child schema name by joining a parent name and property name.\n * Returns `null` when there is no parent to nest under.\n *\n * @example Nested under a parent\n * `childName('Order', 'shipping_address') // 'OrderShippingAddress'`\n *\n * @example No parent\n * `childName(undefined, 'params') // null`\n */\nexport function childName(parentName: string | null | undefined, propName: string): string | null {\n return parentName ? pascalCase([parentName, propName].join(' ')) : null\n}\n\n/**\n * Builds a PascalCase enum name from the parent name, property name, and a suffix, skipping any\n * empty parts.\n *\n * @example\n * `enumPropName('Order', 'status', 'enum') // 'OrderStatusEnum'`\n */\nexport function enumPropName(parentName: string | null | undefined, propName: string, enumSuffix: string): string {\n return pascalCase([parentName, propName, enumSuffix].filter(Boolean).join(' '))\n}\n\n/**\n * Merges a ref node with its resolved schema, giving usage-site fields precedence.\n *\n * Every field set on the ref node except `kind`, `type`, `name`, `ref`, and `schema` overrides the\n * same field in the resolved `node.schema` (for example `description`, `nullable`, `readOnly`,\n * `deprecated`). Fields left `undefined` on the ref do not shadow the resolved schema. Non-ref\n * nodes and refs without a resolved `schema` are returned unchanged.\n *\n * @example\n * ```ts\n * const ref = createSchema({ type: 'ref', ref: '#/components/schemas/Pet', description: 'A cute pet' })\n * const merged = syncSchemaRef(ref) // merges with resolved Pet schema\n * ```\n */\nexport function syncSchemaRef(node: SchemaNode): SchemaNode {\n const ref = narrowSchema(node, 'ref')\n\n if (!ref) return node\n if (!ref.schema) return node\n\n const { kind: _kind, type: _type, name: _name, ref: _ref, schema: _schema, ...overrides } = ref\n\n // Filter out undefined override values so they don't shadow the resolved schema's fields.\n const definedOverrides = Object.fromEntries(Object.entries(overrides).filter(([, v]) => v !== undefined))\n\n return createSchema({ ...ref.schema, ...definedOverrides })\n}\n\n/**\n * Type guard that returns `true` when a schema emits as a plain `string` type.\n *\n * Covers `string`, `uuid`, `email`, `url`, and `datetime` types. For `date` and `time`\n * types, returns `true` only when `representation` is `'string'` rather than `'date'`.\n */\nexport function isStringType(node: SchemaNode): boolean {\n if (plainStringTypes.has(node.type)) {\n return true\n }\n\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n if (temporal) {\n return temporal.representation !== 'date'\n }\n\n return false\n}\n\n/**\n * Derives a {@link ParamGroupType} for a query or header group from the resolver.\n *\n * Returns `null` when there is no resolver, no params, or the group name equals the\n * individual param name (so there is no real group to emit).\n */\nexport function resolveGroupType({\n node,\n params,\n group,\n resolver,\n}: {\n node: OperationNode\n params: Array<ParameterNode>\n group: 'query' | 'header'\n resolver: OperationParamsResolver | undefined\n}): ParamGroupType | null {\n if (!resolver || !params.length) {\n return null\n }\n const firstParam = params[0]!\n const groupMethod = group === 'query' ? resolver.resolveQueryParamsName : resolver.resolveHeaderParamsName\n const groupName = groupMethod.call(resolver, node, firstParam)\n if (groupName === resolver.resolveParamName(node, firstParam)) {\n return null\n }\n return { type: groupName, optional: params.every((p) => !p.required) }\n}\n"],"mappings":";;;AAMA,MAAM,mBAAmB,IAAI,IAAgB;CAAC;CAAU;CAAQ;CAAS;CAAO;AAAU,CAAU;;;;;;;AAQpG,SAAgB,eAAe,KAAqB;CAClD,OAAO,IAAI,MAAM,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK;AAClC;;;;;;;;;;AAWA,SAAgB,eAAe,MAA6C;CAC1E,IAAI,CAAC,QAAQ,KAAK,SAAS,OAAO,OAAO;CACzC,IAAI,KAAK,KAAK,OAAO,eAAe,KAAK,GAAG,KAAK,KAAK,QAAQ,KAAK,QAAQ,QAAQ;CAEnF,OAAO,KAAK,QAAQ,KAAK,QAAQ,QAAQ;AAC3C;;;;;;;;;;;AAYA,SAAgB,UAAU,YAAuC,UAAiC;CAChG,OAAO,aAAa,WAAW,CAAC,YAAY,QAAQ,CAAC,CAAC,KAAK,GAAG,CAAC,IAAI;AACrE;;;;;;;;AASA,SAAgB,aAAa,YAAuC,UAAkB,YAA4B;CAChH,OAAO,WAAW;EAAC;EAAY;EAAU;CAAU,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC;AAChF;;;;;;;;;;;;;;;AAgBA,SAAgB,cAAc,MAA8B;CAC1D,MAAM,MAAM,aAAa,MAAM,KAAK;CAEpC,IAAI,CAAC,KAAK,OAAO;CACjB,IAAI,CAAC,IAAI,QAAQ,OAAO;CAExB,MAAM,EAAE,MAAM,OAAO,MAAM,OAAO,MAAM,OAAO,KAAK,MAAM,QAAQ,SAAS,GAAG,cAAc;CAG5F,MAAM,mBAAmB,OAAO,YAAY,OAAO,QAAQ,SAAS,CAAC,CAAC,QAAQ,GAAG,OAAO,MAAM,KAAA,CAAS,CAAC;CAExG,OAAO,aAAa;EAAE,GAAG,IAAI;EAAQ,GAAG;CAAiB,CAAC;AAC5D;;;;;;;AAQA,SAAgB,aAAa,MAA2B;CACtD,IAAI,iBAAiB,IAAI,KAAK,IAAI,GAChC,OAAO;CAGT,MAAM,WAAW,aAAa,MAAM,MAAM,KAAK,aAAa,MAAM,MAAM;CACxE,IAAI,UACF,OAAO,SAAS,mBAAmB;CAGrC,OAAO;AACT;;;;;;;AAQA,SAAgB,iBAAiB,EAC/B,MACA,QACA,OACA,YAMwB;CACxB,IAAI,CAAC,YAAY,CAAC,OAAO,QACvB,OAAO;CAET,MAAM,aAAa,OAAO;CAE1B,MAAM,aADc,UAAU,UAAU,SAAS,yBAAyB,SAAS,wBAAA,CACrD,KAAK,UAAU,MAAM,UAAU;CAC7D,IAAI,cAAc,SAAS,iBAAiB,MAAM,UAAU,GAC1D,OAAO;CAET,OAAO;EAAE,MAAM;EAAW,UAAU,OAAO,OAAO,MAAM,CAAC,EAAE,QAAQ;CAAE;AACvE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __name } from "./rolldown-runtime-CNktS9qV.js";
|
|
2
|
-
import { _t as SchemaNode,
|
|
2
|
+
import { _t as SchemaNode, vt as SchemaNodeByType, yt as SchemaType } from "./index-q_ldM1YP.js";
|
|
3
3
|
|
|
4
4
|
//#region src/defineDialect.d.ts
|
|
5
5
|
/**
|
|
@@ -30,22 +30,10 @@ type SchemaDialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TSchema,
|
|
|
30
30
|
resolveRef<TResolved>(document: TDocument, ref: string): TResolved | null | undefined;
|
|
31
31
|
};
|
|
32
32
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
35
|
-
* adapter, not here, so `@kubb/ast` carries no dedupe logic. The returned plan owns the rewriting
|
|
36
|
-
* behavior, so callers interact with one object.
|
|
33
|
+
* A spec adapter's dialect. `name` identifies it in logs and diagnostics, and `schema` holds the
|
|
34
|
+
* spec-specific schema questions the parser answers.
|
|
37
35
|
*/
|
|
38
|
-
type
|
|
39
|
-
/**
|
|
40
|
-
* Scans a forest of nodes and produces a plan describing which shapes to share.
|
|
41
|
-
*/
|
|
42
|
-
plan(roots: ReadonlyArray<Node>, context: TContext): TPlan;
|
|
43
|
-
};
|
|
44
|
-
/**
|
|
45
|
-
* A spec adapter's dialect. `name` identifies it in logs and diagnostics, `schema` holds the
|
|
46
|
-
* spec-specific schema questions the parser answers, and `dedupe` is the schema-sharing seam.
|
|
47
|
-
*/
|
|
48
|
-
type Dialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TSchema, TDocument = unknown, TDedupe extends Dedupe = Dedupe> = {
|
|
36
|
+
type Dialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TSchema, TDocument = unknown> = {
|
|
49
37
|
/**
|
|
50
38
|
* Identifies the dialect in logs and diagnostics.
|
|
51
39
|
*/
|
|
@@ -54,10 +42,6 @@ type Dialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TSchema, TDocum
|
|
|
54
42
|
* The spec-specific schema behavior. See {@link SchemaDialect}.
|
|
55
43
|
*/
|
|
56
44
|
schema: SchemaDialect<TSchema, TRef, TDiscriminated, TDocument>;
|
|
57
|
-
/**
|
|
58
|
-
* The schema-sharing behavior. See {@link Dedupe}.
|
|
59
|
-
*/
|
|
60
|
-
dedupe: TDedupe;
|
|
61
45
|
};
|
|
62
46
|
/**
|
|
63
47
|
* Types a {@link Dialect} for an adapter. Adds no runtime behavior and only pins the
|
|
@@ -74,11 +58,10 @@ type Dialect<TSchema = unknown, TRef = TSchema, TDiscriminated = TSchema, TDocum
|
|
|
74
58
|
* isBinary: (schema) => schema.type === 'string' && schema.contentMediaType === 'application/octet-stream',
|
|
75
59
|
* resolveRef,
|
|
76
60
|
* },
|
|
77
|
-
* dedupe: { plan },
|
|
78
61
|
* })
|
|
79
62
|
* ```
|
|
80
63
|
*/
|
|
81
|
-
declare function defineDialect<TSchema, TRef, TDiscriminated, TDocument
|
|
64
|
+
declare function defineDialect<TSchema, TRef, TDiscriminated, TDocument>(dialect: Dialect<TSchema, TRef, TDiscriminated, TDocument>): Dialect<TSchema, TRef, TDiscriminated, TDocument>;
|
|
82
65
|
//#endregion
|
|
83
66
|
//#region src/createPrinter.d.ts
|
|
84
67
|
/**
|
|
@@ -257,5 +240,5 @@ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) =
|
|
|
257
240
|
*/
|
|
258
241
|
declare function createPrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T>;
|
|
259
242
|
//#endregion
|
|
260
|
-
export {
|
|
261
|
-
//# sourceMappingURL=types-
|
|
243
|
+
export { Dialect as a, createPrinter as i, PrinterFactoryOptions as n, SchemaDialect as o, PrinterPartial as r, defineDialect as s, Printer as t };
|
|
244
|
+
//# sourceMappingURL=types-Df1jVmRy.d.ts.map
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as VisitorContext, n as Macro, o as ParentOf, s as Visitor, t as Enforce } from "./defineMacro-D9ekmTW5.js";
|
|
2
|
+
import { a as Dialect, n as PrinterFactoryOptions, o as SchemaDialect, r as PrinterPartial, t as Printer } from "./types-Df1jVmRy.js";
|
|
2
3
|
import { A as IndexedAccessTypeNode, At as InferSchemaNode, Bt as TypeNode, C as ParameterNode, Ct as UrlSchemaNode, D as FunctionParamNode, E as FunctionParamKind, Et as PropertyNode, Ft as ConstNode, G as FileNode, It as FunctionNode, J as UserFileNode, K as ImportNode, Lt as JSDocNode, M as TypeExpression, Mt as ArrowFunctionNode, N as TypeLiteralNode, Nt as BreakNode, O as FunctionParameterNode, Pt as CodeNode, Rt as JsxNode, S as ParameterLocation, St as UnionSchemaNode, W as ExportNode, _t as SchemaNode, a as InputMeta, an as NodeKind, bt as StringSchemaNode, ct as DatetimeSchemaNode, d as HttpOperationNode, dt as NumberSchemaNode, f as OperationNode, ft as ObjectSchemaNode, g as StatusCode, gt as ScalarSchemaType, h as ResponseNode, ht as ScalarSchemaNode, j as ObjectBindingPatternNode, jt as ParserOptions, k as FunctionParametersNode, l as GenericOperationNode, lt as EnumSchemaNode, mt as RefSchemaNode, n as OutputNode, nn as NodeDef, o as InputNode, ot as ArraySchemaNode, pt as PrimitiveSchemaType, q as SourceNode, rt as ContentNode, st as DateSchemaNode, t as Node, tn as DistributiveOmit, u as HttpMethod, ut as IntersectionSchemaNode, vt as SchemaNodeByType, xt as TimeSchemaNode, y as RequestBodyNode, yt as SchemaType, zt as TextNode } from "./index-q_ldM1YP.js";
|
|
3
|
-
import { a as Dedupe, n as PrinterFactoryOptions, o as Dialect, r as PrinterPartial, s as SchemaDialect, t as Printer } from "./types-BOsOrEZf.js";
|
|
4
4
|
import { n as OperationParamsResolver } from "./operationParams-Dme8H-sR.js";
|
|
5
|
-
export type { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode,
|
|
5
|
+
export type { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode, Dialect, DistributiveOmit, Enforce, 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 };
|