@mettlecast/domain-cli 0.2.20 → 0.2.22

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.
@@ -34,7 +34,11 @@ function isZod(v) {
34
34
  return v && typeof v === 'object' && typeof v.parse === 'function' && typeof v.safeParse === 'function' && v._def !== undefined;
35
35
  }
36
36
  function toJsonSchema(v) {
37
- try { return z.toJSONSchema ? z.toJSONSchema(v) : zodToJsonSchema(v); } catch { return { type: 'null' }; }
37
+ try {
38
+ if (typeof v.toJSONSchema === 'function') return v.toJSONSchema();
39
+ if (typeof z.toJSONSchema === 'function') return z.toJSONSchema(v);
40
+ return zodToJsonSchema(v);
41
+ } catch { return { type: 'null' }; }
38
42
  }
39
43
  function strip(obj) {
40
44
  const out = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mettlecast/domain-cli",
3
- "version": "0.2.20",
3
+ "version": "0.2.22",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",
@@ -51,7 +51,11 @@ function isZod(v) {
51
51
  return v && typeof v === 'object' && typeof v.parse === 'function' && typeof v.safeParse === 'function' && v._def !== undefined;
52
52
  }
53
53
  function toJsonSchema(v) {
54
- try { return z.toJSONSchema ? z.toJSONSchema(v) : zodToJsonSchema(v); } catch { return { type: 'null' }; }
54
+ try {
55
+ if (typeof v.toJSONSchema === 'function') return v.toJSONSchema();
56
+ if (typeof z.toJSONSchema === 'function') return z.toJSONSchema(v);
57
+ return zodToJsonSchema(v);
58
+ } catch { return { type: 'null' }; }
55
59
  }
56
60
  function strip(obj) {
57
61
  const out = {};