@clipwright/core 0.26.0 → 0.27.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +59 -0
  2. package/README.md +5 -0
  3. package/dist/api-failure.d.ts +21 -1
  4. package/dist/api-failure.js +38 -1
  5. package/dist/api-failure.js.map +1 -1
  6. package/dist/edit-document.d.ts +335 -0
  7. package/dist/edit-document.js +110 -0
  8. package/dist/edit-document.js.map +1 -0
  9. package/dist/edit-faceless.d.ts +24 -0
  10. package/dist/edit-faceless.js +39 -0
  11. package/dist/edit-faceless.js.map +1 -0
  12. package/dist/edit-operations.d.ts +34 -0
  13. package/dist/edit-operations.js +13 -0
  14. package/dist/edit-operations.js.map +1 -0
  15. package/dist/edit-primitives.d.ts +8 -0
  16. package/dist/edit-primitives.js +12 -0
  17. package/dist/edit-primitives.js.map +1 -0
  18. package/dist/edit-rules.d.ts +60 -0
  19. package/dist/edit-rules.js +44 -0
  20. package/dist/edit-rules.js.map +1 -0
  21. package/dist/edit-shots.d.ts +548 -0
  22. package/dist/edit-shots.js +61 -0
  23. package/dist/edit-shots.js.map +1 -0
  24. package/dist/edit-validate.d.ts +57 -0
  25. package/dist/edit-validate.js +248 -0
  26. package/dist/edit-validate.js.map +1 -0
  27. package/dist/edit.d.ts +6 -0
  28. package/dist/edit.js +8 -0
  29. package/dist/edit.js.map +1 -0
  30. package/dist/endpoints.d.ts +5 -0
  31. package/dist/endpoints.js +33 -19
  32. package/dist/endpoints.js.map +1 -1
  33. package/dist/errors.d.ts +30 -0
  34. package/dist/errors.js +42 -0
  35. package/dist/errors.js.map +1 -1
  36. package/dist/faceless-media-record.d.ts +100 -0
  37. package/dist/faceless-media-record.js +25 -0
  38. package/dist/faceless-media-record.js.map +1 -0
  39. package/dist/faceless-public-plan.d.ts +1 -0
  40. package/dist/faceless-public-plan.js +2 -1
  41. package/dist/faceless-public-plan.js.map +1 -1
  42. package/dist/index.d.ts +2 -0
  43. package/dist/index.js +2 -0
  44. package/dist/index.js.map +1 -1
  45. package/dist/uploads.d.ts +4 -2
  46. package/dist/uploads.js +5 -3
  47. package/dist/uploads.js.map +1 -1
  48. package/package.json +5 -1
  49. package/dist/__fixtures__/queue-promises.d.ts +0 -8
  50. package/dist/__fixtures__/queue-promises.js +0 -22
  51. package/dist/__fixtures__/queue-promises.js.map +0 -1
@@ -0,0 +1,548 @@
1
+ import { z } from "zod";
2
+ /** The tariff a paid edit is priced by; the prices join it later, so further keys pass through. */
3
+ export declare const editPricing: z.ZodObject<{
4
+ tariff_id: z.ZodString;
5
+ }, z.core.$loose>;
6
+ export declare const viewShot: z.ZodObject<{
7
+ id: z.ZodString;
8
+ index: z.ZodNumber;
9
+ track: z.ZodEnum<{
10
+ presenter: "presenter";
11
+ visual: "visual";
12
+ }>;
13
+ kind: z.ZodEnum<{
14
+ clip: "clip";
15
+ picture: "picture";
16
+ presenter: "presenter";
17
+ }>;
18
+ start_frame: z.ZodNumber;
19
+ end_frame: z.ZodNumber;
20
+ first_word: z.ZodNullable<z.ZodNumber>;
21
+ end_word: z.ZodNullable<z.ZodNumber>;
22
+ description: z.ZodNullable<z.ZodString>;
23
+ preview_url: z.ZodNullable<z.ZodString>;
24
+ source: z.ZodEnum<{
25
+ candidate: "candidate";
26
+ customer: "customer";
27
+ generated: "generated";
28
+ unknown: "unknown";
29
+ upload: "upload";
30
+ }>;
31
+ media_frames: z.ZodNullable<z.ZodNumber>;
32
+ media_offset_frames: z.ZodNullable<z.ZodNumber>;
33
+ operations: z.ZodArray<z.ZodEnum<{
34
+ animate: "animate";
35
+ cover: "cover";
36
+ delete: "delete";
37
+ edit_picture: "edit_picture";
38
+ new_picture: "new_picture";
39
+ retake: "retake";
40
+ retime: "retime";
41
+ upload: "upload";
42
+ }>>;
43
+ }, z.core.$strip>;
44
+ export type ViewShot = z.infer<typeof viewShot>;
45
+ /** A run whose plan is recorded: its timeline, its words and the rules an edit of it must keep. */
46
+ export declare const plannedRunShots: z.ZodObject<{
47
+ planned: z.ZodLiteral<true>;
48
+ run_id: z.ZodString;
49
+ line: z.ZodEnum<{
50
+ faceless: "faceless";
51
+ long_form: "long_form";
52
+ ugc: "ugc";
53
+ }>;
54
+ frame: z.ZodObject<{
55
+ width: z.ZodNumber;
56
+ height: z.ZodNumber;
57
+ aspect_ratio: z.ZodEnum<{
58
+ "16:9": "16:9";
59
+ "1:1": "1:1";
60
+ "9:16": "9:16";
61
+ }>;
62
+ }, z.core.$strip>;
63
+ timebase: z.ZodObject<{
64
+ fps: z.ZodNumber;
65
+ }, z.core.$strip>;
66
+ duration_frames: z.ZodNumber;
67
+ captions: z.ZodNullable<z.ZodBoolean>;
68
+ narration: z.ZodObject<{
69
+ offset_frames: z.ZodNumber;
70
+ words: z.ZodArray<z.ZodObject<{
71
+ index: z.ZodNumber;
72
+ text: z.ZodString;
73
+ start_ms: z.ZodNumber;
74
+ end_ms: z.ZodNumber;
75
+ }, z.core.$strip>>;
76
+ }, z.core.$strip>;
77
+ tracks: z.ZodArray<z.ZodObject<{
78
+ id: z.ZodEnum<{
79
+ presenter: "presenter";
80
+ visual: "visual";
81
+ }>;
82
+ shots: z.ZodArray<z.ZodObject<{
83
+ id: z.ZodString;
84
+ index: z.ZodNumber;
85
+ track: z.ZodEnum<{
86
+ presenter: "presenter";
87
+ visual: "visual";
88
+ }>;
89
+ kind: z.ZodEnum<{
90
+ clip: "clip";
91
+ picture: "picture";
92
+ presenter: "presenter";
93
+ }>;
94
+ start_frame: z.ZodNumber;
95
+ end_frame: z.ZodNumber;
96
+ first_word: z.ZodNullable<z.ZodNumber>;
97
+ end_word: z.ZodNullable<z.ZodNumber>;
98
+ description: z.ZodNullable<z.ZodString>;
99
+ preview_url: z.ZodNullable<z.ZodString>;
100
+ source: z.ZodEnum<{
101
+ candidate: "candidate";
102
+ customer: "customer";
103
+ generated: "generated";
104
+ unknown: "unknown";
105
+ upload: "upload";
106
+ }>;
107
+ media_frames: z.ZodNullable<z.ZodNumber>;
108
+ media_offset_frames: z.ZodNullable<z.ZodNumber>;
109
+ operations: z.ZodArray<z.ZodEnum<{
110
+ animate: "animate";
111
+ cover: "cover";
112
+ delete: "delete";
113
+ edit_picture: "edit_picture";
114
+ new_picture: "new_picture";
115
+ retake: "retake";
116
+ retime: "retime";
117
+ upload: "upload";
118
+ }>>;
119
+ }, z.core.$strip>>;
120
+ }, z.core.$strip>>;
121
+ rules: z.ZodObject<{
122
+ kinds: z.ZodRecord<z.ZodEnum<{
123
+ clip: "clip";
124
+ picture: "picture";
125
+ presenter: "presenter";
126
+ }> & z.core.$partial, z.ZodObject<{
127
+ min_frames: z.ZodNumber;
128
+ max_frames: z.ZodNumber;
129
+ movable: z.ZodBoolean;
130
+ resizable: z.ZodBoolean;
131
+ }, z.core.$strict>>;
132
+ output_coverage: z.ZodEnum<{
133
+ union: "union";
134
+ visual: "visual";
135
+ }>;
136
+ first_visual_kind: z.ZodNullable<z.ZodEnum<{
137
+ clip: "clip";
138
+ picture: "picture";
139
+ presenter: "presenter";
140
+ }>>;
141
+ picture_assets_unique: z.ZodBoolean;
142
+ visual_covers_presenter: z.ZodBoolean;
143
+ add_visual: z.ZodEnum<{
144
+ never: "never";
145
+ over_presenter: "over_presenter";
146
+ }>;
147
+ reuse_source_asset: z.ZodBoolean;
148
+ upload_aspect: z.ZodNullable<z.ZodObject<{
149
+ max_distance: z.ZodNumber;
150
+ }, z.core.$strict>>;
151
+ max_generated_per_revision: z.ZodNumber;
152
+ }, z.core.$strict>;
153
+ editable: z.ZodObject<{
154
+ state: z.ZodEnum<{
155
+ editable: "editable";
156
+ expired: "expired";
157
+ not_recorded: "not_recorded";
158
+ }>;
159
+ media_available_until: z.ZodNullable<z.ZodString>;
160
+ reason: z.ZodNullable<z.ZodString>;
161
+ }, z.core.$strip>;
162
+ lineage: z.ZodObject<{
163
+ source_run_id: z.ZodNullable<z.ZodString>;
164
+ root_run_id: z.ZodString;
165
+ revisions: z.ZodArray<z.ZodObject<{
166
+ run_id: z.ZodString;
167
+ state: z.ZodString;
168
+ }, z.core.$strip>>;
169
+ }, z.core.$strip>;
170
+ withheld: z.ZodArray<z.ZodEnum<{
171
+ description: "description";
172
+ source_media: "source_media";
173
+ }>>;
174
+ pricing: z.ZodNullable<z.ZodObject<{
175
+ tariff_id: z.ZodString;
176
+ }, z.core.$loose>>;
177
+ paid_edits: z.ZodObject<{
178
+ enabled: z.ZodBoolean;
179
+ reason: z.ZodNullable<z.ZodString>;
180
+ }, z.core.$strip>;
181
+ contract_version: z.ZodString;
182
+ }, z.core.$strip>;
183
+ /** A run with no plan to show: it carries no frame, duration, words or rules, and none are invented. */
184
+ export declare const unplannedRunShots: z.ZodObject<{
185
+ planned: z.ZodLiteral<false>;
186
+ run_id: z.ZodString;
187
+ line: z.ZodEnum<{
188
+ faceless: "faceless";
189
+ long_form: "long_form";
190
+ ugc: "ugc";
191
+ }>;
192
+ editable: z.ZodObject<{
193
+ state: z.ZodEnum<{
194
+ not_recorded: "not_recorded";
195
+ not_succeeded: "not_succeeded";
196
+ unsupported_line: "unsupported_line";
197
+ }>;
198
+ media_available_until: z.ZodNullable<z.ZodString>;
199
+ reason: z.ZodString;
200
+ }, z.core.$strip>;
201
+ lineage: z.ZodObject<{
202
+ source_run_id: z.ZodNullable<z.ZodString>;
203
+ root_run_id: z.ZodString;
204
+ revisions: z.ZodArray<z.ZodObject<{
205
+ run_id: z.ZodString;
206
+ state: z.ZodString;
207
+ }, z.core.$strip>>;
208
+ }, z.core.$strip>;
209
+ contract_version: z.ZodString;
210
+ }, z.core.$strip>;
211
+ export declare const runShots: z.ZodDiscriminatedUnion<[z.ZodObject<{
212
+ planned: z.ZodLiteral<true>;
213
+ run_id: z.ZodString;
214
+ line: z.ZodEnum<{
215
+ faceless: "faceless";
216
+ long_form: "long_form";
217
+ ugc: "ugc";
218
+ }>;
219
+ frame: z.ZodObject<{
220
+ width: z.ZodNumber;
221
+ height: z.ZodNumber;
222
+ aspect_ratio: z.ZodEnum<{
223
+ "16:9": "16:9";
224
+ "1:1": "1:1";
225
+ "9:16": "9:16";
226
+ }>;
227
+ }, z.core.$strip>;
228
+ timebase: z.ZodObject<{
229
+ fps: z.ZodNumber;
230
+ }, z.core.$strip>;
231
+ duration_frames: z.ZodNumber;
232
+ captions: z.ZodNullable<z.ZodBoolean>;
233
+ narration: z.ZodObject<{
234
+ offset_frames: z.ZodNumber;
235
+ words: z.ZodArray<z.ZodObject<{
236
+ index: z.ZodNumber;
237
+ text: z.ZodString;
238
+ start_ms: z.ZodNumber;
239
+ end_ms: z.ZodNumber;
240
+ }, z.core.$strip>>;
241
+ }, z.core.$strip>;
242
+ tracks: z.ZodArray<z.ZodObject<{
243
+ id: z.ZodEnum<{
244
+ presenter: "presenter";
245
+ visual: "visual";
246
+ }>;
247
+ shots: z.ZodArray<z.ZodObject<{
248
+ id: z.ZodString;
249
+ index: z.ZodNumber;
250
+ track: z.ZodEnum<{
251
+ presenter: "presenter";
252
+ visual: "visual";
253
+ }>;
254
+ kind: z.ZodEnum<{
255
+ clip: "clip";
256
+ picture: "picture";
257
+ presenter: "presenter";
258
+ }>;
259
+ start_frame: z.ZodNumber;
260
+ end_frame: z.ZodNumber;
261
+ first_word: z.ZodNullable<z.ZodNumber>;
262
+ end_word: z.ZodNullable<z.ZodNumber>;
263
+ description: z.ZodNullable<z.ZodString>;
264
+ preview_url: z.ZodNullable<z.ZodString>;
265
+ source: z.ZodEnum<{
266
+ candidate: "candidate";
267
+ customer: "customer";
268
+ generated: "generated";
269
+ unknown: "unknown";
270
+ upload: "upload";
271
+ }>;
272
+ media_frames: z.ZodNullable<z.ZodNumber>;
273
+ media_offset_frames: z.ZodNullable<z.ZodNumber>;
274
+ operations: z.ZodArray<z.ZodEnum<{
275
+ animate: "animate";
276
+ cover: "cover";
277
+ delete: "delete";
278
+ edit_picture: "edit_picture";
279
+ new_picture: "new_picture";
280
+ retake: "retake";
281
+ retime: "retime";
282
+ upload: "upload";
283
+ }>>;
284
+ }, z.core.$strip>>;
285
+ }, z.core.$strip>>;
286
+ rules: z.ZodObject<{
287
+ kinds: z.ZodRecord<z.ZodEnum<{
288
+ clip: "clip";
289
+ picture: "picture";
290
+ presenter: "presenter";
291
+ }> & z.core.$partial, z.ZodObject<{
292
+ min_frames: z.ZodNumber;
293
+ max_frames: z.ZodNumber;
294
+ movable: z.ZodBoolean;
295
+ resizable: z.ZodBoolean;
296
+ }, z.core.$strict>>;
297
+ output_coverage: z.ZodEnum<{
298
+ union: "union";
299
+ visual: "visual";
300
+ }>;
301
+ first_visual_kind: z.ZodNullable<z.ZodEnum<{
302
+ clip: "clip";
303
+ picture: "picture";
304
+ presenter: "presenter";
305
+ }>>;
306
+ picture_assets_unique: z.ZodBoolean;
307
+ visual_covers_presenter: z.ZodBoolean;
308
+ add_visual: z.ZodEnum<{
309
+ never: "never";
310
+ over_presenter: "over_presenter";
311
+ }>;
312
+ reuse_source_asset: z.ZodBoolean;
313
+ upload_aspect: z.ZodNullable<z.ZodObject<{
314
+ max_distance: z.ZodNumber;
315
+ }, z.core.$strict>>;
316
+ max_generated_per_revision: z.ZodNumber;
317
+ }, z.core.$strict>;
318
+ editable: z.ZodObject<{
319
+ state: z.ZodEnum<{
320
+ editable: "editable";
321
+ expired: "expired";
322
+ not_recorded: "not_recorded";
323
+ }>;
324
+ media_available_until: z.ZodNullable<z.ZodString>;
325
+ reason: z.ZodNullable<z.ZodString>;
326
+ }, z.core.$strip>;
327
+ lineage: z.ZodObject<{
328
+ source_run_id: z.ZodNullable<z.ZodString>;
329
+ root_run_id: z.ZodString;
330
+ revisions: z.ZodArray<z.ZodObject<{
331
+ run_id: z.ZodString;
332
+ state: z.ZodString;
333
+ }, z.core.$strip>>;
334
+ }, z.core.$strip>;
335
+ withheld: z.ZodArray<z.ZodEnum<{
336
+ description: "description";
337
+ source_media: "source_media";
338
+ }>>;
339
+ pricing: z.ZodNullable<z.ZodObject<{
340
+ tariff_id: z.ZodString;
341
+ }, z.core.$loose>>;
342
+ paid_edits: z.ZodObject<{
343
+ enabled: z.ZodBoolean;
344
+ reason: z.ZodNullable<z.ZodString>;
345
+ }, z.core.$strip>;
346
+ contract_version: z.ZodString;
347
+ }, z.core.$strip>, z.ZodObject<{
348
+ planned: z.ZodLiteral<false>;
349
+ run_id: z.ZodString;
350
+ line: z.ZodEnum<{
351
+ faceless: "faceless";
352
+ long_form: "long_form";
353
+ ugc: "ugc";
354
+ }>;
355
+ editable: z.ZodObject<{
356
+ state: z.ZodEnum<{
357
+ not_recorded: "not_recorded";
358
+ not_succeeded: "not_succeeded";
359
+ unsupported_line: "unsupported_line";
360
+ }>;
361
+ media_available_until: z.ZodNullable<z.ZodString>;
362
+ reason: z.ZodString;
363
+ }, z.core.$strip>;
364
+ lineage: z.ZodObject<{
365
+ source_run_id: z.ZodNullable<z.ZodString>;
366
+ root_run_id: z.ZodString;
367
+ revisions: z.ZodArray<z.ZodObject<{
368
+ run_id: z.ZodString;
369
+ state: z.ZodString;
370
+ }, z.core.$strip>>;
371
+ }, z.core.$strip>;
372
+ contract_version: z.ZodString;
373
+ }, z.core.$strip>], "planned">;
374
+ export type PlannedRunShots = z.infer<typeof plannedRunShots>;
375
+ export type UnplannedRunShots = z.infer<typeof unplannedRunShots>;
376
+ export type RunShots = z.infer<typeof runShots>;
377
+ export declare const plannedRunShotsRead: z.ZodObject<{
378
+ planned: z.ZodLiteral<true>;
379
+ run_id: z.ZodString;
380
+ timebase: z.ZodObject<{
381
+ fps: z.ZodNumber;
382
+ }, z.core.$strip>;
383
+ duration_frames: z.ZodNumber;
384
+ captions: z.ZodNullable<z.ZodBoolean>;
385
+ narration: z.ZodObject<{
386
+ offset_frames: z.ZodNumber;
387
+ words: z.ZodArray<z.ZodObject<{
388
+ index: z.ZodNumber;
389
+ text: z.ZodString;
390
+ start_ms: z.ZodNumber;
391
+ end_ms: z.ZodNumber;
392
+ }, z.core.$strip>>;
393
+ }, z.core.$strip>;
394
+ lineage: z.ZodObject<{
395
+ source_run_id: z.ZodNullable<z.ZodString>;
396
+ root_run_id: z.ZodString;
397
+ revisions: z.ZodArray<z.ZodObject<{
398
+ run_id: z.ZodString;
399
+ state: z.ZodString;
400
+ }, z.core.$strip>>;
401
+ }, z.core.$strip>;
402
+ pricing: z.ZodNullable<z.ZodObject<{
403
+ tariff_id: z.ZodString;
404
+ }, z.core.$loose>>;
405
+ paid_edits: z.ZodObject<{
406
+ enabled: z.ZodBoolean;
407
+ reason: z.ZodNullable<z.ZodString>;
408
+ }, z.core.$strip>;
409
+ contract_version: z.ZodString;
410
+ line: z.ZodString;
411
+ frame: z.ZodObject<{
412
+ width: z.ZodNumber;
413
+ height: z.ZodNumber;
414
+ aspect_ratio: z.ZodString;
415
+ }, z.core.$strip>;
416
+ tracks: z.ZodArray<z.ZodObject<{
417
+ id: z.ZodString;
418
+ shots: z.ZodArray<z.ZodObject<{
419
+ id: z.ZodString;
420
+ index: z.ZodNumber;
421
+ start_frame: z.ZodNumber;
422
+ end_frame: z.ZodNumber;
423
+ first_word: z.ZodNullable<z.ZodNumber>;
424
+ end_word: z.ZodNullable<z.ZodNumber>;
425
+ description: z.ZodNullable<z.ZodString>;
426
+ preview_url: z.ZodNullable<z.ZodString>;
427
+ media_frames: z.ZodNullable<z.ZodNumber>;
428
+ media_offset_frames: z.ZodNullable<z.ZodNumber>;
429
+ track: z.ZodString;
430
+ kind: z.ZodString;
431
+ source: z.ZodString;
432
+ operations: z.ZodArray<z.ZodString>;
433
+ }, z.core.$strip>>;
434
+ }, z.core.$strip>>;
435
+ rules: z.ZodRecord<z.ZodString, z.ZodUnknown>;
436
+ editable: z.ZodObject<{
437
+ state: z.ZodString;
438
+ media_available_until: z.ZodNullable<z.ZodString>;
439
+ reason: z.ZodNullable<z.ZodString>;
440
+ }, z.core.$strip>;
441
+ withheld: z.ZodArray<z.ZodString>;
442
+ }, z.core.$strip>;
443
+ export declare const unplannedRunShotsRead: z.ZodObject<{
444
+ planned: z.ZodLiteral<false>;
445
+ run_id: z.ZodString;
446
+ lineage: z.ZodObject<{
447
+ source_run_id: z.ZodNullable<z.ZodString>;
448
+ root_run_id: z.ZodString;
449
+ revisions: z.ZodArray<z.ZodObject<{
450
+ run_id: z.ZodString;
451
+ state: z.ZodString;
452
+ }, z.core.$strip>>;
453
+ }, z.core.$strip>;
454
+ contract_version: z.ZodString;
455
+ line: z.ZodString;
456
+ editable: z.ZodObject<{
457
+ state: z.ZodString;
458
+ media_available_until: z.ZodNullable<z.ZodString>;
459
+ reason: z.ZodNullable<z.ZodString>;
460
+ }, z.core.$strip>;
461
+ }, z.core.$strip>;
462
+ export declare const runShotsRead: z.ZodDiscriminatedUnion<[z.ZodObject<{
463
+ planned: z.ZodLiteral<true>;
464
+ run_id: z.ZodString;
465
+ timebase: z.ZodObject<{
466
+ fps: z.ZodNumber;
467
+ }, z.core.$strip>;
468
+ duration_frames: z.ZodNumber;
469
+ captions: z.ZodNullable<z.ZodBoolean>;
470
+ narration: z.ZodObject<{
471
+ offset_frames: z.ZodNumber;
472
+ words: z.ZodArray<z.ZodObject<{
473
+ index: z.ZodNumber;
474
+ text: z.ZodString;
475
+ start_ms: z.ZodNumber;
476
+ end_ms: z.ZodNumber;
477
+ }, z.core.$strip>>;
478
+ }, z.core.$strip>;
479
+ lineage: z.ZodObject<{
480
+ source_run_id: z.ZodNullable<z.ZodString>;
481
+ root_run_id: z.ZodString;
482
+ revisions: z.ZodArray<z.ZodObject<{
483
+ run_id: z.ZodString;
484
+ state: z.ZodString;
485
+ }, z.core.$strip>>;
486
+ }, z.core.$strip>;
487
+ pricing: z.ZodNullable<z.ZodObject<{
488
+ tariff_id: z.ZodString;
489
+ }, z.core.$loose>>;
490
+ paid_edits: z.ZodObject<{
491
+ enabled: z.ZodBoolean;
492
+ reason: z.ZodNullable<z.ZodString>;
493
+ }, z.core.$strip>;
494
+ contract_version: z.ZodString;
495
+ line: z.ZodString;
496
+ frame: z.ZodObject<{
497
+ width: z.ZodNumber;
498
+ height: z.ZodNumber;
499
+ aspect_ratio: z.ZodString;
500
+ }, z.core.$strip>;
501
+ tracks: z.ZodArray<z.ZodObject<{
502
+ id: z.ZodString;
503
+ shots: z.ZodArray<z.ZodObject<{
504
+ id: z.ZodString;
505
+ index: z.ZodNumber;
506
+ start_frame: z.ZodNumber;
507
+ end_frame: z.ZodNumber;
508
+ first_word: z.ZodNullable<z.ZodNumber>;
509
+ end_word: z.ZodNullable<z.ZodNumber>;
510
+ description: z.ZodNullable<z.ZodString>;
511
+ preview_url: z.ZodNullable<z.ZodString>;
512
+ media_frames: z.ZodNullable<z.ZodNumber>;
513
+ media_offset_frames: z.ZodNullable<z.ZodNumber>;
514
+ track: z.ZodString;
515
+ kind: z.ZodString;
516
+ source: z.ZodString;
517
+ operations: z.ZodArray<z.ZodString>;
518
+ }, z.core.$strip>>;
519
+ }, z.core.$strip>>;
520
+ rules: z.ZodRecord<z.ZodString, z.ZodUnknown>;
521
+ editable: z.ZodObject<{
522
+ state: z.ZodString;
523
+ media_available_until: z.ZodNullable<z.ZodString>;
524
+ reason: z.ZodNullable<z.ZodString>;
525
+ }, z.core.$strip>;
526
+ withheld: z.ZodArray<z.ZodString>;
527
+ }, z.core.$strip>, z.ZodObject<{
528
+ planned: z.ZodLiteral<false>;
529
+ run_id: z.ZodString;
530
+ lineage: z.ZodObject<{
531
+ source_run_id: z.ZodNullable<z.ZodString>;
532
+ root_run_id: z.ZodString;
533
+ revisions: z.ZodArray<z.ZodObject<{
534
+ run_id: z.ZodString;
535
+ state: z.ZodString;
536
+ }, z.core.$strip>>;
537
+ }, z.core.$strip>;
538
+ contract_version: z.ZodString;
539
+ line: z.ZodString;
540
+ editable: z.ZodObject<{
541
+ state: z.ZodString;
542
+ media_available_until: z.ZodNullable<z.ZodString>;
543
+ reason: z.ZodNullable<z.ZodString>;
544
+ }, z.core.$strip>;
545
+ }, z.core.$strip>], "planned">;
546
+ export type RunShotsRead = z.infer<typeof runShotsRead>;
547
+ /** The path of a run's shots. The id is encoded, since it comes from the caller. */
548
+ export declare const runShotsPath: (id: string) => string;
@@ -0,0 +1,61 @@
1
+ import { z } from "zod";
2
+ import { frame, frameCount, shotId } from "./edit-primitives.js";
3
+ import { EDIT_LINES, SHOT_ACTIONS, SHOT_KINDS, SHOT_SOURCES, SHOT_TRACKS, editRules } from "./edit-rules.js";
4
+ import { runId } from "./runs.js";
5
+ import { ASPECT_RATIOS } from "./skills.js";
6
+ /** The tariff a paid edit is priced by; the prices join it later, so further keys pass through. */
7
+ export const editPricing = z.object({ tariff_id: z.string().min(1) }).passthrough();
8
+ const word = z.object({ index: frame, text: z.string().min(1), start_ms: frame, end_ms: frame.positive() });
9
+ export const viewShot = z.object({
10
+ id: shotId, index: frame, track: z.enum(SHOT_TRACKS), kind: z.enum(SHOT_KINDS),
11
+ start_frame: frame, end_frame: frame.positive(),
12
+ first_word: frame.nullable(), end_word: frame.nullable(),
13
+ description: z.string().nullable(), preview_url: z.string().url().nullable(),
14
+ source: z.enum(SHOT_SOURCES),
15
+ media_frames: frameCount.nullable(), media_offset_frames: frame.nullable(),
16
+ operations: z.array(z.enum(SHOT_ACTIONS)),
17
+ });
18
+ const lineage = z.object({ source_run_id: runId.nullable(), root_run_id: runId, revisions: z.array(z.object({ run_id: runId, state: z.string() })) });
19
+ const until = z.string().datetime().nullable();
20
+ /** A run whose plan is recorded: its timeline, its words and the rules an edit of it must keep. */
21
+ export const plannedRunShots = z.object({
22
+ planned: z.literal(true),
23
+ run_id: runId, line: z.enum(EDIT_LINES),
24
+ frame: z.object({ width: frameCount, height: frameCount, aspect_ratio: z.enum(ASPECT_RATIOS) }),
25
+ timebase: z.object({ fps: z.number().int().positive() }),
26
+ duration_frames: frameCount, captions: z.boolean().nullable(),
27
+ narration: z.object({ offset_frames: frame, words: z.array(word) }),
28
+ tracks: z.array(z.object({ id: z.enum(SHOT_TRACKS), shots: z.array(viewShot) })),
29
+ rules: editRules,
30
+ editable: z.object({ state: z.enum(["editable", "expired", "not_recorded"]), media_available_until: until, reason: z.string().nullable() }),
31
+ lineage,
32
+ withheld: z.array(z.enum(["description", "source_media"])),
33
+ pricing: editPricing.nullable(),
34
+ paid_edits: z.object({ enabled: z.boolean(), reason: z.string().nullable() }),
35
+ contract_version: z.string().min(1),
36
+ });
37
+ /** A run with no plan to show: it carries no frame, duration, words or rules, and none are invented. */
38
+ export const unplannedRunShots = z.object({
39
+ planned: z.literal(false),
40
+ run_id: runId, line: z.enum(EDIT_LINES),
41
+ editable: z.object({ state: z.enum(["not_succeeded", "unsupported_line", "not_recorded"]), media_available_until: until, reason: z.string().min(1) }),
42
+ lineage,
43
+ contract_version: z.string().min(1),
44
+ });
45
+ export const runShots = z.discriminatedUnion("planned", [plannedRunShots, unplannedRunShots]);
46
+ // What installed clients parse: every closed vocabulary is an open string, and `rules` is opaque.
47
+ const editableRead = z.object({ state: z.string(), media_available_until: until, reason: z.string().nullable() });
48
+ const viewShotRead = viewShot.extend({ track: z.string(), kind: z.string(), source: z.string(), operations: z.array(z.string()) });
49
+ export const plannedRunShotsRead = plannedRunShots.extend({
50
+ line: z.string(),
51
+ frame: z.object({ width: frameCount, height: frameCount, aspect_ratio: z.string() }),
52
+ tracks: z.array(z.object({ id: z.string(), shots: z.array(viewShotRead) })),
53
+ rules: z.record(z.string(), z.unknown()),
54
+ editable: editableRead,
55
+ withheld: z.array(z.string()),
56
+ });
57
+ export const unplannedRunShotsRead = unplannedRunShots.extend({ line: z.string(), editable: editableRead });
58
+ export const runShotsRead = z.discriminatedUnion("planned", [plannedRunShotsRead, unplannedRunShotsRead]);
59
+ /** The path of a run's shots. The id is encoded, since it comes from the caller. */
60
+ export const runShotsPath = (id) => `/v1/runs/${encodeURIComponent(id)}/shots`;
61
+ //# sourceMappingURL=edit-shots.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"edit-shots.js","sourceRoot":"","sources":["../src/edit-shots.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAA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E,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;IAC3E,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;IACxC,QAAQ,EAAE,YAAY;IACtB,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC9B,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,CAAC,CAAC;AAC5G,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,kBAAkB,CAAC,SAAS,EAAE,CAAC,mBAAmB,EAAE,qBAAqB,CAAC,CAAC,CAAC;AAG1G,oFAAoF;AACpF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,YAAY,kBAAkB,CAAC,EAAE,CAAC,QAAQ,CAAC"}
@@ -0,0 +1,57 @@
1
+ import type { EditDocument } from "./edit-document.js";
2
+ import { type ShotOperationMode } from "./edit-operations.js";
3
+ import type { ShotKind } from "./edit-rules.js";
4
+ import type { PlannedRunShots } from "./edit-shots.js";
5
+ /** In the order issues are reported. */
6
+ export declare const EDIT_ISSUE_CODES: readonly ["source_mismatch", "timebase_mismatch", "duration_mismatch", "duplicate_shot_id", "span_out_of_range", "kind_changed", "shot_added_not_allowed", "too_short", "too_long", "action_not_allowed", "not_movable", "not_resizable", "overlap", "tracks_overlap", "uncovered", "first_shot_fixed", "foreign_source_asset", "kind_asset_mismatch", "candidate_for_other_shot", "unknown_asset", "upload_shape_refused", "duplicate_picture_asset", "too_many_generated", "footage_exceeded", "presenter_out_of_sync", "presenter_outside_recording"];
7
+ export type EditIssueCode = (typeof EDIT_ISSUE_CODES)[number];
8
+ /** What the caller measured about the assets a document names: kept candidates by run id, uploads by upload id. */
9
+ export type EditFacts = {
10
+ candidates: Record<string, {
11
+ shot_id: string;
12
+ kind: "picture" | "clip";
13
+ media_frames: number | null;
14
+ }>;
15
+ uploads: Record<string, {
16
+ width: number;
17
+ height: number;
18
+ }>;
19
+ };
20
+ export type EditIssue = {
21
+ code: EditIssueCode;
22
+ shot_id?: string;
23
+ from_frame?: number;
24
+ to_frame?: number;
25
+ message: string;
26
+ };
27
+ export type EditSummary = {
28
+ /** Source shots whose start_frame, end_frame or media_offset_frames changed. */
29
+ retimed: string[];
30
+ /** Source shot ids absent from the document. */
31
+ deleted: string[];
32
+ /** Document shot ids that are not source shot ids. */
33
+ added: string[];
34
+ replaced: {
35
+ shot_id: string;
36
+ from: "candidate" | "upload";
37
+ }[];
38
+ /** Facts only: pricing decides what each entry costs. */
39
+ generated: {
40
+ shot_id: string;
41
+ kind: ShotKind;
42
+ mode: ShotOperationMode;
43
+ }[];
44
+ /** Any list above is non-empty. */
45
+ changed: boolean;
46
+ };
47
+ /** Presenter frames no visual shot covers. */
48
+ export declare function presenterVisibleFrames(shots: Pick<PlannedRunShots, "tracks">): number;
49
+ export declare function diffEditDocument(document: EditDocument, shots: PlannedRunShots): EditSummary;
50
+ /** Checks a document against the view it edits. Every issue is collected; the rules come from the view. */
51
+ export declare function validateEditDocument(document: EditDocument, shots: PlannedRunShots, facts: EditFacts): {
52
+ ok: true;
53
+ summary: EditSummary;
54
+ } | {
55
+ ok: false;
56
+ issues: EditIssue[];
57
+ };