diff --git a/packages/entities/entities-plugins/package.json b/packages/entities/entities-plugins/package.json index c3ce916e9c..5c9adf48bf 100644 --- a/packages/entities/entities-plugins/package.json +++ b/packages/entities/entities-plugins/package.json @@ -35,7 +35,7 @@ "monaco-editor": "^0.52.2", "vue": ">= 3.3.13 < 4", "vue-router": "^4.4.5", - "zod": "^4.0.17" + "zod": ">= 4.1.3 < 5" }, "devDependencies": { "@dagrejs/dagre": "^1.1.5", @@ -54,7 +54,7 @@ "monaco-editor": "^0.52.2", "vue": "^3.5.13", "vue-router": "^4.4.5", - "zod": "^4.0.17" + "zod": "^4.1.12" }, "scripts": { "dev": "cross-env USE_SANDBOX=true vite", diff --git a/packages/entities/entities-plugins/src/components/free-form/Datakit/schema/compat.ts b/packages/entities/entities-plugins/src/components/free-form/Datakit/schema/compat.ts index d1881c1d42..24a0ad99d8 100644 --- a/packages/entities/entities-plugins/src/components/free-form/Datakit/schema/compat.ts +++ b/packages/entities/entities-plugins/src/components/free-form/Datakit/schema/compat.ts @@ -71,7 +71,7 @@ const ConfigNodeBaseGuard = z } }) -const CallNodeSchema = ConfigNodeBaseSchema.extend({ +const CallNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('call'), method: HttpMethodSchema.nullish(), ssl_server_name: z.string().nullish(), @@ -95,7 +95,7 @@ const CallNodeSchema = ConfigNodeBaseSchema.extend({ .nullish(), }).strict() -const ExitNodeSchema = ConfigNodeBaseSchema.extend({ +const ExitNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('exit'), status: z.union([z.number(), z.string()]).nullish(), warn_headers_sent: z.boolean().nullish(), @@ -103,13 +103,13 @@ const ExitNodeSchema = ConfigNodeBaseSchema.extend({ outputs: z.never().optional(), }).strict() -const JqNodeSchema = ConfigNodeBaseSchema.extend({ +const JqNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('jq'), jq: z.string().nullish(), outputs: z.never().optional(), }).strict() -const PropertyNodeSchema = ConfigNodeBaseSchema.extend({ +const PropertyNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('property'), content_type: z.string().nullish(), property: z.string().nullish(), @@ -117,14 +117,14 @@ const PropertyNodeSchema = ConfigNodeBaseSchema.extend({ outputs: z.never().optional(), }).strict() -const StaticNodeSchema = ConfigNodeBaseSchema.extend({ +const StaticNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('static'), values: z.record(z.string(), z.unknown()).nullish(), input: z.never().optional(), inputs: z.never().optional(), }).strict() -const CacheNodeSchema = ConfigNodeBaseSchema.extend({ +const CacheNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('cache'), bypass_on_error: z.boolean().nullish(), inputs: z @@ -152,7 +152,7 @@ const CacheNodeSchema = ConfigNodeBaseSchema.extend({ * Supports conditional execution with `then` and `else` branches. * Each branch contains an array of node names to execute. */ -export const BranchNodeSchema = ConfigNodeBaseSchema.extend({ +export const BranchNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('branch'), then: z.array(LooseNodeNameSchema).nullish(), else: z.array(LooseNodeNameSchema).nullish(), diff --git a/packages/entities/entities-plugins/src/components/free-form/Datakit/schema/strict.ts b/packages/entities/entities-plugins/src/components/free-form/Datakit/schema/strict.ts index a3e19803c1..a34ec1a428 100644 --- a/packages/entities/entities-plugins/src/components/free-form/Datakit/schema/strict.ts +++ b/packages/entities/entities-plugins/src/components/free-form/Datakit/schema/strict.ts @@ -114,7 +114,7 @@ export const ConfigNodeBaseGuard = z } }) -export const CallNodeSchema = ConfigNodeBaseSchema.extend({ +export const CallNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('call'), /** * A string representing an HTTP method, such as GET, POST, PUT, or DELETE. @@ -154,7 +154,7 @@ export const CallNodeSchema = ConfigNodeBaseSchema.extend({ /** Make an external HTTP request. */ export type CallNode = z.infer -export const ExitNodeSchema = ConfigNodeBaseSchema.extend({ +export const ExitNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('exit'), /** * HTTP status code. @@ -170,7 +170,7 @@ export const ExitNodeSchema = ConfigNodeBaseSchema.extend({ /** Terminate the request and send a response to the client. */ export type ExitNode = z.infer -export const JqNodeSchema = ConfigNodeBaseSchema.extend({ +export const JqNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('jq'), /** * The jq filter text. Refer to https://jqlang.org/manual/ for full documentation. @@ -183,7 +183,7 @@ export const JqNodeSchema = ConfigNodeBaseSchema.extend({ /** Process data using `jq` syntax. */ export type JqNode = z.infer -export const PropertyNodeSchema = ConfigNodeBaseSchema.extend({ +export const PropertyNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('property'), /** * The expected MIME type of the property value. When set to `application/json`, @@ -202,7 +202,7 @@ export const PropertyNodeSchema = ConfigNodeBaseSchema.extend({ /** Get or set a property. */ export type PropertyNode = z.infer -export const StaticNodeSchema = ConfigNodeBaseSchema.extend({ +export const StaticNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('static'), /** An object with string keys and free-form values. */ values: z.record(z.string(), z.unknown()), @@ -213,7 +213,7 @@ export const StaticNodeSchema = ConfigNodeBaseSchema.extend({ /** Produce reusable outputs from statically-configured values. */ export type StaticNode = z.infer -export const CacheNodeSchema = ConfigNodeBaseSchema.extend({ +export const CacheNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('cache'), /** When true, skip cache errors and continue execution. */ bypass_on_error: z.boolean().nullish(), @@ -241,7 +241,7 @@ export const CacheNodeSchema = ConfigNodeBaseSchema.extend({ /** Fetch data from configured cache resources. */ export type CacheNode = z.infer -export const BranchNodeSchema = ConfigNodeBaseSchema.extend({ +export const BranchNodeSchema = ConfigNodeBaseSchema.safeExtend({ type: z.literal('branch'), then: z.array(NodeNameSchema).nullish(), else: z.array(NodeNameSchema).nullish(), diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c389004da5..351b244d54 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -988,8 +988,8 @@ importers: specifier: ^4.4.5 version: 4.5.1(vue@3.5.18(typescript@5.9.2)) zod: - specifier: ^4.0.17 - version: 4.0.17 + specifier: ^4.1.12 + version: 4.1.12 packages/entities/entities-plugins-icon: devDependencies: @@ -8136,7 +8136,7 @@ packages: right-pad@1.0.1: resolution: {integrity: sha512-bYBjgxmkvTAfgIYy328fmkwhp39v8lwVgWhhrzxPV3yHtcSqyYKe9/XOhvW48UFjATg3VuJbpsp5822ACNvkmw==} engines: {node: '>= 0.10'} - deprecated: Use String.prototype.padEnd() instead + deprecated: Please use String.prototype.padEnd() over this package. rimraf@2.7.1: resolution: {integrity: sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==} @@ -9900,8 +9900,8 @@ packages: zenscroll@4.0.2: resolution: {integrity: sha512-jEA1znR7b4C/NnaycInCU6h/d15ZzCd1jmsruqOKnZP6WXQSMH3W2GL+OXbkruslU4h+Tzuos0HdswzRUk/Vgg==} - zod@4.0.17: - resolution: {integrity: sha512-1PHjlYRevNxxdy2JZ8JcNAw7rX8V9P1AKkP+x/xZfxB0K5FYfuV+Ug6P/6NVSR2jHQ+FzDDoDHS04nYUsOIyLQ==} + zod@4.1.12: + resolution: {integrity: sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ==} snapshots: @@ -20030,4 +20030,4 @@ snapshots: zenscroll@4.0.2: {} - zod@4.0.17: {} + zod@4.1.12: {}