@kubb/ast 5.15.0 → 5.15.1
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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -17
- package/dist/index.d.ts +11 -17
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1888,13 +1888,13 @@ type InputSecurityScheme = {
|
|
|
1888
1888
|
/**
|
|
1889
1889
|
* Metadata for an API document, populated by the adapter and available to every generator.
|
|
1890
1890
|
*
|
|
1891
|
-
*
|
|
1892
|
-
*
|
|
1893
|
-
*
|
|
1891
|
+
* Computed fields (`circularNames`, `enumNames`) are sets, pre-calculated once during the adapter
|
|
1892
|
+
* pre-scan so generators never need to iterate the full schema list themselves. Every other field
|
|
1893
|
+
* is a plain JSON value.
|
|
1894
1894
|
*
|
|
1895
1895
|
* @example
|
|
1896
1896
|
* ```ts
|
|
1897
|
-
* const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://api.example.com/v2', circularNames:
|
|
1897
|
+
* const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://api.example.com/v2', circularNames: new Set(), enumNames: new Set() }
|
|
1898
1898
|
* ```
|
|
1899
1899
|
*/
|
|
1900
1900
|
type InputMeta = {
|
|
@@ -1925,29 +1925,23 @@ type InputMeta = {
|
|
|
1925
1925
|
* Computed once during the adapter pre-scan, so a generator never has to
|
|
1926
1926
|
* call `findCircularSchemas` itself.
|
|
1927
1927
|
*
|
|
1928
|
-
* Convert to a `Set` once at the start of a generator, not per-schema,
|
|
1929
|
-
* so lookups stay O(1) without repeated allocations.
|
|
1930
|
-
*
|
|
1931
1928
|
* @example Wrap a circular schema in z.lazy()
|
|
1932
1929
|
* ```ts
|
|
1933
|
-
*
|
|
1934
|
-
* if (circular.has(schema.name)) { ... }
|
|
1930
|
+
* if (meta.circularNames.has(schema.name)) { ... }
|
|
1935
1931
|
* ```
|
|
1936
1932
|
*/
|
|
1937
|
-
circularNames:
|
|
1933
|
+
circularNames: ReadonlySet<string>;
|
|
1938
1934
|
/**
|
|
1939
1935
|
* Names of schemas whose type is `enum`.
|
|
1940
1936
|
* Computed once during the adapter pre-scan, so a generator never has to
|
|
1941
1937
|
* filter the schema list itself.
|
|
1942
1938
|
*
|
|
1943
|
-
* Convert to a `Set` once at the start of a generator when you need repeated
|
|
1944
|
-
* membership checks, so each check stays O(1) instead of an array scan.
|
|
1945
|
-
*
|
|
1946
1939
|
* @example Check if a referenced schema is an enum
|
|
1947
|
-
*
|
|
1948
|
-
*
|
|
1940
|
+
* ```ts
|
|
1941
|
+
* const isEnum = meta.enumNames.has(schemaName)
|
|
1942
|
+
* ```
|
|
1949
1943
|
*/
|
|
1950
|
-
enumNames:
|
|
1944
|
+
enumNames: ReadonlySet<string>;
|
|
1951
1945
|
};
|
|
1952
1946
|
/**
|
|
1953
1947
|
* Input AST node that contains all schemas and operations for one API document.
|
|
@@ -1959,7 +1953,7 @@ type InputMeta = {
|
|
|
1959
1953
|
* kind: 'Input',
|
|
1960
1954
|
* schemas: [],
|
|
1961
1955
|
* operations: [],
|
|
1962
|
-
* meta: { circularNames:
|
|
1956
|
+
* meta: { circularNames: new Set(), enumNames: new Set() },
|
|
1963
1957
|
* }
|
|
1964
1958
|
* ```
|
|
1965
1959
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1888,13 +1888,13 @@ type InputSecurityScheme = {
|
|
|
1888
1888
|
/**
|
|
1889
1889
|
* Metadata for an API document, populated by the adapter and available to every generator.
|
|
1890
1890
|
*
|
|
1891
|
-
*
|
|
1892
|
-
*
|
|
1893
|
-
*
|
|
1891
|
+
* Computed fields (`circularNames`, `enumNames`) are sets, pre-calculated once during the adapter
|
|
1892
|
+
* pre-scan so generators never need to iterate the full schema list themselves. Every other field
|
|
1893
|
+
* is a plain JSON value.
|
|
1894
1894
|
*
|
|
1895
1895
|
* @example
|
|
1896
1896
|
* ```ts
|
|
1897
|
-
* const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://api.example.com/v2', circularNames:
|
|
1897
|
+
* const meta: InputMeta = { title: 'Pet Store', version: '1.0.0', baseURL: 'https://api.example.com/v2', circularNames: new Set(), enumNames: new Set() }
|
|
1898
1898
|
* ```
|
|
1899
1899
|
*/
|
|
1900
1900
|
type InputMeta = {
|
|
@@ -1925,29 +1925,23 @@ type InputMeta = {
|
|
|
1925
1925
|
* Computed once during the adapter pre-scan, so a generator never has to
|
|
1926
1926
|
* call `findCircularSchemas` itself.
|
|
1927
1927
|
*
|
|
1928
|
-
* Convert to a `Set` once at the start of a generator, not per-schema,
|
|
1929
|
-
* so lookups stay O(1) without repeated allocations.
|
|
1930
|
-
*
|
|
1931
1928
|
* @example Wrap a circular schema in z.lazy()
|
|
1932
1929
|
* ```ts
|
|
1933
|
-
*
|
|
1934
|
-
* if (circular.has(schema.name)) { ... }
|
|
1930
|
+
* if (meta.circularNames.has(schema.name)) { ... }
|
|
1935
1931
|
* ```
|
|
1936
1932
|
*/
|
|
1937
|
-
circularNames:
|
|
1933
|
+
circularNames: ReadonlySet<string>;
|
|
1938
1934
|
/**
|
|
1939
1935
|
* Names of schemas whose type is `enum`.
|
|
1940
1936
|
* Computed once during the adapter pre-scan, so a generator never has to
|
|
1941
1937
|
* filter the schema list itself.
|
|
1942
1938
|
*
|
|
1943
|
-
* Convert to a `Set` once at the start of a generator when you need repeated
|
|
1944
|
-
* membership checks, so each check stays O(1) instead of an array scan.
|
|
1945
|
-
*
|
|
1946
1939
|
* @example Check if a referenced schema is an enum
|
|
1947
|
-
*
|
|
1948
|
-
*
|
|
1940
|
+
* ```ts
|
|
1941
|
+
* const isEnum = meta.enumNames.has(schemaName)
|
|
1942
|
+
* ```
|
|
1949
1943
|
*/
|
|
1950
|
-
enumNames:
|
|
1944
|
+
enumNames: ReadonlySet<string>;
|
|
1951
1945
|
};
|
|
1952
1946
|
/**
|
|
1953
1947
|
* Input AST node that contains all schemas and operations for one API document.
|
|
@@ -1959,7 +1953,7 @@ type InputMeta = {
|
|
|
1959
1953
|
* kind: 'Input',
|
|
1960
1954
|
* schemas: [],
|
|
1961
1955
|
* operations: [],
|
|
1962
|
-
* meta: { circularNames:
|
|
1956
|
+
* meta: { circularNames: new Set(), enumNames: new Set() },
|
|
1963
1957
|
* }
|
|
1964
1958
|
* ```
|
|
1965
1959
|
*/
|
package/dist/index.js
CHANGED
|
@@ -1595,8 +1595,8 @@ function createInput(overrides = {}) {
|
|
|
1595
1595
|
schemas: [],
|
|
1596
1596
|
operations: [],
|
|
1597
1597
|
meta: {
|
|
1598
|
-
circularNames:
|
|
1599
|
-
enumNames:
|
|
1598
|
+
circularNames: /* @__PURE__ */ new Set(),
|
|
1599
|
+
enumNames: /* @__PURE__ */ new Set()
|
|
1600
1600
|
},
|
|
1601
1601
|
...overrides,
|
|
1602
1602
|
kind: nodeKinds.input
|