@kubb/ast 5.0.0-beta.97 → 5.0.0-beta.99
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 +0 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -61
- package/dist/index.js +1 -43
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1629,45 +1629,6 @@ function containsCircularRef(node, { circularSchemas, excludeName }) {
|
|
|
1629
1629
|
return false;
|
|
1630
1630
|
}
|
|
1631
1631
|
//#endregion
|
|
1632
|
-
//#region src/utils/schemaTraversal.ts
|
|
1633
|
-
/**
|
|
1634
|
-
* Maps each property of an object schema to its transformed output. Pairs every result with the
|
|
1635
|
-
* original property so the printer keeps full control over modifiers, getters, and key syntax.
|
|
1636
|
-
*
|
|
1637
|
-
* @example
|
|
1638
|
-
* ```ts
|
|
1639
|
-
* const entries = mapSchemaProperties(node, (schema) => this.transform(schema))
|
|
1640
|
-
* // entries: [{ name: 'id', property, output: 'z.number()' }, ...]
|
|
1641
|
-
* ```
|
|
1642
|
-
*/
|
|
1643
|
-
function mapSchemaProperties(node, transform) {
|
|
1644
|
-
return node.properties.map((property) => ({
|
|
1645
|
-
name: property.name,
|
|
1646
|
-
property,
|
|
1647
|
-
output: transform(property.schema)
|
|
1648
|
-
}));
|
|
1649
|
-
}
|
|
1650
|
-
/**
|
|
1651
|
-
* Maps each member of a union or intersection schema to its transformed output, pairing every
|
|
1652
|
-
* result with the original member.
|
|
1653
|
-
*/
|
|
1654
|
-
function mapSchemaMembers(node, transform) {
|
|
1655
|
-
return (node.members ?? []).map((schema) => ({
|
|
1656
|
-
schema,
|
|
1657
|
-
output: transform(schema)
|
|
1658
|
-
}));
|
|
1659
|
-
}
|
|
1660
|
-
/**
|
|
1661
|
-
* Maps each item of an array or tuple schema to its transformed output, pairing every result with
|
|
1662
|
-
* the original item.
|
|
1663
|
-
*/
|
|
1664
|
-
function mapSchemaItems(node, transform) {
|
|
1665
|
-
return (node.items ?? []).map((schema) => ({
|
|
1666
|
-
schema,
|
|
1667
|
-
output: transform(schema)
|
|
1668
|
-
}));
|
|
1669
|
-
}
|
|
1670
|
-
//#endregion
|
|
1671
1632
|
//#region src/macros/macroDiscriminatorEnum.ts
|
|
1672
1633
|
/**
|
|
1673
1634
|
* Builds a macro that replaces a discriminator property's schema with a string enum of the given
|
|
@@ -1902,9 +1863,6 @@ var exports_exports = /* @__PURE__ */ __exportAll({
|
|
|
1902
1863
|
macroEnumName: () => macroEnumName,
|
|
1903
1864
|
macroRenameSchema: () => macroRenameSchema,
|
|
1904
1865
|
macroSimplifyUnion: () => macroSimplifyUnion,
|
|
1905
|
-
mapSchemaItems: () => mapSchemaItems,
|
|
1906
|
-
mapSchemaMembers: () => mapSchemaMembers,
|
|
1907
|
-
mapSchemaProperties: () => mapSchemaProperties,
|
|
1908
1866
|
mergeAdjacentObjectsLazy: () => mergeAdjacentObjectsLazy,
|
|
1909
1867
|
narrowSchema: () => narrowSchema,
|
|
1910
1868
|
nodeDefs: () => nodeDefs,
|
|
@@ -1969,9 +1927,6 @@ exports.macroDiscriminatorEnum = macroDiscriminatorEnum;
|
|
|
1969
1927
|
exports.macroEnumName = macroEnumName;
|
|
1970
1928
|
exports.macroRenameSchema = macroRenameSchema;
|
|
1971
1929
|
exports.macroSimplifyUnion = macroSimplifyUnion;
|
|
1972
|
-
exports.mapSchemaItems = mapSchemaItems;
|
|
1973
|
-
exports.mapSchemaMembers = mapSchemaMembers;
|
|
1974
|
-
exports.mapSchemaProperties = mapSchemaProperties;
|
|
1975
1930
|
exports.mergeAdjacentObjectsLazy = mergeAdjacentObjectsLazy;
|
|
1976
1931
|
exports.narrowSchema = narrowSchema;
|
|
1977
1932
|
exports.nodeDefs = nodeDefs;
|