@shotstack/schemas 1.10.7 → 1.10.9

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.
@@ -1111,8 +1111,9 @@ export const richcaptionpropertiesRichCaptionActiveSchema = z.object({
1111
1111
  export const richCaptionActiveSchema = richcaptionpropertiesRichCaptionActiveSchema;
1112
1112
  /**
1113
1113
  * The RichCaptionAsset provides word-level caption animations with rich-text styling. It supports
1114
- * karaoke-style highlighting, word-by-word animations, and advanced typography. Use with SRT/VTT
1115
- * files or auto-transcription via aliases.
1114
+ * karaoke-style highlighting, word-by-word animations, and advanced typography. Captions can be
1115
+ * sourced from SRT/VTT/TTML subtitle files, from audio/video media URLs (auto-transcribed), or
1116
+ * from alias references to other clips in the same timeline.
1116
1117
  *
1117
1118
  */
1118
1119
  export const richcaptionassetRichCaptionAssetSchema = z.object({
@@ -1137,22 +1138,7 @@ export const richcaptionassetRichCaptionAssetSchema = z.object({
1137
1138
  align: z.optional(richtextpropertiesRichTextAlignmentSchema),
1138
1139
  active: z.optional(richcaptionpropertiesRichCaptionActiveSchema),
1139
1140
  animation: z.optional(richcaptionpropertiesRichCaptionAnimationSchema)
1140
- }).strict().superRefine((data, ctx) => {
1141
- if (data.src) {
1142
- try {
1143
- const pathname = new URL(data.src).pathname.toLowerCase();
1144
- const mediaExts = [".m4a", ".mp3", ".wav", ".aac", ".ogg", ".flac", ".wma", ".mp4", ".mov", ".avi", ".mkv", ".webm", ".wmv", ".flv", ".3gp"];
1145
- if (mediaExts.some((ext) => pathname.endsWith(ext))) {
1146
- ctx.addIssue({
1147
- code: z.ZodIssueCode.custom,
1148
- message: "Caption src must be an SRT or VTT subtitle file. To generate captions from a media asset, use an alias reference (e.g. \"alias://my-clip\") instead of a direct URL. See: https://shotstack.io/docs/guide/architecting-an-application/rich-captions/",
1149
- path: ["src"],
1150
- });
1151
- }
1152
- }
1153
- catch { }
1154
- }
1155
- });
1141
+ }).strict();
1156
1142
  export const richCaptionAssetSchema = richcaptionassetRichCaptionAssetSchema;
1157
1143
  /**
1158
1144
  * Font properties for rich text.
@@ -1716,7 +1702,8 @@ export const textpropertiesTextBackgroundSchema = z.object({
1716
1702
  if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
1717
1703
  return v;
1718
1704
  return Number(v);
1719
- } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))
1705
+ } return v; }), z.number().gte(0)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
1706
+ wrap: z.optional(z.boolean())
1720
1707
  }).strict();
1721
1708
  export const textBackgroundSchema = textpropertiesTextBackgroundSchema;
1722
1709
  /**
@@ -1796,7 +1783,15 @@ export const textassetTextAssetSchema = z.object({
1796
1783
  stroke: z.optional(textpropertiesTextStrokeSchema),
1797
1784
  animation: z.optional(textpropertiesTextAnimationSchema),
1798
1785
  ellipsis: z.optional(z.string())
1799
- }).strict();
1786
+ }).strict().superRefine((data, ctx) => {
1787
+ if (data.background && data.background.wrap === true) {
1788
+ ctx.addIssue({
1789
+ code: z.ZodIssueCode.custom,
1790
+ message: "background.wrap is only supported on rich-text and rich-caption assets. For type \"text\", migrate to type \"rich-text\" to use this feature.",
1791
+ path: ["background", "wrap"],
1792
+ });
1793
+ }
1794
+ });
1800
1795
  export const textAssetSchema = textassetTextAssetSchema;
1801
1796
  /**
1802
1797
  * The TextToImageAsset lets you create a dynamic image from a text prompt.
@@ -955,8 +955,9 @@ export const richCaptionActiveSchema = richcaptionpropertiesRichCaptionActiveSch
955
955
 
956
956
  /**
957
957
  * The RichCaptionAsset provides word-level caption animations with rich-text styling. It supports
958
- * karaoke-style highlighting, word-by-word animations, and advanced typography. Use with SRT/VTT
959
- * files or auto-transcription via aliases.
958
+ * karaoke-style highlighting, word-by-word animations, and advanced typography. Captions can be
959
+ * sourced from SRT/VTT/TTML subtitle files, from audio/video media URLs (auto-transcribed), or
960
+ * from alias references to other clips in the same timeline.
960
961
  *
961
962
  */
962
963
  export const richcaptionassetRichCaptionAssetSchema = z.object({
@@ -975,21 +976,7 @@ export const richcaptionassetRichCaptionAssetSchema = z.object({
975
976
  align: z.optional(richtextpropertiesRichTextAlignmentSchema),
976
977
  active: z.optional(richcaptionpropertiesRichCaptionActiveSchema),
977
978
  animation: z.optional(richcaptionpropertiesRichCaptionAnimationSchema)
978
- }).strict().superRefine((data, ctx) => {
979
- if (data.src) {
980
- try {
981
- const pathname = new URL(data.src).pathname.toLowerCase();
982
- const mediaExts = [".m4a",".mp3",".wav",".aac",".ogg",".flac",".wma",".mp4",".mov",".avi",".mkv",".webm",".wmv",".flv",".3gp"];
983
- if (mediaExts.some((ext) => pathname.endsWith(ext))) {
984
- ctx.addIssue({
985
- code: z.ZodIssueCode.custom,
986
- message: "Caption src must be an SRT or VTT subtitle file. To generate captions from a media asset, use an alias reference (e.g. \"alias://my-clip\") instead of a direct URL. See: https://shotstack.io/docs/guide/architecting-an-application/rich-captions/",
987
- path: ["src"],
988
- });
989
- }
990
- } catch {}
991
- }
992
- });
979
+ }).strict();
993
980
 
994
981
  export const richCaptionAssetSchema = richcaptionassetRichCaptionAssetSchema;
995
982
 
@@ -1396,7 +1383,8 @@ export const textpropertiesTextBackgroundSchema = z.object({
1396
1383
  color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
1397
1384
  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*\}\}$/)])),
1398
1385
  padding: 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(100)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
1399
- borderRadius: 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*\}\}$/)]))
1386
+ borderRadius: 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*\}\}$/)])),
1387
+ wrap: z.optional(z.boolean())
1400
1388
  }).strict();
1401
1389
 
1402
1390
  export const textBackgroundSchema = textpropertiesTextBackgroundSchema;
@@ -1439,7 +1427,15 @@ export const textassetTextAssetSchema = z.object({
1439
1427
  stroke: z.optional(textpropertiesTextStrokeSchema),
1440
1428
  animation: z.optional(textpropertiesTextAnimationSchema),
1441
1429
  ellipsis: z.optional(z.string())
1442
- }).strict();
1430
+ }).strict().superRefine((data, ctx) => {
1431
+ if (data.background && data.background.wrap === true) {
1432
+ ctx.addIssue({
1433
+ code: z.ZodIssueCode.custom,
1434
+ message: "background.wrap is only supported on rich-text and rich-caption assets. For type \"text\", migrate to type \"rich-text\" to use this feature.",
1435
+ path: ["background", "wrap"],
1436
+ });
1437
+ }
1438
+ });
1443
1439
 
1444
1440
  export const textAssetSchema = textassetTextAssetSchema;
1445
1441
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/schemas",
3
- "version": "1.10.7",
3
+ "version": "1.10.9",
4
4
  "description": "Centralized OpenAPI schemas and TypeScript types for Shotstack API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",