@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.
@@ -39,9 +39,9 @@ export const uploadRootSchema = z.unknown();
39
39
  */
40
40
  export const captionpropertiesCaptionBackgroundSchema = z.object({
41
41
  color: z.optional(z.string()),
42
- opacity: z.optional(z.number()),
43
- padding: z.optional(z.int()),
44
- borderRadius: z.optional(z.int()),
42
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
43
+ padding: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
44
+ borderRadius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
45
45
  });
46
46
 
47
47
  export const captionBackgroundSchema = captionpropertiesCaptionBackgroundSchema;
@@ -52,11 +52,11 @@ export const captionBackgroundSchema = captionpropertiesCaptionBackgroundSchema;
52
52
  export const captionpropertiesCaptionFontSchema = z.object({
53
53
  family: z.optional(z.string()),
54
54
  color: z.optional(z.string()),
55
- opacity: z.optional(z.number()),
56
- size: z.optional(z.int()),
57
- lineHeight: z.optional(z.number()),
55
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
56
+ size: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
57
+ lineHeight: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
58
58
  stroke: z.optional(z.string()),
59
- strokeWidth: z.optional(z.number()),
59
+ strokeWidth: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
60
60
  });
61
61
 
62
62
  export const captionFontSchema = captionpropertiesCaptionFontSchema;
@@ -65,9 +65,9 @@ export const captionFontSchema = captionpropertiesCaptionFontSchema;
65
65
  * The margin properties for captions. Margins are used to position the caption text and background on the screen.
66
66
  */
67
67
  export const captionpropertiesCaptionMarginSchema = z.object({
68
- top: z.optional(z.number()),
69
- left: z.optional(z.number()),
70
- right: z.optional(z.number()),
68
+ top: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
69
+ left: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
70
+ right: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
71
71
  });
72
72
 
73
73
  export const captionMarginSchema = captionpropertiesCaptionMarginSchema;
@@ -90,8 +90,8 @@ export const captionassetCaptionAssetSchema = z.object({
90
90
  font: z.optional(captionpropertiesCaptionFontSchema),
91
91
  background: z.optional(captionpropertiesCaptionBackgroundSchema),
92
92
  margin: z.optional(captionpropertiesCaptionMarginSchema),
93
- trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
94
- speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
93
+ 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()))),
94
+ 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)))),
95
95
  });
96
96
 
97
97
  export const captionAssetSchema = captionassetCaptionAssetSchema;
@@ -101,8 +101,8 @@ export const captionAssetSchema = captionassetCaptionAssetSchema;
101
101
  */
102
102
  export const chromakeyChromaKeySchema = z.object({
103
103
  color: z.optional(z.string()),
104
- threshold: z.optional(z.int().gte(0).lte(250)),
105
- halo: z.optional(z.int().gte(0).lte(250)),
104
+ threshold: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(0).lte(250))),
105
+ halo: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(0).lte(250))),
106
106
  });
107
107
 
108
108
  export const chromaKeySchema = chromakeyChromaKeySchema;
@@ -470,8 +470,8 @@ export const shotstackImageToVideoOptionsShotstackImageToVideoOptionsSchema =
470
470
  z.object({
471
471
  type: z.enum(["image-to-video"]),
472
472
  imageUrl: z.string(),
473
- guidanceScale: z.optional(z.number()).default(1.8),
474
- motion: z.optional(z.int()).default(127),
473
+ guidanceScale: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(1.8),
474
+ motion: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())).default(127),
475
475
  });
476
476
 
477
477
  export const shotstackImageToVideoOptionsSchema =
@@ -496,8 +496,8 @@ export const shotstackTextToImageOptionsShotstackTextToImageOptionsSchema =
496
496
  z.object({
497
497
  type: z.enum(["text-to-image"]),
498
498
  prompt: z.string(),
499
- width: z.int(),
500
- height: z.int(),
499
+ width: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
500
+ height: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
501
501
  });
502
502
 
503
503
  export const shotstackTextToImageOptionsSchema =
@@ -673,11 +673,11 @@ export const stabilityAiTextToImageOptionsStabilityAiTextToImageOptionsSchema =
673
673
  "stable-diffusion-xl-beta-v2-2-2",
674
674
  ])
675
675
  ),
676
- width: z.int(),
677
- height: z.int(),
678
- steps: z.optional(z.int()).default(30),
679
- seed: z.optional(z.int()).default(0),
680
- cfgScale: z.optional(z.number()).default(7),
676
+ width: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
677
+ height: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
678
+ steps: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())).default(30),
679
+ seed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())).default(0),
680
+ cfgScale: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(7),
681
681
  stylePreset: z.optional(
682
682
  z.enum([
683
683
  "3d-model",
@@ -780,10 +780,10 @@ export const generatedAssetSchema = generatedAssetGeneratedAssetSchema;
780
780
  * 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.
781
781
  */
782
782
  export const cropCropSchema = z.object({
783
- top: z.optional(z.number().gte(0).lte(1)),
784
- bottom: z.optional(z.number().gte(0).lte(1)),
785
- left: z.optional(z.number().gte(0).lte(1)),
786
- right: z.optional(z.number().gte(0).lte(1)),
783
+ top: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))),
784
+ bottom: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))),
785
+ left: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))),
786
+ right: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))),
787
787
  });
788
788
 
789
789
  export const cropSchema = cropCropSchema;
@@ -1040,8 +1040,8 @@ export const htmlassetHtmlAssetSchema = z.object({
1040
1040
  type: z.enum(["html"]),
1041
1041
  html: z.string(),
1042
1042
  css: z.optional(z.string()),
1043
- width: z.optional(z.int()),
1044
- height: z.optional(z.int()),
1043
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1044
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1045
1045
  background: z.optional(z.string()),
1046
1046
  position: z.optional(
1047
1047
  z.enum([
@@ -1081,7 +1081,7 @@ export const imagetovideoassetImageToVideoAssetSchema = z.object({
1081
1081
  aspectRatio: z.optional(
1082
1082
  z.enum(["1:1", "4:3", "16:9", "9:16", "3:4", "21:9", "9:21"])
1083
1083
  ),
1084
- speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
1084
+ 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)))),
1085
1085
  crop: z.optional(cropCropSchema),
1086
1086
  });
1087
1087
 
@@ -1220,7 +1220,7 @@ export const uploadResponseSchema = uploadresponseUploadResponseSchema;
1220
1220
  * 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.
1221
1221
  */
1222
1222
  export const speedSpeedSchema = z.object({
1223
- speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
1223
+ 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)))),
1224
1224
  preservePitch: z.optional(z.boolean()),
1225
1225
  });
1226
1226
 
@@ -1241,7 +1241,7 @@ export const transcriptionSchema = transcriptionTranscriptionSchema;
1241
1241
  export const lumaassetLumaAssetSchema = z.object({
1242
1242
  type: z.enum(["luma"]),
1243
1243
  src: z.string(),
1244
- trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1244
+ 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()))),
1245
1245
  });
1246
1246
 
1247
1247
  export const lumaAssetSchema = lumaassetLumaAssetSchema;
@@ -1260,7 +1260,7 @@ export const mergeFieldSchema = mergefieldMergeFieldSchema;
1260
1260
  * 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.
1261
1261
  */
1262
1262
  export const posterPosterSchema = z.object({
1263
- capture: z.number(),
1263
+ capture: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()),
1264
1264
  });
1265
1265
 
1266
1266
  export const posterSchema = posterPosterSchema;
@@ -1269,8 +1269,8 @@ export const posterSchema = posterPosterSchema;
1269
1269
  * 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.
1270
1270
  */
1271
1271
  export const rangeRangeSchema = z.object({
1272
- start: z.optional(z.number().gte(0)),
1273
- length: z.optional(z.number().gte(0)),
1272
+ start: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))),
1273
+ length: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))),
1274
1274
  });
1275
1275
 
1276
1276
  export const rangeSchema = rangeRangeSchema;
@@ -1437,8 +1437,8 @@ export const richtextpropertiesRichTextAnimationSchema = z.object({
1437
1437
  "shift",
1438
1438
  "movingLetters",
1439
1439
  ]),
1440
- speed: z.optional(z.number().gte(0.1).lte(10)).default(1),
1441
- duration: z.optional(z.number().gte(0.1).lte(30)),
1440
+ 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),
1441
+ duration: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0.1).lte(30))),
1442
1442
  style: z.optional(z.enum(["character", "word"])),
1443
1443
  direction: z.optional(z.enum(["left", "right", "up", "down"])),
1444
1444
  });
@@ -1451,8 +1451,8 @@ export const richTextAnimationSchema =
1451
1451
  */
1452
1452
  export const richtextpropertiesRichTextBackgroundSchema = z.object({
1453
1453
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)),
1454
- opacity: z.optional(z.number().gte(0).lte(1)).default(1),
1455
- borderRadius: z.optional(z.number().gte(0)).default(0),
1454
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1455
+ borderRadius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1456
1456
  });
1457
1457
 
1458
1458
  export const richTextBackgroundSchema =
@@ -1462,10 +1462,10 @@ export const richTextBackgroundSchema =
1462
1462
  * Border styling properties for the text bounding box.
1463
1463
  */
1464
1464
  export const richtextpropertiesRichTextBorderSchema = z.object({
1465
- width: z.optional(z.number().gte(0)).default(0),
1465
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1466
1466
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#000000"),
1467
- opacity: z.optional(z.number().gte(0).lte(1)).default(1),
1468
- radius: z.optional(z.number().gte(0)).default(0),
1467
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1468
+ radius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1469
1469
  });
1470
1470
 
1471
1471
  /**
@@ -1473,11 +1473,11 @@ export const richtextpropertiesRichTextBorderSchema = z.object({
1473
1473
  */
1474
1474
  export const richtextpropertiesRichTextGradientSchema = z.object({
1475
1475
  type: z.optional(z.enum(["linear", "radial"])),
1476
- angle: z.optional(z.number().gte(0).lte(360)).default(0),
1476
+ angle: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(360))).default(0),
1477
1477
  stops: z
1478
1478
  .array(
1479
1479
  z.object({
1480
- offset: z.number().gte(0).lte(1),
1480
+ offset: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1)),
1481
1481
  color: z.string().regex(/^#[A-Fa-f0-9]{6}$/),
1482
1482
  })
1483
1483
  )
@@ -1490,21 +1490,21 @@ export const richTextGradientSchema = richtextpropertiesRichTextGradientSchema;
1490
1490
  * Padding properties for individual sides of the text bounding box.
1491
1491
  */
1492
1492
  export const richtextpropertiesRichTextPaddingSchema = z.object({
1493
- top: z.optional(z.number().gte(0)).default(0),
1494
- right: z.optional(z.number().gte(0)).default(0),
1495
- bottom: z.optional(z.number().gte(0)).default(0),
1496
- left: z.optional(z.number().gte(0)).default(0),
1493
+ top: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1494
+ right: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1495
+ bottom: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1496
+ left: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1497
1497
  });
1498
1498
 
1499
1499
  /**
1500
1500
  * Text shadow properties.
1501
1501
  */
1502
1502
  export const richtextpropertiesRichTextShadowSchema = z.object({
1503
- offsetX: z.optional(z.number()).default(0),
1504
- offsetY: z.optional(z.number()).default(0),
1505
- blur: z.optional(z.number().gte(0)).default(0),
1503
+ offsetX: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1504
+ offsetY: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1505
+ blur: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1506
1506
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#000000"),
1507
- opacity: z.optional(z.number().gte(0).lte(1)).default(0.5),
1507
+ 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),
1508
1508
  });
1509
1509
 
1510
1510
  export const richTextShadowSchema = richtextpropertiesRichTextShadowSchema;
@@ -1513,9 +1513,9 @@ export const richTextShadowSchema = richtextpropertiesRichTextShadowSchema;
1513
1513
  * Text stroke (outline) properties.
1514
1514
  */
1515
1515
  export const richtextpropertiesRichTextStrokeSchema = z.object({
1516
- width: z.optional(z.number().gte(0)).default(0),
1516
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1517
1517
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#000000"),
1518
- opacity: z.optional(z.number().gte(0).lte(1)).default(1),
1518
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1519
1519
  });
1520
1520
 
1521
1521
  export const richTextStrokeSchema = richtextpropertiesRichTextStrokeSchema;
@@ -1525,11 +1525,11 @@ export const richTextStrokeSchema = richtextpropertiesRichTextStrokeSchema;
1525
1525
  */
1526
1526
  export const richtextpropertiesRichTextFontSchema = z.object({
1527
1527
  family: z.optional(z.string()).default("Open Sans"),
1528
- size: z.optional(z.int().gte(1).lte(500)).default(24),
1528
+ size: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(500))).default(24),
1529
1529
  weight: z.optional(z.unknown()).default("400"),
1530
- style: z.optional(z.enum(["normal", "italic", "oblique"])),
1531
1530
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#ffffff"),
1532
- opacity: z.optional(z.number().gte(0).lte(1)).default(1),
1531
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1532
+ background: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)),
1533
1533
  stroke: z.optional(richtextpropertiesRichTextStrokeSchema),
1534
1534
  });
1535
1535
 
@@ -1539,8 +1539,8 @@ export const richTextFontSchema = richtextpropertiesRichTextFontSchema;
1539
1539
  * Text style properties including spacing, line height, and transformations.
1540
1540
  */
1541
1541
  export const richtextpropertiesRichTextStyleSchema = z.object({
1542
- letterSpacing: z.optional(z.number()).default(0),
1543
- lineHeight: z.optional(z.number().gte(0).lte(10)).default(1.2),
1542
+ letterSpacing: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1543
+ 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),
1544
1544
  textTransform: z.optional(
1545
1545
  z.enum(["none", "uppercase", "lowercase", "capitalize"])
1546
1546
  ),
@@ -1564,7 +1564,7 @@ export const richtextassetRichTextAssetSchema = z.object({
1564
1564
  background: z.optional(richtextpropertiesRichTextBackgroundSchema),
1565
1565
  border: z.optional(richtextpropertiesRichTextBorderSchema),
1566
1566
  padding: z.optional(
1567
- z.union([z.number().gte(0), richtextpropertiesRichTextPaddingSchema])
1567
+ z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0)), richtextpropertiesRichTextPaddingSchema])
1568
1568
  ),
1569
1569
  align: z.optional(richtextpropertiesRichTextAlignmentSchema),
1570
1570
  animation: z.optional(richtextpropertiesRichTextAnimationSchema),
@@ -1627,36 +1627,36 @@ export const transferSchema = transferTransferSchema;
1627
1627
  export const shapeassetShapeAssetSchema = z.object({
1628
1628
  type: z.enum(["shape"]),
1629
1629
  shape: z.enum(["rectangle", "circle", "line"]),
1630
- width: z.optional(z.int()),
1631
- height: z.optional(z.int()),
1630
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1631
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1632
1632
  fill: z.optional(
1633
1633
  z.object({
1634
1634
  color: z.optional(z.string()),
1635
- opacity: z.optional(z.number()),
1635
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1636
1636
  })
1637
1637
  ),
1638
1638
  stroke: z.optional(
1639
1639
  z.object({
1640
1640
  color: z.optional(z.string()),
1641
- width: z.optional(z.number()),
1641
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1642
1642
  })
1643
1643
  ),
1644
1644
  rectangle: z.optional(
1645
1645
  z.object({
1646
- width: z.int(),
1647
- height: z.int(),
1648
- cornerRadius: z.optional(z.int()),
1646
+ width: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
1647
+ height: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
1648
+ cornerRadius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1649
1649
  })
1650
1650
  ),
1651
1651
  circle: z.optional(
1652
1652
  z.object({
1653
- radius: z.int(),
1653
+ radius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
1654
1654
  })
1655
1655
  ),
1656
1656
  line: z.optional(
1657
1657
  z.object({
1658
- length: z.int(),
1659
- thickness: z.int(),
1658
+ length: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
1659
+ thickness: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int()),
1660
1660
  })
1661
1661
  ),
1662
1662
  });
@@ -1667,8 +1667,8 @@ export const shapeAssetSchema = shapeassetShapeAssetSchema;
1667
1667
  * 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.
1668
1668
  */
1669
1669
  export const sizeSizeSchema = z.object({
1670
- width: z.optional(z.int().gte(1).lte(4096)),
1671
- height: z.optional(z.int().gte(1).lte(4096)),
1670
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(4096))),
1671
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(4096))),
1672
1672
  });
1673
1673
 
1674
1674
  export const sizeSchema = sizeSizeSchema;
@@ -1699,7 +1699,7 @@ export const renditionRenditionSchema = z.object({
1699
1699
  size: z.optional(sizeSizeSchema),
1700
1700
  fit: z.optional(z.enum(["cover", "contain", "crop"])),
1701
1701
  resolution: z.optional(z.enum(["preview", "mobile", "sd", "hd", "fhd"])),
1702
- quality: z.optional(z.int().gte(1).lte(100)),
1702
+ quality: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(100))),
1703
1703
  fps: z.optional(
1704
1704
  z.union([
1705
1705
  z.literal(12),
@@ -1716,7 +1716,7 @@ export const renditionRenditionSchema = z.object({
1716
1716
  ])
1717
1717
  ),
1718
1718
  speed: z.optional(speedSpeedSchema),
1719
- keyframeInterval: z.optional(z.int().gte(1).lte(300)),
1719
+ keyframeInterval: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(300))),
1720
1720
  fixOffset: z.optional(z.boolean()),
1721
1721
  fixRotation: z.optional(z.boolean()),
1722
1722
  enhance: z.optional(enhancementsEnhancementsSchema),
@@ -1752,12 +1752,12 @@ export const renditionresponseattributesRenditionResponseAttributesSchema =
1752
1752
  ])
1753
1753
  ),
1754
1754
  url: z.optional(z.string()),
1755
- executionTime: z.optional(z.number()),
1755
+ executionTime: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1756
1756
  transformation: z.optional(renditionRenditionSchema),
1757
- width: z.optional(z.int()),
1758
- height: z.optional(z.int()),
1759
- duration: z.optional(z.number()),
1760
- fps: z.optional(z.number()),
1757
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1758
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1759
+ duration: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1760
+ fps: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1761
1761
  });
1762
1762
 
1763
1763
  export const renditionResponseAttributesSchema =
@@ -1786,10 +1786,10 @@ export const sourceresponseattributesSourceResponseAttributesSchema = z.object({
1786
1786
  z.enum(["queued", "importing", "ready", "failed", "deleted", "overwritten"])
1787
1787
  ),
1788
1788
  outputs: z.optional(outputsresponseOutputsResponseSchema),
1789
- width: z.optional(z.int()),
1789
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1790
1790
  height: z.optional(z.string()),
1791
- duration: z.optional(z.number()),
1792
- fps: z.optional(z.number()),
1791
+ duration: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1792
+ fps: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1793
1793
  created: z.optional(z.string()),
1794
1794
  updated: z.optional(z.string()),
1795
1795
  });
@@ -1847,11 +1847,346 @@ export const sourceSchema = sourceSourceSchema;
1847
1847
  export const soundtrackSoundtrackSchema = z.object({
1848
1848
  src: z.string(),
1849
1849
  effect: z.optional(z.enum(["fadeIn", "fadeOut", "fadeInFadeOut"])),
1850
- volume: z.optional(z.number()),
1850
+ volume: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1851
1851
  });
1852
1852
 
1853
1853
  export const soundtrackSchema = soundtrackSoundtrackSchema;
1854
1854
 
1855
+ /**
1856
+ * A color stop in a gradient. Each stop defines a color at a specific position
1857
+ * along the gradient vector. Gradients require at least 2 stops.
1858
+ *
1859
+ */
1860
+ export const svgpropertiesSvgGradientStopSchema = z.object({
1861
+ offset: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1)),
1862
+ color: z.string().regex(/^#[A-Fa-f0-9]{6}$/),
1863
+ });
1864
+
1865
+ export const svgGradientStopSchema = svgpropertiesSvgGradientStopSchema;
1866
+
1867
+ /**
1868
+ * A linear gradient fill that transitions colors along a straight line.
1869
+ * The gradient direction is controlled by the `angle` property.
1870
+ *
1871
+ */
1872
+ export const svgpropertiesSvgLinearGradientFillSchema = z.object({
1873
+ type: z.enum(["linear"]),
1874
+ angle: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(360))).default(0),
1875
+ stops: z.array(svgpropertiesSvgGradientStopSchema).min(2),
1876
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1877
+ });
1878
+
1879
+ export const svgLinearGradientFillSchema =
1880
+ svgpropertiesSvgLinearGradientFillSchema;
1881
+
1882
+ /**
1883
+ * A radial gradient fill that transitions colors radiating outward from a center point.
1884
+ * The gradient creates a circular or elliptical color transition.
1885
+ *
1886
+ */
1887
+ export const svgpropertiesSvgRadialGradientFillSchema = z.object({
1888
+ type: z.enum(["radial"]),
1889
+ stops: z.array(svgpropertiesSvgGradientStopSchema).min(2),
1890
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1891
+ });
1892
+
1893
+ export const svgRadialGradientFillSchema =
1894
+ svgpropertiesSvgRadialGradientFillSchema;
1895
+
1896
+ /**
1897
+ * Drop shadow properties for SVG shapes. Creates a shadow effect behind the shape.
1898
+ *
1899
+ */
1900
+ export const svgpropertiesSvgShadowSchema = z.object({
1901
+ offsetX: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1902
+ offsetY: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1903
+ blur: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))).default(0),
1904
+ color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#000000"),
1905
+ 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),
1906
+ });
1907
+
1908
+ export const svgShadowSchema = svgpropertiesSvgShadowSchema;
1909
+
1910
+ /**
1911
+ * A solid color fill for SVG shapes.
1912
+ */
1913
+ export const svgpropertiesSvgSolidFillSchema = z.object({
1914
+ type: z.enum(["solid"]),
1915
+ color: z
1916
+ .string()
1917
+ .regex(/^#[A-Fa-f0-9]{6}$/)
1918
+ .default("#000000"),
1919
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1920
+ });
1921
+
1922
+ export const svgSolidFillSchema = svgpropertiesSvgSolidFillSchema;
1923
+
1924
+ /**
1925
+ * Fill properties for SVG shapes. Supports solid colors and gradients.
1926
+ * The fill defines how the interior of a shape is painted.
1927
+ *
1928
+ */
1929
+ export const svgpropertiesSvgFillSchema = z.discriminatedUnion("type", [
1930
+ svgpropertiesSvgSolidFillSchema,
1931
+ svgpropertiesSvgLinearGradientFillSchema,
1932
+ svgpropertiesSvgRadialGradientFillSchema,
1933
+ ]);
1934
+
1935
+ export const svgFillSchema = svgpropertiesSvgFillSchema;
1936
+
1937
+ /**
1938
+ * Stroke (outline) properties for SVG shapes. The stroke defines how the outline
1939
+ * of a shape is painted, including its color, width, and line style.
1940
+ *
1941
+ */
1942
+ export const svgpropertiesSvgStrokeSchema = z.object({
1943
+ color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)).default("#000000"),
1944
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(100))).default(1),
1945
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
1946
+ lineCap: z.optional(z.enum(["butt", "round", "square"])),
1947
+ lineJoin: z.optional(z.enum(["miter", "round", "bevel"])),
1948
+ dashArray: z.optional(z.array(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0)))),
1949
+ dashOffset: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1950
+ });
1951
+
1952
+ export const svgStrokeSchema = svgpropertiesSvgStrokeSchema;
1953
+
1954
+ /**
1955
+ * Transformation properties for positioning, rotating, and scaling SVG shapes.
1956
+ *
1957
+ */
1958
+ export const svgpropertiesSvgTransformSchema = z.object({
1959
+ x: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1960
+ y: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())).default(0),
1961
+ rotation: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(-360).lte(360))).default(0),
1962
+ 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),
1963
+ 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),
1964
+ 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),
1965
+ });
1966
+
1967
+ export const svgTransformSchema = svgpropertiesSvgTransformSchema;
1968
+
1969
+ /**
1970
+ * An arrow shape pointing to the right by default.
1971
+ * Use transform rotation to change direction.
1972
+ *
1973
+ */
1974
+ export const svgshapesSvgArrowShapeSchema = z.object({
1975
+ type: z.enum(["arrow"]),
1976
+ length: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
1977
+ headWidth: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(1000)),
1978
+ headLength: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(1000)),
1979
+ shaftWidth: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(1000)),
1980
+ });
1981
+
1982
+ export const svgArrowShapeSchema = svgshapesSvgArrowShapeSchema;
1983
+
1984
+ /**
1985
+ * A perfect circle shape defined by its radius.
1986
+ * The circle is centered at the shape's position.
1987
+ *
1988
+ */
1989
+ export const svgshapesSvgCircleShapeSchema = z.object({
1990
+ type: z.enum(["circle"]),
1991
+ radius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
1992
+ });
1993
+
1994
+ export const svgCircleShapeSchema = svgshapesSvgCircleShapeSchema;
1995
+
1996
+ /**
1997
+ * A cross or plus shape with equal or different arm lengths.
1998
+ * Can be styled as a plus sign (+) or a cross (x with rotation).
1999
+ *
2000
+ */
2001
+ export const svgshapesSvgCrossShapeSchema = z.object({
2002
+ type: z.enum(["cross"]),
2003
+ width: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
2004
+ height: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
2005
+ thickness: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(500)),
2006
+ });
2007
+
2008
+ export const svgCrossShapeSchema = svgshapesSvgCrossShapeSchema;
2009
+
2010
+ /**
2011
+ * An ellipse (oval) shape with separate horizontal and vertical radii.
2012
+ * The ellipse is centered at the shape's position.
2013
+ *
2014
+ */
2015
+ export const svgshapesSvgEllipseShapeSchema = z.object({
2016
+ type: z.enum(["ellipse"]),
2017
+ radiusX: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
2018
+ radiusY: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
2019
+ });
2020
+
2021
+ export const svgEllipseShapeSchema = svgshapesSvgEllipseShapeSchema;
2022
+
2023
+ /**
2024
+ * A heart shape commonly used for love/like icons.
2025
+ * The heart is defined by a single size parameter.
2026
+ *
2027
+ */
2028
+ export const svgshapesSvgHeartShapeSchema = z.object({
2029
+ type: z.enum(["heart"]),
2030
+ size: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
2031
+ });
2032
+
2033
+ export const svgHeartShapeSchema = svgshapesSvgHeartShapeSchema;
2034
+
2035
+ /**
2036
+ * A straight line shape with a specified length and thickness.
2037
+ * The line is drawn horizontally by default and can be rotated using transform.
2038
+ *
2039
+ */
2040
+ export const svgshapesSvgLineShapeSchema = z.object({
2041
+ type: z.enum(["line"]),
2042
+ length: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
2043
+ thickness: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(500)),
2044
+ });
2045
+
2046
+ export const svgLineShapeSchema = svgshapesSvgLineShapeSchema;
2047
+
2048
+ /**
2049
+ * A custom shape defined by SVG path data.
2050
+ * Supports all standard SVG path commands for creating complex shapes.
2051
+ *
2052
+ * **Path Commands:**
2053
+ * - `M x y` / `m dx dy` - Move to (absolute/relative)
2054
+ * - `L x y` / `l dx dy` - Line to
2055
+ * - `H x` / `h dx` - Horizontal line to
2056
+ * - `V y` / `v dy` - Vertical line to
2057
+ * - `C x1 y1 x2 y2 x y` / `c` - Cubic Bezier curve
2058
+ * - `S x2 y2 x y` / `s` - Smooth cubic Bezier
2059
+ * - `Q x1 y1 x y` / `q` - Quadratic Bezier curve
2060
+ * - `T x y` / `t` - Smooth quadratic Bezier
2061
+ * - `A rx ry angle large-arc sweep x y` / `a` - Elliptical arc
2062
+ * - `Z` / `z` - Close path
2063
+ *
2064
+ */
2065
+ export const svgshapesSvgPathShapeSchema = z.object({
2066
+ type: z.enum(["path"]),
2067
+ d: z.string().min(1).max(100000),
2068
+ });
2069
+
2070
+ export const svgPathShapeSchema = svgshapesSvgPathShapeSchema;
2071
+
2072
+ /**
2073
+ * A regular polygon shape with a specified number of sides.
2074
+ * Examples: triangle (3), square (4), pentagon (5), hexagon (6), etc.
2075
+ * The polygon is inscribed in a circle of the given radius.
2076
+ *
2077
+ */
2078
+ export const svgshapesSvgPolygonShapeSchema = z.object({
2079
+ type: z.enum(["polygon"]),
2080
+ sides: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(3).lte(100)),
2081
+ radius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
2082
+ });
2083
+
2084
+ export const svgPolygonShapeSchema = svgshapesSvgPolygonShapeSchema;
2085
+
2086
+ /**
2087
+ * A rectangle shape with optional rounded corners.
2088
+ * The rectangle is defined by its width and height dimensions.
2089
+ *
2090
+ */
2091
+ export const svgshapesSvgRectangleShapeSchema = z.object({
2092
+ type: z.enum(["rectangle"]),
2093
+ width: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
2094
+ height: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(4096)),
2095
+ cornerRadius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(2048))).default(0),
2096
+ });
2097
+
2098
+ export const svgRectangleShapeSchema = svgshapesSvgRectangleShapeSchema;
2099
+
2100
+ /**
2101
+ * A ring (donut/annulus) shape - a circle with a circular hole in the center.
2102
+ * The ring is defined by outer and inner radii.
2103
+ *
2104
+ */
2105
+ export const svgshapesSvgRingShapeSchema = z.object({
2106
+ type: z.enum(["ring"]),
2107
+ outerRadius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
2108
+ innerRadius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(2048)),
2109
+ });
2110
+
2111
+ export const svgRingShapeSchema = svgshapesSvgRingShapeSchema;
2112
+
2113
+ /**
2114
+ * A star shape with a specified number of points.
2115
+ * The star is defined by outer and inner radii, creating the characteristic
2116
+ * pointed appearance.
2117
+ *
2118
+ */
2119
+ export const svgshapesSvgStarShapeSchema = z.object({
2120
+ type: z.enum(["star"]),
2121
+ points: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(3).lte(100)),
2122
+ outerRadius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
2123
+ innerRadius: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(1).lte(2048)),
2124
+ });
2125
+
2126
+ export const svgStarShapeSchema = svgshapesSvgStarShapeSchema;
2127
+
2128
+ /**
2129
+ * The shape definition for an SVG asset. Each shape type has its own specific
2130
+ * properties. The `type` field determines which shape is rendered.
2131
+ *
2132
+ */
2133
+ export const svgshapesSvgShapeSchema = z.discriminatedUnion("type", [
2134
+ svgshapesSvgRectangleShapeSchema,
2135
+ svgshapesSvgCircleShapeSchema,
2136
+ svgshapesSvgEllipseShapeSchema,
2137
+ svgshapesSvgLineShapeSchema,
2138
+ svgshapesSvgPolygonShapeSchema,
2139
+ svgshapesSvgStarShapeSchema,
2140
+ svgshapesSvgArrowShapeSchema,
2141
+ svgshapesSvgHeartShapeSchema,
2142
+ svgshapesSvgCrossShapeSchema,
2143
+ svgshapesSvgRingShapeSchema,
2144
+ svgshapesSvgPathShapeSchema,
2145
+ ]);
2146
+
2147
+ export const svgShapeSchema = svgshapesSvgShapeSchema;
2148
+
2149
+ /**
2150
+ * The SvgAsset is used to add scalable vector graphics (SVG) shapes to a video.
2151
+ * It provides a comprehensive set of primitive shapes and custom paths with full
2152
+ * styling support including fills, strokes, gradients, and shadows.
2153
+ *
2154
+ * **Available Shapes:**
2155
+ * - `rectangle` - Rectangles with optional rounded corners
2156
+ * - `circle` - Perfect circles
2157
+ * - `ellipse` - Ellipses/ovals with separate x and y radii
2158
+ * - `line` - Straight lines with configurable thickness
2159
+ * - `polygon` - Regular polygons (triangle, pentagon, hexagon, etc.)
2160
+ * - `star` - Multi-pointed stars
2161
+ * - `arrow` - Directional arrows
2162
+ * - `heart` - Heart shapes
2163
+ * - `cross` - Plus/cross shapes
2164
+ * - `ring` - Donut/ring shapes
2165
+ * - `path` - Custom shapes using SVG path data
2166
+ *
2167
+ * **Styling Options:**
2168
+ * - Fill with solid colors or linear/radial gradients
2169
+ * - Stroke with configurable width, color, dash patterns, and line caps/joins
2170
+ * - Drop shadows with blur, offset, and opacity
2171
+ * - Transform properties for positioning, rotation, and scaling
2172
+ *
2173
+ * See [W3C SVG 2 Specification](https://www.w3.org/TR/SVG2/) for path data syntax.
2174
+ *
2175
+ */
2176
+ export const svgassetSvgAssetSchema = z.object({
2177
+ type: z.enum(["svg"]),
2178
+ shape: svgshapesSvgShapeSchema,
2179
+ fill: z.optional(svgpropertiesSvgFillSchema),
2180
+ stroke: z.optional(svgpropertiesSvgStrokeSchema),
2181
+ shadow: z.optional(svgpropertiesSvgShadowSchema),
2182
+ transform: z.optional(svgpropertiesSvgTransformSchema),
2183
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))).default(1),
2184
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(4096))),
2185
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(4096))),
2186
+ });
2187
+
2188
+ export const svgAssetSchema = svgassetSvgAssetSchema;
2189
+
1855
2190
  /**
1856
2191
  * Configure the id and optional merge fields to render a template by id.
1857
2192
  */
@@ -1877,7 +2212,7 @@ export const textAlignmentSchema = textpropertiesTextAlignmentSchema;
1877
2212
  */
1878
2213
  export const textpropertiesTextAnimationSchema = z.object({
1879
2214
  preset: z.enum(["typewriter"]),
1880
- duration: z.optional(z.number().gte(0.1).lte(30)),
2215
+ duration: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0.1).lte(30))),
1881
2216
  });
1882
2217
 
1883
2218
  /**
@@ -1885,9 +2220,9 @@ export const textpropertiesTextAnimationSchema = z.object({
1885
2220
  */
1886
2221
  export const textpropertiesTextBackgroundSchema = z.object({
1887
2222
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)),
1888
- opacity: z.optional(z.number().gte(0).lte(1)),
1889
- padding: z.optional(z.number().gte(0).lte(100)),
1890
- borderRadius: z.optional(z.number().gte(0)),
2223
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1))),
2224
+ padding: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(100))),
2225
+ borderRadius: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0))),
1891
2226
  });
1892
2227
 
1893
2228
  export const textBackgroundSchema = textpropertiesTextBackgroundSchema;
@@ -1898,10 +2233,10 @@ export const textBackgroundSchema = textpropertiesTextBackgroundSchema;
1898
2233
  export const textpropertiesTextFontSchema = z.object({
1899
2234
  family: z.optional(z.string()),
1900
2235
  color: z.optional(z.string()),
1901
- opacity: z.optional(z.number()),
1902
- size: z.optional(z.int()),
1903
- weight: z.optional(z.int()),
1904
- lineHeight: z.optional(z.number()),
2236
+ opacity: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
2237
+ size: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
2238
+ weight: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
2239
+ lineHeight: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
1905
2240
  });
1906
2241
 
1907
2242
  export const textFontSchema = textpropertiesTextFontSchema;
@@ -1910,7 +2245,7 @@ export const textFontSchema = textpropertiesTextFontSchema;
1910
2245
  * Text stroke (outline) properties.
1911
2246
  */
1912
2247
  export const textpropertiesTextStrokeSchema = z.object({
1913
- width: z.optional(z.number().gte(0).lte(10)),
2248
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
1914
2249
  color: z.optional(z.string().regex(/^#[A-Fa-f0-9]{6}$/)),
1915
2250
  });
1916
2251
 
@@ -1922,8 +2257,8 @@ export const textpropertiesTextStrokeSchema = z.object({
1922
2257
  export const textassetTextAssetSchema = z.object({
1923
2258
  type: z.enum(["text"]),
1924
2259
  text: z.string(),
1925
- width: z.optional(z.int()),
1926
- height: z.optional(z.int()),
2260
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
2261
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1927
2262
  font: z.optional(textpropertiesTextFontSchema),
1928
2263
  background: z.optional(textpropertiesTextBackgroundSchema),
1929
2264
  alignment: z.optional(textpropertiesTextAlignmentSchema),
@@ -1940,8 +2275,8 @@ export const textAssetSchema = textassetTextAssetSchema;
1940
2275
  export const texttoimageassetTextToImageAssetSchema = z.object({
1941
2276
  type: z.enum(["text-to-image"]),
1942
2277
  prompt: z.string(),
1943
- width: z.optional(z.int()),
1944
- height: z.optional(z.int()),
2278
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
2279
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int())),
1945
2280
  crop: z.optional(cropCropSchema),
1946
2281
  });
1947
2282
 
@@ -1951,8 +2286,8 @@ export const textToImageAssetSchema = texttoimageassetTextToImageAssetSchema;
1951
2286
  * Generate a thumbnail image for the video or image at a specific point from the timeline.
1952
2287
  */
1953
2288
  export const thumbnailThumbnailSchema = z.object({
1954
- capture: z.number(),
1955
- scale: z.number().gte(0).lte(1),
2289
+ capture: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()),
2290
+ scale: z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1)),
1956
2291
  });
1957
2292
 
1958
2293
  export const thumbnailSchema = thumbnailThumbnailSchema;
@@ -2147,8 +2482,8 @@ export const transitionSchema = transitionTransitionSchema;
2147
2482
  export const tweenTweenSchema = z.object({
2148
2483
  from: z.optional(z.unknown()),
2149
2484
  to: z.optional(z.unknown()),
2150
- start: z.optional(z.number()),
2151
- length: z.optional(z.number()),
2485
+ start: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
2486
+ length: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
2152
2487
  interpolation: z.optional(z.enum(["linear", "bezier", "constant"])),
2153
2488
  easing: z.optional(
2154
2489
  z.enum([
@@ -2192,11 +2527,11 @@ export const tweenSchema = tweenTweenSchema;
2192
2527
  export const audioassetAudioAssetSchema = z.object({
2193
2528
  type: z.enum(["audio"]),
2194
2529
  src: z.string(),
2195
- trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
2530
+ 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()))),
2196
2531
  volume: z.optional(
2197
- z.union([z.number().gte(0).lte(1), z.array(tweenTweenSchema)])
2532
+ z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1)), z.array(tweenTweenSchema)])
2198
2533
  ),
2199
- speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
2534
+ 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)))),
2200
2535
  effect: z.optional(z.enum(["none", "fadeIn", "fadeOut", "fadeInFadeOut"])),
2201
2536
  });
2202
2537
 
@@ -2207,10 +2542,10 @@ export const audioAssetSchema = audioassetAudioAssetSchema;
2207
2542
  */
2208
2543
  export const offsetOffsetSchema = z.object({
2209
2544
  x: z.optional(
2210
- z.union([z.number().gte(-10).lte(10), z.array(tweenTweenSchema)])
2545
+ z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(-10).lte(10)), z.array(tweenTweenSchema)])
2211
2546
  ),
2212
2547
  y: z.optional(
2213
- z.union([z.number().gte(-10).lte(10), z.array(tweenTweenSchema)])
2548
+ z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(-10).lte(10)), z.array(tweenTweenSchema)])
2214
2549
  ),
2215
2550
  });
2216
2551
 
@@ -2221,7 +2556,7 @@ export const offsetSchema = offsetOffsetSchema;
2221
2556
  */
2222
2557
  export const rotatetransformationRotateTransformationSchema = z.object({
2223
2558
  angle: z.optional(
2224
- z.union([z.int().gte(-360).lte(360), z.array(tweenTweenSchema)])
2559
+ z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(-360).lte(360)), z.array(tweenTweenSchema)])
2225
2560
  ),
2226
2561
  });
2227
2562
 
@@ -2233,10 +2568,10 @@ export const rotateTransformationSchema =
2233
2568
  */
2234
2569
  export const skewtransformationSkewTransformationSchema = z.object({
2235
2570
  x: z.optional(
2236
- z.union([z.number().gte(-100).lte(100), z.array(tweenTweenSchema)])
2571
+ z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(-100).lte(100)), z.array(tweenTweenSchema)])
2237
2572
  ),
2238
2573
  y: z.optional(
2239
- z.union([z.number().gte(-100).lte(100), z.array(tweenTweenSchema)])
2574
+ z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(-100).lte(100)), z.array(tweenTweenSchema)])
2240
2575
  ),
2241
2576
  });
2242
2577
 
@@ -2316,15 +2651,15 @@ export const transformationSchema = transformationTransformationSchema;
2316
2651
  export const videoassetVideoAssetSchema = z.object({
2317
2652
  type: z.enum(["video"]),
2318
2653
  src: z.string(),
2319
- transcode: z.optional(z.boolean()).default(false),
2320
- trim: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
2654
+ transcode: z.optional(z.boolean()),
2655
+ 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()))),
2321
2656
  volume: z.optional(
2322
- z.union([z.number().gte(0).lte(1), z.array(tweenTweenSchema)])
2657
+ z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(1)), z.array(tweenTweenSchema)])
2323
2658
  ),
2324
2659
  volumeEffect: z.optional(
2325
2660
  z.enum(["none", "fadeIn", "fadeOut", "fadeInFadeOut"])
2326
2661
  ),
2327
- speed: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number().gte(0).lte(10))),
2662
+ 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)))),
2328
2663
  crop: z.optional(cropCropSchema),
2329
2664
  chromaKey: z.optional(chromakeyChromaKeySchema),
2330
2665
  });
@@ -2345,6 +2680,7 @@ export const assetAssetSchema = z.discriminatedUnion("type", [
2345
2680
  htmlassetHtmlAssetSchema,
2346
2681
  titleassetTitleAssetSchema,
2347
2682
  shapeassetShapeAssetSchema,
2683
+ svgassetSvgAssetSchema,
2348
2684
  texttoimageassetTextToImageAssetSchema,
2349
2685
  imagetovideoassetImageToVideoAssetSchema,
2350
2686
  ]);
@@ -2356,12 +2692,12 @@ export const assetSchema = assetAssetSchema;
2356
2692
  */
2357
2693
  export const clipClipSchema = z.object({
2358
2694
  asset: assetAssetSchema,
2359
- start: z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()), z.enum(["auto"])]),
2360
- length: z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()), z.literal("auto"), z.literal("end")]),
2695
+ 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"])]),
2696
+ 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")]),
2361
2697
  fit: z.optional(z.enum(["cover", "contain", "crop", "none"])),
2362
- scale: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
2363
- width: z.optional(z.int().gte(1).lte(3840)),
2364
- height: z.optional(z.int().gte(1).lte(2160)),
2698
+ 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()))),
2699
+ width: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(3840))),
2700
+ height: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.int().gte(1).lte(2160))),
2365
2701
  position: z.optional(
2366
2702
  z.enum([
2367
2703
  "top",
@@ -2412,7 +2748,7 @@ export const clipClipSchema = z.object({
2412
2748
  "negative",
2413
2749
  ])
2414
2750
  ),
2415
- opacity: z.optional(z.union([z.number(), z.array(tweenTweenSchema)])),
2751
+ opacity: z.optional(z.union([z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number()), z.array(tweenTweenSchema)])),
2416
2752
  transform: z.optional(transformationTransformationSchema),
2417
2753
  alias: z.optional(z.string().regex(/^[A-Za-z0-9_-]+$/)),
2418
2754
  });
@@ -2471,8 +2807,8 @@ export const renderresponsedataRenderResponseDataSchema = z.object({
2471
2807
  "failed",
2472
2808
  ]),
2473
2809
  error: z.optional(z.string()),
2474
- duration: z.optional(z.number()),
2475
- renderTime: z.optional(z.number()),
2810
+ duration: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
2811
+ renderTime: z.optional(z.preprocess((val) => typeof val === 'string' && val !== '' && !isNaN(Number(val)) ? Number(val) : val, z.number())),
2476
2812
  url: z.optional(z.string()),
2477
2813
  poster: z.optional(z.union([z.string(), z.null()])),
2478
2814
  thumbnail: z.optional(z.union([z.string(), z.null()])),