@shotstack/schemas 1.7.1 → 1.8.3
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 +89 -89
- package/dist/api.bundled.json +43 -1
- package/dist/json-schema/asset.json +82 -1
- package/dist/json-schema/clip.json +82 -1
- package/dist/json-schema/edit.json +82 -1
- package/dist/json-schema/rich-caption-asset.json +221 -140
- package/dist/json-schema/schemas.json +88 -1
- package/dist/json-schema/timeline.json +82 -1
- package/dist/json-schema/track.json +82 -1
- package/dist/schema.d.ts +36 -1
- package/dist/zod/zod.gen.cjs +950 -1086
- package/dist/zod/zod.gen.d.ts +150 -484
- package/dist/zod/zod.gen.js +946 -1082
- package/dist/zod/zod.gen.ts +1660 -1583
- package/package.json +79 -79
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
|
package/dist/api.bundled.json
CHANGED
|
@@ -1934,7 +1934,49 @@
|
|
|
1934
1934
|
},
|
|
1935
1935
|
"font": {
|
|
1936
1936
|
"description": "Font styling properties for inactive words.",
|
|
1937
|
-
"
|
|
1937
|
+
"properties": {
|
|
1938
|
+
"family": {
|
|
1939
|
+
"description": "The font family name. This must be the Family name embedded in the font, i.e. \"Roboto\".",
|
|
1940
|
+
"type": "string",
|
|
1941
|
+
"example": "Roboto",
|
|
1942
|
+
"default": "Roboto"
|
|
1943
|
+
},
|
|
1944
|
+
"size": {
|
|
1945
|
+
"description": "The size of the font in pixels (px). Must be between 1 and 500.",
|
|
1946
|
+
"type": "integer",
|
|
1947
|
+
"minimum": 1,
|
|
1948
|
+
"maximum": 500,
|
|
1949
|
+
"default": 24,
|
|
1950
|
+
"example": 48
|
|
1951
|
+
},
|
|
1952
|
+
"weight": {
|
|
1953
|
+
"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).",
|
|
1954
|
+
"default": "400"
|
|
1955
|
+
},
|
|
1956
|
+
"color": {
|
|
1957
|
+
"description": "The text color using hexadecimal color notation.",
|
|
1958
|
+
"type": "string",
|
|
1959
|
+
"pattern": "^#[A-Fa-f0-9]{6}$",
|
|
1960
|
+
"default": "#ffffff",
|
|
1961
|
+
"example": "#ffffff"
|
|
1962
|
+
},
|
|
1963
|
+
"opacity": {
|
|
1964
|
+
"description": "The opacity of the text where 1 is opaque and 0 is transparent.",
|
|
1965
|
+
"type": "number",
|
|
1966
|
+
"minimum": 0,
|
|
1967
|
+
"maximum": 1,
|
|
1968
|
+
"default": 1,
|
|
1969
|
+
"example": 0.9
|
|
1970
|
+
},
|
|
1971
|
+
"background": {
|
|
1972
|
+
"description": "The background color behind the text using hexadecimal color notation.",
|
|
1973
|
+
"type": "string",
|
|
1974
|
+
"pattern": "^#[A-Fa-f0-9]{6}$",
|
|
1975
|
+
"example": "#000000"
|
|
1976
|
+
}
|
|
1977
|
+
},
|
|
1978
|
+
"additionalProperties": false,
|
|
1979
|
+
"type": "object"
|
|
1938
1980
|
},
|
|
1939
1981
|
"style": {
|
|
1940
1982
|
"description": "Text style properties including spacing, line height, and transformations.",
|
|
@@ -1519,7 +1519,88 @@
|
|
|
1519
1519
|
"font": {
|
|
1520
1520
|
"anyOf": [
|
|
1521
1521
|
{
|
|
1522
|
-
"
|
|
1522
|
+
"type": "object",
|
|
1523
|
+
"properties": {
|
|
1524
|
+
"family": {
|
|
1525
|
+
"anyOf": [
|
|
1526
|
+
{
|
|
1527
|
+
"type": "string",
|
|
1528
|
+
"enum": [
|
|
1529
|
+
"Roboto"
|
|
1530
|
+
]
|
|
1531
|
+
},
|
|
1532
|
+
{
|
|
1533
|
+
"type": "null"
|
|
1534
|
+
}
|
|
1535
|
+
]
|
|
1536
|
+
},
|
|
1537
|
+
"size": {
|
|
1538
|
+
"anyOf": [
|
|
1539
|
+
{
|
|
1540
|
+
"type": "integer",
|
|
1541
|
+
"minimum": 1,
|
|
1542
|
+
"maximum": 500
|
|
1543
|
+
},
|
|
1544
|
+
{
|
|
1545
|
+
"type": "null"
|
|
1546
|
+
}
|
|
1547
|
+
]
|
|
1548
|
+
},
|
|
1549
|
+
"weight": {
|
|
1550
|
+
"anyOf": [
|
|
1551
|
+
{
|
|
1552
|
+
"type": "string"
|
|
1553
|
+
},
|
|
1554
|
+
{
|
|
1555
|
+
"type": "null"
|
|
1556
|
+
}
|
|
1557
|
+
]
|
|
1558
|
+
},
|
|
1559
|
+
"color": {
|
|
1560
|
+
"anyOf": [
|
|
1561
|
+
{
|
|
1562
|
+
"type": "string",
|
|
1563
|
+
"enum": [
|
|
1564
|
+
"#ffffff"
|
|
1565
|
+
]
|
|
1566
|
+
},
|
|
1567
|
+
{
|
|
1568
|
+
"type": "null"
|
|
1569
|
+
}
|
|
1570
|
+
]
|
|
1571
|
+
},
|
|
1572
|
+
"opacity": {
|
|
1573
|
+
"anyOf": [
|
|
1574
|
+
{
|
|
1575
|
+
"type": "number",
|
|
1576
|
+
"minimum": 0,
|
|
1577
|
+
"maximum": 1
|
|
1578
|
+
},
|
|
1579
|
+
{
|
|
1580
|
+
"type": "null"
|
|
1581
|
+
}
|
|
1582
|
+
]
|
|
1583
|
+
},
|
|
1584
|
+
"background": {
|
|
1585
|
+
"anyOf": [
|
|
1586
|
+
{
|
|
1587
|
+
"type": "string"
|
|
1588
|
+
},
|
|
1589
|
+
{
|
|
1590
|
+
"type": "null"
|
|
1591
|
+
}
|
|
1592
|
+
]
|
|
1593
|
+
}
|
|
1594
|
+
},
|
|
1595
|
+
"additionalProperties": false,
|
|
1596
|
+
"required": [
|
|
1597
|
+
"family",
|
|
1598
|
+
"size",
|
|
1599
|
+
"weight",
|
|
1600
|
+
"color",
|
|
1601
|
+
"opacity",
|
|
1602
|
+
"background"
|
|
1603
|
+
]
|
|
1523
1604
|
},
|
|
1524
1605
|
{
|
|
1525
1606
|
"type": "null"
|
|
@@ -1751,7 +1751,88 @@
|
|
|
1751
1751
|
"font": {
|
|
1752
1752
|
"anyOf": [
|
|
1753
1753
|
{
|
|
1754
|
-
"
|
|
1754
|
+
"type": "object",
|
|
1755
|
+
"properties": {
|
|
1756
|
+
"family": {
|
|
1757
|
+
"anyOf": [
|
|
1758
|
+
{
|
|
1759
|
+
"type": "string",
|
|
1760
|
+
"enum": [
|
|
1761
|
+
"Roboto"
|
|
1762
|
+
]
|
|
1763
|
+
},
|
|
1764
|
+
{
|
|
1765
|
+
"type": "null"
|
|
1766
|
+
}
|
|
1767
|
+
]
|
|
1768
|
+
},
|
|
1769
|
+
"size": {
|
|
1770
|
+
"anyOf": [
|
|
1771
|
+
{
|
|
1772
|
+
"type": "integer",
|
|
1773
|
+
"minimum": 1,
|
|
1774
|
+
"maximum": 500
|
|
1775
|
+
},
|
|
1776
|
+
{
|
|
1777
|
+
"type": "null"
|
|
1778
|
+
}
|
|
1779
|
+
]
|
|
1780
|
+
},
|
|
1781
|
+
"weight": {
|
|
1782
|
+
"anyOf": [
|
|
1783
|
+
{
|
|
1784
|
+
"type": "string"
|
|
1785
|
+
},
|
|
1786
|
+
{
|
|
1787
|
+
"type": "null"
|
|
1788
|
+
}
|
|
1789
|
+
]
|
|
1790
|
+
},
|
|
1791
|
+
"color": {
|
|
1792
|
+
"anyOf": [
|
|
1793
|
+
{
|
|
1794
|
+
"type": "string",
|
|
1795
|
+
"enum": [
|
|
1796
|
+
"#ffffff"
|
|
1797
|
+
]
|
|
1798
|
+
},
|
|
1799
|
+
{
|
|
1800
|
+
"type": "null"
|
|
1801
|
+
}
|
|
1802
|
+
]
|
|
1803
|
+
},
|
|
1804
|
+
"opacity": {
|
|
1805
|
+
"anyOf": [
|
|
1806
|
+
{
|
|
1807
|
+
"type": "number",
|
|
1808
|
+
"minimum": 0,
|
|
1809
|
+
"maximum": 1
|
|
1810
|
+
},
|
|
1811
|
+
{
|
|
1812
|
+
"type": "null"
|
|
1813
|
+
}
|
|
1814
|
+
]
|
|
1815
|
+
},
|
|
1816
|
+
"background": {
|
|
1817
|
+
"anyOf": [
|
|
1818
|
+
{
|
|
1819
|
+
"type": "string"
|
|
1820
|
+
},
|
|
1821
|
+
{
|
|
1822
|
+
"type": "null"
|
|
1823
|
+
}
|
|
1824
|
+
]
|
|
1825
|
+
}
|
|
1826
|
+
},
|
|
1827
|
+
"additionalProperties": false,
|
|
1828
|
+
"required": [
|
|
1829
|
+
"family",
|
|
1830
|
+
"size",
|
|
1831
|
+
"weight",
|
|
1832
|
+
"color",
|
|
1833
|
+
"opacity",
|
|
1834
|
+
"background"
|
|
1835
|
+
]
|
|
1755
1836
|
},
|
|
1756
1837
|
{
|
|
1757
1838
|
"type": "null"
|
|
@@ -1935,7 +1935,88 @@
|
|
|
1935
1935
|
"font": {
|
|
1936
1936
|
"anyOf": [
|
|
1937
1937
|
{
|
|
1938
|
-
"
|
|
1938
|
+
"type": "object",
|
|
1939
|
+
"properties": {
|
|
1940
|
+
"family": {
|
|
1941
|
+
"anyOf": [
|
|
1942
|
+
{
|
|
1943
|
+
"type": "string",
|
|
1944
|
+
"enum": [
|
|
1945
|
+
"Roboto"
|
|
1946
|
+
]
|
|
1947
|
+
},
|
|
1948
|
+
{
|
|
1949
|
+
"type": "null"
|
|
1950
|
+
}
|
|
1951
|
+
]
|
|
1952
|
+
},
|
|
1953
|
+
"size": {
|
|
1954
|
+
"anyOf": [
|
|
1955
|
+
{
|
|
1956
|
+
"type": "integer",
|
|
1957
|
+
"minimum": 1,
|
|
1958
|
+
"maximum": 500
|
|
1959
|
+
},
|
|
1960
|
+
{
|
|
1961
|
+
"type": "null"
|
|
1962
|
+
}
|
|
1963
|
+
]
|
|
1964
|
+
},
|
|
1965
|
+
"weight": {
|
|
1966
|
+
"anyOf": [
|
|
1967
|
+
{
|
|
1968
|
+
"type": "string"
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
"type": "null"
|
|
1972
|
+
}
|
|
1973
|
+
]
|
|
1974
|
+
},
|
|
1975
|
+
"color": {
|
|
1976
|
+
"anyOf": [
|
|
1977
|
+
{
|
|
1978
|
+
"type": "string",
|
|
1979
|
+
"enum": [
|
|
1980
|
+
"#ffffff"
|
|
1981
|
+
]
|
|
1982
|
+
},
|
|
1983
|
+
{
|
|
1984
|
+
"type": "null"
|
|
1985
|
+
}
|
|
1986
|
+
]
|
|
1987
|
+
},
|
|
1988
|
+
"opacity": {
|
|
1989
|
+
"anyOf": [
|
|
1990
|
+
{
|
|
1991
|
+
"type": "number",
|
|
1992
|
+
"minimum": 0,
|
|
1993
|
+
"maximum": 1
|
|
1994
|
+
},
|
|
1995
|
+
{
|
|
1996
|
+
"type": "null"
|
|
1997
|
+
}
|
|
1998
|
+
]
|
|
1999
|
+
},
|
|
2000
|
+
"background": {
|
|
2001
|
+
"anyOf": [
|
|
2002
|
+
{
|
|
2003
|
+
"type": "string"
|
|
2004
|
+
},
|
|
2005
|
+
{
|
|
2006
|
+
"type": "null"
|
|
2007
|
+
}
|
|
2008
|
+
]
|
|
2009
|
+
}
|
|
2010
|
+
},
|
|
2011
|
+
"additionalProperties": false,
|
|
2012
|
+
"required": [
|
|
2013
|
+
"family",
|
|
2014
|
+
"size",
|
|
2015
|
+
"weight",
|
|
2016
|
+
"color",
|
|
2017
|
+
"opacity",
|
|
2018
|
+
"background"
|
|
2019
|
+
]
|
|
1939
2020
|
},
|
|
1940
2021
|
{
|
|
1941
2022
|
"type": "null"
|