@shotstack/schemas 1.12.2 → 1.13.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.
- package/dist/api.bundled.json +71 -17
- package/dist/json-schema/asset.json +134 -3
- package/dist/json-schema/audio-asset.json +84 -17
- package/dist/json-schema/clip.json +134 -3
- package/dist/json-schema/edit.json +134 -3
- package/dist/json-schema/image-asset.json +34 -3
- package/dist/json-schema/image-to-video-asset.json +1 -1
- package/dist/json-schema/schemas.json +155 -14
- package/dist/json-schema/template.json +135 -4
- package/dist/json-schema/text-to-image-asset.json +1 -1
- package/dist/json-schema/text-to-speech-asset.json +19 -19
- package/dist/json-schema/timeline.json +134 -3
- package/dist/json-schema/track.json +134 -3
- package/dist/json-schema/video-asset.json +70 -27
- package/dist/schema.d.ts +118 -14
- package/dist/zod/zod.gen.cjs +101 -10
- package/dist/zod/zod.gen.d.ts +1834 -1093
- package/dist/zod/zod.gen.js +101 -10
- package/dist/zod/zod.gen.ts +101 -10
- package/package.json +1 -1
package/dist/zod/zod.gen.js
CHANGED
|
@@ -465,16 +465,43 @@ export const htmlassetHtmlAssetSchema = z.object({
|
|
|
465
465
|
}).strict();
|
|
466
466
|
export const htmlAssetSchema = htmlassetHtmlAssetSchema;
|
|
467
467
|
/**
|
|
468
|
-
* The ImageAsset
|
|
468
|
+
* 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
|
+
*
|
|
472
|
+
* - **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
|
+
*
|
|
469
476
|
*/
|
|
470
477
|
export const imageassetImageAssetSchema = z.object({
|
|
471
478
|
type: z.enum(['image']),
|
|
472
|
-
src: z.string().min(1).regex(/\S/),
|
|
479
|
+
src: z.optional(z.string().min(1).regex(/\S/)),
|
|
480
|
+
prompt: z.optional(z.string().max(4000)),
|
|
481
|
+
model: z.optional(z.string()),
|
|
473
482
|
crop: z.optional(cropCropSchema)
|
|
474
|
-
}).strict()
|
|
483
|
+
}).strict().superRefine((data, ctx) => {
|
|
484
|
+
var hasSrc = typeof data.src === "string" && data.src.trim().length > 0;
|
|
485
|
+
var hasPrompt = typeof data.prompt === "string" && data.prompt.trim().length > 0;
|
|
486
|
+
if (!hasSrc && !hasPrompt) {
|
|
487
|
+
ctx.addIssue({
|
|
488
|
+
code: z.ZodIssueCode.custom,
|
|
489
|
+
message: "A media asset requires either \"src\" (a source URL) or \"prompt\" (to generate the asset). Provide one.",
|
|
490
|
+
path: ["src"],
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
});
|
|
475
494
|
export const imageAssetSchema = imageassetImageAssetSchema;
|
|
476
495
|
/**
|
|
496
|
+
* **Notice: ImageToVideoAsset is deprecated. Use [VideoAsset](#tocs_videoasset)
|
|
497
|
+
* with `prompt` and `seed` instead.** This type continues to function and is
|
|
498
|
+
* internally rewritten to VideoAsset; no behaviour change for existing
|
|
499
|
+
* integrations.
|
|
500
|
+
*
|
|
477
501
|
* The ImageToVideoAsset lets you create a video from an image and a text prompt.
|
|
502
|
+
*
|
|
503
|
+
*
|
|
504
|
+
* @deprecated
|
|
478
505
|
*/
|
|
479
506
|
export const imagetovideoassetImageToVideoAssetSchema = z.object({
|
|
480
507
|
type: z.enum(['image-to-video']),
|
|
@@ -1812,7 +1839,14 @@ export const textassetTextAssetSchema = z.object({
|
|
|
1812
1839
|
});
|
|
1813
1840
|
export const textAssetSchema = textassetTextAssetSchema;
|
|
1814
1841
|
/**
|
|
1842
|
+
* **Notice: TextToImageAsset is deprecated. Use [ImageAsset](#tocs_imageasset)
|
|
1843
|
+
* with `prompt` instead.** This type continues to function and is internally
|
|
1844
|
+
* rewritten to ImageAsset; no behaviour change for existing integrations.
|
|
1845
|
+
*
|
|
1815
1846
|
* The TextToImageAsset lets you create a dynamic image from a text prompt.
|
|
1847
|
+
*
|
|
1848
|
+
*
|
|
1849
|
+
* @deprecated
|
|
1816
1850
|
*/
|
|
1817
1851
|
export const texttoimageassetTextToImageAssetSchema = z.object({
|
|
1818
1852
|
type: z.enum(['text-to-image']),
|
|
@@ -2117,11 +2151,26 @@ export const tweenTweenSchema = z.object({
|
|
|
2117
2151
|
}).strict();
|
|
2118
2152
|
export const tweenSchema = tweenTweenSchema;
|
|
2119
2153
|
/**
|
|
2120
|
-
* The AudioAsset
|
|
2154
|
+
* The AudioAsset adds audio to a Clip. The audio can be sourced from a URL
|
|
2155
|
+
* (`src`) or generated from a text prompt (`prompt`). Exactly one of `src` or
|
|
2156
|
+
* `prompt` must be provided.
|
|
2157
|
+
*
|
|
2158
|
+
* - **Source URL:** set `src` to a publicly accessible audio URL (e.g. mp3).
|
|
2159
|
+
* - **Generated speech:** set `prompt` to the spoken text and `voice` to a voice
|
|
2160
|
+
* identifier (text-to-speech). Optionally set `language`/`newscaster`.
|
|
2161
|
+
* - **Generated music or SFX:** set `prompt` describing the sound; omit `voice`.
|
|
2162
|
+
* - Use `model` to choose the generator. The generated `src` is filled in
|
|
2163
|
+
* automatically.
|
|
2164
|
+
*
|
|
2121
2165
|
*/
|
|
2122
2166
|
export const audioassetAudioAssetSchema = z.object({
|
|
2123
2167
|
type: z.enum(['audio']),
|
|
2124
|
-
src: z.string().min(1).regex(/\S/),
|
|
2168
|
+
src: z.optional(z.string().min(1).regex(/\S/)),
|
|
2169
|
+
prompt: z.optional(z.string().max(4000)),
|
|
2170
|
+
voice: z.optional(z.string()),
|
|
2171
|
+
language: z.optional(z.string()),
|
|
2172
|
+
newscaster: z.optional(z.boolean()).default(false),
|
|
2173
|
+
model: z.optional(z.string()),
|
|
2125
2174
|
trim: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
|
|
2126
2175
|
return undefined; if (Array.isArray(v))
|
|
2127
2176
|
return v; if (typeof v === 'string') {
|
|
@@ -2152,7 +2201,17 @@ export const audioassetAudioAssetSchema = z.object({
|
|
|
2152
2201
|
'fadeOut',
|
|
2153
2202
|
'fadeInFadeOut'
|
|
2154
2203
|
]))
|
|
2155
|
-
}).strict()
|
|
2204
|
+
}).strict().superRefine((data, ctx) => {
|
|
2205
|
+
var hasSrc = typeof data.src === "string" && data.src.trim().length > 0;
|
|
2206
|
+
var hasPrompt = typeof data.prompt === "string" && data.prompt.trim().length > 0;
|
|
2207
|
+
if (!hasSrc && !hasPrompt) {
|
|
2208
|
+
ctx.addIssue({
|
|
2209
|
+
code: z.ZodIssueCode.custom,
|
|
2210
|
+
message: "A media asset requires either \"src\" (a source URL) or \"prompt\" (to generate the asset). Provide one.",
|
|
2211
|
+
path: ["src"],
|
|
2212
|
+
});
|
|
2213
|
+
}
|
|
2214
|
+
});
|
|
2156
2215
|
export const audioAssetSchema = audioassetAudioAssetSchema;
|
|
2157
2216
|
/**
|
|
2158
2217
|
* Offsets the position of an asset horizontally or vertically by a relative distance.
|
|
@@ -2223,7 +2282,17 @@ export const skewtransformationSkewTransformationSchema = z.object({
|
|
|
2223
2282
|
}).strict();
|
|
2224
2283
|
export const skewTransformationSchema = skewtransformationSkewTransformationSchema;
|
|
2225
2284
|
/**
|
|
2226
|
-
*
|
|
2285
|
+
* **Notice: TextToSpeechAsset is deprecated. Use [AudioAsset](#tocs_audioasset)
|
|
2286
|
+
* with `prompt` (the spoken text) and `voice` instead.** This type continues to
|
|
2287
|
+
* function and is internally rewritten to AudioAsset; no behaviour change for
|
|
2288
|
+
* existing integrations.
|
|
2289
|
+
*
|
|
2290
|
+
* The TextToSpeechAsset lets you generate a voice over from text using a text-to-speech service.
|
|
2291
|
+
* The generated audio can be trimmed, faded and have its volume and speed adjusted using the
|
|
2292
|
+
* same properties available on the AudioAsset.
|
|
2293
|
+
*
|
|
2294
|
+
*
|
|
2295
|
+
* @deprecated
|
|
2227
2296
|
*/
|
|
2228
2297
|
export const texttospeechassetTextToSpeechAssetSchema = z.object({
|
|
2229
2298
|
type: z.enum(['text-to-speech']),
|
|
@@ -2321,11 +2390,23 @@ export const transformationTransformationSchema = z.object({
|
|
|
2321
2390
|
}).strict();
|
|
2322
2391
|
export const transformationSchema = transformationTransformationSchema;
|
|
2323
2392
|
/**
|
|
2324
|
-
* The VideoAsset
|
|
2393
|
+
* 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.
|
|
2396
|
+
*
|
|
2397
|
+
* - **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
|
|
2400
|
+
* (e.g. `luma-ray-3`, `runpod-itv-mini`). The generated `src` is filled in
|
|
2401
|
+
* automatically.
|
|
2402
|
+
*
|
|
2325
2403
|
*/
|
|
2326
2404
|
export const videoassetVideoAssetSchema = z.object({
|
|
2327
2405
|
type: z.enum(['video']),
|
|
2328
|
-
src: z.string().min(1).regex(/\S/),
|
|
2406
|
+
src: z.optional(z.string().min(1).regex(/\S/)),
|
|
2407
|
+
prompt: z.optional(z.string().max(4000)),
|
|
2408
|
+
seed: z.optional(z.string().min(1)),
|
|
2409
|
+
model: z.optional(z.string()),
|
|
2329
2410
|
transcode: z.optional(z.boolean()),
|
|
2330
2411
|
trim: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
|
|
2331
2412
|
return undefined; if (Array.isArray(v))
|
|
@@ -2359,7 +2440,17 @@ export const videoassetVideoAssetSchema = z.object({
|
|
|
2359
2440
|
} return v; }), z.number().gte(0).lte(10)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
|
|
2360
2441
|
crop: z.optional(cropCropSchema),
|
|
2361
2442
|
chromaKey: z.optional(chromakeyChromaKeySchema)
|
|
2362
|
-
}).strict()
|
|
2443
|
+
}).strict().superRefine((data, ctx) => {
|
|
2444
|
+
var hasSrc = typeof data.src === "string" && data.src.trim().length > 0;
|
|
2445
|
+
var hasPrompt = typeof data.prompt === "string" && data.prompt.trim().length > 0;
|
|
2446
|
+
if (!hasSrc && !hasPrompt) {
|
|
2447
|
+
ctx.addIssue({
|
|
2448
|
+
code: z.ZodIssueCode.custom,
|
|
2449
|
+
message: "A media asset requires either \"src\" (a source URL) or \"prompt\" (to generate the asset). Provide one.",
|
|
2450
|
+
path: ["src"],
|
|
2451
|
+
});
|
|
2452
|
+
}
|
|
2453
|
+
});
|
|
2363
2454
|
export const videoAssetSchema = videoassetVideoAssetSchema;
|
|
2364
2455
|
/**
|
|
2365
2456
|
* The type of asset to display for the duration of the Clip, i.e. a video clip or an image. Choose from one of the available asset types below.
|
package/dist/zod/zod.gen.ts
CHANGED
|
@@ -413,18 +413,45 @@ export const htmlassetHtmlAssetSchema = z.object({
|
|
|
413
413
|
export const htmlAssetSchema = htmlassetHtmlAssetSchema;
|
|
414
414
|
|
|
415
415
|
/**
|
|
416
|
-
* The ImageAsset
|
|
416
|
+
* 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.
|
|
419
|
+
*
|
|
420
|
+
* - **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.
|
|
423
|
+
*
|
|
417
424
|
*/
|
|
418
425
|
export const imageassetImageAssetSchema = z.object({
|
|
419
426
|
type: z.enum(['image']),
|
|
420
|
-
src: z.string().min(1).regex(/\S/),
|
|
427
|
+
src: z.optional(z.string().min(1).regex(/\S/)),
|
|
428
|
+
prompt: z.optional(z.string().max(4000)),
|
|
429
|
+
model: z.optional(z.string()),
|
|
421
430
|
crop: z.optional(cropCropSchema)
|
|
422
|
-
}).strict()
|
|
431
|
+
}).strict().superRefine((data, ctx) => {
|
|
432
|
+
var hasSrc = typeof data.src === "string" && data.src.trim().length > 0;
|
|
433
|
+
var hasPrompt = typeof data.prompt === "string" && data.prompt.trim().length > 0;
|
|
434
|
+
if (!hasSrc && !hasPrompt) {
|
|
435
|
+
ctx.addIssue({
|
|
436
|
+
code: z.ZodIssueCode.custom,
|
|
437
|
+
message: "A media asset requires either \"src\" (a source URL) or \"prompt\" (to generate the asset). Provide one.",
|
|
438
|
+
path: ["src"],
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
});
|
|
423
442
|
|
|
424
443
|
export const imageAssetSchema = imageassetImageAssetSchema;
|
|
425
444
|
|
|
426
445
|
/**
|
|
446
|
+
* **Notice: ImageToVideoAsset is deprecated. Use [VideoAsset](#tocs_videoasset)
|
|
447
|
+
* with `prompt` and `seed` instead.** This type continues to function and is
|
|
448
|
+
* internally rewritten to VideoAsset; no behaviour change for existing
|
|
449
|
+
* integrations.
|
|
450
|
+
*
|
|
427
451
|
* The ImageToVideoAsset lets you create a video from an image and a text prompt.
|
|
452
|
+
*
|
|
453
|
+
*
|
|
454
|
+
* @deprecated
|
|
428
455
|
*/
|
|
429
456
|
export const imagetovideoassetImageToVideoAssetSchema = z.object({
|
|
430
457
|
type: z.enum(['image-to-video']),
|
|
@@ -1454,7 +1481,14 @@ export const textassetTextAssetSchema = z.object({
|
|
|
1454
1481
|
export const textAssetSchema = textassetTextAssetSchema;
|
|
1455
1482
|
|
|
1456
1483
|
/**
|
|
1484
|
+
* **Notice: TextToImageAsset is deprecated. Use [ImageAsset](#tocs_imageasset)
|
|
1485
|
+
* with `prompt` instead.** This type continues to function and is internally
|
|
1486
|
+
* rewritten to ImageAsset; no behaviour change for existing integrations.
|
|
1487
|
+
*
|
|
1457
1488
|
* The TextToImageAsset lets you create a dynamic image from a text prompt.
|
|
1489
|
+
*
|
|
1490
|
+
*
|
|
1491
|
+
* @deprecated
|
|
1458
1492
|
*/
|
|
1459
1493
|
export const texttoimageassetTextToImageAssetSchema = z.object({
|
|
1460
1494
|
type: z.enum(['text-to-image']),
|
|
@@ -1733,11 +1767,26 @@ export const tweenTweenSchema = z.object({
|
|
|
1733
1767
|
export const tweenSchema = tweenTweenSchema;
|
|
1734
1768
|
|
|
1735
1769
|
/**
|
|
1736
|
-
* The AudioAsset
|
|
1770
|
+
* The AudioAsset adds audio to a Clip. The audio can be sourced from a URL
|
|
1771
|
+
* (`src`) or generated from a text prompt (`prompt`). Exactly one of `src` or
|
|
1772
|
+
* `prompt` must be provided.
|
|
1773
|
+
*
|
|
1774
|
+
* - **Source URL:** set `src` to a publicly accessible audio URL (e.g. mp3).
|
|
1775
|
+
* - **Generated speech:** set `prompt` to the spoken text and `voice` to a voice
|
|
1776
|
+
* identifier (text-to-speech). Optionally set `language`/`newscaster`.
|
|
1777
|
+
* - **Generated music or SFX:** set `prompt` describing the sound; omit `voice`.
|
|
1778
|
+
* - Use `model` to choose the generator. The generated `src` is filled in
|
|
1779
|
+
* automatically.
|
|
1780
|
+
*
|
|
1737
1781
|
*/
|
|
1738
1782
|
export const audioassetAudioAssetSchema = z.object({
|
|
1739
1783
|
type: z.enum(['audio']),
|
|
1740
|
-
src: z.string().min(1).regex(/\S/),
|
|
1784
|
+
src: z.optional(z.string().min(1).regex(/\S/)),
|
|
1785
|
+
prompt: z.optional(z.string().max(4000)),
|
|
1786
|
+
voice: z.optional(z.string()),
|
|
1787
|
+
language: z.optional(z.string()),
|
|
1788
|
+
newscaster: z.optional(z.boolean()).default(false),
|
|
1789
|
+
model: z.optional(z.string()),
|
|
1741
1790
|
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*\}\}$/)])),
|
|
1742
1791
|
volume: z.optional(z.union([
|
|
1743
1792
|
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*\}\}$/)]),
|
|
@@ -1750,7 +1799,17 @@ export const audioassetAudioAssetSchema = z.object({
|
|
|
1750
1799
|
'fadeOut',
|
|
1751
1800
|
'fadeInFadeOut'
|
|
1752
1801
|
]))
|
|
1753
|
-
}).strict()
|
|
1802
|
+
}).strict().superRefine((data, ctx) => {
|
|
1803
|
+
var hasSrc = typeof data.src === "string" && data.src.trim().length > 0;
|
|
1804
|
+
var hasPrompt = typeof data.prompt === "string" && data.prompt.trim().length > 0;
|
|
1805
|
+
if (!hasSrc && !hasPrompt) {
|
|
1806
|
+
ctx.addIssue({
|
|
1807
|
+
code: z.ZodIssueCode.custom,
|
|
1808
|
+
message: "A media asset requires either \"src\" (a source URL) or \"prompt\" (to generate the asset). Provide one.",
|
|
1809
|
+
path: ["src"],
|
|
1810
|
+
});
|
|
1811
|
+
}
|
|
1812
|
+
});
|
|
1754
1813
|
|
|
1755
1814
|
export const audioAssetSchema = audioassetAudioAssetSchema;
|
|
1756
1815
|
|
|
@@ -1799,7 +1858,17 @@ export const skewtransformationSkewTransformationSchema = z.object({
|
|
|
1799
1858
|
export const skewTransformationSchema = skewtransformationSkewTransformationSchema;
|
|
1800
1859
|
|
|
1801
1860
|
/**
|
|
1802
|
-
*
|
|
1861
|
+
* **Notice: TextToSpeechAsset is deprecated. Use [AudioAsset](#tocs_audioasset)
|
|
1862
|
+
* with `prompt` (the spoken text) and `voice` instead.** This type continues to
|
|
1863
|
+
* function and is internally rewritten to AudioAsset; no behaviour change for
|
|
1864
|
+
* existing integrations.
|
|
1865
|
+
*
|
|
1866
|
+
* The TextToSpeechAsset lets you generate a voice over from text using a text-to-speech service.
|
|
1867
|
+
* The generated audio can be trimmed, faded and have its volume and speed adjusted using the
|
|
1868
|
+
* same properties available on the AudioAsset.
|
|
1869
|
+
*
|
|
1870
|
+
*
|
|
1871
|
+
* @deprecated
|
|
1803
1872
|
*/
|
|
1804
1873
|
export const texttospeechassetTextToSpeechAssetSchema = z.object({
|
|
1805
1874
|
type: z.enum(['text-to-speech']),
|
|
@@ -1885,11 +1954,23 @@ export const transformationTransformationSchema = z.object({
|
|
|
1885
1954
|
export const transformationSchema = transformationTransformationSchema;
|
|
1886
1955
|
|
|
1887
1956
|
/**
|
|
1888
|
-
* The VideoAsset
|
|
1957
|
+
* 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.
|
|
1960
|
+
*
|
|
1961
|
+
* - **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
|
|
1964
|
+
* (e.g. `luma-ray-3`, `runpod-itv-mini`). The generated `src` is filled in
|
|
1965
|
+
* automatically.
|
|
1966
|
+
*
|
|
1889
1967
|
*/
|
|
1890
1968
|
export const videoassetVideoAssetSchema = z.object({
|
|
1891
1969
|
type: z.enum(['video']),
|
|
1892
|
-
src: z.string().min(1).regex(/\S/),
|
|
1970
|
+
src: z.optional(z.string().min(1).regex(/\S/)),
|
|
1971
|
+
prompt: z.optional(z.string().max(4000)),
|
|
1972
|
+
seed: z.optional(z.string().min(1)),
|
|
1973
|
+
model: z.optional(z.string()),
|
|
1893
1974
|
transcode: z.optional(z.boolean()),
|
|
1894
1975
|
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*\}\}$/)])),
|
|
1895
1976
|
volume: z.optional(z.union([
|
|
@@ -1905,7 +1986,17 @@ export const videoassetVideoAssetSchema = z.object({
|
|
|
1905
1986
|
speed: 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(10)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
|
|
1906
1987
|
crop: z.optional(cropCropSchema),
|
|
1907
1988
|
chromaKey: z.optional(chromakeyChromaKeySchema)
|
|
1908
|
-
}).strict()
|
|
1989
|
+
}).strict().superRefine((data, ctx) => {
|
|
1990
|
+
var hasSrc = typeof data.src === "string" && data.src.trim().length > 0;
|
|
1991
|
+
var hasPrompt = typeof data.prompt === "string" && data.prompt.trim().length > 0;
|
|
1992
|
+
if (!hasSrc && !hasPrompt) {
|
|
1993
|
+
ctx.addIssue({
|
|
1994
|
+
code: z.ZodIssueCode.custom,
|
|
1995
|
+
message: "A media asset requires either \"src\" (a source URL) or \"prompt\" (to generate the asset). Provide one.",
|
|
1996
|
+
path: ["src"],
|
|
1997
|
+
});
|
|
1998
|
+
}
|
|
1999
|
+
});
|
|
1909
2000
|
|
|
1910
2001
|
export const videoAssetSchema = videoassetVideoAssetSchema;
|
|
1911
2002
|
|