@nodaro/shared 3.2.0 → 3.5.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.
@@ -0,0 +1,24 @@
1
+ /** Public workflow capability marker; creative planning stays in the Studio codec. */
2
+ export const STUDIO_DEPENDENT_FRAMES_CAPABILITY = "studio-dependent-frames-v1"
3
+
4
+ export class SequenceExecutionRequiredError extends Error {
5
+ readonly code = "sequence_execution_required"
6
+ readonly statusCode = 400
7
+ constructor(readonly nodeIds: readonly string[]) {
8
+ super("Generate linked frames and clips in Studio or through its production API so the reviewed images are used.")
9
+ this.name = "SequenceExecutionRequiredError"
10
+ }
11
+ }
12
+
13
+ /** A missing declaration must not make a recognizable dependency node runnable. */
14
+ export function requiresSequenceExecution(node: { data?: unknown }): boolean {
15
+ if (!node.data || typeof node.data !== "object" || Array.isArray(node.data)) return false
16
+ const data = node.data as Record<string, unknown>
17
+ return data.keyframeId !== undefined || data.sequenceBinding !== undefined
18
+ || (Array.isArray(data.requiredCapabilities) && data.requiredCapabilities.includes(STUDIO_DEPENDENT_FRAMES_CAPABILITY))
19
+ }
20
+
21
+ export function assertCanvasExecutionAllowed(nodes: readonly { id: string; data?: unknown }[]): void {
22
+ const blocked = nodes.filter(requiresSequenceExecution).map((node) => node.id)
23
+ if (blocked.length) throw new SequenceExecutionRequiredError(blocked)
24
+ }