@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.
- package/dist/index.cjs +87 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +62 -14
- package/dist/index.js +86 -1
- package/dist/index.js.map +1 -1
- package/dist/{types-BPqinVNh.d.ts → types-DiCduvU8.d.ts} +38 -9
- package/dist/types.d.ts +2 -2
- package/package.json +3 -1
|
@@ -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 `
|
|
564
|
-
*
|
|
565
|
-
* -
|
|
566
|
-
*
|
|
567
|
-
*
|
|
568
|
-
*
|
|
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:
|
|
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 $,
|
|
2764
|
-
//# sourceMappingURL=types-
|
|
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 {
|
|
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
|
|
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
|
},
|