@shotstack/schemas 1.9.10 → 1.9.12

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.
@@ -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: "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/",
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.
@@ -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: "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/",
986
+ path: ["src"],
987
+ });
988
+ }
989
+ } catch {}
990
+ }
991
+ });
978
992
 
979
993
  export const richCaptionAssetSchema = richcaptionassetRichCaptionAssetSchema;
980
994
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/schemas",
3
- "version": "1.9.10",
3
+ "version": "1.9.12",
4
4
  "description": "Centralized OpenAPI schemas and TypeScript types for Shotstack API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",