@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/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",
@@ -26,7 +26,7 @@
26
26
  "sdk"
27
27
  ],
28
28
  "author": "",
29
- "license": "ISC",
29
+ "license": "SEE LICENSE IN LICENSE",
30
30
  "publishConfig": {
31
31
  "access": "restricted"
32
32
  },
@@ -46,10 +46,10 @@
46
46
  "pkce-challenge": "^5.0.0",
47
47
  "semver": "^7.7.3",
48
48
  "typescript": "^5.8.3",
49
- "zod": "^3.25.67",
50
- "@zapier/zapier-sdk": "0.15.12",
51
- "@zapier/zapier-sdk-cli-login": "0.3.4",
52
- "@zapier/zapier-sdk-mcp": "0.3.38"
49
+ "zod": "4.2.1",
50
+ "@zapier/zapier-sdk-mcp": "0.4.0",
51
+ "@zapier/zapier-sdk-cli-login": "0.3.5",
52
+ "@zapier/zapier-sdk": "0.16.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "@types/express": "^5.0.3",
@@ -52,13 +52,13 @@ function analyzeZodField(
52
52
  // Unwrap optional and default wrappers
53
53
  if (baseSchema instanceof z.ZodOptional) {
54
54
  required = false;
55
- baseSchema = baseSchema._def.innerType;
55
+ baseSchema = baseSchema._zod.def.innerType as z.ZodSchema;
56
56
  }
57
57
 
58
58
  if (baseSchema instanceof z.ZodDefault) {
59
59
  required = false;
60
- defaultValue = baseSchema._def.defaultValue();
61
- baseSchema = baseSchema._def.innerType;
60
+ defaultValue = (baseSchema._zod.def.defaultValue as () => unknown)();
61
+ baseSchema = baseSchema._zod.def.innerType as z.ZodSchema;
62
62
  }
63
63
 
64
64
  // Determine parameter type
@@ -75,7 +75,7 @@ function analyzeZodField(
75
75
  paramType = "array";
76
76
  } else if (baseSchema instanceof z.ZodEnum) {
77
77
  paramType = "string";
78
- choices = baseSchema._def.values;
78
+ choices = baseSchema.options as string[];
79
79
  } else if (baseSchema instanceof z.ZodRecord) {
80
80
  // Handle Record<string, any> as JSON string input
81
81
  paramType = "string";
@@ -45,15 +45,14 @@ function analyzeZodSchema(
45
45
  const parameters: CliParameter[] = [];
46
46
 
47
47
  // Handle ZodEffects (schemas with .refine(), .transform(), etc.)
48
- if (
49
- (schema as unknown as { _def?: { typeName?: string } })._def &&
50
- (schema as unknown as { _def: { typeName: string } })._def.typeName ===
51
- "ZodEffects"
52
- ) {
53
- // Get the underlying schema
54
- const innerSchema = (schema as unknown as { _def: { schema: z.ZodSchema } })
55
- ._def.schema;
56
- return analyzeZodSchema(innerSchema, functionInfo);
48
+ // In Zod, effects have type "effect" and inner schema is accessed via innerType
49
+ const schemaDef = (
50
+ schema as unknown as {
51
+ _zod?: { def?: { type?: string; innerType?: z.ZodSchema } };
52
+ }
53
+ )._zod?.def;
54
+ if (schemaDef?.type === "effect" && schemaDef.innerType) {
55
+ return analyzeZodSchema(schemaDef.innerType, functionInfo);
57
56
  }
58
57
 
59
58
  if (schema instanceof z.ZodObject) {
@@ -87,26 +86,26 @@ function analyzeZodField(
87
86
  while (true) {
88
87
  if (baseSchema instanceof z.ZodOptional) {
89
88
  required = false;
90
- baseSchema = baseSchema._def.innerType;
89
+ baseSchema = baseSchema._zod.def.innerType as z.ZodSchema;
91
90
  } else if (baseSchema instanceof z.ZodDefault) {
92
91
  required = false;
93
- defaultValue = baseSchema._def.defaultValue();
94
- baseSchema = baseSchema._def.innerType;
95
- } else if (
96
- (
92
+ defaultValue = (baseSchema._zod.def.defaultValue as () => unknown)();
93
+ baseSchema = baseSchema._zod.def.innerType as z.ZodSchema;
94
+ } else {
95
+ // Check for ZodNullable - nullable doesn't affect CLI required status, but we need to unwrap it to get the base type
96
+ const zodDef = (
97
97
  baseSchema as unknown as {
98
- _def?: { typeName?: string; innerType?: z.ZodSchema };
98
+ _zod?: { def?: { typeName?: string; innerType?: z.ZodSchema } };
99
99
  }
100
- )._def &&
101
- (baseSchema as unknown as { _def: { typeName: string } })._def
102
- .typeName === "ZodNullable"
103
- ) {
104
- // nullable doesn't affect CLI required status, but we need to unwrap it to get the base type
105
- baseSchema = (
106
- baseSchema as unknown as { _def: { innerType: z.ZodSchema } }
107
- )._def.innerType;
108
- } else {
109
- break; // No more wrappers to unwrap
100
+ )._zod?.def;
101
+
102
+ if (zodDef?.typeName === "ZodNullable" && zodDef.innerType) {
103
+ baseSchema = zodDef.innerType;
104
+ continue;
105
+ }
106
+
107
+ // No more wrappers to unwrap
108
+ break;
110
109
  }
111
110
  }
112
111
 
@@ -124,7 +123,7 @@ function analyzeZodField(
124
123
  paramType = "array";
125
124
  } else if (baseSchema instanceof z.ZodEnum) {
126
125
  paramType = "string";
127
- choices = baseSchema._def.values;
126
+ choices = baseSchema.options as string[];
128
127
  } else if (baseSchema instanceof z.ZodRecord) {
129
128
  // Handle Record<string, any> as JSON string input
130
129
  paramType = "string";
@@ -364,12 +364,12 @@ export class SchemaParameterResolver {
364
364
  // Check if field is optional or has default
365
365
  if (baseSchema instanceof z.ZodOptional) {
366
366
  isRequired = false;
367
- baseSchema = baseSchema._def.innerType;
367
+ baseSchema = baseSchema._zod.def.innerType as z.ZodSchema;
368
368
  }
369
369
 
370
370
  if (baseSchema instanceof z.ZodDefault) {
371
371
  isRequired = false;
372
- baseSchema = baseSchema._def.innerType;
372
+ baseSchema = baseSchema._zod.def.innerType as z.ZodSchema;
373
373
  }
374
374
 
375
375
  return this.createResolvableParameter([fieldName], baseSchema, isRequired);
@@ -6,12 +6,13 @@ import type { FormattedItem, FormatMetadata } from "@zapier/zapier-sdk";
6
6
  // TODO: Consider exposing these utilities or implementing proper CLI formatting
7
7
 
8
8
  function getFormatMetadata(schema: unknown): FormatMetadata | undefined {
9
- return (schema as { _def?: { formatMeta?: FormatMetadata } })?._def
10
- ?.formatMeta;
9
+ return (schema as { _zod?: { def?: { formatMeta?: FormatMetadata } } })?._zod
10
+ ?.def?.formatMeta;
11
11
  }
12
12
 
13
13
  function getOutputSchema(schema: unknown): unknown {
14
- return (schema as { _def?: { outputSchema?: unknown } })?._def?.outputSchema;
14
+ return (schema as { _zod?: { def?: { outputSchema?: unknown } } })?._zod?.def
15
+ ?.outputSchema;
15
16
  }
16
17
 
17
18
  // ============================================================================