@shotstack/schemas 1.8.6 → 1.9.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/README.md CHANGED
@@ -1,89 +1,89 @@
1
- # @shotstack/schemas
2
-
3
- Centralized OpenAPI schemas and TypeScript types for the Shotstack API.
4
-
5
- ## Installation
6
-
7
- ```bash
8
- npm install @shotstack/schemas zod
9
- ```
10
-
11
- ## Usage
12
-
13
- ### TypeScript Types
14
-
15
- ```typescript
16
- import type { components } from '@shotstack/schemas';
17
-
18
- type Edit = components['schemas']['Edit'];
19
- type Timeline = components['schemas']['Timeline'];
20
- type Clip = components['schemas']['Clip'];
21
- type Output = components['schemas']['Output'];
22
- ```
23
-
24
- ### Zod Schemas
25
-
26
- ```typescript
27
- import { z } from 'zod';
28
- import { richTextAssetSchema, editSchema, timelineSchema } from '@shotstack/schemas/zod';
29
-
30
- const result = richTextAssetSchema.safeParse(inputData);
31
- if (result.success) {
32
- console.log(result.data);
33
- }
34
- ```
35
-
36
- ### Extending Schemas
37
-
38
- ```typescript
39
- import { z } from 'zod';
40
- import { richTextAssetSchema } from '@shotstack/schemas/zod';
41
-
42
- const ExtendedAsset = richTextAssetSchema.extend({
43
- customFonts: z.array(z.object({
44
- src: z.string().url(),
45
- family: z.string(),
46
- })).optional(),
47
- border: z.object({
48
- width: z.number().min(0),
49
- color: z.string(),
50
- }).optional(),
51
- });
52
-
53
- type ExtendedAssetType = z.infer<typeof ExtendedAsset>;
54
- ```
55
-
56
- ### Custom Validation
57
-
58
- ```typescript
59
- import { richTextAnimationSchema } from '@shotstack/schemas/zod';
60
-
61
- const AnimationWithDirection = richTextAnimationSchema.refine(
62
- (data) => {
63
- if (data.preset === 'slideIn' && !data.direction) {
64
- return false;
65
- }
66
- return true;
67
- },
68
- { message: 'direction is required for slideIn preset' }
69
- );
70
- ```
71
-
72
- ## Available Schemas
73
-
74
- - Edit, Timeline, Track, Clip, Output
75
- - Assets: VideoAsset, ImageAsset, AudioAsset, HtmlAsset, TextAsset, TitleAsset, LumaAsset, CaptionAsset, ShapeAsset, RichTextAsset
76
- - Destinations: ShotstackDestination, S3Destination, MuxDestination, VimeoDestination, GoogleDriveDestination, GoogleCloudStorageDestination
77
- - Transforms, Transitions, Fonts, MergeFields, and more
78
-
79
- ## Development
80
-
81
- ```bash
82
- pnpm install
83
- pnpm run build
84
- pnpm run test
85
- ```
86
-
87
- ## License
88
-
89
- MIT
1
+ # @shotstack/schemas
2
+
3
+ Centralized OpenAPI schemas and TypeScript types for the Shotstack API
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @shotstack/schemas zod
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ ### TypeScript Types
14
+
15
+ ```typescript
16
+ import type { components } from '@shotstack/schemas';
17
+
18
+ type Edit = components['schemas']['Edit'];
19
+ type Timeline = components['schemas']['Timeline'];
20
+ type Clip = components['schemas']['Clip'];
21
+ type Output = components['schemas']['Output'];
22
+ ```
23
+
24
+ ### Zod Schemas
25
+
26
+ ```typescript
27
+ import { z } from 'zod';
28
+ import { richTextAssetSchema, editSchema, timelineSchema } from '@shotstack/schemas/zod';
29
+
30
+ const result = richTextAssetSchema.safeParse(inputData);
31
+ if (result.success) {
32
+ console.log(result.data);
33
+ }
34
+ ```
35
+
36
+ ### Extending Schemas
37
+
38
+ ```typescript
39
+ import { z } from 'zod';
40
+ import { richTextAssetSchema } from '@shotstack/schemas/zod';
41
+
42
+ const ExtendedAsset = richTextAssetSchema.extend({
43
+ customFonts: z.array(z.object({
44
+ src: z.string().url(),
45
+ family: z.string(),
46
+ })).optional(),
47
+ border: z.object({
48
+ width: z.number().min(0),
49
+ color: z.string(),
50
+ }).optional(),
51
+ });
52
+
53
+ type ExtendedAssetType = z.infer<typeof ExtendedAsset>;
54
+ ```
55
+
56
+ ### Custom Validation
57
+
58
+ ```typescript
59
+ import { richTextAnimationSchema } from '@shotstack/schemas/zod';
60
+
61
+ const AnimationWithDirection = richTextAnimationSchema.refine(
62
+ (data) => {
63
+ if (data.preset === 'slideIn' && !data.direction) {
64
+ return false;
65
+ }
66
+ return true;
67
+ },
68
+ { message: 'direction is required for slideIn preset' }
69
+ );
70
+ ```
71
+
72
+ ## Available Schemas
73
+
74
+ - Edit, Timeline, Track, Clip, Output
75
+ - Assets: VideoAsset, ImageAsset, AudioAsset, HtmlAsset, TextAsset, TitleAsset, LumaAsset, CaptionAsset, ShapeAsset, RichTextAsset
76
+ - Destinations: ShotstackDestination, S3Destination, MuxDestination, VimeoDestination, GoogleDriveDestination, GoogleCloudStorageDestination
77
+ - Transforms, Transitions, Fonts, MergeFields, and more
78
+
79
+ ## Development
80
+
81
+ ```bash
82
+ pnpm install
83
+ pnpm run build
84
+ pnpm run test
85
+ ```
86
+
87
+ ## License
88
+
89
+ MIT
@@ -1919,22 +1919,67 @@
1919
1919
  "type": "string"
1920
1920
  },
1921
1921
  "src": {
1922
- "description": "The URL to an SRT or VTT subtitles file, or an alias reference to auto-generate captions from an audio or video clip. For file URLs, the URL must be publicly accessible or include credentials. For auto-captioning, use the format `alias://clip-name` where clip-name is the alias of an audio, video, or text-to-speech clip. Mutually exclusive with `words`.",
1922
+ "description": "The URL to an SRT or VTT subtitles file, or an alias reference to auto-generate captions from an audio or video clip. For file URLs, the URL must be publicly accessible or include credentials. For auto-captioning, use the format `alias://clip-name` where clip-name is the alias of an audio, video, or text-to-speech clip.",
1923
1923
  "type": "string",
1924
1924
  "minLength": 1,
1925
1925
  "example": "alias://audio"
1926
1926
  },
1927
- "words": {
1928
- "description": "Pre-provided word-level timing data. Use this instead of `src` when you have word timestamps from an external source. Mutually exclusive with `src`.",
1929
- "type": "array",
1930
- "items": {
1931
- "$ref": "#/components/schemas/WordTiming"
1932
- },
1933
- "maxItems": 100000
1934
- },
1935
1927
  "font": {
1936
1928
  "description": "Font styling properties for inactive words.",
1937
- "$ref": "#/components/schemas/RichTextFont"
1929
+ "properties": {
1930
+ "family": {
1931
+ "description": "The font family name. This must be the Family name embedded in the font, i.e. \"Roboto\".",
1932
+ "type": "string",
1933
+ "example": "Roboto",
1934
+ "default": "Roboto"
1935
+ },
1936
+ "size": {
1937
+ "description": "The size of the font in pixels (px). Must be between 1 and 500.",
1938
+ "type": "integer",
1939
+ "minimum": 1,
1940
+ "maximum": 500,
1941
+ "default": 24,
1942
+ "example": 48
1943
+ },
1944
+ "weight": {
1945
+ "description": "The weight of the font. Can be a number (100-900) or a string ('normal', 'bold', etc.). 100 is lightest, 900 is heaviest (boldest).",
1946
+ "default": "400"
1947
+ },
1948
+ "color": {
1949
+ "description": "The text color using hexadecimal color notation.",
1950
+ "type": "string",
1951
+ "pattern": "^#[A-Fa-f0-9]{6}$",
1952
+ "default": "#ffffff",
1953
+ "example": "#ffffff"
1954
+ },
1955
+ "opacity": {
1956
+ "description": "The opacity of the text where 1 is opaque and 0 is transparent.",
1957
+ "type": "number",
1958
+ "minimum": 0,
1959
+ "maximum": 1,
1960
+ "default": 1,
1961
+ "example": 0.9
1962
+ },
1963
+ "background": {
1964
+ "description": "The background color behind the text using hexadecimal color notation.",
1965
+ "type": "string",
1966
+ "pattern": "^#[A-Fa-f0-9]{6}$",
1967
+ "example": "#000000"
1968
+ },
1969
+ "textDecoration": {
1970
+ "description": "Text decoration to apply to all words.",
1971
+ "type": "string",
1972
+ "enum": [
1973
+ "none",
1974
+ "underline",
1975
+ "line-through"
1976
+ ],
1977
+ "default": "none",
1978
+ "example": "underline"
1979
+ }
1980
+ },
1981
+ "additionalProperties": false,
1982
+ "type": "object"
1938
1983
  },
1939
1984
  "style": {
1940
1985
  "description": "Text style properties including spacing, line height, and transformations.",
@@ -1952,6 +1997,10 @@
1952
1997
  "description": "Background styling properties for the caption bounding box.",
1953
1998
  "$ref": "#/components/schemas/RichTextBackground"
1954
1999
  },
2000
+ "border": {
2001
+ "description": "Border styling properties for the caption bounding box.",
2002
+ "$ref": "#/components/schemas/RichTextAsset/properties/border"
2003
+ },
1955
2004
  "padding": {
1956
2005
  "description": "Padding inside the caption bounding box. Can be a single number (applied to all sides) or an object with individual sides.",
1957
2006
  "oneOf": [
@@ -1977,75 +2026,12 @@
1977
2026
  "wordAnimation": {
1978
2027
  "description": "Word-level animation properties controlling how words are highlighted or revealed.",
1979
2028
  "$ref": "#/components/schemas/RichCaptionWordAnimation"
1980
- },
1981
- "position": {
1982
- "description": "Vertical position of the caption on screen.",
1983
- "type": "string",
1984
- "enum": [
1985
- "top",
1986
- "center",
1987
- "bottom"
1988
- ],
1989
- "default": "bottom",
1990
- "example": "bottom"
1991
- },
1992
- "maxWidth": {
1993
- "description": "Maximum width of the caption as a ratio of the frame width. Must be between 0.1 and 1.",
1994
- "type": "number",
1995
- "minimum": 0.1,
1996
- "maximum": 1,
1997
- "default": 0.9,
1998
- "example": 0.85
1999
- },
2000
- "maxLines": {
2001
- "description": "Maximum number of lines to display at once. Must be between 1 and 10.",
2002
- "type": "integer",
2003
- "minimum": 1,
2004
- "maximum": 10,
2005
- "default": 2,
2006
- "example": 2
2007
2029
  }
2008
2030
  },
2009
2031
  "additionalProperties": false,
2010
2032
  "required": [
2011
- "type"
2012
- ]
2013
- },
2014
- "WordTiming": {
2015
- "description": "Word-level timing information for caption animation.",
2016
- "type": "object",
2017
- "properties": {
2018
- "text": {
2019
- "description": "The word text to display.",
2020
- "type": "string",
2021
- "minLength": 1,
2022
- "example": "Hello"
2023
- },
2024
- "start": {
2025
- "description": "Start time of the word in milliseconds.",
2026
- "type": "number",
2027
- "minimum": 0,
2028
- "example": 0
2029
- },
2030
- "end": {
2031
- "description": "End time of the word in milliseconds.",
2032
- "type": "number",
2033
- "minimum": 0,
2034
- "example": 400
2035
- },
2036
- "confidence": {
2037
- "description": "Speech-to-text confidence score between 0 and 1.",
2038
- "type": "number",
2039
- "minimum": 0,
2040
- "maximum": 1,
2041
- "example": 0.98
2042
- }
2043
- },
2044
- "additionalProperties": false,
2045
- "required": [
2046
- "text",
2047
- "start",
2048
- "end"
2033
+ "type",
2034
+ "src"
2049
2035
  ]
2050
2036
  },
2051
2037
  "RichCaptionActiveFont": {
@@ -2072,6 +2058,17 @@
2072
2058
  "maximum": 1,
2073
2059
  "default": 1,
2074
2060
  "example": 1
2061
+ },
2062
+ "textDecoration": {
2063
+ "description": "Text decoration to apply to the active word.",
2064
+ "type": "string",
2065
+ "enum": [
2066
+ "none",
2067
+ "underline",
2068
+ "line-through"
2069
+ ],
2070
+ "default": "none",
2071
+ "example": "underline"
2075
2072
  }
2076
2073
  },
2077
2074
  "additionalProperties": false
@@ -2088,6 +2085,10 @@
2088
2085
  "description": "Stroke properties for the active word.",
2089
2086
  "$ref": "#/components/schemas/RichTextStroke"
2090
2087
  },
2088
+ "shadow": {
2089
+ "description": "Shadow properties for the active word. Overrides the base shadow when a word is active.",
2090
+ "$ref": "#/components/schemas/RichTextShadow"
2091
+ },
2091
2092
  "scale": {
2092
2093
  "description": "Scale multiplier for the active word. 1.0 is normal size, 1.2 is 20% larger.",
2093
2094
  "type": "number",
@@ -1494,32 +1494,109 @@
1494
1494
  "type": "string"
1495
1495
  },
1496
1496
  "src": {
1497
- "anyOf": [
1498
- {
1499
- "type": "string"
1500
- },
1501
- {
1502
- "type": "null"
1503
- }
1504
- ]
1505
- },
1506
- "words": {
1507
- "anyOf": [
1508
- {
1509
- "type": "array",
1510
- "items": {
1511
- "$ref": "#/$defs/WordTiming"
1512
- }
1513
- },
1514
- {
1515
- "type": "null"
1516
- }
1517
- ]
1497
+ "type": "string"
1518
1498
  },
1519
1499
  "font": {
1520
1500
  "anyOf": [
1521
1501
  {
1522
- "$ref": "#/$defs/RichTextFont"
1502
+ "type": "object",
1503
+ "properties": {
1504
+ "family": {
1505
+ "anyOf": [
1506
+ {
1507
+ "type": "string",
1508
+ "enum": [
1509
+ "Roboto"
1510
+ ]
1511
+ },
1512
+ {
1513
+ "type": "null"
1514
+ }
1515
+ ]
1516
+ },
1517
+ "size": {
1518
+ "anyOf": [
1519
+ {
1520
+ "type": "integer",
1521
+ "minimum": 1,
1522
+ "maximum": 500
1523
+ },
1524
+ {
1525
+ "type": "null"
1526
+ }
1527
+ ]
1528
+ },
1529
+ "weight": {
1530
+ "anyOf": [
1531
+ {
1532
+ "type": "string"
1533
+ },
1534
+ {
1535
+ "type": "null"
1536
+ }
1537
+ ]
1538
+ },
1539
+ "color": {
1540
+ "anyOf": [
1541
+ {
1542
+ "type": "string",
1543
+ "enum": [
1544
+ "#ffffff"
1545
+ ]
1546
+ },
1547
+ {
1548
+ "type": "null"
1549
+ }
1550
+ ]
1551
+ },
1552
+ "opacity": {
1553
+ "anyOf": [
1554
+ {
1555
+ "type": "number",
1556
+ "minimum": 0,
1557
+ "maximum": 1
1558
+ },
1559
+ {
1560
+ "type": "null"
1561
+ }
1562
+ ]
1563
+ },
1564
+ "background": {
1565
+ "anyOf": [
1566
+ {
1567
+ "type": "string"
1568
+ },
1569
+ {
1570
+ "type": "null"
1571
+ }
1572
+ ]
1573
+ },
1574
+ "textDecoration": {
1575
+ "anyOf": [
1576
+ {
1577
+ "type": "string",
1578
+ "enum": [
1579
+ "none",
1580
+ "underline",
1581
+ "line-through"
1582
+ ]
1583
+ },
1584
+ {
1585
+ "type": "null"
1586
+ }
1587
+ ]
1588
+ }
1589
+ },
1590
+ "additionalProperties": false,
1591
+ "required": [
1592
+ "family",
1593
+ "size",
1594
+ "weight",
1595
+ "color",
1596
+ "opacity",
1597
+ "background",
1598
+ "textDecoration"
1599
+ ]
1523
1600
  },
1524
1601
  {
1525
1602
  "type": "null"
@@ -1566,6 +1643,16 @@
1566
1643
  }
1567
1644
  ]
1568
1645
  },
1646
+ "border": {
1647
+ "anyOf": [
1648
+ {
1649
+ "$ref": "#/$defs/RichTextAsset/properties/border"
1650
+ },
1651
+ {
1652
+ "type": "null"
1653
+ }
1654
+ ]
1655
+ },
1569
1656
  "padding": {
1570
1657
  "anyOf": [
1571
1658
  {
@@ -1609,118 +1696,51 @@
1609
1696
  "type": "null"
1610
1697
  }
1611
1698
  ]
1612
- },
1613
- "position": {
1614
- "anyOf": [
1615
- {
1616
- "type": "string",
1617
- "enum": [
1618
- "top",
1619
- "center",
1620
- "bottom"
1621
- ]
1622
- },
1623
- {
1624
- "type": "null"
1625
- }
1626
- ]
1627
- },
1628
- "maxWidth": {
1629
- "anyOf": [
1630
- {
1631
- "type": "number",
1632
- "minimum": 0.1,
1633
- "maximum": 1
1634
- },
1635
- {
1636
- "type": "null"
1637
- }
1638
- ]
1639
- },
1640
- "maxLines": {
1641
- "anyOf": [
1642
- {
1643
- "type": "integer",
1644
- "minimum": 1,
1645
- "maximum": 10
1646
- },
1647
- {
1648
- "type": "null"
1649
- }
1650
- ]
1651
1699
  }
1652
1700
  },
1653
1701
  "additionalProperties": false,
1654
1702
  "required": [
1655
1703
  "type",
1656
1704
  "src",
1657
- "words",
1658
1705
  "font",
1659
1706
  "style",
1660
1707
  "stroke",
1661
1708
  "shadow",
1662
1709
  "background",
1710
+ "border",
1663
1711
  "padding",
1664
1712
  "align",
1665
1713
  "active",
1666
- "wordAnimation",
1667
- "position",
1668
- "maxWidth",
1669
- "maxLines"
1714
+ "wordAnimation"
1670
1715
  ]
1671
1716
  },
1672
- "WordTiming": {
1717
+ "RichCaptionActive": {
1673
1718
  "type": "object",
1674
1719
  "properties": {
1675
- "text": {
1676
- "type": "string"
1677
- },
1678
- "start": {
1679
- "type": "number",
1680
- "minimum": 0
1681
- },
1682
- "end": {
1683
- "type": "number",
1684
- "minimum": 0
1685
- },
1686
- "confidence": {
1720
+ "font": {
1687
1721
  "anyOf": [
1688
1722
  {
1689
- "type": "number",
1690
- "minimum": 0,
1691
- "maximum": 1
1723
+ "$ref": "#/$defs/RichCaptionActiveFont"
1692
1724
  },
1693
1725
  {
1694
1726
  "type": "null"
1695
1727
  }
1696
1728
  ]
1697
- }
1698
- },
1699
- "additionalProperties": false,
1700
- "required": [
1701
- "text",
1702
- "start",
1703
- "end",
1704
- "confidence"
1705
- ]
1706
- },
1707
- "RichCaptionActive": {
1708
- "type": "object",
1709
- "properties": {
1710
- "font": {
1729
+ },
1730
+ "stroke": {
1711
1731
  "anyOf": [
1712
1732
  {
1713
- "$ref": "#/$defs/RichCaptionActiveFont"
1733
+ "$ref": "#/$defs/RichTextStroke"
1714
1734
  },
1715
1735
  {
1716
1736
  "type": "null"
1717
1737
  }
1718
1738
  ]
1719
1739
  },
1720
- "stroke": {
1740
+ "shadow": {
1721
1741
  "anyOf": [
1722
1742
  {
1723
- "$ref": "#/$defs/RichTextStroke"
1743
+ "$ref": "#/$defs/RichTextShadow"
1724
1744
  },
1725
1745
  {
1726
1746
  "type": "null"
@@ -1744,6 +1764,7 @@
1744
1764
  "required": [
1745
1765
  "font",
1746
1766
  "stroke",
1767
+ "shadow",
1747
1768
  "scale"
1748
1769
  ]
1749
1770
  },
@@ -1784,13 +1805,29 @@
1784
1805
  "type": "null"
1785
1806
  }
1786
1807
  ]
1808
+ },
1809
+ "textDecoration": {
1810
+ "anyOf": [
1811
+ {
1812
+ "type": "string",
1813
+ "enum": [
1814
+ "none",
1815
+ "underline",
1816
+ "line-through"
1817
+ ]
1818
+ },
1819
+ {
1820
+ "type": "null"
1821
+ }
1822
+ ]
1787
1823
  }
1788
1824
  },
1789
1825
  "additionalProperties": false,
1790
1826
  "required": [
1791
1827
  "color",
1792
1828
  "background",
1793
- "opacity"
1829
+ "opacity",
1830
+ "textDecoration"
1794
1831
  ]
1795
1832
  },
1796
1833
  "RichCaptionWordAnimation": {