@kubb/ast 5.22.0 → 5.23.0

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.
Files changed (155) hide show
  1. package/dist/base-IpYuh3ZP.d.cts +173 -0
  2. package/dist/base-IpYuh3ZP.d.ts +173 -0
  3. package/dist/constants-Ckeonm-D.js +141 -0
  4. package/dist/constants-Ckeonm-D.js.map +1 -0
  5. package/dist/constants-CquR083U.cjs +152 -0
  6. package/dist/constants-CquR083U.cjs.map +1 -0
  7. package/dist/factory.cjs +23 -0
  8. package/dist/factory.d.cts +4 -0
  9. package/dist/factory.d.ts +4 -0
  10. package/dist/factory.js +4 -0
  11. package/dist/file-BVqSiSvV.d.cts +624 -0
  12. package/dist/file-Cg0T6cgz.cjs +319 -0
  13. package/dist/file-Cg0T6cgz.cjs.map +1 -0
  14. package/dist/file-CnuL8oUj.js +283 -0
  15. package/dist/file-CnuL8oUj.js.map +1 -0
  16. package/dist/file-CvlMAp_d.js +131 -0
  17. package/dist/file-CvlMAp_d.js.map +1 -0
  18. package/dist/file-Dd50jPkH.cjs +142 -0
  19. package/dist/file-Dd50jPkH.cjs.map +1 -0
  20. package/dist/file-xJnBQPGq.d.ts +624 -0
  21. package/dist/file.cjs +3 -0
  22. package/dist/file.d.cts +2 -0
  23. package/dist/file.d.ts +2 -0
  24. package/dist/file.js +1 -0
  25. package/dist/graph-BcwFCvei.js +144 -0
  26. package/dist/graph-BcwFCvei.js.map +1 -0
  27. package/dist/graph-DcIY6tQb.cjs +173 -0
  28. package/dist/graph-DcIY6tQb.cjs.map +1 -0
  29. package/dist/graph.cjs +6 -0
  30. package/dist/graph.d.cts +2 -0
  31. package/dist/graph.d.ts +2 -0
  32. package/dist/graph.js +1 -0
  33. package/dist/guards-B8qDgSaT.d.cts +23 -0
  34. package/dist/guards-COVJE6TU.cjs +41 -0
  35. package/dist/guards-COVJE6TU.cjs.map +1 -0
  36. package/dist/guards-D-h9R_sV.d.ts +23 -0
  37. package/dist/guards-DlJkKsT1.js +30 -0
  38. package/dist/guards-DlJkKsT1.js.map +1 -0
  39. package/dist/http-Bm5lhVK4.cjs +12 -0
  40. package/dist/http-Bm5lhVK4.cjs.map +1 -0
  41. package/dist/http-DwboM6pK.js +7 -0
  42. package/dist/http-DwboM6pK.js.map +1 -0
  43. package/dist/http.cjs +4 -0
  44. package/dist/http.d.cts +3 -0
  45. package/dist/http.d.ts +3 -0
  46. package/dist/http.js +2 -0
  47. package/dist/index-BWd95onW.d.cts +5 -0
  48. package/dist/index-Bb1kqq8H.d.cts +20 -0
  49. package/dist/index-BngGJux5.d.cts +12 -0
  50. package/dist/index-BwnMIoLl.d.ts +24 -0
  51. package/dist/index-C-vhkzwR.d.cts +79 -0
  52. package/dist/index-CAGuKv6t.d.ts +74 -0
  53. package/dist/index-CFH4ZC7q.d.ts +44 -0
  54. package/dist/index-CIqwy4EE.d.cts +74 -0
  55. package/dist/index-Cc2K3OzU.d.cts +11 -0
  56. package/dist/index-Cc2K3OzU.d.ts +11 -0
  57. package/dist/index-Csf8xsCc.d.cts +46 -0
  58. package/dist/index-D3M2spDR.d.ts +12 -0
  59. package/dist/index-DNiIem0x.d.ts +79 -0
  60. package/dist/index-DSVef1pp.d.cts +24 -0
  61. package/dist/index-DU_jYpBt.d.cts +44 -0
  62. package/dist/index-DYDha-3I.d.cts +67 -0
  63. package/dist/index-DaHsMJ_S.d.ts +5 -0
  64. package/dist/index-Dp50LM3a.d.ts +67 -0
  65. package/dist/index-cpjUxIik.d.ts +46 -0
  66. package/dist/index-eGkM4FE9.d.ts +20 -0
  67. package/dist/index.cjs +87 -2131
  68. package/dist/index.cjs.map +1 -1
  69. package/dist/index.d.cts +25 -2745
  70. package/dist/index.d.ts +25 -2745
  71. package/dist/index.js +40 -2052
  72. package/dist/index.js.map +1 -1
  73. package/dist/json-DH7_lcWm.js +74 -0
  74. package/dist/json-DH7_lcWm.js.map +1 -0
  75. package/dist/json-DURdtz9A.cjs +91 -0
  76. package/dist/json-DURdtz9A.cjs.map +1 -0
  77. package/dist/json.cjs +4 -0
  78. package/dist/json.d.cts +2 -0
  79. package/dist/json.d.ts +2 -0
  80. package/dist/json.js +1 -0
  81. package/dist/macro-D0KfNtff.js +104 -0
  82. package/dist/macro-D0KfNtff.js.map +1 -0
  83. package/dist/macro-DrTBT7fh.cjs +127 -0
  84. package/dist/macro-DrTBT7fh.cjs.map +1 -0
  85. package/dist/macro.cjs +4 -0
  86. package/dist/macro.d.cts +2 -0
  87. package/dist/macro.d.ts +2 -0
  88. package/dist/macro.js +1 -0
  89. package/dist/mediaType-CRjggmoG.js +19 -0
  90. package/dist/mediaType-CRjggmoG.js.map +1 -0
  91. package/dist/mediaType-D8uIO8sG.cjs +35 -0
  92. package/dist/mediaType-D8uIO8sG.cjs.map +1 -0
  93. package/dist/mediaType.cjs +4 -0
  94. package/dist/mediaType.d.cts +2 -0
  95. package/dist/mediaType.d.ts +2 -0
  96. package/dist/mediaType.js +1 -0
  97. package/dist/node-DjcETnc8.cjs +19 -0
  98. package/dist/node-DjcETnc8.cjs.map +1 -0
  99. package/dist/node-Djh-mZB2.js +14 -0
  100. package/dist/node-Djh-mZB2.js.map +1 -0
  101. package/dist/node.cjs +9 -0
  102. package/dist/node.d.cts +4 -0
  103. package/dist/node.d.ts +4 -0
  104. package/dist/node.js +5 -0
  105. package/dist/nodeText-DRb_rVd1.cjs +58 -0
  106. package/dist/nodeText-DRb_rVd1.cjs.map +1 -0
  107. package/dist/nodeText-DVVDZQjF.js +47 -0
  108. package/dist/nodeText-DVVDZQjF.js.map +1 -0
  109. package/dist/nodes-BB60Bq2H.cjs +320 -0
  110. package/dist/nodes-BB60Bq2H.cjs.map +1 -0
  111. package/dist/nodes-CWMa9xhW.js +231 -0
  112. package/dist/nodes-CWMa9xhW.js.map +1 -0
  113. package/dist/operation-BgRyVS7z.d.ts +1272 -0
  114. package/dist/operation-X7chCdL2.d.cts +1272 -0
  115. package/dist/optionality-D-zqzVMH.cjs +22 -0
  116. package/dist/optionality-D-zqzVMH.cjs.map +1 -0
  117. package/dist/optionality-DISn8ytP.js +17 -0
  118. package/dist/optionality-DISn8ytP.js.map +1 -0
  119. package/dist/promise-BOdlgT0N.cjs +50 -0
  120. package/dist/promise-BOdlgT0N.cjs.map +1 -0
  121. package/dist/promise-RpnEev9D.js +45 -0
  122. package/dist/promise-RpnEev9D.js.map +1 -0
  123. package/dist/ref-Bu7PoHar.js +22 -0
  124. package/dist/ref-Bu7PoHar.js.map +1 -0
  125. package/dist/ref-P0ZLT1Bg.cjs +39 -0
  126. package/dist/ref-P0ZLT1Bg.cjs.map +1 -0
  127. package/dist/ref.cjs +7 -0
  128. package/dist/ref.d.cts +2 -0
  129. package/dist/ref.d.ts +2 -0
  130. package/dist/ref.js +3 -0
  131. package/dist/refs-CYHpRlQo.cjs +131 -0
  132. package/dist/refs-CYHpRlQo.cjs.map +1 -0
  133. package/dist/refs-YCV3CznS.js +102 -0
  134. package/dist/refs-YCV3CznS.js.map +1 -0
  135. package/dist/rolldown-runtime-BV8xUvPy.cjs +52 -0
  136. package/dist/rolldown-runtime-BYyVTPww.js +16 -0
  137. package/dist/schema-2ZAQk7qE.js +44 -0
  138. package/dist/schema-2ZAQk7qE.js.map +1 -0
  139. package/dist/schema-BIErWqgc.cjs +214 -0
  140. package/dist/schema-BIErWqgc.cjs.map +1 -0
  141. package/dist/schema-DloctnMm.js +179 -0
  142. package/dist/schema-DloctnMm.js.map +1 -0
  143. package/dist/schema-hxMlgCrV.cjs +49 -0
  144. package/dist/schema-hxMlgCrV.cjs.map +1 -0
  145. package/dist/schema.cjs +16 -0
  146. package/dist/schema.d.cts +5 -0
  147. package/dist/schema.d.ts +5 -0
  148. package/dist/schema.js +6 -0
  149. package/dist/visitor-BZozlXBF.d.ts +179 -0
  150. package/dist/visitor-Bw_opzjF.d.cts +179 -0
  151. package/dist/visitor-DTrzvA3R.cjs +382 -0
  152. package/dist/visitor-DTrzvA3R.cjs.map +1 -0
  153. package/dist/visitor-NoQSUQTu.js +347 -0
  154. package/dist/visitor-NoQSUQTu.js.map +1 -0
  155. package/package.json +101 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-2ZAQk7qE.js","names":[],"sources":["../src/nodes/schema.ts"],"sourcesContent":["import { nodeKinds } from '../constants.ts'\nimport type { BaseNode, DistributiveOmit } from './base.ts'\nimport type { ExternalDocs } from './input.ts'\nimport type { PropertyNode } from './property.ts'\n\n/**\n * Subset of {@link SchemaType} covering the primitives plus `object`, `array`, and `date`; `schemaTypes` documents each.\n */\nexport type PrimitiveSchemaType =\n | 'string'\n | 'number'\n | 'integer'\n | 'bigint'\n | 'boolean'\n | 'null'\n | 'any'\n | 'unknown'\n | 'void'\n | 'never'\n | 'object'\n | 'array'\n | 'date'\n\n/**\n * All schema type strings, one per key of {@link SchemaNodeByType}.\n */\nexport type SchemaType = keyof SchemaNodeByType\n\n/**\n * Scalar schema types without extra object/array/ref structure or constraints.\n */\nexport type ScalarSchemaType = 'boolean' | 'null' | 'any' | 'unknown' | 'void' | 'never' | 'blob' | 'ipv4' | 'ipv6'\n\n/**\n * Fields shared by all schema nodes.\n */\ntype SchemaNodeBase = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Schema'\n /**\n * Schema name for named definitions (for example, `\"Pet\"`).\n * Inline schemas omit this field.\n * `null` means Kubb has processed this and determined there is no applicable name.\n * `undefined` means the name has not been set yet.\n */\n name?: string | null\n /**\n * Short schema title.\n */\n title?: string\n /**\n * Schema description text.\n */\n description?: string\n /**\n * Whether `null` is allowed.\n */\n nullable?: boolean\n /**\n * Whether the field is optional.\n */\n optional?: boolean\n /**\n * Both optional and nullable (`optional` + `nullable`).\n */\n nullish?: boolean\n /**\n * Whether the schema is deprecated.\n */\n deprecated?: boolean\n /**\n * Whether the schema is read-only.\n */\n readOnly?: boolean\n /**\n * Whether the schema is write-only.\n */\n writeOnly?: boolean\n /**\n * Default value.\n */\n default?: unknown\n /**\n * Example values from an `examples` array.\n */\n examples?: Array<unknown>\n /**\n * Base primitive type.\n * For example, this is `'string'` for a `uuid` schema.\n */\n primitive?: PrimitiveSchemaType\n /**\n * Schema `format` value.\n */\n format?: string\n externalDocs?: ExternalDocs\n /**\n * `if`/`then`/`else`, `dependentRequired` and `dependentSchemas`. A required `unknown` property in `if` means \"key is present\".\n * Visitors do not walk it.\n */\n conditionals?: Array<{ if: SchemaNode; then?: SchemaNode; else?: SchemaNode }>\n}\n\n/**\n * Object schema with ordered properties.\n *\n * @example\n * ```ts\n * const objectSchema: ObjectSchemaNode = {\n * kind: 'Schema',\n * type: 'object',\n * properties: [],\n * }\n * ```\n */\nexport type ObjectSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'object'\n /**\n * Primitive type, always `'object'` for object schemas.\n */\n primitive: 'object'\n /**\n * Ordered object properties.\n */\n properties: Array<PropertyNode>\n /**\n * Additional object properties behavior:\n * - `true`: allow any value\n * - `false`: reject unknown properties\n * - `SchemaNode`: allow values that match that schema\n * - `undefined`: no additional properties constraint (open object)\n */\n additionalProperties?: SchemaNode | boolean\n /**\n * Pattern-based property schemas.\n */\n patternProperties?: Record<string, SchemaNode>\n /**\n * Schema that each property name must match.\n *\n * @example\n * ```ts\n * const objectSchema: ObjectSchemaNode = {\n * kind: 'Schema',\n * type: 'object',\n * primitive: 'object',\n * properties: [],\n * propertyNames: { kind: 'Schema', type: 'string', primitive: 'string', pattern: '^[a-z]+$' },\n * }\n * ```\n */\n propertyNames?: SchemaNode\n /**\n * Minimum number of properties allowed.\n */\n min?: number\n /**\n * Maximum number of properties allowed.\n */\n max?: number\n /**\n * @deprecated Use `min`. Removed in Kubb v6.\n */\n minProperties?: number\n /**\n * @deprecated Use `max`. Removed in Kubb v6.\n */\n maxProperties?: number\n}\n\n/**\n * Array-like schema (`array` or `tuple`).\n *\n * @example\n * ```ts\n * const arraySchema: ArraySchemaNode = {\n * kind: 'Schema',\n * type: 'array',\n * items: [],\n * }\n * ```\n */\nexport type ArraySchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator (`array` or `tuple`).\n */\n type: 'array' | 'tuple'\n /**\n * Item schemas.\n */\n items?: Array<SchemaNode>\n /**\n * Tuple rest-item schema for elements beyond positional `items`.\n */\n rest?: SchemaNode\n /**\n * Minimum item count (or tuple length).\n */\n min?: number\n /**\n * Maximum item count (or tuple length).\n */\n max?: number\n /**\n * Whether all items must be unique.\n */\n unique?: boolean\n /**\n * At least `min` (default 1) and at most `max` items match `schema`. Visitors do not walk `schema`.\n */\n contains?: { schema: SchemaNode; min?: number; max?: number }\n}\n\n/**\n * Shared shape for union and intersection schemas.\n */\ntype CompositeSchemaNodeBase = SchemaNodeBase & {\n /**\n * Member schemas.\n */\n members?: Array<SchemaNode>\n}\n\n/**\n * Union schema, often from `oneOf` or `anyOf`.\n *\n * @example\n * ```ts\n * const unionSchema: UnionSchemaNode = {\n * kind: 'Schema',\n * type: 'union',\n * members: [],\n * }\n * ```\n */\nexport type UnionSchemaNode = CompositeSchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'union'\n /**\n * Discriminator property name for a polymorphic union.\n */\n discriminatorPropertyName?: string\n /**\n * How many union members must be valid.\n * - `'one'`: exactly one member, from `oneOf`\n * - `'any'`: any number of members, from `anyOf`\n */\n strategy?: 'one' | 'any'\n}\n\n/**\n * Intersection schema, often from `allOf`.\n *\n * @example\n * ```ts\n * const intersectionSchema: IntersectionSchemaNode = {\n * kind: 'Schema',\n * type: 'intersection',\n * members: [],\n * }\n * ```\n */\nexport type IntersectionSchemaNode = CompositeSchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'intersection'\n}\n\n/** Negation from `not`: the value must not match its single member. Printers that cannot express it return `null`. */\nexport type NotSchemaNode = CompositeSchemaNodeBase & {\n /** Schema type discriminator. */\n type: 'not'\n}\n\n/**\n * One named enum item.\n */\ntype EnumValueNode = {\n /**\n * Enum item name.\n */\n name: string\n /**\n * Enum item value.\n */\n value: string | number | boolean\n /**\n * Primitive type of the enum value.\n */\n primitive: Extract<PrimitiveSchemaType, 'string' | 'number' | 'boolean'>\n /**\n * Label for the enum item, taken from the `x-enumDescriptions` or\n * `x-enum-descriptions` vendor extension. A printer can render it as\n * a comment on the matching enum member.\n */\n description?: string\n}\n\n/**\n * Enum schema node.\n *\n * @example\n * ```ts\n * const enumSchema: EnumSchemaNode = {\n * kind: 'Schema',\n * type: 'enum',\n * enumValues: ['a', 'b'],\n * }\n * ```\n */\nexport type EnumSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'enum'\n /**\n * Enum values in simple form.\n */\n enumValues?: Array<string | number | boolean | null>\n /**\n * Enum values in named form.\n * If present, this is used instead of `enumValues`.\n */\n namedEnumValues?: Array<EnumValueNode>\n}\n\n/**\n * Reference schema that points to another schema definition.\n *\n * @example\n * ```ts\n * const refSchema: RefSchemaNode = {\n * kind: 'Schema',\n * type: 'ref',\n * ref: '#/components/schemas/Pet',\n * }\n * ```\n */\nexport type RefSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'ref'\n /**\n * Referenced schema name.\n * `null` means Kubb has processed this and determined there is no applicable name.\n */\n name?: string | null\n /**\n * Original `$ref` path, for example, `#/components/schemas/Order`.\n * Used to resolve names later.\n */\n ref?: string\n /**\n * Emitted name of the referenced schema when it differs from the pointer's last segment,\n * for example after a collision rename (`Order` becomes `OrderSchema`) or a macro rename.\n * Resolve display and import names through `ast.ref.getName`, which prefers this field and\n * falls back to the pointer segment, then `name`.\n */\n targetName?: string\n /**\n * Pattern copied from a sibling `pattern` field.\n */\n pattern?: string\n /**\n * The fully-parsed schema this ref resolves to, so its structure (`primitive`, `properties`)\n * can be read without following the reference. Populated during parsing when the\n * definition resolves, `null` when it can't or the ref is circular, and `undefined` when\n * resolution has not been attempted.\n */\n schema?: SchemaNode | null\n}\n\n/**\n * Datetime schema.\n *\n * @example\n * ```ts\n * const datetimeSchema: DatetimeSchemaNode = { kind: 'Schema', type: 'datetime' }\n * ```\n */\nexport type DatetimeSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'datetime'\n /**\n * Whether the datetime includes a timezone offset (`dateType: 'stringOffset'`).\n */\n offset?: boolean\n /**\n * Whether the datetime is local (no timezone, `dateType: 'stringLocal'`).\n */\n local?: boolean\n}\n\n/**\n * Shared base for `date` and `time` schemas.\n */\ntype TemporalSchemaNodeBase<T extends 'date' | 'time'> = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: T\n /**\n * Output representation in generated code.\n */\n representation: 'date' | 'string'\n}\n\n/**\n * Date schema node.\n *\n * @example\n * ```ts\n * const dateSchema: DateSchemaNode = { kind: 'Schema', type: 'date', representation: 'string' }\n * ```\n */\nexport type DateSchemaNode = TemporalSchemaNodeBase<'date'>\n\n/**\n * Time schema node.\n *\n * @example\n * ```ts\n * const timeSchema: TimeSchemaNode = { kind: 'Schema', type: 'time', representation: 'string' }\n * ```\n */\nexport type TimeSchemaNode = TemporalSchemaNodeBase<'time'>\n\n/**\n * String schema node.\n *\n * @example\n * ```ts\n * const stringSchema: StringSchemaNode = { kind: 'Schema', type: 'string' }\n * ```\n */\nexport type StringSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'string'\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n /**\n * Regex pattern.\n */\n pattern?: string\n /**\n * The value the string encodes, such as a JSON document or `base64` bytes. Visitors do not walk `schema`.\n */\n content?: {\n mediaType?: string\n encoding?: string\n schema?: SchemaNode\n }\n}\n\n/**\n * Numeric schema (`number`, `integer`, or `bigint`).\n *\n * @example\n * ```ts\n * const numberSchema: NumberSchemaNode = { kind: 'Schema', type: 'number' }\n * ```\n */\nexport type NumberSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'number' | 'integer' | 'bigint'\n /**\n * Minimum value.\n */\n min?: number\n /**\n * Maximum value.\n */\n max?: number\n /**\n * Bounds the value may not equal: it must be greater than `min` and less than `max`.\n */\n exclusive?: { min?: number; max?: number }\n /**\n * @deprecated Use `exclusive.min`. Removed in Kubb v6.\n */\n exclusiveMinimum?: number\n /**\n * @deprecated Use `exclusive.max`. Removed in Kubb v6.\n */\n exclusiveMaximum?: number\n /**\n * The value must be a multiple of this number.\n */\n multipleOf?: number\n}\n\n/**\n * Scalar schema with no extra constraints.\n *\n * @example\n * ```ts\n * const anySchema: ScalarSchemaNode = { kind: 'Schema', type: 'any' }\n * ```\n */\nexport type ScalarSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: ScalarSchemaType\n}\n\n/**\n * URL schema node.\n * Can include a path template for template literal types.\n *\n * @example\n * ```ts\n * const urlSchema: UrlSchemaNode = { kind: 'Schema', type: 'url', path: '/pets/{petId}' }\n * ```\n */\nexport type UrlSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'url'\n /**\n * Path template, for example, `'/pets/{petId}'`.\n */\n path?: string\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n}\n\n/**\n * Format-string schema for string-based formats that support length constraints.\n *\n * @example\n * ```ts\n * const uuidSchema: FormatStringSchemaNode = { kind: 'Schema', type: 'uuid', min: 36, max: 36 }\n * ```\n */\ntype FormatStringSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'uuid' | 'email'\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n}\n\n/**\n * Mapping from schema type literals to concrete schema node types.\n * Used by `narrowSchema`.\n */\nexport type SchemaNodeByType = {\n object: ObjectSchemaNode\n array: ArraySchemaNode\n tuple: ArraySchemaNode\n union: UnionSchemaNode\n intersection: IntersectionSchemaNode\n not: NotSchemaNode\n enum: EnumSchemaNode\n ref: RefSchemaNode\n datetime: DatetimeSchemaNode\n date: DateSchemaNode\n time: TimeSchemaNode\n string: StringSchemaNode\n number: NumberSchemaNode\n integer: NumberSchemaNode\n bigint: NumberSchemaNode\n boolean: ScalarSchemaNode\n null: ScalarSchemaNode\n any: ScalarSchemaNode\n unknown: ScalarSchemaNode\n void: ScalarSchemaNode\n never: ScalarSchemaNode\n uuid: FormatStringSchemaNode\n email: FormatStringSchemaNode\n url: UrlSchemaNode\n ipv4: ScalarSchemaNode\n ipv6: ScalarSchemaNode\n blob: ScalarSchemaNode\n}\n\n/**\n * Union of all schema node types.\n */\nexport type SchemaNode =\n | ObjectSchemaNode\n | ArraySchemaNode\n | UnionSchemaNode\n | IntersectionSchemaNode\n | NotSchemaNode\n | EnumSchemaNode\n | RefSchemaNode\n | DatetimeSchemaNode\n | DateSchemaNode\n | TimeSchemaNode\n | StringSchemaNode\n | NumberSchemaNode\n | UrlSchemaNode\n | FormatStringSchemaNode\n | ScalarSchemaNode\n\ntype CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & { properties?: Array<PropertyNode>; primitive?: 'object' }\ntype CreateSchemaInput = CreateSchemaObjectInput | DistributiveOmit<Exclude<SchemaNode, ObjectSchemaNode>, 'kind'>\ntype CreateSchemaOutput<T extends CreateSchemaInput> = SchemaNodeByType[T['type']] & { kind: 'Schema' }\n\n/**\n * Maps schema `type` to its underlying `primitive`.\n * Primitive types map to themselves and special string formats map to `'string'`.\n * Any type not listed here (such as `ref`, `enum`, `union`, `intersection`, `not`, `tuple`, `ipv4`, `ipv6`, `blob`) has no `primitive`.\n */\nconst TYPE_TO_PRIMITIVE: Partial<Record<SchemaNode['type'], PrimitiveSchemaType>> = {\n string: 'string',\n number: 'number',\n integer: 'integer',\n bigint: 'bigint',\n boolean: 'boolean',\n null: 'null',\n any: 'any',\n unknown: 'unknown',\n void: 'void',\n never: 'never',\n object: 'object',\n array: 'array',\n date: 'date',\n uuid: 'string',\n email: 'string',\n url: 'string',\n datetime: 'string',\n time: 'string',\n}\n\n/**\n * Creates a `SchemaNode`, narrowed to the variant of `props.type`. Object schemas default\n * `properties` to an empty array, and `primitive` is inferred from `type` when not explicitly provided.\n *\n * @example\n * ```ts\n * const scalar = createSchema({ type: 'string' })\n * // { kind: 'Schema', type: 'string', primitive: 'string' }\n * ```\n *\n * @example\n * ```ts\n * const object = createSchema({ type: 'object' })\n * // { kind: 'Schema', type: 'object', primitive: 'object', properties: [] }\n * ```\n */\nexport function createSchema<T extends CreateSchemaInput>(props: T): CreateSchemaOutput<T>\nexport function createSchema(props: CreateSchemaInput): SchemaNode\nexport function createSchema(props: CreateSchemaInput): SchemaNode {\n if (props.type === 'object') {\n return { properties: [], primitive: 'object', ...props, kind: nodeKinds.schema }\n }\n\n return { primitive: TYPE_TO_PRIMITIVE[props.type], ...props, kind: nodeKinds.schema }\n}\n"],"mappings":";;;;;;;;AAioBA,MAAM,oBAA8E;CAClF,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,SAAS;CACT,MAAM;CACN,KAAK;CACL,SAAS;CACT,MAAM;CACN,OAAO;CACP,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,KAAK;CACL,UAAU;CACV,MAAM;AACR;AAoBA,SAAgB,aAAa,OAAsC;CACjE,IAAI,MAAM,SAAS,UACjB,OAAO;EAAE,YAAY,CAAC;EAAG,WAAW;EAAU,GAAG;EAAO,MAAM,UAAU;CAAO;CAGjF,OAAO;EAAE,WAAW,kBAAkB,MAAM;EAAO,GAAG;EAAO,MAAM,UAAU;CAAO;AACtF"}
@@ -0,0 +1,214 @@
1
+ const require_rolldown_runtime = require("./rolldown-runtime-BV8xUvPy.cjs");
2
+ const require_optionality = require("./optionality-D-zqzVMH.cjs");
3
+ const require_constants = require("./constants-CquR083U.cjs");
4
+ const require_guards = require("./guards-COVJE6TU.cjs");
5
+ const require_visitor = require("./visitor-DTrzvA3R.cjs");
6
+ const require_ref = require("./ref-P0ZLT1Bg.cjs");
7
+ const require_promise = require("./promise-BOdlgT0N.cjs");
8
+ // src/schema/is.ts
9
+ const plainStringTypes = /* @__PURE__ */ new Set([
10
+ "string",
11
+ "uuid",
12
+ "email",
13
+ "url",
14
+ "datetime"
15
+ ]);
16
+ const scalarTypes = /* @__PURE__ */ new Set([
17
+ "string",
18
+ "email",
19
+ "url",
20
+ "uuid",
21
+ "number",
22
+ "integer",
23
+ "bigint",
24
+ "boolean",
25
+ "date",
26
+ "time",
27
+ "datetime",
28
+ "blob",
29
+ "enum"
30
+ ]);
31
+ const untypedTypes = /* @__PURE__ */ new Set([
32
+ "void",
33
+ "any",
34
+ "unknown"
35
+ ]);
36
+ const kinds = {
37
+ binary: (node) => node.type === "blob",
38
+ string: (node) => {
39
+ if (plainStringTypes.has(node.type)) return true;
40
+ const temporal = require_guards.narrowSchema(node, "date") ?? require_guards.narrowSchema(node, "time");
41
+ return temporal ? temporal.representation !== "date" : false;
42
+ },
43
+ text: (node) => node.type !== "blob" && node.primitive === "string",
44
+ scalar: (node) => scalarTypes.has(node.type),
45
+ const: (node) => node.type === "enum" && (node.namedEnumValues ?? node.enumValues ?? []).length === 1,
46
+ enumLike: (node, test) => node.type === "enum" || node.type === "union" && !!node.members?.length && node.members.every(test),
47
+ untyped: (node) => untypedTypes.has(node.type)
48
+ };
49
+ /** Whether a schema is of `kind`, looking at the node itself unless `follow` names links to look through. */
50
+ function is(node, kind, { follow = [] } = {}) {
51
+ const test = (current, path) => {
52
+ if (follow.includes("ref") && current.type === "ref" && current.schema) return !path.has(current.schema) && test(require_ref.mergeSchema(current), new Set(path).add(current.schema));
53
+ const child = (next) => test(next, path);
54
+ return kinds[kind](current, child) || follow.includes("array") && current.type === "array" && (current.items ?? []).some(child);
55
+ };
56
+ return test(node, /* @__PURE__ */ new Set());
57
+ }
58
+ // src/utils/schemaProperties.ts
59
+ /**
60
+ * Finds every matching property exposed by an object, resolved reference, or intersection.
61
+ *
62
+ * References are followed through their parsed `schema`. Circular references terminate without
63
+ * revisiting a node. Unions are not traversed because a property on one branch does not describe
64
+ * every branch.
65
+ *
66
+ * @example Faker discriminator narrowing
67
+ * ```ts
68
+ * const values = resolveSchemaProperties({ node: member, propertyName: union.discriminatorPropertyName }).flatMap(({ schema }) =>
69
+ * getSchemaLiteralValues(schema),
70
+ * )
71
+ * const typeName = `Extract<Pet, { type: ${values.map(JSON.stringify).join(' | ')} }>`
72
+ * ```
73
+ *
74
+ * @example Zod discriminated unions
75
+ * ```ts
76
+ * const canDiscriminate = union.members?.every(
77
+ * (member) => resolveSchemaProperties({ node: member, propertyName: 'type' }).length > 0,
78
+ * )
79
+ * const expression = canDiscriminate ? `z.discriminatedUnion('type', members)` : `z.union(members)`
80
+ * ```
81
+ *
82
+ * @example TypeScript property lookup
83
+ * ```ts
84
+ * const properties = resolveSchemaProperties({ node: schema, propertyName: 'status' })
85
+ * const statusSchemas = properties.map((property) => print(property.schema))
86
+ * ```
87
+ */
88
+ function resolveSchemaProperties({ node, propertyName }) {
89
+ const properties = [];
90
+ walkSchema(node, "intersection", (current) => {
91
+ if (current.type !== "object") return;
92
+ const property = current.properties.find((candidate) => candidate.name === propertyName);
93
+ if (property) properties.push(property);
94
+ });
95
+ return properties;
96
+ }
97
+ function walkSchema(node, through, visit) {
98
+ const visited = /* @__PURE__ */ new WeakSet();
99
+ function walk(current) {
100
+ if (!current || visited.has(current)) return;
101
+ visited.add(current);
102
+ visit(current);
103
+ if (current.type === "ref") return walk(current.schema);
104
+ if (current.type === through) for (const member of current.members ?? []) walk(member);
105
+ }
106
+ walk(node);
107
+ }
108
+ /**
109
+ * Reads the unique literal values represented by an enum, resolved reference, or union.
110
+ *
111
+ * Named enum values take precedence over simple enum values, matching how renderers consume
112
+ * `EnumSchemaNode`.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const values = getSchemaLiteralValues(enumNode)
117
+ * // ['cat', 'dog']
118
+ * ```
119
+ */
120
+ function getSchemaLiteralValues(node) {
121
+ return require_promise.memo(literalValues, node, () => {
122
+ const values = /* @__PURE__ */ new Set();
123
+ walkSchema(node, "union", (current) => {
124
+ if (current.type !== "enum") return;
125
+ for (const { value } of current.namedEnumValues ?? current.enumValues?.map((value) => ({ value })) ?? []) values.add(value);
126
+ });
127
+ return Object.freeze([...values]);
128
+ });
129
+ }
130
+ const literalValues = require_promise.memo.create({ weak: true });
131
+ function collectPropertyNames(node) {
132
+ const names = /* @__PURE__ */ new Set();
133
+ walkSchema(node, "intersection", (current) => {
134
+ if (current.type === "object") for (const property of current.properties) names.add(property.name);
135
+ });
136
+ return names;
137
+ }
138
+ /**
139
+ * Infers an implicit discriminator: a property every member exposes with a distinct single
140
+ * literal value, the same shape a declared OpenAPI `discriminator` already narrows on.
141
+ */
142
+ function inferDiscriminatorPropertyName(members) {
143
+ if (members.length < 2) return void 0;
144
+ let candidates;
145
+ for (const member of members) {
146
+ const names = collectPropertyNames(member);
147
+ candidates = candidates ? new Set([...candidates].filter((name) => names.has(name))) : names;
148
+ }
149
+ for (const name of candidates ?? []) {
150
+ const values = members.map((member) => {
151
+ const literals = new Set(resolveSchemaProperties({
152
+ node: member,
153
+ propertyName: name
154
+ }).flatMap((property) => getSchemaLiteralValues(property.schema)));
155
+ return literals.size === 1 ? [...literals][0] : void 0;
156
+ });
157
+ if (values.every((value) => value !== void 0) && new Set(values).size === members.length) return name;
158
+ }
159
+ }
160
+ // src/schema/index.ts
161
+ var schema_exports = /* @__PURE__ */ require_rolldown_runtime.__exportAll({
162
+ applyOptionality: () => require_optionality.applyOptionality,
163
+ find: () => require_visitor.findSchema,
164
+ findProperties: () => resolveSchemaProperties,
165
+ getEmbeddedJson: () => require_visitor.getEmbeddedJson,
166
+ getLiterals: () => getSchemaLiteralValues,
167
+ inferDiscriminator: () => inferDiscriminatorPropertyName,
168
+ is: () => is,
169
+ isString: () => isString,
170
+ narrow: () => require_guards.narrowSchema,
171
+ types: () => require_constants.schemaTypes
172
+ });
173
+ /** @deprecated Use `ast.schema.is(node, 'string')`. Removed in Kubb v6. */
174
+ function isString(node) {
175
+ return is(node, "string");
176
+ }
177
+ Object.defineProperty(exports, "getSchemaLiteralValues", {
178
+ enumerable: true,
179
+ get: function() {
180
+ return getSchemaLiteralValues;
181
+ }
182
+ });
183
+ Object.defineProperty(exports, "inferDiscriminatorPropertyName", {
184
+ enumerable: true,
185
+ get: function() {
186
+ return inferDiscriminatorPropertyName;
187
+ }
188
+ });
189
+ Object.defineProperty(exports, "is", {
190
+ enumerable: true,
191
+ get: function() {
192
+ return is;
193
+ }
194
+ });
195
+ Object.defineProperty(exports, "isString", {
196
+ enumerable: true,
197
+ get: function() {
198
+ return isString;
199
+ }
200
+ });
201
+ Object.defineProperty(exports, "resolveSchemaProperties", {
202
+ enumerable: true,
203
+ get: function() {
204
+ return resolveSchemaProperties;
205
+ }
206
+ });
207
+ Object.defineProperty(exports, "schema_exports", {
208
+ enumerable: true,
209
+ get: function() {
210
+ return schema_exports;
211
+ }
212
+ });
213
+
214
+ //# sourceMappingURL=schema-BIErWqgc.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-BIErWqgc.cjs","names":["narrowSchema","mergeSchema","memo"],"sources":["../src/schema/is.ts","../src/utils/schemaProperties.ts","../src/schema/index.ts"],"sourcesContent":["import { narrowSchema } from '../guards.ts'\nimport type { SchemaNode, SchemaType } from '../nodes/schema.ts'\nimport { mergeSchema } from '../ref/index.ts'\n\n/** `string` prints as a plain `string`, `text` is a non-blob string primitive, `const` a one-value enum, `enumLike` an enum or union of them, `untyped` is `void`, `any` or `unknown`. */\nexport type SchemaKind = 'binary' | 'string' | 'text' | 'scalar' | 'const' | 'enumLike' | 'untyped'\n\n/** `ref` jumps to a resolved ref's target, `array` matches when some item matches. */\nexport type SchemaFollow = 'ref' | 'array'\n\nexport type IsOptions = {\n /** Links to look through. Following repeats and stops on a ref cycle. */\n follow?: ReadonlyArray<SchemaFollow>\n}\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'])\nconst scalarTypes = new Set<SchemaType>([\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n 'enum',\n])\nconst untypedTypes = new Set<SchemaType>(['void', 'any', 'unknown'])\n\nconst kinds: Record<SchemaKind, (node: SchemaNode, test: (child: SchemaNode) => boolean) => boolean> = {\n binary: (node) => node.type === 'blob',\n string: (node) => {\n if (plainStringTypes.has(node.type)) return true\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n return temporal ? temporal.representation !== 'date' : false\n },\n text: (node) => node.type !== 'blob' && node.primitive === 'string',\n scalar: (node) => scalarTypes.has(node.type),\n const: (node) => node.type === 'enum' && (node.namedEnumValues ?? node.enumValues ?? []).length === 1,\n enumLike: (node, test) => node.type === 'enum' || (node.type === 'union' && !!node.members?.length && node.members.every(test)),\n untyped: (node) => untypedTypes.has(node.type),\n}\n\n/** Whether a schema is of `kind`, looking at the node itself unless `follow` names links to look through. */\nexport function is(node: SchemaNode, kind: SchemaKind, { follow = [] }: IsOptions = {}): boolean {\n // `path` holds the ref targets above `current`, so a cycle stops without hiding a target a sibling branch reaches.\n const test = (current: SchemaNode, path: ReadonlySet<SchemaNode>): boolean => {\n if (follow.includes('ref') && current.type === 'ref' && current.schema) {\n return !path.has(current.schema) && test(mergeSchema(current), new Set(path).add(current.schema))\n }\n const child = (next: SchemaNode) => test(next, path)\n return kinds[kind](current, child) || (follow.includes('array') && current.type === 'array' && (current.items ?? []).some(child))\n }\n\n return test(node, new Set())\n}\n","import { memo } from '@internals/utils'\nimport type { PropertyNode } from '../nodes/property.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\n\n/**\n * Finds every matching property exposed by an object, resolved reference, or intersection.\n *\n * References are followed through their parsed `schema`. Circular references terminate without\n * revisiting a node. Unions are not traversed because a property on one branch does not describe\n * every branch.\n *\n * @example Faker discriminator narrowing\n * ```ts\n * const values = resolveSchemaProperties({ node: member, propertyName: union.discriminatorPropertyName }).flatMap(({ schema }) =>\n * getSchemaLiteralValues(schema),\n * )\n * const typeName = `Extract<Pet, { type: ${values.map(JSON.stringify).join(' | ')} }>`\n * ```\n *\n * @example Zod discriminated unions\n * ```ts\n * const canDiscriminate = union.members?.every(\n * (member) => resolveSchemaProperties({ node: member, propertyName: 'type' }).length > 0,\n * )\n * const expression = canDiscriminate ? `z.discriminatedUnion('type', members)` : `z.union(members)`\n * ```\n *\n * @example TypeScript property lookup\n * ```ts\n * const properties = resolveSchemaProperties({ node: schema, propertyName: 'status' })\n * const statusSchemas = properties.map((property) => print(property.schema))\n * ```\n */\nexport function resolveSchemaProperties({ node, propertyName }: { node: SchemaNode; propertyName: string }): ReadonlyArray<PropertyNode> {\n const properties: Array<PropertyNode> = []\n walkSchema(node, 'intersection', (current) => {\n if (current.type !== 'object') return\n const property = current.properties.find((candidate) => candidate.name === propertyName)\n if (property) properties.push(property)\n })\n return properties\n}\n\nfunction walkSchema(node: SchemaNode, through: 'union' | 'intersection', visit: (schema: SchemaNode) => void): void {\n const visited = new WeakSet<SchemaNode>()\n\n function walk(current: SchemaNode | null | undefined): void {\n if (!current || visited.has(current)) return\n visited.add(current)\n visit(current)\n\n if (current.type === 'ref') return walk(current.schema)\n if (current.type === through) for (const member of current.members ?? []) walk(member)\n }\n\n walk(node)\n}\n\n/**\n * Reads the unique literal values represented by an enum, resolved reference, or union.\n *\n * Named enum values take precedence over simple enum values, matching how renderers consume\n * `EnumSchemaNode`.\n *\n * @example\n * ```ts\n * const values = getSchemaLiteralValues(enumNode)\n * // ['cat', 'dog']\n * ```\n */\nexport function getSchemaLiteralValues(node: SchemaNode): ReadonlyArray<LiteralValue> {\n return memo(literalValues, node, () => {\n const values = new Set<LiteralValue>()\n walkSchema(node, 'union', (current) => {\n if (current.type !== 'enum') return\n for (const { value } of current.namedEnumValues ?? current.enumValues?.map((value) => ({ value })) ?? []) values.add(value)\n })\n return Object.freeze([...values])\n })\n}\n\ntype LiteralValue = string | number | boolean | null\n\n// Printers read an enum's values each time they print it.\nconst literalValues = memo.create<SchemaNode, ReadonlyArray<LiteralValue>>({ weak: true })\n\n// Names of every property an object, resolved reference, or intersection exposes.\nfunction collectPropertyNames(node: SchemaNode): Set<string> {\n const names = new Set<string>()\n walkSchema(node, 'intersection', (current) => {\n if (current.type === 'object') for (const property of current.properties) names.add(property.name)\n })\n return names\n}\n\n/**\n * Infers an implicit discriminator: a property every member exposes with a distinct single\n * literal value, the same shape a declared OpenAPI `discriminator` already narrows on.\n */\nexport function inferDiscriminatorPropertyName(members: ReadonlyArray<SchemaNode>): string | undefined {\n if (members.length < 2) return undefined\n\n let candidates: Set<string> | undefined\n for (const member of members) {\n const names = collectPropertyNames(member)\n candidates = candidates ? new Set([...candidates].filter((name) => names.has(name))) : names\n }\n\n for (const name of candidates ?? []) {\n const values = members.map((member) => {\n const literals = new Set(resolveSchemaProperties({ node: member, propertyName: name }).flatMap((property) => getSchemaLiteralValues(property.schema)))\n return literals.size === 1 ? [...literals][0] : undefined\n })\n\n if (values.every((value) => value !== undefined) && new Set(values).size === members.length) {\n return name\n }\n }\n\n return undefined\n}\n","export { applyOptionality } from '../optionality.ts'\nexport { schemaTypes as types } from '../constants.ts'\nexport { narrowSchema as narrow } from '../guards.ts'\nexport { findSchema as find } from '../visitor.ts'\nexport { getEmbeddedJson } from './embeddedJson.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\nimport { is } from './is.ts'\n\nexport { is } from './is.ts'\nexport type { IsOptions, SchemaFollow, SchemaKind } from './is.ts'\nexport {\n getSchemaLiteralValues as getLiterals,\n inferDiscriminatorPropertyName as inferDiscriminator,\n resolveSchemaProperties as findProperties,\n} from '../utils/schemaProperties.ts'\n\n/** @deprecated Use `ast.schema.is(node, 'string')`. Removed in Kubb v6. */\nexport function isString(node: SchemaNode): boolean {\n return is(node, 'string')\n}\n"],"mappings":"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"}
@@ -0,0 +1,179 @@
1
+ import { t as __exportAll } from "./rolldown-runtime-BYyVTPww.js";
2
+ import { t as applyOptionality } from "./optionality-DISn8ytP.js";
3
+ import { n as schemaTypes } from "./constants-Ckeonm-D.js";
4
+ import { n as narrowSchema } from "./guards-DlJkKsT1.js";
5
+ import { n as findSchema, o as getEmbeddedJson } from "./visitor-NoQSUQTu.js";
6
+ import { n as mergeSchema } from "./ref-Bu7PoHar.js";
7
+ import { t as memo } from "./promise-RpnEev9D.js";
8
+ // src/schema/is.ts
9
+ const plainStringTypes = /* @__PURE__ */ new Set([
10
+ "string",
11
+ "uuid",
12
+ "email",
13
+ "url",
14
+ "datetime"
15
+ ]);
16
+ const scalarTypes = /* @__PURE__ */ new Set([
17
+ "string",
18
+ "email",
19
+ "url",
20
+ "uuid",
21
+ "number",
22
+ "integer",
23
+ "bigint",
24
+ "boolean",
25
+ "date",
26
+ "time",
27
+ "datetime",
28
+ "blob",
29
+ "enum"
30
+ ]);
31
+ const untypedTypes = /* @__PURE__ */ new Set([
32
+ "void",
33
+ "any",
34
+ "unknown"
35
+ ]);
36
+ const kinds = {
37
+ binary: (node) => node.type === "blob",
38
+ string: (node) => {
39
+ if (plainStringTypes.has(node.type)) return true;
40
+ const temporal = narrowSchema(node, "date") ?? narrowSchema(node, "time");
41
+ return temporal ? temporal.representation !== "date" : false;
42
+ },
43
+ text: (node) => node.type !== "blob" && node.primitive === "string",
44
+ scalar: (node) => scalarTypes.has(node.type),
45
+ const: (node) => node.type === "enum" && (node.namedEnumValues ?? node.enumValues ?? []).length === 1,
46
+ enumLike: (node, test) => node.type === "enum" || node.type === "union" && !!node.members?.length && node.members.every(test),
47
+ untyped: (node) => untypedTypes.has(node.type)
48
+ };
49
+ /** Whether a schema is of `kind`, looking at the node itself unless `follow` names links to look through. */
50
+ function is(node, kind, { follow = [] } = {}) {
51
+ const test = (current, path) => {
52
+ if (follow.includes("ref") && current.type === "ref" && current.schema) return !path.has(current.schema) && test(mergeSchema(current), new Set(path).add(current.schema));
53
+ const child = (next) => test(next, path);
54
+ return kinds[kind](current, child) || follow.includes("array") && current.type === "array" && (current.items ?? []).some(child);
55
+ };
56
+ return test(node, /* @__PURE__ */ new Set());
57
+ }
58
+ // src/utils/schemaProperties.ts
59
+ /**
60
+ * Finds every matching property exposed by an object, resolved reference, or intersection.
61
+ *
62
+ * References are followed through their parsed `schema`. Circular references terminate without
63
+ * revisiting a node. Unions are not traversed because a property on one branch does not describe
64
+ * every branch.
65
+ *
66
+ * @example Faker discriminator narrowing
67
+ * ```ts
68
+ * const values = resolveSchemaProperties({ node: member, propertyName: union.discriminatorPropertyName }).flatMap(({ schema }) =>
69
+ * getSchemaLiteralValues(schema),
70
+ * )
71
+ * const typeName = `Extract<Pet, { type: ${values.map(JSON.stringify).join(' | ')} }>`
72
+ * ```
73
+ *
74
+ * @example Zod discriminated unions
75
+ * ```ts
76
+ * const canDiscriminate = union.members?.every(
77
+ * (member) => resolveSchemaProperties({ node: member, propertyName: 'type' }).length > 0,
78
+ * )
79
+ * const expression = canDiscriminate ? `z.discriminatedUnion('type', members)` : `z.union(members)`
80
+ * ```
81
+ *
82
+ * @example TypeScript property lookup
83
+ * ```ts
84
+ * const properties = resolveSchemaProperties({ node: schema, propertyName: 'status' })
85
+ * const statusSchemas = properties.map((property) => print(property.schema))
86
+ * ```
87
+ */
88
+ function resolveSchemaProperties({ node, propertyName }) {
89
+ const properties = [];
90
+ walkSchema(node, "intersection", (current) => {
91
+ if (current.type !== "object") return;
92
+ const property = current.properties.find((candidate) => candidate.name === propertyName);
93
+ if (property) properties.push(property);
94
+ });
95
+ return properties;
96
+ }
97
+ function walkSchema(node, through, visit) {
98
+ const visited = /* @__PURE__ */ new WeakSet();
99
+ function walk(current) {
100
+ if (!current || visited.has(current)) return;
101
+ visited.add(current);
102
+ visit(current);
103
+ if (current.type === "ref") return walk(current.schema);
104
+ if (current.type === through) for (const member of current.members ?? []) walk(member);
105
+ }
106
+ walk(node);
107
+ }
108
+ /**
109
+ * Reads the unique literal values represented by an enum, resolved reference, or union.
110
+ *
111
+ * Named enum values take precedence over simple enum values, matching how renderers consume
112
+ * `EnumSchemaNode`.
113
+ *
114
+ * @example
115
+ * ```ts
116
+ * const values = getSchemaLiteralValues(enumNode)
117
+ * // ['cat', 'dog']
118
+ * ```
119
+ */
120
+ function getSchemaLiteralValues(node) {
121
+ return memo(literalValues, node, () => {
122
+ const values = /* @__PURE__ */ new Set();
123
+ walkSchema(node, "union", (current) => {
124
+ if (current.type !== "enum") return;
125
+ for (const { value } of current.namedEnumValues ?? current.enumValues?.map((value) => ({ value })) ?? []) values.add(value);
126
+ });
127
+ return Object.freeze([...values]);
128
+ });
129
+ }
130
+ const literalValues = memo.create({ weak: true });
131
+ function collectPropertyNames(node) {
132
+ const names = /* @__PURE__ */ new Set();
133
+ walkSchema(node, "intersection", (current) => {
134
+ if (current.type === "object") for (const property of current.properties) names.add(property.name);
135
+ });
136
+ return names;
137
+ }
138
+ /**
139
+ * Infers an implicit discriminator: a property every member exposes with a distinct single
140
+ * literal value, the same shape a declared OpenAPI `discriminator` already narrows on.
141
+ */
142
+ function inferDiscriminatorPropertyName(members) {
143
+ if (members.length < 2) return void 0;
144
+ let candidates;
145
+ for (const member of members) {
146
+ const names = collectPropertyNames(member);
147
+ candidates = candidates ? new Set([...candidates].filter((name) => names.has(name))) : names;
148
+ }
149
+ for (const name of candidates ?? []) {
150
+ const values = members.map((member) => {
151
+ const literals = new Set(resolveSchemaProperties({
152
+ node: member,
153
+ propertyName: name
154
+ }).flatMap((property) => getSchemaLiteralValues(property.schema)));
155
+ return literals.size === 1 ? [...literals][0] : void 0;
156
+ });
157
+ if (values.every((value) => value !== void 0) && new Set(values).size === members.length) return name;
158
+ }
159
+ }
160
+ // src/schema/index.ts
161
+ var schema_exports = /* @__PURE__ */ __exportAll({
162
+ applyOptionality: () => applyOptionality,
163
+ find: () => findSchema,
164
+ findProperties: () => resolveSchemaProperties,
165
+ getEmbeddedJson: () => getEmbeddedJson,
166
+ getLiterals: () => getSchemaLiteralValues,
167
+ inferDiscriminator: () => inferDiscriminatorPropertyName,
168
+ is: () => is,
169
+ isString: () => isString,
170
+ narrow: () => narrowSchema,
171
+ types: () => schemaTypes
172
+ });
173
+ /** @deprecated Use `ast.schema.is(node, 'string')`. Removed in Kubb v6. */
174
+ function isString(node) {
175
+ return is(node, "string");
176
+ }
177
+ export { resolveSchemaProperties as a, inferDiscriminatorPropertyName as i, schema_exports as n, is as o, getSchemaLiteralValues as r, isString as t };
178
+
179
+ //# sourceMappingURL=schema-DloctnMm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-DloctnMm.js","names":[],"sources":["../src/schema/is.ts","../src/utils/schemaProperties.ts","../src/schema/index.ts"],"sourcesContent":["import { narrowSchema } from '../guards.ts'\nimport type { SchemaNode, SchemaType } from '../nodes/schema.ts'\nimport { mergeSchema } from '../ref/index.ts'\n\n/** `string` prints as a plain `string`, `text` is a non-blob string primitive, `const` a one-value enum, `enumLike` an enum or union of them, `untyped` is `void`, `any` or `unknown`. */\nexport type SchemaKind = 'binary' | 'string' | 'text' | 'scalar' | 'const' | 'enumLike' | 'untyped'\n\n/** `ref` jumps to a resolved ref's target, `array` matches when some item matches. */\nexport type SchemaFollow = 'ref' | 'array'\n\nexport type IsOptions = {\n /** Links to look through. Following repeats and stops on a ref cycle. */\n follow?: ReadonlyArray<SchemaFollow>\n}\n\nconst plainStringTypes = new Set<SchemaType>(['string', 'uuid', 'email', 'url', 'datetime'])\nconst scalarTypes = new Set<SchemaType>([\n 'string',\n 'email',\n 'url',\n 'uuid',\n 'number',\n 'integer',\n 'bigint',\n 'boolean',\n 'date',\n 'time',\n 'datetime',\n 'blob',\n 'enum',\n])\nconst untypedTypes = new Set<SchemaType>(['void', 'any', 'unknown'])\n\nconst kinds: Record<SchemaKind, (node: SchemaNode, test: (child: SchemaNode) => boolean) => boolean> = {\n binary: (node) => node.type === 'blob',\n string: (node) => {\n if (plainStringTypes.has(node.type)) return true\n const temporal = narrowSchema(node, 'date') ?? narrowSchema(node, 'time')\n return temporal ? temporal.representation !== 'date' : false\n },\n text: (node) => node.type !== 'blob' && node.primitive === 'string',\n scalar: (node) => scalarTypes.has(node.type),\n const: (node) => node.type === 'enum' && (node.namedEnumValues ?? node.enumValues ?? []).length === 1,\n enumLike: (node, test) => node.type === 'enum' || (node.type === 'union' && !!node.members?.length && node.members.every(test)),\n untyped: (node) => untypedTypes.has(node.type),\n}\n\n/** Whether a schema is of `kind`, looking at the node itself unless `follow` names links to look through. */\nexport function is(node: SchemaNode, kind: SchemaKind, { follow = [] }: IsOptions = {}): boolean {\n // `path` holds the ref targets above `current`, so a cycle stops without hiding a target a sibling branch reaches.\n const test = (current: SchemaNode, path: ReadonlySet<SchemaNode>): boolean => {\n if (follow.includes('ref') && current.type === 'ref' && current.schema) {\n return !path.has(current.schema) && test(mergeSchema(current), new Set(path).add(current.schema))\n }\n const child = (next: SchemaNode) => test(next, path)\n return kinds[kind](current, child) || (follow.includes('array') && current.type === 'array' && (current.items ?? []).some(child))\n }\n\n return test(node, new Set())\n}\n","import { memo } from '@internals/utils'\nimport type { PropertyNode } from '../nodes/property.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\n\n/**\n * Finds every matching property exposed by an object, resolved reference, or intersection.\n *\n * References are followed through their parsed `schema`. Circular references terminate without\n * revisiting a node. Unions are not traversed because a property on one branch does not describe\n * every branch.\n *\n * @example Faker discriminator narrowing\n * ```ts\n * const values = resolveSchemaProperties({ node: member, propertyName: union.discriminatorPropertyName }).flatMap(({ schema }) =>\n * getSchemaLiteralValues(schema),\n * )\n * const typeName = `Extract<Pet, { type: ${values.map(JSON.stringify).join(' | ')} }>`\n * ```\n *\n * @example Zod discriminated unions\n * ```ts\n * const canDiscriminate = union.members?.every(\n * (member) => resolveSchemaProperties({ node: member, propertyName: 'type' }).length > 0,\n * )\n * const expression = canDiscriminate ? `z.discriminatedUnion('type', members)` : `z.union(members)`\n * ```\n *\n * @example TypeScript property lookup\n * ```ts\n * const properties = resolveSchemaProperties({ node: schema, propertyName: 'status' })\n * const statusSchemas = properties.map((property) => print(property.schema))\n * ```\n */\nexport function resolveSchemaProperties({ node, propertyName }: { node: SchemaNode; propertyName: string }): ReadonlyArray<PropertyNode> {\n const properties: Array<PropertyNode> = []\n walkSchema(node, 'intersection', (current) => {\n if (current.type !== 'object') return\n const property = current.properties.find((candidate) => candidate.name === propertyName)\n if (property) properties.push(property)\n })\n return properties\n}\n\nfunction walkSchema(node: SchemaNode, through: 'union' | 'intersection', visit: (schema: SchemaNode) => void): void {\n const visited = new WeakSet<SchemaNode>()\n\n function walk(current: SchemaNode | null | undefined): void {\n if (!current || visited.has(current)) return\n visited.add(current)\n visit(current)\n\n if (current.type === 'ref') return walk(current.schema)\n if (current.type === through) for (const member of current.members ?? []) walk(member)\n }\n\n walk(node)\n}\n\n/**\n * Reads the unique literal values represented by an enum, resolved reference, or union.\n *\n * Named enum values take precedence over simple enum values, matching how renderers consume\n * `EnumSchemaNode`.\n *\n * @example\n * ```ts\n * const values = getSchemaLiteralValues(enumNode)\n * // ['cat', 'dog']\n * ```\n */\nexport function getSchemaLiteralValues(node: SchemaNode): ReadonlyArray<LiteralValue> {\n return memo(literalValues, node, () => {\n const values = new Set<LiteralValue>()\n walkSchema(node, 'union', (current) => {\n if (current.type !== 'enum') return\n for (const { value } of current.namedEnumValues ?? current.enumValues?.map((value) => ({ value })) ?? []) values.add(value)\n })\n return Object.freeze([...values])\n })\n}\n\ntype LiteralValue = string | number | boolean | null\n\n// Printers read an enum's values each time they print it.\nconst literalValues = memo.create<SchemaNode, ReadonlyArray<LiteralValue>>({ weak: true })\n\n// Names of every property an object, resolved reference, or intersection exposes.\nfunction collectPropertyNames(node: SchemaNode): Set<string> {\n const names = new Set<string>()\n walkSchema(node, 'intersection', (current) => {\n if (current.type === 'object') for (const property of current.properties) names.add(property.name)\n })\n return names\n}\n\n/**\n * Infers an implicit discriminator: a property every member exposes with a distinct single\n * literal value, the same shape a declared OpenAPI `discriminator` already narrows on.\n */\nexport function inferDiscriminatorPropertyName(members: ReadonlyArray<SchemaNode>): string | undefined {\n if (members.length < 2) return undefined\n\n let candidates: Set<string> | undefined\n for (const member of members) {\n const names = collectPropertyNames(member)\n candidates = candidates ? new Set([...candidates].filter((name) => names.has(name))) : names\n }\n\n for (const name of candidates ?? []) {\n const values = members.map((member) => {\n const literals = new Set(resolveSchemaProperties({ node: member, propertyName: name }).flatMap((property) => getSchemaLiteralValues(property.schema)))\n return literals.size === 1 ? [...literals][0] : undefined\n })\n\n if (values.every((value) => value !== undefined) && new Set(values).size === members.length) {\n return name\n }\n }\n\n return undefined\n}\n","export { applyOptionality } from '../optionality.ts'\nexport { schemaTypes as types } from '../constants.ts'\nexport { narrowSchema as narrow } from '../guards.ts'\nexport { findSchema as find } from '../visitor.ts'\nexport { getEmbeddedJson } from './embeddedJson.ts'\nimport type { SchemaNode } from '../nodes/schema.ts'\nimport { is } from './is.ts'\n\nexport { is } from './is.ts'\nexport type { IsOptions, SchemaFollow, SchemaKind } from './is.ts'\nexport {\n getSchemaLiteralValues as getLiterals,\n inferDiscriminatorPropertyName as inferDiscriminator,\n resolveSchemaProperties as findProperties,\n} from '../utils/schemaProperties.ts'\n\n/** @deprecated Use `ast.schema.is(node, 'string')`. Removed in Kubb v6. */\nexport function isString(node: SchemaNode): boolean {\n return is(node, 'string')\n}\n"],"mappings":"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"}
@@ -0,0 +1,49 @@
1
+ require("./rolldown-runtime-BV8xUvPy.cjs");
2
+ const require_constants = require("./constants-CquR083U.cjs");
3
+ // src/nodes/schema.ts
4
+ /**
5
+ * Maps schema `type` to its underlying `primitive`.
6
+ * Primitive types map to themselves and special string formats map to `'string'`.
7
+ * Any type not listed here (such as `ref`, `enum`, `union`, `intersection`, `not`, `tuple`, `ipv4`, `ipv6`, `blob`) has no `primitive`.
8
+ */
9
+ const TYPE_TO_PRIMITIVE = {
10
+ string: "string",
11
+ number: "number",
12
+ integer: "integer",
13
+ bigint: "bigint",
14
+ boolean: "boolean",
15
+ null: "null",
16
+ any: "any",
17
+ unknown: "unknown",
18
+ void: "void",
19
+ never: "never",
20
+ object: "object",
21
+ array: "array",
22
+ date: "date",
23
+ uuid: "string",
24
+ email: "string",
25
+ url: "string",
26
+ datetime: "string",
27
+ time: "string"
28
+ };
29
+ function createSchema(props) {
30
+ if (props.type === "object") return {
31
+ properties: [],
32
+ primitive: "object",
33
+ ...props,
34
+ kind: require_constants.nodeKinds.schema
35
+ };
36
+ return {
37
+ primitive: TYPE_TO_PRIMITIVE[props.type],
38
+ ...props,
39
+ kind: require_constants.nodeKinds.schema
40
+ };
41
+ }
42
+ Object.defineProperty(exports, "createSchema", {
43
+ enumerable: true,
44
+ get: function() {
45
+ return createSchema;
46
+ }
47
+ });
48
+
49
+ //# sourceMappingURL=schema-hxMlgCrV.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-hxMlgCrV.cjs","names":["nodeKinds"],"sources":["../src/nodes/schema.ts"],"sourcesContent":["import { nodeKinds } from '../constants.ts'\nimport type { BaseNode, DistributiveOmit } from './base.ts'\nimport type { ExternalDocs } from './input.ts'\nimport type { PropertyNode } from './property.ts'\n\n/**\n * Subset of {@link SchemaType} covering the primitives plus `object`, `array`, and `date`; `schemaTypes` documents each.\n */\nexport type PrimitiveSchemaType =\n | 'string'\n | 'number'\n | 'integer'\n | 'bigint'\n | 'boolean'\n | 'null'\n | 'any'\n | 'unknown'\n | 'void'\n | 'never'\n | 'object'\n | 'array'\n | 'date'\n\n/**\n * All schema type strings, one per key of {@link SchemaNodeByType}.\n */\nexport type SchemaType = keyof SchemaNodeByType\n\n/**\n * Scalar schema types without extra object/array/ref structure or constraints.\n */\nexport type ScalarSchemaType = 'boolean' | 'null' | 'any' | 'unknown' | 'void' | 'never' | 'blob' | 'ipv4' | 'ipv6'\n\n/**\n * Fields shared by all schema nodes.\n */\ntype SchemaNodeBase = BaseNode & {\n /**\n * Node kind.\n */\n kind: 'Schema'\n /**\n * Schema name for named definitions (for example, `\"Pet\"`).\n * Inline schemas omit this field.\n * `null` means Kubb has processed this and determined there is no applicable name.\n * `undefined` means the name has not been set yet.\n */\n name?: string | null\n /**\n * Short schema title.\n */\n title?: string\n /**\n * Schema description text.\n */\n description?: string\n /**\n * Whether `null` is allowed.\n */\n nullable?: boolean\n /**\n * Whether the field is optional.\n */\n optional?: boolean\n /**\n * Both optional and nullable (`optional` + `nullable`).\n */\n nullish?: boolean\n /**\n * Whether the schema is deprecated.\n */\n deprecated?: boolean\n /**\n * Whether the schema is read-only.\n */\n readOnly?: boolean\n /**\n * Whether the schema is write-only.\n */\n writeOnly?: boolean\n /**\n * Default value.\n */\n default?: unknown\n /**\n * Example values from an `examples` array.\n */\n examples?: Array<unknown>\n /**\n * Base primitive type.\n * For example, this is `'string'` for a `uuid` schema.\n */\n primitive?: PrimitiveSchemaType\n /**\n * Schema `format` value.\n */\n format?: string\n externalDocs?: ExternalDocs\n /**\n * `if`/`then`/`else`, `dependentRequired` and `dependentSchemas`. A required `unknown` property in `if` means \"key is present\".\n * Visitors do not walk it.\n */\n conditionals?: Array<{ if: SchemaNode; then?: SchemaNode; else?: SchemaNode }>\n}\n\n/**\n * Object schema with ordered properties.\n *\n * @example\n * ```ts\n * const objectSchema: ObjectSchemaNode = {\n * kind: 'Schema',\n * type: 'object',\n * properties: [],\n * }\n * ```\n */\nexport type ObjectSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'object'\n /**\n * Primitive type, always `'object'` for object schemas.\n */\n primitive: 'object'\n /**\n * Ordered object properties.\n */\n properties: Array<PropertyNode>\n /**\n * Additional object properties behavior:\n * - `true`: allow any value\n * - `false`: reject unknown properties\n * - `SchemaNode`: allow values that match that schema\n * - `undefined`: no additional properties constraint (open object)\n */\n additionalProperties?: SchemaNode | boolean\n /**\n * Pattern-based property schemas.\n */\n patternProperties?: Record<string, SchemaNode>\n /**\n * Schema that each property name must match.\n *\n * @example\n * ```ts\n * const objectSchema: ObjectSchemaNode = {\n * kind: 'Schema',\n * type: 'object',\n * primitive: 'object',\n * properties: [],\n * propertyNames: { kind: 'Schema', type: 'string', primitive: 'string', pattern: '^[a-z]+$' },\n * }\n * ```\n */\n propertyNames?: SchemaNode\n /**\n * Minimum number of properties allowed.\n */\n min?: number\n /**\n * Maximum number of properties allowed.\n */\n max?: number\n /**\n * @deprecated Use `min`. Removed in Kubb v6.\n */\n minProperties?: number\n /**\n * @deprecated Use `max`. Removed in Kubb v6.\n */\n maxProperties?: number\n}\n\n/**\n * Array-like schema (`array` or `tuple`).\n *\n * @example\n * ```ts\n * const arraySchema: ArraySchemaNode = {\n * kind: 'Schema',\n * type: 'array',\n * items: [],\n * }\n * ```\n */\nexport type ArraySchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator (`array` or `tuple`).\n */\n type: 'array' | 'tuple'\n /**\n * Item schemas.\n */\n items?: Array<SchemaNode>\n /**\n * Tuple rest-item schema for elements beyond positional `items`.\n */\n rest?: SchemaNode\n /**\n * Minimum item count (or tuple length).\n */\n min?: number\n /**\n * Maximum item count (or tuple length).\n */\n max?: number\n /**\n * Whether all items must be unique.\n */\n unique?: boolean\n /**\n * At least `min` (default 1) and at most `max` items match `schema`. Visitors do not walk `schema`.\n */\n contains?: { schema: SchemaNode; min?: number; max?: number }\n}\n\n/**\n * Shared shape for union and intersection schemas.\n */\ntype CompositeSchemaNodeBase = SchemaNodeBase & {\n /**\n * Member schemas.\n */\n members?: Array<SchemaNode>\n}\n\n/**\n * Union schema, often from `oneOf` or `anyOf`.\n *\n * @example\n * ```ts\n * const unionSchema: UnionSchemaNode = {\n * kind: 'Schema',\n * type: 'union',\n * members: [],\n * }\n * ```\n */\nexport type UnionSchemaNode = CompositeSchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'union'\n /**\n * Discriminator property name for a polymorphic union.\n */\n discriminatorPropertyName?: string\n /**\n * How many union members must be valid.\n * - `'one'`: exactly one member, from `oneOf`\n * - `'any'`: any number of members, from `anyOf`\n */\n strategy?: 'one' | 'any'\n}\n\n/**\n * Intersection schema, often from `allOf`.\n *\n * @example\n * ```ts\n * const intersectionSchema: IntersectionSchemaNode = {\n * kind: 'Schema',\n * type: 'intersection',\n * members: [],\n * }\n * ```\n */\nexport type IntersectionSchemaNode = CompositeSchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'intersection'\n}\n\n/** Negation from `not`: the value must not match its single member. Printers that cannot express it return `null`. */\nexport type NotSchemaNode = CompositeSchemaNodeBase & {\n /** Schema type discriminator. */\n type: 'not'\n}\n\n/**\n * One named enum item.\n */\ntype EnumValueNode = {\n /**\n * Enum item name.\n */\n name: string\n /**\n * Enum item value.\n */\n value: string | number | boolean\n /**\n * Primitive type of the enum value.\n */\n primitive: Extract<PrimitiveSchemaType, 'string' | 'number' | 'boolean'>\n /**\n * Label for the enum item, taken from the `x-enumDescriptions` or\n * `x-enum-descriptions` vendor extension. A printer can render it as\n * a comment on the matching enum member.\n */\n description?: string\n}\n\n/**\n * Enum schema node.\n *\n * @example\n * ```ts\n * const enumSchema: EnumSchemaNode = {\n * kind: 'Schema',\n * type: 'enum',\n * enumValues: ['a', 'b'],\n * }\n * ```\n */\nexport type EnumSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'enum'\n /**\n * Enum values in simple form.\n */\n enumValues?: Array<string | number | boolean | null>\n /**\n * Enum values in named form.\n * If present, this is used instead of `enumValues`.\n */\n namedEnumValues?: Array<EnumValueNode>\n}\n\n/**\n * Reference schema that points to another schema definition.\n *\n * @example\n * ```ts\n * const refSchema: RefSchemaNode = {\n * kind: 'Schema',\n * type: 'ref',\n * ref: '#/components/schemas/Pet',\n * }\n * ```\n */\nexport type RefSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'ref'\n /**\n * Referenced schema name.\n * `null` means Kubb has processed this and determined there is no applicable name.\n */\n name?: string | null\n /**\n * Original `$ref` path, for example, `#/components/schemas/Order`.\n * Used to resolve names later.\n */\n ref?: string\n /**\n * Emitted name of the referenced schema when it differs from the pointer's last segment,\n * for example after a collision rename (`Order` becomes `OrderSchema`) or a macro rename.\n * Resolve display and import names through `ast.ref.getName`, which prefers this field and\n * falls back to the pointer segment, then `name`.\n */\n targetName?: string\n /**\n * Pattern copied from a sibling `pattern` field.\n */\n pattern?: string\n /**\n * The fully-parsed schema this ref resolves to, so its structure (`primitive`, `properties`)\n * can be read without following the reference. Populated during parsing when the\n * definition resolves, `null` when it can't or the ref is circular, and `undefined` when\n * resolution has not been attempted.\n */\n schema?: SchemaNode | null\n}\n\n/**\n * Datetime schema.\n *\n * @example\n * ```ts\n * const datetimeSchema: DatetimeSchemaNode = { kind: 'Schema', type: 'datetime' }\n * ```\n */\nexport type DatetimeSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'datetime'\n /**\n * Whether the datetime includes a timezone offset (`dateType: 'stringOffset'`).\n */\n offset?: boolean\n /**\n * Whether the datetime is local (no timezone, `dateType: 'stringLocal'`).\n */\n local?: boolean\n}\n\n/**\n * Shared base for `date` and `time` schemas.\n */\ntype TemporalSchemaNodeBase<T extends 'date' | 'time'> = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: T\n /**\n * Output representation in generated code.\n */\n representation: 'date' | 'string'\n}\n\n/**\n * Date schema node.\n *\n * @example\n * ```ts\n * const dateSchema: DateSchemaNode = { kind: 'Schema', type: 'date', representation: 'string' }\n * ```\n */\nexport type DateSchemaNode = TemporalSchemaNodeBase<'date'>\n\n/**\n * Time schema node.\n *\n * @example\n * ```ts\n * const timeSchema: TimeSchemaNode = { kind: 'Schema', type: 'time', representation: 'string' }\n * ```\n */\nexport type TimeSchemaNode = TemporalSchemaNodeBase<'time'>\n\n/**\n * String schema node.\n *\n * @example\n * ```ts\n * const stringSchema: StringSchemaNode = { kind: 'Schema', type: 'string' }\n * ```\n */\nexport type StringSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'string'\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n /**\n * Regex pattern.\n */\n pattern?: string\n /**\n * The value the string encodes, such as a JSON document or `base64` bytes. Visitors do not walk `schema`.\n */\n content?: {\n mediaType?: string\n encoding?: string\n schema?: SchemaNode\n }\n}\n\n/**\n * Numeric schema (`number`, `integer`, or `bigint`).\n *\n * @example\n * ```ts\n * const numberSchema: NumberSchemaNode = { kind: 'Schema', type: 'number' }\n * ```\n */\nexport type NumberSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'number' | 'integer' | 'bigint'\n /**\n * Minimum value.\n */\n min?: number\n /**\n * Maximum value.\n */\n max?: number\n /**\n * Bounds the value may not equal: it must be greater than `min` and less than `max`.\n */\n exclusive?: { min?: number; max?: number }\n /**\n * @deprecated Use `exclusive.min`. Removed in Kubb v6.\n */\n exclusiveMinimum?: number\n /**\n * @deprecated Use `exclusive.max`. Removed in Kubb v6.\n */\n exclusiveMaximum?: number\n /**\n * The value must be a multiple of this number.\n */\n multipleOf?: number\n}\n\n/**\n * Scalar schema with no extra constraints.\n *\n * @example\n * ```ts\n * const anySchema: ScalarSchemaNode = { kind: 'Schema', type: 'any' }\n * ```\n */\nexport type ScalarSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: ScalarSchemaType\n}\n\n/**\n * URL schema node.\n * Can include a path template for template literal types.\n *\n * @example\n * ```ts\n * const urlSchema: UrlSchemaNode = { kind: 'Schema', type: 'url', path: '/pets/{petId}' }\n * ```\n */\nexport type UrlSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'url'\n /**\n * Path template, for example, `'/pets/{petId}'`.\n */\n path?: string\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n}\n\n/**\n * Format-string schema for string-based formats that support length constraints.\n *\n * @example\n * ```ts\n * const uuidSchema: FormatStringSchemaNode = { kind: 'Schema', type: 'uuid', min: 36, max: 36 }\n * ```\n */\ntype FormatStringSchemaNode = SchemaNodeBase & {\n /**\n * Schema type discriminator.\n */\n type: 'uuid' | 'email'\n /**\n * Minimum string length.\n */\n min?: number\n /**\n * Maximum string length.\n */\n max?: number\n}\n\n/**\n * Mapping from schema type literals to concrete schema node types.\n * Used by `narrowSchema`.\n */\nexport type SchemaNodeByType = {\n object: ObjectSchemaNode\n array: ArraySchemaNode\n tuple: ArraySchemaNode\n union: UnionSchemaNode\n intersection: IntersectionSchemaNode\n not: NotSchemaNode\n enum: EnumSchemaNode\n ref: RefSchemaNode\n datetime: DatetimeSchemaNode\n date: DateSchemaNode\n time: TimeSchemaNode\n string: StringSchemaNode\n number: NumberSchemaNode\n integer: NumberSchemaNode\n bigint: NumberSchemaNode\n boolean: ScalarSchemaNode\n null: ScalarSchemaNode\n any: ScalarSchemaNode\n unknown: ScalarSchemaNode\n void: ScalarSchemaNode\n never: ScalarSchemaNode\n uuid: FormatStringSchemaNode\n email: FormatStringSchemaNode\n url: UrlSchemaNode\n ipv4: ScalarSchemaNode\n ipv6: ScalarSchemaNode\n blob: ScalarSchemaNode\n}\n\n/**\n * Union of all schema node types.\n */\nexport type SchemaNode =\n | ObjectSchemaNode\n | ArraySchemaNode\n | UnionSchemaNode\n | IntersectionSchemaNode\n | NotSchemaNode\n | EnumSchemaNode\n | RefSchemaNode\n | DatetimeSchemaNode\n | DateSchemaNode\n | TimeSchemaNode\n | StringSchemaNode\n | NumberSchemaNode\n | UrlSchemaNode\n | FormatStringSchemaNode\n | ScalarSchemaNode\n\ntype CreateSchemaObjectInput = Omit<ObjectSchemaNode, 'kind' | 'properties' | 'primitive'> & { properties?: Array<PropertyNode>; primitive?: 'object' }\ntype CreateSchemaInput = CreateSchemaObjectInput | DistributiveOmit<Exclude<SchemaNode, ObjectSchemaNode>, 'kind'>\ntype CreateSchemaOutput<T extends CreateSchemaInput> = SchemaNodeByType[T['type']] & { kind: 'Schema' }\n\n/**\n * Maps schema `type` to its underlying `primitive`.\n * Primitive types map to themselves and special string formats map to `'string'`.\n * Any type not listed here (such as `ref`, `enum`, `union`, `intersection`, `not`, `tuple`, `ipv4`, `ipv6`, `blob`) has no `primitive`.\n */\nconst TYPE_TO_PRIMITIVE: Partial<Record<SchemaNode['type'], PrimitiveSchemaType>> = {\n string: 'string',\n number: 'number',\n integer: 'integer',\n bigint: 'bigint',\n boolean: 'boolean',\n null: 'null',\n any: 'any',\n unknown: 'unknown',\n void: 'void',\n never: 'never',\n object: 'object',\n array: 'array',\n date: 'date',\n uuid: 'string',\n email: 'string',\n url: 'string',\n datetime: 'string',\n time: 'string',\n}\n\n/**\n * Creates a `SchemaNode`, narrowed to the variant of `props.type`. Object schemas default\n * `properties` to an empty array, and `primitive` is inferred from `type` when not explicitly provided.\n *\n * @example\n * ```ts\n * const scalar = createSchema({ type: 'string' })\n * // { kind: 'Schema', type: 'string', primitive: 'string' }\n * ```\n *\n * @example\n * ```ts\n * const object = createSchema({ type: 'object' })\n * // { kind: 'Schema', type: 'object', primitive: 'object', properties: [] }\n * ```\n */\nexport function createSchema<T extends CreateSchemaInput>(props: T): CreateSchemaOutput<T>\nexport function createSchema(props: CreateSchemaInput): SchemaNode\nexport function createSchema(props: CreateSchemaInput): SchemaNode {\n if (props.type === 'object') {\n return { properties: [], primitive: 'object', ...props, kind: nodeKinds.schema }\n }\n\n return { primitive: TYPE_TO_PRIMITIVE[props.type], ...props, kind: nodeKinds.schema }\n}\n"],"mappings":";;;;;;;;AAioBA,MAAM,oBAA8E;CAClF,QAAQ;CACR,QAAQ;CACR,SAAS;CACT,QAAQ;CACR,SAAS;CACT,MAAM;CACN,KAAK;CACL,SAAS;CACT,MAAM;CACN,OAAO;CACP,QAAQ;CACR,OAAO;CACP,MAAM;CACN,MAAM;CACN,OAAO;CACP,KAAK;CACL,UAAU;CACV,MAAM;AACR;AAoBA,SAAgB,aAAa,OAAsC;CACjE,IAAI,MAAM,SAAS,UACjB,OAAO;EAAE,YAAY,CAAC;EAAG,WAAW;EAAU,GAAG;EAAO,MAAMA,kBAAAA,UAAU;CAAO;CAGjF,OAAO;EAAE,WAAW,kBAAkB,MAAM;EAAO,GAAG;EAAO,MAAMA,kBAAAA,UAAU;CAAO;AACtF"}
@@ -0,0 +1,16 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_constants = require("./constants-CquR083U.cjs");
3
+ const require_visitor = require("./visitor-DTrzvA3R.cjs");
4
+ const require_guards = require("./guards-COVJE6TU.cjs");
5
+ const require_optionality = require("./optionality-D-zqzVMH.cjs");
6
+ const require_schema = require("./schema-BIErWqgc.cjs");
7
+ exports.applyOptionality = require_optionality.applyOptionality;
8
+ exports.find = require_visitor.findSchema;
9
+ exports.findProperties = require_schema.resolveSchemaProperties;
10
+ exports.getEmbeddedJson = require_visitor.getEmbeddedJson;
11
+ exports.getLiterals = require_schema.getSchemaLiteralValues;
12
+ exports.inferDiscriminator = require_schema.inferDiscriminatorPropertyName;
13
+ exports.is = require_schema.is;
14
+ exports.isString = require_schema.isString;
15
+ exports.narrow = require_guards.narrowSchema;
16
+ exports.types = require_constants.schemaTypes;
@@ -0,0 +1,5 @@
1
+ import { a as schemaTypes } from "./base-IpYuh3ZP.cjs";
2
+ import { n as narrowSchema } from "./guards-B8qDgSaT.cjs";
3
+ import { a as resolveSchemaProperties, c as SchemaKind, d as applyOptionality, i as inferDiscriminatorPropertyName, l as is, n as isString, o as IsOptions, r as getSchemaLiteralValues, s as SchemaFollow, u as getEmbeddedJson } from "./index-C-vhkzwR.cjs";
4
+ import { a as findSchema } from "./visitor-Bw_opzjF.cjs";
5
+ export { type IsOptions, type SchemaFollow, type SchemaKind, applyOptionality, findSchema as find, resolveSchemaProperties as findProperties, getEmbeddedJson, getSchemaLiteralValues as getLiterals, inferDiscriminatorPropertyName as inferDiscriminator, is, isString, narrowSchema as narrow, schemaTypes as types };
@@ -0,0 +1,5 @@
1
+ import { a as schemaTypes } from "./base-IpYuh3ZP.js";
2
+ import { n as narrowSchema } from "./guards-D-h9R_sV.js";
3
+ import { a as resolveSchemaProperties, c as SchemaKind, d as applyOptionality, i as inferDiscriminatorPropertyName, l as is, n as isString, o as IsOptions, r as getSchemaLiteralValues, s as SchemaFollow, u as getEmbeddedJson } from "./index-DNiIem0x.js";
4
+ import { a as findSchema } from "./visitor-BZozlXBF.js";
5
+ export { type IsOptions, type SchemaFollow, type SchemaKind, applyOptionality, findSchema as find, resolveSchemaProperties as findProperties, getEmbeddedJson, getSchemaLiteralValues as getLiterals, inferDiscriminatorPropertyName as inferDiscriminator, is, isString, narrowSchema as narrow, schemaTypes as types };
package/dist/schema.js ADDED
@@ -0,0 +1,6 @@
1
+ import { n as schemaTypes } from "./constants-Ckeonm-D.js";
2
+ import { n as findSchema, o as getEmbeddedJson } from "./visitor-NoQSUQTu.js";
3
+ import { n as narrowSchema } from "./guards-DlJkKsT1.js";
4
+ import { t as applyOptionality } from "./optionality-DISn8ytP.js";
5
+ import { a as resolveSchemaProperties, i as inferDiscriminatorPropertyName, o as is, r as getSchemaLiteralValues, t as isString } from "./schema-DloctnMm.js";
6
+ export { applyOptionality, findSchema as find, resolveSchemaProperties as findProperties, getEmbeddedJson, getSchemaLiteralValues as getLiterals, inferDiscriminatorPropertyName as inferDiscriminator, is, isString, narrowSchema as narrow, schemaTypes as types };