@nodaro/shared 3.30.0 → 3.32.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/README.md +17 -0
- package/dist/chunk-2NIQO2J3.cjs +54 -0
- package/dist/chunk-2NIQO2J3.cjs.map +1 -0
- package/dist/chunk-2OJIVO7R.cjs +32 -0
- package/dist/chunk-2OJIVO7R.cjs.map +1 -0
- package/dist/chunk-2RF4Z7KG.cjs +803 -0
- package/dist/chunk-2RF4Z7KG.cjs.map +1 -0
- package/dist/chunk-3CUFITU7.js +1905 -0
- package/dist/chunk-3CUFITU7.js.map +1 -0
- package/dist/chunk-3RYKIUAE.js +86 -0
- package/dist/chunk-3RYKIUAE.js.map +1 -0
- package/dist/chunk-44I73CQS.cjs +194 -0
- package/dist/chunk-44I73CQS.cjs.map +1 -0
- package/dist/chunk-5AUSSJIM.cjs +3372 -0
- package/dist/chunk-5AUSSJIM.cjs.map +1 -0
- package/dist/chunk-5PC6JBGJ.cjs +1419 -0
- package/dist/chunk-5PC6JBGJ.cjs.map +1 -0
- package/dist/chunk-5RU2HCW2.js +30 -0
- package/dist/chunk-5RU2HCW2.js.map +1 -0
- package/dist/chunk-5THUHJ3E.js +46 -0
- package/dist/chunk-5THUHJ3E.js.map +1 -0
- package/dist/chunk-5U7VLG43.js +141 -0
- package/dist/chunk-5U7VLG43.js.map +1 -0
- package/dist/chunk-6DAWSVX2.cjs +103 -0
- package/dist/chunk-6DAWSVX2.cjs.map +1 -0
- package/dist/chunk-6DKDOWBL.js +1567 -0
- package/dist/chunk-6DKDOWBL.js.map +1 -0
- package/dist/chunk-6IJOPRZP.cjs +197 -0
- package/dist/chunk-6IJOPRZP.cjs.map +1 -0
- package/dist/chunk-7G7G42KS.js +86 -0
- package/dist/chunk-7G7G42KS.js.map +1 -0
- package/dist/chunk-AINCI23X.js +2171 -0
- package/dist/chunk-AINCI23X.js.map +1 -0
- package/dist/chunk-AROWPFO2.js +773 -0
- package/dist/chunk-AROWPFO2.js.map +1 -0
- package/dist/chunk-AVQK77G6.cjs +2000 -0
- package/dist/chunk-AVQK77G6.cjs.map +1 -0
- package/dist/chunk-C57NEO3X.js +3327 -0
- package/dist/chunk-C57NEO3X.js.map +1 -0
- package/dist/chunk-CK3GK34R.js +1381 -0
- package/dist/chunk-CK3GK34R.js.map +1 -0
- package/dist/chunk-E2TGXG6X.cjs +1770 -0
- package/dist/chunk-E2TGXG6X.cjs.map +1 -0
- package/dist/chunk-EK362Q45.cjs +38 -0
- package/dist/chunk-EK362Q45.cjs.map +1 -0
- package/dist/chunk-FBV5DF6D.js +95 -0
- package/dist/chunk-FBV5DF6D.js.map +1 -0
- package/dist/chunk-FG4E7MTG.cjs +4 -0
- package/dist/chunk-FG4E7MTG.cjs.map +1 -0
- package/dist/chunk-G6IIVKMO.js +26 -0
- package/dist/chunk-G6IIVKMO.js.map +1 -0
- package/dist/chunk-HGC5JNVA.cjs +1503 -0
- package/dist/chunk-HGC5JNVA.cjs.map +1 -0
- package/dist/chunk-HSHCCBIV.js +255 -0
- package/dist/chunk-HSHCCBIV.js.map +1 -0
- package/dist/chunk-IEBZHTPE.js +254 -0
- package/dist/chunk-IEBZHTPE.js.map +1 -0
- package/dist/chunk-ISJDAFKS.js +1604 -0
- package/dist/chunk-ISJDAFKS.js.map +1 -0
- package/dist/chunk-J6KHW2E5.cjs +1963 -0
- package/dist/chunk-J6KHW2E5.cjs.map +1 -0
- package/dist/chunk-J7BMO73N.cjs +114 -0
- package/dist/chunk-J7BMO73N.cjs.map +1 -0
- package/dist/chunk-JL4C5VJ7.cjs +488 -0
- package/dist/chunk-JL4C5VJ7.cjs.map +1 -0
- package/dist/chunk-JSGIEF6Z.cjs +1087 -0
- package/dist/chunk-JSGIEF6Z.cjs.map +1 -0
- package/dist/chunk-JSNV5O2F.cjs +34 -0
- package/dist/chunk-JSNV5O2F.cjs.map +1 -0
- package/dist/chunk-JWA5SGCS.js +203 -0
- package/dist/chunk-JWA5SGCS.js.map +1 -0
- package/dist/chunk-JX5YZ4DH.cjs +430 -0
- package/dist/chunk-JX5YZ4DH.cjs.map +1 -0
- package/dist/chunk-KHCBJ7KD.js +42 -0
- package/dist/chunk-KHCBJ7KD.js.map +1 -0
- package/dist/chunk-KU6S7IYV.cjs +210 -0
- package/dist/chunk-KU6S7IYV.cjs.map +1 -0
- package/dist/chunk-LKAIXWK3.js +181 -0
- package/dist/chunk-LKAIXWK3.js.map +1 -0
- package/dist/chunk-LPW3XNC2.js +471 -0
- package/dist/chunk-LPW3XNC2.js.map +1 -0
- package/dist/chunk-M36G6SRP.js +447 -0
- package/dist/chunk-M36G6SRP.js.map +1 -0
- package/dist/chunk-MRXGWL42.cjs +4 -0
- package/dist/chunk-MRXGWL42.cjs.map +1 -0
- package/dist/chunk-NB72XWXQ.cjs +54 -0
- package/dist/chunk-NB72XWXQ.cjs.map +1 -0
- package/dist/chunk-NEJ2PV4C.cjs +211 -0
- package/dist/chunk-NEJ2PV4C.cjs.map +1 -0
- package/dist/chunk-NT6IJH4L.cjs +273 -0
- package/dist/chunk-NT6IJH4L.cjs.map +1 -0
- package/dist/chunk-O5MP52U2.cjs +526 -0
- package/dist/chunk-O5MP52U2.cjs.map +1 -0
- package/dist/chunk-O7PUQLJ3.cjs +818 -0
- package/dist/chunk-O7PUQLJ3.cjs.map +1 -0
- package/dist/chunk-PQHS255G.js +1369 -0
- package/dist/chunk-PQHS255G.js.map +1 -0
- package/dist/chunk-PRYE7AZQ.cjs +1227 -0
- package/dist/chunk-PRYE7AZQ.cjs.map +1 -0
- package/dist/chunk-Q4CDQ2KO.js +21 -0
- package/dist/chunk-Q4CDQ2KO.js.map +1 -0
- package/dist/chunk-QELDJGDK.cjs +1714 -0
- package/dist/chunk-QELDJGDK.cjs.map +1 -0
- package/dist/chunk-QJRP44ZO.js +769 -0
- package/dist/chunk-QJRP44ZO.js.map +1 -0
- package/dist/chunk-QNGNOU4Z.js +29 -0
- package/dist/chunk-QNGNOU4Z.js.map +1 -0
- package/dist/chunk-RJL7RCEM.cjs +159 -0
- package/dist/chunk-RJL7RCEM.cjs.map +1 -0
- package/dist/chunk-RN3RMBJZ.js +1164 -0
- package/dist/chunk-RN3RMBJZ.js.map +1 -0
- package/dist/chunk-S5DMKUWK.cjs +1273 -0
- package/dist/chunk-S5DMKUWK.cjs.map +1 -0
- package/dist/chunk-SES6GDBQ.cjs +624 -0
- package/dist/chunk-SES6GDBQ.cjs.map +1 -0
- package/dist/chunk-TNPDV7I4.cjs +2346 -0
- package/dist/chunk-TNPDV7I4.cjs.map +1 -0
- package/dist/chunk-TZBIY5C3.js +187 -0
- package/dist/chunk-TZBIY5C3.js.map +1 -0
- package/dist/chunk-TZE673G6.js +3 -0
- package/dist/chunk-TZE673G6.js.map +1 -0
- package/dist/chunk-ULXI7A6Q.cjs +1047 -0
- package/dist/chunk-ULXI7A6Q.cjs.map +1 -0
- package/dist/chunk-VIWSWVAW.js +1782 -0
- package/dist/chunk-VIWSWVAW.js.map +1 -0
- package/dist/chunk-VWGNPMJZ.cjs +19 -0
- package/dist/chunk-VWGNPMJZ.cjs.map +1 -0
- package/dist/chunk-WDIBOWAA.js +1054 -0
- package/dist/chunk-WDIBOWAA.js.map +1 -0
- package/dist/chunk-WNG7HRVA.cjs +25 -0
- package/dist/chunk-WNG7HRVA.cjs.map +1 -0
- package/dist/chunk-WNVQ3SMB.cjs +96 -0
- package/dist/chunk-WNVQ3SMB.cjs.map +1 -0
- package/dist/chunk-WRSWH7US.cjs +285 -0
- package/dist/chunk-WRSWH7US.cjs.map +1 -0
- package/dist/chunk-XAMC4S53.js +17 -0
- package/dist/chunk-XAMC4S53.js.map +1 -0
- package/dist/chunk-XNISPHTZ.js +1039 -0
- package/dist/chunk-XNISPHTZ.js.map +1 -0
- package/dist/chunk-Y2PM3FFL.js +3 -0
- package/dist/chunk-Y2PM3FFL.js.map +1 -0
- package/dist/chunk-YBPBK5KI.js +1030 -0
- package/dist/chunk-YBPBK5KI.js.map +1 -0
- package/dist/chunk-YHRG7UOC.js +31 -0
- package/dist/chunk-YHRG7UOC.js.map +1 -0
- package/dist/chunk-YWNYGYI7.cjs +31 -0
- package/dist/chunk-YWNYGYI7.cjs.map +1 -0
- package/dist/chunk-YYV35XOS.js +122 -0
- package/dist/chunk-YYV35XOS.js.map +1 -0
- package/dist/chunk-Z2OL5AJD.cjs +133 -0
- package/dist/chunk-Z2OL5AJD.cjs.map +1 -0
- package/dist/chunk-Z4AZW6FY.js +920 -0
- package/dist/chunk-Z4AZW6FY.js.map +1 -0
- package/dist/chunk-ZDFHA2EC.js +572 -0
- package/dist/chunk-ZDFHA2EC.js.map +1 -0
- package/dist/chunk-ZNZDQAXN.js +175 -0
- package/dist/chunk-ZNZDQAXN.js.map +1 -0
- package/dist/chunk-ZRL2UFTH.cjs +1073 -0
- package/dist/chunk-ZRL2UFTH.cjs.map +1 -0
- package/dist/chunk-ZT77RY6R.js +404 -0
- package/dist/chunk-ZT77RY6R.js.map +1 -0
- package/dist/entries/apps.cjs +155 -0
- package/dist/entries/apps.cjs.map +1 -0
- package/dist/entries/apps.d.cts +283 -0
- package/dist/entries/apps.d.ts +283 -0
- package/dist/entries/apps.js +10 -0
- package/dist/entries/apps.js.map +1 -0
- package/dist/entries/captions.cjs +124 -0
- package/dist/entries/captions.cjs.map +1 -0
- package/dist/entries/captions.d.cts +354 -0
- package/dist/entries/captions.d.ts +354 -0
- package/dist/entries/captions.js +3 -0
- package/dist/entries/captions.js.map +1 -0
- package/dist/entries/catalogs.cjs +165 -0
- package/dist/entries/catalogs.cjs.map +1 -0
- package/dist/entries/catalogs.d.cts +385 -0
- package/dist/entries/catalogs.d.ts +385 -0
- package/dist/entries/catalogs.js +4 -0
- package/dist/entries/catalogs.js.map +1 -0
- package/dist/entries/credits.cjs +592 -0
- package/dist/entries/credits.cjs.map +1 -0
- package/dist/entries/credits.d.cts +1429 -0
- package/dist/entries/credits.d.ts +1429 -0
- package/dist/entries/credits.js +11 -0
- package/dist/entries/credits.js.map +1 -0
- package/dist/entries/edl.cjs +409 -0
- package/dist/entries/edl.cjs.map +1 -0
- package/dist/entries/edl.d.cts +1199 -0
- package/dist/entries/edl.d.ts +1199 -0
- package/dist/entries/edl.js +4 -0
- package/dist/entries/edl.js.map +1 -0
- package/dist/entries/entities.cjs +530 -0
- package/dist/entries/entities.cjs.map +1 -0
- package/dist/entries/entities.d.cts +1371 -0
- package/dist/entries/entities.d.ts +1371 -0
- package/dist/entries/entities.js +5 -0
- package/dist/entries/entities.js.map +1 -0
- package/dist/entries/i18n.cjs +48 -0
- package/dist/entries/i18n.cjs.map +1 -0
- package/dist/entries/i18n.d.cts +69 -0
- package/dist/entries/i18n.d.ts +69 -0
- package/dist/entries/i18n.js +3 -0
- package/dist/entries/i18n.js.map +1 -0
- package/dist/entries/llm-models.cjs +177 -0
- package/dist/entries/llm-models.cjs.map +1 -0
- package/dist/entries/llm-models.d.cts +435 -0
- package/dist/entries/llm-models.d.ts +435 -0
- package/dist/entries/llm-models.js +4 -0
- package/dist/entries/llm-models.js.map +1 -0
- package/dist/entries/media.cjs +335 -0
- package/dist/entries/media.cjs.map +1 -0
- package/dist/entries/media.d.cts +518 -0
- package/dist/entries/media.d.ts +518 -0
- package/dist/entries/media.js +6 -0
- package/dist/entries/media.js.map +1 -0
- package/dist/entries/model-catalog.cjs +247 -0
- package/dist/entries/model-catalog.cjs.map +1 -0
- package/dist/entries/model-catalog.d.cts +202 -0
- package/dist/entries/model-catalog.d.ts +202 -0
- package/dist/entries/model-catalog.js +6 -0
- package/dist/entries/model-catalog.js.map +1 -0
- package/dist/entries/models.cjs +833 -0
- package/dist/entries/models.cjs.map +1 -0
- package/dist/entries/models.d.cts +287 -0
- package/dist/entries/models.d.ts +287 -0
- package/dist/entries/models.js +8 -0
- package/dist/entries/models.js.map +1 -0
- package/dist/entries/nodes.cjs +789 -0
- package/dist/entries/nodes.cjs.map +1 -0
- package/dist/entries/nodes.d.cts +1600 -0
- package/dist/entries/nodes.d.ts +1600 -0
- package/dist/entries/nodes.js +16 -0
- package/dist/entries/nodes.js.map +1 -0
- package/dist/entries/organizations.cjs +80 -0
- package/dist/entries/organizations.cjs.map +1 -0
- package/dist/entries/organizations.d.cts +466 -0
- package/dist/entries/organizations.d.ts +466 -0
- package/dist/entries/organizations.js +3 -0
- package/dist/entries/organizations.js.map +1 -0
- package/dist/entries/pipeline.cjs +594 -0
- package/dist/entries/pipeline.cjs.map +1 -0
- package/dist/entries/pipeline.d.cts +2617 -0
- package/dist/entries/pipeline.d.ts +2617 -0
- package/dist/entries/pipeline.js +5 -0
- package/dist/entries/pipeline.js.map +1 -0
- package/dist/entries/scene3d.cjs +704 -0
- package/dist/entries/scene3d.cjs.map +1 -0
- package/dist/entries/scene3d.d.cts +4284 -0
- package/dist/entries/scene3d.d.ts +4284 -0
- package/dist/entries/scene3d.js +3 -0
- package/dist/entries/scene3d.js.map +1 -0
- package/dist/entries/social.cjs +714 -0
- package/dist/entries/social.cjs.map +1 -0
- package/dist/entries/social.d.cts +1366 -0
- package/dist/entries/social.d.ts +1366 -0
- package/dist/entries/social.js +5 -0
- package/dist/entries/social.js.map +1 -0
- package/dist/entries/types.cjs +13 -0
- package/dist/entries/types.cjs.map +1 -0
- package/dist/entries/types.d.cts +162 -0
- package/dist/entries/types.d.ts +162 -0
- package/dist/entries/types.js +4 -0
- package/dist/entries/types.js.map +1 -0
- package/dist/entries/ugc.cjs +279 -0
- package/dist/entries/ugc.cjs.map +1 -0
- package/dist/entries/ugc.d.cts +575 -0
- package/dist/entries/ugc.d.ts +575 -0
- package/dist/entries/ugc.js +6 -0
- package/dist/entries/ugc.js.map +1 -0
- package/dist/entries/video.cjs +549 -0
- package/dist/entries/video.cjs.map +1 -0
- package/dist/entries/video.d.cts +1791 -0
- package/dist/entries/video.d.ts +1791 -0
- package/dist/entries/video.js +8 -0
- package/dist/entries/video.js.map +1 -0
- package/dist/entries/workflow.cjs +574 -0
- package/dist/entries/workflow.cjs.map +1 -0
- package/dist/entries/workflow.d.cts +1733 -0
- package/dist/entries/workflow.d.ts +1733 -0
- package/dist/entries/workflow.js +5 -0
- package/dist/entries/workflow.js.map +1 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.cts +19 -0
- package/dist/fan-out-meta-Bu6VyXcZ.d.ts +19 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.cts +174 -0
- package/dist/gemini-omni-voices-zeRXxSbZ.d.ts +174 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.cts +208 -0
- package/dist/image-overlay-layers-CyBfRhxJ.d.ts +208 -0
- package/dist/index.cjs +7731 -26444
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -23733
- package/dist/index.d.ts +32 -23733
- package/dist/index.js +40 -24641
- package/dist/index.js.map +1 -1
- package/dist/model-catalog-flJYaa-g.d.cts +561 -0
- package/dist/model-catalog-flJYaa-g.d.ts +561 -0
- package/dist/presentation-types-0ENOCjoj.d.cts +61 -0
- package/dist/presentation-types-0ENOCjoj.d.ts +61 -0
- package/dist/presentation-utils-BIqiCzSA.d.cts +90 -0
- package/dist/presentation-utils-BdiObtwq.d.ts +90 -0
- package/dist/scene-node-types-DjenYFLO.d.cts +1949 -0
- package/dist/scene-node-types-DjenYFLO.d.ts +1949 -0
- package/dist/supported-fonts-CRoF1gOy.d.cts +16 -0
- package/dist/supported-fonts-CRoF1gOy.d.ts +16 -0
- package/dist/types-BRlFPEru.d.cts +511 -0
- package/dist/types-BRlFPEru.d.ts +511 -0
- package/dist/types-DffyGSy5.d.cts +67 -0
- package/dist/types-DffyGSy5.d.ts +67 -0
- package/package.json +102 -1
- package/src/__tests__/add-captions-plan.test.ts +6 -2
- package/src/__tests__/caption-edge-dash.test.ts +23 -0
- package/src/__tests__/entity-image-handle.test.ts +61 -1
- package/src/__tests__/fixtures/root-exports.baseline.json +4625 -0
- package/src/__tests__/input-field-extra-keys.test.ts +1 -0
- package/src/__tests__/json-kinds.test.ts +10 -0
- package/src/__tests__/model-seed-capability.test.ts +34 -0
- package/src/__tests__/no-internal-imports.test.ts +1 -1
- package/src/__tests__/node-aspect-ratio.test.ts +25 -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 +70 -0
- package/src/__tests__/package-entries.test.ts +50 -0
- package/src/__tests__/pitch-tempo-pricing.test.ts +21 -0
- package/src/__tests__/presentation-utils.test.ts +14 -0
- package/src/__tests__/preview-gate-use-case.test.ts +151 -0
- package/src/__tests__/producer-types.test.ts +15 -0
- package/src/__tests__/run-continuation.test.ts +7 -1
- package/src/__tests__/seedance-draft.test.ts +74 -0
- package/src/__tests__/site-capture-node.test.ts +58 -0
- package/src/__tests__/ugc-clip-saved-list.test.ts +19 -0
- package/src/__tests__/ugc-lane-wires.test.ts +228 -0
- package/src/__tests__/ugc-node-wires.test.ts +606 -0
- package/src/__tests__/ugc-run-state.test.ts +85 -7
- package/src/__tests__/video-analysis-catalog-sync.test.ts +1 -1
- package/src/__tests__/video-analysis-pricing.test.ts +6 -6
- package/src/__tests__/voice-changer-pro-quote.test.ts +79 -0
- package/src/__tests__/workflow-export-strip.test.ts +14 -0
- package/src/add-captions-plan.ts +9 -3
- package/src/caption-edge-dash.ts +33 -0
- package/src/credit-estimators/index.ts +22 -1
- package/src/credit-estimators/pitch-tempo.ts +15 -1
- package/src/credit-estimators/speech.ts +72 -4
- package/src/credit-estimators/unit-quote.ts +52 -0
- package/src/credit-estimators/video-sfx.ts +15 -0
- package/src/credit-estimators/voice-changer-pro-quote.ts +138 -0
- package/src/entity-image-handle.ts +50 -1
- package/src/entries/apps.ts +63 -0
- package/src/entries/captions.ts +34 -0
- package/src/entries/catalogs.ts +65 -0
- package/src/entries/credits.ts +104 -0
- package/src/entries/edl.ts +42 -0
- package/src/entries/entities.ts +144 -0
- package/src/entries/i18n.ts +31 -0
- package/src/entries/llm-models.ts +63 -0
- package/src/entries/media.ts +36 -0
- package/src/entries/model-catalog.ts +89 -0
- package/src/entries/models.ts +266 -0
- package/src/entries/nodes.ts +245 -0
- package/src/entries/organizations.ts +9 -0
- package/src/entries/pipeline.ts +43 -0
- package/src/entries/scene3d.ts +27 -0
- package/src/entries/social.ts +297 -0
- package/src/entries/types.ts +26 -0
- package/src/entries/ugc.ts +14 -0
- package/src/entries/video.ts +59 -0
- package/src/entries/workflow.ts +172 -0
- package/src/fan-out-rows.ts +2 -0
- package/src/index.ts +25 -1838
- package/src/json-kinds.ts +13 -0
- package/src/model-catalog.ts +97 -36
- package/src/model-constants.ts +3 -0
- package/src/node-mappable-fields.ts +1 -0
- package/src/node-preset-export.ts +2 -2
- package/src/node-preset-extract.ts +6 -4
- package/src/node-run-routes.ts +78 -0
- package/src/node-runtime-keys.ts +50 -1
- package/src/normalize-node-params.ts +30 -0
- package/src/presentation-utils.ts +8 -0
- package/src/preview-gate.ts +92 -14
- package/src/producer-types.ts +26 -2
- package/src/run-continuation.ts +21 -0
- package/src/seedance-draft.ts +64 -0
- package/src/site-capture-node.ts +82 -0
- package/src/social-post.ts +13 -0
- package/src/ugc-lane-wires.ts +246 -0
- package/src/ugc-node-wires.ts +653 -0
- package/src/ugc-run-state.ts +65 -8
- package/src/video-analysis-pricing.ts +31 -29
- package/src/workflow-export.ts +3 -1
|
@@ -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,58 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest"
|
|
2
|
+
import { siteCaptureMaxStills, siteCaptureNodeOutputs, siteCapturePageUrl, siteCaptureStillUrls, siteCaptureStills } from "../site-capture-node.js"
|
|
3
|
+
|
|
4
|
+
const CAPTURE = {
|
|
5
|
+
pageUrl: "https://example.com/",
|
|
6
|
+
title: "Example",
|
|
7
|
+
fullPage: { url: "https://cdn.example/full.jpg", width: 412, height: 6000, truncated: false },
|
|
8
|
+
stills: [
|
|
9
|
+
{ index: 1, sectionOrder: 3, label: "Pricing", category: "pricing", url: "https://cdn.example/1.png" },
|
|
10
|
+
{ index: 0, sectionOrder: 0, label: "Hero", category: "hero", url: "https://cdn.example/0.png" },
|
|
11
|
+
{ index: 2, sectionOrder: 5, label: "Broken", category: "other", url: "" },
|
|
12
|
+
],
|
|
13
|
+
facts: ["$12 per month"],
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
describe("siteCapturePageUrl — the page a run captures", () => {
|
|
17
|
+
it("is the address typed on the node", () => expect(siteCapturePageUrl(" example.com/pricing ", "https://other.com")).toBe("example.com/pricing"))
|
|
18
|
+
it("else the first web address in the wired text, without trailing punctuation", () =>
|
|
19
|
+
expect(siteCapturePageUrl("", "Look at https://acme.io/pricing, then https://b.io.")).toBe("https://acme.io/pricing"))
|
|
20
|
+
it("else the wired text's first word (the route normalises or refuses it)", () => expect(siteCapturePageUrl(undefined, "acme.io is the site")).toBe("acme.io"))
|
|
21
|
+
it("else nothing", () => {
|
|
22
|
+
expect(siteCapturePageUrl("", " ")).toBe("")
|
|
23
|
+
expect(siteCapturePageUrl(undefined, undefined)).toBe("")
|
|
24
|
+
})
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
describe("siteCaptureMaxStills — the route's bounds", () => {
|
|
28
|
+
it.each([
|
|
29
|
+
[undefined, 8],
|
|
30
|
+
["5", 8],
|
|
31
|
+
[Number.NaN, 8],
|
|
32
|
+
[1, 3],
|
|
33
|
+
[5.4, 5],
|
|
34
|
+
[12, 8],
|
|
35
|
+
])("%j → %i", (value, stills) => expect(siteCaptureMaxStills(value)).toBe(stills))
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
describe("the capture's outputs", () => {
|
|
39
|
+
it("lists the stills in page order and drops one with no address; the full page is never one of them", () => {
|
|
40
|
+
expect(siteCaptureStills(CAPTURE).map((s) => s.label)).toEqual(["Hero", "Pricing"])
|
|
41
|
+
expect(siteCaptureStillUrls(CAPTURE)).toEqual(["https://cdn.example/0.png", "https://cdn.example/1.png"])
|
|
42
|
+
})
|
|
43
|
+
|
|
44
|
+
it("hands on the capture as json, its first still as the image and every still as the list", () => {
|
|
45
|
+
expect(siteCaptureNodeOutputs(CAPTURE)).toEqual({
|
|
46
|
+
json: CAPTURE,
|
|
47
|
+
imageUrl: "https://cdn.example/0.png",
|
|
48
|
+
listResults: ["https://cdn.example/0.png", "https://cdn.example/1.png"],
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
it("a capture with no still hands on its json only; anything that is not a capture hands on nothing", () => {
|
|
53
|
+
expect(siteCaptureNodeOutputs({ ...CAPTURE, stills: [] })).toEqual({ json: { ...CAPTURE, stills: [] } })
|
|
54
|
+
expect(siteCaptureNodeOutputs(null)).toEqual({})
|
|
55
|
+
expect(siteCaptureNodeOutputs([CAPTURE])).toEqual({})
|
|
56
|
+
expect(siteCaptureStills("nope")).toEqual([])
|
|
57
|
+
})
|
|
58
|
+
})
|
|
@@ -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
|
+
})
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The UGC wires of a video whose clips are cut from one recorded speech: UGC Clips' prelude, the
|
|
3
|
+
* script's language, the Script (sized) output that carries the finish call, and UGC Finish. The
|
|
4
|
+
* URLs and texts are placeholders; nothing here reads what a call says.
|
|
5
|
+
*/
|
|
6
|
+
import { describe, expect, it } from "vitest"
|
|
7
|
+
import {
|
|
8
|
+
FAN_IN_TARGETS,
|
|
9
|
+
UGC_FINISH_CLIPS_TYPE,
|
|
10
|
+
UGC_NODE_MESSAGES,
|
|
11
|
+
UGC_NODE_TYPES,
|
|
12
|
+
UGC_OVERRIDABLE_FIELDS,
|
|
13
|
+
UGC_PRELUDE_ROUTES,
|
|
14
|
+
UGC_PRIMARY_HANDLE,
|
|
15
|
+
VIDEO_PRODUCER_TYPES,
|
|
16
|
+
defaultEdgeOutputMode,
|
|
17
|
+
getInputFieldExtraKeys,
|
|
18
|
+
isFanInEdge,
|
|
19
|
+
isFanInNodeType,
|
|
20
|
+
ugcClipsOutputs,
|
|
21
|
+
ugcClipsPhase,
|
|
22
|
+
ugcClipsPhase2Body,
|
|
23
|
+
ugcFinishOutputs,
|
|
24
|
+
ugcFinishPlan,
|
|
25
|
+
ugcFinishWired,
|
|
26
|
+
ugcLaneNeedsFinish,
|
|
27
|
+
ugcPrelude,
|
|
28
|
+
ugcPreludeOutput,
|
|
29
|
+
ugcRenderHoldBody,
|
|
30
|
+
ugcRenderHoldVerdict,
|
|
31
|
+
ugcRunEstimateInput,
|
|
32
|
+
ugcScriptBody,
|
|
33
|
+
} from "../index.js"
|
|
34
|
+
|
|
35
|
+
const PHASE1 = {
|
|
36
|
+
errors: [],
|
|
37
|
+
lane: "segmented-reference",
|
|
38
|
+
phase: 1,
|
|
39
|
+
speech: { tool: "generate_speech", args: { text: "one two three", model: "speech-model", language_code: "xx", voice_id: "voice-1", voice_type: "library" } },
|
|
40
|
+
align: { tool: "forced_alignment", args: { transcript: "one two three" } },
|
|
41
|
+
split: { tool: "ugc_split_speech", args: { plan: { v: 1, hook: "one" } } },
|
|
42
|
+
}
|
|
43
|
+
const SEGMENTS = [{ index: 1, text: "one two" }, { index: 2, text: "three" }]
|
|
44
|
+
const PHASE2 = {
|
|
45
|
+
errors: [],
|
|
46
|
+
phase: 2,
|
|
47
|
+
tickets: [{ v: 1, index: 0, durationSec: 7 }, { v: 1, index: 1, durationSec: 7 }],
|
|
48
|
+
sizedPlan: { hook: "one", clipBreaks: [], clipDurations: [14] },
|
|
49
|
+
transcript: "one two three",
|
|
50
|
+
hasCards: false,
|
|
51
|
+
speechCheckCall: { tool: "transcribe", args: { language: "xx" } },
|
|
52
|
+
finish: { tool: "ugc_finish_clips", args: { segments: SEGMENTS } },
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe("the script's language", () => {
|
|
56
|
+
it("the node's choice goes to the script route; none, or one this app does not know, is English", () => {
|
|
57
|
+
const body = (language: unknown) => (ugcScriptBody({ site: "Acme", screenshots: [], language }) as { body: Record<string, unknown> }).body.language
|
|
58
|
+
expect(body("he")).toBe("he")
|
|
59
|
+
expect(body("en")).toBe("en")
|
|
60
|
+
expect(body(undefined)).toBe("en")
|
|
61
|
+
expect(body("fr")).toBe("en")
|
|
62
|
+
})
|
|
63
|
+
it("is an overridable field and an extra app-input key, together", () => {
|
|
64
|
+
expect(UGC_OVERRIDABLE_FIELDS["ugc-script"]).toContain("language")
|
|
65
|
+
expect(getInputFieldExtraKeys("ugc-script")).toEqual([{ key: "language", type: "select" }])
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
describe("UGC Clips' prelude", () => {
|
|
70
|
+
it("reads an answer's phase: 1 runs the prelude, 2 the clips, none is one call", () => {
|
|
71
|
+
expect(ugcClipsPhase(PHASE1)).toBe(1)
|
|
72
|
+
expect(ugcClipsPhase(PHASE2)).toBe(2)
|
|
73
|
+
expect(ugcClipsPhase({ tickets: [] })).toBeNull()
|
|
74
|
+
})
|
|
75
|
+
it("maps the three calls to the routes their MCP tools dispatch to, argument by argument", () => {
|
|
76
|
+
const p = ugcPrelude(PHASE1)
|
|
77
|
+
if ("error" in p) throw new Error(p.error)
|
|
78
|
+
expect(p.speech).toEqual({ text: "one two three", voice: "voice-1", voiceType: "library", provider: "speech-model", languageCode: "xx" })
|
|
79
|
+
expect(p.alignment("https://cdn.example/s.mp3")).toEqual({ transcript: "one two three", audioUrl: "https://cdn.example/s.mp3" })
|
|
80
|
+
expect(p.split("https://cdn.example/s.mp3", [{ word: "one", start: 0, end: 1 }])).toEqual({
|
|
81
|
+
plan: { v: 1, hook: "one" }, audioUrl: "https://cdn.example/s.mp3", alignment: [{ word: "one", start: 0, end: 1 }],
|
|
82
|
+
})
|
|
83
|
+
expect(UGC_PRELUDE_ROUTES).toEqual({
|
|
84
|
+
speech: { path: "/v1/text-to-speech", jobType: "text-to-speech" },
|
|
85
|
+
alignment: { path: "/v1/forced-alignment", jobType: "forced-alignment" },
|
|
86
|
+
split: { path: "/v1/ugc/segments", jobType: "ugc-segments" },
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
it("an answer missing a call, or naming another tool, is the newer-app sentence", () => {
|
|
90
|
+
expect(ugcPrelude({ ...PHASE1, align: undefined })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
|
|
91
|
+
expect(ugcPrelude({ ...PHASE1, speech: { tool: "generate_dialogue", args: { text: "x" } } })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
|
|
92
|
+
expect(ugcPrelude({ ...PHASE1, split: { tool: "ugc_split_speech", args: {} } })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
|
|
93
|
+
})
|
|
94
|
+
it("reads each step's job output: the speech's audio, the word timings, the segments", () => {
|
|
95
|
+
expect(ugcPreludeOutput("speech", { audioUrl: "https://cdn.example/s.mp3" })).toEqual({ value: "https://cdn.example/s.mp3" })
|
|
96
|
+
expect(ugcPreludeOutput("alignment", { alignment: [{ word: "a" }] })).toEqual({ value: [{ word: "a" }] })
|
|
97
|
+
expect(ugcPreludeOutput("split", { segments: SEGMENTS })).toEqual({ value: SEGMENTS })
|
|
98
|
+
for (const [step, out] of [["speech", {}], ["alignment", { alignment: [] }], ["split", undefined]] as const) {
|
|
99
|
+
expect(ugcPreludeOutput(step, out as never)).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
it("the second call is the first call's body with the segments", () => {
|
|
103
|
+
expect(ugcClipsPhase2Body({ plan: { v: 1 }, surface: "canvas", userId: "u" }, SEGMENTS)).toEqual({ plan: { v: 1 }, surface: "canvas", userId: "u", segments: SEGMENTS })
|
|
104
|
+
})
|
|
105
|
+
it("the phase-2 answer's Script (sized) output carries the finish call's arguments; an answer without one is unchanged", () => {
|
|
106
|
+
const read = ugcClipsOutputs(PHASE2)
|
|
107
|
+
if ("error" in read) throw new Error(read.error)
|
|
108
|
+
expect(JSON.parse(read.outputs["plan-out"]!)).toEqual({ v: 1, plan: PHASE2.sizedPlan, transcribeArgs: { language: "xx" }, finish: { segments: SEGMENTS } })
|
|
109
|
+
const { finish: _f, phase: _p, ...english } = PHASE2
|
|
110
|
+
const en = ugcClipsOutputs(english)
|
|
111
|
+
if ("error" in en) throw new Error(en.error)
|
|
112
|
+
expect(JSON.parse(en.outputs["plan-out"]!)).toEqual({ v: 1, plan: PHASE2.sizedPlan, transcribeArgs: { language: "xx" } })
|
|
113
|
+
})
|
|
114
|
+
it("says the clips go through UGC Finish's job exactly when its plan-out carries the finish call (the quote prices it then)", () => {
|
|
115
|
+
const read = ugcClipsOutputs(PHASE2)
|
|
116
|
+
if ("error" in read) throw new Error(read.error)
|
|
117
|
+
expect(read.finishes).toBe(true)
|
|
118
|
+
expect("finish" in JSON.parse(read.outputs["plan-out"]!)).toBe(true)
|
|
119
|
+
const { finish: _f, phase: _p, ...english } = PHASE2
|
|
120
|
+
const en = ugcClipsOutputs(english)
|
|
121
|
+
if ("error" in en) throw new Error(en.error)
|
|
122
|
+
expect(en.finishes).toBe(false)
|
|
123
|
+
// A finish with no arguments is not carried, so it is not priced either.
|
|
124
|
+
const bare = ugcClipsOutputs({ ...PHASE2, finish: { tool: "ugc_finish_clips" } })
|
|
125
|
+
if ("error" in bare) throw new Error(bare.error)
|
|
126
|
+
expect([bare.finishes, "finish" in JSON.parse(bare.outputs["plan-out"]!)]).toEqual([false, false])
|
|
127
|
+
})
|
|
128
|
+
it("is refused before anything is spent when no UGC Finish reads this UGC Clips' Script (sized) output", () => {
|
|
129
|
+
const nodes = [{ id: "clips", type: "ugc-clips" }, { id: "fin", type: UGC_FINISH_CLIPS_TYPE }, { id: "join", type: "combine-videos" }]
|
|
130
|
+
const wired = [{ source: "clips", target: "fin", sourceHandle: "plan-out", targetHandle: "plan" }]
|
|
131
|
+
expect(ugcFinishWired(wired, nodes, "clips")).toBe(true)
|
|
132
|
+
expect(ugcLaneNeedsFinish(wired, nodes, "clips")).toBeNull()
|
|
133
|
+
// Another UGC Clips' finish, another output, or no UGC Finish at all: refused.
|
|
134
|
+
expect(ugcLaneNeedsFinish(wired, nodes, "other")).toBe(UGC_NODE_MESSAGES.needsFinish)
|
|
135
|
+
expect(ugcLaneNeedsFinish([{ ...wired[0]!, sourceHandle: "transcript" }], nodes, "clips")).toBe(UGC_NODE_MESSAGES.needsFinish)
|
|
136
|
+
expect(ugcLaneNeedsFinish([{ ...wired[0]!, target: "join" }], nodes, "clips")).toBe(UGC_NODE_MESSAGES.needsFinish)
|
|
137
|
+
})
|
|
138
|
+
})
|
|
139
|
+
|
|
140
|
+
describe("UGC Finish", () => {
|
|
141
|
+
const PLAN_OUT_EN = JSON.stringify({ v: 1, plan: { hook: "h" }, transcribeArgs: {} })
|
|
142
|
+
const PLAN_OUT_LANE = JSON.stringify({ v: 1, plan: { hook: "h" }, transcribeArgs: {}, finish: { segments: SEGMENTS } })
|
|
143
|
+
const CLIPS = ["https://cdn.example/1.mp4", "https://cdn.example/2.mp4"]
|
|
144
|
+
|
|
145
|
+
it("is a registered UGC node, a video producer, and folds its clips into one run (never fanned out)", () => {
|
|
146
|
+
expect(UGC_NODE_TYPES.has(UGC_FINISH_CLIPS_TYPE)).toBe(true)
|
|
147
|
+
expect(VIDEO_PRODUCER_TYPES.has(UGC_FINISH_CLIPS_TYPE)).toBe(true)
|
|
148
|
+
expect(FAN_IN_TARGETS[UGC_FINISH_CLIPS_TYPE]).toEqual(["clips"])
|
|
149
|
+
expect(isFanInNodeType(UGC_FINISH_CLIPS_TYPE)).toBe(true)
|
|
150
|
+
expect(isFanInEdge(UGC_FINISH_CLIPS_TYPE, "clips")).toBe(true)
|
|
151
|
+
expect(isFanInEdge(UGC_FINISH_CLIPS_TYPE, "plan")).toBe(false)
|
|
152
|
+
expect(UGC_PRIMARY_HANDLE[UGC_FINISH_CLIPS_TYPE]).toBe("video-out")
|
|
153
|
+
// Its output is one value per edge by default; a Bundle edge hands on the whole list.
|
|
154
|
+
expect(defaultEdgeOutputMode(UGC_FINISH_CLIPS_TYPE, "video-out")).toBe("last")
|
|
155
|
+
})
|
|
156
|
+
it("English (no finish call on the plan): the clips pass through as they came — no call, no job", () => {
|
|
157
|
+
expect(ugcFinishPlan({ planOutWire: PLAN_OUT_EN, clipUrls: CLIPS })).toEqual({ kind: "pass", clips: CLIPS })
|
|
158
|
+
})
|
|
159
|
+
it("the segmented lane: the finish job's body — the segments as they came, one roll per clip, in order", () => {
|
|
160
|
+
expect(ugcFinishPlan({ planOutWire: PLAN_OUT_LANE, clipUrls: CLIPS })).toEqual({
|
|
161
|
+
kind: "job", path: "/v1/ugc/finish",
|
|
162
|
+
body: { segments: SEGMENTS, clips: [{ clip: 1, rolls: [CLIPS[0]] }, { clip: 2, rolls: [CLIPS[1]] }] },
|
|
163
|
+
})
|
|
164
|
+
})
|
|
165
|
+
it("refuses before any call: no clips, no plan, or a clip count that is not the segment count", () => {
|
|
166
|
+
expect(ugcFinishPlan({ planOutWire: PLAN_OUT_LANE, clipUrls: [] })).toEqual({ error: UGC_NODE_MESSAGES.finishNeedsClips })
|
|
167
|
+
expect(ugcFinishPlan({ planOutWire: undefined, clipUrls: CLIPS })).toEqual({ error: UGC_NODE_MESSAGES.needsPlanOut })
|
|
168
|
+
expect(ugcFinishPlan({ planOutWire: PLAN_OUT_LANE, clipUrls: CLIPS.slice(0, 1) })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
|
|
169
|
+
})
|
|
170
|
+
it("a finished job → the clips in clip order with their real length; a dry finish's warning rides every clip", () => {
|
|
171
|
+
const out = ugcFinishOutputs({
|
|
172
|
+
ready: true,
|
|
173
|
+
clips: [{ clip: 2, url: "https://cdn.example/f2.mp4", sec: 5.2 }, { clip: 1, url: "https://cdn.example/f1.mp4", sec: 6.1 }],
|
|
174
|
+
warnings: [{ code: "ACOUSTICS_SKIPPED", cause: null, reason: "r" }],
|
|
175
|
+
})
|
|
176
|
+
expect(out).toEqual({
|
|
177
|
+
clips: [
|
|
178
|
+
{ url: "https://cdn.example/f1.mp4", meta: { warnings: ["ACOUSTICS_SKIPPED"], durationSec: 6.1 } },
|
|
179
|
+
{ url: "https://cdn.example/f2.mp4", meta: { warnings: ["ACOUSTICS_SKIPPED"], durationSec: 5.2 } },
|
|
180
|
+
],
|
|
181
|
+
})
|
|
182
|
+
})
|
|
183
|
+
it("ready: false fails with its sentence; a clip list with a gap is never handed on", () => {
|
|
184
|
+
expect(ugcFinishOutputs({ ready: false, reroll: [2], failed: [] })).toEqual({ error: UGC_NODE_MESSAGES.finishNotReady })
|
|
185
|
+
expect(ugcFinishOutputs({ ready: true, clips: [{ clip: 1, url: "u1" }, { clip: 3, url: "u3" }] })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
|
|
186
|
+
expect(ugcFinishOutputs(undefined)).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
|
|
187
|
+
})
|
|
188
|
+
})
|
|
189
|
+
|
|
190
|
+
describe("the hold check once the speech is split", () => {
|
|
191
|
+
const T = { v: 1, index: 0, durationSec: 7, video: { tool: "generate_video", args: {} } }
|
|
192
|
+
const PLAN = { v: 1, hook: "h", language: "he", targetDurationSec: 20, beats: [{ screenshot: { slot: 1 } }, { screenshot: { slot: 2 } }, { screenshot: "x" }, "not a beat"] }
|
|
193
|
+
const INPUT = { targetDurationSec: 20, screenshotCount: 2, source: "sampled", language: "he" } as const
|
|
194
|
+
|
|
195
|
+
it("reads the video's estimate input from the plan UGC Clips was sent (or its wire): length, screenshot cards, language", () => {
|
|
196
|
+
expect(ugcRunEstimateInput(PLAN)).toEqual({ runEstimate: INPUT })
|
|
197
|
+
expect(ugcRunEstimateInput(JSON.stringify(PLAN))).toEqual({ runEstimate: INPUT })
|
|
198
|
+
// A plan with no beats has no cards to count.
|
|
199
|
+
const { beats: _b, ...noBeats } = PLAN
|
|
200
|
+
expect(ugcRunEstimateInput(noBeats)).toEqual({ runEstimate: { ...INPUT, screenshotCount: 0 } })
|
|
201
|
+
})
|
|
202
|
+
it("never guesses: a plan with no length, an English or unknown language, or no plan → the newer-app sentence", () => {
|
|
203
|
+
const { targetDurationSec: _t, ...noLength } = PLAN
|
|
204
|
+
for (const plan of [noLength, { ...PLAN, targetDurationSec: 2 }, { ...PLAN, language: "en" }, { ...PLAN, language: "xx" }, { ...PLAN, language: undefined }, undefined, "not json"]) {
|
|
205
|
+
expect(ugcRunEstimateInput(plan), JSON.stringify(plan)).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
|
|
206
|
+
}
|
|
207
|
+
})
|
|
208
|
+
it("asks the quote for the clips handed on, with that input", () => {
|
|
209
|
+
expect(ugcRenderHoldBody({ runEstimate: INPUT, tickets: [T], hasCards: true, finishes: true })).toEqual({
|
|
210
|
+
path: "/v1/ugc/quote",
|
|
211
|
+
body: { tickets: [T], hasCards: true, finishes: true, runEstimate: INPUT },
|
|
212
|
+
})
|
|
213
|
+
// No finish call → no `finishes` key.
|
|
214
|
+
expect(ugcRenderHoldBody({ runEstimate: INPUT, tickets: [T], hasCards: false, finishes: false })).toEqual({
|
|
215
|
+
path: "/v1/ugc/quote",
|
|
216
|
+
body: { tickets: [T], hasCards: false, runEstimate: INPUT },
|
|
217
|
+
})
|
|
218
|
+
for (const tickets of [[], undefined, "x"]) expect(ugcRenderHoldBody({ runEstimate: INPUT, tickets, hasCards: false, finishes: true })).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
|
|
219
|
+
})
|
|
220
|
+
it("goes on at or under what the run was checked for; over it, the over-hold sentence; without both figures, the newer-app sentence", () => {
|
|
221
|
+
expect(ugcRenderHoldVerdict({ ceiling: 2400, runHold: 2400 })).toEqual({ ok: true })
|
|
222
|
+
expect(ugcRenderHoldVerdict({ ceiling: 0, runHold: 1 })).toEqual({ ok: true })
|
|
223
|
+
expect(ugcRenderHoldVerdict({ ceiling: 2401, runHold: 2400 })).toEqual({ error: UGC_NODE_MESSAGES.overHold })
|
|
224
|
+
for (const answer of [undefined, null, [], {}, { ceiling: 1 }, { runHold: 1 }, { ceiling: "1", runHold: 2 }, { ceiling: 1, runHold: Number.NaN }, { ceiling: -1, runHold: 2 }]) {
|
|
225
|
+
expect(ugcRenderHoldVerdict(answer), JSON.stringify(answer)).toEqual({ error: UGC_NODE_MESSAGES.newerApp })
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
})
|