@shotstack/schemas 1.9.9 → 1.9.11

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.
@@ -114,7 +114,7 @@ export const captionMarginSchema = captionpropertiesCaptionMarginSchema;
114
114
  * flexibility with styling and layout. For example you can scale, position or crop a video without modifying the
115
115
  * captions.
116
116
  *
117
- * To sync captions with a video or audio file use a [Video](#tocs_videoasset") or [Audio](#tocs_audioasset") with
117
+ * To sync captions with a video or audio file use a [Video](#tocs_videoasset) or [Audio](#tocs_audioasset) with
118
118
  * matching start and end time.
119
119
  *
120
120
  */
@@ -1136,7 +1136,22 @@ export const richcaptionassetRichCaptionAssetSchema = z.object({
1136
1136
  align: z.optional(richtextpropertiesRichTextAlignmentSchema),
1137
1137
  active: z.optional(richcaptionpropertiesRichCaptionActiveSchema),
1138
1138
  animation: z.optional(richcaptionpropertiesRichCaptionAnimationSchema)
1139
- }).strict();
1139
+ }).strict().superRefine((data, ctx) => {
1140
+ if (data.src) {
1141
+ try {
1142
+ const pathname = new URL(data.src).pathname.toLowerCase();
1143
+ const mediaExts = [".m4a", ".mp3", ".wav", ".aac", ".ogg", ".flac", ".wma", ".mp4", ".mov", ".avi", ".mkv", ".webm", ".wmv", ".flv", ".3gp"];
1144
+ if (mediaExts.some((ext) => pathname.endsWith(ext))) {
1145
+ ctx.addIssue({
1146
+ code: z.ZodIssueCode.custom,
1147
+ message: "src must point to a subtitle file (SRT or VTT). Audio and video files are not supported as src. Use the words array to provide word timings directly.",
1148
+ path: ["src"],
1149
+ });
1150
+ }
1151
+ }
1152
+ catch { }
1153
+ }
1154
+ });
1140
1155
  export const richCaptionAssetSchema = richcaptionassetRichCaptionAssetSchema;
1141
1156
  /**
1142
1157
  * Font properties for rich text.
@@ -1620,13 +1635,6 @@ export const soundtrackSchema = soundtrackSoundtrackSchema;
1620
1635
  /**
1621
1636
  * The SvgAsset is used to add scalable vector graphics (SVG) to a video using raw SVG markup.
1622
1637
  *
1623
- * ```json
1624
- * {
1625
- * "type": "svg",
1626
- * "src": "<svg width=\"100\" height=\"100\"><circle cx=\"50\" cy=\"50\" r=\"40\" fill=\"#FF0000\"/></svg>"
1627
- * }
1628
- * ```
1629
- *
1630
1638
  * **Supported elements:** `<path>`, `<rect>`, `<circle>`, `<ellipse>`,
1631
1639
  * `<line>`, `<polygon>`, `<polyline>`
1632
1640
  *
@@ -76,7 +76,7 @@ export const captionMarginSchema = captionpropertiesCaptionMarginSchema;
76
76
  * flexibility with styling and layout. For example you can scale, position or crop a video without modifying the
77
77
  * captions.
78
78
  *
79
- * To sync captions with a video or audio file use a [Video](#tocs_videoasset") or [Audio](#tocs_audioasset") with
79
+ * To sync captions with a video or audio file use a [Video](#tocs_videoasset) or [Audio](#tocs_audioasset) with
80
80
  * matching start and end time.
81
81
  *
82
82
  */
@@ -974,7 +974,21 @@ export const richcaptionassetRichCaptionAssetSchema = z.object({
974
974
  align: z.optional(richtextpropertiesRichTextAlignmentSchema),
975
975
  active: z.optional(richcaptionpropertiesRichCaptionActiveSchema),
976
976
  animation: z.optional(richcaptionpropertiesRichCaptionAnimationSchema)
977
- }).strict();
977
+ }).strict().superRefine((data, ctx) => {
978
+ if (data.src) {
979
+ try {
980
+ const pathname = new URL(data.src).pathname.toLowerCase();
981
+ const mediaExts = [".m4a",".mp3",".wav",".aac",".ogg",".flac",".wma",".mp4",".mov",".avi",".mkv",".webm",".wmv",".flv",".3gp"];
982
+ if (mediaExts.some((ext) => pathname.endsWith(ext))) {
983
+ ctx.addIssue({
984
+ code: z.ZodIssueCode.custom,
985
+ message: "src must point to a subtitle file (SRT or VTT). Audio and video files are not supported as src. Use the words array to provide word timings directly.",
986
+ path: ["src"],
987
+ });
988
+ }
989
+ } catch {}
990
+ }
991
+ });
978
992
 
979
993
  export const richCaptionAssetSchema = richcaptionassetRichCaptionAssetSchema;
980
994
 
@@ -1318,13 +1332,6 @@ export const soundtrackSchema = soundtrackSoundtrackSchema;
1318
1332
  /**
1319
1333
  * The SvgAsset is used to add scalable vector graphics (SVG) to a video using raw SVG markup.
1320
1334
  *
1321
- * ```json
1322
- * {
1323
- * "type": "svg",
1324
- * "src": "<svg width=\"100\" height=\"100\"><circle cx=\"50\" cy=\"50\" r=\"40\" fill=\"#FF0000\"/></svg>"
1325
- * }
1326
- * ```
1327
- *
1328
1335
  * **Supported elements:** `<path>`, `<rect>`, `<circle>`, `<ellipse>`,
1329
1336
  * `<line>`, `<polygon>`, `<polyline>`
1330
1337
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/schemas",
3
- "version": "1.9.9",
3
+ "version": "1.9.11",
4
4
  "description": "Centralized OpenAPI schemas and TypeScript types for Shotstack API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",