@shotstack/shotstack-studio 2.12.1 → 2.13.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/index.d.ts CHANGED
@@ -110,6 +110,14 @@ declare type ClipReference = ClipLocation & {
110
110
  clip: Clip;
111
111
  };
112
112
 
113
+ /**
114
+ * Result of command execution.
115
+ */
116
+ export declare interface CommandResult {
117
+ status: "success" | "noop";
118
+ message?: string;
119
+ }
120
+
113
121
  export declare class Controls {
114
122
  private edit;
115
123
  private seekDistance;
@@ -200,17 +208,27 @@ export declare class Edit {
200
208
  } | null;
201
209
  /**
202
210
  * Patch fields on a clip identified by stable ID.
211
+ *
212
+ * Resolves with the command outcome: `success` when the clip was updated, or `noop`
213
+ * (with a `message`) when no clip matches `clipId`.
203
214
  */
204
- updateClipById(clipId: string, updates: Partial<Clip>): Promise<void>;
215
+ updateClipById(clipId: string, updates: Partial<Clip>): Promise<CommandResult>;
205
216
  /**
206
217
  * Remove a clip identified by stable ID.
218
+ *
219
+ * Resolves with the command outcome: `success` when the clip was removed, or `noop`
220
+ * (with a `message`) when no clip matches `clipId` or the deletion was refused —
221
+ * the timeline always keeps at least one clip.
207
222
  */
208
- deleteClipById(clipId: string): Promise<void>;
223
+ deleteClipById(clipId: string): Promise<CommandResult>;
209
224
  /**
210
225
  * Move a clip identified by stable ID to a different track and/or start time.
226
+ *
227
+ * Resolves with the command outcome: `success` when the clip was moved, or `noop`
228
+ * (with a `message`) when no clip matches `clipId`.
211
229
  */
212
- moveClipById(clipId: string, toTrackIndex: number, newStart?: Seconds): Promise<void>;
213
- addClip(trackIdx: number, clip: Clip): Promise<void>;
230
+ moveClipById(clipId: string, toTrackIndex: number, newStart?: Seconds): Promise<CommandResult>;
231
+ addClip(trackIdx: number, clip: Clip): Promise<CommandResult>;
214
232
  addSvgClip(svgMarkup: string, opts?: {
215
233
  trackIndex?: number;
216
234
  start?: Seconds;
@@ -235,8 +253,15 @@ export declare class Edit {
235
253
  * Whether the clip at `(trackIdx, clipIdx)` can be deleted.
236
254
  */
237
255
  canDeleteClip(trackIdx: number, clipIdx: number): boolean;
238
- deleteClip(trackIdx: number, clipIdx: number): Promise<void>;
239
- addTrack(trackIdx: number, track: Track): Promise<void>;
256
+ /**
257
+ * Delete the clip at `(trackIdx, clipIdx)`, along with any luma matte attached to it.
258
+ *
259
+ * Resolves with the command outcome for the requested clip: `success` when it was
260
+ * removed, or `noop` (with a `message`) when there is no clip at that position or the
261
+ * deletion was refused — the timeline always keeps at least one clip.
262
+ */
263
+ deleteClip(trackIdx: number, clipIdx: number): Promise<CommandResult>;
264
+ addTrack(trackIdx: number, track: Track): Promise<CommandResult>;
240
265
  /**
241
266
  * Add a font to the timeline.
242
267
  */
@@ -253,9 +278,28 @@ export declare class Edit {
253
278
  */
254
279
  private autoLinkCaptionSources;
255
280
  getTrack(trackIdx: number): Track | null;
256
- deleteTrack(trackIdx: number): void;
257
- undo(): Promise<void>;
258
- redo(): Promise<void>;
281
+ /**
282
+ * Delete the track at `trackIdx` and all of its clips.
283
+ *
284
+ * Resolves with the command outcome: `success` when the track was removed, or `noop`
285
+ * (with a `message`) when the deletion was refused — the timeline always keeps at
286
+ * least one track.
287
+ */
288
+ deleteTrack(trackIdx: number): Promise<CommandResult>;
289
+ /**
290
+ * Undo the most recent command.
291
+ *
292
+ * Resolves with the outcome: `success` when a command was undone, or `noop` (with a
293
+ * `message`) when the history is empty or the command cannot be undone.
294
+ */
295
+ undo(): Promise<CommandResult>;
296
+ /**
297
+ * Re-apply the most recently undone command.
298
+ *
299
+ * Resolves with the outcome: `success` when a command was re-applied, or `noop` (with
300
+ * a `message`) when there is nothing to redo.
301
+ */
302
+ redo(): Promise<CommandResult>;
259
303
  /** True when there is a command to undo (the history pointer is not before the first command). */
260
304
  get canUndo(): boolean;
261
305
  /** True when there is a command ahead to redo (the history pointer is not at the latest command). */
@@ -264,7 +308,13 @@ export declare class Edit {
264
308
  * Add a command to history without executing it.
265
309
  */
266
310
  private addCommandToHistory;
267
- updateClip(trackIdx: number, clipIdx: number, updates: Partial<Clip>): Promise<void>;
311
+ /**
312
+ * Merge `updates` into the clip at `(trackIdx, clipIdx)`.
313
+ *
314
+ * Resolves with the command outcome: `success` when the clip was updated, or `noop`
315
+ * (with a `message`) when there is no clip at that position.
316
+ */
317
+ updateClip(trackIdx: number, clipIdx: number, updates: Partial<Clip>): Promise<CommandResult>;
268
318
  /**
269
319
  * HEAD-check every external http(s) URL in a payload
270
320
  */
@@ -315,16 +365,16 @@ export declare class Edit {
315
365
  private unloadClipAssets;
316
366
  private movePlayerToTrackContainer;
317
367
  private addPlayer;
318
- setOutputSize(width: number, height: number): Promise<void>;
319
- setOutputFps(fps: number): Promise<void>;
368
+ setOutputSize(width: number, height: number): Promise<CommandResult>;
369
+ setOutputFps(fps: number): Promise<CommandResult>;
320
370
  getOutputFps(): number;
321
- setOutputFormat(format: string): Promise<void>;
371
+ setOutputFormat(format: string): Promise<CommandResult>;
322
372
  getOutputFormat(): string;
323
- setOutputDestinations(destinations: Destination[]): Promise<void>;
373
+ setOutputDestinations(destinations: Destination[]): Promise<CommandResult>;
324
374
  getOutputDestinations(): Destination[];
325
- setOutputResolution(resolution: string): Promise<void>;
375
+ setOutputResolution(resolution: string): Promise<CommandResult>;
326
376
  getOutputResolution(): string | undefined;
327
- setOutputAspectRatio(aspectRatio: string): Promise<void>;
377
+ setOutputAspectRatio(aspectRatio: string): Promise<CommandResult>;
328
378
  /**
329
379
  * Capture the rendered output frame as a base64 data URL.
330
380
  *
@@ -367,9 +417,16 @@ export declare class Edit {
367
417
  aspectRatio?: string;
368
418
  }): Promise<void>;
369
419
  getOutputAspectRatio(): string | undefined;
370
- setTimelineBackground(color: string): Promise<void>;
420
+ setTimelineBackground(color: string): Promise<CommandResult>;
371
421
  private setTimelineBackgroundInternal;
372
422
  getTimelineBackground(): string;
423
+ /**
424
+ * Re-detect merge field placeholders across the document and re-resolve the canvas.
425
+ * Use after registering or updating fields directly on the merge field service (rather
426
+ * than through a clip-level command): clips that already contain `{{ FIELD }}`
427
+ * placeholders pick up their resolved values immediately, without a reload.
428
+ */
429
+ refreshMergeFields(): void;
373
430
  /**
374
431
  * Find the content clip that best matches a luma (by temporal overlap).
375
432
  */
@@ -16,6 +16,14 @@ declare type ClipReference = ClipLocation & {
16
16
  clip: Clip;
17
17
  };
18
18
 
19
+ /**
20
+ * Result of command execution.
21
+ */
22
+ declare interface CommandResult {
23
+ status: "success" | "noop";
24
+ message?: string;
25
+ }
26
+
19
27
  declare type Destination = components["schemas"]["Destinations"];
20
28
 
21
29
  export declare class Edit {
@@ -89,17 +97,27 @@ export declare class Edit {
89
97
  } | null;
90
98
  /**
91
99
  * Patch fields on a clip identified by stable ID.
100
+ *
101
+ * Resolves with the command outcome: `success` when the clip was updated, or `noop`
102
+ * (with a `message`) when no clip matches `clipId`.
92
103
  */
93
- updateClipById(clipId: string, updates: Partial<Clip>): Promise<void>;
104
+ updateClipById(clipId: string, updates: Partial<Clip>): Promise<CommandResult>;
94
105
  /**
95
106
  * Remove a clip identified by stable ID.
107
+ *
108
+ * Resolves with the command outcome: `success` when the clip was removed, or `noop`
109
+ * (with a `message`) when no clip matches `clipId` or the deletion was refused —
110
+ * the timeline always keeps at least one clip.
96
111
  */
97
- deleteClipById(clipId: string): Promise<void>;
112
+ deleteClipById(clipId: string): Promise<CommandResult>;
98
113
  /**
99
114
  * Move a clip identified by stable ID to a different track and/or start time.
115
+ *
116
+ * Resolves with the command outcome: `success` when the clip was moved, or `noop`
117
+ * (with a `message`) when no clip matches `clipId`.
100
118
  */
101
- moveClipById(clipId: string, toTrackIndex: number, newStart?: Seconds): Promise<void>;
102
- addClip(trackIdx: number, clip: Clip): Promise<void>;
119
+ moveClipById(clipId: string, toTrackIndex: number, newStart?: Seconds): Promise<CommandResult>;
120
+ addClip(trackIdx: number, clip: Clip): Promise<CommandResult>;
103
121
  addSvgClip(svgMarkup: string, opts?: {
104
122
  trackIndex?: number;
105
123
  start?: Seconds;
@@ -124,8 +142,15 @@ export declare class Edit {
124
142
  * Whether the clip at `(trackIdx, clipIdx)` can be deleted.
125
143
  */
126
144
  canDeleteClip(trackIdx: number, clipIdx: number): boolean;
127
- deleteClip(trackIdx: number, clipIdx: number): Promise<void>;
128
- addTrack(trackIdx: number, track: Track): Promise<void>;
145
+ /**
146
+ * Delete the clip at `(trackIdx, clipIdx)`, along with any luma matte attached to it.
147
+ *
148
+ * Resolves with the command outcome for the requested clip: `success` when it was
149
+ * removed, or `noop` (with a `message`) when there is no clip at that position or the
150
+ * deletion was refused — the timeline always keeps at least one clip.
151
+ */
152
+ deleteClip(trackIdx: number, clipIdx: number): Promise<CommandResult>;
153
+ addTrack(trackIdx: number, track: Track): Promise<CommandResult>;
129
154
  /**
130
155
  * Add a font to the timeline.
131
156
  */
@@ -142,9 +167,28 @@ export declare class Edit {
142
167
  */
143
168
  private autoLinkCaptionSources;
144
169
  getTrack(trackIdx: number): Track | null;
145
- deleteTrack(trackIdx: number): void;
146
- undo(): Promise<void>;
147
- redo(): Promise<void>;
170
+ /**
171
+ * Delete the track at `trackIdx` and all of its clips.
172
+ *
173
+ * Resolves with the command outcome: `success` when the track was removed, or `noop`
174
+ * (with a `message`) when the deletion was refused — the timeline always keeps at
175
+ * least one track.
176
+ */
177
+ deleteTrack(trackIdx: number): Promise<CommandResult>;
178
+ /**
179
+ * Undo the most recent command.
180
+ *
181
+ * Resolves with the outcome: `success` when a command was undone, or `noop` (with a
182
+ * `message`) when the history is empty or the command cannot be undone.
183
+ */
184
+ undo(): Promise<CommandResult>;
185
+ /**
186
+ * Re-apply the most recently undone command.
187
+ *
188
+ * Resolves with the outcome: `success` when a command was re-applied, or `noop` (with
189
+ * a `message`) when there is nothing to redo.
190
+ */
191
+ redo(): Promise<CommandResult>;
148
192
  /** True when there is a command to undo (the history pointer is not before the first command). */
149
193
  get canUndo(): boolean;
150
194
  /** True when there is a command ahead to redo (the history pointer is not at the latest command). */
@@ -153,7 +197,13 @@ export declare class Edit {
153
197
  * Add a command to history without executing it.
154
198
  */
155
199
  private addCommandToHistory;
156
- updateClip(trackIdx: number, clipIdx: number, updates: Partial<Clip>): Promise<void>;
200
+ /**
201
+ * Merge `updates` into the clip at `(trackIdx, clipIdx)`.
202
+ *
203
+ * Resolves with the command outcome: `success` when the clip was updated, or `noop`
204
+ * (with a `message`) when there is no clip at that position.
205
+ */
206
+ updateClip(trackIdx: number, clipIdx: number, updates: Partial<Clip>): Promise<CommandResult>;
157
207
  /**
158
208
  * HEAD-check every external http(s) URL in a payload
159
209
  */
@@ -204,16 +254,16 @@ export declare class Edit {
204
254
  private unloadClipAssets;
205
255
  private movePlayerToTrackContainer;
206
256
  private addPlayer;
207
- setOutputSize(width: number, height: number): Promise<void>;
208
- setOutputFps(fps: number): Promise<void>;
257
+ setOutputSize(width: number, height: number): Promise<CommandResult>;
258
+ setOutputFps(fps: number): Promise<CommandResult>;
209
259
  getOutputFps(): number;
210
- setOutputFormat(format: string): Promise<void>;
260
+ setOutputFormat(format: string): Promise<CommandResult>;
211
261
  getOutputFormat(): string;
212
- setOutputDestinations(destinations: Destination[]): Promise<void>;
262
+ setOutputDestinations(destinations: Destination[]): Promise<CommandResult>;
213
263
  getOutputDestinations(): Destination[];
214
- setOutputResolution(resolution: string): Promise<void>;
264
+ setOutputResolution(resolution: string): Promise<CommandResult>;
215
265
  getOutputResolution(): string | undefined;
216
- setOutputAspectRatio(aspectRatio: string): Promise<void>;
266
+ setOutputAspectRatio(aspectRatio: string): Promise<CommandResult>;
217
267
  /**
218
268
  * Capture the rendered output frame as a base64 data URL.
219
269
  *
@@ -256,9 +306,16 @@ export declare class Edit {
256
306
  aspectRatio?: string;
257
307
  }): Promise<void>;
258
308
  getOutputAspectRatio(): string | undefined;
259
- setTimelineBackground(color: string): Promise<void>;
309
+ setTimelineBackground(color: string): Promise<CommandResult>;
260
310
  private setTimelineBackgroundInternal;
261
311
  getTimelineBackground(): string;
312
+ /**
313
+ * Re-detect merge field placeholders across the document and re-resolve the canvas.
314
+ * Use after registering or updating fields directly on the merge field service (rather
315
+ * than through a clip-level command): clips that already contain `{{ FIELD }}`
316
+ * placeholders pick up their resolved values immediately, without a reload.
317
+ */
318
+ refreshMergeFields(): void;
262
319
  /**
263
320
  * Find the content clip that best matches a luma (by temporal overlap).
264
321
  */
@@ -542,11 +599,11 @@ export declare class ShotstackEdit extends Edit {
542
599
  /**
543
600
  * Apply a merge field to a clip property.
544
601
  */
545
- applyMergeField(clipId: string, propertyPath: string, fieldName: string, value: string, originalValue?: string): Promise<void>;
602
+ applyMergeField(clipId: string, propertyPath: string, fieldName: string, value: string, originalValue?: string): Promise<CommandResult>;
546
603
  /**
547
604
  * Remove a merge field from a clip property, restoring the original value.
548
605
  */
549
- removeMergeField(clipId: string, propertyPath: string, restoreValue: string): Promise<void>;
606
+ removeMergeField(clipId: string, propertyPath: string, restoreValue: string): Promise<CommandResult>;
550
607
  /**
551
608
  * Get the merge field name for a clip property, if any.
552
609
  */