@nodaro/shared 3.31.0 → 3.33.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-23FJQTEA.js +1604 -0
- package/dist/chunk-23FJQTEA.js.map +1 -0
- package/dist/chunk-2NIQO2J3.cjs +54 -0
- package/dist/chunk-2NIQO2J3.cjs.map +1 -0
- package/dist/chunk-2NQLSLSN.cjs +19 -0
- package/dist/chunk-2NQLSLSN.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-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-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-5RYLK3MQ.js +267 -0
- package/dist/chunk-5RYLK3MQ.js.map +1 -0
- package/dist/chunk-5THUHJ3E.js +46 -0
- package/dist/chunk-5THUHJ3E.js.map +1 -0
- package/dist/chunk-6DAWSVX2.cjs +103 -0
- package/dist/chunk-6DAWSVX2.cjs.map +1 -0
- package/dist/chunk-6WZ2VN7V.js +920 -0
- package/dist/chunk-6WZ2VN7V.js.map +1 -0
- package/dist/chunk-7G7G42KS.js +86 -0
- package/dist/chunk-7G7G42KS.js.map +1 -0
- package/dist/chunk-7Z5LUTGU.js +1567 -0
- package/dist/chunk-7Z5LUTGU.js.map +1 -0
- package/dist/chunk-AINCI23X.js +2171 -0
- package/dist/chunk-AINCI23X.js.map +1 -0
- package/dist/chunk-BG5D5CZ6.js +1922 -0
- package/dist/chunk-BG5D5CZ6.js.map +1 -0
- package/dist/chunk-CK3GK34R.js +1381 -0
- package/dist/chunk-CK3GK34R.js.map +1 -0
- package/dist/chunk-CUH22J4D.js +17 -0
- package/dist/chunk-CUH22J4D.js.map +1 -0
- package/dist/chunk-D26ENTN2.cjs +1770 -0
- package/dist/chunk-D26ENTN2.cjs.map +1 -0
- package/dist/chunk-D6GNRSCV.cjs +2017 -0
- package/dist/chunk-D6GNRSCV.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-FT5CF6IA.js +42 -0
- package/dist/chunk-FT5CF6IA.js.map +1 -0
- package/dist/chunk-G6IIVKMO.js +26 -0
- package/dist/chunk-G6IIVKMO.js.map +1 -0
- package/dist/chunk-HC7VKIV5.cjs +430 -0
- package/dist/chunk-HC7VKIV5.cjs.map +1 -0
- package/dist/chunk-HGC5JNVA.cjs +1503 -0
- package/dist/chunk-HGC5JNVA.cjs.map +1 -0
- package/dist/chunk-HKFMXNVQ.cjs +1273 -0
- package/dist/chunk-HKFMXNVQ.cjs.map +1 -0
- package/dist/chunk-HRXEZ3SX.cjs +526 -0
- package/dist/chunk-HRXEZ3SX.cjs.map +1 -0
- package/dist/chunk-HSHCCBIV.js +255 -0
- package/dist/chunk-HSHCCBIV.js.map +1 -0
- package/dist/chunk-HUR6ZJ7S.cjs +159 -0
- package/dist/chunk-HUR6ZJ7S.cjs.map +1 -0
- package/dist/chunk-J7BMO73N.cjs +114 -0
- package/dist/chunk-J7BMO73N.cjs.map +1 -0
- package/dist/chunk-JFS3NWZ5.cjs +1714 -0
- package/dist/chunk-JFS3NWZ5.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-JWA5SGCS.js +203 -0
- package/dist/chunk-JWA5SGCS.js.map +1 -0
- package/dist/chunk-K3LLGRK7.cjs +3545 -0
- package/dist/chunk-K3LLGRK7.cjs.map +1 -0
- package/dist/chunk-KU6S7IYV.cjs +210 -0
- package/dist/chunk-KU6S7IYV.cjs.map +1 -0
- package/dist/chunk-M36G6SRP.js +447 -0
- package/dist/chunk-M36G6SRP.js.map +1 -0
- package/dist/chunk-M7GQBRZU.cjs +1963 -0
- package/dist/chunk-M7GQBRZU.cjs.map +1 -0
- package/dist/chunk-MRXGWL42.cjs +4 -0
- package/dist/chunk-MRXGWL42.cjs.map +1 -0
- package/dist/chunk-NEJ2PV4C.cjs +211 -0
- package/dist/chunk-NEJ2PV4C.cjs.map +1 -0
- package/dist/chunk-OTATNBMD.js +141 -0
- package/dist/chunk-OTATNBMD.js.map +1 -0
- package/dist/chunk-OZSACQ2V.js +471 -0
- package/dist/chunk-OZSACQ2V.js.map +1 -0
- package/dist/chunk-PHZ23DP3.js +1782 -0
- package/dist/chunk-PHZ23DP3.js.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-PVJBAPYJ.js +404 -0
- package/dist/chunk-PVJBAPYJ.js.map +1 -0
- package/dist/chunk-PXFQVLBX.js +776 -0
- package/dist/chunk-PXFQVLBX.js.map +1 -0
- package/dist/chunk-QA3MVQ32.js +21 -0
- package/dist/chunk-QA3MVQ32.js.map +1 -0
- package/dist/chunk-QJRP44ZO.js +769 -0
- package/dist/chunk-QJRP44ZO.js.map +1 -0
- package/dist/chunk-SAW5OK36.cjs +54 -0
- package/dist/chunk-SAW5OK36.cjs.map +1 -0
- package/dist/chunk-SES6GDBQ.cjs +624 -0
- package/dist/chunk-SES6GDBQ.cjs.map +1 -0
- package/dist/chunk-SFW3UB2P.js +31 -0
- package/dist/chunk-SFW3UB2P.js.map +1 -0
- package/dist/chunk-TNPDV7I4.cjs +2346 -0
- package/dist/chunk-TNPDV7I4.cjs.map +1 -0
- package/dist/chunk-TU33KYKW.cjs +25 -0
- package/dist/chunk-TU33KYKW.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-UCFWI6D4.js +29 -0
- package/dist/chunk-UCFWI6D4.js.map +1 -0
- package/dist/chunk-UTQSSKSG.js +1164 -0
- package/dist/chunk-UTQSSKSG.js.map +1 -0
- package/dist/chunk-VA42637J.cjs +287 -0
- package/dist/chunk-VA42637J.cjs.map +1 -0
- package/dist/chunk-VNQRI2RO.cjs +1047 -0
- package/dist/chunk-VNQRI2RO.cjs.map +1 -0
- package/dist/chunk-VXPLKQWY.cjs +821 -0
- package/dist/chunk-VXPLKQWY.cjs.map +1 -0
- package/dist/chunk-WD6HJRBG.cjs +197 -0
- package/dist/chunk-WD6HJRBG.cjs.map +1 -0
- package/dist/chunk-WDIBOWAA.js +1054 -0
- package/dist/chunk-WDIBOWAA.js.map +1 -0
- package/dist/chunk-WKOIGLQX.cjs +38 -0
- package/dist/chunk-WKOIGLQX.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-XGFTL5XY.js +181 -0
- package/dist/chunk-XGFTL5XY.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-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-ZDFHA2EC.js +572 -0
- package/dist/chunk-ZDFHA2EC.js.map +1 -0
- package/dist/chunk-ZL7UM6PU.cjs +34 -0
- package/dist/chunk-ZL7UM6PU.cjs.map +1 -0
- package/dist/chunk-ZNZDQAXN.js +175 -0
- package/dist/chunk-ZNZDQAXN.js.map +1 -0
- package/dist/chunk-ZO5PBBFX.js +3497 -0
- package/dist/chunk-ZO5PBBFX.js.map +1 -0
- package/dist/chunk-ZRL2UFTH.cjs +1073 -0
- package/dist/chunk-ZRL2UFTH.cjs.map +1 -0
- package/dist/entries/apps.cjs +155 -0
- package/dist/entries/apps.cjs.map +1 -0
- package/dist/entries/apps.d.cts +292 -0
- package/dist/entries/apps.d.ts +292 -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 +596 -0
- package/dist/entries/credits.cjs.map +1 -0
- package/dist/entries/credits.d.cts +1460 -0
- package/dist/entries/credits.d.ts +1460 -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 +259 -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 +1743 -0
- package/dist/entries/workflow.d.ts +1743 -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 +7747 -27084
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -24198
- package/dist/index.d.ts +32 -24198
- package/dist/index.js +40 -25220
- package/dist/index.js.map +1 -1
- package/dist/model-catalog-V-ZNzRSd.d.cts +651 -0
- package/dist/model-catalog-V-ZNzRSd.d.ts +651 -0
- package/dist/presentation-types-0ENOCjoj.d.cts +61 -0
- package/dist/presentation-types-0ENOCjoj.d.ts +61 -0
- package/dist/presentation-utils-D0kxsWf9.d.cts +92 -0
- package/dist/presentation-utils-pZwlEAzo.d.ts +92 -0
- package/dist/scene-node-types-C3kl_zyK.d.cts +1949 -0
- package/dist/scene-node-types-C3kl_zyK.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__/fixtures/root-exports.baseline.json +4625 -0
- package/src/__tests__/input-field-extra-keys.test.ts +1 -0
- package/src/__tests__/model-makers.test.ts +76 -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-runtime-keys.test.ts +9 -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 +15 -0
- package/src/__tests__/preview-gate-use-case.test.ts +151 -0
- package/src/__tests__/private-host.test.ts +53 -0
- package/src/__tests__/run-continuation.test.ts +7 -1
- package/src/__tests__/site-capture-node.test.ts +58 -0
- package/src/__tests__/ugc-lane-wires.test.ts +228 -0
- package/src/__tests__/ugc-node-wires.test.ts +9 -3
- package/src/__tests__/ugc-run-state.test.ts +5 -4
- 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/add-captions-plan.ts +9 -3
- package/src/caption-edge-dash.ts +33 -0
- package/src/component-types.ts +9 -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/credit-identifiers.ts +62 -17
- package/src/entity-image-handle.ts +2 -0
- 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 +105 -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 +95 -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 -1845
- package/src/json-kinds.ts +4 -0
- package/src/model-catalog.ts +243 -34
- package/src/node-mappable-fields.ts +1 -0
- package/src/node-run-routes.ts +2 -0
- package/src/node-runtime-keys.ts +8 -0
- package/src/normalize-node-params.ts +30 -0
- package/src/presentation-utils.ts +12 -0
- package/src/preview-gate.ts +92 -14
- package/src/private-host.ts +89 -59
- package/src/producer-types.ts +16 -2
- package/src/run-continuation.ts +21 -0
- package/src/site-capture-node.ts +82 -0
- package/src/ugc-lane-wires.ts +246 -0
- package/src/ugc-node-wires.ts +37 -7
- package/src/ugc-run-state.ts +5 -3
- package/src/video-analysis-pricing.ts +31 -29
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/video-link.ts
|
|
4
|
+
var SOCIAL_VIDEO_HOSTS = [
|
|
5
|
+
"youtube.com",
|
|
6
|
+
"youtu.be",
|
|
7
|
+
"tiktok.com",
|
|
8
|
+
"instagram.com",
|
|
9
|
+
"twitter.com",
|
|
10
|
+
"x.com",
|
|
11
|
+
"facebook.com",
|
|
12
|
+
"fb.watch",
|
|
13
|
+
"fb.com"
|
|
14
|
+
];
|
|
15
|
+
var YOUTUBE_HOSTS = ["youtube.com", "youtu.be"];
|
|
16
|
+
var INSTAGRAM_HOSTS = ["instagram.com"];
|
|
17
|
+
var TIKTOK_HOSTS = ["tiktok.com"];
|
|
18
|
+
var TWITTER_HOSTS = ["twitter.com", "x.com"];
|
|
19
|
+
var FACEBOOK_HOSTS = ["facebook.com", "fb.watch", "fb.com"];
|
|
20
|
+
function hostnameMatchesAllowlist(hostname, domains) {
|
|
21
|
+
const h = hostname.toLowerCase().replace(/\.$/, "");
|
|
22
|
+
return domains.some((d) => {
|
|
23
|
+
const dom = d.toLowerCase();
|
|
24
|
+
return h === dom || h.endsWith("." + dom);
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function hasUrlParserHazard(url) {
|
|
28
|
+
for (let i = 0; i < url.length; i++) {
|
|
29
|
+
const code = url.charCodeAt(i);
|
|
30
|
+
if (code === 92 || code <= 31 || code === 127) return true;
|
|
31
|
+
}
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
function isSocialVideoUrl(url, domains = SOCIAL_VIDEO_HOSTS) {
|
|
35
|
+
if (hasUrlParserHazard(url)) return false;
|
|
36
|
+
try {
|
|
37
|
+
const parsed = new URL(url);
|
|
38
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return false;
|
|
39
|
+
return hostnameMatchesAllowlist(parsed.hostname, domains);
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function detectVideoLinkPlatform(url) {
|
|
45
|
+
if (isSocialVideoUrl(url, YOUTUBE_HOSTS)) return "youtube";
|
|
46
|
+
if (isSocialVideoUrl(url, FACEBOOK_HOSTS)) return "facebook";
|
|
47
|
+
if (isSocialVideoUrl(url, TIKTOK_HOSTS)) return "tiktok";
|
|
48
|
+
if (isSocialVideoUrl(url, INSTAGRAM_HOSTS)) return "instagram";
|
|
49
|
+
if (isSocialVideoUrl(url, TWITTER_HOSTS)) return "twitter";
|
|
50
|
+
return "unknown";
|
|
51
|
+
}
|
|
52
|
+
var VIDEO_LINK_TOLERANT_CONSUMER_TYPES = /* @__PURE__ */ new Set([
|
|
53
|
+
"suno-cover",
|
|
54
|
+
"transcribe",
|
|
55
|
+
"dubbing",
|
|
56
|
+
"content-recipe"
|
|
57
|
+
]);
|
|
58
|
+
var VIDEO_LINK_AUDIO_CONSUMER_TYPES = /* @__PURE__ */ new Set(["suno-cover", "transcribe"]);
|
|
59
|
+
function videoLinkNeedOf(consumerTypes) {
|
|
60
|
+
let audio = false;
|
|
61
|
+
for (const type of consumerTypes) {
|
|
62
|
+
if (!VIDEO_LINK_TOLERANT_CONSUMER_TYPES.has(type)) return "file";
|
|
63
|
+
if (VIDEO_LINK_AUDIO_CONSUMER_TYPES.has(type)) audio = true;
|
|
64
|
+
}
|
|
65
|
+
return audio ? "audio" : "none";
|
|
66
|
+
}
|
|
67
|
+
function videoLinkRunNeeds(scopeIds, nodes, edges) {
|
|
68
|
+
const byId = new Map(nodes.map((n) => [n.id, n]));
|
|
69
|
+
const isSkipped = (id) => byId.get(id)?.data?.skipped === true;
|
|
70
|
+
const sourcesOf = /* @__PURE__ */ new Map();
|
|
71
|
+
for (const edge of edges) {
|
|
72
|
+
const list = sourcesOf.get(edge.target);
|
|
73
|
+
if (list) list.push(edge.source);
|
|
74
|
+
else sourcesOf.set(edge.target, [edge.source]);
|
|
75
|
+
}
|
|
76
|
+
const inRun = /* @__PURE__ */ new Set();
|
|
77
|
+
const queue = (scopeIds ?? nodes.map((n) => n.id)).filter((id) => !isSkipped(id));
|
|
78
|
+
for (const id of queue) inRun.add(id);
|
|
79
|
+
while (queue.length > 0) {
|
|
80
|
+
const current = queue.pop();
|
|
81
|
+
for (const source of sourcesOf.get(current) ?? []) {
|
|
82
|
+
if (inRun.has(source)) continue;
|
|
83
|
+
inRun.add(source);
|
|
84
|
+
queue.push(source);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
const consumers = /* @__PURE__ */ new Map();
|
|
88
|
+
for (const edge of edges) {
|
|
89
|
+
if (byId.get(edge.source)?.type !== "youtube-video" || !inRun.has(edge.target)) continue;
|
|
90
|
+
const list = consumers.get(edge.source);
|
|
91
|
+
const type = byId.get(edge.target)?.type ?? "";
|
|
92
|
+
if (list) list.push(type);
|
|
93
|
+
else consumers.set(edge.source, [type]);
|
|
94
|
+
}
|
|
95
|
+
const needs = /* @__PURE__ */ new Map();
|
|
96
|
+
for (const [id, types] of consumers) needs.set(id, videoLinkNeedOf(types));
|
|
97
|
+
return needs;
|
|
98
|
+
}
|
|
99
|
+
function trimmed(value) {
|
|
100
|
+
if (typeof value !== "string") return void 0;
|
|
101
|
+
const t = value.trim();
|
|
102
|
+
return t === "" ? void 0 : t;
|
|
103
|
+
}
|
|
104
|
+
function videoLinkDownloadedFile(data) {
|
|
105
|
+
const file = trimmed(data.downloadedVideoUrl);
|
|
106
|
+
if (!file) return void 0;
|
|
107
|
+
const from = trimmed(data.downloadedFromUrl);
|
|
108
|
+
if (from && from !== trimmed(data.youtubeUrl)) return void 0;
|
|
109
|
+
return file;
|
|
110
|
+
}
|
|
111
|
+
function resolveVideoLinkOutput(data) {
|
|
112
|
+
return videoLinkDownloadedFile(data) ?? trimmed(data.youtubeUrl);
|
|
113
|
+
}
|
|
114
|
+
function videoLinkPageUrl(data) {
|
|
115
|
+
return trimmed(data.youtubeUrl);
|
|
116
|
+
}
|
|
117
|
+
function videoLinkNeedsDownload(data) {
|
|
118
|
+
const url = trimmed(data.youtubeUrl);
|
|
119
|
+
if (!url || !isSocialVideoUrl(url)) return false;
|
|
120
|
+
return videoLinkDownloadedFile(data) === void 0;
|
|
121
|
+
}
|
|
122
|
+
var DIRECT_VIDEO_EXTENSIONS = [".mp4", ".webm", ".mov", ".avi"];
|
|
123
|
+
function isDirectVideoFileUrl(url) {
|
|
124
|
+
if (hasUrlParserHazard(url)) return false;
|
|
125
|
+
try {
|
|
126
|
+
const parsed = new URL(url);
|
|
127
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return false;
|
|
128
|
+
const path = parsed.pathname.toLowerCase();
|
|
129
|
+
return DIRECT_VIDEO_EXTENSIONS.some((ext) => path.endsWith(ext));
|
|
130
|
+
} catch {
|
|
131
|
+
return false;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
var AUTO_DOWNLOAD_MAX_SEC = 240;
|
|
135
|
+
var YOUTUBE_MAX_HEIGHT = 1080;
|
|
136
|
+
var MAX_VIDEO_LINK_INPUT_CHARS = 2048;
|
|
137
|
+
function videoLinkInputProblem(value) {
|
|
138
|
+
if (value === void 0 || value === null) return "empty";
|
|
139
|
+
if (typeof value !== "string") return "invalid";
|
|
140
|
+
const link = value.trim();
|
|
141
|
+
if (link === "") return "empty";
|
|
142
|
+
if (link.length > MAX_VIDEO_LINK_INPUT_CHARS) return "invalid";
|
|
143
|
+
return isSocialVideoUrl(link) || isHttpLink(link) ? null : "invalid";
|
|
144
|
+
}
|
|
145
|
+
function isHttpLink(link) {
|
|
146
|
+
if (hasUrlParserHazard(link)) return false;
|
|
147
|
+
try {
|
|
148
|
+
const parsed = new URL(link);
|
|
149
|
+
return (parsed.protocol === "http:" || parsed.protocol === "https:") && parsed.hostname !== "";
|
|
150
|
+
} catch {
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
var VIDEO_LINK_DERIVED_FIELDS = [
|
|
155
|
+
"videoId",
|
|
156
|
+
"title",
|
|
157
|
+
"thumbnailUrl",
|
|
158
|
+
"downloadedVideoUrl",
|
|
159
|
+
"downloadedThumbnailUrl",
|
|
160
|
+
"downloadedFromUrl",
|
|
161
|
+
"downloadedSection",
|
|
162
|
+
"downloadStatus",
|
|
163
|
+
"downloadError",
|
|
164
|
+
"downloadErrorCode",
|
|
165
|
+
"downloadId",
|
|
166
|
+
"downloadIdUrl",
|
|
167
|
+
"downloadMode",
|
|
168
|
+
"downloadAllowSilent",
|
|
169
|
+
"downloadPercent",
|
|
170
|
+
"downloadPhase",
|
|
171
|
+
"sectionStartSec",
|
|
172
|
+
"sectionEndSec",
|
|
173
|
+
"needsRangeChoice",
|
|
174
|
+
"videoDurationSec",
|
|
175
|
+
"downloadedAudioUrl",
|
|
176
|
+
"audioDownloadStatus",
|
|
177
|
+
"audioDownloadError"
|
|
178
|
+
];
|
|
179
|
+
function dropStaleVideoLinkFields(data, incoming) {
|
|
180
|
+
if (!("youtubeUrl" in incoming)) return data;
|
|
181
|
+
if (trimmed(incoming.youtubeUrl) === trimmed(data.youtubeUrl)) return data;
|
|
182
|
+
const out = { ...data };
|
|
183
|
+
for (const key of VIDEO_LINK_DERIVED_FIELDS) delete out[key];
|
|
184
|
+
return out;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
exports.AUTO_DOWNLOAD_MAX_SEC = AUTO_DOWNLOAD_MAX_SEC;
|
|
188
|
+
exports.DIRECT_VIDEO_EXTENSIONS = DIRECT_VIDEO_EXTENSIONS;
|
|
189
|
+
exports.INSTAGRAM_HOSTS = INSTAGRAM_HOSTS;
|
|
190
|
+
exports.MAX_VIDEO_LINK_INPUT_CHARS = MAX_VIDEO_LINK_INPUT_CHARS;
|
|
191
|
+
exports.SOCIAL_VIDEO_HOSTS = SOCIAL_VIDEO_HOSTS;
|
|
192
|
+
exports.VIDEO_LINK_AUDIO_CONSUMER_TYPES = VIDEO_LINK_AUDIO_CONSUMER_TYPES;
|
|
193
|
+
exports.VIDEO_LINK_DERIVED_FIELDS = VIDEO_LINK_DERIVED_FIELDS;
|
|
194
|
+
exports.VIDEO_LINK_TOLERANT_CONSUMER_TYPES = VIDEO_LINK_TOLERANT_CONSUMER_TYPES;
|
|
195
|
+
exports.YOUTUBE_HOSTS = YOUTUBE_HOSTS;
|
|
196
|
+
exports.YOUTUBE_MAX_HEIGHT = YOUTUBE_MAX_HEIGHT;
|
|
197
|
+
exports.detectVideoLinkPlatform = detectVideoLinkPlatform;
|
|
198
|
+
exports.dropStaleVideoLinkFields = dropStaleVideoLinkFields;
|
|
199
|
+
exports.hasUrlParserHazard = hasUrlParserHazard;
|
|
200
|
+
exports.hostnameMatchesAllowlist = hostnameMatchesAllowlist;
|
|
201
|
+
exports.isDirectVideoFileUrl = isDirectVideoFileUrl;
|
|
202
|
+
exports.isSocialVideoUrl = isSocialVideoUrl;
|
|
203
|
+
exports.resolveVideoLinkOutput = resolveVideoLinkOutput;
|
|
204
|
+
exports.videoLinkDownloadedFile = videoLinkDownloadedFile;
|
|
205
|
+
exports.videoLinkInputProblem = videoLinkInputProblem;
|
|
206
|
+
exports.videoLinkNeedOf = videoLinkNeedOf;
|
|
207
|
+
exports.videoLinkNeedsDownload = videoLinkNeedsDownload;
|
|
208
|
+
exports.videoLinkPageUrl = videoLinkPageUrl;
|
|
209
|
+
exports.videoLinkRunNeeds = videoLinkRunNeeds;
|
|
210
|
+
//# sourceMappingURL=chunk-NEJ2PV4C.cjs.map
|
|
211
|
+
//# sourceMappingURL=chunk-NEJ2PV4C.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/video-link.ts"],"names":[],"mappings":";;;AAoBO,IAAM,kBAAA,GAAqB;AAAA,EAChC,aAAA;AAAA,EAAe,UAAA;AAAA,EACf,YAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EAAe,OAAA;AAAA,EACf,cAAA;AAAA,EAAgB,UAAA;AAAA,EAAY;AAC9B;AAGO,IAAM,aAAA,GAAgB,CAAC,aAAA,EAAe,UAAU;AAGhD,IAAM,eAAA,GAAkB,CAAC,eAAe;AAE/C,IAAM,YAAA,GAAe,CAAC,YAAY,CAAA;AAClC,IAAM,aAAA,GAAgB,CAAC,aAAA,EAAe,OAAO,CAAA;AAC7C,IAAM,cAAA,GAAiB,CAAC,cAAA,EAAgB,UAAA,EAAY,QAAQ,CAAA;AAQrD,SAAS,wBAAA,CAAyB,UAAkB,OAAA,EAAqC;AAC9F,EAAA,MAAM,IAAI,QAAA,CAAS,WAAA,EAAY,CAAE,OAAA,CAAQ,OAAO,EAAE,CAAA;AAClD,EAAA,OAAO,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA,KAAM;AACzB,IAAA,MAAM,GAAA,GAAM,EAAE,WAAA,EAAY;AAC1B,IAAA,OAAO,CAAA,KAAM,GAAA,IAAO,CAAA,CAAE,QAAA,CAAS,MAAM,GAAG,CAAA;AAAA,EAC1C,CAAC,CAAA;AACH;AAeO,SAAS,mBAAmB,GAAA,EAAsB;AACvD,EAAA,KAAA,IAAS,CAAA,GAAI,CAAA,EAAG,CAAA,GAAI,GAAA,CAAI,QAAQ,CAAA,EAAA,EAAK;AACnC,IAAA,M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A,EACA,cAAA;AAAA,EACA,oBAAA;AAAA,EACA,wBAAA;AAAA,EACA,mBAAA;AAAA,EACA,mBAAA;AAAA,EACA,gBAAA;AAAA,EACA,eAAA;AAAA,EACA,mBAAA;AAAA,EACA,YAAA;AAAA,EACA,eAAA;AAAA,EACA,cAAA;AAAA,EACA,qBAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAA;AAAA,EACA,iBAAA;AAAA,EACA,eAAA;AAAA,EACA,kBAAA;AAAA,EACA,kBAAA;AAAA,EACA,oBAAA;AAAA,EACA,qBAAA;AAAA,EACA;AACF;AASO,SAAS,wBAAA,CACd,MACA,QAAA,EACyB;AACzB,EAAA,IAAI,EAAE,YAAA,IAAgB,QAAA,CAAA,EAAW,OAAO,IAAA;AACxC,EAAA,IAAI,OAAA,CAAQ,SAAS,UAAU,CAAA,KAAM,QAAQ,IAAA,CAAK,UAAU,GAAG,OAAO,IAAA;AACtE,EAAA,MAAM,GAAA,GAA+B,EAAE,GAAG,IAAA,EAAK;AAC/C,EAAA,KAAA,MAAW,GAAA,IAAO,yBAAA,EAA2B,OAAO,GAAA,CAAI,GAAG,CAAA;AAC3D,EAAA,OAAO,GAAA;AACT","file":"chunk-NEJ2PV4C.cjs","sourcesContent":["/**\n * The Video URL node (`youtube-video`) and the social-video import path —\n * structural vocabulary shared by the canvas, the orchestrator and the\n * download routes. Host names and a node-output rule only; no prompt content.\n *\n * ONE list, three readers:\n * - the backend's yt-dlp routes (`lib/url-validator.ts` re-exports these),\n * where the list IS the SSRF gate — yt-dlp does its own DNS + HTTP, so\n * nothing but this exact-suffix match stands between a pasted link and an\n * internal address;\n * - the editor, which decides from the same list whether a pasted link is\n * one it should download (it must never offer a host the server refuses,\n * nor sit on one the server accepts);\n * - both workflow engines, which read a node's output through\n * `resolveVideoLinkOutput`.\n *\n * ⚠️ Adding a host here ADMITS it to a server-side fetch. It is a security\n * decision, not a UI one — only fixed, reputable domains whose DNS an attacker\n * cannot control.\n */\nexport const SOCIAL_VIDEO_HOSTS = [\n \"youtube.com\", \"youtu.be\",\n \"tiktok.com\",\n \"instagram.com\",\n \"twitter.com\", \"x.com\",\n \"facebook.com\", \"fb.watch\", \"fb.com\",\n] as const\n\n/** YouTube-only subset (the metadata probe and the client ladder are YouTube-only). */\nexport const YOUTUBE_HOSTS = [\"youtube.com\", \"youtu.be\"] as const\n\n/** Instagram-only subset (the download path's proxy failover is Instagram-scoped). */\nexport const INSTAGRAM_HOSTS = [\"instagram.com\"] as const\n\nconst TIKTOK_HOSTS = [\"tiktok.com\"] as const\nconst TWITTER_HOSTS = [\"twitter.com\", \"x.com\"] as const\nconst FACEBOOK_HOSTS = [\"facebook.com\", \"fb.watch\", \"fb.com\"] as const\n\n/**\n * Exact registrable-domain match against an allowlist: the domain itself or a\n * true subdomain (`www.youtube.com`, `m.youtu.be`). A host that merely\n * CONTAINS an allowlisted name (`evilyoutube.com`, `youtube.com.attacker.example`,\n * or `netflix.com` for `x.com`) does not match.\n */\nexport function hostnameMatchesAllowlist(hostname: string, domains: readonly string[]): boolean {\n const h = hostname.toLowerCase().replace(/\\.$/, \"\") // strip FQDN trailing dot\n return domains.some((d) => {\n const dom = d.toLowerCase()\n return h === dom || h.endsWith(\".\" + dom)\n })\n}\n\n/**\n * True when the RAW link carries a character that URL parsers read differently:\n * a backslash or an ASCII control character.\n *\n * Every check in this file parses the WHATWG way (Node, the browser), where a\n * backslash in an http(s) URL is a slash — `https://tiktok.com\\@10.0.0.1/x` has\n * host `tiktok.com`. A parser that ends the authority at `/` alone reads the\n * same string as a user name at host `10.0.0.1`. The download tools are handed\n * the raw string and do their own parsing, DNS and HTTP, so a link the two\n * readings can disagree on is refused outright rather than reasoned about. Tabs\n * and newlines are dropped silently by one parser and kept by another — same\n * answer. No real video link contains any of these.\n */\nexport function hasUrlParserHazard(url: string): boolean {\n for (let i = 0; i < url.length; i++) {\n const code = url.charCodeAt(i)\n if (code === 0x5c || code <= 0x1f || code === 0x7f) return true\n }\n return false\n}\n\n/** True for an http(s) URL whose host is on the allowlist. Never throws. */\nexport function isSocialVideoUrl(url: string, domains: readonly string[] = SOCIAL_VIDEO_HOSTS): boolean {\n if (hasUrlParserHazard(url)) return false\n try {\n const parsed = new URL(url)\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") return false\n return hostnameMatchesAllowlist(parsed.hostname, domains)\n } catch {\n return false\n }\n}\n\nexport type VideoLinkPlatform = \"youtube\" | \"facebook\" | \"tiktok\" | \"instagram\" | \"twitter\" | \"unknown\"\n\n/** Which supported platform a link belongs to — by exact host, never by substring. */\nexport function detectVideoLinkPlatform(url: string): VideoLinkPlatform {\n if (isSocialVideoUrl(url, YOUTUBE_HOSTS)) return \"youtube\"\n if (isSocialVideoUrl(url, FACEBOOK_HOSTS)) return \"facebook\"\n if (isSocialVideoUrl(url, TIKTOK_HOSTS)) return \"tiktok\"\n if (isSocialVideoUrl(url, INSTAGRAM_HOSTS)) return \"instagram\"\n if (isSocialVideoUrl(url, TWITTER_HOSTS)) return \"twitter\"\n return \"unknown\"\n}\n\n/**\n * Node types that can use a Video URL node WITHOUT its downloaded file, because\n * they never read the video: `suno-cover` and `transcribe` take the node's\n * separately-fetched audio track (`downloadedAudioUrl`), `dubbing` hands the\n * page link to a provider that fetches it itself, and `content-recipe` cites the\n * post's page link on its `link` input (`videoLinkPageUrl`, both resolvers) —\n * a Video URL can reach it on no other input. A run whose only consumers of a\n * link are these must not be made to download — or to choose a part of — a\n * video nobody will look at. Structural vocabulary: it mirrors those\n * server-side readers; add a type here only together with its reader.\n */\nexport const VIDEO_LINK_TOLERANT_CONSUMER_TYPES: ReadonlySet<string> = new Set([\n \"suno-cover\",\n \"transcribe\",\n \"dubbing\",\n \"content-recipe\",\n])\n\n/**\n * The tolerant consumers that DO read something fetched from the link — the\n * separately-fetched audio track (`downloadedAudioUrl`): Transcribe and Suno\n * Cover. The rest of the tolerant set (Dubbing, Content Recipe) read only the\n * page link and need nothing fetched. A subset of the tolerant set by\n * construction (guard test).\n */\nexport const VIDEO_LINK_AUDIO_CONSUMER_TYPES: ReadonlySet<string> = new Set([\"suno-cover\", \"transcribe\"])\n\n/**\n * What a run must FETCH for a Video URL node holding a post link:\n * - `file`: some node in the run watches the video — download the video;\n * - `audio`: every reader is tolerant and at least one takes the audio track —\n * fetch the track only, never the video (and never ask for a part of it);\n * - `none`: every reader takes the page link alone — fetch nothing.\n */\nexport type VideoLinkNeed = \"file\" | \"audio\" | \"none\"\n\n/** The need of a node read by consumers of these types. No consumer reads nothing. */\nexport function videoLinkNeedOf(consumerTypes: Iterable<string>): VideoLinkNeed {\n let audio = false\n for (const type of consumerTypes) {\n if (!VIDEO_LINK_TOLERANT_CONSUMER_TYPES.has(type)) return \"file\"\n if (VIDEO_LINK_AUDIO_CONSUMER_TYPES.has(type)) audio = true\n }\n return audio ? \"audio\" : \"none\"\n}\n\n/** The node shape the graph readers need — open on purpose, both engines' nodes fit. */\nexport interface VideoLinkGraphNode {\n readonly id: string\n readonly type?: string\n readonly data?: unknown\n}\n\nexport interface VideoLinkGraphEdge {\n readonly source: string\n readonly target: string\n}\n\n/**\n * The need of every Video URL node that feeds the run, by node id — ONE reading\n * of the graph for the editor's pre-run gate, the app runner's card and the\n * server's pre-run fetch, so the three cannot disagree on what a run needs.\n *\n * `scopeIds` are the nodes about to run (`null` = every node: an app runs its\n * whole graph). The run is those nodes plus everything they read from, at any\n * depth; a link that feeds nothing in it is absent (a long video parked on the\n * canvas must never block an unrelated run). Skipped nodes are not part of the\n * run and pull nothing in.\n */\nexport function videoLinkRunNeeds(\n scopeIds: readonly string[] | null,\n nodes: readonly VideoLinkGraphNode[],\n edges: readonly VideoLinkGraphEdge[],\n): Map<string, VideoLinkNeed> {\n const byId = new Map(nodes.map((n) => [n.id, n] as const))\n const isSkipped = (id: string) => (byId.get(id)?.data as { skipped?: unknown } | undefined)?.skipped === true\n\n const sourcesOf = new Map<string, string[]>()\n for (const edge of edges) {\n const list = sourcesOf.get(edge.target)\n if (list) list.push(edge.source)\n else sourcesOf.set(edge.target, [edge.source])\n }\n\n // Everything the run touches: the nodes about to run plus all they read from.\n const inRun = new Set<string>()\n const queue = (scopeIds ?? nodes.map((n) => n.id)).filter((id) => !isSkipped(id))\n for (const id of queue) inRun.add(id)\n while (queue.length > 0) {\n const current = queue.pop()!\n for (const source of sourcesOf.get(current) ?? []) {\n if (inRun.has(source)) continue\n inRun.add(source)\n queue.push(source)\n }\n }\n\n const consumers = new Map<string, string[]>()\n for (const edge of edges) {\n if (byId.get(edge.source)?.type !== \"youtube-video\" || !inRun.has(edge.target)) continue\n const list = consumers.get(edge.source)\n const type = byId.get(edge.target)?.type ?? \"\"\n if (list) list.push(type)\n else consumers.set(edge.source, [type])\n }\n const needs = new Map<string, VideoLinkNeed>()\n for (const [id, types] of consumers) needs.set(id, videoLinkNeedOf(types))\n return needs\n}\n\n/**\n * The fields of a Video URL node's data that decide what it emits. Open-ended\n * on purpose: both engines hand over the node's whole `data` bag, and a closed\n * shape with only optional members would refuse it as having nothing in common.\n */\nexport interface VideoLinkNodeFields {\n readonly youtubeUrl?: unknown\n readonly downloadedVideoUrl?: unknown\n readonly downloadedFromUrl?: unknown\n readonly [key: string]: unknown\n}\n\nfunction trimmed(value: unknown): string | undefined {\n if (typeof value !== \"string\") return undefined\n const t = value.trim()\n return t === \"\" ? undefined : t\n}\n\n/**\n * The stored file that belongs to the node's CURRENT link, or undefined.\n *\n * `downloadedFromUrl` binds a file to the link it came from. The editor clears\n * the file whenever the link is edited, but a link can also change where no\n * editor is looking — an agent or an import rewriting the workflow JSON — and\n * without the binding the node would go on emitting the PREVIOUS video, which\n * is worse than emitting none. A node saved before the field existed has no\n * binding and is trusted as it always was.\n */\nexport function videoLinkDownloadedFile(data: VideoLinkNodeFields): string | undefined {\n const file = trimmed(data.downloadedVideoUrl)\n if (!file) return undefined\n const from = trimmed(data.downloadedFromUrl)\n if (from && from !== trimmed(data.youtubeUrl)) return undefined\n return file\n}\n\n/**\n * What a Video URL node emits on its `video` handle: the downloaded file when\n * one matches the link, else the link itself. The fallback is load-bearing — a\n * DIRECT file link (`https://cdn…/clip.mp4`) is a legitimate value of the URL\n * field and is never downloaded, so it must pass through.\n */\nexport function resolveVideoLinkOutput(data: VideoLinkNodeFields): string | undefined {\n return videoLinkDownloadedFile(data) ?? trimmed(data.youtubeUrl)\n}\n\n/**\n * The page link a Video URL node was given (the post's own address), never\n * the downloaded file. Read by consumers that CITE a post rather than watch\n * it — Content Recipe's \"Source post\" input stores it as the recipe's source.\n */\nexport function videoLinkPageUrl(data: VideoLinkNodeFields): string | undefined {\n return trimmed(data.youtubeUrl)\n}\n\n/**\n * True when the node holds a social link with no file for it yet — the state\n * in which its output is a web PAGE, which no video consumer can read.\n */\nexport function videoLinkNeedsDownload(data: VideoLinkNodeFields): boolean {\n const url = trimmed(data.youtubeUrl)\n if (!url || !isSocialVideoUrl(url)) return false\n return videoLinkDownloadedFile(data) === undefined\n}\n\n// ---------------------------------------------------------------------------\n// The link as an APP INPUT (a published app, MCP `run_app`, the SDK)\n// ---------------------------------------------------------------------------\n\n/**\n * File extensions accepted as DIRECT video-file links (pathname suffix match).\n * Mirrors save-to-storage's video auto-detect set.\n */\nexport const DIRECT_VIDEO_EXTENSIONS = [\".mp4\", \".webm\", \".mov\", \".avi\"] as const\n\n/**\n * True for a DIRECT video-file link: http(s) whose PATHNAME ends in a video\n * extension — `https://cdn.nodaro.ai/uploads/videos/<id>.mp4` and any other\n * cdn-style link. Query and fragment are ignored (signed CDN links keep the\n * extension in the path); an extension that appears only in the query does\n * not qualify. Host-agnostic BY DESIGN, which is exactly why admission is not\n * sufficient on its own: the download route pre-resolves these hosts before it\n * fetches (`resolvesOnlyToPublicAddresses`), and every other reader goes\n * through the SSRF-guarded fetch.\n *\n * A link carrying a backslash or a control character is refused first\n * (`hasUrlParserHazard`): the route pre-resolves the WHATWG host, and the\n * download tool would fetch whatever host ITS parser reads.\n */\nexport function isDirectVideoFileUrl(url: string): boolean {\n if (hasUrlParserHazard(url)) return false\n try {\n const parsed = new URL(url)\n if (parsed.protocol !== \"http:\" && parsed.protocol !== \"https:\") return false\n const path = parsed.pathname.toLowerCase()\n return DIRECT_VIDEO_EXTENSIONS.some((ext) => path.endsWith(ext))\n } catch {\n return false\n }\n}\n\n/**\n * A YouTube video shorter than this downloads whole the moment the link lands;\n * a longer one (or one whose length could not be read) waits for a part to be\n * chosen. The same 4 minutes Recast and Studio use — a two-hour talk nobody\n * asked for never gets fetched by accident. One number for the canvas node, the\n * app runner's card and the server's pre-run fetch.\n */\nexport const AUTO_DOWNLOAD_MAX_SEC = 240\n\n/** YouTube's quality cap (\"up to N rows\"). Other hosts have no ladder worth capping. */\nexport const YOUTUBE_MAX_HEIGHT = 1080\n\n/** The longest link an app input accepts. A real video link is a few hundred characters. */\nexport const MAX_VIDEO_LINK_INPUT_CHARS = 2048\n\nexport type VideoLinkInputProblem = \"empty\" | \"invalid\"\n\n/**\n * The ONE rule for what a Video URL app input may hold — the canvas node's own\n * (decided 2026-10-08): a link to a supported social host (downloaded before\n * the nodes that need the file run), or any other http(s) link (passed through\n * as it is, never downloaded; the nodes that read it fetch it through the\n * SSRF-guarded fetch). The app runner's card, the run-request lock and MCP\n * `get_app_inputs` all read it, so a link the card accepts is a link the\n * server accepts, and the reverse.\n *\n * Structural only: the server layers its SSRF guard on top (`safeUrlSchema`),\n * and the card refuses a literal local / private host. A link carrying a\n * backslash or a control character is refused (`hasUrlParserHazard`).\n * `null` = fine; leading and trailing spaces are not a problem (the card trims\n * before it sends).\n */\nexport function videoLinkInputProblem(value: unknown): VideoLinkInputProblem | null {\n if (value === undefined || value === null) return \"empty\"\n if (typeof value !== \"string\") return \"invalid\"\n const link = value.trim()\n if (link === \"\") return \"empty\"\n if (link.length > MAX_VIDEO_LINK_INPUT_CHARS) return \"invalid\"\n return isSocialVideoUrl(link) || isHttpLink(link) ? null : \"invalid\"\n}\n\nfunction isHttpLink(link: string): boolean {\n if (hasUrlParserHazard(link)) return false\n try {\n const parsed = new URL(link)\n return (parsed.protocol === \"http:\" || parsed.protocol === \"https:\") && parsed.hostname !== \"\"\n } catch {\n return false\n }\n}\n\n/**\n * The fields of a Video URL node's data that belong to ONE link: the file and\n * audio track fetched from it, the progress of that fetch, and what was read\n * from the link (its id, title, picture, length). Every one of them describes\n * the link it was made for.\n *\n * A run-time override that swaps the link (`dropStaleVideoLinkFields`) drops\n * these first, because the creator's published node carries all of them and a\n * shallow merge would leave them standing under the caller's link — the audio\n * track in particular has no binding to its link (`downloadedAudioUrl` is read\n * straight off the node by Transcribe and Suno Cover), so a caller's episode\n * would be transcribed from the creator's sample. The editor's own\n * link-change reset (`CLEARED_DOWNLOAD` in `lib/video-link-ingest.ts`) is\n * guarded to be inside this list.\n */\nexport const VIDEO_LINK_DERIVED_FIELDS = [\n \"videoId\",\n \"title\",\n \"thumbnailUrl\",\n \"downloadedVideoUrl\",\n \"downloadedThumbnailUrl\",\n \"downloadedFromUrl\",\n \"downloadedSection\",\n \"downloadStatus\",\n \"downloadError\",\n \"downloadErrorCode\",\n \"downloadId\",\n \"downloadIdUrl\",\n \"downloadMode\",\n \"downloadAllowSilent\",\n \"downloadPercent\",\n \"downloadPhase\",\n \"sectionStartSec\",\n \"sectionEndSec\",\n \"needsRangeChoice\",\n \"videoDurationSec\",\n \"downloadedAudioUrl\",\n \"audioDownloadStatus\",\n \"audioDownloadError\",\n] as const\n\n/**\n * The saved Video URL node data without what belonged to its previous link,\n * when `incoming` (the run's override for the node) points it at a different\n * one. A field the override brings itself is kept (the merge applies it after\n * this). Returns the SAME object when the link is not being changed; never\n * mutates.\n */\nexport function dropStaleVideoLinkFields(\n data: Record<string, unknown>,\n incoming: Record<string, unknown>,\n): Record<string, unknown> {\n if (!(\"youtubeUrl\" in incoming)) return data\n if (trimmed(incoming.youtubeUrl) === trimmed(data.youtubeUrl)) return data\n const out: Record<string, unknown> = { ...data }\n for (const key of VIDEO_LINK_DERIVED_FIELDS) delete out[key]\n return out\n}\n"]}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { INPUT_FIELD_MAP, canonicalExposedFieldKey } from './chunk-PXFQVLBX.js';
|
|
2
|
+
|
|
3
|
+
// src/picker-restrictions.ts
|
|
4
|
+
var valuesOf = (v) => (Array.isArray(v) ? v : [v]).filter((x) => x !== void 0 && x !== null && x !== "").map(String);
|
|
5
|
+
function findRestrictedPickerValue(input) {
|
|
6
|
+
if (!input.cardMeta || !input.inputValues) return null;
|
|
7
|
+
for (const node of input.nodes) {
|
|
8
|
+
const meta = input.cardMeta[node.id];
|
|
9
|
+
const submitted = input.inputValues[node.id];
|
|
10
|
+
if (!meta || !submitted) continue;
|
|
11
|
+
const rules = [];
|
|
12
|
+
const rep = node.type ? INPUT_FIELD_MAP[node.type]?.key : void 0;
|
|
13
|
+
if (rep && meta.pickerAllowedValues && meta.pickerAllowedValues.length > 0) rules.push([rep, meta.pickerAllowedValues]);
|
|
14
|
+
for (const [field, allowed] of Object.entries(meta.pickerAllowedValuesByField ?? {})) {
|
|
15
|
+
if (allowed.length > 0) rules.push([field, allowed]);
|
|
16
|
+
}
|
|
17
|
+
for (const [field, allowed] of rules) {
|
|
18
|
+
for (const [key, raw] of Object.entries(submitted)) {
|
|
19
|
+
if (canonicalExposedFieldKey(node.type, key) !== field) continue;
|
|
20
|
+
for (const value of valuesOf(raw)) {
|
|
21
|
+
if (!allowed.includes(value)) return `Invalid value for ${field}: ${value}. Allowed: ${allowed.join(", ")}`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// src/component-types.ts
|
|
30
|
+
var INPUT_FIELD_MAP2 = Object.fromEntries(
|
|
31
|
+
Object.entries(INPUT_FIELD_MAP).map(([k, v]) => [k, v.key])
|
|
32
|
+
);
|
|
33
|
+
var HANDLE_PORT_SEPARATOR = "::";
|
|
34
|
+
function parseHandleId(handleId) {
|
|
35
|
+
const sep = handleId.indexOf(HANDLE_PORT_SEPARATOR);
|
|
36
|
+
if (sep < 0) return { nodeId: handleId };
|
|
37
|
+
const portId = handleId.slice(sep + HANDLE_PORT_SEPARATOR.length);
|
|
38
|
+
return { nodeId: handleId.slice(0, sep), portId: portId || void 0 };
|
|
39
|
+
}
|
|
40
|
+
function applyHandleInputOverride(inputOverrides, handle, value) {
|
|
41
|
+
const { nodeId, portId } = parseHandleId(handle.id);
|
|
42
|
+
if (portId) {
|
|
43
|
+
const existing = inputOverrides[nodeId]?.__injectedPortValues ?? {};
|
|
44
|
+
inputOverrides[nodeId] = {
|
|
45
|
+
...inputOverrides[nodeId],
|
|
46
|
+
__injectedPortValues: { ...existing, [portId]: value }
|
|
47
|
+
};
|
|
48
|
+
} else {
|
|
49
|
+
inputOverrides[nodeId] = { ...inputOverrides[nodeId], [handle.fieldKey]: value };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function isHandleInputWired(inputOverrides, handle) {
|
|
53
|
+
const { nodeId, portId } = parseHandleId(handle.id);
|
|
54
|
+
if (portId) {
|
|
55
|
+
const injected = inputOverrides[nodeId]?.__injectedPortValues;
|
|
56
|
+
return injected?.[portId] !== void 0;
|
|
57
|
+
}
|
|
58
|
+
return inputOverrides[nodeId]?.[handle.fieldKey] !== void 0;
|
|
59
|
+
}
|
|
60
|
+
var OUTPUT_FIELD_MAP = {
|
|
61
|
+
image: "imageUrl",
|
|
62
|
+
video: "videoUrl",
|
|
63
|
+
audio: "audioUrl",
|
|
64
|
+
text: "text"
|
|
65
|
+
};
|
|
66
|
+
function mergeExposedSettings(inputOverrides, exposedSettings, metadata) {
|
|
67
|
+
const merged = { ...inputOverrides };
|
|
68
|
+
for (const setting of metadata.exposedSettings) {
|
|
69
|
+
const key = `${setting.nodeId}:${setting.field}`;
|
|
70
|
+
const value = exposedSettings[key];
|
|
71
|
+
if (value !== void 0) {
|
|
72
|
+
if (merged[setting.nodeId]?.[setting.field] !== void 0) continue;
|
|
73
|
+
merged[setting.nodeId] = { ...merged[setting.nodeId], [setting.field]: value };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return merged;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// src/oauth-scopes.ts
|
|
80
|
+
var OAUTH_SCOPES = [
|
|
81
|
+
"workflows:read",
|
|
82
|
+
"workflows:write",
|
|
83
|
+
"workflows:execute",
|
|
84
|
+
"jobs:read",
|
|
85
|
+
"assets:read",
|
|
86
|
+
"assets:write",
|
|
87
|
+
"credits:read",
|
|
88
|
+
"apps:read",
|
|
89
|
+
"pipelines:read",
|
|
90
|
+
"pipelines:execute",
|
|
91
|
+
"pipelines:approve",
|
|
92
|
+
"presets:read",
|
|
93
|
+
"workspaces:read",
|
|
94
|
+
"workspaces:write"
|
|
95
|
+
];
|
|
96
|
+
|
|
97
|
+
// src/recast-segment-packs.ts
|
|
98
|
+
var RECAST_SEGMENT_PACKS = ["max", "scenes-max", "scenes"];
|
|
99
|
+
|
|
100
|
+
// src/template-categories.ts
|
|
101
|
+
var TEMPLATE_CATEGORIES = [
|
|
102
|
+
"product-imagery",
|
|
103
|
+
"static-ads",
|
|
104
|
+
"user-generated-content",
|
|
105
|
+
"video-ads",
|
|
106
|
+
"brand-assets",
|
|
107
|
+
"automations",
|
|
108
|
+
"campaign-concepts",
|
|
109
|
+
"social-creatives"
|
|
110
|
+
];
|
|
111
|
+
var DEFAULT_TEMPLATE_CATEGORY = "automations";
|
|
112
|
+
var LEGACY_TEMPLATE_CATEGORIES = {
|
|
113
|
+
"image-generation": "product-imagery",
|
|
114
|
+
"video-production": "video-ads",
|
|
115
|
+
"audio-music": "social-creatives",
|
|
116
|
+
"content-writing": "campaign-concepts",
|
|
117
|
+
"social-media": "social-creatives",
|
|
118
|
+
"data-processing": "automations",
|
|
119
|
+
"multi-step": "automations",
|
|
120
|
+
other: "automations"
|
|
121
|
+
};
|
|
122
|
+
var CURRENT = new Set(TEMPLATE_CATEGORIES);
|
|
123
|
+
function isTemplateCategory(value) {
|
|
124
|
+
return typeof value === "string" && CURRENT.has(value);
|
|
125
|
+
}
|
|
126
|
+
function resolveTemplateCategory(value) {
|
|
127
|
+
if (value == null) return void 0;
|
|
128
|
+
if (isTemplateCategory(value)) return value;
|
|
129
|
+
return LEGACY_TEMPLATE_CATEGORIES[value];
|
|
130
|
+
}
|
|
131
|
+
function normalizeTemplateCategory(value) {
|
|
132
|
+
return resolveTemplateCategory(value) ?? DEFAULT_TEMPLATE_CATEGORY;
|
|
133
|
+
}
|
|
134
|
+
function templateCategoryStoredValues(category) {
|
|
135
|
+
const legacy = Object.keys(LEGACY_TEMPLATE_CATEGORIES).filter((value) => LEGACY_TEMPLATE_CATEGORIES[value] === category);
|
|
136
|
+
return [category, ...legacy];
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
export { DEFAULT_TEMPLATE_CATEGORY, HANDLE_PORT_SEPARATOR, INPUT_FIELD_MAP2 as INPUT_FIELD_MAP, LEGACY_TEMPLATE_CATEGORIES, OAUTH_SCOPES, OUTPUT_FIELD_MAP, RECAST_SEGMENT_PACKS, TEMPLATE_CATEGORIES, applyHandleInputOverride, findRestrictedPickerValue, isHandleInputWired, isTemplateCategory, mergeExposedSettings, normalizeTemplateCategory, parseHandleId, resolveTemplateCategory, templateCategoryStoredValues };
|
|
140
|
+
//# sourceMappingURL=chunk-OTATNBMD.js.map
|
|
141
|
+
//# sourceMappingURL=chunk-OTATNBMD.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/picker-restrictions.ts","../src/component-types.ts","../src/oauth-scopes.ts","../src/recast-segment-packs.ts","../src/template-categories.ts"],"names":["INPUT_FIELD_MAP"],"mappings":";;;AAYA,IAAM,QAAA,GAAW,CAAC,CAAA,KAAA,CACf,KAAA,CAAM,QAAQ,CAAC,CAAA,GAAI,CAAA,GAAI,CAAC,CAAC,CAAA,EAAG,OAAO,CAAC,CAAA,KAAM,MAAM,MAAA,IAAa,CAAA,KAAM,QAAQ,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AAA,EAAgE;AACtG,EAAA,IAAI,KAAA,IAAS,MAAM,OAAO,MAAA;AAC1B,EAAA,IAAI,kBAAA,CAAmB,KAAK,CAAA,EAAG,OAAO,KAAA;AACtC,EAAA,OAAO,2BAA2B,KAAK,CAAA;AACzC;AAGO,SAAS,0BAA0B,KAAA,EAAoD;AAC5F,EAAA,OAAO,uBAAA,CAAwB,KAAK,CAAA,IAAK,yBAAA;AAC3C;AAOO,SAAS,6BAA6B,QAAA,EAAsC;AACjF,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,IAAA,CAAK,0BAA0B,CAAA,CAAE,MAAA,CAAO,CAAC,KAAA,KAAU,0BAAA,CAA2B,KAAK,CAAA,KAAM,QAAQ,CAAA;AACvH,EAAA,OAAO,CAAC,QAAA,EAAU,GAAG,MAAM,CAAA;AAC7B","file":"chunk-OTATNBMD.js","sourcesContent":["import { canonicalExposedFieldKey } from \"./exposed-field-keys.js\"\nimport { INPUT_FIELD_MAP } from \"./presentation-utils.js\"\n\n/** What an app's picker card may restrict (stored in `presentationSettings.cardMeta[nodeId]`). */\nexport interface PickerCardRestrictions {\n readonly pickerAllowedValues?: readonly string[]\n readonly pickerAllowedValuesByField?: Readonly<Record<string, readonly string[]>>\n}\n\n// Every submitted value is checked, whatever its type — a number or object where a\n// catalog id belongs must be refused, not skipped. An unset / cleared pick (\"\" , null)\n// is no selection and passes (the node falls back to its default).\nconst valuesOf = (v: unknown): string[] =>\n (Array.isArray(v) ? v : [v]).filter((x) => x !== undefined && x !== null && x !== \"\").map(String)\n\n/**\n * The first submitted picker value an app's card restrictions forbid, as the\n * runner's 400 text; null when all pass. Runs on every app run — `run_app`,\n * the SDK and a hand-built body included — so a restriction is never UI-only.\n * A submitted key is read through `canonicalExposedFieldKey`, so a legacy\n * spelling cannot slip past a restriction written against the current field.\n */\nexport function findRestrictedPickerValue(input: {\n readonly cardMeta: Readonly<Record<string, PickerCardRestrictions | undefined>> | undefined\n readonly nodes: ReadonlyArray<{ readonly id: string; readonly type?: string }>\n readonly inputValues: Readonly<Record<string, Readonly<Record<string, unknown>>>> | undefined\n}): string | null {\n if (!input.cardMeta || !input.inputValues) return null\n for (const node of input.nodes) {\n const meta = input.cardMeta[node.id]\n const submitted = input.inputValues[node.id]\n if (!meta || !submitted) continue\n const rules: Array<[string, readonly string[]]> = []\n const rep = node.type ? INPUT_FIELD_MAP[node.type]?.key : undefined\n if (rep && meta.pickerAllowedValues && meta.pickerAllowedValues.length > 0) rules.push([rep, meta.pickerAllowedValues])\n for (const [field, allowed] of Object.entries(meta.pickerAllowedValuesByField ?? {})) {\n if (allowed.length > 0) rules.push([field, allowed])\n }\n for (const [field, allowed] of rules) {\n for (const [key, raw] of Object.entries(submitted)) {\n if (canonicalExposedFieldKey(node.type, key) !== field) continue\n for (const value of valuesOf(raw)) {\n if (!allowed.includes(value)) return `Invalid value for ${field}: ${value}. Allowed: ${allowed.join(\", \")}`\n }\n }\n }\n }\n return null\n}\n","import { INPUT_FIELD_MAP as PRESENTATION_INPUT_MAP } from \"./presentation-utils.js\"\n\nexport interface ComponentHandle {\n id: string\n name: string\n type: \"image\" | \"video\" | \"audio\" | \"text\"\n required: boolean\n mediaPreview?: boolean\n fieldKey: string\n}\n\nexport interface ExposedSetting {\n nodeId: string\n field: string\n label: string\n type: \"select\" | \"text\" | \"number\" | \"toggle\" | \"aspect-ratio\"\n allowedValues?: unknown[]\n /** Full option list with labels for select fields (preferred over allowedValues). */\n options?: Array<{ value: string; label: string }>\n defaultValue: unknown\n /**\n * Set when the setting is one of the node's quick settings (the editor's bottom-bar levers): the node type,\n * so the consuming workflow can render the same control, and the node's own lever values its choices depend\n * on (its model, Draft, …), so the control offers what that model takes. Never prompts or results.\n */\n quick?: {\n nodeType: string\n context?: Record<string, string | number | boolean>\n }\n}\n\nexport interface ComponentMetadata {\n inputs: ComponentHandle[]\n outputs: ComponentHandle[]\n exposedSettings: ExposedSetting[]\n}\n\n/** Maps input node types to their data field key for inputOverrides (derived from presentation-utils) */\nexport const INPUT_FIELD_MAP: Record<string, string> = Object.fromEntries(\n Object.entries(PRESENTATION_INPUT_MAP).map(([k, v]) => [k, v.key]),\n)\n\n/** Separator used in component handle ids that target a specific port on a sub-workflow-input / sub-workflow-output node. */\nexport const HANDLE_PORT_SEPARATOR = \"::\"\n\n/**\n * Split a component handle id of the form `nodeId` or `nodeId::portId`.\n * Returns the literal nodeId when no separator is present.\n */\nexport function parseHandleId(handleId: string): { nodeId: string; portId?: string } {\n const sep = handleId.indexOf(HANDLE_PORT_SEPARATOR)\n if (sep < 0) return { nodeId: handleId }\n const portId = handleId.slice(sep + HANDLE_PORT_SEPARATOR.length)\n return { nodeId: handleId.slice(0, sep), portId: portId || undefined }\n}\n\n/**\n * Apply a value for a component input handle to the inputOverrides map.\n *\n * - Plain handles (id = nodeId) write to `inputOverrides[nodeId][fieldKey]`,\n * which the orchestrator shallow-merges into `node.data` at execution.\n * - Compound handles (id = nodeId::portId) write into\n * `inputOverrides[nodeId].__injectedPortValues[portId]`, the slot that\n * sub-workflow-input nodes read at runtime via output-extractor.\n *\n * Mutates the map in place so multi-port accumulation merges correctly when\n * iterating handles in a loop.\n */\nexport function applyHandleInputOverride(\n inputOverrides: Record<string, Record<string, unknown>>,\n handle: { id: string; fieldKey: string },\n value: unknown,\n): void {\n const { nodeId, portId } = parseHandleId(handle.id)\n if (portId) {\n const existing = (inputOverrides[nodeId]?.__injectedPortValues as Record<string, unknown> | undefined) ?? {}\n inputOverrides[nodeId] = {\n ...inputOverrides[nodeId],\n __injectedPortValues: { ...existing, [portId]: value },\n }\n } else {\n inputOverrides[nodeId] = { ...inputOverrides[nodeId], [handle.fieldKey]: value }\n }\n}\n\n/**\n * Has a value already been recorded for this handle in the inputOverrides map?\n * Used to skip fallback wiring when an upstream connection already supplied\n * the input.\n */\nexport function isHandleInputWired(\n inputOverrides: Record<string, Record<string, unknown>>,\n handle: { id: string; fieldKey: string },\n): boolean {\n const { nodeId, portId } = parseHandleId(handle.id)\n if (portId) {\n const injected = inputOverrides[nodeId]?.__injectedPortValues as Record<string, unknown> | undefined\n return injected?.[portId] !== undefined\n }\n return inputOverrides[nodeId]?.[handle.fieldKey] !== undefined\n}\n\n/** Maps output media types to NodeOutput field keys */\nexport const OUTPUT_FIELD_MAP: Record<string, string> = {\n image: \"imageUrl\",\n video: \"videoUrl\",\n audio: \"audioUrl\",\n text: \"text\",\n}\n\n/**\n * Merge exposed settings into inputOverrides format.\n * exposedSettings is keyed by \"nodeId:field\" -> value on the component node data.\n *\n * Connected inputs (already present in inputOverrides) always take priority\n * over exposed settings for the same node+field combination. This ensures\n * that mandatory upstream wires are never silently overwritten by stale\n * default / user-configured exposed-setting values.\n */\nexport function mergeExposedSettings(\n inputOverrides: Record<string, Record<string, unknown>>,\n exposedSettings: Record<string, unknown>,\n metadata: ComponentMetadata,\n): Record<string, Record<string, unknown>> {\n const merged = { ...inputOverrides }\n for (const setting of metadata.exposedSettings) {\n const key = `${setting.nodeId}:${setting.field}`\n const value = exposedSettings[key]\n if (value !== undefined) {\n // Skip if a connected input already provided this field\n if (merged[setting.nodeId]?.[setting.field] !== undefined) continue\n merged[setting.nodeId] = { ...merged[setting.nodeId], [setting.field]: value }\n }\n }\n return merged\n}\n","/**\n * The OAuth scopes a Nodaro token can carry — part of the public API contract\n * (published in the authorization server's `scopes_supported`, requested by\n * developer apps, typed in `@nodaro/sdk`). The server validates against this\n * list and the SDK types against it, so the two cannot drift.\n *\n * A scope in this list is published and handed to any Dynamic Client\n * Registration client that asks for everything, so add one in the same change\n * that makes something check it (see backend/src/lib/scopes.ts).\n */\nexport const OAUTH_SCOPES = [\n \"workflows:read\",\n \"workflows:write\",\n \"workflows:execute\",\n \"jobs:read\",\n \"assets:read\",\n \"assets:write\",\n \"credits:read\",\n \"apps:read\",\n \"pipelines:read\",\n \"pipelines:execute\",\n \"pipelines:approve\",\n \"presets:read\",\n \"workspaces:read\",\n \"workspaces:write\",\n] as const\n\nexport type OAuthScope = (typeof OAUTH_SCOPES)[number]\n","/**\n * How a recast render packs scenes into parts — the values `segmentSec` takes\n * on `POST /v1/recast`, `/v1/recast/estimate` and `/v1/recast/:id/start`. A\n * name, not seconds, despite the field's name:\n *\n * - `\"scenes-max\"` (Long): whole scenes grouped into as few parts as fit, the\n * fewest seams.\n * - `\"scenes\"` (Short): whole scenes in shorter parts.\n * - `\"max\"`: the longest parts the model allows, not grouped by scene.\n */\nexport const RECAST_SEGMENT_PACKS = [\"max\", \"scenes-max\", \"scenes\"] as const\n\nexport type RecastSegmentPack = (typeof RECAST_SEGMENT_PACKS)[number]\n","/**\n * The use cases a marketplace template is filed under — exactly one each.\n * Shared by the publish/browse routes (the `category` enum), the Templates\n * page (tiles, URL filter, labels) and the publish dialog, so the list can\n * only change in one place. Labels live with the frontend's i18n\n * (`lib/template-categories.ts`), keyed by these values.\n */\nexport const TEMPLATE_CATEGORIES = [\n \"product-imagery\",\n \"static-ads\",\n \"user-generated-content\",\n \"video-ads\",\n \"brand-assets\",\n \"automations\",\n \"campaign-concepts\",\n \"social-creatives\",\n] as const\n\nexport type TemplateCategory = (typeof TEMPLATE_CATEGORIES)[number]\n\n/** Where a template with no usable category is filed: the plain \"it is a workflow\" bucket. */\nexport const DEFAULT_TEMPLATE_CATEGORY: TemplateCategory = \"automations\"\n\n/**\n * The categories templates were filed under before September 2026, each\n * read as its new home. Migration 423 rewrites the rows with the same map;\n * this keeps an old link (`?category=video-production`), a cached card and a\n * row the migration has not reached yet resolving in the meantime.\n */\nexport const LEGACY_TEMPLATE_CATEGORIES: Readonly<Record<string, TemplateCategory>> = {\n \"image-generation\": \"product-imagery\",\n \"video-production\": \"video-ads\",\n \"audio-music\": \"social-creatives\",\n \"content-writing\": \"campaign-concepts\",\n \"social-media\": \"social-creatives\",\n \"data-processing\": \"automations\",\n \"multi-step\": \"automations\",\n other: \"automations\",\n}\n\nconst CURRENT = new Set<string>(TEMPLATE_CATEGORIES)\n\nexport function isTemplateCategory(value: unknown): value is TemplateCategory {\n return typeof value === \"string\" && CURRENT.has(value)\n}\n\n/** A current category as is, a legacy one as its new home, anything else as undefined. */\nexport function resolveTemplateCategory(value: string | null | undefined): TemplateCategory | undefined {\n if (value == null) return undefined\n if (isTemplateCategory(value)) return value\n return LEGACY_TEMPLATE_CATEGORIES[value]\n}\n\n/** The category a stored row reads as: resolved, else the default bucket. */\nexport function normalizeTemplateCategory(value: string | null | undefined): TemplateCategory {\n return resolveTemplateCategory(value) ?? DEFAULT_TEMPLATE_CATEGORY\n}\n\n/**\n * Every stored value that reads as `category` — the value itself and the\n * legacy ones that map to it — so a database filter matches rows the\n * migration has not rewritten yet.\n */\nexport function templateCategoryStoredValues(category: TemplateCategory): string[] {\n const legacy = Object.keys(LEGACY_TEMPLATE_CATEGORIES).filter((value) => LEGACY_TEMPLATE_CATEGORIES[value] === category)\n return [category, ...legacy]\n}\n"]}
|