@nodaro/shared 3.30.0 → 3.31.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.cjs +733 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +501 -36
- package/dist/index.d.ts +501 -36
- package/dist/index.js +673 -94
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__tests__/entity-image-handle.test.ts +61 -1
- package/src/__tests__/json-kinds.test.ts +10 -0
- package/src/__tests__/model-seed-capability.test.ts +34 -0
- package/src/__tests__/node-preset-extract.test.ts +8 -0
- package/src/__tests__/node-run-routes.test.ts +63 -0
- package/src/__tests__/node-runtime-keys.test.ts +61 -0
- package/src/__tests__/presentation-utils.test.ts +14 -0
- package/src/__tests__/producer-types.test.ts +15 -0
- package/src/__tests__/seedance-draft.test.ts +74 -0
- package/src/__tests__/ugc-clip-saved-list.test.ts +19 -0
- package/src/__tests__/ugc-node-wires.test.ts +600 -0
- package/src/__tests__/ugc-run-state.test.ts +80 -3
- package/src/__tests__/workflow-export-strip.test.ts +14 -0
- package/src/entity-image-handle.ts +48 -1
- package/src/index.ts +8 -1
- package/src/json-kinds.ts +9 -0
- package/src/model-catalog.ts +61 -2
- package/src/model-constants.ts +3 -0
- package/src/node-preset-export.ts +2 -2
- package/src/node-preset-extract.ts +6 -4
- package/src/node-run-routes.ts +76 -0
- package/src/node-runtime-keys.ts +42 -1
- package/src/presentation-utils.ts +3 -0
- package/src/producer-types.ts +10 -0
- package/src/seedance-draft.ts +64 -0
- package/src/social-post.ts +13 -0
- package/src/ugc-node-wires.ts +623 -0
- package/src/ugc-run-state.ts +60 -5
- package/src/workflow-export.ts +3 -1
package/package.json
CHANGED
|
@@ -1,5 +1,65 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest"
|
|
2
|
-
import { resolveEffectiveSourceType, ENTITY_IMAGE_HANDLE_TYPES, AGGREGATE_LANE_SOURCE_TYPES, sourceRefKey } from "../entity-image-handle.js"
|
|
2
|
+
import { resolveEffectiveSourceType, ENTITY_IMAGE_HANDLE_TYPES, AGGREGATE_LANE_SOURCE_TYPES, OUTPUT_PIP_EFFECTIVE_TYPES, outputPipSourceType, sourceRefKey } from "../entity-image-handle.js"
|
|
3
|
+
import { LEGACY_SOURCE_HANDLE_ALIASES } from "../handle-aliases.js"
|
|
4
|
+
|
|
5
|
+
describe("an output pip that emits a plain medium (OUTPUT_PIP_EFFECTIVE_TYPES)", () => {
|
|
6
|
+
it("UGC Creator's `image` pip is a plain image producer; its `creator` pip and a missing handle stay UGC Creator", () => {
|
|
7
|
+
expect(OUTPUT_PIP_EFFECTIVE_TYPES["ugc-creator"]).toEqual({ image: "upload-image" })
|
|
8
|
+
expect(resolveEffectiveSourceType("ugc-creator", "image")).toBe("upload-image")
|
|
9
|
+
expect(resolveEffectiveSourceType("ugc-creator", "creator")).toBe("ugc-creator")
|
|
10
|
+
expect(resolveEffectiveSourceType("ugc-creator", null)).toBe("ugc-creator")
|
|
11
|
+
expect(resolveEffectiveSourceType("ugc-creator", undefined)).toBe("ugc-creator")
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it("UGC's plain-text pips are one text each (the script's category, the clips' transcript, the cards' Notes); the JSON pips stay their node", () => {
|
|
15
|
+
expect(OUTPUT_PIP_EFFECTIVE_TYPES["ugc-script"]).toEqual({ category: "combine-text" })
|
|
16
|
+
expect(OUTPUT_PIP_EFFECTIVE_TYPES["ugc-clips"]).toEqual({ transcript: "combine-text" })
|
|
17
|
+
expect(OUTPUT_PIP_EFFECTIVE_TYPES["ugc-cards"]).toEqual({ report: "combine-text" })
|
|
18
|
+
for (const [type, pip] of [["ugc-script", "category"], ["ugc-clips", "transcript"], ["ugc-cards", "report"]] as const) {
|
|
19
|
+
expect(resolveEffectiveSourceType(type, pip), `${type}.${pip}`).toBe("combine-text")
|
|
20
|
+
expect(outputPipSourceType(type, pip), `${type}.${pip}`).toBe("combine-text")
|
|
21
|
+
}
|
|
22
|
+
for (const [type, pip] of [["ugc-creator", "creator"], ["ugc-script", "plan"], ["ugc-clips", "clips"], ["ugc-clips", "plan-out"], ["ugc-clip", "video-out"], ["ugc-cards", "layerPlan"], ["ugc-cards", "captionPlan"]] as const) {
|
|
23
|
+
expect(resolveEffectiveSourceType(type, pip), `${type}.${pip}`).toBe(type)
|
|
24
|
+
}
|
|
25
|
+
// An edge with no source pip reads the node's primary output, which is never a text pip.
|
|
26
|
+
for (const type of ["ugc-script", "ugc-clips", "ugc-cards"]) expect(resolveEffectiveSourceType(type, null)).toBe(type)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it("the legacy-handle classifiers read this table alone: an entity's image pip or a lane keeps its own type there", () => {
|
|
30
|
+
expect(outputPipSourceType("ugc-creator", "image")).toBe("upload-image")
|
|
31
|
+
expect(outputPipSourceType("ugc-creator", "creator")).toBe("ugc-creator")
|
|
32
|
+
expect(outputPipSourceType("character", "image")).toBe("character")
|
|
33
|
+
expect(outputPipSourceType("collect", "out-image")).toBe("collect")
|
|
34
|
+
expect(outputPipSourceType(undefined, "image")).toBe("")
|
|
35
|
+
})
|
|
36
|
+
|
|
37
|
+
it("is no identity remap: UGC Creator is not an entity, and its image keeps the bare node id as a ref key", () => {
|
|
38
|
+
expect(ENTITY_IMAGE_HANDLE_TYPES.has("ugc-creator")).toBe(false)
|
|
39
|
+
expect(sourceRefKey("n1", "image", "ugc-creator")).toBe("n1")
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it("never reads an inherited key", () => {
|
|
43
|
+
expect(outputPipSourceType("constructor", "image")).toBe("constructor")
|
|
44
|
+
expect(outputPipSourceType("ugc-creator", "constructor")).toBe("ugc-creator")
|
|
45
|
+
expect(resolveEffectiveSourceType("ugc-creator", "toString")).toBe("ugc-creator")
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
it("no source-handle alias names a remapped pip", () => {
|
|
49
|
+
// Both engines read the remap on the pip AS WRITTEN in the Generate Image
|
|
50
|
+
// handle migration, and on the pip AFTER the source-alias fix in the
|
|
51
|
+
// legacy-target classifiers (the server's write-time normalizer, the
|
|
52
|
+
// editor's load pass). An alias to or from a remapped pip would judge one
|
|
53
|
+
// edge by two different pips. Record the remap on the alias's spelling as
|
|
54
|
+
// well, or apply the alias before every read, before adding one.
|
|
55
|
+
for (const [type, pips] of Object.entries(OUTPUT_PIP_EFFECTIVE_TYPES)) {
|
|
56
|
+
const aliases = Object.hasOwn(LEGACY_SOURCE_HANDLE_ALIASES, type) ? LEGACY_SOURCE_HANDLE_ALIASES[type]! : {}
|
|
57
|
+
for (const [from, to] of Object.entries(aliases)) {
|
|
58
|
+
expect(Object.hasOwn(pips, from) || Object.hasOwn(pips, to), `${type}: the alias ${from} → ${to} names a remapped pip`).toBe(false)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
})
|
|
3
63
|
|
|
4
64
|
const ENTITY_REF_HANDLE: Record<string, string> = {
|
|
5
65
|
character: "characterRef",
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
jsonOutputKind,
|
|
10
10
|
declaredJsonOutput,
|
|
11
11
|
declaredJsonOutputRows,
|
|
12
|
+
UGC_PRIMARY_HANDLE,
|
|
12
13
|
type RenderNodeDescriptor,
|
|
13
14
|
} from "../index.js"
|
|
14
15
|
|
|
@@ -186,4 +187,13 @@ describe("declaredJsonOutput — every JSON pip is classified (decided 2026-10-0
|
|
|
186
187
|
expect(declaredJsonOutput(type, pip)).toBe(kind)
|
|
187
188
|
}
|
|
188
189
|
})
|
|
190
|
+
|
|
191
|
+
it("a UGC node's edge with no source pip reads the UGC wires' primary output, whose JSON is neither kind", () => {
|
|
192
|
+
for (const type of ["ugc-creator", "ugc-script", "ugc-clips", "ugc-cards"]) {
|
|
193
|
+
expect(declaredJsonOutput(type, undefined), type).toBe("other")
|
|
194
|
+
expect(declaredJsonOutput(type, UGC_PRIMARY_HANDLE[type]), type).toBe("other")
|
|
195
|
+
}
|
|
196
|
+
// UGC Clip's only pip is its video: no JSON row at all.
|
|
197
|
+
expect(declaredJsonOutput("ugc-clip", undefined)).toBeUndefined()
|
|
198
|
+
})
|
|
189
199
|
})
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import { MODEL_CATALOG, modelTakesSeed } from "../model-catalog.js"
|
|
3
|
+
|
|
4
|
+
// `noSeed` is the catalog's answer to "does a seed on this model do anything".
|
|
5
|
+
// The editor hides its Seed field off it; the backend's KIE `omitSeed` flags
|
|
6
|
+
// are pinned to it by backend/src/providers/kie/__tests__/seed-capability-parity.test.ts.
|
|
7
|
+
describe("modelTakesSeed", () => {
|
|
8
|
+
it("is false for Seedance 2.5 — the provider refuses a seed", () => {
|
|
9
|
+
expect(modelTakesSeed("seedance-2-5")).toBe(false)
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
it("is false for HappyHorse 1.1 (its schema dropped seed)", () => {
|
|
13
|
+
expect(modelTakesSeed("happyhorse")).toBe(false)
|
|
14
|
+
expect(modelTakesSeed("happyhorse-i2v")).toBe(false)
|
|
15
|
+
expect(modelTakesSeed("happyhorse-ref2v")).toBe(false)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it("is true for models that declare nothing", () => {
|
|
19
|
+
expect(modelTakesSeed("veo3")).toBe(true)
|
|
20
|
+
expect(modelTakesSeed("bytedance-lite")).toBe(true)
|
|
21
|
+
expect(modelTakesSeed("seedance-2")).toBe(true)
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it("is true for an unknown or missing id — never hides a field it knows nothing about", () => {
|
|
25
|
+
expect(modelTakesSeed("not-a-model")).toBe(true)
|
|
26
|
+
expect(modelTakesSeed(undefined)).toBe(true)
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it("agrees with the catalog flag for every entry", () => {
|
|
30
|
+
for (const m of Object.values(MODEL_CATALOG)) {
|
|
31
|
+
expect(modelTakesSeed(m.id), m.id).toBe(m.noSeed !== true)
|
|
32
|
+
}
|
|
33
|
+
})
|
|
34
|
+
})
|
|
@@ -296,3 +296,11 @@ describe("caption lever group (applying a caption preset over another)", () => {
|
|
|
296
296
|
for (const k of PRESET_APPLY_CLEAR_KEYS) expect(PRESET_EXCLUDED_KEYS.has(k), k).toBe(true)
|
|
297
297
|
})
|
|
298
298
|
})
|
|
299
|
+
|
|
300
|
+
describe("extractPresetData — a type's own run results under generic names", () => {
|
|
301
|
+
it("drops them from that type's preset, and keeps another node's setting of the same name", () => {
|
|
302
|
+
expect(extractPresetData({ quote: { expected: 1 }, voiceId: "v" }, "ugc-clips")).toEqual({ voiceId: "v" })
|
|
303
|
+
expect(extractPresetData({ quote: "a quote to show" }, "some-future-node")).toEqual({ quote: "a quote to show" })
|
|
304
|
+
expect(extractPresetData({ quote: "a quote to show" })).toEqual({ quote: "a quote to show" })
|
|
305
|
+
})
|
|
306
|
+
})
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import {
|
|
3
|
+
NODE_RUN_ROUTES,
|
|
4
|
+
NODE_TYPES_WITHOUT_RUN_ROUTE,
|
|
5
|
+
SOCIAL_POST_NODE_PLATFORM,
|
|
6
|
+
SOCIAL_POST_NODE_TYPES,
|
|
7
|
+
nodeRunRoute,
|
|
8
|
+
} from "../index.js"
|
|
9
|
+
|
|
10
|
+
describe("nodeRunRoute", () => {
|
|
11
|
+
it("is POST /v1/<type> for a node that follows the convention", () => {
|
|
12
|
+
expect(nodeRunRoute("generate-image")).toBe("/v1/generate-image")
|
|
13
|
+
expect(nodeRunRoute("pro-3d-render")).toBe("/v1/pro-3d-render")
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
it("names the nested route of a node that does not", () => {
|
|
17
|
+
expect(nodeRunRoute("llm-chat")).toBe("/v1/llm-chat/generate")
|
|
18
|
+
expect(nodeRunRoute("image-to-text")).toBe("/v1/image-to-text/describe")
|
|
19
|
+
expect(nodeRunRoute("video-composer")).toBe("/v1/scene-graph/generate")
|
|
20
|
+
expect(nodeRunRoute("generate-3d-scene")).toBe("/v1/3d-scene/generate")
|
|
21
|
+
expect(nodeRunRoute("suno-generate")).toBe("/v1/suno/generate")
|
|
22
|
+
expect(nodeRunRoute("suno-voice")).toBe("/v1/suno/voice/generate")
|
|
23
|
+
expect(nodeRunRoute("telegram-channel-feed")).toBe("/v1/telegram-channel/fetch")
|
|
24
|
+
expect(nodeRunRoute("ugc-creator")).toBe("/v1/ugc/creator")
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it("sends every social post node to the one publish route", () => {
|
|
28
|
+
for (const type of SOCIAL_POST_NODE_TYPES) expect(nodeRunRoute(type)).toBe("/v1/social/publish")
|
|
29
|
+
})
|
|
30
|
+
|
|
31
|
+
it("is null for a node with no route of its own", () => {
|
|
32
|
+
expect(nodeRunRoute("modify-image")).toBeNull()
|
|
33
|
+
expect(nodeRunRoute("paint-mask")).toBeNull()
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
it("escapes a type that is not a plain slug", () => {
|
|
37
|
+
expect(nodeRunRoute("a/b")).toBe("/v1/a%2Fb")
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
|
|
41
|
+
describe("the node route tables", () => {
|
|
42
|
+
it("list only routes that differ from the convention, under /v1/", () => {
|
|
43
|
+
for (const [type, route] of Object.entries(NODE_RUN_ROUTES)) {
|
|
44
|
+
expect(route.startsWith("/v1/"), type).toBe(true)
|
|
45
|
+
expect(route, type).not.toBe(`/v1/${type}`)
|
|
46
|
+
}
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it("never list a type as both routed and route-less", () => {
|
|
50
|
+
expect(Object.keys(NODE_RUN_ROUTES).filter((t) => t in NODE_TYPES_WITHOUT_RUN_ROUTE)).toEqual([])
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
it("say what to run instead for every route-less type", () => {
|
|
54
|
+
for (const [type, hint] of Object.entries(NODE_TYPES_WITHOUT_RUN_ROUTE)) expect(hint.length, type).toBeGreaterThan(10)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it("give every per-platform social node its platform, and only those", () => {
|
|
58
|
+
const perPlatform = [...SOCIAL_POST_NODE_TYPES].filter((t) => t !== "publish-social").sort()
|
|
59
|
+
expect(Object.keys(SOCIAL_POST_NODE_PLATFORM).sort()).toEqual(perPlatform)
|
|
60
|
+
expect(SOCIAL_POST_NODE_PLATFORM["x-post"]).toBe("x")
|
|
61
|
+
expect(SOCIAL_POST_NODE_PLATFORM["youtube-upload"]).toBe("youtube")
|
|
62
|
+
})
|
|
63
|
+
})
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { describe, it, expect } from "vitest"
|
|
2
2
|
import {
|
|
3
3
|
EXECUTION_DATA_KEYS,
|
|
4
|
+
NODE_TYPE_EXECUTION_DATA_KEYS,
|
|
4
5
|
TRANSIENT_RUNTIME_KEYS,
|
|
6
|
+
UGC_CREATOR_CANDIDATES_KEY,
|
|
7
|
+
executionDataKeysOf,
|
|
8
|
+
isExecutionDataKey,
|
|
5
9
|
stripTransientRuntimeData,
|
|
6
10
|
} from "../index.js"
|
|
7
11
|
|
|
@@ -73,6 +77,63 @@ describe("EXECUTION_DATA_KEYS", () => {
|
|
|
73
77
|
it("files the clear-results watermark as runtime bookkeeping — never preset / template / copilot-visible config", () => {
|
|
74
78
|
expect(EXECUTION_DATA_KEYS.has("resultsClearedAt")).toBe(true)
|
|
75
79
|
})
|
|
80
|
+
|
|
81
|
+
it("files a UGC run's own fields as run results of the UGC types only: a run writing them is never an undo step, and they persist", () => {
|
|
82
|
+
// What the UGC lanes write beside the generic keys: the outputs a node hands on, UGC Creator's
|
|
83
|
+
// options of a draw and their note, UGC Clips' quote, UGC Clip's warnings, length and Re-render marks.
|
|
84
|
+
const own: Record<string, readonly string[]> = {
|
|
85
|
+
"ugc-creator": ["ugcOutputs", UGC_CREATOR_CANDIDATES_KEY, "optionFailed"],
|
|
86
|
+
"ugc-script": ["ugcOutputs"],
|
|
87
|
+
"ugc-clips": ["ugcOutputs", "quote"],
|
|
88
|
+
"ugc-clip": ["ugcOutputs", "clipWarnings", "durationSec", "rerenderPending"],
|
|
89
|
+
"ugc-cards": ["ugcOutputs"],
|
|
90
|
+
}
|
|
91
|
+
for (const [type, keys] of Object.entries(own)) {
|
|
92
|
+
for (const key of keys) {
|
|
93
|
+
expect(isExecutionDataKey(key, type), `${type}.${key}`).toBe(true)
|
|
94
|
+
expect(TRANSIENT_RUNTIME_KEYS.has(key), `${key} must stay persisted`).toBe(false)
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
// A fan-out's notes rows are every fan-out's, whatever the node.
|
|
98
|
+
expect(EXECUTION_DATA_KEYS.has("__listResultMeta")).toBe(true)
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
it("never files those generic names as run state of another node: a setting stored under one stays a setting", () => {
|
|
102
|
+
for (const key of ["ugcOutputs", UGC_CREATOR_CANDIDATES_KEY, "optionFailed", "quote", "clipWarnings", "durationSec", "rerenderPending"]) {
|
|
103
|
+
expect(EXECUTION_DATA_KEYS.has(key), `${key} must not be global`).toBe(false)
|
|
104
|
+
expect(isExecutionDataKey(key, "llm-chat"), key).toBe(false)
|
|
105
|
+
expect(isExecutionDataKey(key, "video-overlay"), key).toBe(false)
|
|
106
|
+
expect(isExecutionDataKey(key, undefined), key).toBe(false)
|
|
107
|
+
}
|
|
108
|
+
// Each type's list is its own: UGC Clips' quote is not UGC Script's.
|
|
109
|
+
expect(isExecutionDataKey("quote", "ugc-script")).toBe(false)
|
|
110
|
+
expect(isExecutionDataKey("candidates", "ugc-clip")).toBe(false)
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
it("files only UGC types' generic names: Video Overlay's results stay as every other surface reads them", () => {
|
|
114
|
+
// Presets capture them, Reset clears them, exports and the Copilot keep them — as on any node.
|
|
115
|
+
for (const key of ["durationSec", "width", "height", "warnings", "resultCompositionKey"]) {
|
|
116
|
+
expect(isExecutionDataKey(key, "video-overlay"), key).toBe(false)
|
|
117
|
+
}
|
|
118
|
+
expect(executionDataKeysOf("video-overlay")).toBe(EXECUTION_DATA_KEYS)
|
|
119
|
+
for (const type of Object.keys(NODE_TYPE_EXECUTION_DATA_KEYS)) expect(type, type).toMatch(/^ugc-/)
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it("a type's own keys come with every global one, as a set", () => {
|
|
123
|
+
const ugcClip = executionDataKeysOf("ugc-clip")
|
|
124
|
+
for (const key of EXECUTION_DATA_KEYS) expect(ugcClip.has(key), key).toBe(true)
|
|
125
|
+
expect(ugcClip.has("clipWarnings")).toBe(true)
|
|
126
|
+
expect(executionDataKeysOf("llm-chat")).toBe(EXECUTION_DATA_KEYS)
|
|
127
|
+
expect(executionDataKeysOf(undefined)).toBe(EXECUTION_DATA_KEYS)
|
|
128
|
+
})
|
|
129
|
+
|
|
130
|
+
it("never files a UGC node's choices as run state: an edit of one stays undoable", () => {
|
|
131
|
+
for (const key of ["keepResult", "rerender", "voiceId", "source", "gender", "photoUrl", "categoryOverride", "seed", "targetDurationSec"]) {
|
|
132
|
+
for (const type of ["ugc-creator", "ugc-script", "ugc-clips", "ugc-clip", "ugc-cards"]) {
|
|
133
|
+
expect(isExecutionDataKey(key, type), `${type}.${key}`).toBe(false)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
})
|
|
76
137
|
})
|
|
77
138
|
|
|
78
139
|
describe("stripTransientRuntimeData", () => {
|
|
@@ -1185,6 +1185,20 @@ describe("getOutputType — derived from the producer vocabularies", () => {
|
|
|
1185
1185
|
})
|
|
1186
1186
|
})
|
|
1187
1187
|
|
|
1188
|
+
describe("UGC Cards' Notes are its text output", () => {
|
|
1189
|
+
// A published app shows UGC Cards as its Notes card: a text card, never a JSON blob.
|
|
1190
|
+
it("types UGC Cards as text, and leaves the other UGC nodes as they were", () => {
|
|
1191
|
+
expect(getOutputType("ugc-cards")).toBe("text")
|
|
1192
|
+
expect(getOutputType("ugc-clip")).toBe("video")
|
|
1193
|
+
for (const t of ["ugc-creator", "ugc-script", "ugc-clips"]) expect([t, getOutputType(t)]).toEqual([t, "data"])
|
|
1194
|
+
})
|
|
1195
|
+
|
|
1196
|
+
it("reads the Notes the editor writes on the node (generatedText) as its text", () => {
|
|
1197
|
+
const data = { label: "UGC Cards", result: { layerPlan: "[]", captionPlan: "{}", report: "No issues." }, generatedText: "No issues." }
|
|
1198
|
+
expect(getNodeResult(data)).toEqual({ url: undefined, text: "No issues." })
|
|
1199
|
+
})
|
|
1200
|
+
})
|
|
1201
|
+
|
|
1188
1202
|
describe("published-app / API-token output mapping for 3D Render Pro", () => {
|
|
1189
1203
|
const proNode = mkNode("pro", "pro-3d-render", { presentationOutput: true, label: "Render" })
|
|
1190
1204
|
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
listResultsServeHandle,
|
|
10
10
|
} from "../producer-types.js"
|
|
11
11
|
import { getOutputType } from "../presentation-utils.js"
|
|
12
|
+
import { UGC_PRIMARY_HANDLE } from "../ugc-node-wires.js"
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* Producer-set membership is what every downstream node's typed-handle
|
|
@@ -105,6 +106,10 @@ describe("producer-types", () => {
|
|
|
105
106
|
it("registers video-overlay as a video producer", () => {
|
|
106
107
|
expect(VIDEO_PRODUCER_TYPES.has("video-overlay")).toBe(true)
|
|
107
108
|
})
|
|
109
|
+
// UGC Clip renders one clip of a UGC video → emits a video URL on `video-out`.
|
|
110
|
+
it("registers ugc-clip as a video producer", () => {
|
|
111
|
+
expect(VIDEO_PRODUCER_TYPES.has("ugc-clip")).toBe(true)
|
|
112
|
+
})
|
|
108
113
|
})
|
|
109
114
|
|
|
110
115
|
// Per-handle "each" defaults (decided 2026-10-04): Camera Switch run once per
|
|
@@ -123,6 +128,16 @@ describe("defaultEdgeOutputMode / listResultsServeHandle", () => {
|
|
|
123
128
|
expect(defaultEdgeOutputMode("camera-switch", null)).toBe("each")
|
|
124
129
|
expect(defaultEdgeOutputMode("camera-switch", "transcript")).toBe("last")
|
|
125
130
|
})
|
|
131
|
+
it("UGC Clips: only the clips handle (and no handle = clips) is each; plan-out and transcript are one value", () => {
|
|
132
|
+
expect(FAN_OUT_EACH_HANDLES["ugc-clips"]).toEqual({ each: ["clips"], primary: "clips" })
|
|
133
|
+
// One source for the output an edge with no handle reads: the UGC wires' own.
|
|
134
|
+
expect(FAN_OUT_EACH_HANDLES["ugc-clips"]!.primary).toBe(UGC_PRIMARY_HANDLE["ugc-clips"])
|
|
135
|
+
expect(defaultEdgeOutputMode("ugc-clips", "clips")).toBe("each")
|
|
136
|
+
expect(defaultEdgeOutputMode("ugc-clips", undefined)).toBe("each")
|
|
137
|
+
expect(defaultEdgeOutputMode("ugc-clips", "plan-out")).toBe("last")
|
|
138
|
+
expect(defaultEdgeOutputMode("ugc-clips", "transcript")).toBe("last")
|
|
139
|
+
expect(listResultsServeHandle("ugc-clips", "plan-out")).toBe(false)
|
|
140
|
+
})
|
|
126
141
|
it("only the each handles read the per-iteration results", () => {
|
|
127
142
|
expect(listResultsServeHandle("camera-switch", "edl")).toBe(true)
|
|
128
143
|
expect(listResultsServeHandle("camera-switch", undefined)).toBe(true)
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest"
|
|
2
|
+
import {
|
|
3
|
+
SEEDANCE_DRAFT_MODELS,
|
|
4
|
+
isSeedanceDraftCapable,
|
|
5
|
+
seedanceDraftFinalizeBillableSec,
|
|
6
|
+
seedanceDraftFinalizeCreditId,
|
|
7
|
+
} from "../seedance-draft.js"
|
|
8
|
+
import { MODEL_CATALOG, normalizeVideoRequestParams } from "../model-catalog.js"
|
|
9
|
+
import { VIDEO_UPSCALE_PROVIDERS } from "../model-constants.js"
|
|
10
|
+
|
|
11
|
+
describe("Seedance Draft — the one capability gate", () => {
|
|
12
|
+
it("only Seedance 2.5 offers a draft", () => {
|
|
13
|
+
expect([...SEEDANCE_DRAFT_MODELS]).toEqual(["seedance-2-5"])
|
|
14
|
+
expect(isSeedanceDraftCapable("seedance-2-5")).toBe(true)
|
|
15
|
+
for (const other of ["seedance-2", "seedance-2-fast", "kling-3.0", "seedance-2-5-hd", undefined]) {
|
|
16
|
+
expect(isSeedanceDraftCapable(other)).toBe(false)
|
|
17
|
+
}
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
it("every draft-capable model is a real 480p-capable catalog model", () => {
|
|
21
|
+
for (const id of SEEDANCE_DRAFT_MODELS) {
|
|
22
|
+
expect(MODEL_CATALOG[id]?.resolutions).toContain("480p")
|
|
23
|
+
}
|
|
24
|
+
})
|
|
25
|
+
|
|
26
|
+
it("the finalize is a Video Upscale provider with a catalog entry", () => {
|
|
27
|
+
expect(VIDEO_UPSCALE_PROVIDERS).toContain("seedance-2-5-hd")
|
|
28
|
+
expect(MODEL_CATALOG["seedance-2-5-hd"]?.modes).toEqual(["video-upscale"])
|
|
29
|
+
})
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
describe("normalizeVideoRequestParams — draft forces 480p", () => {
|
|
33
|
+
it("coerces a stale 720p to 480p and discloses it", () => {
|
|
34
|
+
const out = normalizeVideoRequestParams("seedance-2-5", { resolution: "720p", draft: true })
|
|
35
|
+
expect(out.resolution).toBe("480p")
|
|
36
|
+
expect(out.adjustments).toEqual([expect.objectContaining({ field: "resolution", from: "720p", to: "480p" })])
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it("fills an omitted resolution with 480p silently", () => {
|
|
40
|
+
const out = normalizeVideoRequestParams("seedance-2-5", { draft: true })
|
|
41
|
+
expect(out.resolution).toBe("480p")
|
|
42
|
+
expect(out.adjustments).toEqual([])
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
it("leaves 480p alone", () => {
|
|
46
|
+
expect(normalizeVideoRequestParams("seedance-2-5", { resolution: "480p", draft: true }).adjustments).toEqual([])
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it("is ignored by a model that has no draft, and when draft is off", () => {
|
|
50
|
+
expect(normalizeVideoRequestParams("seedance-2", { resolution: "720p", draft: true }).resolution).toBe("720p")
|
|
51
|
+
expect(normalizeVideoRequestParams("seedance-2-5", { resolution: "1080p", draft: false }).resolution).toBe("1080p")
|
|
52
|
+
expect(normalizeVideoRequestParams("seedance-2-5", { resolution: "1080p" }).resolution).toBe("1080p")
|
|
53
|
+
})
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
describe("finalize credit ids", () => {
|
|
57
|
+
it("bills whole seconds: a container's 4.04 s is 4 s, 4.3 s is 5 s", () => {
|
|
58
|
+
expect(seedanceDraftFinalizeBillableSec(4.04)).toBe(4)
|
|
59
|
+
expect(seedanceDraftFinalizeBillableSec(4.25)).toBe(4)
|
|
60
|
+
expect(seedanceDraftFinalizeBillableSec(4.3)).toBe(5)
|
|
61
|
+
expect(seedanceDraftFinalizeBillableSec(12)).toBe(12)
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
it("clamps onto the seeded 4-30 s ladder", () => {
|
|
65
|
+
expect(seedanceDraftFinalizeBillableSec(2)).toBe(4)
|
|
66
|
+
expect(seedanceDraftFinalizeBillableSec(31.5)).toBe(30)
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
it("encodes output seconds plus a -ref twin, like the generation ladder", () => {
|
|
70
|
+
expect(seedanceDraftFinalizeCreditId(4.04, false)).toBe("seedance-2-5-hd:4s")
|
|
71
|
+
expect(seedanceDraftFinalizeCreditId(8, true)).toBe("seedance-2-5-hd:8s-ref")
|
|
72
|
+
expect(seedanceDraftFinalizeCreditId(30, false)).toBe("seedance-2-5-hd:30s")
|
|
73
|
+
})
|
|
74
|
+
})
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import { ugcClipSavedList } from "../index.js"
|
|
3
|
+
|
|
4
|
+
describe("ugcClipSavedList: what a list read takes from a UGC Clip", () => {
|
|
5
|
+
const takes = [{ url: "https://cdn.example/new.mp4" }, { url: "https://cdn.example/old.mp4" }]
|
|
6
|
+
it("its last batch, in clip order, when it holds one", () => {
|
|
7
|
+
expect(ugcClipSavedList({ __listResults: ["https://cdn.example/1.mp4", "", "https://cdn.example/2.mp4"], generatedResults: takes })).toEqual(["https://cdn.example/1.mp4", "https://cdn.example/2.mp4"])
|
|
8
|
+
})
|
|
9
|
+
it("else exactly the take it shows: the active result, else its video — never the earlier takes", () => {
|
|
10
|
+
expect(ugcClipSavedList({ generatedResults: takes })).toEqual(["https://cdn.example/new.mp4"])
|
|
11
|
+
expect(ugcClipSavedList({ generatedResults: takes, activeResultIndex: 1 })).toEqual(["https://cdn.example/old.mp4"])
|
|
12
|
+
expect(ugcClipSavedList({ generatedVideoUrl: "https://cdn.example/v.mp4" })).toEqual(["https://cdn.example/v.mp4"])
|
|
13
|
+
})
|
|
14
|
+
it("nothing when it holds no take", () => {
|
|
15
|
+
expect(ugcClipSavedList({})).toBeUndefined()
|
|
16
|
+
expect(ugcClipSavedList(undefined)).toBeUndefined()
|
|
17
|
+
expect(ugcClipSavedList({ __listResults: [], generatedResults: [] })).toBeUndefined()
|
|
18
|
+
})
|
|
19
|
+
})
|