Skip to content

Commit c10ee35

Browse files
authored
chore(deps): Update zod to v4.4.3 (#332)
1 parent d1c1c53 commit c10ee35

10 files changed

Lines changed: 84 additions & 71 deletions

File tree

packages/@cdktn/cli-core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"undici": "8.6.0",
5959
"xml-js": "1.6.11",
6060
"xstate": "4.38.3",
61-
"zod": "3.25.76"
61+
"zod": "4.4.3"
6262
},
6363
"lint-staged": {
6464
"src/**/*.{ts,tsx}": "tsc-files ambient.d.ts --noEmit"

packages/@cdktn/cli-core/src/lib/dependencies/package-manager.ts

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,15 +139,16 @@ const { GITHUB_API_TOKEN_CDKTF } = process.env;
139139
const npmListSchema = z
140140
.object({
141141
dependencies: z.record(
142+
z.string(),
142143
z
143144
.object({
144145
version: z.string(),
145146
})
146-
.nonstrict(),
147+
.loose(),
147148
),
148149
})
149-
.deepPartial()
150-
.nonstrict();
150+
.partial()
151+
.loose();
151152

152153
// {
153154
// "type": "tree",
@@ -173,13 +174,15 @@ const yarnListSchema = z
173174
.object({
174175
name: z.string(),
175176
})
176-
.nonstrict(),
177+
.partial()
178+
.loose(),
177179
),
178180
})
179-
.nonstrict(),
181+
.partial()
182+
.loose(),
180183
})
181-
.deepPartial()
182-
.nonstrict();
184+
.partial()
185+
.loose();
183186

184187
// [
185188
// {
@@ -188,7 +191,7 @@ const yarnListSchema = z
188191
// },
189192
// {
190193
const pipPackageSchema = z.array(
191-
z.object({ name: z.string(), version: z.string() }).nonstrict(),
194+
z.object({ name: z.string(), version: z.string() }).loose(),
192195
);
193196

194197
/**

packages/@cdktn/cli-core/src/lib/local-provider-constraints.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import * as z from "zod";
99

1010
const constraintsType = z.object({
1111
cdktf: z.string(),
12-
providers: z.record(z.string()),
12+
providers: z.record(z.string(), z.string()),
1313
});
1414

1515
export type Constraints = z.infer<typeof constraintsType>;

packages/@cdktn/cli-core/src/lib/models/schema.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const baseMessage = z
1919
"@module": z.string(),
2020
"@timestamp": z.string(),
2121
})
22-
.nonstrict();
22+
.loose();
2323

2424
const action = z.enum(["noop", "create", "read", "update", "delete"]);
2525
const change = z.object({
@@ -52,6 +52,7 @@ const changeSummary = baseMessage.extend({
5252
const outputs = baseMessage.extend({
5353
type: z.literal("outputs"),
5454
outputs: z.record(
55+
z.string(),
5556
z.object({
5657
sensitive: z.boolean(),
5758
type: z.string(),

packages/@cdktn/cli-core/src/lib/output.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const parseJsonOutputLine = (
9595
if (err instanceof z.ZodError) {
9696
logger.trace(
9797
`Error parsing line into schema: ${JSON.stringify(
98-
err.errors,
98+
err.issues,
9999
)} => ${line}`,
100100
);
101101
}

packages/@cdktn/cli-core/src/lib/terraform-json.ts

Lines changed: 45 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ const remote = z
77
organization: z.string(),
88
hostname: z.string().optional(),
99
token: z.string().optional(),
10-
workspaces: z.object({
11-
name: z.string().optional(),
12-
prefix: z.string().optional(),
13-
}),
10+
workspaces: z
11+
.object({
12+
name: z.string().optional(),
13+
prefix: z.string().optional(),
14+
})
15+
.partial(),
1416
})
15-
.deepPartial();
17+
.partial();
1618

1719
export const terraformJsonSchema = z
1820
.object({
@@ -24,39 +26,46 @@ export const terraformJsonSchema = z
2426
stackName: z.string(),
2527
backend: z.string(),
2628
})
27-
.nonstrict(),
28-
outputs: z.record(z.any()),
29+
.partial()
30+
.loose(),
31+
outputs: z.record(z.string(), z.any()),
32+
})
33+
.partial()
34+
.loose(),
35+
terraform: z
36+
.object({
37+
backend: z
38+
.object({
39+
// All other backends are here as well, but we don't read them right now
40+
remote,
41+
})
42+
.partial()
43+
.loose(),
44+
cloud: z
45+
.object({
46+
organization: z.string(),
47+
hostname: z.string().optional(),
48+
token: z.string().optional(),
49+
workspaces: z.union([
50+
z.object({ name: z.string() }),
51+
z.object({ tags: z.array(z.string()) }),
52+
]),
53+
})
54+
.partial()
55+
.loose(),
56+
required_providers: z.record(
57+
z.string(),
58+
z.object({ source: z.string(), version: z.string() }).loose(),
59+
),
60+
required_version: z.string(),
2961
})
30-
.nonstrict(),
31-
terraform: z.object({
32-
backend: z
33-
.object({
34-
// All other backends are here as well, but we don't read them right now
35-
remote,
36-
})
37-
.nonstrict(),
38-
cloud: z
39-
.object({
40-
organization: z.string(),
41-
hostname: z.string().optional(),
42-
token: z.string().optional(),
43-
workspaces: z.union([
44-
z.object({ name: z.string() }),
45-
z.object({ tags: z.array(z.string()) }),
46-
]),
47-
})
48-
.nonstrict(),
49-
required_providers: z.record(
50-
z.object({ source: z.string(), version: z.string() }).nonstrict(),
51-
),
52-
required_version: z.string(),
53-
}),
54-
data: z.record(z.any()),
55-
provider: z.record(z.any()),
56-
resource: z.record(z.any()),
62+
.partial(),
63+
data: z.record(z.string(), z.any()),
64+
provider: z.record(z.string(), z.any()),
65+
resource: z.record(z.string(), z.any()),
5766
})
58-
.deepPartial()
59-
.nonstrict();
67+
.partial()
68+
.loose();
6069

6170
export type TerraformStack = z.infer<typeof terraformJsonSchema>;
6271
export type TerraformJsonConfigBackendRemote = z.infer<typeof remote>;

packages/@cdktn/hcl2cdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"jsii-rosetta": "~5.9.0",
5252
"prettier": "2.8.8",
5353
"reserved-words": "0.1.2",
54-
"zod": "3.25.76"
54+
"zod": "4.4.3"
5555
},
5656
"devDependencies": {
5757
"@types/babel__generator": "7.27.0",

packages/@cdktn/hcl2cdk/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export async function getParsedHcl(hcl: string) {
7676
} catch (err) {
7777
throw new Error(`Error: HCL-JSON does not conform to schema. This is not expected, please file a bug under https://github.com/open-constructs/cdk-terrain/issues/new?assignees=&labels=bug%2C+new%2C+feature%2Fconvert&template=bug-report.yml&title=
7878
Please include this information:
79-
${JSON.stringify((err as z.ZodError).errors)}`);
79+
${JSON.stringify((err as z.ZodError).issues)}`);
8080
}
8181

8282
return plan;

packages/@cdktn/hcl2cdk/src/schema.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ const variableConfig = tfObject({
2828
});
2929
export type Variable = z.infer<typeof variableConfig>;
3030

31-
const providerConfig = z.array(z.record(z.any()));
31+
const providerConfig = z.array(z.record(z.string(), z.any()));
3232
export type Provider = z.infer<typeof providerConfig>;
3333

34-
const moduleConfig = z.array(z.object({ source: z.string() }).nonstrict());
34+
const moduleConfig = z.array(z.object({ source: z.string() }).loose());
3535
export type Module = z.infer<typeof moduleConfig>;
3636

37-
const resourceConfig = z.array(z.record(z.any()));
37+
const resourceConfig = z.array(z.record(z.string(), z.any()));
3838
export type Resource = z.infer<typeof resourceConfig>;
3939
export type Data = Resource;
4040

@@ -53,22 +53,22 @@ const providerSpecification = z.union([
5353
const terraformConfig = z
5454
.object({
5555
required_version: z.string(),
56-
required_providers: z.array(z.record(providerSpecification)),
57-
backend: z.record(z.array(z.record(z.any()))),
56+
required_providers: z.array(z.record(z.string(), providerSpecification)),
57+
backend: z.record(z.string(), z.array(z.record(z.string(), z.any()))),
5858
})
5959
.partial();
6060
export type TerraformConfig = z.infer<typeof terraformConfig>;
6161

6262
export const schema = z
6363
.object({
64-
data: z.record(z.record(resourceConfig)),
64+
data: z.record(z.string(), z.record(z.string(), resourceConfig)),
6565
import: z.array(importConfig),
66-
locals: z.array(z.record(z.any())),
67-
module: z.record(moduleConfig),
68-
output: z.record(outputConfig),
69-
provider: z.record(providerConfig),
70-
resource: z.record(z.record(resourceConfig)),
66+
locals: z.array(z.record(z.string(), z.any())),
67+
module: z.record(z.string(), moduleConfig),
68+
output: z.record(z.string(), outputConfig),
69+
provider: z.record(z.string(), providerConfig),
70+
resource: z.record(z.string(), z.record(z.string(), resourceConfig)),
7171
terraform: z.array(terraformConfig),
72-
variable: z.record(variableConfig),
72+
variable: z.record(z.string(), variableConfig),
7373
})
7474
.partial();

pnpm-lock.yaml

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)