@kubb/ast 5.0.6 → 5.2.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.
@@ -555,19 +555,48 @@ declare function createBreak(): BreakNode;
555
555
  declare const createJsx: (input: string) => JsxNode;
556
556
  //#endregion
557
557
  //#region src/infer.d.ts
558
+ /**
559
+ * How `format: 'date-time'` schemas are represented downstream.
560
+ * - `false` falls through to a plain `string` (no validation).
561
+ * - `'string'` emits a datetime string node.
562
+ * - `'stringOffset'` emits a datetime node with timezone offset.
563
+ * - `'stringLocal'` emits a local datetime node.
564
+ * - `'date'` emits a `date` node (JavaScript `Date` object).
565
+ */
566
+ type DateTimeTypeValue = false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
567
+ /**
568
+ * How `format: 'date'` or `format: 'time'` schemas are represented downstream.
569
+ * - `false` falls through to a plain `string` (no validation).
570
+ * - `'string'` (default) emits a date or time string node.
571
+ * - `'date'` emits a `date`/`time` node (JavaScript `Date` object).
572
+ */
573
+ type DateOnlyTypeValue = false | 'string' | 'date';
574
+ /**
575
+ * Per-format override of `dateType`, so `date-time`, `date`, and `time` schemas can each
576
+ * resolve to a different representation. A key left out defaults to `'string'`, the same
577
+ * default as the scalar form of `dateType`.
578
+ */
579
+ type DateTypeOptions = {
580
+ dateTime?: DateTimeTypeValue;
581
+ date?: DateOnlyTypeValue;
582
+ time?: DateOnlyTypeValue;
583
+ };
558
584
  /**
559
585
  * Options that control how the adapter parser maps source schemas to AST nodes.
560
586
  */
561
587
  type ParserOptions = {
562
588
  /**
563
- * How `format: 'date-time'` schemas are represented downstream.
564
- * - `false` falls through to a plain `string` (no validation).
565
- * - `'string'` emits a datetime string node.
566
- * - `'stringOffset'` emits a datetime node with timezone offset.
567
- * - `'stringLocal'` emits a local datetime node.
568
- * - `'date'` emits a `date` node (JavaScript `Date` object).
589
+ * How `date-time`, `date`, and `time` formatted schemas are represented downstream.
590
+ * A scalar value ({@link DateTimeTypeValue}) applies to all three formats, matching
591
+ * the pre-5.1 behavior. Pass a {@link DateTypeOptions} object to set `dateTime`,
592
+ * `date`, and `time` independently.
593
+ *
594
+ * @example Represent `date-time` as a JS `Date`, keep `date` and `time` as strings
595
+ * ```ts
596
+ * dateType: { dateTime: 'date' }
597
+ * ```
569
598
  */
570
- dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
599
+ dateType: DateTimeTypeValue | DateTypeOptions;
571
600
  /**
572
601
  * How `type: 'integer'` (and `format: 'int64'`) maps to TypeScript.
573
602
  * - `'bigint'` is exact for 64-bit IDs, but does not round-trip through JSON.
@@ -2760,5 +2789,5 @@ type PrinterBuilder<T extends PrinterFactoryOptions> = (options: T['options']) =
2760
2789
  */
2761
2790
  declare function createPrinter<T extends PrinterFactoryOptions = PrinterFactoryOptions>(build: PrinterBuilder<T>): (options?: T['options']) => Printer<T>;
2762
2791
  //#endregion
2763
- export { importDef as $, DistributiveOmit as $t, ResponseNode as A, ArrowFunctionNode as At, createParameter as B, breakDef as Bt, inputDef as C, schemaDef as Ct, OperationNode as D, propertyDef as Dt, HttpOperationNode as E, createProperty as Et, createRequestBody as F, JSDocNode as Ft, SourceNode as G, createFunction as Gt, ExportNode as H, createArrowFunction as Ht, requestBodyDef as I, JsxNode as It, createFile as J, createType as Jt, UserFileNode as K, createJsx as Kt, ParameterLocation as L, TextNode as Lt, createResponse as M, CodeNode as Mt, responseDef as N, ConstNode as Nt, createOperation as O, InferSchemaNode as Ot, RequestBodyNode as P, FunctionNode as Pt, fileDef as Q, typeDef as Qt, ParameterNode as R, TypeNode as Rt, createInput as S, createSchema as St, HttpMethod as T, UserPropertyNode as Tt, FileNode as U, createBreak as Ut, parameterDef as V, constDef as Vt, ImportNode as W, createConst as Wt, createSource as X, jsxDef as Xt, createImport as Y, functionDef as Yt, exportDef as Z, textDef as Zt, OutputNode as _, SchemaType as _t, Enforce as a, DateSchemaNode as at, InputMeta as b, UnionSchemaNode as bt, composeMacros as c, IntersectionSchemaNode as ct, Visitor as d, PrimitiveSchemaType as dt, NodeDef as en, sourceDef as et, VisitorContext as f, RefSchemaNode as ft, Node as g, SchemaNodeByType as gt, transform as h, SchemaNode as ht, createPrinter as i, schemaTypes as in, ArraySchemaNode as it, StatusCode as j, BreakNode as jt, operationDef as k, ParserOptions as kt, defineMacro as l, NumberSchemaNode as lt, collectSync as m, ScalarSchemaType as mt, PrinterFactoryOptions as n, BaseNode as nn, contentDef as nt, Macro as o, DatetimeSchemaNode as ot, collect as p, ScalarSchemaNode as pt, createExport as q, createText as qt, PrinterPartial as r, NodeKind as rn, createContent as rt, applyMacros as s, EnumSchemaNode as st, Printer as t, defineNode as tn, ContentNode as tt, ParentOf as u, ObjectSchemaNode as ut, createOutput as v, StringSchemaNode as vt, GenericOperationNode as w, PropertyNode as wt, InputNode as x, UrlSchemaNode as xt, outputDef as y, TimeSchemaNode as yt, ParameterStyle as z, arrowFunctionDef as zt };
2764
- //# sourceMappingURL=types-BPqinVNh.d.ts.map
2792
+ export { importDef as $, textDef as $t, ResponseNode as A, InferSchemaNode as At, createParameter as B, TypeNode as Bt, inputDef as C, schemaDef as Ct, OperationNode as D, DateOnlyTypeValue as Dt, HttpOperationNode as E, propertyDef as Et, createRequestBody as F, ConstNode as Ft, SourceNode as G, createBreak as Gt, ExportNode as H, breakDef as Ht, requestBodyDef as I, FunctionNode as It, createFile as J, createJsx as Jt, UserFileNode as K, createConst as Kt, ParameterLocation as L, JSDocNode as Lt, createResponse as M, ArrowFunctionNode as Mt, responseDef as N, BreakNode as Nt, createOperation as O, DateTimeTypeValue as Ot, RequestBodyNode as P, CodeNode as Pt, fileDef as Q, jsxDef as Qt, ParameterNode as R, JsxNode as Rt, createInput as S, createSchema as St, HttpMethod as T, createProperty as Tt, FileNode as U, constDef as Ut, parameterDef as V, arrowFunctionDef as Vt, ImportNode as W, createArrowFunction as Wt, createSource as X, createType as Xt, createImport as Y, createText as Yt, exportDef as Z, functionDef as Zt, OutputNode as _, SchemaType as _t, Enforce as a, NodeKind as an, DateSchemaNode as at, InputMeta as b, UnionSchemaNode as bt, composeMacros as c, IntersectionSchemaNode as ct, Visitor as d, PrimitiveSchemaType as dt, typeDef as en, sourceDef as et, VisitorContext as f, RefSchemaNode as ft, Node as g, SchemaNodeByType as gt, transform as h, SchemaNode as ht, createPrinter as i, BaseNode as in, ArraySchemaNode as it, StatusCode as j, ParserOptions as jt, operationDef as k, DateTypeOptions as kt, defineMacro as l, NumberSchemaNode as lt, collectSync as m, ScalarSchemaType as mt, PrinterFactoryOptions as n, NodeDef as nn, contentDef as nt, Macro as o, schemaTypes as on, DatetimeSchemaNode as ot, collect as p, ScalarSchemaNode as pt, createExport as q, createFunction as qt, PrinterPartial as r, defineNode as rn, createContent as rt, applyMacros as s, EnumSchemaNode as st, Printer as t, DistributiveOmit as tn, ContentNode as tt, ParentOf as u, ObjectSchemaNode as ut, createOutput as v, StringSchemaNode as vt, GenericOperationNode as w, PropertyNode as wt, InputNode as x, UrlSchemaNode as xt, outputDef as y, TimeSchemaNode as yt, ParameterStyle as z, TextNode as zt };
2793
+ //# sourceMappingURL=types-DiCduvU8.d.ts.map
package/dist/types.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { $t as DistributiveOmit, A as ResponseNode, At as ArrowFunctionNode, D as OperationNode, E as HttpOperationNode, Ft as JSDocNode, G as SourceNode, H as ExportNode, It as JsxNode, K as UserFileNode, L as ParameterLocation, Lt as TextNode, Mt as CodeNode, Nt as ConstNode, Ot as InferSchemaNode, P as RequestBodyNode, Pt as FunctionNode, R as ParameterNode, Rt as TypeNode, T as HttpMethod, U as FileNode, W as ImportNode, _ as OutputNode, _t as SchemaType, a as Enforce, at as DateSchemaNode, b as InputMeta, bt as UnionSchemaNode, ct as IntersectionSchemaNode, d as Visitor, dt as PrimitiveSchemaType, en as NodeDef, f as VisitorContext, ft as RefSchemaNode, g as Node, gt as SchemaNodeByType, ht as SchemaNode, it as ArraySchemaNode, j as StatusCode, jt as BreakNode, kt as ParserOptions, lt as NumberSchemaNode, mt as ScalarSchemaType, n as PrinterFactoryOptions, o as Macro, ot as DatetimeSchemaNode, pt as ScalarSchemaNode, r as PrinterPartial, rn as NodeKind, st as EnumSchemaNode, t as Printer, tt as ContentNode, u as ParentOf, ut as ObjectSchemaNode, vt as StringSchemaNode, w as GenericOperationNode, wt as PropertyNode, x as InputNode, xt as UrlSchemaNode, yt as TimeSchemaNode, z as ParameterStyle } from "./types-BPqinVNh.js";
2
- export type { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateSchemaNode, DatetimeSchemaNode, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeDef, NodeKind, NumberSchemaNode, ObjectSchemaNode, OperationNode, OutputNode, ParameterLocation, ParameterNode, ParameterStyle, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, RequestBodyNode, ResponseNode, ScalarSchemaNode, ScalarSchemaType, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext };
1
+ import { A as ResponseNode, At as InferSchemaNode, Bt as TypeNode, D as OperationNode, Dt as DateOnlyTypeValue, E as HttpOperationNode, Ft as ConstNode, G as SourceNode, H as ExportNode, It as FunctionNode, K as UserFileNode, L as ParameterLocation, Lt as JSDocNode, Mt as ArrowFunctionNode, Nt as BreakNode, Ot as DateTimeTypeValue, P as RequestBodyNode, Pt as CodeNode, R as ParameterNode, Rt as JsxNode, T as HttpMethod, U as FileNode, W as ImportNode, _ as OutputNode, _t as SchemaType, a as Enforce, an as NodeKind, at as DateSchemaNode, b as InputMeta, bt as UnionSchemaNode, ct as IntersectionSchemaNode, d as Visitor, dt as PrimitiveSchemaType, f as VisitorContext, ft as RefSchemaNode, g as Node, gt as SchemaNodeByType, ht as SchemaNode, it as ArraySchemaNode, j as StatusCode, jt as ParserOptions, kt as DateTypeOptions, lt as NumberSchemaNode, mt as ScalarSchemaType, n as PrinterFactoryOptions, nn as NodeDef, o as Macro, ot as DatetimeSchemaNode, pt as ScalarSchemaNode, r as PrinterPartial, st as EnumSchemaNode, t as Printer, tn as DistributiveOmit, tt as ContentNode, u as ParentOf, ut as ObjectSchemaNode, vt as StringSchemaNode, w as GenericOperationNode, wt as PropertyNode, x as InputNode, xt as UrlSchemaNode, yt as TimeSchemaNode, z as ParameterStyle, zt as TextNode } from "./types-DiCduvU8.js";
2
+ export type { ArraySchemaNode, ArrowFunctionNode, BreakNode, CodeNode, ConstNode, ContentNode, DateOnlyTypeValue, DateSchemaNode, DateTimeTypeValue, DateTypeOptions, DatetimeSchemaNode, DistributiveOmit, Enforce, EnumSchemaNode, ExportNode, FileNode, FunctionNode, GenericOperationNode, HttpMethod, HttpOperationNode, ImportNode, InferSchemaNode, InputMeta, InputNode, IntersectionSchemaNode, JSDocNode, JsxNode, Macro, Node, NodeDef, NodeKind, NumberSchemaNode, ObjectSchemaNode, OperationNode, OutputNode, ParameterLocation, ParameterNode, ParameterStyle, ParentOf, ParserOptions, PrimitiveSchemaType, Printer, PrinterFactoryOptions, PrinterPartial, PropertyNode, RefSchemaNode, RequestBodyNode, ResponseNode, ScalarSchemaNode, ScalarSchemaType, SchemaNode, SchemaNodeByType, SchemaType, SourceNode, StatusCode, StringSchemaNode, TextNode, TimeSchemaNode, TypeNode, UnionSchemaNode, UrlSchemaNode, UserFileNode, Visitor, VisitorContext };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/ast",
3
- "version": "5.0.6",
3
+ "version": "5.2.0",
4
4
  "description": "Spec-agnostic AST layer for Kubb. Defines the node tree, visitor pattern, factory functions, and type guards used across all code generation plugins.",
5
5
  "keywords": [
6
6
  "ast",
@@ -39,10 +39,12 @@
39
39
  "types": "./dist/index.d.ts",
40
40
  "exports": {
41
41
  ".": {
42
+ "types": "./dist/index.d.ts",
42
43
  "import": "./dist/index.js",
43
44
  "require": "./dist/index.cjs"
44
45
  },
45
46
  "./types": {
47
+ "types": "./dist/types.d.ts",
46
48
  "import": "./dist/types.js",
47
49
  "require": "./dist/types.cjs"
48
50
  },