@shotstack/schemas 1.13.0 → 1.13.2

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.
@@ -494,7 +494,7 @@ export const imageassetImageAssetSchema = z.object({
494
494
  export const imageAssetSchema = imageassetImageAssetSchema;
495
495
  /**
496
496
  * **Notice: ImageToVideoAsset is deprecated. Use [VideoAsset](#tocs_videoasset)
497
- * with `prompt` and `seed` instead.** This type continues to function and is
497
+ * with `prompt` and `inputSrc` instead.** This type continues to function and is
498
498
  * internally rewritten to VideoAsset; no behaviour change for existing
499
499
  * integrations.
500
500
  *
@@ -1889,7 +1889,7 @@ export const thumbnailThumbnailSchema = z.object({
1889
1889
  }).strict();
1890
1890
  export const thumbnailSchema = thumbnailThumbnailSchema;
1891
1891
  /**
1892
- * The output format, render range and type of media to generate.
1892
+ * The output format, render range and type of media to generate. For all formats except `mp3`, either `resolution` or `size` (with both `width` and `height`) must be specified.
1893
1893
  */
1894
1894
  export const outputOutputSchema = z.object({
1895
1895
  format: z.enum([
@@ -1950,7 +1950,18 @@ export const outputOutputSchema = z.object({
1950
1950
  poster: z.optional(posterPosterSchema),
1951
1951
  thumbnail: z.optional(thumbnailThumbnailSchema),
1952
1952
  destinations: z.optional(z.array(destinationsDestinationsSchema))
1953
- }).strict();
1953
+ }).strict().superRefine((val, ctx) => {
1954
+ var isMp3 = val.format === "mp3";
1955
+ if (!isMp3 && val.size != null && (val.size.width == null || val.size.height == null)) {
1956
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["size"], message: "size requires both width and height" });
1957
+ return;
1958
+ }
1959
+ var hasResolution = typeof val.resolution === "string";
1960
+ var hasSize = val.size != null && val.size.width != null && val.size.height != null;
1961
+ if (!isMp3 && !hasResolution && !hasSize) {
1962
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'output requires either "resolution" or "size" (with width and height)' });
1963
+ }
1964
+ });
1954
1965
  export const outputSchema = outputOutputSchema;
1955
1966
  /**
1956
1967
  * In and out transitions for a clip - i.e. fade in and fade out
@@ -2391,12 +2402,12 @@ export const transformationTransformationSchema = z.object({
2391
2402
  export const transformationSchema = transformationTransformationSchema;
2392
2403
  /**
2393
2404
  * The VideoAsset adds a video to a Clip. The video can be sourced from a URL
2394
- * (`src`) or generated from a text prompt (`prompt`), optionally seeded from a
2395
- * starting image (`seed`). Exactly one of `src` or `prompt` must be provided.
2405
+ * (`src`) or generated from a text prompt (`prompt`), optionally from a
2406
+ * starting image (`inputSrc`). Exactly one of `src` or `prompt` must be provided.
2396
2407
  *
2397
2408
  * - **Source URL:** set `src` to the URL of an mp4 (or compatible) video file.
2398
- * - **Generated:** set `prompt` to describe the motion. Optionally set `seed` to
2399
- * a starting image URL (image-to-video). Use `model` to choose the generator
2409
+ * - **Generated:** set `prompt` to describe the motion. Optionally set `inputSrc`
2410
+ * to a starting image URL (image-to-video). Use `model` to choose the generator
2400
2411
  * (e.g. `luma-ray-3`, `runpod-itv-mini`). The generated `src` is filled in
2401
2412
  * automatically.
2402
2413
  *
@@ -2405,6 +2416,7 @@ export const videoassetVideoAssetSchema = z.object({
2405
2416
  type: z.enum(['video']),
2406
2417
  src: z.optional(z.string().min(1).regex(/\S/)),
2407
2418
  prompt: z.optional(z.string().max(4000)),
2419
+ inputSrc: z.optional(z.string().min(1)),
2408
2420
  seed: z.optional(z.string().min(1)),
2409
2421
  model: z.optional(z.string()),
2410
2422
  transcode: z.optional(z.boolean()),
@@ -444,7 +444,7 @@ export const imageAssetSchema = imageassetImageAssetSchema;
444
444
 
445
445
  /**
446
446
  * **Notice: ImageToVideoAsset is deprecated. Use [VideoAsset](#tocs_videoasset)
447
- * with `prompt` and `seed` instead.** This type continues to function and is
447
+ * with `prompt` and `inputSrc` instead.** This type continues to function and is
448
448
  * internally rewritten to VideoAsset; no behaviour change for existing
449
449
  * integrations.
450
450
  *
@@ -1511,7 +1511,7 @@ export const thumbnailThumbnailSchema = z.object({
1511
1511
  export const thumbnailSchema = thumbnailThumbnailSchema;
1512
1512
 
1513
1513
  /**
1514
- * The output format, render range and type of media to generate.
1514
+ * The output format, render range and type of media to generate. For all formats except `mp3`, either `resolution` or `size` (with both `width` and `height`) must be specified.
1515
1515
  */
1516
1516
  export const outputOutputSchema = z.object({
1517
1517
  format: z.enum([
@@ -1572,7 +1572,18 @@ export const outputOutputSchema = z.object({
1572
1572
  poster: z.optional(posterPosterSchema),
1573
1573
  thumbnail: z.optional(thumbnailThumbnailSchema),
1574
1574
  destinations: z.optional(z.array(destinationsDestinationsSchema))
1575
- }).strict();
1575
+ }).strict().superRefine((val, ctx) => {
1576
+ var isMp3 = val.format === "mp3";
1577
+ if (!isMp3 && val.size != null && (val.size.width == null || val.size.height == null)) {
1578
+ ctx.addIssue({ code: z.ZodIssueCode.custom, path: ["size"], message: "size requires both width and height" });
1579
+ return;
1580
+ }
1581
+ var hasResolution = typeof val.resolution === "string";
1582
+ var hasSize = val.size != null && val.size.width != null && val.size.height != null;
1583
+ if (!isMp3 && !hasResolution && !hasSize) {
1584
+ ctx.addIssue({ code: z.ZodIssueCode.custom, message: 'output requires either "resolution" or "size" (with width and height)' });
1585
+ }
1586
+ });
1576
1587
 
1577
1588
  export const outputSchema = outputOutputSchema;
1578
1589
 
@@ -1955,12 +1966,12 @@ export const transformationSchema = transformationTransformationSchema;
1955
1966
 
1956
1967
  /**
1957
1968
  * The VideoAsset adds a video to a Clip. The video can be sourced from a URL
1958
- * (`src`) or generated from a text prompt (`prompt`), optionally seeded from a
1959
- * starting image (`seed`). Exactly one of `src` or `prompt` must be provided.
1969
+ * (`src`) or generated from a text prompt (`prompt`), optionally from a
1970
+ * starting image (`inputSrc`). Exactly one of `src` or `prompt` must be provided.
1960
1971
  *
1961
1972
  * - **Source URL:** set `src` to the URL of an mp4 (or compatible) video file.
1962
- * - **Generated:** set `prompt` to describe the motion. Optionally set `seed` to
1963
- * a starting image URL (image-to-video). Use `model` to choose the generator
1973
+ * - **Generated:** set `prompt` to describe the motion. Optionally set `inputSrc`
1974
+ * to a starting image URL (image-to-video). Use `model` to choose the generator
1964
1975
  * (e.g. `luma-ray-3`, `runpod-itv-mini`). The generated `src` is filled in
1965
1976
  * automatically.
1966
1977
  *
@@ -1969,6 +1980,7 @@ export const videoassetVideoAssetSchema = z.object({
1969
1980
  type: z.enum(['video']),
1970
1981
  src: z.optional(z.string().min(1).regex(/\S/)),
1971
1982
  prompt: z.optional(z.string().max(4000)),
1983
+ inputSrc: z.optional(z.string().min(1)),
1972
1984
  seed: z.optional(z.string().min(1)),
1973
1985
  model: z.optional(z.string()),
1974
1986
  transcode: z.optional(z.boolean()),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/schemas",
3
- "version": "1.13.0",
3
+ "version": "1.13.2",
4
4
  "description": "Centralized OpenAPI schemas and TypeScript types for Shotstack API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",