@shotstack/schemas 1.15.1 → 1.16.0

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.
@@ -5,6 +5,8 @@ export const sourceRootSchema = z.unknown();
5
5
  export const assetsRootSchema = z.unknown();
6
6
  export const assetsidRootSchema = z.unknown();
7
7
  export const assetsrenderidRootSchema = z.unknown();
8
+ export const generateRootSchema = z.unknown();
9
+ export const generateidRootSchema = z.unknown();
8
10
  export const probeRootSchema = z.unknown();
9
11
  export const renderRootSchema = z.unknown();
10
12
  export const renderidRootSchema = z.unknown();
@@ -466,12 +468,16 @@ export const htmlassetHtmlAssetSchema = z.object({
466
468
  export const htmlAssetSchema = htmlassetHtmlAssetSchema;
467
469
  /**
468
470
  * The ImageAsset adds an image to a Clip. The image can be sourced from a URL
469
- * (`src`) or generated from a text prompt (`prompt`). Exactly one of `src` or
470
- * `prompt` must be provided.
471
+ * (`src`), generated from a text prompt (`prompt`), or both. At least one of
472
+ * `src` or `prompt` must be provided.
471
473
  *
472
474
  * - **Source URL:** set `src` to the publicly accessible URL of a jpg or png file.
473
- * - **Generated:** set `prompt` to describe the image; the engine generates it
474
- * using the provider chosen by `model` and fills `src` in automatically.
475
+ * - **Generated:** set `prompt` to describe the image. Choose a generator with
476
+ * `model` and configure it with model-specific `options`; the engine fills
477
+ * `src` in automatically.
478
+ * - **Both:** `src` acts as a preview placeholder while `prompt` drives
479
+ * generation — the image is regenerated from the prompt at render time.
480
+ * Unchanged prompts and options resolve from the generation cache.
475
481
  *
476
482
  */
477
483
  export const imageassetImageAssetSchema = z.object({
@@ -479,20 +485,7 @@ export const imageassetImageAssetSchema = z.object({
479
485
  src: z.optional(z.string().min(1).regex(/\S/)),
480
486
  prompt: z.optional(z.string().max(4000)),
481
487
  model: z.optional(z.string()),
482
- resolution: z.optional(z.enum([
483
- '1K',
484
- '2K',
485
- '4K'
486
- ])),
487
- aspectRatio: z.optional(z.enum([
488
- '1:1',
489
- '16:9',
490
- '9:16',
491
- '4:3',
492
- '3:4',
493
- '21:9',
494
- '9:21'
495
- ])),
488
+ options: z.optional(z.record(z.string(), z.unknown())),
496
489
  crop: z.optional(cropCropSchema)
497
490
  }).strict().superRefine((data, ctx) => {
498
491
  var hasSrc = typeof data.src === "string" && data.src.trim().length > 0;
@@ -758,6 +751,20 @@ export const assetresponseAssetResponseSchema = z.object({
758
751
  data: assetresponsedataAssetResponseDataSchema
759
752
  }).strict();
760
753
  export const assetResponseSchema = assetresponseAssetResponseSchema;
754
+ /**
755
+ * The status of an on-demand asset generation job. Completed jobs include the public URL of the generated asset.
756
+ */
757
+ export const generationresponseGenerationResponseSchema = z.object({
758
+ id: z.string(),
759
+ status: z.enum([
760
+ 'queued',
761
+ 'processing',
762
+ 'done',
763
+ 'failed'
764
+ ]),
765
+ url: z.optional(z.string()),
766
+ error: z.optional(z.string())
767
+ }).strict();
761
768
  /**
762
769
  * The response received after a [probe request](#inspect-media) is submitted. The probe requests returns data from FFprobe formatted as JSON.
763
770
  */
@@ -2185,34 +2192,27 @@ export const tweenTweenSchema = z.object({
2185
2192
  export const tweenSchema = tweenTweenSchema;
2186
2193
  /**
2187
2194
  * The AudioAsset adds audio to a Clip. The audio can be sourced from a URL
2188
- * (`src`) or generated from a text prompt (`prompt`). Exactly one of `src` or
2189
- * `prompt` must be provided.
2195
+ * (`src`), generated from a text prompt (`prompt`), or both. At least one of
2196
+ * `src` or `prompt` must be provided.
2190
2197
  *
2191
2198
  * - **Source URL:** set `src` to a publicly accessible audio URL (e.g. mp3).
2192
- * - **Generated speech:** set `prompt` to the spoken text and `voice` to a voice
2193
- * identifier (text-to-speech). Optionally set `language`/`newscaster`.
2194
- * - **Generated music or SFX:** set `prompt` describing the sound; omit `voice`.
2195
- * - Use `model` to choose the generator. The generated `src` is filled in
2196
- * automatically.
2199
+ * - **Generated speech:** set `prompt` to the spoken text and choose a
2200
+ * text-to-speech `model`; set the voice via `options`.
2201
+ * - **Generated music or SFX:** set `prompt` describing the sound and choose
2202
+ * a music generation `model`.
2203
+ * - **Both:** `src` acts as a preview placeholder while `prompt` drives
2204
+ * generation — the audio is regenerated from the prompt at render time.
2205
+ * Unchanged prompts and options resolve from the generation cache.
2206
+ * - Use `model` to choose the generator and `options` to configure it. The
2207
+ * generated `src` is filled in automatically.
2197
2208
  *
2198
2209
  */
2199
2210
  export const audioassetAudioAssetSchema = z.object({
2200
2211
  type: z.enum(['audio']),
2201
2212
  src: z.optional(z.string().min(1).regex(/\S/)),
2202
2213
  prompt: z.optional(z.string().max(4000)),
2203
- voice: z.optional(z.string()),
2204
- language: z.optional(z.string()),
2205
- newscaster: z.optional(z.boolean()).default(false),
2206
2214
  model: z.optional(z.string()),
2207
- musicLengthMs: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2208
- return undefined; if (Array.isArray(v))
2209
- return v; if (typeof v === 'string') {
2210
- if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
2211
- return v;
2212
- return Number(v);
2213
- } return v; }), z.number().gte(3000).lte(600000)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
2214
- forceInstrumental: z.optional(z.boolean()).default(false),
2215
- compositionPlan: z.optional(z.string().max(4000)),
2215
+ options: z.optional(z.record(z.string(), z.unknown())),
2216
2216
  trim: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2217
2217
  return undefined; if (Array.isArray(v))
2218
2218
  return v; if (typeof v === 'string') {
@@ -2433,52 +2433,25 @@ export const transformationTransformationSchema = z.object({
2433
2433
  export const transformationSchema = transformationTransformationSchema;
2434
2434
  /**
2435
2435
  * The VideoAsset adds a video to a Clip. The video can be sourced from a URL
2436
- * (`src`) or generated from a text prompt (`prompt`), optionally from a
2437
- * starting image (`inputSrc`). Exactly one of `src` or `prompt` must be provided.
2436
+ * (`src`), generated from a text prompt (`prompt`), or both. At least one of
2437
+ * `src` or `prompt` must be provided.
2438
2438
  *
2439
2439
  * - **Source URL:** set `src` to the URL of an mp4 (or compatible) video file.
2440
- * - **Generated:** set `prompt` to describe the motion. Optionally set `inputSrc`
2441
- * to a starting image URL (image-to-video). Use `model` to choose the generator
2442
- * (e.g. `luma-ray-3`, `runpod-itv-mini`). The generated `src` is filled in
2440
+ * - **Generated:** set `prompt` to describe the motion. Choose a generator
2441
+ * with `model` and configure it with model-specific `options` (including a
2442
+ * starting image for image-to-video). The generated `src` is filled in
2443
2443
  * automatically.
2444
+ * - **Both:** `src` acts as a preview placeholder while `prompt` drives
2445
+ * generation — the video is regenerated from the prompt at render time.
2446
+ * Unchanged prompts and options resolve from the generation cache.
2444
2447
  *
2445
2448
  */
2446
2449
  export const videoassetVideoAssetSchema = z.object({
2447
2450
  type: z.enum(['video']),
2448
2451
  src: z.optional(z.string().min(1).regex(/\S/)),
2449
2452
  prompt: z.optional(z.string().max(4000)),
2450
- inputSrc: z.optional(z.string().min(1)),
2451
2453
  model: z.optional(z.string()),
2452
- resolution: z.optional(z.enum([
2453
- '480p',
2454
- '720p',
2455
- '1080p'
2456
- ])),
2457
- duration: z.optional(z.enum([
2458
- 'auto',
2459
- '4',
2460
- '5',
2461
- '6',
2462
- '7',
2463
- '8',
2464
- '9',
2465
- '10',
2466
- '11',
2467
- '12',
2468
- '13',
2469
- '14',
2470
- '15'
2471
- ])),
2472
- aspectRatio: z.optional(z.enum([
2473
- '1:1',
2474
- '16:9',
2475
- '9:16',
2476
- '4:3',
2477
- '3:4',
2478
- '21:9',
2479
- '9:21'
2480
- ])),
2481
- generateAudio: z.optional(z.boolean()).default(false),
2454
+ options: z.optional(z.record(z.string(), z.unknown())),
2482
2455
  transcode: z.optional(z.boolean()),
2483
2456
  trim: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
2484
2457
  return undefined; if (Array.isArray(v))
@@ -2881,6 +2854,32 @@ export const probeRequest = z.object({
2881
2854
  * FFprobe response formatted as JSON.
2882
2855
  */
2883
2856
  export const probeResponse = proberesponseProbeResponseSchema;
2857
+ export const postGenerateRequest = z.object({
2858
+ body: z.optional(z.object({
2859
+ asset: z.union([
2860
+ imageassetImageAssetSchema,
2861
+ videoassetVideoAssetSchema,
2862
+ audioassetAudioAssetSchema
2863
+ ])
2864
+ })),
2865
+ path: z.optional(z.never()),
2866
+ query: z.optional(z.never())
2867
+ }).strict();
2868
+ /**
2869
+ * The generated asset was already cached and is immediately available.
2870
+ */
2871
+ export const postGenerateResponse = generationresponseGenerationResponseSchema;
2872
+ export const getGenerateRequest = z.object({
2873
+ body: z.optional(z.never()),
2874
+ path: z.object({
2875
+ id: z.string()
2876
+ }),
2877
+ query: z.optional(z.never())
2878
+ }).strict();
2879
+ /**
2880
+ * The generation job has finished (done or failed).
2881
+ */
2882
+ export const getGenerateResponse = generationresponseGenerationResponseSchema;
2884
2883
  export const deleteAssetRequest = z.object({
2885
2884
  body: z.optional(z.never()),
2886
2885
  path: z.object({
@@ -12,6 +12,10 @@ export const assetsidRootSchema = z.unknown();
12
12
 
13
13
  export const assetsrenderidRootSchema = z.unknown();
14
14
 
15
+ export const generateRootSchema = z.unknown();
16
+
17
+ export const generateidRootSchema = z.unknown();
18
+
15
19
  export const probeRootSchema = z.unknown();
16
20
 
17
21
  export const renderRootSchema = z.unknown();
@@ -414,12 +418,16 @@ export const htmlAssetSchema = htmlassetHtmlAssetSchema;
414
418
 
415
419
  /**
416
420
  * The ImageAsset adds an image to a Clip. The image can be sourced from a URL
417
- * (`src`) or generated from a text prompt (`prompt`). Exactly one of `src` or
418
- * `prompt` must be provided.
421
+ * (`src`), generated from a text prompt (`prompt`), or both. At least one of
422
+ * `src` or `prompt` must be provided.
419
423
  *
420
424
  * - **Source URL:** set `src` to the publicly accessible URL of a jpg or png file.
421
- * - **Generated:** set `prompt` to describe the image; the engine generates it
422
- * using the provider chosen by `model` and fills `src` in automatically.
425
+ * - **Generated:** set `prompt` to describe the image. Choose a generator with
426
+ * `model` and configure it with model-specific `options`; the engine fills
427
+ * `src` in automatically.
428
+ * - **Both:** `src` acts as a preview placeholder while `prompt` drives
429
+ * generation — the image is regenerated from the prompt at render time.
430
+ * Unchanged prompts and options resolve from the generation cache.
423
431
  *
424
432
  */
425
433
  export const imageassetImageAssetSchema = z.object({
@@ -427,20 +435,7 @@ export const imageassetImageAssetSchema = z.object({
427
435
  src: z.optional(z.string().min(1).regex(/\S/)),
428
436
  prompt: z.optional(z.string().max(4000)),
429
437
  model: z.optional(z.string()),
430
- resolution: z.optional(z.enum([
431
- '1K',
432
- '2K',
433
- '4K'
434
- ])),
435
- aspectRatio: z.optional(z.enum([
436
- '1:1',
437
- '16:9',
438
- '9:16',
439
- '4:3',
440
- '3:4',
441
- '21:9',
442
- '9:21'
443
- ])),
438
+ options: z.optional(z.record(z.string(), z.unknown())),
444
439
  crop: z.optional(cropCropSchema)
445
440
  }).strict().superRefine((data, ctx) => {
446
441
  var hasSrc = typeof data.src === "string" && data.src.trim().length > 0;
@@ -716,6 +711,21 @@ export const assetresponseAssetResponseSchema = z.object({
716
711
 
717
712
  export const assetResponseSchema = assetresponseAssetResponseSchema;
718
713
 
714
+ /**
715
+ * The status of an on-demand asset generation job. Completed jobs include the public URL of the generated asset.
716
+ */
717
+ export const generationresponseGenerationResponseSchema = z.object({
718
+ id: z.string(),
719
+ status: z.enum([
720
+ 'queued',
721
+ 'processing',
722
+ 'done',
723
+ 'failed'
724
+ ]),
725
+ url: z.optional(z.string()),
726
+ error: z.optional(z.string())
727
+ }).strict();
728
+
719
729
  /**
720
730
  * The response received after a [probe request](#inspect-media) is submitted. The probe requests returns data from FFprobe formatted as JSON.
721
731
  */
@@ -1801,28 +1811,27 @@ export const tweenSchema = tweenTweenSchema;
1801
1811
 
1802
1812
  /**
1803
1813
  * The AudioAsset adds audio to a Clip. The audio can be sourced from a URL
1804
- * (`src`) or generated from a text prompt (`prompt`). Exactly one of `src` or
1805
- * `prompt` must be provided.
1814
+ * (`src`), generated from a text prompt (`prompt`), or both. At least one of
1815
+ * `src` or `prompt` must be provided.
1806
1816
  *
1807
1817
  * - **Source URL:** set `src` to a publicly accessible audio URL (e.g. mp3).
1808
- * - **Generated speech:** set `prompt` to the spoken text and `voice` to a voice
1809
- * identifier (text-to-speech). Optionally set `language`/`newscaster`.
1810
- * - **Generated music or SFX:** set `prompt` describing the sound; omit `voice`.
1811
- * - Use `model` to choose the generator. The generated `src` is filled in
1812
- * automatically.
1818
+ * - **Generated speech:** set `prompt` to the spoken text and choose a
1819
+ * text-to-speech `model`; set the voice via `options`.
1820
+ * - **Generated music or SFX:** set `prompt` describing the sound and choose
1821
+ * a music generation `model`.
1822
+ * - **Both:** `src` acts as a preview placeholder while `prompt` drives
1823
+ * generation — the audio is regenerated from the prompt at render time.
1824
+ * Unchanged prompts and options resolve from the generation cache.
1825
+ * - Use `model` to choose the generator and `options` to configure it. The
1826
+ * generated `src` is filled in automatically.
1813
1827
  *
1814
1828
  */
1815
1829
  export const audioassetAudioAssetSchema = z.object({
1816
1830
  type: z.enum(['audio']),
1817
1831
  src: z.optional(z.string().min(1).regex(/\S/)),
1818
1832
  prompt: z.optional(z.string().max(4000)),
1819
- voice: z.optional(z.string()),
1820
- language: z.optional(z.string()),
1821
- newscaster: z.optional(z.boolean()).default(false),
1822
1833
  model: z.optional(z.string()),
1823
- musicLengthMs: 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(3000).lte(600000)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
1824
- forceInstrumental: z.optional(z.boolean()).default(false),
1825
- compositionPlan: z.optional(z.string().max(4000)),
1834
+ options: z.optional(z.record(z.string(), z.unknown())),
1826
1835
  trim: 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*\}\}$/)])),
1827
1836
  volume: z.optional(z.union([
1828
1837
  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*\}\}$/)]),
@@ -1991,52 +2000,25 @@ export const transformationSchema = transformationTransformationSchema;
1991
2000
 
1992
2001
  /**
1993
2002
  * The VideoAsset adds a video to a Clip. The video can be sourced from a URL
1994
- * (`src`) or generated from a text prompt (`prompt`), optionally from a
1995
- * starting image (`inputSrc`). Exactly one of `src` or `prompt` must be provided.
2003
+ * (`src`), generated from a text prompt (`prompt`), or both. At least one of
2004
+ * `src` or `prompt` must be provided.
1996
2005
  *
1997
2006
  * - **Source URL:** set `src` to the URL of an mp4 (or compatible) video file.
1998
- * - **Generated:** set `prompt` to describe the motion. Optionally set `inputSrc`
1999
- * to a starting image URL (image-to-video). Use `model` to choose the generator
2000
- * (e.g. `luma-ray-3`, `runpod-itv-mini`). The generated `src` is filled in
2007
+ * - **Generated:** set `prompt` to describe the motion. Choose a generator
2008
+ * with `model` and configure it with model-specific `options` (including a
2009
+ * starting image for image-to-video). The generated `src` is filled in
2001
2010
  * automatically.
2011
+ * - **Both:** `src` acts as a preview placeholder while `prompt` drives
2012
+ * generation — the video is regenerated from the prompt at render time.
2013
+ * Unchanged prompts and options resolve from the generation cache.
2002
2014
  *
2003
2015
  */
2004
2016
  export const videoassetVideoAssetSchema = z.object({
2005
2017
  type: z.enum(['video']),
2006
2018
  src: z.optional(z.string().min(1).regex(/\S/)),
2007
2019
  prompt: z.optional(z.string().max(4000)),
2008
- inputSrc: z.optional(z.string().min(1)),
2009
2020
  model: z.optional(z.string()),
2010
- resolution: z.optional(z.enum([
2011
- '480p',
2012
- '720p',
2013
- '1080p'
2014
- ])),
2015
- duration: z.optional(z.enum([
2016
- 'auto',
2017
- '4',
2018
- '5',
2019
- '6',
2020
- '7',
2021
- '8',
2022
- '9',
2023
- '10',
2024
- '11',
2025
- '12',
2026
- '13',
2027
- '14',
2028
- '15'
2029
- ])),
2030
- aspectRatio: z.optional(z.enum([
2031
- '1:1',
2032
- '16:9',
2033
- '9:16',
2034
- '4:3',
2035
- '3:4',
2036
- '21:9',
2037
- '9:21'
2038
- ])),
2039
- generateAudio: z.optional(z.boolean()).default(false),
2021
+ options: z.optional(z.record(z.string(), z.unknown())),
2040
2022
  transcode: z.optional(z.boolean()),
2041
2023
  trim: 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*\}\}$/)])),
2042
2024
  volume: z.optional(z.union([
@@ -2414,6 +2396,36 @@ export const probeRequest = z.object({
2414
2396
  */
2415
2397
  export const probeResponse = proberesponseProbeResponseSchema;
2416
2398
 
2399
+ export const postGenerateRequest = z.object({
2400
+ body: z.optional(z.object({
2401
+ asset: z.union([
2402
+ imageassetImageAssetSchema,
2403
+ videoassetVideoAssetSchema,
2404
+ audioassetAudioAssetSchema
2405
+ ])
2406
+ })),
2407
+ path: z.optional(z.never()),
2408
+ query: z.optional(z.never())
2409
+ }).strict();
2410
+
2411
+ /**
2412
+ * The generated asset was already cached and is immediately available.
2413
+ */
2414
+ export const postGenerateResponse = generationresponseGenerationResponseSchema;
2415
+
2416
+ export const getGenerateRequest = z.object({
2417
+ body: z.optional(z.never()),
2418
+ path: z.object({
2419
+ id: z.string()
2420
+ }),
2421
+ query: z.optional(z.never())
2422
+ }).strict();
2423
+
2424
+ /**
2425
+ * The generation job has finished (done or failed).
2426
+ */
2427
+ export const getGenerateResponse = generationresponseGenerationResponseSchema;
2428
+
2417
2429
  export const deleteAssetRequest = z.object({
2418
2430
  body: z.optional(z.never()),
2419
2431
  path: z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/schemas",
3
- "version": "1.15.1",
3
+ "version": "1.16.0",
4
4
  "description": "Centralized OpenAPI schemas and TypeScript types for Shotstack API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",