@shotstack/schemas 1.3.4 → 1.3.6

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.
@@ -21,9 +21,9 @@ export const uploadRootSchema = z.unknown();
21
21
  */
22
22
  export const captionpropertiesCaptionBackgroundSchema = z.object({
23
23
  color: z.optional(z.string()),
24
- opacity: z.optional(z.number()),
25
- padding: z.optional(z.int()),
26
- borderRadius: z.optional(z.int()),
24
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
25
+ padding: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
26
+ borderRadius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
27
27
  });
28
28
  export const captionBackgroundSchema = captionpropertiesCaptionBackgroundSchema;
29
29
  /**
@@ -32,20 +32,20 @@ export const captionBackgroundSchema = captionpropertiesCaptionBackgroundSchema;
32
32
  export const captionpropertiesCaptionFontSchema = z.object({
33
33
  family: z.optional(z.string()),
34
34
  color: z.optional(z.string()),
35
- opacity: z.optional(z.number()),
36
- size: z.optional(z.int()),
37
- lineHeight: z.optional(z.number()),
35
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
36
+ size: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
37
+ lineHeight: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
38
38
  stroke: z.optional(z.string()),
39
- strokeWidth: z.optional(z.number()),
39
+ strokeWidth: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
40
40
  });
41
41
  export const captionFontSchema = captionpropertiesCaptionFontSchema;
42
42
  /**
43
43
  * The margin properties for captions. Margins are used to position the caption text and background on the screen.
44
44
  */
45
45
  export const captionpropertiesCaptionMarginSchema = z.object({
46
- top: z.optional(z.number()),
47
- left: z.optional(z.number()),
48
- right: z.optional(z.number()),
46
+ top: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
47
+ left: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
48
+ right: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
49
49
  });
50
50
  export const captionMarginSchema = captionpropertiesCaptionMarginSchema;
51
51
  /**
@@ -66,8 +66,8 @@ export const captionassetCaptionAssetSchema = z.object({
66
66
  font: z.optional(captionpropertiesCaptionFontSchema),
67
67
  background: z.optional(captionpropertiesCaptionBackgroundSchema),
68
68
  margin: z.optional(captionpropertiesCaptionMarginSchema),
69
- trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
70
- speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
69
+ trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()))),
70
+ speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10)))),
71
71
  });
72
72
  export const captionAssetSchema = captionassetCaptionAssetSchema;
73
73
  /**
@@ -75,8 +75,8 @@ export const captionAssetSchema = captionassetCaptionAssetSchema;
75
75
  */
76
76
  export const chromakeyChromaKeySchema = z.object({
77
77
  color: z.optional(z.string()),
78
- threshold: z.optional(z.int().gte(0).lte(250)),
79
- halo: z.optional(z.int().gte(0).lte(250)),
78
+ threshold: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(0).lte(250))),
79
+ halo: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(0).lte(250))),
80
80
  });
81
81
  export const chromaKeySchema = chromakeyChromaKeySchema;
82
82
  /**
@@ -378,8 +378,8 @@ export const generatedAssetResponseSchema = generatedAssetResponseGeneratedAsset
378
378
  export const shotstackImageToVideoOptionsShotstackImageToVideoOptionsSchema = z.object({
379
379
  type: z.enum(["image-to-video"]),
380
380
  imageUrl: z.string(),
381
- guidanceScale: z.optional(z.number()).default(1.8),
382
- motion: z.optional(z.int()).default(127),
381
+ guidanceScale: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(1.8),
382
+ motion: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())).default(127),
383
383
  });
384
384
  export const shotstackImageToVideoOptionsSchema = shotstackImageToVideoOptionsShotstackImageToVideoOptionsSchema;
385
385
  /**
@@ -396,8 +396,8 @@ export const shotstackTextGeneratorOptionsSchema = shotstackTextGeneratorOptions
396
396
  export const shotstackTextToImageOptionsShotstackTextToImageOptionsSchema = z.object({
397
397
  type: z.enum(["text-to-image"]),
398
398
  prompt: z.string(),
399
- width: z.int(),
400
- height: z.int(),
399
+ width: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
400
+ height: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
401
401
  });
402
402
  export const shotstackTextToImageOptionsSchema = shotstackTextToImageOptionsShotstackTextToImageOptionsSchema;
403
403
  /**
@@ -546,11 +546,11 @@ export const stabilityAiTextToImageOptionsStabilityAiTextToImageOptionsSchema =
546
546
  "stable-diffusion-512-v2-1",
547
547
  "stable-diffusion-xl-beta-v2-2-2",
548
548
  ])),
549
- width: z.int(),
550
- height: z.int(),
551
- steps: z.optional(z.int()).default(30),
552
- seed: z.optional(z.int()).default(0),
553
- cfgScale: z.optional(z.number()).default(7),
549
+ width: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
550
+ height: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
551
+ steps: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())).default(30),
552
+ seed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())).default(0),
553
+ cfgScale: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(7),
554
554
  stylePreset: z.optional(z.enum([
555
555
  "3d-model",
556
556
  "analog-film",
@@ -633,10 +633,10 @@ export const generatedAssetSchema = generatedAssetGeneratedAssetSchema;
633
633
  * Crop the sides of an asset by a relative amount. The size of the crop is specified using a scale between 0 and 1, relative to the screen width - i.e a left crop of 0.5 will crop half of the asset from the left, a top crop of 0.25 will crop the top by quarter of the asset.
634
634
  */
635
635
  export const cropCropSchema = z.object({
636
- top: z.optional(z.number().gte(0).lte(1)),
637
- bottom: z.optional(z.number().gte(0).lte(1)),
638
- left: z.optional(z.number().gte(0).lte(1)),
639
- right: z.optional(z.number().gte(0).lte(1)),
636
+ top: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))),
637
+ bottom: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))),
638
+ left: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))),
639
+ right: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))),
640
640
  });
641
641
  export const cropSchema = cropCropSchema;
642
642
  /**
@@ -831,8 +831,8 @@ export const htmlassetHtmlAssetSchema = z.object({
831
831
  type: z.enum(["html"]),
832
832
  html: z.string(),
833
833
  css: z.optional(z.string()),
834
- width: z.optional(z.int()),
835
- height: z.optional(z.int()),
834
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
835
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
836
836
  background: z.optional(z.string()),
837
837
  position: z.optional(z.enum([
838
838
  "top",
@@ -864,7 +864,7 @@ export const imagetovideoassetImageToVideoAssetSchema = z.object({
864
864
  src: z.optional(z.string()),
865
865
  prompt: z.optional(z.string()),
866
866
  aspectRatio: z.optional(z.enum(["1:1", "4:3", "16:9", "9:16", "3:4", "21:9", "9:21"])),
867
- speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
867
+ speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10)))),
868
868
  crop: z.optional(cropCropSchema),
869
869
  });
870
870
  export const imageToVideoAssetSchema = imagetovideoassetImageToVideoAssetSchema;
@@ -972,7 +972,7 @@ export const uploadResponseSchema = uploadresponseUploadResponseSchema;
972
972
  * Set the playback speed of a video or audio file. Allows you to preserve the pitch of the audio so that it is sped up without sounding too high pitched or too low.
973
973
  */
974
974
  export const speedSpeedSchema = z.object({
975
- speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
975
+ speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10)))),
976
976
  preservePitch: z.optional(z.boolean()),
977
977
  });
978
978
  export const speedSchema = speedSpeedSchema;
@@ -989,7 +989,7 @@ export const transcriptionSchema = transcriptionTranscriptionSchema;
989
989
  export const lumaassetLumaAssetSchema = z.object({
990
990
  type: z.enum(["luma"]),
991
991
  src: z.string(),
992
- trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
992
+ trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()))),
993
993
  });
994
994
  export const lumaAssetSchema = lumaassetLumaAssetSchema;
995
995
  /**
@@ -1004,15 +1004,15 @@ export const mergeFieldSchema = mergefieldMergeFieldSchema;
1004
1004
  * Generate a poster image for the video at a specific point from the timeline. The poster image size will match the size of the output video.
1005
1005
  */
1006
1006
  export const posterPosterSchema = z.object({
1007
- capture: z.number(),
1007
+ capture: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()),
1008
1008
  });
1009
1009
  export const posterSchema = posterPosterSchema;
1010
1010
  /**
1011
1011
  * Specify a time range to render, i.e. to render only a portion of a video or audio file. Omit this setting to export the entire video. Range can also be used to render a frame at a specific time point - setting a range and output format as `jpg` will output a single frame image at the range `start` point.
1012
1012
  */
1013
1013
  export const rangeRangeSchema = z.object({
1014
- start: z.optional(z.number().gte(0)),
1015
- length: z.optional(z.number().gte(0)),
1014
+ start: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))),
1015
+ length: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))),
1016
1016
  });
1017
1017
  export const rangeSchema = rangeRangeSchema;
1018
1018
  /**
@@ -1143,8 +1143,8 @@ export const richtextpropertiesRichTextAnimationSchema = z.object({
1143
1143
  "shift",
1144
1144
  "movingLetters",
1145
1145
  ]),
1146
- speed: z.optional(z.number().gte(0.1).lte(10)).default(1),
1147
- duration: z.optional(z.number().gte(0.1).lte(30)),
1146
+ speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0.1).lte(10))).default(1),
1147
+ duration: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0.1).lte(30))),
1148
1148
  style: z.optional(z.enum(["character", "word"])),
1149
1149
  direction: z.optional(z.enum(["left", "right", "up", "down"])),
1150
1150
  });
@@ -1154,28 +1154,28 @@ export const richTextAnimationSchema = richtextpropertiesRichTextAnimationSchema
1154
1154
  */
1155
1155
  export const richtextpropertiesRichTextBackgroundSchema = z.object({
1156
1156
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)),
1157
- opacity: z.optional(z.number().gte(0).lte(1)).default(1),
1158
- borderRadius: z.optional(z.number().gte(0)).default(0),
1157
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1158
+ borderRadius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1159
1159
  });
1160
1160
  export const richTextBackgroundSchema = richtextpropertiesRichTextBackgroundSchema;
1161
1161
  /**
1162
1162
  * Border styling properties for the text bounding box.
1163
1163
  */
1164
1164
  export const richtextpropertiesRichTextBorderSchema = z.object({
1165
- width: z.optional(z.number().gte(0)).default(0),
1165
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1166
1166
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#000000"),
1167
- opacity: z.optional(z.number().gte(0).lte(1)).default(1),
1168
- radius: z.optional(z.number().gte(0)).default(0),
1167
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1168
+ radius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1169
1169
  });
1170
1170
  /**
1171
1171
  * Gradient properties for text fill.
1172
1172
  */
1173
1173
  export const richtextpropertiesRichTextGradientSchema = z.object({
1174
1174
  type: z.optional(z.enum(["linear", "radial"])),
1175
- angle: z.optional(z.number().gte(0).lte(360)).default(0),
1175
+ angle: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(360))).default(0),
1176
1176
  stops: z
1177
1177
  .array(z.object({
1178
- offset: z.number().gte(0).lte(1),
1178
+ offset: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1)),
1179
1179
  color: z.string().regex(/^#[A-Fa-f0-9]{6}$/),
1180
1180
  }))
1181
1181
  .min(2),
@@ -1185,29 +1185,29 @@ export const richTextGradientSchema = richtextpropertiesRichTextGradientSchema;
1185
1185
  * Padding properties for individual sides of the text bounding box.
1186
1186
  */
1187
1187
  export const richtextpropertiesRichTextPaddingSchema = z.object({
1188
- top: z.optional(z.number().gte(0)).default(0),
1189
- right: z.optional(z.number().gte(0)).default(0),
1190
- bottom: z.optional(z.number().gte(0)).default(0),
1191
- left: z.optional(z.number().gte(0)).default(0),
1188
+ top: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1189
+ right: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1190
+ bottom: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1191
+ left: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1192
1192
  });
1193
1193
  /**
1194
1194
  * Text shadow properties.
1195
1195
  */
1196
1196
  export const richtextpropertiesRichTextShadowSchema = z.object({
1197
- offsetX: z.optional(z.number()).default(0),
1198
- offsetY: z.optional(z.number()).default(0),
1199
- blur: z.optional(z.number().gte(0)).default(0),
1197
+ offsetX: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1198
+ offsetY: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1199
+ blur: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1200
1200
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#000000"),
1201
- opacity: z.optional(z.number().gte(0).lte(1)).default(0.5),
1201
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(0.5),
1202
1202
  });
1203
1203
  export const richTextShadowSchema = richtextpropertiesRichTextShadowSchema;
1204
1204
  /**
1205
1205
  * Text stroke (outline) properties.
1206
1206
  */
1207
1207
  export const richtextpropertiesRichTextStrokeSchema = z.object({
1208
- width: z.optional(z.number().gte(0)).default(0),
1208
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1209
1209
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#000000"),
1210
- opacity: z.optional(z.number().gte(0).lte(1)).default(1),
1210
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1211
1211
  });
1212
1212
  export const richTextStrokeSchema = richtextpropertiesRichTextStrokeSchema;
1213
1213
  /**
@@ -1215,11 +1215,11 @@ export const richTextStrokeSchema = richtextpropertiesRichTextStrokeSchema;
1215
1215
  */
1216
1216
  export const richtextpropertiesRichTextFontSchema = z.object({
1217
1217
  family: z.optional(z.string()).default("Open Sans"),
1218
- size: z.optional(z.int().gte(1).lte(500)).default(24),
1218
+ size: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(500))).default(24),
1219
1219
  weight: z.optional(z.unknown()).default("400"),
1220
- style: z.optional(z.enum(["normal", "italic", "oblique"])),
1221
1220
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#ffffff"),
1222
- opacity: z.optional(z.number().gte(0).lte(1)).default(1),
1221
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1222
+ background: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)),
1223
1223
  stroke: z.optional(richtextpropertiesRichTextStrokeSchema),
1224
1224
  });
1225
1225
  export const richTextFontSchema = richtextpropertiesRichTextFontSchema;
@@ -1227,8 +1227,8 @@ export const richTextFontSchema = richtextpropertiesRichTextFontSchema;
1227
1227
  * Text style properties including spacing, line height, and transformations.
1228
1228
  */
1229
1229
  export const richtextpropertiesRichTextStyleSchema = z.object({
1230
- letterSpacing: z.optional(z.number()).default(0),
1231
- lineHeight: z.optional(z.number().gte(0).lte(10)).default(1.2),
1230
+ letterSpacing: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1231
+ lineHeight: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))).default(1.2),
1232
1232
  textTransform: z.optional(z.enum(["none", "uppercase", "lowercase", "capitalize"])),
1233
1233
  textDecoration: z.optional(z.enum(["none", "underline", "line-through"])),
1234
1234
  gradient: z.optional(richtextpropertiesRichTextGradientSchema),
@@ -1247,7 +1247,7 @@ export const richtextassetRichTextAssetSchema = z.object({
1247
1247
  shadow: z.optional(richtextpropertiesRichTextShadowSchema),
1248
1248
  background: z.optional(richtextpropertiesRichTextBackgroundSchema),
1249
1249
  border: z.optional(richtextpropertiesRichTextBorderSchema),
1250
- padding: z.optional(z.union([z.number().gte(0), richtextpropertiesRichTextPaddingSchema])),
1250
+ padding: z.optional(z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0)), richtextpropertiesRichTextPaddingSchema])),
1251
1251
  align: z.optional(richtextpropertiesRichTextAlignmentSchema),
1252
1252
  animation: z.optional(richtextpropertiesRichTextAnimationSchema),
1253
1253
  });
@@ -1294,27 +1294,27 @@ export const transferSchema = transferTransferSchema;
1294
1294
  export const shapeassetShapeAssetSchema = z.object({
1295
1295
  type: z.enum(["shape"]),
1296
1296
  shape: z.enum(["rectangle", "circle", "line"]),
1297
- width: z.optional(z.int()),
1298
- height: z.optional(z.int()),
1297
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1298
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1299
1299
  fill: z.optional(z.object({
1300
1300
  color: z.optional(z.string()),
1301
- opacity: z.optional(z.number()),
1301
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1302
1302
  })),
1303
1303
  stroke: z.optional(z.object({
1304
1304
  color: z.optional(z.string()),
1305
- width: z.optional(z.number()),
1305
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1306
1306
  })),
1307
1307
  rectangle: z.optional(z.object({
1308
- width: z.int(),
1309
- height: z.int(),
1310
- cornerRadius: z.optional(z.int()),
1308
+ width: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
1309
+ height: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
1310
+ cornerRadius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1311
1311
  })),
1312
1312
  circle: z.optional(z.object({
1313
- radius: z.int(),
1313
+ radius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
1314
1314
  })),
1315
1315
  line: z.optional(z.object({
1316
- length: z.int(),
1317
- thickness: z.int(),
1316
+ length: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
1317
+ thickness: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
1318
1318
  })),
1319
1319
  });
1320
1320
  export const shapeAssetSchema = shapeassetShapeAssetSchema;
@@ -1322,8 +1322,8 @@ export const shapeAssetSchema = shapeassetShapeAssetSchema;
1322
1322
  * Set a custom size for a video or image in pixels. When using a custom size omit the `resolution` and `aspectRatio`. Custom sizes must be divisible by 2 based on the encoder specifications.
1323
1323
  */
1324
1324
  export const sizeSizeSchema = z.object({
1325
- width: z.optional(z.int().gte(1).lte(4096)),
1326
- height: z.optional(z.int().gte(1).lte(4096)),
1325
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(4096))),
1326
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(4096))),
1327
1327
  });
1328
1328
  export const sizeSchema = sizeSizeSchema;
1329
1329
  /**
@@ -1350,7 +1350,7 @@ export const renditionRenditionSchema = z.object({
1350
1350
  size: z.optional(sizeSizeSchema),
1351
1351
  fit: z.optional(z.enum(["cover", "contain", "crop"])),
1352
1352
  resolution: z.optional(z.enum(["preview", "mobile", "sd", "hd", "fhd"])),
1353
- quality: z.optional(z.int().gte(1).lte(100)),
1353
+ quality: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(100))),
1354
1354
  fps: z.optional(z.union([
1355
1355
  z.literal(12),
1356
1356
  z.literal(15),
@@ -1365,7 +1365,7 @@ export const renditionRenditionSchema = z.object({
1365
1365
  z.literal(60),
1366
1366
  ])),
1367
1367
  speed: z.optional(speedSpeedSchema),
1368
- keyframeInterval: z.optional(z.int().gte(1).lte(300)),
1368
+ keyframeInterval: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(300))),
1369
1369
  fixOffset: z.optional(z.boolean()),
1370
1370
  fixRotation: z.optional(z.boolean()),
1371
1371
  enhance: z.optional(enhancementsEnhancementsSchema),
@@ -1394,12 +1394,12 @@ export const renditionresponseattributesRenditionResponseAttributesSchema = z.ob
1394
1394
  "overwritten",
1395
1395
  ])),
1396
1396
  url: z.optional(z.string()),
1397
- executionTime: z.optional(z.number()),
1397
+ executionTime: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1398
1398
  transformation: z.optional(renditionRenditionSchema),
1399
- width: z.optional(z.int()),
1400
- height: z.optional(z.int()),
1401
- duration: z.optional(z.number()),
1402
- fps: z.optional(z.number()),
1399
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1400
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1401
+ duration: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1402
+ fps: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1403
1403
  });
1404
1404
  export const renditionResponseAttributesSchema = renditionresponseattributesRenditionResponseAttributesSchema;
1405
1405
  /**
@@ -1419,10 +1419,10 @@ export const sourceresponseattributesSourceResponseAttributesSchema = z.object({
1419
1419
  source: z.optional(z.string()),
1420
1420
  status: z.optional(z.enum(["queued", "importing", "ready", "failed", "deleted", "overwritten"])),
1421
1421
  outputs: z.optional(outputsresponseOutputsResponseSchema),
1422
- width: z.optional(z.int()),
1422
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1423
1423
  height: z.optional(z.string()),
1424
- duration: z.optional(z.number()),
1425
- fps: z.optional(z.number()),
1424
+ duration: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1425
+ fps: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1426
1426
  created: z.optional(z.string()),
1427
1427
  updated: z.optional(z.string()),
1428
1428
  });
@@ -1467,9 +1467,300 @@ export const sourceSchema = sourceSourceSchema;
1467
1467
  export const soundtrackSoundtrackSchema = z.object({
1468
1468
  src: z.string(),
1469
1469
  effect: z.optional(z.enum(["fadeIn", "fadeOut", "fadeInFadeOut"])),
1470
- volume: z.optional(z.number()),
1470
+ volume: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1471
1471
  });
1472
1472
  export const soundtrackSchema = soundtrackSoundtrackSchema;
1473
+ /**
1474
+ * A color stop in a gradient. Each stop defines a color at a specific position
1475
+ * along the gradient vector. Gradients require at least 2 stops.
1476
+ *
1477
+ */
1478
+ export const svgpropertiesSvgGradientStopSchema = z.object({
1479
+ offset: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1)),
1480
+ color: z.string().regex(/^#[A-Fa-f0-9]{6}$/),
1481
+ });
1482
+ export const svgGradientStopSchema = svgpropertiesSvgGradientStopSchema;
1483
+ /**
1484
+ * A linear gradient fill that transitions colors along a straight line.
1485
+ * The gradient direction is controlled by the `angle` property.
1486
+ *
1487
+ */
1488
+ export const svgpropertiesSvgLinearGradientFillSchema = z.object({
1489
+ type: z.enum(["linear"]),
1490
+ angle: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(360))).default(0),
1491
+ stops: z.array(svgpropertiesSvgGradientStopSchema).min(2),
1492
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1493
+ });
1494
+ export const svgLinearGradientFillSchema = svgpropertiesSvgLinearGradientFillSchema;
1495
+ /**
1496
+ * A radial gradient fill that transitions colors radiating outward from a center point.
1497
+ * The gradient creates a circular or elliptical color transition.
1498
+ *
1499
+ */
1500
+ export const svgpropertiesSvgRadialGradientFillSchema = z.object({
1501
+ type: z.enum(["radial"]),
1502
+ stops: z.array(svgpropertiesSvgGradientStopSchema).min(2),
1503
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1504
+ });
1505
+ export const svgRadialGradientFillSchema = svgpropertiesSvgRadialGradientFillSchema;
1506
+ /**
1507
+ * Drop shadow properties for SVG shapes. Creates a shadow effect behind the shape.
1508
+ *
1509
+ */
1510
+ export const svgpropertiesSvgShadowSchema = z.object({
1511
+ offsetX: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1512
+ offsetY: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1513
+ blur: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1514
+ color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#000000"),
1515
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(0.5),
1516
+ });
1517
+ export const svgShadowSchema = svgpropertiesSvgShadowSchema;
1518
+ /**
1519
+ * A solid color fill for SVG shapes.
1520
+ */
1521
+ export const svgpropertiesSvgSolidFillSchema = z.object({
1522
+ type: z.enum(["solid"]),
1523
+ color: z
1524
+ .string()
1525
+ .regex(/^#[A-Fa-f0-9]{6}$/)
1526
+ .default("#000000"),
1527
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1528
+ });
1529
+ export const svgSolidFillSchema = svgpropertiesSvgSolidFillSchema;
1530
+ /**
1531
+ * Fill properties for SVG shapes. Supports solid colors and gradients.
1532
+ * The fill defines how the interior of a shape is painted.
1533
+ *
1534
+ */
1535
+ export const svgpropertiesSvgFillSchema = z.discriminatedUnion("type", [
1536
+ svgpropertiesSvgSolidFillSchema,
1537
+ svgpropertiesSvgLinearGradientFillSchema,
1538
+ svgpropertiesSvgRadialGradientFillSchema,
1539
+ ]);
1540
+ export const svgFillSchema = svgpropertiesSvgFillSchema;
1541
+ /**
1542
+ * Stroke (outline) properties for SVG shapes. The stroke defines how the outline
1543
+ * of a shape is painted, including its color, width, and line style.
1544
+ *
1545
+ */
1546
+ export const svgpropertiesSvgStrokeSchema = z.object({
1547
+ color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#000000"),
1548
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(100))).default(1),
1549
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1550
+ lineCap: z.optional(z.enum(["butt", "round", "square"])),
1551
+ lineJoin: z.optional(z.enum(["miter", "round", "bevel"])),
1552
+ dashArray: z.optional(z.array(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0)))),
1553
+ dashOffset: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1554
+ });
1555
+ export const svgStrokeSchema = svgpropertiesSvgStrokeSchema;
1556
+ /**
1557
+ * Transformation properties for positioning, rotating, and scaling SVG shapes.
1558
+ *
1559
+ */
1560
+ export const svgpropertiesSvgTransformSchema = z.object({
1561
+ x: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1562
+ y: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1563
+ rotation: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(-360).lte(360))).default(0),
1564
+ scale: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0.01).lte(100))).default(1),
1565
+ originX: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(0.5),
1566
+ originY: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(0.5),
1567
+ });
1568
+ export const svgTransformSchema = svgpropertiesSvgTransformSchema;
1569
+ /**
1570
+ * An arrow shape pointing to the right by default.
1571
+ * Use transform rotation to change direction.
1572
+ *
1573
+ */
1574
+ export const svgshapesSvgArrowShapeSchema = z.object({
1575
+ type: z.enum(["arrow"]),
1576
+ length: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
1577
+ headWidth: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(1000)),
1578
+ headLength: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(1000)),
1579
+ shaftWidth: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(1000)),
1580
+ });
1581
+ export const svgArrowShapeSchema = svgshapesSvgArrowShapeSchema;
1582
+ /**
1583
+ * A perfect circle shape defined by its radius.
1584
+ * The circle is centered at the shape's position.
1585
+ *
1586
+ */
1587
+ export const svgshapesSvgCircleShapeSchema = z.object({
1588
+ type: z.enum(["circle"]),
1589
+ radius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
1590
+ });
1591
+ export const svgCircleShapeSchema = svgshapesSvgCircleShapeSchema;
1592
+ /**
1593
+ * A cross or plus shape with equal or different arm lengths.
1594
+ * Can be styled as a plus sign (+) or a cross (x with rotation).
1595
+ *
1596
+ */
1597
+ export const svgshapesSvgCrossShapeSchema = z.object({
1598
+ type: z.enum(["cross"]),
1599
+ width: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
1600
+ height: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
1601
+ thickness: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(500)),
1602
+ });
1603
+ export const svgCrossShapeSchema = svgshapesSvgCrossShapeSchema;
1604
+ /**
1605
+ * An ellipse (oval) shape with separate horizontal and vertical radii.
1606
+ * The ellipse is centered at the shape's position.
1607
+ *
1608
+ */
1609
+ export const svgshapesSvgEllipseShapeSchema = z.object({
1610
+ type: z.enum(["ellipse"]),
1611
+ radiusX: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
1612
+ radiusY: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
1613
+ });
1614
+ export const svgEllipseShapeSchema = svgshapesSvgEllipseShapeSchema;
1615
+ /**
1616
+ * A heart shape commonly used for love/like icons.
1617
+ * The heart is defined by a single size parameter.
1618
+ *
1619
+ */
1620
+ export const svgshapesSvgHeartShapeSchema = z.object({
1621
+ type: z.enum(["heart"]),
1622
+ size: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
1623
+ });
1624
+ export const svgHeartShapeSchema = svgshapesSvgHeartShapeSchema;
1625
+ /**
1626
+ * A straight line shape with a specified length and thickness.
1627
+ * The line is drawn horizontally by default and can be rotated using transform.
1628
+ *
1629
+ */
1630
+ export const svgshapesSvgLineShapeSchema = z.object({
1631
+ type: z.enum(["line"]),
1632
+ length: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
1633
+ thickness: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(500)),
1634
+ });
1635
+ export const svgLineShapeSchema = svgshapesSvgLineShapeSchema;
1636
+ /**
1637
+ * A custom shape defined by SVG path data.
1638
+ * Supports all standard SVG path commands for creating complex shapes.
1639
+ *
1640
+ * **Path Commands:**
1641
+ * - `M x y` / `m dx dy` - Move to (absolute/relative)
1642
+ * - `L x y` / `l dx dy` - Line to
1643
+ * - `H x` / `h dx` - Horizontal line to
1644
+ * - `V y` / `v dy` - Vertical line to
1645
+ * - `C x1 y1 x2 y2 x y` / `c` - Cubic Bezier curve
1646
+ * - `S x2 y2 x y` / `s` - Smooth cubic Bezier
1647
+ * - `Q x1 y1 x y` / `q` - Quadratic Bezier curve
1648
+ * - `T x y` / `t` - Smooth quadratic Bezier
1649
+ * - `A rx ry angle large-arc sweep x y` / `a` - Elliptical arc
1650
+ * - `Z` / `z` - Close path
1651
+ *
1652
+ */
1653
+ export const svgshapesSvgPathShapeSchema = z.object({
1654
+ type: z.enum(["path"]),
1655
+ d: z.string().min(1).max(100000),
1656
+ });
1657
+ export const svgPathShapeSchema = svgshapesSvgPathShapeSchema;
1658
+ /**
1659
+ * A regular polygon shape with a specified number of sides.
1660
+ * Examples: triangle (3), square (4), pentagon (5), hexagon (6), etc.
1661
+ * The polygon is inscribed in a circle of the given radius.
1662
+ *
1663
+ */
1664
+ export const svgshapesSvgPolygonShapeSchema = z.object({
1665
+ type: z.enum(["polygon"]),
1666
+ sides: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(3).lte(100)),
1667
+ radius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
1668
+ });
1669
+ export const svgPolygonShapeSchema = svgshapesSvgPolygonShapeSchema;
1670
+ /**
1671
+ * A rectangle shape with optional rounded corners.
1672
+ * The rectangle is defined by its width and height dimensions.
1673
+ *
1674
+ */
1675
+ export const svgshapesSvgRectangleShapeSchema = z.object({
1676
+ type: z.enum(["rectangle"]),
1677
+ width: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
1678
+ height: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
1679
+ cornerRadius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(2048))).default(0),
1680
+ });
1681
+ export const svgRectangleShapeSchema = svgshapesSvgRectangleShapeSchema;
1682
+ /**
1683
+ * A ring (donut/annulus) shape - a circle with a circular hole in the center.
1684
+ * The ring is defined by outer and inner radii.
1685
+ *
1686
+ */
1687
+ export const svgshapesSvgRingShapeSchema = z.object({
1688
+ type: z.enum(["ring"]),
1689
+ outerRadius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
1690
+ innerRadius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(2048)),
1691
+ });
1692
+ export const svgRingShapeSchema = svgshapesSvgRingShapeSchema;
1693
+ /**
1694
+ * A star shape with a specified number of points.
1695
+ * The star is defined by outer and inner radii, creating the characteristic
1696
+ * pointed appearance.
1697
+ *
1698
+ */
1699
+ export const svgshapesSvgStarShapeSchema = z.object({
1700
+ type: z.enum(["star"]),
1701
+ points: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(3).lte(100)),
1702
+ outerRadius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
1703
+ innerRadius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
1704
+ });
1705
+ export const svgStarShapeSchema = svgshapesSvgStarShapeSchema;
1706
+ /**
1707
+ * The shape definition for an SVG asset. Each shape type has its own specific
1708
+ * properties. The `type` field determines which shape is rendered.
1709
+ *
1710
+ */
1711
+ export const svgshapesSvgShapeSchema = z.discriminatedUnion("type", [
1712
+ svgshapesSvgRectangleShapeSchema,
1713
+ svgshapesSvgCircleShapeSchema,
1714
+ svgshapesSvgEllipseShapeSchema,
1715
+ svgshapesSvgLineShapeSchema,
1716
+ svgshapesSvgPolygonShapeSchema,
1717
+ svgshapesSvgStarShapeSchema,
1718
+ svgshapesSvgArrowShapeSchema,
1719
+ svgshapesSvgHeartShapeSchema,
1720
+ svgshapesSvgCrossShapeSchema,
1721
+ svgshapesSvgRingShapeSchema,
1722
+ svgshapesSvgPathShapeSchema,
1723
+ ]);
1724
+ export const svgShapeSchema = svgshapesSvgShapeSchema;
1725
+ /**
1726
+ * The SvgAsset is used to add scalable vector graphics (SVG) shapes to a video.
1727
+ * It provides a comprehensive set of primitive shapes and custom paths with full
1728
+ * styling support including fills, strokes, gradients, and shadows.
1729
+ *
1730
+ * **Available Shapes:**
1731
+ * - `rectangle` - Rectangles with optional rounded corners
1732
+ * - `circle` - Perfect circles
1733
+ * - `ellipse` - Ellipses/ovals with separate x and y radii
1734
+ * - `line` - Straight lines with configurable thickness
1735
+ * - `polygon` - Regular polygons (triangle, pentagon, hexagon, etc.)
1736
+ * - `star` - Multi-pointed stars
1737
+ * - `arrow` - Directional arrows
1738
+ * - `heart` - Heart shapes
1739
+ * - `cross` - Plus/cross shapes
1740
+ * - `ring` - Donut/ring shapes
1741
+ * - `path` - Custom shapes using SVG path data
1742
+ *
1743
+ * **Styling Options:**
1744
+ * - Fill with solid colors or linear/radial gradients
1745
+ * - Stroke with configurable width, color, dash patterns, and line caps/joins
1746
+ * - Drop shadows with blur, offset, and opacity
1747
+ * - Transform properties for positioning, rotation, and scaling
1748
+ *
1749
+ * See [W3C SVG 2 Specification](https://www.w3.org/TR/SVG2/) for path data syntax.
1750
+ *
1751
+ */
1752
+ export const svgassetSvgAssetSchema = z.object({
1753
+ type: z.enum(["svg"]),
1754
+ shape: svgshapesSvgShapeSchema,
1755
+ fill: z.optional(svgpropertiesSvgFillSchema),
1756
+ stroke: z.optional(svgpropertiesSvgStrokeSchema),
1757
+ shadow: z.optional(svgpropertiesSvgShadowSchema),
1758
+ transform: z.optional(svgpropertiesSvgTransformSchema),
1759
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1760
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(4096))),
1761
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(4096))),
1762
+ });
1763
+ export const svgAssetSchema = svgassetSvgAssetSchema;
1473
1764
  /**
1474
1765
  * Configure the id and optional merge fields to render a template by id.
1475
1766
  */
@@ -1491,16 +1782,16 @@ export const textAlignmentSchema = textpropertiesTextAlignmentSchema;
1491
1782
  */
1492
1783
  export const textpropertiesTextAnimationSchema = z.object({
1493
1784
  preset: z.enum(["typewriter"]),
1494
- duration: z.optional(z.number().gte(0.1).lte(30)),
1785
+ duration: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0.1).lte(30))),
1495
1786
  });
1496
1787
  /**
1497
1788
  * Displays a background box behind the text.
1498
1789
  */
1499
1790
  export const textpropertiesTextBackgroundSchema = z.object({
1500
1791
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)),
1501
- opacity: z.optional(z.number().gte(0).lte(1)),
1502
- padding: z.optional(z.number().gte(0).lte(100)),
1503
- borderRadius: z.optional(z.number().gte(0)),
1792
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))),
1793
+ padding: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(100))),
1794
+ borderRadius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))),
1504
1795
  });
1505
1796
  export const textBackgroundSchema = textpropertiesTextBackgroundSchema;
1506
1797
  /**
@@ -1509,17 +1800,17 @@ export const textBackgroundSchema = textpropertiesTextBackgroundSchema;
1509
1800
  export const textpropertiesTextFontSchema = z.object({
1510
1801
  family: z.optional(z.string()),
1511
1802
  color: z.optional(z.string()),
1512
- opacity: z.optional(z.number()),
1513
- size: z.optional(z.int()),
1514
- weight: z.optional(z.int()),
1515
- lineHeight: z.optional(z.number()),
1803
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1804
+ size: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1805
+ weight: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1806
+ lineHeight: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1516
1807
  });
1517
1808
  export const textFontSchema = textpropertiesTextFontSchema;
1518
1809
  /**
1519
1810
  * Text stroke (outline) properties.
1520
1811
  */
1521
1812
  export const textpropertiesTextStrokeSchema = z.object({
1522
- width: z.optional(z.number().gte(0).lte(10)),
1813
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
1523
1814
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)),
1524
1815
  });
1525
1816
  /**
@@ -1530,8 +1821,8 @@ export const textpropertiesTextStrokeSchema = z.object({
1530
1821
  export const textassetTextAssetSchema = z.object({
1531
1822
  type: z.enum(["text"]),
1532
1823
  text: z.string(),
1533
- width: z.optional(z.int()),
1534
- height: z.optional(z.int()),
1824
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1825
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1535
1826
  font: z.optional(textpropertiesTextFontSchema),
1536
1827
  background: z.optional(textpropertiesTextBackgroundSchema),
1537
1828
  alignment: z.optional(textpropertiesTextAlignmentSchema),
@@ -1546,8 +1837,8 @@ export const textAssetSchema = textassetTextAssetSchema;
1546
1837
  export const texttoimageassetTextToImageAssetSchema = z.object({
1547
1838
  type: z.enum(["text-to-image"]),
1548
1839
  prompt: z.string(),
1549
- width: z.optional(z.int()),
1550
- height: z.optional(z.int()),
1840
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1841
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1551
1842
  crop: z.optional(cropCropSchema),
1552
1843
  });
1553
1844
  export const textToImageAssetSchema = texttoimageassetTextToImageAssetSchema;
@@ -1555,8 +1846,8 @@ export const textToImageAssetSchema = texttoimageassetTextToImageAssetSchema;
1555
1846
  * Generate a thumbnail image for the video or image at a specific point from the timeline.
1556
1847
  */
1557
1848
  export const thumbnailThumbnailSchema = z.object({
1558
- capture: z.number(),
1559
- scale: z.number().gte(0).lte(1),
1849
+ capture: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()),
1850
+ scale: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1)),
1560
1851
  });
1561
1852
  export const thumbnailSchema = thumbnailThumbnailSchema;
1562
1853
  /**
@@ -1737,8 +2028,8 @@ export const transitionSchema = transitionTransitionSchema;
1737
2028
  export const tweenTweenSchema = z.object({
1738
2029
  from: z.optional(z.unknown()),
1739
2030
  to: z.optional(z.unknown()),
1740
- start: z.optional(z.number()),
1741
- length: z.optional(z.number()),
2031
+ start: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
2032
+ length: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1742
2033
  interpolation: z.optional(z.enum(["linear", "bezier", "constant"])),
1743
2034
  easing: z.optional(z.enum([
1744
2035
  "ease",
@@ -1778,9 +2069,9 @@ export const tweenSchema = tweenTweenSchema;
1778
2069
  export const audioassetAudioAssetSchema = z.object({
1779
2070
  type: z.enum(["audio"]),
1780
2071
  src: z.string(),
1781
- trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1782
- volume: z.optional(z.union([z.number().gte(0).lte(1), z.array(tweenTweenSchema)])),
1783
- speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
2072
+ trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()))),
2073
+ volume: z.optional(z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1)), z.array(tweenTweenSchema)])),
2074
+ speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10)))),
1784
2075
  effect: z.optional(z.enum(["none", "fadeIn", "fadeOut", "fadeInFadeOut"])),
1785
2076
  });
1786
2077
  export const audioAssetSchema = audioassetAudioAssetSchema;
@@ -1788,23 +2079,23 @@ export const audioAssetSchema = audioassetAudioAssetSchema;
1788
2079
  * Offsets the position of an asset horizontally or vertically by a relative distance.
1789
2080
  */
1790
2081
  export const offsetOffsetSchema = z.object({
1791
- x: z.optional(z.union([z.number().gte(-10).lte(10), z.array(tweenTweenSchema)])),
1792
- y: z.optional(z.union([z.number().gte(-10).lte(10), z.array(tweenTweenSchema)])),
2082
+ x: z.optional(z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(-10).lte(10)), z.array(tweenTweenSchema)])),
2083
+ y: z.optional(z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(-10).lte(10)), z.array(tweenTweenSchema)])),
1793
2084
  });
1794
2085
  export const offsetSchema = offsetOffsetSchema;
1795
2086
  /**
1796
2087
  * Rotate a clip by the specified angle in degrees. Rotation origin is set based on the clips `position`.
1797
2088
  */
1798
2089
  export const rotatetransformationRotateTransformationSchema = z.object({
1799
- angle: z.optional(z.union([z.int().gte(-360).lte(360), z.array(tweenTweenSchema)])),
2090
+ angle: z.optional(z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(-360).lte(360)), z.array(tweenTweenSchema)])),
1800
2091
  });
1801
2092
  export const rotateTransformationSchema = rotatetransformationRotateTransformationSchema;
1802
2093
  /**
1803
2094
  * Skew a clip so its edges are sheared at an angle. Use values between -100 and 100. Values over 3 or under -3 will skew the clip almost flat.
1804
2095
  */
1805
2096
  export const skewtransformationSkewTransformationSchema = z.object({
1806
- x: z.optional(z.union([z.number().gte(-100).lte(100), z.array(tweenTweenSchema)])),
1807
- y: z.optional(z.union([z.number().gte(-100).lte(100), z.array(tweenTweenSchema)])),
2097
+ x: z.optional(z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(-100).lte(100)), z.array(tweenTweenSchema)])),
2098
+ y: z.optional(z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(-100).lte(100)), z.array(tweenTweenSchema)])),
1808
2099
  });
1809
2100
  export const skewTransformationSchema = skewtransformationSkewTransformationSchema;
1810
2101
  /**
@@ -1870,11 +2161,11 @@ export const transformationSchema = transformationTransformationSchema;
1870
2161
  export const videoassetVideoAssetSchema = z.object({
1871
2162
  type: z.enum(["video"]),
1872
2163
  src: z.string(),
1873
- transcode: z.optional(z.boolean()).default(false),
1874
- trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1875
- volume: z.optional(z.union([z.number().gte(0).lte(1), z.array(tweenTweenSchema)])),
2164
+ transcode: z.optional(z.boolean()),
2165
+ trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()))),
2166
+ volume: z.optional(z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1)), z.array(tweenTweenSchema)])),
1876
2167
  volumeEffect: z.optional(z.enum(["none", "fadeIn", "fadeOut", "fadeInFadeOut"])),
1877
- speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
2168
+ speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10)))),
1878
2169
  crop: z.optional(cropCropSchema),
1879
2170
  chromaKey: z.optional(chromakeyChromaKeySchema),
1880
2171
  });
@@ -1893,6 +2184,7 @@ export const assetAssetSchema = z.discriminatedUnion("type", [
1893
2184
  htmlassetHtmlAssetSchema,
1894
2185
  titleassetTitleAssetSchema,
1895
2186
  shapeassetShapeAssetSchema,
2187
+ svgassetSvgAssetSchema,
1896
2188
  texttoimageassetTextToImageAssetSchema,
1897
2189
  imagetovideoassetImageToVideoAssetSchema,
1898
2190
  ]);
@@ -1902,12 +2194,12 @@ export const assetSchema = assetAssetSchema;
1902
2194
  */
1903
2195
  export const clipClipSchema = z.object({
1904
2196
  asset: assetAssetSchema,
1905
- start: z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()), z.enum(["auto"])]),
1906
- length: z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()), z.literal("auto"), z.literal("end")]),
2197
+ start: z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())), z.enum(["auto"])]),
2198
+ length: z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())), z.literal("auto"), z.literal("end")]),
1907
2199
  fit: z.optional(z.enum(["cover", "contain", "crop", "none"])),
1908
- scale: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1909
- width: z.optional(z.int().gte(1).lte(3840)),
1910
- height: z.optional(z.int().gte(1).lte(2160)),
2200
+ scale: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()))),
2201
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(3840))),
2202
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(2160))),
1911
2203
  position: z.optional(z.enum([
1912
2204
  "top",
1913
2205
  "topRight",
@@ -1952,7 +2244,7 @@ export const clipClipSchema = z.object({
1952
2244
  "muted",
1953
2245
  "negative",
1954
2246
  ])),
1955
- opacity: z.optional(z.union([z.number(), z.array(tweenTweenSchema)])),
2247
+ opacity: z.optional(z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()), z.array(tweenTweenSchema)])),
1956
2248
  transform: z.optional(transformationTransformationSchema),
1957
2249
  alias: z.optional(z.string().regex(/^[A-Za-z0-9_-]+$/)),
1958
2250
  });
@@ -2003,8 +2295,8 @@ export const renderresponsedataRenderResponseDataSchema = z.object({
2003
2295
  "failed",
2004
2296
  ]),
2005
2297
  error: z.optional(z.string()),
2006
- duration: z.optional(z.number()),
2007
- renderTime: z.optional(z.number()),
2298
+ duration: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
2299
+ renderTime: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
2008
2300
  url: z.optional(z.string()),
2009
2301
  poster: z.optional(z.union([z.string(), z.null()])),
2010
2302
  thumbnail: z.optional(z.union([z.string(), z.null()])),