@mettlecast/domain-cli 0.2.32 → 0.2.34

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.
@@ -27,7 +27,6 @@ function makeEvalScript(absoluteFilePath) {
27
27
  const fileUrl = pathToFileURL(absoluteFilePath).href;
28
28
  return `
29
29
  import { z } from 'zod';
30
- import { zodToJsonSchema } from 'zod-to-json-schema';
31
30
  import * as mod from ${JSON.stringify(fileUrl)};
32
31
  const KINDS = new Set(['api','webhook','subscriber','schedule','job','action','integration','event','domain']);
33
32
  function isZod(v) {
@@ -35,10 +34,19 @@ function isZod(v) {
35
34
  }
36
35
  function toJsonSchema(v) {
37
36
  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' }; }
37
+ if (typeof v.toJSONSchema === 'function') {
38
+ // Zod v4: z.void() throws convert to empty object
39
+ if (v._def?.type === 'void') return { type: 'object', properties: {}, additionalProperties: false };
40
+ return v.toJSONSchema();
41
+ }
42
+ if (typeof z.toJSONSchema === 'function') {
43
+ if (v._def?.type === 'void') return { type: 'object', properties: {}, additionalProperties: false };
44
+ return z.toJSONSchema(v);
45
+ }
46
+ } catch { /* fall through to custom conversion */ }
47
+ // Fallback conversion for schemas that can't be auto-converted
48
+ if (v._def?.type === 'void') return { type: 'object', properties: {}, additionalProperties: false };
49
+ return { type: 'object', properties: {} };
42
50
  }
43
51
  function strip(obj) {
44
52
  const out = {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mettlecast/domain-cli",
3
- "version": "0.2.32",
3
+ "version": "0.2.34",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org",
@@ -44,7 +44,6 @@ function makeEvalScript(absoluteFilePath: string): string {
44
44
  const fileUrl = pathToFileURL(absoluteFilePath).href;
45
45
  return `
46
46
  import { z } from 'zod';
47
- import { zodToJsonSchema } from 'zod-to-json-schema';
48
47
  import * as mod from ${JSON.stringify(fileUrl)};
49
48
  const KINDS = new Set(['api','webhook','subscriber','schedule','job','action','integration','event','domain']);
50
49
  function isZod(v) {
@@ -52,10 +51,19 @@ function isZod(v) {
52
51
  }
53
52
  function toJsonSchema(v) {
54
53
  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' }; }
54
+ if (typeof v.toJSONSchema === 'function') {
55
+ // Zod v4: z.void() throws convert to empty object
56
+ if (v._def?.type === 'void') return { type: 'object', properties: {}, additionalProperties: false };
57
+ return v.toJSONSchema();
58
+ }
59
+ if (typeof z.toJSONSchema === 'function') {
60
+ if (v._def?.type === 'void') return { type: 'object', properties: {}, additionalProperties: false };
61
+ return z.toJSONSchema(v);
62
+ }
63
+ } catch { /* fall through to custom conversion */ }
64
+ // Fallback conversion for schemas that can't be auto-converted
65
+ if (v._def?.type === 'void') return { type: 'object', properties: {}, additionalProperties: false };
66
+ return { type: 'object', properties: {} };
59
67
  }
60
68
  function strip(obj) {
61
69
  const out = {};