@blitzreels/sdk 0.1.4 → 0.1.5

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/index.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import { type AiEditResource } from "./resources/ai-edit.js";
2
+ import { type CaptionsResource } from "./resources/captions.js";
3
+ import { type TimelineResource } from "./resources/timeline.js";
1
4
  export type HttpMethod = "GET" | "POST" | "PATCH" | "DELETE";
2
5
  export type JsonObject = Record<string, unknown>;
3
6
  export type QueryValue = string | number | boolean | null | undefined;
@@ -20,11 +23,16 @@ export type BlitzReelsErrorOptions = {
20
23
  status: number;
21
24
  requestId: string | null;
22
25
  body: unknown;
26
+ code?: BlitzReelsErrorCode;
27
+ retryable?: boolean;
23
28
  };
29
+ export type BlitzReelsErrorCode = "api_error" | "auth_error" | "not_found" | "conflict" | "validation_error" | "rate_limited" | "timeout" | "server_error";
24
30
  export declare class BlitzReelsError extends Error {
25
31
  status: number;
26
32
  requestId: string | null;
27
33
  body: unknown;
34
+ code: BlitzReelsErrorCode;
35
+ retryable: boolean;
28
36
  constructor(options: BlitzReelsErrorOptions);
29
37
  }
30
38
  export type AuthValidation = {
@@ -43,9 +51,22 @@ export type AuthValidation = {
43
51
  };
44
52
  };
45
53
  export type ProjectContextMode = "summary" | "assets" | "timeline" | "transcript" | "full";
54
+ export type ProjectContextCollectionBounds = {
55
+ name: string;
56
+ offset: number;
57
+ limit: number;
58
+ total: number;
59
+ returned: number;
60
+ hasMore: boolean;
61
+ truncated: boolean;
62
+ };
63
+ export type ProjectContextBounds = {
64
+ collections: ProjectContextCollectionBounds[];
65
+ };
46
66
  export type ProjectContext = {
47
67
  mode: ProjectContextMode;
48
68
  data: unknown;
69
+ bounds: ProjectContextBounds;
49
70
  };
50
71
  export type Project = {
51
72
  id: string;
@@ -171,6 +192,7 @@ export type MediaAttachResult = {
171
192
  message: string | null;
172
193
  animation_applied: string | null;
173
194
  layer_index: number | null;
195
+ warnings?: string[];
174
196
  }>;
175
197
  summary: {
176
198
  total: number;
@@ -178,6 +200,7 @@ export type MediaAttachResult = {
178
200
  already_in_timeline: number;
179
201
  failed: number;
180
202
  };
203
+ warnings?: string[];
181
204
  message: string;
182
205
  };
183
206
  export type MediaShortSuggestionList = {
@@ -376,6 +399,7 @@ export type UpdateMediaOverlayResult = {
376
399
  updated: JsonObject;
377
400
  animationApplied: string | null;
378
401
  keyframeCount: number;
402
+ warnings?: string[];
379
403
  message: string;
380
404
  };
381
405
  export type TimelineEditResult = {
@@ -402,6 +426,51 @@ export type TimelineDeleteOptions = {
402
426
  timelineItemIds: string[];
403
427
  autoPack: boolean | undefined;
404
428
  };
429
+ export type TimelineSplitOptions = {
430
+ projectId: string;
431
+ timelineItemId: string;
432
+ splitAtSeconds: number;
433
+ snapToFrame: boolean | undefined;
434
+ };
435
+ export type TimelineTrimOptions = {
436
+ projectId: string;
437
+ timelineItemId: string;
438
+ trimStartDeltaSeconds: number | undefined;
439
+ trimEndDeltaSeconds: number | undefined;
440
+ snapToFrame: boolean | undefined;
441
+ };
442
+ export type TimelineBatchMoveOptions = {
443
+ projectId: string;
444
+ items: Array<{
445
+ timelineItemId: string;
446
+ newStartSeconds: number;
447
+ newLayerIndex: number | undefined;
448
+ }>;
449
+ };
450
+ export type TimelineBatchTrimOptions = {
451
+ projectId: string;
452
+ items: Array<{
453
+ timelineItemId: string;
454
+ trimStartDeltaSeconds: number | undefined;
455
+ trimEndDeltaSeconds: number | undefined;
456
+ }>;
457
+ snapToFrame: boolean | undefined;
458
+ };
459
+ export type TimelineBatchTransformOptions = {
460
+ projectId: string;
461
+ items: Array<Omit<TimelineTransformOptions, "projectId">>;
462
+ };
463
+ export type TimelineCutOptions = {
464
+ projectId: string;
465
+ timelineItemId: string;
466
+ cuts: Array<{
467
+ startSeconds: number;
468
+ endSeconds: number;
469
+ trimFollowingSeconds: number | undefined;
470
+ }>;
471
+ snapToFrame: boolean | undefined;
472
+ ripple: boolean | undefined;
473
+ };
405
474
  export type TimelineItemDeleteResult = {
406
475
  success: boolean;
407
476
  deleted_item_id: string;
@@ -468,6 +537,33 @@ export type CaptionThemeList = {
468
537
  total: number;
469
538
  };
470
539
  export type CaptionTheme = JsonObject;
540
+ export type CaptionPresetList = {
541
+ presets: JsonObject[];
542
+ total: number;
543
+ };
544
+ export type CaptionLookList = {
545
+ looks: JsonObject[];
546
+ total: number;
547
+ };
548
+ export type CaptionStyle = {
549
+ success: boolean;
550
+ settings: JsonObject;
551
+ hint: string | undefined;
552
+ };
553
+ export type UpdateCaptionStyleOptions = {
554
+ projectId: string;
555
+ lookId: string | undefined;
556
+ presetId: string | undefined;
557
+ clearWordOverrides: boolean | undefined;
558
+ style: JsonObject;
559
+ };
560
+ export type CaptionStyleUpdateResult = {
561
+ success: boolean;
562
+ updated_properties: string[];
563
+ look_id: string | null | undefined;
564
+ preset_id: string | null | undefined;
565
+ message: string | undefined;
566
+ };
471
567
  export type CaptionThemePreview = {
472
568
  preview_url: string;
473
569
  expires_at: string;
@@ -479,12 +575,198 @@ export type ExportStartResult = {
479
575
  job_id: string;
480
576
  status: string;
481
577
  };
578
+ export type AiEditStyleId = "mirage-black" | "clean-founder";
579
+ export type AiEditQualityTarget = "fast" | "premium" | "frontier";
580
+ export type AiEditControllerKind = "api" | "cli" | "codex" | "claude_code" | "platform" | "unknown";
581
+ export type AiEditRunStatus = "queued" | "understanding" | "planning" | "applying" | "rendering" | "critiquing" | "repairing" | "completed" | "failed" | "needs_review";
582
+ export type AiEditStylesList = {
583
+ styles: Array<{
584
+ id: AiEditStyleId;
585
+ name: string;
586
+ description: string;
587
+ preview_image_path: string;
588
+ manual_skill: {
589
+ type: "local_skill";
590
+ path: string;
591
+ style_json_path: string;
592
+ };
593
+ spec: JsonObject;
594
+ }>;
595
+ total: number;
596
+ };
597
+ export type AiEditRunEnvelope = {
598
+ run: {
599
+ id: string;
600
+ project_id: string;
601
+ organization_id: string;
602
+ user_id: string;
603
+ api_key_id: string | null;
604
+ execution_mode: "external_controller" | "hosted_agent";
605
+ credit_mode: "external" | "platform_credits" | "byok";
606
+ controller_kind: AiEditControllerKind;
607
+ status: AiEditRunStatus;
608
+ style_id: AiEditStyleId;
609
+ quality_target: AiEditQualityTarget;
610
+ run_config: JsonObject;
611
+ budget_receipt: JsonObject;
612
+ summary: string | null;
613
+ failure_message: string | null;
614
+ completed_at: string | null;
615
+ created_at: string;
616
+ updated_at: string;
617
+ };
618
+ context: JsonObject;
619
+ };
620
+ export type AiEditRunLog = {
621
+ id: string;
622
+ run_id: string;
623
+ organization_id: string;
624
+ project_id: string;
625
+ kind: string;
626
+ status: string;
627
+ input: JsonObject;
628
+ output: JsonObject;
629
+ error_message: string | null;
630
+ created_at: string;
631
+ };
632
+ export type AiEditRunArtifact = {
633
+ id: string;
634
+ run_id: string;
635
+ organization_id: string;
636
+ project_id: string;
637
+ artifact_type: string;
638
+ time_seconds: number | null;
639
+ url: string | null;
640
+ storage_key: string | null;
641
+ metadata: JsonObject;
642
+ created_at: string;
643
+ };
644
+ export type AiEditRunLogsOptions = {
645
+ runId: string;
646
+ limit: number | undefined;
647
+ offset: number | undefined;
648
+ };
649
+ export type AiEditRunLogsEnvelope = {
650
+ run_id: string;
651
+ project_id: string;
652
+ logs: AiEditRunLog[];
653
+ artifacts: AiEditRunArtifact[];
654
+ bounds: {
655
+ logs: {
656
+ offset: number;
657
+ limit: number;
658
+ returned: number;
659
+ truncated: boolean;
660
+ };
661
+ };
662
+ };
663
+ export type AiEditAppendRunLogOptions = {
664
+ runId: string;
665
+ kind: string;
666
+ status: "queued" | "running" | "completed" | "failed" | "skipped";
667
+ message: string;
668
+ metadata: JsonObject;
669
+ dryRun: boolean | undefined;
670
+ };
671
+ export type AiEditAppendRunLogResult = {
672
+ success: true;
673
+ dry_run: boolean;
674
+ run_id: string;
675
+ log: AiEditRunLog | null;
676
+ };
677
+ export type AiEditCreateRunOptions = {
678
+ projectId: string;
679
+ styleId: AiEditStyleId;
680
+ qualityTarget: AiEditQualityTarget | undefined;
681
+ controllerKind: AiEditControllerKind | undefined;
682
+ dryRun: boolean | undefined;
683
+ };
684
+ export type AiEditApplyStyleOptions = {
685
+ runId: string;
686
+ dryRun: boolean | undefined;
687
+ titleText: string | null | undefined;
688
+ };
689
+ export type AiEditApplyStyleResult = {
690
+ success: true;
691
+ dry_run: boolean;
692
+ run_id: string;
693
+ project_id: string;
694
+ style_id: AiEditStyleId;
695
+ receipts: Array<{
696
+ action: string;
697
+ target_id: string;
698
+ dry_run: boolean;
699
+ changes: JsonObject;
700
+ }>;
701
+ txid: number | null;
702
+ };
703
+ export type AiEditSnapshotTime = "start" | "hook" | "middle" | "end";
704
+ export type AiEditRenderSnapshotsOptions = {
705
+ runId: string;
706
+ dryRun: boolean | undefined;
707
+ times: Array<number | AiEditSnapshotTime> | undefined;
708
+ targetWidth: number | undefined;
709
+ imageFormat: "jpeg" | "png" | undefined;
710
+ };
711
+ export type AiEditSnapshotsResult = {
712
+ success: true;
713
+ dry_run: boolean;
714
+ run_id: string;
715
+ project_id: string;
716
+ snapshots: Array<{
717
+ artifact_id: string | null;
718
+ preview_url: string | null;
719
+ storage_key: string | null;
720
+ frame: number | null;
721
+ time_seconds: number;
722
+ width: number | null;
723
+ height: number | null;
724
+ image_format: "jpeg" | "png";
725
+ }>;
726
+ };
727
+ export type AiEditValidateOptions = {
728
+ runId: string;
729
+ dryRun: boolean | undefined;
730
+ };
731
+ export type AiEditValidationResult = {
732
+ success: true;
733
+ dry_run: boolean;
734
+ run_id: string;
735
+ project_id: string;
736
+ passed: boolean;
737
+ checks: Array<{
738
+ rule: string;
739
+ passed: boolean;
740
+ message: string;
741
+ }>;
742
+ };
743
+ export type AiEditCompleteOptions = {
744
+ runId: string;
745
+ status: "completed" | "needs_review" | "failed";
746
+ summary: string;
747
+ dryRun: boolean | undefined;
748
+ };
749
+ export type AiEditCompleteResult = {
750
+ success: true;
751
+ dry_run: boolean;
752
+ run_id: string;
753
+ status: "completed" | "needs_review" | "failed";
754
+ summary: string;
755
+ };
482
756
  export type ExportStatus = {
483
757
  export_id: string;
484
758
  status: string;
485
759
  download_url: string | null;
486
760
  short_download_url: string | null;
487
761
  thumbnail_url: string | null;
762
+ thumbnail: {
763
+ url: string | null;
764
+ frame: number | null;
765
+ frame_seconds: number | null;
766
+ selection_mode: string | null;
767
+ rationale: string | null;
768
+ } | null;
769
+ platform_metadata: JsonObject | null;
488
770
  expires_at: string | null;
489
771
  file_size_bytes: number | null;
490
772
  duration_seconds: number | null;
@@ -520,6 +802,19 @@ export type SnapshotBatchOptions = {
520
802
  export type InspectProjectOptions = {
521
803
  projectId: string;
522
804
  mode: ProjectContextMode;
805
+ assetLimit?: number;
806
+ assetOffset?: number;
807
+ timelineLimit?: number;
808
+ timelineOffset?: number;
809
+ transcriptLimit?: number;
810
+ transcriptOffset?: number;
811
+ captionWordLimit?: number;
812
+ captionWordOffset?: number;
813
+ };
814
+ export type ProjectTimelineOptions = {
815
+ projectId: string;
816
+ limit?: number;
817
+ offset?: number;
523
818
  };
524
819
  export type ListProjectsOptions = {
525
820
  limit: number | undefined;
@@ -605,6 +900,7 @@ export type AttachMediaToProjectOptions = {
605
900
  positionY: number | undefined;
606
901
  widthPx: number | undefined;
607
902
  heightPx: number | undefined;
903
+ keepAspectRatio: boolean | undefined;
608
904
  scale: number | undefined;
609
905
  opacity: number | undefined;
610
906
  animationPreset: MediaAnimationPreset | undefined;
@@ -851,7 +1147,9 @@ export type UpdateMediaOverlayOptions = {
851
1147
  positionY: number | undefined;
852
1148
  widthPx: number | undefined;
853
1149
  heightPx: number | undefined;
1150
+ keepAspectRatio: boolean | undefined;
854
1151
  scale: number | undefined;
1152
+ opacity: number | undefined;
855
1153
  animationPreset: MediaAnimationPreset | undefined;
856
1154
  removeAnimations: boolean | undefined;
857
1155
  blurredBackground: boolean | undefined;
@@ -894,7 +1192,11 @@ export type SetCaptionWordEmphasisOptions = CaptionWordSelectorOptions & {
894
1192
  };
895
1193
  export type DeleteCaptionWordsOptions = {
896
1194
  projectId: string;
897
- wordIds: string[];
1195
+ wordIds: string[] | undefined;
1196
+ timelineItemId: string | undefined;
1197
+ all: boolean | undefined;
1198
+ fromSeconds: number | undefined;
1199
+ toSeconds: number | undefined;
898
1200
  };
899
1201
  export type MergeCaptionWordsOptions = {
900
1202
  projectId: string;
@@ -923,6 +1225,7 @@ export type StartExportOptions = {
923
1225
  projectId: string;
924
1226
  resolution: string | undefined;
925
1227
  format: string | undefined;
1228
+ coverFrameSeconds?: number | null;
926
1229
  };
927
1230
  export type WaitExportOptions = {
928
1231
  exportId: string;
@@ -933,6 +1236,7 @@ export type SilencePlanOptions = {
933
1236
  projectId: string;
934
1237
  timelineItemId: string | undefined;
935
1238
  allMediaItems: boolean | undefined;
1239
+ strategy: "audio" | "caption-gaps" | undefined;
936
1240
  paddingMs: number | undefined;
937
1241
  silenceThresholdDb: number | undefined;
938
1242
  minSilenceDurationSeconds: number | undefined;
@@ -942,6 +1246,11 @@ export type SilencePlanOptions = {
942
1246
  export type SilenceApplyOptions = SilencePlanOptions & {
943
1247
  deleteSilentClips: boolean | undefined;
944
1248
  manualSegmentOverrides: Record<string, "keep" | "cut"> | undefined;
1249
+ segments: Array<{
1250
+ timelineItemId: string | undefined;
1251
+ startSeconds: number;
1252
+ endSeconds: number;
1253
+ }> | undefined;
945
1254
  previewConfirmed: true;
946
1255
  };
947
1256
  export type MistakePlanOptions = {
@@ -1032,21 +1341,11 @@ export declare class BlitzReelsClient {
1032
1341
  success: true;
1033
1342
  }>;
1034
1343
  inspect: (options: InspectProjectOptions) => Promise<ProjectContext>;
1035
- timeline: (options: {
1036
- projectId: string;
1037
- }) => Promise<ProjectContext>;
1344
+ timeline: (options: ProjectTimelineOptions) => Promise<ProjectContext>;
1038
1345
  renderSnapshot: (options: SnapshotOptions) => Promise<PreviewFrame>;
1039
1346
  renderSnapshots: (options: SnapshotBatchOptions) => Promise<PreviewFrames>;
1040
1347
  };
1041
- timeline: {
1042
- transform: (options: TimelineTransformOptions) => Promise<TimelineEditResult>;
1043
- move: (options: TimelineMoveOptions) => Promise<TimelineEditResult>;
1044
- delete: (options: TimelineDeleteOptions) => Promise<TimelineEditResult>;
1045
- deleteItem: (options: {
1046
- projectId: string;
1047
- timelineItemId: string;
1048
- }) => Promise<TimelineItemDeleteResult>;
1049
- };
1348
+ timeline: TimelineResource;
1050
1349
  effects: {
1051
1350
  zoom: {
1052
1351
  add: (options: AddEffectOptions<ZoomEffectSettings>) => Promise<EffectMutationResult>;
@@ -1158,34 +1457,8 @@ export declare class BlitzReelsClient {
1158
1457
  plan: (options: MistakePlanOptions) => Promise<unknown>;
1159
1458
  apply: (options: MistakeApplyOptions) => Promise<unknown>;
1160
1459
  };
1161
- captions: {
1162
- listWords: (options: ListCaptionWordsOptions) => Promise<CaptionWordsList>;
1163
- updateWordText: (options: UpdateCaptionWordTextOptions) => Promise<CaptionWordTextResult>;
1164
- batchUpdateWordText: (options: BatchUpdateCaptionWordTextOptions) => Promise<CaptionWordBatchTextResult>;
1165
- setWordStyle: (options: SetCaptionWordStyleOptions) => Promise<CaptionWordCountResult>;
1166
- setWordEmphasis: (options: SetCaptionWordEmphasisOptions) => Promise<CaptionWordCountResult>;
1167
- deleteWords: (options: DeleteCaptionWordsOptions) => Promise<CaptionWordMutationResult>;
1168
- delete: (options: CaptionTrackSelectorOptions) => Promise<CaptionTrackMutationResult>;
1169
- hide: (options: CaptionTrackSelectorOptions) => Promise<CaptionTrackMutationResult>;
1170
- show: (options: CaptionTrackSelectorOptions) => Promise<CaptionTrackMutationResult>;
1171
- mergeWords: (options: MergeCaptionWordsOptions) => Promise<CaptionWordMutationResult>;
1172
- splitWord: (options: SplitCaptionWordOptions) => Promise<CaptionWordMutationResult>;
1173
- listThemes: () => Promise<CaptionThemeList>;
1174
- updateTheme: (options: UpdateCaptionThemeOptions) => Promise<CaptionTheme>;
1175
- setDefaultTheme: (options: {
1176
- themeId: string;
1177
- }) => Promise<{
1178
- success: boolean;
1179
- }>;
1180
- setProjectTheme: (options: {
1181
- projectId: string;
1182
- themeId: string;
1183
- }) => Promise<{
1184
- success: boolean;
1185
- theme_id: string;
1186
- }>;
1187
- previewTheme: (options: PreviewCaptionThemeOptions) => Promise<CaptionThemePreview>;
1188
- };
1460
+ aiEdit: AiEditResource;
1461
+ captions: CaptionsResource;
1189
1462
  exports: {
1190
1463
  start: (options: StartExportOptions) => Promise<ExportStartResult>;
1191
1464
  get: (options: {