@nodaro/shared 3.60.1 → 3.62.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-5Y42RIGY.cjs → chunk-2D5LQFV4.cjs} +18 -332
- package/dist/chunk-2D5LQFV4.cjs.map +1 -0
- package/dist/{chunk-5G23AJBU.cjs → chunk-2HZGDZZN.cjs} +6 -6
- package/dist/{chunk-5G23AJBU.cjs.map → chunk-2HZGDZZN.cjs.map} +1 -1
- package/dist/{chunk-DS2TOM32.js → chunk-2QKF7M2Z.js} +28 -4
- package/dist/chunk-2QKF7M2Z.js.map +1 -0
- package/dist/{chunk-CIOXUPCJ.cjs → chunk-2W745U4A.cjs} +228 -355
- package/dist/chunk-2W745U4A.cjs.map +1 -0
- package/dist/{chunk-LN3EVFRS.js → chunk-3OYO3XCC.js} +70 -6
- package/dist/chunk-3OYO3XCC.js.map +1 -0
- package/dist/{chunk-5HK5Z5OB.cjs → chunk-4ZEFP2FQ.cjs} +4 -4
- package/dist/{chunk-5HK5Z5OB.cjs.map → chunk-4ZEFP2FQ.cjs.map} +1 -1
- package/dist/{chunk-KOLC7AF2.js → chunk-5YYN5X57.js} +398 -38
- package/dist/chunk-5YYN5X57.js.map +1 -0
- package/dist/{chunk-RRPPXZ36.cjs → chunk-6CSXMWL4.cjs} +4 -4
- package/dist/{chunk-RRPPXZ36.cjs.map → chunk-6CSXMWL4.cjs.map} +1 -1
- package/dist/{chunk-M3SXUUWC.cjs → chunk-6FQBKI2A.cjs} +4 -11
- package/dist/chunk-6FQBKI2A.cjs.map +1 -0
- package/dist/{chunk-G4XWVWRI.js → chunk-6G7NN4S4.js} +5 -4
- package/dist/chunk-6G7NN4S4.js.map +1 -0
- package/dist/{chunk-HOKWJXHA.cjs → chunk-A2PX5IRC.cjs} +31 -4
- package/dist/chunk-A2PX5IRC.cjs.map +1 -0
- package/dist/{chunk-W4M7TNXG.cjs → chunk-AFYTX4AI.cjs} +52 -43
- package/dist/chunk-AFYTX4AI.cjs.map +1 -0
- package/dist/chunk-ALRXY4QH.cjs +13 -0
- package/dist/chunk-ALRXY4QH.cjs.map +1 -0
- package/dist/chunk-AOJ6B7K4.cjs +351 -0
- package/dist/chunk-AOJ6B7K4.cjs.map +1 -0
- package/dist/{chunk-KJZVQIN4.js → chunk-C7POAYFE.js} +3 -3
- package/dist/{chunk-KJZVQIN4.js.map → chunk-C7POAYFE.js.map} +1 -1
- package/dist/{chunk-6Q6SI7AG.js → chunk-CC4V2B7S.js} +3 -3
- package/dist/{chunk-6Q6SI7AG.js.map → chunk-CC4V2B7S.js.map} +1 -1
- package/dist/{chunk-GNPJ2JLE.cjs → chunk-CIPPPT7E.cjs} +6 -6
- package/dist/{chunk-GNPJ2JLE.cjs.map → chunk-CIPPPT7E.cjs.map} +1 -1
- package/dist/{chunk-6XVHYD5R.js → chunk-CLAKSLXF.js} +4 -9
- package/dist/chunk-CLAKSLXF.js.map +1 -0
- package/dist/chunk-CTANEPMY.js +61 -0
- package/dist/chunk-CTANEPMY.js.map +1 -0
- package/dist/{chunk-WGKAOUEQ.cjs → chunk-D34K455O.cjs} +3 -2
- package/dist/chunk-D34K455O.cjs.map +1 -0
- package/dist/chunk-E2HZTGYX.js +331 -0
- package/dist/chunk-E2HZTGYX.js.map +1 -0
- package/dist/{chunk-SKFJIFEV.cjs → chunk-G3KVK7OU.cjs} +21 -21
- package/dist/{chunk-SKFJIFEV.cjs.map → chunk-G3KVK7OU.cjs.map} +1 -1
- package/dist/chunk-G4U3HW6W.js +453 -0
- package/dist/chunk-G4U3HW6W.js.map +1 -0
- package/dist/{chunk-EN2YI5TV.js → chunk-GSFB537T.js} +3 -3
- package/dist/{chunk-EN2YI5TV.js.map → chunk-GSFB537T.js.map} +1 -1
- package/dist/chunk-HRY7KGAE.cjs +506 -0
- package/dist/chunk-HRY7KGAE.cjs.map +1 -0
- package/dist/{chunk-6AJOTEVC.js → chunk-I2RQB7VG.js} +3 -3
- package/dist/{chunk-6AJOTEVC.js.map → chunk-I2RQB7VG.js.map} +1 -1
- package/dist/chunk-IDTKF5EX.cjs +48 -0
- package/dist/chunk-IDTKF5EX.cjs.map +1 -0
- package/dist/{chunk-DQIJPDHC.cjs → chunk-IWWVPR3W.cjs} +88 -11
- package/dist/chunk-IWWVPR3W.cjs.map +1 -0
- package/dist/{chunk-URLDVK67.js → chunk-JJNNM23P.js} +3 -3
- package/dist/{chunk-URLDVK67.js.map → chunk-JJNNM23P.js.map} +1 -1
- package/dist/{chunk-YHVEZVAO.js → chunk-JZGZ26YB.js} +6 -306
- package/dist/chunk-JZGZ26YB.js.map +1 -0
- package/dist/{chunk-XROE3CAS.cjs → chunk-KHH54GRP.cjs} +120 -79
- package/dist/chunk-KHH54GRP.cjs.map +1 -0
- package/dist/{chunk-AXT7YNOR.cjs → chunk-KJSRPHJ2.cjs} +48 -47
- package/dist/chunk-KJSRPHJ2.cjs.map +1 -0
- package/dist/{chunk-FVVD6XY2.js → chunk-KL6GAYTT.js} +13 -4
- package/dist/chunk-KL6GAYTT.js.map +1 -0
- package/dist/{chunk-AFQFGZN7.cjs → chunk-KYMHFVAZ.cjs} +8 -6
- package/dist/chunk-KYMHFVAZ.cjs.map +1 -0
- package/dist/{chunk-A6HRY3WF.cjs → chunk-MYJQELFN.cjs} +420 -37
- package/dist/chunk-MYJQELFN.cjs.map +1 -0
- package/dist/chunk-N5HH46JF.cjs +68 -0
- package/dist/chunk-N5HH46JF.cjs.map +1 -0
- package/dist/{chunk-BXNPO3PL.cjs → chunk-N7OUQK7E.cjs} +8 -8
- package/dist/{chunk-BXNPO3PL.cjs.map → chunk-N7OUQK7E.cjs.map} +1 -1
- package/dist/{chunk-JKZVRKN3.js → chunk-NGKKNSK6.js} +31 -8
- package/dist/chunk-NGKKNSK6.js.map +1 -0
- package/dist/{chunk-SWVGHAYO.js → chunk-O7RZRUMZ.js} +110 -74
- package/dist/chunk-O7RZRUMZ.js.map +1 -0
- package/dist/{chunk-SCYBGTX6.js → chunk-PTD6EDUU.js} +3 -3
- package/dist/{chunk-SCYBGTX6.js.map → chunk-PTD6EDUU.js.map} +1 -1
- package/dist/{chunk-BDXXOEBZ.cjs → chunk-QWYFHQYK.cjs} +79 -54
- package/dist/chunk-QWYFHQYK.cjs.map +1 -0
- package/dist/{chunk-VB2ARGQ6.js → chunk-RGNHHIMN.js} +3 -3
- package/dist/chunk-RGNHHIMN.js.map +1 -0
- package/dist/{chunk-AZGONXWV.js → chunk-S24ZBUB4.js} +194 -299
- package/dist/chunk-S24ZBUB4.js.map +1 -0
- package/dist/{chunk-IV6IDECY.js → chunk-S5TMRJMX.js} +4 -4
- package/dist/{chunk-IV6IDECY.js.map → chunk-S5TMRJMX.js.map} +1 -1
- package/dist/chunk-SMOO5FAH.js +10 -0
- package/dist/chunk-SMOO5FAH.js.map +1 -0
- package/dist/{chunk-HYBACFYW.js → chunk-SYWR5G3T.js} +16 -7
- package/dist/chunk-SYWR5G3T.js.map +1 -0
- package/dist/{chunk-GWBQ3GPO.cjs → chunk-TRVWMKNE.cjs} +343 -53
- package/dist/chunk-TRVWMKNE.cjs.map +1 -0
- package/dist/{chunk-G6GMY5BC.js → chunk-UDDVDQMF.js} +298 -36
- package/dist/chunk-UDDVDQMF.js.map +1 -0
- package/dist/{chunk-PONP5J5E.cjs → chunk-V24EPI5N.cjs} +13 -3
- package/dist/chunk-V24EPI5N.cjs.map +1 -0
- package/dist/{chunk-HDHLZK7C.cjs → chunk-VACPZPUA.cjs} +5 -5
- package/dist/{chunk-HDHLZK7C.cjs.map → chunk-VACPZPUA.cjs.map} +1 -1
- package/dist/{chunk-ICDLYU4I.js → chunk-Y6X7UJSD.js} +10 -9
- package/dist/chunk-Y6X7UJSD.js.map +1 -0
- package/dist/chunk-YCXRSWCQ.js +42 -0
- package/dist/chunk-YCXRSWCQ.js.map +1 -0
- package/dist/entries/apps.cjs +44 -44
- package/dist/entries/apps.js +9 -9
- package/dist/entries/credits.cjs +217 -152
- package/dist/entries/credits.d.cts +112 -6
- package/dist/entries/credits.d.ts +112 -6
- package/dist/entries/credits.js +13 -8
- package/dist/entries/entities.cjs +188 -143
- package/dist/entries/entities.d.cts +122 -1
- package/dist/entries/entities.d.ts +122 -1
- package/dist/entries/entities.js +2 -1
- package/dist/entries/llm-models.d.cts +2 -1
- package/dist/entries/llm-models.d.ts +2 -1
- package/dist/entries/media.cjs +92 -87
- package/dist/entries/media.d.cts +11 -1
- package/dist/entries/media.d.ts +11 -1
- package/dist/entries/media.js +3 -2
- package/dist/entries/model-catalog.cjs +207 -99
- package/dist/entries/model-catalog.d.cts +90 -4
- package/dist/entries/model-catalog.d.ts +90 -4
- package/dist/entries/model-catalog.js +5 -5
- package/dist/entries/models.cjs +407 -294
- package/dist/entries/models.d.cts +4 -3
- package/dist/entries/models.d.ts +4 -3
- package/dist/entries/models.js +6 -5
- package/dist/entries/nodes.cjs +241 -233
- package/dist/entries/nodes.d.cts +15 -2
- package/dist/entries/nodes.d.ts +15 -2
- package/dist/entries/nodes.js +10 -10
- package/dist/entries/pipeline.cjs +152 -152
- package/dist/entries/pipeline.d.cts +2 -1
- package/dist/entries/pipeline.d.ts +2 -1
- package/dist/entries/pipeline.js +3 -3
- package/dist/entries/ugc.cjs +71 -71
- package/dist/entries/ugc.js +4 -4
- package/dist/entries/video.cjs +308 -204
- package/dist/entries/video.d.cts +480 -98
- package/dist/entries/video.d.ts +480 -98
- package/dist/entries/video.js +8 -4
- package/dist/entries/workflow.cjs +111 -99
- package/dist/entries/workflow.d.cts +29 -2
- package/dist/entries/workflow.d.ts +29 -2
- package/dist/entries/workflow.js +2 -2
- package/dist/{gpt-image-2-6-BeZdT-pW.d.cts → gpt-image-2-6-jIRQBRag.d.cts} +6 -0
- package/dist/{gpt-image-2-6-BeZdT-pW.d.ts → gpt-image-2-6-jIRQBRag.d.ts} +6 -0
- package/dist/index.cjs +2321 -1870
- package/dist/index.d.cts +10 -10
- package/dist/index.d.ts +10 -10
- package/dist/index.js +26 -23
- package/dist/{model-catalog-D6Es7VG-.d.cts → model-catalog-CCEcv08q.d.cts} +179 -14
- package/dist/{model-catalog-D6Es7VG-.d.ts → model-catalog-CCEcv08q.d.ts} +179 -14
- package/dist/{model-constants-22k3fjp1.d.cts → model-constants-B88p6XR0.d.ts} +305 -20
- package/dist/{model-constants-22k3fjp1.d.ts → model-constants-Cf3zaITt.d.cts} +305 -20
- package/package.json +1 -1
- package/src/__tests__/extend-providers.test.ts +114 -0
- package/src/__tests__/fixtures/mask-composite-quote-parity.json +118 -0
- package/src/__tests__/fixtures/root-exports.baseline.json +68 -0
- package/src/__tests__/gpt-image-2-6-formats.test.ts +4 -1
- package/src/__tests__/gpt-image-2-6.test.ts +7 -0
- package/src/__tests__/grok-video-15-catalog.test.ts +189 -0
- package/src/__tests__/gvp-supported-providers.test.ts +5 -2
- package/src/__tests__/image-mask-mode.test.ts +34 -1
- package/src/__tests__/mask-edit-follows-source.test.ts +150 -0
- package/src/__tests__/minimax-h3-image.test.ts +140 -0
- package/src/__tests__/model-makers.test.ts +49 -11
- package/src/__tests__/model-tree.test.ts +13 -0
- package/src/__tests__/retired-video-provider.test.ts +15 -5
- package/src/__tests__/seedance-25-catalog-modes.test.ts +1 -1
- package/src/__tests__/seedance-task-type.test.ts +178 -0
- package/src/__tests__/seedream-5-5.test.ts +117 -0
- package/src/__tests__/unit-contract-compose.test.ts +27 -1
- package/src/__tests__/unit-contracts.test.ts +20 -6
- package/src/__tests__/upscale-factors.test.ts +107 -0
- package/src/__tests__/video-character-refs.test.ts +20 -2
- package/src/__tests__/video-collapse-parity.test.ts +19 -0
- package/src/__tests__/video-overlay-geometry.test.ts +68 -0
- package/src/__tests__/video-overlay-layer-plan.test.ts +3 -4
- package/src/__tests__/video-overlay-layouts.test.ts +529 -0
- package/src/__tests__/video-overlay-pricing.test.ts +61 -0
- package/src/__tests__/video-overlay-validate.test.ts +128 -0
- package/src/__tests__/video-overlay-wired-kind.test.ts +207 -0
- package/src/__tests__/video-overlay.test.ts +280 -194
- package/src/__tests__/video-ref-limits.test.ts +2 -1
- package/src/__tests__/video-reference-only.test.ts +6 -2
- package/src/__tests__/video-start-frame-only.test.ts +98 -0
- package/src/__tests__/wired-character-names.test.ts +220 -0
- package/src/credit-estimators/index.ts +8 -0
- package/src/credit-estimators/video-overlay.ts +70 -0
- package/src/credit-identifiers.ts +102 -5
- package/src/entity-image-url.ts +21 -0
- package/src/entries/credits.ts +14 -0
- package/src/entries/entities.ts +14 -0
- package/src/entries/model-catalog.ts +39 -1
- package/src/entries/models.ts +34 -0
- package/src/entries/nodes.ts +2 -0
- package/src/entries/video.ts +6 -0
- package/src/entries/workflow.ts +1 -0
- package/src/generated/unit-contracts.ts +8 -1
- package/src/gpt-image-2-6.ts +6 -0
- package/src/input-image-pricing.ts +76 -0
- package/src/mask-composite.ts +11 -0
- package/src/minimax-h3-image.ts +61 -0
- package/src/model-catalog.ts +512 -48
- package/src/model-constants.ts +602 -34
- package/src/node-default-mappings.ts +12 -2
- package/src/node-execution-state.ts +4 -1
- package/src/producer-types.ts +23 -1
- package/src/seedance-task-type.ts +37 -0
- package/src/seedream-5-5.ts +45 -0
- package/src/unit-contract-compose.ts +4 -1
- package/src/upscale-factors.ts +111 -0
- package/src/video-character-refs.ts +7 -4
- package/src/video-overlay-geometry.ts +99 -0
- package/src/video-overlay-input.ts +25 -0
- package/src/video-overlay-layout-ids.ts +48 -0
- package/src/video-overlay-layouts.ts +315 -0
- package/src/video-overlay-validate.ts +223 -0
- package/src/video-overlay-video-layers.ts +304 -0
- package/src/video-overlay.ts +165 -297
- package/src/video-ui-defaults.ts +8 -6
- package/src/wired-character-names.ts +202 -0
- package/src/wired-image-size.ts +55 -0
- package/dist/chunk-5Y42RIGY.cjs.map +0 -1
- package/dist/chunk-6XVHYD5R.js.map +0 -1
- package/dist/chunk-A6HRY3WF.cjs.map +0 -1
- package/dist/chunk-AFQFGZN7.cjs.map +0 -1
- package/dist/chunk-AXT7YNOR.cjs.map +0 -1
- package/dist/chunk-AZGONXWV.js.map +0 -1
- package/dist/chunk-BDXXOEBZ.cjs.map +0 -1
- package/dist/chunk-CIOXUPCJ.cjs.map +0 -1
- package/dist/chunk-DQIJPDHC.cjs.map +0 -1
- package/dist/chunk-DS2TOM32.js.map +0 -1
- package/dist/chunk-FVVD6XY2.js.map +0 -1
- package/dist/chunk-G4XWVWRI.js.map +0 -1
- package/dist/chunk-G6GMY5BC.js.map +0 -1
- package/dist/chunk-G7ZYZQKO.cjs +0 -27
- package/dist/chunk-G7ZYZQKO.cjs.map +0 -1
- package/dist/chunk-GWBQ3GPO.cjs.map +0 -1
- package/dist/chunk-HNEF2N5C.cjs +0 -19
- package/dist/chunk-HNEF2N5C.cjs.map +0 -1
- package/dist/chunk-HOKWJXHA.cjs.map +0 -1
- package/dist/chunk-HYBACFYW.js.map +0 -1
- package/dist/chunk-ICDLYU4I.js.map +0 -1
- package/dist/chunk-JKZVRKN3.js.map +0 -1
- package/dist/chunk-KOLC7AF2.js.map +0 -1
- package/dist/chunk-LN3EVFRS.js.map +0 -1
- package/dist/chunk-M3SXUUWC.cjs.map +0 -1
- package/dist/chunk-MHY47BLL.js +0 -23
- package/dist/chunk-MHY47BLL.js.map +0 -1
- package/dist/chunk-PONP5J5E.cjs.map +0 -1
- package/dist/chunk-SWVGHAYO.js.map +0 -1
- package/dist/chunk-VB2ARGQ6.js.map +0 -1
- package/dist/chunk-VYQ25YQF.js +0 -17
- package/dist/chunk-VYQ25YQF.js.map +0 -1
- package/dist/chunk-W4M7TNXG.cjs.map +0 -1
- package/dist/chunk-WGKAOUEQ.cjs.map +0 -1
- package/dist/chunk-XROE3CAS.cjs.map +0 -1
- package/dist/chunk-YHVEZVAO.js.map +0 -1
|
@@ -1 +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,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,OAAA,GAAU,IAAI,GAAA,CAAY,mBAAmB,CAAA;AAE5C,SAAS,mBAAmB,KAAA,EAA2C;AAC5E,EAAA,OAAO,OAAO,KAAA,KAAU,QAAA,IAAY,OAAA,CAAQ,IAAI,KAAK,CAAA;AACvD;AAGO,SAAS,wBAAwB,KAAA,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-6Q6SI7AG.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 // Workflows an AI agent built through the MCP server, kept whole so every step can be opened and changed.\n \"mcp\",\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"]}
|
|
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,CAAA,KAAM,EAAE,CAAA,CAAE,GAAA,CAAI,MAAM,CAAA;AAS3F,SAAS,0BAA0B,KAAA,EAIxB;AAChB,EAAA,IAAI,CAAC,KAAA,CAAM,QAAA,IAAY,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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-CC4V2B7S.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 // Workflows an AI agent built through the MCP server, kept whole so every step can be opened and changed.\n \"mcp\",\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"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunk2D5LQFV4_cjs = require('./chunk-2D5LQFV4.cjs');
|
|
4
4
|
|
|
5
5
|
// src/picker-restrictions.ts
|
|
6
6
|
var valuesOf = (v) => (Array.isArray(v) ? v : [v]).filter((x) => x !== void 0 && x !== null && x !== "").map(String);
|
|
@@ -11,14 +11,14 @@ function findRestrictedPickerValue(input) {
|
|
|
11
11
|
const submitted = input.inputValues[node.id];
|
|
12
12
|
if (!meta || !submitted) continue;
|
|
13
13
|
const rules = [];
|
|
14
|
-
const rep = node.type ?
|
|
14
|
+
const rep = node.type ? chunk2D5LQFV4_cjs.INPUT_FIELD_MAP[node.type]?.key : void 0;
|
|
15
15
|
if (rep && meta.pickerAllowedValues && meta.pickerAllowedValues.length > 0) rules.push([rep, meta.pickerAllowedValues]);
|
|
16
16
|
for (const [field, allowed] of Object.entries(meta.pickerAllowedValuesByField ?? {})) {
|
|
17
17
|
if (allowed.length > 0) rules.push([field, allowed]);
|
|
18
18
|
}
|
|
19
19
|
for (const [field, allowed] of rules) {
|
|
20
20
|
for (const [key, raw] of Object.entries(submitted)) {
|
|
21
|
-
if (
|
|
21
|
+
if (chunk2D5LQFV4_cjs.canonicalExposedFieldKey(node.type, key) !== field) continue;
|
|
22
22
|
for (const value of valuesOf(raw)) {
|
|
23
23
|
if (!allowed.includes(value)) return `Invalid value for ${field}: ${value}. Allowed: ${allowed.join(", ")}`;
|
|
24
24
|
}
|
|
@@ -30,7 +30,7 @@ function findRestrictedPickerValue(input) {
|
|
|
30
30
|
|
|
31
31
|
// src/component-types.ts
|
|
32
32
|
var INPUT_FIELD_MAP2 = Object.fromEntries(
|
|
33
|
-
Object.entries(
|
|
33
|
+
Object.entries(chunk2D5LQFV4_cjs.INPUT_FIELD_MAP).map(([k, v]) => [k, v.key])
|
|
34
34
|
);
|
|
35
35
|
var HANDLE_PORT_SEPARATOR = "::";
|
|
36
36
|
function parseHandleId(handleId) {
|
|
@@ -157,5 +157,5 @@ exports.normalizeTemplateCategory = normalizeTemplateCategory;
|
|
|
157
157
|
exports.parseHandleId = parseHandleId;
|
|
158
158
|
exports.resolveTemplateCategory = resolveTemplateCategory;
|
|
159
159
|
exports.templateCategoryStoredValues = templateCategoryStoredValues;
|
|
160
|
-
//# sourceMappingURL=chunk-
|
|
161
|
-
//# sourceMappingURL=chunk-
|
|
160
|
+
//# sourceMappingURL=chunk-CIPPPT7E.cjs.map
|
|
161
|
+
//# sourceMappingURL=chunk-CIPPPT7E.cjs.map
|
|
@@ -1 +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","canonicalExposedFieldKey"],"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,CAAA,KAAM,EAAE,CAAA,CAAE,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AA,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-GNPJ2JLE.cjs","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 // Workflows an AI agent built through the MCP server, kept whole so every step can be opened and changed.\n \"mcp\",\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"]}
|
|
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","canonicalExposedFieldKey"],"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,CAAA,KAAM,EAAE,CAAA,CAAE,GAAA,CAAI,MAAM,CAAA;AAS3F,SAAS,0BAA0B,KAAA,EAIxB;AAChB,EAAA,IAAI,CAAC,KAAA,CAAM,QAAA,IAAY,CAAC,KAAA,CAAM,aAAa,OAAO,IAAA;AAClD,EAAA,KAAA,MAAW,IAAA,IAAQ,MAAM,KAAA,EAAO;AAC9B,IAAA,MAAM,IAAA,GAAO,KAAA,CAAM,QAAA,CAAS,IAAA,CAAK,EAAE,CAAA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S,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-CIPPPT7E.cjs","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 // Workflows an AI agent built through the MCP server, kept whole so every step can be opened and changed.\n \"mcp\",\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"]}
|
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
var CLIP_PRICE_GRACE_SEC = 0.05;
|
|
3
|
-
var FLOAT_NOISE_SEC = 1e-9;
|
|
4
|
-
function pricedClipSeconds(sec) {
|
|
5
|
-
return Math.max(1, Math.ceil(sec - CLIP_PRICE_GRACE_SEC - FLOAT_NOISE_SEC));
|
|
6
|
-
}
|
|
1
|
+
import { pricedClipSeconds } from './chunk-SMOO5FAH.js';
|
|
7
2
|
|
|
8
3
|
// src/video-depth.ts
|
|
9
4
|
var VIDEO_DEPTH_PROVIDERS = ["video-depth-anything", "depth-anything-frames"];
|
|
@@ -85,6 +80,6 @@ function videoDepthCreditId(provider, durationSec) {
|
|
|
85
80
|
return `${provider}:${known ? pricedClipSeconds(durationSec) : maxSec}s`;
|
|
86
81
|
}
|
|
87
82
|
|
|
88
|
-
export {
|
|
89
|
-
//# sourceMappingURL=chunk-
|
|
90
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
export { FAL_VIDEO_DEPTH_PROVIDERS, REPLICATE_VIDEO_DEPTH_PROVIDERS, VIDEO_DEPTH_BUCKETS, VIDEO_DEPTH_COLORMAPS, VIDEO_DEPTH_LIMITS, VIDEO_DEPTH_MODEL_SIZES, VIDEO_DEPTH_PROVIDERS, VIDEO_DEPTH_RESOLUTIONS, checkVideoDepthLength, resolveVideoDepthColormap, resolveVideoDepthModelSize, resolveVideoDepthProvider, videoDepthColormaps, videoDepthCreditId, videoDepthLevers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AAM,sBAAsB,CAAC,EAAA,EAAI,EAAA,EAAI,EAAA,EAAI,KAAK,GAAG;AAGxD,SAAS,qBAAqB,QAAA,EAA0B;AACtD,EAAA,OAAO,gCAAgC,GAAA,CAAI,QAAQ,CAAA,GAC/C,kBAAA,CAAmB,wBACnB,kBAAA,CAAmB,eAAA;AACzB;AAcO,SAAS,kBAAA,CAAmB,UAAkB,WAAA,EAAgD;AACnG,EAAA,MAAM,MAAA,GAAS,qBAAqB,QAAQ,CAAA;AAC5C,EAAA,MAAM,KAAA,GAAQ,OAAO,WAAA,KAAgB,QAAA,IAAY,MAAA,CAAO,SAAS,WAAW,CAAA,IAAK,WAAA,GAAc,CAAA,IAAK,WAAA,IAAe,MAAA;AACnH,EAAA,OAAO,GAAG,QAAQ,CAAA,CAAA,EAAI,QAAQ,iBAAA,CAAkB,WAAW,IAAI,MAAM,CAAA,CAAA,CAAA;AACvE","file":"chunk-CLAKSLXF.js","sourcesContent":["/**\n * Video Depth — the one contract every layer reads: which providers exist and\n * which lane serves each, which optional levers a provider honours, how long a\n * clip may be, and which price row a run is charged from.\n *\n * Colormaps: fal renders every `VIDEO_DEPTH_COLORMAPS` entry natively. The\n * Replicate model's native output is inferno-colorized, so it offers only\n * `inferno` (passed through as-is) and `grayscale`, which a worker ffmpeg pass\n * produces from the inferno output (`videoDepthNeedsGrayscalePass`).\n *\n * Price rows are `model_pricing` rows (`<provider>:<n>s`); the credit amounts\n * live there, never here. Both providers have one row per whole second of the\n * clip, up to the longest clip each accepts. Worked examples (repeated in\n * docs/nodes/processing-video/video-depth.md):\n * video-depth-anything: 0.4 s → `:1s`, 9 s → `:9s`, 9.2 s → `:10s`, 15.015 s → `:15s`, 15.06 s → `:16s`.\n * depth-anything-frames: 0.4 s → `:1s`, 4 s → `:4s`, 4.1 s → `:5s`, 15.015 s → `:15s`, 15.06 s → `:16s`, 80 s → `:80s`.\n */\n\nimport { pricedClipSeconds } from \"./priced-clip-seconds.js\"\n\nexport const VIDEO_DEPTH_PROVIDERS = [\"video-depth-anything\", \"depth-anything-frames\"] as const\nexport type VideoDepthProvider = (typeof VIDEO_DEPTH_PROVIDERS)[number]\n\nexport const FAL_VIDEO_DEPTH_PROVIDERS: ReadonlySet<string> = new Set([\"video-depth-anything\"])\nexport const REPLICATE_VIDEO_DEPTH_PROVIDERS: ReadonlySet<string> = new Set([\"depth-anything-frames\"])\n\n/**\n * The provider a run uses: `raw` when it is a Video Depth provider, else the\n * default (the first entry). Raw workflow JSON or a FieldMapping can carry any\n * value; the dispatch, the model deny and the price row all read this one\n * resolution, so an unknown id never reaches a price row or slips the deny.\n */\nexport function resolveVideoDepthProvider(raw: unknown): VideoDepthProvider {\n return typeof raw === \"string\" && (VIDEO_DEPTH_PROVIDERS as readonly string[]).includes(raw)\n ? (raw as VideoDepthProvider)\n : VIDEO_DEPTH_PROVIDERS[0]\n}\n\nexport const VIDEO_DEPTH_MODEL_SIZES = [\"small\", \"base\", \"large\"] as const\nexport type VideoDepthModelSize = (typeof VIDEO_DEPTH_MODEL_SIZES)[number]\n\n/** The model size a run uses: `raw` when it is one, else `large` (the providers index lookup tables with it). */\nexport function resolveVideoDepthModelSize(raw: unknown): VideoDepthModelSize {\n return typeof raw === \"string\" && (VIDEO_DEPTH_MODEL_SIZES as readonly string[]).includes(raw)\n ? (raw as VideoDepthModelSize)\n : \"large\"\n}\nexport const VIDEO_DEPTH_COLORMAPS = [\"grayscale\", \"turbo\", \"inferno\", \"magma\", \"viridis\"] as const\nexport type VideoDepthColormap = (typeof VIDEO_DEPTH_COLORMAPS)[number]\nexport const VIDEO_DEPTH_RESOLUTIONS = [\"auto\", \"360p\", \"480p\", \"720p\", \"1080p\"] as const\nexport type VideoDepthResolution = (typeof VIDEO_DEPTH_RESOLUTIONS)[number]\n\nexport type VideoDepthLever = \"colormap\" | \"resolution\" | \"sideBySide\"\nconst ALL_LEVERS: ReadonlySet<VideoDepthLever> = new Set([\"colormap\", \"resolution\", \"sideBySide\"])\nconst COLORMAP_ONLY: ReadonlySet<VideoDepthLever> = new Set([\"colormap\"])\nconst NO_LEVERS: ReadonlySet<VideoDepthLever> = new Set()\n\n/** The optional levers `provider` honours. A lever absent here is dropped, never sent. */\nexport function videoDepthLevers(provider: string): ReadonlySet<VideoDepthLever> {\n if (FAL_VIDEO_DEPTH_PROVIDERS.has(provider)) return ALL_LEVERS\n if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) return COLORMAP_ONLY\n return NO_LEVERS\n}\n\nconst REPLICATE_COLORMAPS: readonly VideoDepthColormap[] = [\"grayscale\", \"inferno\"]\n\n/** The colormaps `provider` can deliver, in display order; empty when it has no colormap lever. */\nexport function videoDepthColormaps(provider: string): readonly VideoDepthColormap[] {\n if (FAL_VIDEO_DEPTH_PROVIDERS.has(provider)) return VIDEO_DEPTH_COLORMAPS\n if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) return REPLICATE_COLORMAPS\n return []\n}\n\n/** The colormap a run uses: the requested one when `provider` offers it, else `grayscale`; `undefined` when the provider has no colormap lever. Coerces, never throws. */\nexport function resolveVideoDepthColormap(provider: string, requested: unknown): VideoDepthColormap | undefined {\n if (!videoDepthLevers(provider).has(\"colormap\")) return undefined\n const offered = videoDepthColormaps(provider)\n return typeof requested === \"string\" && (offered as readonly string[]).includes(requested)\n ? (requested as VideoDepthColormap)\n : \"grayscale\"\n}\n\n/** True when the worker must turn the Replicate model's native inferno output into grayscale with ffmpeg. */\nexport function videoDepthNeedsGrayscalePass(provider: string, colormap: VideoDepthColormap | undefined): boolean {\n return REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider) && resolveVideoDepthColormap(provider, colormap) === \"grayscale\"\n}\n\nexport const VIDEO_DEPTH_LIMITS = {\n /** fal `max_frames` ceiling. */\n FAL_MAX_FRAMES: 2400,\n /** Longest clip the fal lane accepts, whatever its frame rate: its top price row, `:300s` (a low-fps clip under the frame limit can otherwise run past every price row). */\n FAL_MAX_SECONDS: 300,\n /** Frame rate assumed when the clip reports none (variable-rate or missing). */\n ASSUMED_FPS: 30,\n /** Longest clip the Replicate lane accepts. */\n REPLICATE_MAX_SECONDS: 80,\n} as const\n\nconst fmt = (n: number): string => n.toLocaleString(\"en-US\")\n\n/** Refuse a clip the provider cannot take — run BEFORE any credit reservation. */\nexport function checkVideoDepthLength(\n provider: string,\n probe: { durationSec: number; fps?: number },\n): { ok: true } | { ok: false; message: string } {\n if (REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)) {\n if (probe.durationSec <= VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS) return { ok: true }\n return {\n ok: false,\n message: `Video is ${Math.ceil(probe.durationSec)} s. This provider accepts at most ${VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS} s.`,\n }\n }\n if (probe.durationSec > VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS) {\n return {\n ok: false,\n message: `Video is ${Math.ceil(probe.durationSec)} s. This provider accepts at most ${VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS} s. Trim the clip and run again.`,\n }\n }\n const assumed = !(typeof probe.fps === \"number\" && probe.fps > 0)\n const fps = assumed ? VIDEO_DEPTH_LIMITS.ASSUMED_FPS : (probe.fps as number)\n const frames = Math.ceil(probe.durationSec * fps - 1e-9)\n if (frames <= VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES) return { ok: true }\n const maxSec = Math.floor(VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES / fps)\n return {\n ok: false,\n message:\n `Video is ${fmt(frames)} frames; the limit is ${fmt(VIDEO_DEPTH_LIMITS.FAL_MAX_FRAMES)} ` +\n `(about ${maxSec} s at ${Math.round(fps)} fps${assumed ? \", assumed 30 fps because the clip reports no frame rate\" : \"\"}). Trim the clip and run again.`,\n }\n}\n\n/**\n * The length buckets, in seconds, both providers were priced in before their\n * per-second rows. A row is no longer picked from these: a clip's whole seconds\n * name its row, so a `:15s` is the 15-second row and a `:120s` on Depth Anything\n * per frame is past its limit. Each per-second row took its admin switches from\n * the bucket that priced it (migrations 590 and 595).\n */\nexport const VIDEO_DEPTH_BUCKETS = [15, 30, 60, 120, 300] as const\n\n/** The longest clip `provider` accepts (`checkVideoDepthLength`); the fal limit for anything else. */\nfunction videoDepthMaxSeconds(provider: string): number {\n return REPLICATE_VIDEO_DEPTH_PROVIDERS.has(provider)\n ? VIDEO_DEPTH_LIMITS.REPLICATE_MAX_SECONDS\n : VIDEO_DEPTH_LIMITS.FAL_MAX_SECONDS\n}\n\n/**\n * The price row for a clip of `durationSec`.\n *\n * One row per whole second of the clip on both lanes: the clip's length rounded\n * UP (`pricedClipSeconds`: up to 0.05 s past a whole second is ignored first), so\n * a clip under one second is priced as one. `video-depth-anything:1s` … `:300s`\n * (decided 2026-11-03), `depth-anything-frames:1s` … `:80s` (decided 2026-11-04).\n *\n * Unknown, non-positive or longer than the provider accepts → the provider's\n * longest clip (fal `:300s`, Replicate `:80s`), its highest REACHABLE row — the\n * most a run on it can be charged, never a row a run could not reach.\n */\nexport function videoDepthCreditId(provider: string, durationSec: number | null | undefined): string {\n const maxSec = videoDepthMaxSeconds(provider)\n const known = typeof durationSec === \"number\" && Number.isFinite(durationSec) && durationSec > 0 && durationSec <= maxSec\n return `${provider}:${known ? pricedClipSeconds(durationSec) : maxSec}s`\n}\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// src/entity-image-handle.ts
|
|
2
|
+
var ENTITY_IMAGE_HANDLE_TYPES = /* @__PURE__ */ new Set([
|
|
3
|
+
"character",
|
|
4
|
+
"location",
|
|
5
|
+
"object",
|
|
6
|
+
"creature"
|
|
7
|
+
]);
|
|
8
|
+
var AGGREGATE_LANE_SOURCE_TYPES = /* @__PURE__ */ new Set(["group", "collect"]);
|
|
9
|
+
var AGGREGATE_LANE_EFFECTIVE_TYPE = {
|
|
10
|
+
"out-image": "upload-image",
|
|
11
|
+
"out-video": "upload-video",
|
|
12
|
+
"out-audio": "upload-audio",
|
|
13
|
+
"out-text": "list"
|
|
14
|
+
};
|
|
15
|
+
var SCRAPER_HANDLE_EFFECTIVE_TYPE = {
|
|
16
|
+
text: "combine-text",
|
|
17
|
+
image: "upload-image",
|
|
18
|
+
video: "upload-video"
|
|
19
|
+
};
|
|
20
|
+
var SCRAPER_SOURCE_TYPES = /* @__PURE__ */ new Set(["meta-ads-scrape", "instagram-scrape"]);
|
|
21
|
+
var OUTPUT_PIP_EFFECTIVE_TYPES = Object.freeze({
|
|
22
|
+
// UGC Creator's `image`: the creator's first image, for any image input.
|
|
23
|
+
"ugc-creator": Object.freeze({ image: "upload-image" }),
|
|
24
|
+
// Site Capture's `image`: its section stills — the first on a plain wire, each or all on an Each / Bundle wire.
|
|
25
|
+
"site-capture": Object.freeze({ image: "upload-image" }),
|
|
26
|
+
// The UGC nodes' plain-text pips — the script's product category, the clips'
|
|
27
|
+
// transcript, the cards' Notes — are one text each (`combine-text`: one
|
|
28
|
+
// string, not a list): they reach text and prompt inputs, never a JSON input.
|
|
29
|
+
"ugc-script": Object.freeze({ category: "combine-text" }),
|
|
30
|
+
"ugc-clips": Object.freeze({ transcript: "combine-text" }),
|
|
31
|
+
"ugc-cards": Object.freeze({ report: "combine-text" })
|
|
32
|
+
});
|
|
33
|
+
var own = (table, key) => Object.hasOwn(table, key) ? table[key] : void 0;
|
|
34
|
+
function outputPipSourceType(rawSourceType, sourceHandleId) {
|
|
35
|
+
const type = rawSourceType ?? "";
|
|
36
|
+
const pips = own(OUTPUT_PIP_EFFECTIVE_TYPES, type);
|
|
37
|
+
return (pips && typeof sourceHandleId === "string" ? own(pips, sourceHandleId) : void 0) ?? type;
|
|
38
|
+
}
|
|
39
|
+
function resolveEffectiveSourceType(rawSourceType, sourceHandleId) {
|
|
40
|
+
if (sourceHandleId === "image" && ENTITY_IMAGE_HANDLE_TYPES.has(rawSourceType ?? "")) {
|
|
41
|
+
return "upload-image";
|
|
42
|
+
}
|
|
43
|
+
const pipType = outputPipSourceType(rawSourceType, sourceHandleId);
|
|
44
|
+
if (pipType !== (rawSourceType ?? "")) return pipType;
|
|
45
|
+
if (AGGREGATE_LANE_SOURCE_TYPES.has(rawSourceType ?? "")) {
|
|
46
|
+
const effective = AGGREGATE_LANE_EFFECTIVE_TYPE[sourceHandleId ?? ""];
|
|
47
|
+
if (effective) return effective;
|
|
48
|
+
}
|
|
49
|
+
if (SCRAPER_SOURCE_TYPES.has(rawSourceType ?? "")) {
|
|
50
|
+
const effective = SCRAPER_HANDLE_EFFECTIVE_TYPE[sourceHandleId ?? ""];
|
|
51
|
+
if (effective) return effective;
|
|
52
|
+
}
|
|
53
|
+
return rawSourceType ?? "";
|
|
54
|
+
}
|
|
55
|
+
function sourceRefKey(nodeId, sourceHandleId, rawSourceType) {
|
|
56
|
+
return sourceHandleId === "image" && ENTITY_IMAGE_HANDLE_TYPES.has(rawSourceType ?? "") ? `${nodeId}::image` : nodeId;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export { AGGREGATE_LANE_SOURCE_TYPES, ENTITY_IMAGE_HANDLE_TYPES, OUTPUT_PIP_EFFECTIVE_TYPES, outputPipSourceType, resolveEffectiveSourceType, sourceRefKey };
|
|
60
|
+
//# sourceMappingURL=chunk-CTANEPMY.js.map
|
|
61
|
+
//# sourceMappingURL=chunk-CTANEPMY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/entity-image-handle.ts"],"names":[],"mappings":";AAcO,IAAM,yBAAA,uBAAqD,GAAA,CAAI;AAAA,EACpE,WAAA;AAAA,EACA,UAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAAC;AAWM,IAAM,8CAAmD,IAAI,GAAA,CAAI,CAAC,OAAA,EAAS,SAAS,CAAC;AAY5F,IAAM,6BAAA,GAAkE;AAAA,EACtE,WAAA,EAAa,cAAA;AAAA,EACb,WAAA,EAAa,cAAA;AAAA,EACb,WAAA,EAAa,cAAA;AAAA,EACb,UAAA,EAAY;AACd,CAAA;AAWA,IAAM,6BAAA,GAAkE;AAA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MAAM,OAAA,GAAU,mBAAA,CAAoB,aAAA,EAAe,cAAc,CAAA;AACjE,EAAA,IAAI,OAAA,MAAa,aAAA,IAAiB,EAAA,CAAA,EAAK,OAAO,OAAA;AAC9C,EAAA,IAAI,2BAAA,CAA4B,GAAA,CAAI,aAAA,IAAiB,EAAE,CAAA,EAAG;AACxD,IAAA,MAAM,SAAA,GAAY,6BAAA,CAA8B,cAAA,IAAkB,EAAE,CAAA;AACpE,IAAA,IAAI,WAAW,OAAO,SAAA;AAAA,EACxB;AACA,EAAA,IAAI,oBAAA,CAAqB,GAAA,CAAI,aAAA,IAAiB,EAAE,CAAA,EAAG;AACjD,IAAA,MAAM,SAAA,GAAY,6BAAA,CAA8B,cAAA,IAAkB,EAAE,CAAA;AACpE,IAAA,IAAI,WAAW,OAAO,SAAA;AAAA,EACxB;AACA,EAAA,OAAO,aAAA,IAAiB,EAAA;AAC1B;AAcO,SAAS,YAAA,CACd,MAAA,EACA,cAAA,EACA,aAAA,EACQ;AACR,EAAA,OAAO,cAAA,KAAmB,WAAW,yBAAA,CAA0B,GAAA,CAAI,iBAAiB,EAAE,CAAA,GAClF,CAAA,EAAG,MAAM,CAAA,OAAA,CAAA,GACT,MAAA;AACN","file":"chunk-CTANEPMY.js","sourcesContent":["/**\n * Entity node types that expose a plain `image` source handle (emitting the\n * portrait URL) in addition to their identity `*Ref` handle. When a wire leaves\n * the `image` handle, the entity is treated as a plain image PRODUCER\n * (substituted to \"upload-image\") so it reaches image inputs and lists exactly\n * like generate-image / upload-image, while the `*Ref` handle stays identity.\n *\n * SINGLE SOURCE OF TRUTH — consumed by:\n * - frontend connection validation (drop validator, drag-glow, popover),\n * - frontend run assemblers (execute-node, video-prompt-assembly),\n * - frontend config-panel reference preview builders,\n * - backend payload-builder identity-injection guards.\n * Add future per-handle output-type remaps HERE so every surface inherits them.\n */\nexport const ENTITY_IMAGE_HANDLE_TYPES: ReadonlySet<string> = new Set([\n \"character\",\n \"location\",\n \"object\",\n \"creature\",\n])\n\n/**\n * Aggregate node types (Group / Collect) whose source handles are typed LANES\n * — `out-text` / `out-image` / `out-video` / `out-audio` — each emitting that\n * media type. Like an entity's `image` handle, a wire leaving a lane is a plain\n * producer of that lane's type, so it must reach the typed inputs of every\n * consumer (Image Collage, Combine Videos, Merge Lists, prompts, …) exactly as\n * an upload node of that type would. Neither node type is in any producer set\n * itself: the NODE emits nothing, its LANES do.\n */\nexport const AGGREGATE_LANE_SOURCE_TYPES: ReadonlySet<string> = new Set([\"group\", \"collect\"])\n\n/**\n * The plain producer each aggregate lane behaves as. `upload-*` are the\n * canonical single-media producers present in every typed accepts set\n * (IMAGE/VIDEO/AUDIO_PRODUCER_TYPES). `out-text` maps to `list`, not\n * `text-prompt`: the lane is a LIST of texts, so it must reach both prompt\n * inputs (TEXT_PRODUCER_TYPES) and the list consumers (Merge Lists / Sort /\n * Dedup / Selector — LIST_PRODUCER_TYPES), exactly like a List text column.\n * (`list` is also a DYNAMIC producer, so the text lane is admitted at media\n * inputs too — the same latitude a List column already has on canvas.)\n */\nconst AGGREGATE_LANE_EFFECTIVE_TYPE: Readonly<Record<string, string>> = {\n \"out-image\": \"upload-image\",\n \"out-video\": \"upload-video\",\n \"out-audio\": \"upload-audio\",\n \"out-text\": \"list\",\n}\n\n/**\n * Meta Ads scraper: besides its `json` handle it emits the FEATURED ad's\n * copy, creative image and creative video on typed handles. Each behaves as\n * the canonical single-media producer of that type — `text` maps to\n * `combine-text` (ONE string, not a list), so it reaches prompt inputs but\n * not the list consumers.\n */\n// Shared by every scraper node (Meta Ads, Instagram, …): the typed\n// text / image / video handles emit the canonical single-media producers.\nconst SCRAPER_HANDLE_EFFECTIVE_TYPE: Readonly<Record<string, string>> = {\n text: \"combine-text\",\n image: \"upload-image\",\n video: \"upload-video\",\n}\nconst SCRAPER_SOURCE_TYPES = new Set([\"meta-ads-scrape\", \"instagram-scrape\"])\n\n/**\n * Output pips that emit a plain medium although their node is no producer of\n * it: node type → pip → the canonical single-media producer the pip behaves\n * as. A row here is NOT an identity remap (`ENTITY_IMAGE_HANDLE_TYPES`, which\n * the identity gates and `sourceRefKey` read) and adds the node to no producer\n * set: only a wire leaving THIS pip is that producer, so the node's other pips\n * (UGC Creator's `creator` record) stay what they are. A frontend guard holds\n * every row to a declared output drawn in that medium's colour.\n *\n * Both engines' input resolvers route a wire leaving one of these pips as the\n * producer it names, and the editor's validators judge it the same way. A\n * UGC wire input (a pip that reads one output of one UGC node) still judges\n * the RAW node and pip, so a text pip keeps feeding the UGC input made for it.\n */\nexport const OUTPUT_PIP_EFFECTIVE_TYPES: Readonly<Record<string, Readonly<Record<string, string>>>> = Object.freeze({\n // UGC Creator's `image`: the creator's first image, for any image input.\n \"ugc-creator\": Object.freeze({ image: \"upload-image\" }),\n // Site Capture's `image`: its section stills — the first on a plain wire, each or all on an Each / Bundle wire.\n \"site-capture\": Object.freeze({ image: \"upload-image\" }),\n // The UGC nodes' plain-text pips — the script's product category, the clips'\n // transcript, the cards' Notes — are one text each (`combine-text`: one\n // string, not a list): they reach text and prompt inputs, never a JSON input.\n \"ugc-script\": Object.freeze({ category: \"combine-text\" }),\n \"ugc-clips\": Object.freeze({ transcript: \"combine-text\" }),\n \"ugc-cards\": Object.freeze({ report: \"combine-text\" }),\n})\n\nconst own = <T>(table: Readonly<Record<string, T>>, key: string): T | undefined =>\n Object.hasOwn(table, key) ? table[key] : undefined\n\n/**\n * The source type a legacy-handle classifier judges an edge by: the raw node\n * type, unless the edge leaves an `OUTPUT_PIP_EFFECTIVE_TYPES` pip. Only that\n * table: the entity, aggregate and scraper remaps of `resolveEffectiveSourceType`\n * keep the classifiers' rewiring of existing graphs as it was. Read by the\n * editor's load-time pass and the server's write-time normalizer alike.\n */\nexport function outputPipSourceType(\n rawSourceType: string | undefined | null,\n sourceHandleId: string | undefined | null,\n): string {\n const type = rawSourceType ?? \"\"\n const pips = own(OUTPUT_PIP_EFFECTIVE_TYPES, type)\n return (pips && typeof sourceHandleId === \"string\" ? own(pips, sourceHandleId) : undefined) ?? type\n}\n\n/**\n * The effective output TYPE a given source handle emits. Returns the raw node\n * type for every `(type, handle)` pair EXCEPT:\n * - an entity `image` handle → `\"upload-image\"` (a plain image producer);\n * - an aggregate (group / collect) lane handle → the plain producer of that\n * lane's media type (see AGGREGATE_LANE_EFFECTIVE_TYPE);\n * - a Meta Ads `text` / `image` / `video` handle → the plain producer of\n * that type (see META_ADS_HANDLE_EFFECTIVE_TYPE); its `json` handle keeps\n * the raw type;\n * - an `OUTPUT_PIP_EFFECTIVE_TYPES` pip → the producer its row names.\n * Pure — safe for both frontend and backend.\n */\nexport function resolveEffectiveSourceType(\n rawSourceType: string | undefined | null,\n sourceHandleId: string | undefined | null,\n): string {\n if (sourceHandleId === \"image\" && ENTITY_IMAGE_HANDLE_TYPES.has(rawSourceType ?? \"\")) {\n return \"upload-image\"\n }\n const pipType = outputPipSourceType(rawSourceType, sourceHandleId)\n if (pipType !== (rawSourceType ?? \"\")) return pipType\n if (AGGREGATE_LANE_SOURCE_TYPES.has(rawSourceType ?? \"\")) {\n const effective = AGGREGATE_LANE_EFFECTIVE_TYPE[sourceHandleId ?? \"\"]\n if (effective) return effective\n }\n if (SCRAPER_SOURCE_TYPES.has(rawSourceType ?? \"\")) {\n const effective = SCRAPER_HANDLE_EFFECTIVE_TYPE[sourceHandleId ?? \"\"]\n if (effective) return effective\n }\n return rawSourceType ?? \"\"\n}\n\n/**\n * The ref-assembly map key (and `ConnectedReference.id`) for a wired source.\n *\n * An entity's `image` handle emits a plain image that is DISTINCT from the\n * entity's identity `*Ref` handle, yet both edges carry the SAME source node\n * id. Every ref-assembly map that keyed by the bare node id therefore had the\n * two edges collide — silently dropping one (identity → a literal `@abi:N`\n * token + lost character, or the plain image → missing from the picker),\n * non-deterministically by edge order. Scoping the entity-`image`-handle ref to\n * `${nodeId}::image` keeps the two refs distinct so BOTH survive. Every other\n * (type, handle) keeps the bare node id, so nothing else changes.\n */\nexport function sourceRefKey(\n nodeId: string,\n sourceHandleId: string | undefined | null,\n rawSourceType: string | undefined | null,\n): string {\n return sourceHandleId === \"image\" && ENTITY_IMAGE_HANDLE_TYPES.has(rawSourceType ?? \"\")\n ? `${nodeId}::image`\n : nodeId\n}\n"]}
|
|
@@ -75,6 +75,7 @@ exports.GPT_IMAGE_2_6_GIF_BANDS = GPT_IMAGE_2_6_GIF_BANDS;
|
|
|
75
75
|
exports.GPT_IMAGE_2_6_GIF_DEFAULT_FRAMES = GPT_IMAGE_2_6_GIF_DEFAULT_FRAMES;
|
|
76
76
|
exports.GPT_IMAGE_2_6_MAX_INPUT_IMAGES = GPT_IMAGE_2_6_MAX_INPUT_IMAGES;
|
|
77
77
|
exports.GPT_IMAGE_2_6_METERED_QUALITY = GPT_IMAGE_2_6_METERED_QUALITY;
|
|
78
|
+
exports.GPT_IMAGE_2_6_MOODBOARD_MAX_IMAGES = GPT_IMAGE_2_6_MOODBOARD_MAX_IMAGES;
|
|
78
79
|
exports.GPT_IMAGE_2_6_QUALITIES = GPT_IMAGE_2_6_QUALITIES;
|
|
79
80
|
exports.GPT_IMAGE_2_6_RESOLUTIONS = GPT_IMAGE_2_6_RESOLUTIONS;
|
|
80
81
|
exports.GPT_IMAGE_2_6_SVG_LEVELS = GPT_IMAGE_2_6_SVG_LEVELS;
|
|
@@ -88,5 +89,5 @@ exports.imageFormatLeversOf = imageFormatLeversOf;
|
|
|
88
89
|
exports.isGptImage26AutoRun = isGptImage26AutoRun;
|
|
89
90
|
exports.isGptImage26I2i = isGptImage26I2i;
|
|
90
91
|
exports.isGptImage26Tiered = isGptImage26Tiered;
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
92
|
+
//# sourceMappingURL=chunk-D34K455O.cjs.map
|
|
93
|
+
//# sourceMappingURL=chunk-D34K455O.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/gpt-image-2-6.ts"],"names":[],"mappings":";;;AASO,IAAM,wBAAA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GAAI,CAAA,GAAI,CAAA;AAC5E,EAAA,OACE,MAAA,CAAO,IAAA,CAAK,kBAAkB,CAAA,GAC9B,OAAO,IAAA,CAAK,sBAAsB,CAAA,GAClC,MAAA,CAAO,KAAK,SAAS,CAAA,GACrB,MAAA,CAAO,IAAA,CAAK,iBAAiB,CAAA,GAC7B,MAAA,CAAO,IAAA,CAAK,YAAY,CAAA,GACxB,MAAA,CAAO,IAAA,CAAK,cAAc,IAC1B,WAAA,IACC,cAAA,CAAe,IAAA,CAAK,SAAS,IAAI,kCAAA,GAAqC,CAAA,CAAA,IACtE,eAAA,CAAgB,KAAK,IAAI,CAAA,GAAI,CAAA,CAAA;AAElC","file":"chunk-D34K455O.cjs","sourcesContent":["/**\n * What makes GPT Image 2.6 Flare and Sunburst price differently from every\n * other image model: a quality setting AND a size, and on an edit the number of\n * input images as well. Economy is a flat price and is not listed here.\n *\n * Only the ids and levers live in this published package. The rates and the\n * formula are `backend/src/ee/billing/gpt-image-2-6-pricing.ts`.\n */\n\nexport const GPT_IMAGE_2_6_TIERED_T2I = [\"gpt-image-2-6-flare\", \"gpt-image-2-6-sunburst\"] as const\nexport const GPT_IMAGE_2_6_TIERED_I2I = [\"gpt-image-2-6-flare-i2i\", \"gpt-image-2-6-sunburst-i2i\"] as const\nexport type GptImage26TieredModel =\n | (typeof GPT_IMAGE_2_6_TIERED_T2I)[number]\n | (typeof GPT_IMAGE_2_6_TIERED_I2I)[number]\n\nexport const GPT_IMAGE_2_6_QUALITIES = [\"auto\", \"low\", \"medium\", \"high\", \"xhigh\", \"max\"] as const\nexport type GptImage26Quality = (typeof GPT_IMAGE_2_6_QUALITIES)[number]\n/**\n * The quality whose price is known only after the run: KIE picks the level. It\n * is reserved at the Max row and settled on what KIE really billed; every other\n * quality keeps its fixed row.\n */\nexport const GPT_IMAGE_2_6_METERED_QUALITY: GptImage26Quality = \"auto\"\nexport const GPT_IMAGE_2_6_RESOLUTIONS = [\"1K\", \"2K\", \"4K\"] as const\nexport type GptImage26Resolution = (typeof GPT_IMAGE_2_6_RESOLUTIONS)[number]\n\nexport const GPT_IMAGE_2_6_DEFAULT_QUALITY: GptImage26Quality = \"medium\"\nexport const GPT_IMAGE_2_6_DEFAULT_RESOLUTION: GptImage26Resolution = \"1K\"\n/** The most input images an edit is priced for (`REF_IMAGE_MAX_LIMITS`). */\nexport const GPT_IMAGE_2_6_MAX_INPUT_IMAGES = 16\n\n/**\n * A GIF is priced by quality and by how many frames it has, in three bands:\n * KIE draws every frame of a GIF on one sheet, and the frames of a band share a\n * sheet size. Its price does not depend on the ratio or size (a GIF is always\n * square, 512 pixels a frame). Ten to twelve frames take nine's price, so the\n * bands rise in order.\n */\nexport const GPT_IMAGE_2_6_GIF_BANDS = [\n { id: \"2-8\", min: 2, max: 8 },\n { id: \"9-12\", min: 9, max: 12 },\n { id: \"13-16\", min: 13, max: 16 },\n] as const\nexport type GptImage26GifBand = (typeof GPT_IMAGE_2_6_GIF_BANDS)[number][\"id\"]\n/** The frames a GIF has when none are asked for (KIE's own default). */\nexport const GPT_IMAGE_2_6_GIF_DEFAULT_FRAMES = 9\n\n/**\n * The band a GIF of `frames` frames is priced in. A value that is not a whole\n * number of frames, or is off the range, lands where the run lands: no value is\n * the default nine frames, others are rounded and kept inside 2 to 16.\n */\nexport function gptImage26GifBand(frames: unknown): GptImage26GifBand {\n // A numeric string counts as its number, as the run reads it (a form field, a FieldMapping).\n const asked = typeof frames === \"number\" ? frames : typeof frames === \"string\" && frames.trim() !== \"\" ? Number(frames) : Number.NaN\n const n = Number.isFinite(asked) ? Math.round(asked) : GPT_IMAGE_2_6_GIF_DEFAULT_FRAMES\n const first = GPT_IMAGE_2_6_GIF_BANDS[0]\n const last = GPT_IMAGE_2_6_GIF_BANDS[GPT_IMAGE_2_6_GIF_BANDS.length - 1]!\n const clamped = Math.min(Math.max(n, first.min), last.max)\n return (GPT_IMAGE_2_6_GIF_BANDS.find((b) => clamped >= b.min && clamped <= b.max) ?? first).id\n}\n\n/**\n * An SVG is drawn at one of three levels of detail (Standard, Detailed, Max),\n * each priced as the same image in PNG plus a fixed amount for the drawing.\n */\nexport const GPT_IMAGE_2_6_SVG_LEVELS = [\"standard\", \"detailed\", \"max\"] as const\nexport type GptImage26SvgLevel = (typeof GPT_IMAGE_2_6_SVG_LEVELS)[number]\nexport const GPT_IMAGE_2_6_DEFAULT_SVG_LEVEL: GptImage26SvgLevel = \"standard\"\n\n/** The format part of a GPT Image 2.6 price: a GIF's band, an SVG's level, or none (PNG, JPEG and WebP cost the same). */\nexport type GptImage26PricedFormat =\n | { readonly kind: \"gif\"; readonly band: GptImage26GifBand }\n | { readonly kind: \"svg\"; readonly level: GptImage26SvgLevel }\n\n/** The levers a format is priced from, as a request or a node carries them (unchecked). */\nexport interface ImageFormatLevers {\n outputFormat?: unknown\n gifFrames?: unknown\n svgLevel?: unknown\n}\n\n/** The format levers of a request body or a node's data, for a price. */\nexport function imageFormatLeversOf(record: Record<string, unknown> | undefined): ImageFormatLevers {\n return { outputFormat: record?.outputFormat, gifFrames: record?.gifFrames, svgLevel: record?.svgLevel }\n}\n\n/** Read in any case, as the catalog snap reads it (`normalizeModelInput`). */\nfunction lowered(value: unknown): string | undefined {\n return typeof value === \"string\" ? value.trim().toLowerCase() : undefined\n}\n\nexport function gptImage26PricedFormat(levers: ImageFormatLevers | undefined): GptImage26PricedFormat | undefined {\n const format = lowered(levers?.outputFormat)\n if (format === \"gif\") return { kind: \"gif\", band: gptImage26GifBand(levers?.gifFrames) }\n if (format === \"svg\") {\n const asked = lowered(levers?.svgLevel)\n const level = GPT_IMAGE_2_6_SVG_LEVELS.find((l) => l === asked) ?? GPT_IMAGE_2_6_DEFAULT_SVG_LEVEL\n return { kind: \"svg\", level }\n }\n return undefined\n}\n\nexport function isGptImage26I2i(model: string): boolean {\n return (GPT_IMAGE_2_6_TIERED_I2I as readonly string[]).includes(model)\n}\n\nexport function isGptImage26Tiered(model: string): model is GptImage26TieredModel {\n return isGptImage26I2i(model) || (GPT_IMAGE_2_6_TIERED_T2I as readonly string[]).includes(model)\n}\n\n/** True for a run whose charge is settled on KIE's own bill: Flare or Sunburst at quality Auto. */\nexport function isGptImage26AutoRun(provider: unknown, quality: unknown): boolean {\n return typeof provider === \"string\" && isGptImage26Tiered(provider) && quality === GPT_IMAGE_2_6_METERED_QUALITY\n}\n\n/**\n * The images a Generate Image run sends to KIE on GPT Image 2.6: its references\n * and, when it edits a base image, that image too (the worker puts it first,\n * unless it is already one of the references). Any other model is priced on its\n * references alone.\n *\n * @deprecated Use `pricedSentImages` (`input-image-pricing.ts`), which counts\n * the base for every model priced per input image, MiniMax H3 Image included.\n */\nexport function gptImage26SentImages(\n provider: string | undefined,\n references: readonly string[],\n baseImageUrl: unknown,\n): number {\n const countsBase =\n provider !== undefined &&\n isGptImage26Tiered(provider) &&\n typeof baseImageUrl === \"string\" &&\n baseImageUrl.length > 0 &&\n !references.includes(baseImageUrl)\n return references.length + (countsBase ? 1 : 0)\n}\n\n/**\n * The most pictures a saved moodboard holds. A run sends them as references in\n * the seats the node's own images leave free. An estimate cannot read the\n * moodboard, so it counts this many.\n */\nexport const GPT_IMAGE_2_6_MOODBOARD_MAX_IMAGES = 12\n\nfunction namesMoodboard(direction: unknown): boolean {\n if (direction === null || typeof direction !== \"object\") return false\n const style = (direction as Record<string, unknown>).style\n return (Array.isArray(style) ? style : [style]).some(\n (value) => typeof value === \"string\" && value.startsWith(\"moodboard:\"),\n )\n}\n\n/**\n * The input images a workflow estimate counts for one node on a model priced\n * per input image: every list on the node, its source or base image, what is\n * wired in, a moodboard its direction names, and an image-to-image model's own\n * source. An estimate may over-quote, never under.\n *\n * @deprecated Use `pricedEstimatedImages` (`input-image-pricing.ts`), which\n * counts for every model priced per input image, MiniMax H3 Image included.\n */\nexport function gptImage26EstimatedImages(\n model: string,\n data: Record<string, unknown>,\n wiredImages: number,\n): number {\n const listed = (v: unknown) => (Array.isArray(v) ? v.length : 0)\n const single = (v: unknown) => (typeof v === \"string\" && v.length > 0 ? 1 : 0)\n return (\n listed(data.referenceImageUrls) +\n listed(data.characterDefinitionIds) +\n listed(data.extraRefs) +\n single(data.referenceImageUrl) +\n single(data.baseImageUrl) +\n single(data.sourceImageUrl) +\n wiredImages +\n (namesMoodboard(data.direction) ? GPT_IMAGE_2_6_MOODBOARD_MAX_IMAGES : 0) +\n (isGptImage26I2i(model) ? 1 : 0)\n )\n}\n"]}
|