@zapier/zapier-sdk-cli 0.15.13 → 0.16.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @zapier/zapier-sdk-cli
2
2
 
3
+ ## 0.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 24ae4f0: Upgrade to Zod 4
8
+ - Update all packages to use Zod 4
9
+ - Migrate internal API access from `_def` to `_zod.def`
10
+ - Update `z.record()` calls to include explicit key types
11
+ - Fix schema introspection for documentation generation and CLI
12
+ - Update MCP schema converter for Zod 4 structure
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies [24ae4f0]
17
+ - @zapier/zapier-sdk-mcp@0.4.0
18
+ - @zapier/zapier-sdk@0.16.0
19
+
20
+ ## 0.15.14
21
+
22
+ ### Patch Changes
23
+
24
+ - d08fa90: Add proper license
25
+ - Updated dependencies [d08fa90]
26
+ - @zapier/zapier-sdk-cli-login@0.3.5
27
+ - @zapier/zapier-sdk-mcp@0.3.39
28
+ - @zapier/zapier-sdk@0.15.13
29
+
3
30
  ## 0.15.13
4
31
 
5
32
  ### Patch Changes
package/LICENSE ADDED
@@ -0,0 +1,2 @@
1
+ Copyright (c) Zapier, Inc.
2
+ The Zapier SDK is part of Zapier's services. By downloading, installing, accessing, or using any part of the Zapier SDK you agree to the Zapier Terms of Service, which can be found at: https://zapier.com/tos, or such other agreement between you and Zapier governing Zapier services (as applicable). If you do not agree to the Zapier Terms of Service (or do not have another governing agreement in place with Zapier), you may not download, install, access, or use the Zapier SDK.
package/dist/cli.cjs CHANGED
@@ -293,11 +293,11 @@ var SchemaParameterResolver = class {
293
293
  let isRequired = true;
294
294
  if (baseSchema instanceof zod.z.ZodOptional) {
295
295
  isRequired = false;
296
- baseSchema = baseSchema._def.innerType;
296
+ baseSchema = baseSchema._zod.def.innerType;
297
297
  }
298
298
  if (baseSchema instanceof zod.z.ZodDefault) {
299
299
  isRequired = false;
300
- baseSchema = baseSchema._def.innerType;
300
+ baseSchema = baseSchema._zod.def.innerType;
301
301
  }
302
302
  return this.createResolvableParameter([fieldName], baseSchema, isRequired);
303
303
  }
@@ -786,10 +786,10 @@ Optional fields${pathContext}:`));
786
786
  }
787
787
  };
788
788
  function getFormatMetadata(schema) {
789
- return schema?._def?.formatMeta;
789
+ return schema?._zod?.def?.formatMeta;
790
790
  }
791
791
  function getOutputSchema(schema) {
792
- return schema?._def?.outputSchema;
792
+ return schema?._zod?.def?.outputSchema;
793
793
  }
794
794
  function formatJsonOutput(data) {
795
795
  if (data === void 0) {
@@ -878,9 +878,9 @@ function formatItemsGeneric(items, startingNumber = 0) {
878
878
  }
879
879
  function analyzeZodSchema(schema, functionInfo) {
880
880
  const parameters = [];
881
- if (schema._def && schema._def.typeName === "ZodEffects") {
882
- const innerSchema = schema._def.schema;
883
- return analyzeZodSchema(innerSchema, functionInfo);
881
+ const schemaDef = schema._zod?.def;
882
+ if (schemaDef?.type === "effect" && schemaDef.innerType) {
883
+ return analyzeZodSchema(schemaDef.innerType, functionInfo);
884
884
  }
885
885
  if (schema instanceof zod.z.ZodObject) {
886
886
  const shape = schema.shape;
@@ -904,14 +904,17 @@ function analyzeZodField(name, schema, functionInfo) {
904
904
  while (true) {
905
905
  if (baseSchema instanceof zod.z.ZodOptional) {
906
906
  required = false;
907
- baseSchema = baseSchema._def.innerType;
907
+ baseSchema = baseSchema._zod.def.innerType;
908
908
  } else if (baseSchema instanceof zod.z.ZodDefault) {
909
909
  required = false;
910
- defaultValue = baseSchema._def.defaultValue();
911
- baseSchema = baseSchema._def.innerType;
912
- } else if (baseSchema._def && baseSchema._def.typeName === "ZodNullable") {
913
- baseSchema = baseSchema._def.innerType;
910
+ defaultValue = baseSchema._zod.def.defaultValue();
911
+ baseSchema = baseSchema._zod.def.innerType;
914
912
  } else {
913
+ const zodDef = baseSchema._zod?.def;
914
+ if (zodDef?.typeName === "ZodNullable" && zodDef.innerType) {
915
+ baseSchema = zodDef.innerType;
916
+ continue;
917
+ }
915
918
  break;
916
919
  }
917
920
  }
@@ -927,7 +930,7 @@ function analyzeZodField(name, schema, functionInfo) {
927
930
  paramType = "array";
928
931
  } else if (baseSchema instanceof zod.z.ZodEnum) {
929
932
  paramType = "string";
930
- choices = baseSchema._def.values;
933
+ choices = baseSchema.options;
931
934
  } else if (baseSchema instanceof zod.z.ZodRecord) {
932
935
  paramType = "string";
933
936
  }
@@ -1625,7 +1628,7 @@ var LoginSchema = zod.z.object({
1625
1628
 
1626
1629
  // package.json
1627
1630
  var package_default = {
1628
- version: "0.15.13"};
1631
+ version: "0.16.0"};
1629
1632
 
1630
1633
  // src/telemetry/builders.ts
1631
1634
  function createCliBaseEvent(context = {}) {
@@ -2904,7 +2907,7 @@ function createZapierCliSdk(options = {}) {
2904
2907
  // package.json with { type: 'json' }
2905
2908
  var package_default2 = {
2906
2909
  name: "@zapier/zapier-sdk-cli",
2907
- version: "0.15.13"};
2910
+ version: "0.16.0"};
2908
2911
  function detectPackageManager(cwd = process.cwd()) {
2909
2912
  const ua = process.env.npm_config_user_agent;
2910
2913
  if (ua) {
package/dist/cli.mjs CHANGED
@@ -257,11 +257,11 @@ var SchemaParameterResolver = class {
257
257
  let isRequired = true;
258
258
  if (baseSchema instanceof z.ZodOptional) {
259
259
  isRequired = false;
260
- baseSchema = baseSchema._def.innerType;
260
+ baseSchema = baseSchema._zod.def.innerType;
261
261
  }
262
262
  if (baseSchema instanceof z.ZodDefault) {
263
263
  isRequired = false;
264
- baseSchema = baseSchema._def.innerType;
264
+ baseSchema = baseSchema._zod.def.innerType;
265
265
  }
266
266
  return this.createResolvableParameter([fieldName], baseSchema, isRequired);
267
267
  }
@@ -750,10 +750,10 @@ Optional fields${pathContext}:`));
750
750
  }
751
751
  };
752
752
  function getFormatMetadata(schema) {
753
- return schema?._def?.formatMeta;
753
+ return schema?._zod?.def?.formatMeta;
754
754
  }
755
755
  function getOutputSchema(schema) {
756
- return schema?._def?.outputSchema;
756
+ return schema?._zod?.def?.outputSchema;
757
757
  }
758
758
  function formatJsonOutput(data) {
759
759
  if (data === void 0) {
@@ -842,9 +842,9 @@ function formatItemsGeneric(items, startingNumber = 0) {
842
842
  }
843
843
  function analyzeZodSchema(schema, functionInfo) {
844
844
  const parameters = [];
845
- if (schema._def && schema._def.typeName === "ZodEffects") {
846
- const innerSchema = schema._def.schema;
847
- return analyzeZodSchema(innerSchema, functionInfo);
845
+ const schemaDef = schema._zod?.def;
846
+ if (schemaDef?.type === "effect" && schemaDef.innerType) {
847
+ return analyzeZodSchema(schemaDef.innerType, functionInfo);
848
848
  }
849
849
  if (schema instanceof z.ZodObject) {
850
850
  const shape = schema.shape;
@@ -868,14 +868,17 @@ function analyzeZodField(name, schema, functionInfo) {
868
868
  while (true) {
869
869
  if (baseSchema instanceof z.ZodOptional) {
870
870
  required = false;
871
- baseSchema = baseSchema._def.innerType;
871
+ baseSchema = baseSchema._zod.def.innerType;
872
872
  } else if (baseSchema instanceof z.ZodDefault) {
873
873
  required = false;
874
- defaultValue = baseSchema._def.defaultValue();
875
- baseSchema = baseSchema._def.innerType;
876
- } else if (baseSchema._def && baseSchema._def.typeName === "ZodNullable") {
877
- baseSchema = baseSchema._def.innerType;
874
+ defaultValue = baseSchema._zod.def.defaultValue();
875
+ baseSchema = baseSchema._zod.def.innerType;
878
876
  } else {
877
+ const zodDef = baseSchema._zod?.def;
878
+ if (zodDef?.typeName === "ZodNullable" && zodDef.innerType) {
879
+ baseSchema = zodDef.innerType;
880
+ continue;
881
+ }
879
882
  break;
880
883
  }
881
884
  }
@@ -891,7 +894,7 @@ function analyzeZodField(name, schema, functionInfo) {
891
894
  paramType = "array";
892
895
  } else if (baseSchema instanceof z.ZodEnum) {
893
896
  paramType = "string";
894
- choices = baseSchema._def.values;
897
+ choices = baseSchema.options;
895
898
  } else if (baseSchema instanceof z.ZodRecord) {
896
899
  paramType = "string";
897
900
  }
@@ -1589,7 +1592,7 @@ var LoginSchema = z.object({
1589
1592
 
1590
1593
  // package.json
1591
1594
  var package_default = {
1592
- version: "0.15.13"};
1595
+ version: "0.16.0"};
1593
1596
 
1594
1597
  // src/telemetry/builders.ts
1595
1598
  function createCliBaseEvent(context = {}) {
@@ -2868,7 +2871,7 @@ function createZapierCliSdk(options = {}) {
2868
2871
  // package.json with { type: 'json' }
2869
2872
  var package_default2 = {
2870
2873
  name: "@zapier/zapier-sdk-cli",
2871
- version: "0.15.13"};
2874
+ version: "0.16.0"};
2872
2875
  function detectPackageManager(cwd = process.cwd()) {
2873
2876
  const ua = process.env.npm_config_user_agent;
2874
2877
  if (ua) {
package/dist/index.cjs CHANGED
@@ -291,7 +291,7 @@ var LoginSchema = zod.z.object({
291
291
 
292
292
  // package.json
293
293
  var package_default = {
294
- version: "0.15.13"};
294
+ version: "0.16.0"};
295
295
 
296
296
  // src/telemetry/builders.ts
297
297
  function createCliBaseEvent(context = {}) {
package/dist/index.d.mts CHANGED
@@ -2,18 +2,10 @@ import { AppItem, Manifest, GetSdkType, ZapierSdk, ZapierSdkOptions, BaseEvent }
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const BuildManifestSchema: z.ZodObject<{
5
- appKeys: z.ZodArray<z.ZodString, "many">;
5
+ appKeys: z.ZodArray<z.ZodString>;
6
6
  skipWrite: z.ZodOptional<z.ZodBoolean>;
7
7
  configPath: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- appKeys: string[];
10
- configPath?: string | undefined;
11
- skipWrite?: boolean | undefined;
12
- }, {
13
- appKeys: string[];
14
- configPath?: string | undefined;
15
- skipWrite?: boolean | undefined;
16
- }>;
8
+ }, z.core.$strip>;
17
9
  type BuildManifestOptions = z.infer<typeof BuildManifestSchema> & {
18
10
  onProgress?: (event: ManifestBuildProgressEvent) => void;
19
11
  };
@@ -64,21 +56,11 @@ interface BuildManifestPluginProvides {
64
56
  }
65
57
 
66
58
  declare const GenerateAppTypesSchema: z.ZodObject<{
67
- appKeys: z.ZodArray<z.ZodString, "many">;
68
- authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
59
+ appKeys: z.ZodArray<z.ZodString>;
60
+ authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
69
61
  skipWrite: z.ZodOptional<z.ZodBoolean>;
70
62
  typesOutputDirectory: z.ZodOptional<z.ZodString>;
71
- }, "strip", z.ZodTypeAny, {
72
- appKeys: string[];
73
- authenticationIds?: string[] | undefined;
74
- skipWrite?: boolean | undefined;
75
- typesOutputDirectory?: string | undefined;
76
- }, {
77
- appKeys: string[];
78
- authenticationIds?: string[] | undefined;
79
- skipWrite?: boolean | undefined;
80
- typesOutputDirectory?: string | undefined;
81
- }>;
63
+ }, z.core.$strip>;
82
64
  type GenerateAppTypesOptions = z.infer<typeof GenerateAppTypesSchema> & {
83
65
  onProgress?: (event: AppTypesProgressEvent) => void;
84
66
  };
package/dist/index.d.ts CHANGED
@@ -2,18 +2,10 @@ import { AppItem, Manifest, GetSdkType, ZapierSdk, ZapierSdkOptions, BaseEvent }
2
2
  import { z } from 'zod';
3
3
 
4
4
  declare const BuildManifestSchema: z.ZodObject<{
5
- appKeys: z.ZodArray<z.ZodString, "many">;
5
+ appKeys: z.ZodArray<z.ZodString>;
6
6
  skipWrite: z.ZodOptional<z.ZodBoolean>;
7
7
  configPath: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- appKeys: string[];
10
- configPath?: string | undefined;
11
- skipWrite?: boolean | undefined;
12
- }, {
13
- appKeys: string[];
14
- configPath?: string | undefined;
15
- skipWrite?: boolean | undefined;
16
- }>;
8
+ }, z.core.$strip>;
17
9
  type BuildManifestOptions = z.infer<typeof BuildManifestSchema> & {
18
10
  onProgress?: (event: ManifestBuildProgressEvent) => void;
19
11
  };
@@ -64,21 +56,11 @@ interface BuildManifestPluginProvides {
64
56
  }
65
57
 
66
58
  declare const GenerateAppTypesSchema: z.ZodObject<{
67
- appKeys: z.ZodArray<z.ZodString, "many">;
68
- authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
59
+ appKeys: z.ZodArray<z.ZodString>;
60
+ authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
69
61
  skipWrite: z.ZodOptional<z.ZodBoolean>;
70
62
  typesOutputDirectory: z.ZodOptional<z.ZodString>;
71
- }, "strip", z.ZodTypeAny, {
72
- appKeys: string[];
73
- authenticationIds?: string[] | undefined;
74
- skipWrite?: boolean | undefined;
75
- typesOutputDirectory?: string | undefined;
76
- }, {
77
- appKeys: string[];
78
- authenticationIds?: string[] | undefined;
79
- skipWrite?: boolean | undefined;
80
- typesOutputDirectory?: string | undefined;
81
- }>;
63
+ }, z.core.$strip>;
82
64
  type GenerateAppTypesOptions = z.infer<typeof GenerateAppTypesSchema> & {
83
65
  onProgress?: (event: AppTypesProgressEvent) => void;
84
66
  };
package/dist/index.mjs CHANGED
@@ -260,7 +260,7 @@ var LoginSchema = z.object({
260
260
 
261
261
  // package.json
262
262
  var package_default = {
263
- version: "0.15.13"};
263
+ version: "0.16.0"};
264
264
 
265
265
  // src/telemetry/builders.ts
266
266
  function createCliBaseEvent(context = {}) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zapier/zapier-sdk-cli",
3
- "version": "0.15.13",
3
+ "version": "0.16.0",
4
4
  "description": "Command line interface for Zapier SDK",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.mjs",
@@ -35,7 +35,7 @@
35
35
  "sdk"
36
36
  ],
37
37
  "author": "",
38
- "license": "ISC",
38
+ "license": "SEE LICENSE IN LICENSE",
39
39
  "publishConfig": {
40
40
  "access": "restricted"
41
41
  },
@@ -58,7 +58,7 @@
58
58
  "pkce-challenge": "^5.0.0",
59
59
  "semver": "^7.7.3",
60
60
  "typescript": "^5.8.3",
61
- "zod": "^3.25.67"
61
+ "zod": "4.2.1"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/express": "^5.0.3",
@@ -1,18 +1,8 @@
1
1
  import { z } from "zod";
2
2
  export declare const AddSchema: z.ZodObject<{
3
- appKeys: z.ZodArray<z.ZodString, "many">;
4
- authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
3
+ appKeys: z.ZodArray<z.ZodString>;
4
+ authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
5
5
  configPath: z.ZodOptional<z.ZodString>;
6
6
  typesOutput: z.ZodOptional<z.ZodString>;
7
- }, "strip", z.ZodTypeAny, {
8
- appKeys: string[];
9
- authenticationIds?: string[] | undefined;
10
- configPath?: string | undefined;
11
- typesOutput?: string | undefined;
12
- }, {
13
- appKeys: string[];
14
- authenticationIds?: string[] | undefined;
15
- configPath?: string | undefined;
16
- typesOutput?: string | undefined;
17
- }>;
7
+ }, z.core.$strip>;
18
8
  export type AddOptions = z.infer<typeof AddSchema>;
@@ -1,18 +1,10 @@
1
1
  import { z } from "zod";
2
2
  import type { AppItem, Manifest } from "@zapier/zapier-sdk";
3
3
  export declare const BuildManifestSchema: z.ZodObject<{
4
- appKeys: z.ZodArray<z.ZodString, "many">;
4
+ appKeys: z.ZodArray<z.ZodString>;
5
5
  skipWrite: z.ZodOptional<z.ZodBoolean>;
6
6
  configPath: z.ZodOptional<z.ZodString>;
7
- }, "strip", z.ZodTypeAny, {
8
- appKeys: string[];
9
- configPath?: string | undefined;
10
- skipWrite?: boolean | undefined;
11
- }, {
12
- appKeys: string[];
13
- configPath?: string | undefined;
14
- skipWrite?: boolean | undefined;
15
- }>;
7
+ }, z.core.$strip>;
16
8
  export type BuildManifestOptions = z.infer<typeof BuildManifestSchema> & {
17
9
  onProgress?: (event: ManifestBuildProgressEvent) => void;
18
10
  };
@@ -6,19 +6,5 @@ export declare const BundleCodeSchema: z.ZodObject<{
6
6
  minify: z.ZodOptional<z.ZodBoolean>;
7
7
  target: z.ZodOptional<z.ZodString>;
8
8
  cjs: z.ZodOptional<z.ZodBoolean>;
9
- }, "strip", z.ZodTypeAny, {
10
- input: string;
11
- string?: boolean | undefined;
12
- output?: string | undefined;
13
- minify?: boolean | undefined;
14
- target?: string | undefined;
15
- cjs?: boolean | undefined;
16
- }, {
17
- input: string;
18
- string?: boolean | undefined;
19
- output?: string | undefined;
20
- minify?: boolean | undefined;
21
- target?: string | undefined;
22
- cjs?: boolean | undefined;
23
- }>;
9
+ }, z.core.$strip>;
24
10
  export type BundleCodeOptions = z.infer<typeof BundleCodeSchema>;
@@ -1,21 +1,11 @@
1
1
  import { z } from "zod";
2
2
  import type { AppItem } from "@zapier/zapier-sdk";
3
3
  export declare const GenerateAppTypesSchema: z.ZodObject<{
4
- appKeys: z.ZodArray<z.ZodString, "many">;
5
- authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
4
+ appKeys: z.ZodArray<z.ZodString>;
5
+ authenticationIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
6
6
  skipWrite: z.ZodOptional<z.ZodBoolean>;
7
7
  typesOutputDirectory: z.ZodOptional<z.ZodString>;
8
- }, "strip", z.ZodTypeAny, {
9
- appKeys: string[];
10
- authenticationIds?: string[] | undefined;
11
- skipWrite?: boolean | undefined;
12
- typesOutputDirectory?: string | undefined;
13
- }, {
14
- appKeys: string[];
15
- authenticationIds?: string[] | undefined;
16
- skipWrite?: boolean | undefined;
17
- typesOutputDirectory?: string | undefined;
18
- }>;
8
+ }, z.core.$strip>;
19
9
  export type GenerateAppTypesOptions = z.infer<typeof GenerateAppTypesSchema> & {
20
10
  onProgress?: (event: AppTypesProgressEvent) => void;
21
11
  };
@@ -1,3 +1,3 @@
1
1
  import { z } from "zod";
2
- export declare const GetLoginConfigPathSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
2
+ export declare const GetLoginConfigPathSchema: z.ZodObject<{}, z.core.$strip>;
3
3
  export type GetLoginConfigPathOptions = z.infer<typeof GetLoginConfigPathSchema>;
@@ -1,9 +1,5 @@
1
1
  import { z } from "zod";
2
2
  export declare const LoginSchema: z.ZodObject<{
3
3
  timeout: z.ZodOptional<z.ZodString>;
4
- }, "strip", z.ZodTypeAny, {
5
- timeout?: string | undefined;
6
- }, {
7
- timeout?: string | undefined;
8
- }>;
4
+ }, z.core.$strip>;
9
5
  export type LoginOptions = z.infer<typeof LoginSchema>;
@@ -1,3 +1,3 @@
1
1
  import { z } from "zod";
2
- export declare const LogoutSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
2
+ export declare const LogoutSchema: z.ZodObject<{}, z.core.$strip>;
3
3
  export type LogoutOptions = z.infer<typeof LogoutSchema>;
@@ -1,9 +1,5 @@
1
1
  import { z } from "zod";
2
2
  export declare const McpSchema: z.ZodObject<{
3
3
  port: z.ZodOptional<z.ZodString>;
4
- }, "strip", z.ZodTypeAny, {
5
- port?: string | undefined;
6
- }, {
7
- port?: string | undefined;
8
- }>;
4
+ }, z.core.$strip>;
9
5
  export type McpOptions = z.infer<typeof McpSchema>;
@@ -23,12 +23,12 @@ function analyzeZodField(name, schema, functionInfo) {
23
23
  // Unwrap optional and default wrappers
24
24
  if (baseSchema instanceof z.ZodOptional) {
25
25
  required = false;
26
- baseSchema = baseSchema._def.innerType;
26
+ baseSchema = baseSchema._zod.def.innerType;
27
27
  }
28
28
  if (baseSchema instanceof z.ZodDefault) {
29
29
  required = false;
30
- defaultValue = baseSchema._def.defaultValue();
31
- baseSchema = baseSchema._def.innerType;
30
+ defaultValue = baseSchema._zod.def.defaultValue();
31
+ baseSchema = baseSchema._zod.def.innerType;
32
32
  }
33
33
  // Determine parameter type
34
34
  let paramType = "string";
@@ -47,7 +47,7 @@ function analyzeZodField(name, schema, functionInfo) {
47
47
  }
48
48
  else if (baseSchema instanceof z.ZodEnum) {
49
49
  paramType = "string";
50
- choices = baseSchema._def.values;
50
+ choices = baseSchema.options;
51
51
  }
52
52
  else if (baseSchema instanceof z.ZodRecord) {
53
53
  // Handle Record<string, any> as JSON string input
@@ -11,13 +11,10 @@ import { ZapierCliError, ZapierCliExitError } from "./errors";
11
11
  function analyzeZodSchema(schema, functionInfo) {
12
12
  const parameters = [];
13
13
  // Handle ZodEffects (schemas with .refine(), .transform(), etc.)
14
- if (schema._def &&
15
- schema._def.typeName ===
16
- "ZodEffects") {
17
- // Get the underlying schema
18
- const innerSchema = schema
19
- ._def.schema;
20
- return analyzeZodSchema(innerSchema, functionInfo);
14
+ // In Zod, effects have type "effect" and inner schema is accessed via innerType
15
+ const schemaDef = schema._zod?.def;
16
+ if (schemaDef?.type === "effect" && schemaDef.innerType) {
17
+ return analyzeZodSchema(schemaDef.innerType, functionInfo);
21
18
  }
22
19
  if (schema instanceof z.ZodObject) {
23
20
  const shape = schema.shape;
@@ -38,21 +35,22 @@ function analyzeZodField(name, schema, functionInfo) {
38
35
  while (true) {
39
36
  if (baseSchema instanceof z.ZodOptional) {
40
37
  required = false;
41
- baseSchema = baseSchema._def.innerType;
38
+ baseSchema = baseSchema._zod.def.innerType;
42
39
  }
43
40
  else if (baseSchema instanceof z.ZodDefault) {
44
41
  required = false;
45
- defaultValue = baseSchema._def.defaultValue();
46
- baseSchema = baseSchema._def.innerType;
47
- }
48
- else if (baseSchema._def &&
49
- baseSchema._def
50
- .typeName === "ZodNullable") {
51
- // nullable doesn't affect CLI required status, but we need to unwrap it to get the base type
52
- baseSchema = baseSchema._def.innerType;
42
+ defaultValue = baseSchema._zod.def.defaultValue();
43
+ baseSchema = baseSchema._zod.def.innerType;
53
44
  }
54
45
  else {
55
- break; // No more wrappers to unwrap
46
+ // Check for ZodNullable - nullable doesn't affect CLI required status, but we need to unwrap it to get the base type
47
+ const zodDef = baseSchema._zod?.def;
48
+ if (zodDef?.typeName === "ZodNullable" && zodDef.innerType) {
49
+ baseSchema = zodDef.innerType;
50
+ continue;
51
+ }
52
+ // No more wrappers to unwrap
53
+ break;
56
54
  }
57
55
  }
58
56
  // Determine parameter type
@@ -72,7 +70,7 @@ function analyzeZodField(name, schema, functionInfo) {
72
70
  }
73
71
  else if (baseSchema instanceof z.ZodEnum) {
74
72
  paramType = "string";
75
- choices = baseSchema._def.values;
73
+ choices = baseSchema.options;
76
74
  }
77
75
  else if (baseSchema instanceof z.ZodRecord) {
78
76
  // Handle Record<string, any> as JSON string input
@@ -234,11 +234,11 @@ export class SchemaParameterResolver {
234
234
  // Check if field is optional or has default
235
235
  if (baseSchema instanceof z.ZodOptional) {
236
236
  isRequired = false;
237
- baseSchema = baseSchema._def.innerType;
237
+ baseSchema = baseSchema._zod.def.innerType;
238
238
  }
239
239
  if (baseSchema instanceof z.ZodDefault) {
240
240
  isRequired = false;
241
- baseSchema = baseSchema._def.innerType;
241
+ baseSchema = baseSchema._zod.def.innerType;
242
242
  }
243
243
  return this.createResolvableParameter([fieldName], baseSchema, isRequired);
244
244
  }
@@ -3,11 +3,12 @@ import util from "util";
3
3
  // These functions are internal to SDK, implementing basic formatting fallback
4
4
  // TODO: Consider exposing these utilities or implementing proper CLI formatting
5
5
  function getFormatMetadata(schema) {
6
- return schema?._def
7
- ?.formatMeta;
6
+ return schema?._zod
7
+ ?.def?.formatMeta;
8
8
  }
9
9
  function getOutputSchema(schema) {
10
- return schema?._def?.outputSchema;
10
+ return schema?._zod?.def
11
+ ?.outputSchema;
11
12
  }
12
13
  // ============================================================================
13
14
  // JSON Formatting