@shotstack/schemas 1.5.5 → 1.5.7

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.
@@ -1307,6 +1307,73 @@ export const templateresponseTemplateResponseSchema = z.object({
1307
1307
  response: templateresponsedataTemplateResponseDataSchema,
1308
1308
  });
1309
1309
  export const templateResponseSchema = templateresponseTemplateResponseSchema;
1310
+ /**
1311
+ * Font properties for the active/highlighted word.
1312
+ */
1313
+ export const richcaptionpropertiesRichCaptionActiveFontSchema = z.object({
1314
+ color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#ffff00"),
1315
+ background: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
1316
+ opacity: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1317
+ return undefined; if (Array.isArray(v))
1318
+ return v; if (typeof v === 'string') {
1319
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
1320
+ return v;
1321
+ return Number(v);
1322
+ } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
1323
+ });
1324
+ export const richCaptionActiveFontSchema = richcaptionpropertiesRichCaptionActiveFontSchema;
1325
+ /**
1326
+ * Word-level animation properties for caption effects.
1327
+ */
1328
+ export const richcaptionpropertiesRichCaptionWordAnimationSchema = z.object({
1329
+ style: z.enum([
1330
+ "karaoke",
1331
+ "highlight",
1332
+ "pop",
1333
+ "fade",
1334
+ "slide",
1335
+ "bounce",
1336
+ "typewriter",
1337
+ "none",
1338
+ ]),
1339
+ speed: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1340
+ return undefined; if (Array.isArray(v))
1341
+ return v; if (typeof v === 'string') {
1342
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
1343
+ return v;
1344
+ return Number(v);
1345
+ } return v; }), z.number().gte(0.5).lte(2)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
1346
+ direction: z.optional(z.enum(["left", "right", "up", "down"])),
1347
+ });
1348
+ export const richCaptionWordAnimationSchema = richcaptionpropertiesRichCaptionWordAnimationSchema;
1349
+ /**
1350
+ * Word-level timing information for caption animation.
1351
+ */
1352
+ export const richcaptionpropertiesWordTimingSchema = z.object({
1353
+ text: z.string().min(1),
1354
+ start: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1355
+ return undefined; if (Array.isArray(v))
1356
+ return v; if (typeof v === 'string') {
1357
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
1358
+ return v;
1359
+ return Number(v);
1360
+ } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
1361
+ end: z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1362
+ return undefined; if (Array.isArray(v))
1363
+ return v; if (typeof v === 'string') {
1364
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
1365
+ return v;
1366
+ return Number(v);
1367
+ } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
1368
+ confidence: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1369
+ return undefined; if (Array.isArray(v))
1370
+ return v; if (typeof v === 'string') {
1371
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
1372
+ return v;
1373
+ return Number(v);
1374
+ } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
1375
+ });
1376
+ export const wordTimingSchema = richcaptionpropertiesWordTimingSchema;
1310
1377
  /**
1311
1378
  * Text alignment properties (horizontal and vertical).
1312
1379
  */
@@ -1501,6 +1568,21 @@ export const richtextpropertiesRichTextStrokeSchema = z.object({
1501
1568
  } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
1502
1569
  });
1503
1570
  export const richTextStrokeSchema = richtextpropertiesRichTextStrokeSchema;
1571
+ /**
1572
+ * Styling properties for the active/highlighted word.
1573
+ */
1574
+ export const richcaptionpropertiesRichCaptionActiveSchema = z.object({
1575
+ font: z.optional(richcaptionpropertiesRichCaptionActiveFontSchema),
1576
+ stroke: z.optional(richtextpropertiesRichTextStrokeSchema),
1577
+ scale: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1578
+ return undefined; if (Array.isArray(v))
1579
+ return v; if (typeof v === 'string') {
1580
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
1581
+ return v;
1582
+ return Number(v);
1583
+ } return v; }), z.number().gte(0.5).lte(2)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
1584
+ });
1585
+ export const richCaptionActiveSchema = richcaptionpropertiesRichCaptionActiveSchema;
1504
1586
  /**
1505
1587
  * Font properties for rich text.
1506
1588
  */
@@ -1514,7 +1596,7 @@ export const richtextpropertiesRichTextFontSchema = z.object({
1514
1596
  return Number(v);
1515
1597
  } return v; }), z.number().int().gte(1).lte(500)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),
1516
1598
  weight: z.optional(z.unknown()).default("400"),
1517
- color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#ffffff"),
1599
+ color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),
1518
1600
  opacity: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1519
1601
  return undefined; if (Array.isArray(v))
1520
1602
  return v; if (typeof v === 'string') {
@@ -1537,6 +1619,13 @@ export const richtextpropertiesRichTextStyleSchema = z.object({
1537
1619
  return v;
1538
1620
  return Number(v);
1539
1621
  } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
1622
+ wordSpacing: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1623
+ return undefined; if (Array.isArray(v))
1624
+ return v; if (typeof v === 'string') {
1625
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
1626
+ return v;
1627
+ return Number(v);
1628
+ } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
1540
1629
  lineHeight: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1541
1630
  return undefined; if (Array.isArray(v))
1542
1631
  return v; if (typeof v === 'string') {
@@ -1549,6 +1638,48 @@ export const richtextpropertiesRichTextStyleSchema = z.object({
1549
1638
  gradient: z.optional(richtextpropertiesRichTextGradientSchema),
1550
1639
  });
1551
1640
  export const richTextStyleSchema = richtextpropertiesRichTextStyleSchema;
1641
+ /**
1642
+ * The RichCaptionAsset provides word-level caption animations with rich-text styling. It supports
1643
+ * karaoke-style highlighting, word-by-word animations, and advanced typography. Use with SRT/VTT
1644
+ * files or auto-transcription via aliases.
1645
+ *
1646
+ */
1647
+ export const richcaptionassetRichCaptionAssetSchema = z.object({
1648
+ type: z.enum(["rich-caption"]),
1649
+ src: z.optional(z.string().min(1)),
1650
+ words: z.optional(z.array(richcaptionpropertiesWordTimingSchema).max(100000)),
1651
+ font: z.optional(richtextpropertiesRichTextFontSchema),
1652
+ style: z.optional(richtextpropertiesRichTextStyleSchema),
1653
+ stroke: z.optional(richtextpropertiesRichTextStrokeSchema),
1654
+ shadow: z.optional(richtextpropertiesRichTextShadowSchema),
1655
+ background: z.optional(richtextpropertiesRichTextBackgroundSchema),
1656
+ padding: z.optional(z.union([z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1657
+ return undefined; if (Array.isArray(v))
1658
+ return v; if (typeof v === 'string') {
1659
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
1660
+ return v;
1661
+ return Number(v);
1662
+ } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]), richtextpropertiesRichTextPaddingSchema])),
1663
+ align: z.optional(richtextpropertiesRichTextAlignmentSchema),
1664
+ active: z.optional(richcaptionpropertiesRichCaptionActiveSchema),
1665
+ wordAnimation: z.optional(richcaptionpropertiesRichCaptionWordAnimationSchema),
1666
+ position: z.optional(z.enum(["top", "center", "bottom"])),
1667
+ maxWidth: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1668
+ return undefined; if (Array.isArray(v))
1669
+ return v; if (typeof v === 'string') {
1670
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
1671
+ return v;
1672
+ return Number(v);
1673
+ } return v; }), z.number().gte(0.1).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.9),
1674
+ maxLines: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1675
+ return undefined; if (Array.isArray(v))
1676
+ return v; if (typeof v === 'string') {
1677
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
1678
+ return v;
1679
+ return Number(v);
1680
+ } return v; }), z.number().int().gte(1).lte(10)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(2),
1681
+ });
1682
+ export const richCaptionAssetSchema = richcaptionassetRichCaptionAssetSchema;
1552
1683
  /**
1553
1684
  * The RichTextAsset provides advanced text rendering with support for custom fonts, gradients, shadows, strokes,
1554
1685
  * animations, and styling options. It offers more flexibility and visual effects than the basic TextAsset.
@@ -3172,6 +3303,7 @@ export const assetAssetSchema = z.discriminatedUnion("type", [
3172
3303
  audioassetAudioAssetSchema,
3173
3304
  lumaassetLumaAssetSchema,
3174
3305
  captionassetCaptionAssetSchema,
3306
+ richcaptionassetRichCaptionAssetSchema,
3175
3307
  htmlassetHtmlAssetSchema,
3176
3308
  titleassetTitleAssetSchema,
3177
3309
  shapeassetShapeAssetSchema,
@@ -3281,8 +3413,11 @@ export const clipClipSchema = z.object({
3281
3413
  } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]), z.array(tweenTweenSchema)])),
3282
3414
  transform: z.optional(transformationTransformationSchema),
3283
3415
  alias: z.optional(z.union([z.string().regex(/^[A-Za-z0-9_-]+$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
3284
- }).transform((clip) => {
3285
- // Remove 'fit' property for asset types that don't support it
3416
+ });
3417
+ export const clipSchema = clipClipSchema;
3418
+ // Clip schema with fit property filter for rich-text assets
3419
+ // This removes the 'fit' property when asset type is 'rich-text'
3420
+ const clipClipSchemaWithFitFilter = clipClipSchema.transform((clip) => {
3286
3421
  if (clip.asset && typeof clip.asset === 'object' && 'type' in clip.asset) {
3287
3422
  const assetType = clip.asset.type;
3288
3423
  if (assetType === 'rich-text') {
@@ -3292,12 +3427,11 @@ export const clipClipSchema = z.object({
3292
3427
  }
3293
3428
  return clip;
3294
3429
  });
3295
- export const clipSchema = clipClipSchema;
3296
3430
  /**
3297
3431
  * A track contains an array of clips. Tracks are layered on top of each other in the order in the array. The top most track will render on top of those below it.
3298
3432
  */
3299
3433
  export const trackTrackSchema = z.object({
3300
- clips: z.array(clipClipSchema).min(1),
3434
+ clips: z.array(clipClipSchemaWithFitFilter).min(1),
3301
3435
  });
3302
3436
  export const trackSchema = trackTrackSchema;
3303
3437
  /**
@@ -1380,6 +1380,51 @@ export const templateresponseTemplateResponseSchema = z.object({
1380
1380
 
1381
1381
  export const templateResponseSchema = templateresponseTemplateResponseSchema;
1382
1382
 
1383
+ /**
1384
+ * Font properties for the active/highlighted word.
1385
+ */
1386
+ export const richcaptionpropertiesRichCaptionActiveFontSchema = z.object({
1387
+ color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#ffff00"),
1388
+ background: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
1389
+ opacity: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
1390
+ });
1391
+
1392
+ export const richCaptionActiveFontSchema =
1393
+ richcaptionpropertiesRichCaptionActiveFontSchema;
1394
+
1395
+ /**
1396
+ * Word-level animation properties for caption effects.
1397
+ */
1398
+ export const richcaptionpropertiesRichCaptionWordAnimationSchema = z.object({
1399
+ style: z.enum([
1400
+ "karaoke",
1401
+ "highlight",
1402
+ "pop",
1403
+ "fade",
1404
+ "slide",
1405
+ "bounce",
1406
+ "typewriter",
1407
+ "none",
1408
+ ]),
1409
+ speed: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0.5).lte(2)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
1410
+ direction: z.optional(z.enum(["left", "right", "up", "down"])),
1411
+ });
1412
+
1413
+ export const richCaptionWordAnimationSchema =
1414
+ richcaptionpropertiesRichCaptionWordAnimationSchema;
1415
+
1416
+ /**
1417
+ * Word-level timing information for caption animation.
1418
+ */
1419
+ export const richcaptionpropertiesWordTimingSchema = z.object({
1420
+ text: z.string().min(1),
1421
+ start: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
1422
+ end: z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
1423
+ confidence: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
1424
+ });
1425
+
1426
+ export const wordTimingSchema = richcaptionpropertiesWordTimingSchema;
1427
+
1383
1428
  /**
1384
1429
  * Text alignment properties (horizontal and vertical).
1385
1430
  */
@@ -1485,6 +1530,18 @@ export const richtextpropertiesRichTextStrokeSchema = z.object({
1485
1530
 
1486
1531
  export const richTextStrokeSchema = richtextpropertiesRichTextStrokeSchema;
1487
1532
 
1533
+ /**
1534
+ * Styling properties for the active/highlighted word.
1535
+ */
1536
+ export const richcaptionpropertiesRichCaptionActiveSchema = z.object({
1537
+ font: z.optional(richcaptionpropertiesRichCaptionActiveFontSchema),
1538
+ stroke: z.optional(richtextpropertiesRichTextStrokeSchema),
1539
+ scale: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0.5).lte(2)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
1540
+ });
1541
+
1542
+ export const richCaptionActiveSchema =
1543
+ richcaptionpropertiesRichCaptionActiveSchema;
1544
+
1488
1545
  /**
1489
1546
  * Font properties for rich text.
1490
1547
  */
@@ -1492,7 +1549,7 @@ export const richtextpropertiesRichTextFontSchema = z.object({
1492
1549
  family: z.optional(z.string()).default("Open Sans"),
1493
1550
  size: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().int().gte(1).lte(500)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),
1494
1551
  weight: z.optional(z.unknown()).default("400"),
1495
- color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#ffffff"),
1552
+ color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default("#000000"),
1496
1553
  opacity: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
1497
1554
  background: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
1498
1555
  stroke: z.optional(richtextpropertiesRichTextStrokeSchema),
@@ -1505,6 +1562,7 @@ export const richTextFontSchema = richtextpropertiesRichTextFontSchema;
1505
1562
  */
1506
1563
  export const richtextpropertiesRichTextStyleSchema = z.object({
1507
1564
  letterSpacing: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
1565
+ wordSpacing: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0),
1508
1566
  lineHeight: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0).lte(10)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1.2),
1509
1567
  textTransform: z.optional(
1510
1568
  z.enum(["none", "uppercase", "lowercase", "capitalize"]),
@@ -1515,6 +1573,36 @@ export const richtextpropertiesRichTextStyleSchema = z.object({
1515
1573
 
1516
1574
  export const richTextStyleSchema = richtextpropertiesRichTextStyleSchema;
1517
1575
 
1576
+ /**
1577
+ * The RichCaptionAsset provides word-level caption animations with rich-text styling. It supports
1578
+ * karaoke-style highlighting, word-by-word animations, and advanced typography. Use with SRT/VTT
1579
+ * files or auto-transcription via aliases.
1580
+ *
1581
+ */
1582
+ export const richcaptionassetRichCaptionAssetSchema = z.object({
1583
+ type: z.enum(["rich-caption"]),
1584
+ src: z.optional(z.string().min(1)),
1585
+ words: z.optional(z.array(richcaptionpropertiesWordTimingSchema).max(100000)),
1586
+ font: z.optional(richtextpropertiesRichTextFontSchema),
1587
+ style: z.optional(richtextpropertiesRichTextStyleSchema),
1588
+ stroke: z.optional(richtextpropertiesRichTextStrokeSchema),
1589
+ shadow: z.optional(richtextpropertiesRichTextShadowSchema),
1590
+ background: z.optional(richtextpropertiesRichTextBackgroundSchema),
1591
+ padding: z.optional(
1592
+ z.union([z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]), richtextpropertiesRichTextPaddingSchema]),
1593
+ ),
1594
+ align: z.optional(richtextpropertiesRichTextAlignmentSchema),
1595
+ active: z.optional(richcaptionpropertiesRichCaptionActiveSchema),
1596
+ wordAnimation: z.optional(
1597
+ richcaptionpropertiesRichCaptionWordAnimationSchema,
1598
+ ),
1599
+ position: z.optional(z.enum(["top", "center", "bottom"])),
1600
+ maxWidth: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().gte(0.1).lte(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(0.9),
1601
+ maxLines: z.optional(z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number().int().gte(1).lte(10)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(2),
1602
+ });
1603
+
1604
+ export const richCaptionAssetSchema = richcaptionassetRichCaptionAssetSchema;
1605
+
1518
1606
  /**
1519
1607
  * The RichTextAsset provides advanced text rendering with support for custom fonts, gradients, shadows, strokes,
1520
1608
  * animations, and styling options. It offers more flexibility and visual effects than the basic TextAsset.
@@ -2719,6 +2807,7 @@ export const assetAssetSchema = z.discriminatedUnion("type", [
2719
2807
  audioassetAudioAssetSchema,
2720
2808
  lumaassetLumaAssetSchema,
2721
2809
  captionassetCaptionAssetSchema,
2810
+ richcaptionassetRichCaptionAssetSchema,
2722
2811
  htmlassetHtmlAssetSchema,
2723
2812
  titleassetTitleAssetSchema,
2724
2813
  shapeassetShapeAssetSchema,
@@ -2800,8 +2889,13 @@ export const clipClipSchema = z.object({
2800
2889
  opacity: z.optional(z.union([z.union([z.preprocess(((v: unknown) => { if (v === '' || v === null || v === undefined) return undefined; if (Array.isArray(v)) return v; if (typeof v === 'string') { if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v)) return v; return Number(v); } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]), z.array(tweenTweenSchema)])),
2801
2890
  transform: z.optional(transformationTransformationSchema),
2802
2891
  alias: z.optional(z.union([z.string().regex(/^[A-Za-z0-9_-]+$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
2803
- }).transform((clip) => {
2804
- // Remove 'fit' property for asset types that don't support it
2892
+ });
2893
+
2894
+ export const clipSchema = clipClipSchema;
2895
+
2896
+ // Clip schema with fit property filter for rich-text assets
2897
+ // This removes the 'fit' property when asset type is 'rich-text'
2898
+ const clipClipSchemaWithFitFilter = clipClipSchema.transform((clip) => {
2805
2899
  if (clip.asset && typeof clip.asset === 'object' && 'type' in clip.asset) {
2806
2900
  const assetType = clip.asset.type;
2807
2901
  if (assetType === 'rich-text') {
@@ -2812,13 +2906,11 @@ export const clipClipSchema = z.object({
2812
2906
  return clip;
2813
2907
  });
2814
2908
 
2815
- export const clipSchema = clipClipSchema;
2816
-
2817
2909
  /**
2818
2910
  * A track contains an array of clips. Tracks are layered on top of each other in the order in the array. The top most track will render on top of those below it.
2819
2911
  */
2820
2912
  export const trackTrackSchema = z.object({
2821
- clips: z.array(clipClipSchema).min(1),
2913
+ clips: z.array(clipClipSchemaWithFitFilter).min(1),
2822
2914
  });
2823
2915
 
2824
2916
  export const trackSchema = trackTrackSchema;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/schemas",
3
- "version": "1.5.5",
3
+ "version": "1.5.7",
4
4
  "description": "Centralized OpenAPI schemas and TypeScript types for Shotstack API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",