@agentmedia/schema 0.1.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/__tests__/parity.test.d.ts +2 -0
- package/dist/__tests__/parity.test.d.ts.map +1 -0
- package/dist/__tests__/parity.test.js +329 -0
- package/dist/__tests__/parity.test.js.map +1 -0
- package/dist/account.d.ts +8 -0
- package/dist/account.d.ts.map +1 -0
- package/dist/account.js +7 -0
- package/dist/account.js.map +1 -0
- package/dist/actors.d.ts +25 -0
- package/dist/actors.d.ts.map +1 -0
- package/dist/actors.js +8 -0
- package/dist/actors.js.map +1 -0
- package/dist/errors.d.ts +21 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +16 -0
- package/dist/errors.js.map +1 -0
- package/dist/generators.d.ts +253 -0
- package/dist/generators.d.ts.map +1 -0
- package/dist/generators.js +28 -0
- package/dist/generators.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/video.d.ts +373 -0
- package/dist/video.d.ts.map +1 -0
- package/dist/video.js +176 -0
- package/dist/video.js.map +1 -0
- package/package.json +34 -0
- package/scripts/check-spec-freshness.ts +41 -0
- package/scripts/generate-edge-schema.ts +77 -0
- package/scripts/generate-openapi.ts +403 -0
- package/src/__tests__/parity.test.ts +427 -0
- package/src/account.ts +11 -0
- package/src/actors.ts +30 -0
- package/src/errors.ts +25 -0
- package/src/generators.ts +33 -0
- package/src/index.ts +12 -0
- package/src/video.ts +235 -0
- package/tsconfig.json +9 -0
package/dist/video.d.ts
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video-related enums, types, and validation schemas.
|
|
3
|
+
*
|
|
4
|
+
* This is the SINGLE SOURCE OF TRUTH for all video option values.
|
|
5
|
+
* Every consumer (API, CLI, dashboard, edge functions, docs, MCP, SDKs)
|
|
6
|
+
* must import from here — never hardcode these values.
|
|
7
|
+
*
|
|
8
|
+
* IMPORTANT: Values must exactly match what is currently in production.
|
|
9
|
+
* Any change to this file will propagate to all consumers on next build.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
export declare const DURATIONS: readonly [5, 10, 15];
|
|
13
|
+
export type Duration = (typeof DURATIONS)[number];
|
|
14
|
+
export declare const TONES: readonly ["energetic", "calm", "confident", "dramatic"];
|
|
15
|
+
export type Tone = (typeof TONES)[number];
|
|
16
|
+
export declare const MUSIC_GENRES: readonly ["chill", "energetic", "corporate", "dramatic", "upbeat"];
|
|
17
|
+
export type MusicGenre = (typeof MUSIC_GENRES)[number];
|
|
18
|
+
export declare const SUBTITLE_STYLES: readonly ["hormozi", "minimal", "bold", "karaoke", "clean", "tiktok", "neon", "fire", "glow", "pop", "aesthetic", "impact", "pastel", "electric", "boxed", "gradient", "spotlight"];
|
|
19
|
+
export type SubtitleStyle = (typeof SUBTITLE_STYLES)[number];
|
|
20
|
+
export declare const ASPECT_RATIOS: readonly ["9:16", "16:9", "1:1"];
|
|
21
|
+
export type AspectRatio = (typeof ASPECT_RATIOS)[number];
|
|
22
|
+
/**
|
|
23
|
+
* Currently supported scene types. The API validator previously accepted
|
|
24
|
+
* 'narration', 'image', and 'transition' but the backend only processes
|
|
25
|
+
* these two. Additional types will be added here once backend handlers exist.
|
|
26
|
+
*/
|
|
27
|
+
export declare const SCENE_TYPES: readonly ["talking_head", "broll"];
|
|
28
|
+
export type SceneType = (typeof SCENE_TYPES)[number];
|
|
29
|
+
export declare const TEMPLATES: readonly ["monologue", "testimonial", "product-review", "problem-solution", "saas-review", "before-after", "listicle", "product-demo"];
|
|
30
|
+
export type Template = (typeof TEMPLATES)[number];
|
|
31
|
+
export declare const VOICES: readonly ["alloy", "echo", "fable", "onyx", "nova", "shimmer"];
|
|
32
|
+
export type Voice = (typeof VOICES)[number];
|
|
33
|
+
export declare const TTS_PROVIDERS: readonly ["openai", "elevenlabs", "hume"];
|
|
34
|
+
export type TTSProvider = (typeof TTS_PROVIDERS)[number];
|
|
35
|
+
export declare const REVIEW_ANGLES: readonly ["honest", "enthusiastic", "roast", "tutorial", "comparison"];
|
|
36
|
+
export type ReviewAngle = (typeof REVIEW_ANGLES)[number];
|
|
37
|
+
export declare const PIP_POSITIONS: readonly ["bottom-center", "bottom-left", "bottom-right"];
|
|
38
|
+
export type PIPPosition = (typeof PIP_POSITIONS)[number];
|
|
39
|
+
export declare const PIP_SIZES: readonly ["small", "medium", "large"];
|
|
40
|
+
export type PIPSize = (typeof PIP_SIZES)[number];
|
|
41
|
+
export declare const PIP_ANIMATIONS: readonly ["slide-up", "slide-left", "slide-right", "fade", "scale"];
|
|
42
|
+
export type PIPAnimation = (typeof PIP_ANIMATIONS)[number];
|
|
43
|
+
export declare const PIP_FRAME_STYLES: readonly ["none", "rounded", "shadow"];
|
|
44
|
+
export type PIPFrameStyle = (typeof PIP_FRAME_STYLES)[number];
|
|
45
|
+
export declare const COMPOSITION_MODES: readonly ["pip"];
|
|
46
|
+
export type CompositionMode = (typeof COMPOSITION_MODES)[number];
|
|
47
|
+
/**
|
|
48
|
+
* B-roll model names. DEPRECATED — backend auto-selects the best model.
|
|
49
|
+
* Kept in schema for backwards compatibility (accept but ignore).
|
|
50
|
+
* Will be removed in schema v2.0.0.
|
|
51
|
+
* @deprecated Use the default — backend auto-selects the best model.
|
|
52
|
+
*/
|
|
53
|
+
export declare const BROLL_MODELS: readonly ["kling3", "hailuo2", "wan21"];
|
|
54
|
+
export type BrollModel = (typeof BROLL_MODELS)[number];
|
|
55
|
+
export declare const CREDITS_PER_SECOND = 30;
|
|
56
|
+
export declare const SCRIPT_GENERATION_CREDIT_SURCHARGE = 5;
|
|
57
|
+
export declare const PipOptionsSchema: z.ZodObject<{
|
|
58
|
+
position: z.ZodOptional<z.ZodEnum<["bottom-center", "bottom-left", "bottom-right"]>>;
|
|
59
|
+
size: z.ZodOptional<z.ZodEnum<["small", "medium", "large"]>>;
|
|
60
|
+
animation: z.ZodOptional<z.ZodEnum<["slide-up", "slide-left", "slide-right", "fade", "scale"]>>;
|
|
61
|
+
frame_style: z.ZodOptional<z.ZodEnum<["none", "rounded", "shadow"]>>;
|
|
62
|
+
}, "strict", z.ZodTypeAny, {
|
|
63
|
+
position?: "bottom-center" | "bottom-left" | "bottom-right" | undefined;
|
|
64
|
+
size?: "medium" | "small" | "large" | undefined;
|
|
65
|
+
animation?: "slide-up" | "slide-left" | "slide-right" | "fade" | "scale" | undefined;
|
|
66
|
+
frame_style?: "none" | "rounded" | "shadow" | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
position?: "bottom-center" | "bottom-left" | "bottom-right" | undefined;
|
|
69
|
+
size?: "medium" | "small" | "large" | undefined;
|
|
70
|
+
animation?: "slide-up" | "slide-left" | "slide-right" | "fade" | "scale" | undefined;
|
|
71
|
+
frame_style?: "none" | "rounded" | "shadow" | undefined;
|
|
72
|
+
}>;
|
|
73
|
+
export type PipOptions = z.infer<typeof PipOptionsSchema>;
|
|
74
|
+
/**
|
|
75
|
+
* Grouped parameter objects — better DX for new integrations.
|
|
76
|
+
* These are optional alternatives to the flat params.
|
|
77
|
+
* The preprocess step flattens them so downstream code stays unchanged.
|
|
78
|
+
*/
|
|
79
|
+
export declare const ActorConfigSchema: z.ZodOptional<z.ZodObject<{
|
|
80
|
+
slug: z.ZodOptional<z.ZodString>;
|
|
81
|
+
persona_slug: z.ZodOptional<z.ZodString>;
|
|
82
|
+
face_photo_url: z.ZodOptional<z.ZodString>;
|
|
83
|
+
voice: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, "strict", z.ZodTypeAny, {
|
|
85
|
+
slug?: string | undefined;
|
|
86
|
+
persona_slug?: string | undefined;
|
|
87
|
+
face_photo_url?: string | undefined;
|
|
88
|
+
voice?: string | undefined;
|
|
89
|
+
}, {
|
|
90
|
+
slug?: string | undefined;
|
|
91
|
+
persona_slug?: string | undefined;
|
|
92
|
+
face_photo_url?: string | undefined;
|
|
93
|
+
voice?: string | undefined;
|
|
94
|
+
}>>;
|
|
95
|
+
export declare const OutputConfigSchema: z.ZodOptional<z.ZodObject<{
|
|
96
|
+
duration: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
97
|
+
aspect_ratio: z.ZodOptional<z.ZodEnum<["9:16", "16:9", "1:1"]>>;
|
|
98
|
+
style: z.ZodOptional<z.ZodString>;
|
|
99
|
+
music: z.ZodOptional<z.ZodEnum<["chill", "energetic", "corporate", "dramatic", "upbeat"]>>;
|
|
100
|
+
cta: z.ZodOptional<z.ZodString>;
|
|
101
|
+
}, "strict", z.ZodTypeAny, {
|
|
102
|
+
duration?: number | undefined;
|
|
103
|
+
aspect_ratio?: "9:16" | "16:9" | "1:1" | undefined;
|
|
104
|
+
style?: string | undefined;
|
|
105
|
+
music?: "energetic" | "dramatic" | "chill" | "corporate" | "upbeat" | undefined;
|
|
106
|
+
cta?: string | undefined;
|
|
107
|
+
}, {
|
|
108
|
+
duration?: number | undefined;
|
|
109
|
+
aspect_ratio?: "9:16" | "16:9" | "1:1" | undefined;
|
|
110
|
+
style?: string | undefined;
|
|
111
|
+
music?: "energetic" | "dramatic" | "chill" | "corporate" | "upbeat" | undefined;
|
|
112
|
+
cta?: string | undefined;
|
|
113
|
+
}>>;
|
|
114
|
+
export declare const BrollConfigSchema: z.ZodOptional<z.ZodObject<{
|
|
115
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
images: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
117
|
+
}, "strict", z.ZodTypeAny, {
|
|
118
|
+
enabled?: boolean | undefined;
|
|
119
|
+
images?: string[] | undefined;
|
|
120
|
+
}, {
|
|
121
|
+
enabled?: boolean | undefined;
|
|
122
|
+
images?: string[] | undefined;
|
|
123
|
+
}>>;
|
|
124
|
+
/**
|
|
125
|
+
* Zod schema for video generation.
|
|
126
|
+
*
|
|
127
|
+
* Accepts both flat params and grouped objects:
|
|
128
|
+
* Flat: { actor_slug: "sofia", target_duration: 10, allow_broll: true }
|
|
129
|
+
* Grouped: { actor: { slug: "sofia" }, output: { duration: 10 }, broll: { enabled: true } }
|
|
130
|
+
* Mixed: { actor: { slug: "sofia" }, target_duration: 10, allow_broll: true }
|
|
131
|
+
*
|
|
132
|
+
* Flat params take precedence over grouped when both are provided.
|
|
133
|
+
*/
|
|
134
|
+
export declare const CreateVideoSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
135
|
+
script: z.ZodOptional<z.ZodString>;
|
|
136
|
+
prompt: z.ZodOptional<z.ZodString>;
|
|
137
|
+
product_url: z.ZodOptional<z.ZodString>;
|
|
138
|
+
actor_slug: z.ZodOptional<z.ZodString>;
|
|
139
|
+
persona_slug: z.ZodOptional<z.ZodString>;
|
|
140
|
+
face_photo_url: z.ZodOptional<z.ZodString>;
|
|
141
|
+
voice: z.ZodOptional<z.ZodString>;
|
|
142
|
+
target_duration: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
143
|
+
style: z.ZodOptional<z.ZodString>;
|
|
144
|
+
tone: z.ZodOptional<z.ZodEnum<["energetic", "calm", "confident", "dramatic"]>>;
|
|
145
|
+
voice_speed: z.ZodOptional<z.ZodNumber>;
|
|
146
|
+
music: z.ZodOptional<z.ZodEnum<["chill", "energetic", "corporate", "dramatic", "upbeat"]>>;
|
|
147
|
+
cta: z.ZodOptional<z.ZodString>;
|
|
148
|
+
aspect_ratio: z.ZodOptional<z.ZodEnum<["9:16", "16:9", "1:1"]>>;
|
|
149
|
+
template: z.ZodOptional<z.ZodString>;
|
|
150
|
+
composition_mode: z.ZodOptional<z.ZodLiteral<"pip">>;
|
|
151
|
+
pip_options: z.ZodOptional<z.ZodObject<{
|
|
152
|
+
position: z.ZodOptional<z.ZodEnum<["bottom-center", "bottom-left", "bottom-right"]>>;
|
|
153
|
+
size: z.ZodOptional<z.ZodEnum<["small", "medium", "large"]>>;
|
|
154
|
+
animation: z.ZodOptional<z.ZodEnum<["slide-up", "slide-left", "slide-right", "fade", "scale"]>>;
|
|
155
|
+
frame_style: z.ZodOptional<z.ZodEnum<["none", "rounded", "shadow"]>>;
|
|
156
|
+
}, "strict", z.ZodTypeAny, {
|
|
157
|
+
position?: "bottom-center" | "bottom-left" | "bottom-right" | undefined;
|
|
158
|
+
size?: "medium" | "small" | "large" | undefined;
|
|
159
|
+
animation?: "slide-up" | "slide-left" | "slide-right" | "fade" | "scale" | undefined;
|
|
160
|
+
frame_style?: "none" | "rounded" | "shadow" | undefined;
|
|
161
|
+
}, {
|
|
162
|
+
position?: "bottom-center" | "bottom-left" | "bottom-right" | undefined;
|
|
163
|
+
size?: "medium" | "small" | "large" | undefined;
|
|
164
|
+
animation?: "slide-up" | "slide-left" | "slide-right" | "fade" | "scale" | undefined;
|
|
165
|
+
frame_style?: "none" | "rounded" | "shadow" | undefined;
|
|
166
|
+
}>>;
|
|
167
|
+
allow_broll: z.ZodOptional<z.ZodBoolean>;
|
|
168
|
+
broll_model: z.ZodOptional<z.ZodEnum<["kling3", "hailuo2", "wan21"]>>;
|
|
169
|
+
broll_images: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
170
|
+
product_image_url: z.ZodOptional<z.ZodString>;
|
|
171
|
+
dub_language: z.ZodOptional<z.ZodString>;
|
|
172
|
+
webhook_url: z.ZodOptional<z.ZodString>;
|
|
173
|
+
scenes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
174
|
+
type: z.ZodOptional<z.ZodEnum<["talking_head", "broll"]>>;
|
|
175
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
176
|
+
type: z.ZodOptional<z.ZodEnum<["talking_head", "broll"]>>;
|
|
177
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
178
|
+
type: z.ZodOptional<z.ZodEnum<["talking_head", "broll"]>>;
|
|
179
|
+
}, z.ZodTypeAny, "passthrough">>, "many">>;
|
|
180
|
+
}, "strip", z.ZodTypeAny, {
|
|
181
|
+
persona_slug?: string | undefined;
|
|
182
|
+
face_photo_url?: string | undefined;
|
|
183
|
+
voice?: string | undefined;
|
|
184
|
+
aspect_ratio?: "9:16" | "16:9" | "1:1" | undefined;
|
|
185
|
+
style?: string | undefined;
|
|
186
|
+
music?: "energetic" | "dramatic" | "chill" | "corporate" | "upbeat" | undefined;
|
|
187
|
+
cta?: string | undefined;
|
|
188
|
+
actor_slug?: string | undefined;
|
|
189
|
+
target_duration?: number | undefined;
|
|
190
|
+
allow_broll?: boolean | undefined;
|
|
191
|
+
broll_images?: string[] | undefined;
|
|
192
|
+
script?: string | undefined;
|
|
193
|
+
prompt?: string | undefined;
|
|
194
|
+
product_url?: string | undefined;
|
|
195
|
+
tone?: "energetic" | "calm" | "confident" | "dramatic" | undefined;
|
|
196
|
+
voice_speed?: number | undefined;
|
|
197
|
+
template?: string | undefined;
|
|
198
|
+
composition_mode?: "pip" | undefined;
|
|
199
|
+
pip_options?: {
|
|
200
|
+
position?: "bottom-center" | "bottom-left" | "bottom-right" | undefined;
|
|
201
|
+
size?: "medium" | "small" | "large" | undefined;
|
|
202
|
+
animation?: "slide-up" | "slide-left" | "slide-right" | "fade" | "scale" | undefined;
|
|
203
|
+
frame_style?: "none" | "rounded" | "shadow" | undefined;
|
|
204
|
+
} | undefined;
|
|
205
|
+
broll_model?: "kling3" | "hailuo2" | "wan21" | undefined;
|
|
206
|
+
product_image_url?: string | undefined;
|
|
207
|
+
dub_language?: string | undefined;
|
|
208
|
+
webhook_url?: string | undefined;
|
|
209
|
+
scenes?: z.objectOutputType<{
|
|
210
|
+
type: z.ZodOptional<z.ZodEnum<["talking_head", "broll"]>>;
|
|
211
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
212
|
+
}, {
|
|
213
|
+
persona_slug?: string | undefined;
|
|
214
|
+
face_photo_url?: string | undefined;
|
|
215
|
+
voice?: string | undefined;
|
|
216
|
+
aspect_ratio?: "9:16" | "16:9" | "1:1" | undefined;
|
|
217
|
+
style?: string | undefined;
|
|
218
|
+
music?: "energetic" | "dramatic" | "chill" | "corporate" | "upbeat" | undefined;
|
|
219
|
+
cta?: string | undefined;
|
|
220
|
+
actor_slug?: string | undefined;
|
|
221
|
+
target_duration?: number | undefined;
|
|
222
|
+
allow_broll?: boolean | undefined;
|
|
223
|
+
broll_images?: string[] | undefined;
|
|
224
|
+
script?: string | undefined;
|
|
225
|
+
prompt?: string | undefined;
|
|
226
|
+
product_url?: string | undefined;
|
|
227
|
+
tone?: "energetic" | "calm" | "confident" | "dramatic" | undefined;
|
|
228
|
+
voice_speed?: number | undefined;
|
|
229
|
+
template?: string | undefined;
|
|
230
|
+
composition_mode?: "pip" | undefined;
|
|
231
|
+
pip_options?: {
|
|
232
|
+
position?: "bottom-center" | "bottom-left" | "bottom-right" | undefined;
|
|
233
|
+
size?: "medium" | "small" | "large" | undefined;
|
|
234
|
+
animation?: "slide-up" | "slide-left" | "slide-right" | "fade" | "scale" | undefined;
|
|
235
|
+
frame_style?: "none" | "rounded" | "shadow" | undefined;
|
|
236
|
+
} | undefined;
|
|
237
|
+
broll_model?: "kling3" | "hailuo2" | "wan21" | undefined;
|
|
238
|
+
product_image_url?: string | undefined;
|
|
239
|
+
dub_language?: string | undefined;
|
|
240
|
+
webhook_url?: string | undefined;
|
|
241
|
+
scenes?: z.objectInputType<{
|
|
242
|
+
type: z.ZodOptional<z.ZodEnum<["talking_head", "broll"]>>;
|
|
243
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
244
|
+
}>, {
|
|
245
|
+
persona_slug?: string | undefined;
|
|
246
|
+
face_photo_url?: string | undefined;
|
|
247
|
+
voice?: string | undefined;
|
|
248
|
+
aspect_ratio?: "9:16" | "16:9" | "1:1" | undefined;
|
|
249
|
+
style?: string | undefined;
|
|
250
|
+
music?: "energetic" | "dramatic" | "chill" | "corporate" | "upbeat" | undefined;
|
|
251
|
+
cta?: string | undefined;
|
|
252
|
+
actor_slug?: string | undefined;
|
|
253
|
+
target_duration?: number | undefined;
|
|
254
|
+
allow_broll?: boolean | undefined;
|
|
255
|
+
broll_images?: string[] | undefined;
|
|
256
|
+
script?: string | undefined;
|
|
257
|
+
prompt?: string | undefined;
|
|
258
|
+
product_url?: string | undefined;
|
|
259
|
+
tone?: "energetic" | "calm" | "confident" | "dramatic" | undefined;
|
|
260
|
+
voice_speed?: number | undefined;
|
|
261
|
+
template?: string | undefined;
|
|
262
|
+
composition_mode?: "pip" | undefined;
|
|
263
|
+
pip_options?: {
|
|
264
|
+
position?: "bottom-center" | "bottom-left" | "bottom-right" | undefined;
|
|
265
|
+
size?: "medium" | "small" | "large" | undefined;
|
|
266
|
+
animation?: "slide-up" | "slide-left" | "slide-right" | "fade" | "scale" | undefined;
|
|
267
|
+
frame_style?: "none" | "rounded" | "shadow" | undefined;
|
|
268
|
+
} | undefined;
|
|
269
|
+
broll_model?: "kling3" | "hailuo2" | "wan21" | undefined;
|
|
270
|
+
product_image_url?: string | undefined;
|
|
271
|
+
dub_language?: string | undefined;
|
|
272
|
+
webhook_url?: string | undefined;
|
|
273
|
+
scenes?: z.objectOutputType<{
|
|
274
|
+
type: z.ZodOptional<z.ZodEnum<["talking_head", "broll"]>>;
|
|
275
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
276
|
+
}, {
|
|
277
|
+
persona_slug?: string | undefined;
|
|
278
|
+
face_photo_url?: string | undefined;
|
|
279
|
+
voice?: string | undefined;
|
|
280
|
+
aspect_ratio?: "9:16" | "16:9" | "1:1" | undefined;
|
|
281
|
+
style?: string | undefined;
|
|
282
|
+
music?: "energetic" | "dramatic" | "chill" | "corporate" | "upbeat" | undefined;
|
|
283
|
+
cta?: string | undefined;
|
|
284
|
+
actor_slug?: string | undefined;
|
|
285
|
+
target_duration?: number | undefined;
|
|
286
|
+
allow_broll?: boolean | undefined;
|
|
287
|
+
broll_images?: string[] | undefined;
|
|
288
|
+
script?: string | undefined;
|
|
289
|
+
prompt?: string | undefined;
|
|
290
|
+
product_url?: string | undefined;
|
|
291
|
+
tone?: "energetic" | "calm" | "confident" | "dramatic" | undefined;
|
|
292
|
+
voice_speed?: number | undefined;
|
|
293
|
+
template?: string | undefined;
|
|
294
|
+
composition_mode?: "pip" | undefined;
|
|
295
|
+
pip_options?: {
|
|
296
|
+
position?: "bottom-center" | "bottom-left" | "bottom-right" | undefined;
|
|
297
|
+
size?: "medium" | "small" | "large" | undefined;
|
|
298
|
+
animation?: "slide-up" | "slide-left" | "slide-right" | "fade" | "scale" | undefined;
|
|
299
|
+
frame_style?: "none" | "rounded" | "shadow" | undefined;
|
|
300
|
+
} | undefined;
|
|
301
|
+
broll_model?: "kling3" | "hailuo2" | "wan21" | undefined;
|
|
302
|
+
product_image_url?: string | undefined;
|
|
303
|
+
dub_language?: string | undefined;
|
|
304
|
+
webhook_url?: string | undefined;
|
|
305
|
+
scenes?: z.objectInputType<{
|
|
306
|
+
type: z.ZodOptional<z.ZodEnum<["talking_head", "broll"]>>;
|
|
307
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
308
|
+
}>, {
|
|
309
|
+
persona_slug?: string | undefined;
|
|
310
|
+
face_photo_url?: string | undefined;
|
|
311
|
+
voice?: string | undefined;
|
|
312
|
+
aspect_ratio?: "9:16" | "16:9" | "1:1" | undefined;
|
|
313
|
+
style?: string | undefined;
|
|
314
|
+
music?: "energetic" | "dramatic" | "chill" | "corporate" | "upbeat" | undefined;
|
|
315
|
+
cta?: string | undefined;
|
|
316
|
+
actor_slug?: string | undefined;
|
|
317
|
+
target_duration?: number | undefined;
|
|
318
|
+
allow_broll?: boolean | undefined;
|
|
319
|
+
broll_images?: string[] | undefined;
|
|
320
|
+
script?: string | undefined;
|
|
321
|
+
prompt?: string | undefined;
|
|
322
|
+
product_url?: string | undefined;
|
|
323
|
+
tone?: "energetic" | "calm" | "confident" | "dramatic" | undefined;
|
|
324
|
+
voice_speed?: number | undefined;
|
|
325
|
+
template?: string | undefined;
|
|
326
|
+
composition_mode?: "pip" | undefined;
|
|
327
|
+
pip_options?: {
|
|
328
|
+
position?: "bottom-center" | "bottom-left" | "bottom-right" | undefined;
|
|
329
|
+
size?: "medium" | "small" | "large" | undefined;
|
|
330
|
+
animation?: "slide-up" | "slide-left" | "slide-right" | "fade" | "scale" | undefined;
|
|
331
|
+
frame_style?: "none" | "rounded" | "shadow" | undefined;
|
|
332
|
+
} | undefined;
|
|
333
|
+
broll_model?: "kling3" | "hailuo2" | "wan21" | undefined;
|
|
334
|
+
product_image_url?: string | undefined;
|
|
335
|
+
dub_language?: string | undefined;
|
|
336
|
+
webhook_url?: string | undefined;
|
|
337
|
+
scenes?: z.objectOutputType<{
|
|
338
|
+
type: z.ZodOptional<z.ZodEnum<["talking_head", "broll"]>>;
|
|
339
|
+
}, z.ZodTypeAny, "passthrough">[] | undefined;
|
|
340
|
+
}, unknown>;
|
|
341
|
+
export type CreateVideoInput = z.infer<typeof CreateVideoSchema>;
|
|
342
|
+
export declare const SubtitleSchema: z.ZodObject<{
|
|
343
|
+
video_url: z.ZodString;
|
|
344
|
+
style: z.ZodOptional<z.ZodEnum<["hormozi", "minimal", "bold", "karaoke", "clean", "tiktok", "neon", "fire", "glow", "pop", "aesthetic", "impact", "pastel", "electric", "boxed", "gradient", "spotlight"]>>;
|
|
345
|
+
}, "strip", z.ZodTypeAny, {
|
|
346
|
+
video_url: string;
|
|
347
|
+
style?: "hormozi" | "minimal" | "bold" | "karaoke" | "clean" | "tiktok" | "neon" | "fire" | "glow" | "pop" | "aesthetic" | "impact" | "pastel" | "electric" | "boxed" | "gradient" | "spotlight" | undefined;
|
|
348
|
+
}, {
|
|
349
|
+
video_url: string;
|
|
350
|
+
style?: "hormozi" | "minimal" | "bold" | "karaoke" | "clean" | "tiktok" | "neon" | "fire" | "glow" | "pop" | "aesthetic" | "impact" | "pastel" | "electric" | "boxed" | "gradient" | "spotlight" | undefined;
|
|
351
|
+
}>;
|
|
352
|
+
export type SubtitleInput = z.infer<typeof SubtitleSchema>;
|
|
353
|
+
export declare const ProductReviewSchema: z.ZodObject<{
|
|
354
|
+
product_url: z.ZodString;
|
|
355
|
+
angle: z.ZodOptional<z.ZodEnum<["honest", "enthusiastic", "roast", "tutorial", "comparison"]>>;
|
|
356
|
+
tone: z.ZodOptional<z.ZodEnum<["energetic", "calm", "confident", "dramatic"]>>;
|
|
357
|
+
actor_slug: z.ZodOptional<z.ZodString>;
|
|
358
|
+
target_duration: z.ZodOptional<z.ZodEffects<z.ZodNumber, number, number>>;
|
|
359
|
+
}, "strip", z.ZodTypeAny, {
|
|
360
|
+
product_url: string;
|
|
361
|
+
actor_slug?: string | undefined;
|
|
362
|
+
target_duration?: number | undefined;
|
|
363
|
+
tone?: "energetic" | "calm" | "confident" | "dramatic" | undefined;
|
|
364
|
+
angle?: "honest" | "enthusiastic" | "roast" | "tutorial" | "comparison" | undefined;
|
|
365
|
+
}, {
|
|
366
|
+
product_url: string;
|
|
367
|
+
actor_slug?: string | undefined;
|
|
368
|
+
target_duration?: number | undefined;
|
|
369
|
+
tone?: "energetic" | "calm" | "confident" | "dramatic" | undefined;
|
|
370
|
+
angle?: "honest" | "enthusiastic" | "roast" | "tutorial" | "comparison" | undefined;
|
|
371
|
+
}>;
|
|
372
|
+
export type ProductReviewInput = z.infer<typeof ProductReviewSchema>;
|
|
373
|
+
//# sourceMappingURL=video.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video.d.ts","sourceRoot":"","sources":["../src/video.ts"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,SAAS,sBAAuB,CAAC;AAC9C,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,eAAO,MAAM,KAAK,yDAA0D,CAAC;AAC7E,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AA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B,CAAC,CAAC;AAEjE,eAAO,MAAM,cAAc;;;;;;;;;EAGzB,CAAC;AAEH,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAE3D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;EAS9B,CAAC;AAEH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC"}
|
package/dist/video.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// Copyright 2026 agent-media contributors. Apache-2.0 license.
|
|
2
|
+
/**
|
|
3
|
+
* Video-related enums, types, and validation schemas.
|
|
4
|
+
*
|
|
5
|
+
* This is the SINGLE SOURCE OF TRUTH for all video option values.
|
|
6
|
+
* Every consumer (API, CLI, dashboard, edge functions, docs, MCP, SDKs)
|
|
7
|
+
* must import from here — never hardcode these values.
|
|
8
|
+
*
|
|
9
|
+
* IMPORTANT: Values must exactly match what is currently in production.
|
|
10
|
+
* Any change to this file will propagate to all consumers on next build.
|
|
11
|
+
*/
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
// ── Enums (as const + derived types) ────────────────────────────────────────
|
|
14
|
+
export const DURATIONS = [5, 10, 15];
|
|
15
|
+
export const TONES = ['energetic', 'calm', 'confident', 'dramatic'];
|
|
16
|
+
export const MUSIC_GENRES = ['chill', 'energetic', 'corporate', 'dramatic', 'upbeat'];
|
|
17
|
+
export const SUBTITLE_STYLES = [
|
|
18
|
+
'hormozi', 'minimal', 'bold', 'karaoke', 'clean',
|
|
19
|
+
'tiktok', 'neon', 'fire', 'glow', 'pop', 'aesthetic',
|
|
20
|
+
'impact', 'pastel', 'electric', 'boxed', 'gradient', 'spotlight',
|
|
21
|
+
];
|
|
22
|
+
export const ASPECT_RATIOS = ['9:16', '16:9', '1:1'];
|
|
23
|
+
/**
|
|
24
|
+
* Currently supported scene types. The API validator previously accepted
|
|
25
|
+
* 'narration', 'image', and 'transition' but the backend only processes
|
|
26
|
+
* these two. Additional types will be added here once backend handlers exist.
|
|
27
|
+
*/
|
|
28
|
+
export const SCENE_TYPES = ['talking_head', 'broll'];
|
|
29
|
+
export const TEMPLATES = [
|
|
30
|
+
'monologue', 'testimonial', 'product-review', 'problem-solution',
|
|
31
|
+
'saas-review', 'before-after', 'listicle', 'product-demo',
|
|
32
|
+
];
|
|
33
|
+
export const VOICES = ['alloy', 'echo', 'fable', 'onyx', 'nova', 'shimmer'];
|
|
34
|
+
export const TTS_PROVIDERS = ['openai', 'elevenlabs', 'hume'];
|
|
35
|
+
export const REVIEW_ANGLES = ['honest', 'enthusiastic', 'roast', 'tutorial', 'comparison'];
|
|
36
|
+
export const PIP_POSITIONS = ['bottom-center', 'bottom-left', 'bottom-right'];
|
|
37
|
+
export const PIP_SIZES = ['small', 'medium', 'large'];
|
|
38
|
+
export const PIP_ANIMATIONS = ['slide-up', 'slide-left', 'slide-right', 'fade', 'scale'];
|
|
39
|
+
export const PIP_FRAME_STYLES = ['none', 'rounded', 'shadow'];
|
|
40
|
+
export const COMPOSITION_MODES = ['pip'];
|
|
41
|
+
/**
|
|
42
|
+
* B-roll model names. DEPRECATED — backend auto-selects the best model.
|
|
43
|
+
* Kept in schema for backwards compatibility (accept but ignore).
|
|
44
|
+
* Will be removed in schema v2.0.0.
|
|
45
|
+
* @deprecated Use the default — backend auto-selects the best model.
|
|
46
|
+
*/
|
|
47
|
+
export const BROLL_MODELS = ['kling3', 'hailuo2', 'wan21'];
|
|
48
|
+
// ── Validation constants ────────────────────────────────────────────────────
|
|
49
|
+
export const CREDITS_PER_SECOND = 30;
|
|
50
|
+
export const SCRIPT_GENERATION_CREDIT_SURCHARGE = 5;
|
|
51
|
+
// ── Zod schemas ─────────────────────────────────────────────────────────────
|
|
52
|
+
export const PipOptionsSchema = z.object({
|
|
53
|
+
position: z.enum(PIP_POSITIONS).optional(),
|
|
54
|
+
size: z.enum(PIP_SIZES).optional(),
|
|
55
|
+
animation: z.enum(PIP_ANIMATIONS).optional(),
|
|
56
|
+
frame_style: z.enum(PIP_FRAME_STYLES).optional(),
|
|
57
|
+
}).strict();
|
|
58
|
+
/**
|
|
59
|
+
* Grouped parameter objects — better DX for new integrations.
|
|
60
|
+
* These are optional alternatives to the flat params.
|
|
61
|
+
* The preprocess step flattens them so downstream code stays unchanged.
|
|
62
|
+
*/
|
|
63
|
+
export const ActorConfigSchema = z.object({
|
|
64
|
+
slug: z.string().min(1).max(100).optional(),
|
|
65
|
+
persona_slug: z.string().min(1).max(100).optional(),
|
|
66
|
+
face_photo_url: z.string().url().optional(),
|
|
67
|
+
voice: z.string().max(100).optional(),
|
|
68
|
+
}).strict().optional();
|
|
69
|
+
export const OutputConfigSchema = z.object({
|
|
70
|
+
duration: z.number().refine((v) => DURATIONS.includes(v), { message: 'duration must be 5, 10, or 15' }).optional(),
|
|
71
|
+
aspect_ratio: z.enum(ASPECT_RATIOS).optional(),
|
|
72
|
+
style: z.string().max(50).optional(),
|
|
73
|
+
music: z.enum(MUSIC_GENRES).optional(),
|
|
74
|
+
cta: z.string().max(100).optional(),
|
|
75
|
+
}).strict().optional();
|
|
76
|
+
export const BrollConfigSchema = z.object({
|
|
77
|
+
enabled: z.boolean().optional(),
|
|
78
|
+
images: z.array(z.string().url()).max(10).optional(),
|
|
79
|
+
}).strict().optional();
|
|
80
|
+
/**
|
|
81
|
+
* Preprocess: flatten grouped params into flat params.
|
|
82
|
+
* Accepts BOTH flat and grouped — flat params take precedence.
|
|
83
|
+
*/
|
|
84
|
+
function flattenGroupedParams(input) {
|
|
85
|
+
if (typeof input !== 'object' || input === null)
|
|
86
|
+
return input;
|
|
87
|
+
const data = { ...input };
|
|
88
|
+
// Flatten actor config
|
|
89
|
+
const actor = data.actor;
|
|
90
|
+
if (actor) {
|
|
91
|
+
if (actor.slug && !data.actor_slug)
|
|
92
|
+
data.actor_slug = actor.slug;
|
|
93
|
+
if (actor.persona_slug && !data.persona_slug)
|
|
94
|
+
data.persona_slug = actor.persona_slug;
|
|
95
|
+
if (actor.face_photo_url && !data.face_photo_url)
|
|
96
|
+
data.face_photo_url = actor.face_photo_url;
|
|
97
|
+
if (actor.voice && !data.voice)
|
|
98
|
+
data.voice = actor.voice;
|
|
99
|
+
delete data.actor;
|
|
100
|
+
}
|
|
101
|
+
// Flatten output config
|
|
102
|
+
const output = data.output;
|
|
103
|
+
if (output) {
|
|
104
|
+
if (output.duration && !data.target_duration)
|
|
105
|
+
data.target_duration = output.duration;
|
|
106
|
+
if (output.aspect_ratio && !data.aspect_ratio)
|
|
107
|
+
data.aspect_ratio = output.aspect_ratio;
|
|
108
|
+
if (output.style && !data.style)
|
|
109
|
+
data.style = output.style;
|
|
110
|
+
if (output.music && !data.music)
|
|
111
|
+
data.music = output.music;
|
|
112
|
+
if (output.cta && !data.cta)
|
|
113
|
+
data.cta = output.cta;
|
|
114
|
+
delete data.output;
|
|
115
|
+
}
|
|
116
|
+
// Flatten broll config
|
|
117
|
+
const broll = data.broll;
|
|
118
|
+
if (broll) {
|
|
119
|
+
if (broll.enabled !== undefined && data.allow_broll === undefined)
|
|
120
|
+
data.allow_broll = broll.enabled;
|
|
121
|
+
if (broll.images && !data.broll_images)
|
|
122
|
+
data.broll_images = broll.images;
|
|
123
|
+
delete data.broll;
|
|
124
|
+
}
|
|
125
|
+
return data;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Zod schema for video generation.
|
|
129
|
+
*
|
|
130
|
+
* Accepts both flat params and grouped objects:
|
|
131
|
+
* Flat: { actor_slug: "sofia", target_duration: 10, allow_broll: true }
|
|
132
|
+
* Grouped: { actor: { slug: "sofia" }, output: { duration: 10 }, broll: { enabled: true } }
|
|
133
|
+
* Mixed: { actor: { slug: "sofia" }, target_duration: 10, allow_broll: true }
|
|
134
|
+
*
|
|
135
|
+
* Flat params take precedence over grouped when both are provided.
|
|
136
|
+
*/
|
|
137
|
+
export const CreateVideoSchema = z.preprocess(flattenGroupedParams, z.object({
|
|
138
|
+
script: z.string().min(50).max(3000).optional(),
|
|
139
|
+
prompt: z.string().min(1).max(1000).optional(),
|
|
140
|
+
product_url: z.string().url().optional(),
|
|
141
|
+
actor_slug: z.string().min(1).max(100).optional(),
|
|
142
|
+
persona_slug: z.string().min(1).max(100).optional(),
|
|
143
|
+
face_photo_url: z.string().url().optional(),
|
|
144
|
+
voice: z.string().max(100).optional(),
|
|
145
|
+
target_duration: z.number().refine((v) => DURATIONS.includes(v), { message: 'target_duration must be 5, 10, or 15' }).optional(),
|
|
146
|
+
style: z.string().max(50).optional(),
|
|
147
|
+
tone: z.enum(TONES).optional(),
|
|
148
|
+
voice_speed: z.number().min(0.7).max(1.5).optional(),
|
|
149
|
+
music: z.enum(MUSIC_GENRES).optional(),
|
|
150
|
+
cta: z.string().max(100).optional(),
|
|
151
|
+
aspect_ratio: z.enum(ASPECT_RATIOS).optional(),
|
|
152
|
+
template: z.string().max(50).optional(),
|
|
153
|
+
composition_mode: z.literal('pip').optional(),
|
|
154
|
+
pip_options: PipOptionsSchema.optional(),
|
|
155
|
+
allow_broll: z.boolean().optional(),
|
|
156
|
+
broll_model: z.enum(BROLL_MODELS).optional(),
|
|
157
|
+
broll_images: z.array(z.string().url()).max(10).optional(),
|
|
158
|
+
product_image_url: z.string().url().optional(),
|
|
159
|
+
dub_language: z.string().max(10).optional(),
|
|
160
|
+
webhook_url: z.string().url().optional(),
|
|
161
|
+
scenes: z.array(z.object({
|
|
162
|
+
type: z.enum(SCENE_TYPES).optional(),
|
|
163
|
+
}).passthrough()).max(30).optional(),
|
|
164
|
+
}).refine((data) => data.script !== undefined || data.prompt !== undefined, { message: 'Either script or prompt is required' }));
|
|
165
|
+
export const SubtitleSchema = z.object({
|
|
166
|
+
video_url: z.string().url(),
|
|
167
|
+
style: z.enum(SUBTITLE_STYLES).optional(),
|
|
168
|
+
});
|
|
169
|
+
export const ProductReviewSchema = z.object({
|
|
170
|
+
product_url: z.string().url(),
|
|
171
|
+
angle: z.enum(REVIEW_ANGLES).optional(),
|
|
172
|
+
tone: z.enum(TONES).optional(),
|
|
173
|
+
actor_slug: z.string().min(1).max(100).optional(),
|
|
174
|
+
target_duration: z.number().refine((v) => DURATIONS.includes(v), { message: 'target_duration must be 5, 10, or 15' }).optional(),
|
|
175
|
+
});
|
|
176
|
+
//# sourceMappingURL=video.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"video.js","sourceRoot":"","sources":["../src/video.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAE/D;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAU,CAAC;AAG9C,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,UAAU,CAAU,CAAC;AAG7E,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,CAAU,CAAC;AAG/F,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,SAAS,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO;IAChD,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW;IACpD,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,WAAW;CACxD,CAAC;AAGX,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAU,CAAC;AAG9D;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,cAAc,EAAE,OAAO,CAAU,CAAC;AAG9D,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,WAAW,EAAE,aAAa,EAAE,gBAAgB,EAAE,kBAAkB;IAChE,aAAa,EAAE,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"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"typecheck": "tsc --noEmit",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"generate:edge-schema": "tsx scripts/generate-edge-schema.ts",
|
|
20
|
+
"generate:openapi": "tsx scripts/generate-openapi.ts",
|
|
21
|
+
"check:spec": "tsx scripts/check-spec-freshness.ts",
|
|
22
|
+
"check:sdk-types": "npx openapi-typescript generated/openapi.json -o generated/api-types.d.ts && echo '✓ SDK types generated'"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"zod": "^3.23.0",
|
|
26
|
+
"zod-to-json-schema": "^3.25.2"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"openapi-typescript": "^7.13.0",
|
|
30
|
+
"tsx": "^4.19.0",
|
|
31
|
+
"typescript": "^5.7.3",
|
|
32
|
+
"vitest": "^3.1.0"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
// Copyright 2026 agent-media contributors. Apache-2.0 license.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* CI check: verify generated/openapi.json is up to date with the schema.
|
|
6
|
+
* Regenerates the spec in memory and diffs against the committed file.
|
|
7
|
+
* Exit code 1 if stale.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { readFileSync, existsSync } from 'node:fs';
|
|
11
|
+
import { resolve, dirname } from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
import { execSync } from 'node:child_process';
|
|
14
|
+
|
|
15
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
const specPath = resolve(__dirname, '../../../generated/openapi.json');
|
|
17
|
+
|
|
18
|
+
if (!existsSync(specPath)) {
|
|
19
|
+
console.error('ERROR: generated/openapi.json does not exist. Run: pnpm --filter @agent-media/schema generate:openapi');
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const committed = readFileSync(specPath, 'utf-8');
|
|
24
|
+
|
|
25
|
+
// Regenerate in a temp location
|
|
26
|
+
const tmpPath = resolve(__dirname, '../../../generated/openapi.check.json');
|
|
27
|
+
execSync(`tsx ${resolve(__dirname, 'generate-openapi.ts')}`, { stdio: 'pipe' });
|
|
28
|
+
const regenerated = readFileSync(specPath, 'utf-8');
|
|
29
|
+
|
|
30
|
+
// Restore committed version
|
|
31
|
+
readFileSync(specPath);
|
|
32
|
+
|
|
33
|
+
if (committed.trim() === regenerated.trim()) {
|
|
34
|
+
console.log('✓ OpenAPI spec is up to date with schema');
|
|
35
|
+
process.exit(0);
|
|
36
|
+
} else {
|
|
37
|
+
console.error('✗ OpenAPI spec is STALE. Schema changed but spec was not regenerated.');
|
|
38
|
+
console.error(' Run: pnpm --filter @agent-media/schema generate:openapi');
|
|
39
|
+
console.error(' Then commit generated/openapi.json');
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|