zod-to-x 2.2.0 → 2.2.1-dev.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.
@@ -255,6 +255,6 @@ class Zod2ProtoV3 extends core_1.Zod2X {
255
255
  */
256
256
  function zod2ProtoV3(schema, // TODO: fix any to force only ZodObjects
257
257
  opt = {}) {
258
- const astNode = new core_1.Zod2Ast({ strict: opt.strict }).build(schema);
258
+ const astNode = new core_1.Zod2Ast({ strict: opt.strict, skipBasicTypes: true }).build(schema);
259
259
  return new Zod2ProtoV3(opt).transpile(astNode);
260
260
  }
@@ -12,6 +12,13 @@ export interface IZod2AstOpt {
12
12
  * the schema.
13
13
  */
14
14
  layer?: IZod2xLayerMetadata;
15
+ /**
16
+ * If true, aliased basic types (string, number, boolean, etc.) from layered modeling
17
+ * will not be extracted as named AST nodes. Instead, they will be inlined as their
18
+ * underlying type. Useful for targets like Protobuf that don't support type aliases.
19
+ * Default is false.
20
+ */
21
+ skipBasicTypes?: boolean;
15
22
  }
16
23
  /**
17
24
  * This class creates AST nodes used to transpile Zod Schemas to other languages.
@@ -481,7 +481,7 @@ class Zod2Ast {
481
481
  }
482
482
  _getAliasAst(schema, item) {
483
483
  var _a;
484
- if (((_a = schema._zod2x) === null || _a === void 0 ? void 0 : _a.typeName) === undefined) {
484
+ if (((_a = schema._zod2x) === null || _a === void 0 ? void 0 : _a.typeName) === undefined || this.opt.skipBasicTypes === true) {
485
485
  return item;
486
486
  }
487
487
  const { name, parentFile, parentNamespace, aliasOf } = this._getNames(schema);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zod-to-x",
3
- "version": "2.2.0",
3
+ "version": "2.2.1-dev.0",
4
4
  "description": "Multi language types generation from Zod schemas.",
5
5
  "main": "dist/index.js",
6
6
  "files": [