@shotstack/schemas 1.16.0 → 1.18.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.
@@ -7,6 +7,8 @@ export const assetsidRootSchema = z.unknown();
7
7
  export const assetsrenderidRootSchema = z.unknown();
8
8
  export const generateRootSchema = z.unknown();
9
9
  export const generateidRootSchema = z.unknown();
10
+ export const modelsRootSchema = z.unknown();
11
+ export const modelsidRootSchema = z.unknown();
10
12
  export const probeRootSchema = z.unknown();
11
13
  export const renderRootSchema = z.unknown();
12
14
  export const renderidRootSchema = z.unknown();
@@ -413,6 +415,49 @@ export const fontFontSchema = z.object({
413
415
  src: z.string()
414
416
  }).strict();
415
417
  export const fontSchema = fontFontSchema;
418
+ /**
419
+ * What one generation costs, in credits. There is no formula to evaluate: multiply the rate by the number of units the generation consumes. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it.
420
+ */
421
+ export const generationmodelpricingGenerationModelPricingSchema = z.object({
422
+ unit: z.enum([
423
+ 'render',
424
+ 'second',
425
+ 'minute',
426
+ 'thousandCharacters'
427
+ ]),
428
+ credits: z.union([
429
+ z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
430
+ return undefined; if (Array.isArray(v))
431
+ return v; if (typeof v === 'string') {
432
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
433
+ return v;
434
+ return Number(v);
435
+ } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]),
436
+ z.record(z.string(), z.unknown())
437
+ ]),
438
+ tieredBy: z.optional(z.array(z.string())),
439
+ minUnits: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
440
+ return undefined; if (Array.isArray(v))
441
+ return v; if (typeof v === 'string') {
442
+ if (/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/.test(v))
443
+ return v;
444
+ return Number(v);
445
+ } return v; }), z.number()), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
446
+ effectiveFrom: z.string()
447
+ }).strict();
448
+ /**
449
+ * A generation model available to `prompt`-bearing image, video and audio assets, with the options it accepts and what it costs. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.
450
+ */
451
+ export const generationmodelGenerationModelSchema = z.object({
452
+ model: z.string(),
453
+ type: z.enum([
454
+ 'image',
455
+ 'video',
456
+ 'audio'
457
+ ]),
458
+ pricing: z.optional(generationmodelpricingGenerationModelPricingSchema),
459
+ options: z.optional(z.record(z.string(), z.unknown()))
460
+ }).strict();
416
461
  /**
417
462
  * The Html5Asset renders full HTML5/CSS3/JS.
418
463
  *
@@ -751,6 +796,12 @@ export const assetresponseAssetResponseSchema = z.object({
751
796
  data: assetresponsedataAssetResponseDataSchema
752
797
  }).strict();
753
798
  export const assetResponseSchema = assetresponseAssetResponseSchema;
799
+ /**
800
+ * The generation models available to this account.
801
+ */
802
+ export const generationmodellistresponseGenerationModelListResponseSchema = z.object({
803
+ models: z.array(generationmodelGenerationModelSchema)
804
+ }).strict();
754
805
  /**
755
806
  * The status of an on-demand asset generation job. Completed jobs include the public URL of the generated asset.
756
807
  */
@@ -899,6 +950,7 @@ export const richcaptionpropertiesRichCaptionFontSchema = z.object({
899
950
  return Number(v);
900
951
  } return v; }), z.number().int().gte(1).lte(500)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),
901
952
  weight: z.optional(z.unknown()).default('400'),
953
+ style: z.optional(z.enum(['normal', 'italic'])),
902
954
  color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default('#ffffff'),
903
955
  opacity: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
904
956
  return undefined; if (Array.isArray(v))
@@ -1219,6 +1271,7 @@ export const richtextpropertiesRichTextFontSchema = z.object({
1219
1271
  return Number(v);
1220
1272
  } return v; }), z.number().int().gte(1).lte(500)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),
1221
1273
  weight: z.optional(z.unknown()).default('400'),
1274
+ style: z.optional(z.enum(['normal', 'italic'])),
1222
1275
  color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default('#000000'),
1223
1276
  opacity: z.optional(z.union([z.preprocess(((v) => { if (v === '' || v === null || v === undefined)
1224
1277
  return undefined; if (Array.isArray(v))
@@ -2880,6 +2933,28 @@ export const getGenerateRequest = z.object({
2880
2933
  * The generation job has finished (done or failed).
2881
2934
  */
2882
2935
  export const getGenerateResponse = generationresponseGenerationResponseSchema;
2936
+ export const getModelsRequest = z.object({
2937
+ body: z.optional(z.never()),
2938
+ path: z.optional(z.never()),
2939
+ query: z.optional(z.object({
2940
+ expand: z.optional(z.enum(['options']))
2941
+ }))
2942
+ }).strict();
2943
+ /**
2944
+ * The available generation models.
2945
+ */
2946
+ export const getModelsResponse = generationmodellistresponseGenerationModelListResponseSchema;
2947
+ export const getModelRequest = z.object({
2948
+ body: z.optional(z.never()),
2949
+ path: z.object({
2950
+ id: z.string()
2951
+ }),
2952
+ query: z.optional(z.never())
2953
+ }).strict();
2954
+ /**
2955
+ * The generation model, with its option schema.
2956
+ */
2957
+ export const getModelResponse = generationmodelGenerationModelSchema;
2883
2958
  export const deleteAssetRequest = z.object({
2884
2959
  body: z.optional(z.never()),
2885
2960
  path: z.object({
@@ -16,6 +16,10 @@ export const generateRootSchema = z.unknown();
16
16
 
17
17
  export const generateidRootSchema = z.unknown();
18
18
 
19
+ export const modelsRootSchema = z.unknown();
20
+
21
+ export const modelsidRootSchema = z.unknown();
22
+
19
23
  export const probeRootSchema = z.unknown();
20
24
 
21
25
  export const renderRootSchema = z.unknown();
@@ -371,6 +375,39 @@ export const fontFontSchema = z.object({
371
375
 
372
376
  export const fontSchema = fontFontSchema;
373
377
 
378
+ /**
379
+ * What one generation costs, in credits. There is no formula to evaluate: multiply the rate by the number of units the generation consumes. Where a model charges differently per option value, `credits` is an object keyed by that value and `tieredBy` names the option that selects it.
380
+ */
381
+ export const generationmodelpricingGenerationModelPricingSchema = z.object({
382
+ unit: z.enum([
383
+ 'render',
384
+ 'second',
385
+ 'minute',
386
+ 'thousandCharacters'
387
+ ]),
388
+ credits: z.union([
389
+ 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*\}\}$/)]),
390
+ z.record(z.string(), z.unknown())
391
+ ]),
392
+ tieredBy: z.optional(z.array(z.string())),
393
+ minUnits: 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*\}\}$/)])),
394
+ effectiveFrom: z.string()
395
+ }).strict();
396
+
397
+ /**
398
+ * A generation model available to `prompt`-bearing image, video and audio assets, with the options it accepts and what it costs. Render a model picker and its option fields from this rather than hard coding a model list, so a newly launched model is available without a client release.
399
+ */
400
+ export const generationmodelGenerationModelSchema = z.object({
401
+ model: z.string(),
402
+ type: z.enum([
403
+ 'image',
404
+ 'video',
405
+ 'audio'
406
+ ]),
407
+ pricing: z.optional(generationmodelpricingGenerationModelPricingSchema),
408
+ options: z.optional(z.record(z.string(), z.unknown()))
409
+ }).strict();
410
+
374
411
  /**
375
412
  * The Html5Asset renders full HTML5/CSS3/JS.
376
413
  *
@@ -711,6 +748,13 @@ export const assetresponseAssetResponseSchema = z.object({
711
748
 
712
749
  export const assetResponseSchema = assetresponseAssetResponseSchema;
713
750
 
751
+ /**
752
+ * The generation models available to this account.
753
+ */
754
+ export const generationmodellistresponseGenerationModelListResponseSchema = z.object({
755
+ models: z.array(generationmodelGenerationModelSchema)
756
+ }).strict();
757
+
714
758
  /**
715
759
  * The status of an on-demand asset generation job. Completed jobs include the public URL of the generated asset.
716
760
  */
@@ -862,6 +906,7 @@ export const richcaptionpropertiesRichCaptionFontSchema = z.object({
862
906
  family: z.optional(z.string()).default('Roboto'),
863
907
  size: 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().int().gte(1).lte(500)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),
864
908
  weight: z.optional(z.unknown()).default('400'),
909
+ style: z.optional(z.enum(['normal', 'italic'])),
865
910
  color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default('#ffffff'),
866
911
  opacity: 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(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
867
912
  background: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)]))
@@ -1052,6 +1097,7 @@ export const richtextpropertiesRichTextFontSchema = z.object({
1052
1097
  family: z.optional(z.string()).default('Open Sans'),
1053
1098
  size: 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().int().gte(1).lte(500)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(24),
1054
1099
  weight: z.optional(z.unknown()).default('400'),
1100
+ style: z.optional(z.enum(['normal', 'italic'])),
1055
1101
  color: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default('#000000'),
1056
1102
  opacity: 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(1)), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])).default(1),
1057
1103
  background: z.optional(z.union([z.string().regex(/^#[A-Fa-f0-9]{6}$/), z.string().regex(/^\{\{\s*[A-Za-z0-9_]+\s*\}\}$/)])),
@@ -2426,6 +2472,32 @@ export const getGenerateRequest = z.object({
2426
2472
  */
2427
2473
  export const getGenerateResponse = generationresponseGenerationResponseSchema;
2428
2474
 
2475
+ export const getModelsRequest = z.object({
2476
+ body: z.optional(z.never()),
2477
+ path: z.optional(z.never()),
2478
+ query: z.optional(z.object({
2479
+ expand: z.optional(z.enum(['options']))
2480
+ }))
2481
+ }).strict();
2482
+
2483
+ /**
2484
+ * The available generation models.
2485
+ */
2486
+ export const getModelsResponse = generationmodellistresponseGenerationModelListResponseSchema;
2487
+
2488
+ export const getModelRequest = z.object({
2489
+ body: z.optional(z.never()),
2490
+ path: z.object({
2491
+ id: z.string()
2492
+ }),
2493
+ query: z.optional(z.never())
2494
+ }).strict();
2495
+
2496
+ /**
2497
+ * The generation model, with its option schema.
2498
+ */
2499
+ export const getModelResponse = generationmodelGenerationModelSchema;
2500
+
2429
2501
  export const deleteAssetRequest = z.object({
2430
2502
  body: z.optional(z.never()),
2431
2503
  path: z.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shotstack/schemas",
3
- "version": "1.16.0",
3
+ "version": "1.18.0",
4
4
  "description": "Centralized OpenAPI schemas and TypeScript types for Shotstack API",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",