MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / normalizeConnectionInputs

Function normalizeConnectionInputs

packages/core/sdk/src/executor.ts:984–1000  ·  view source on GitHub ↗
(
  input: ConnectionValueInput,
)

Source from the content-addressed store, hash-verified

982 * `values` map, or the canonical per-variable `inputs` map) into a uniform list
983 * of named origins. */
984const normalizeConnectionInputs = (
985 input: ConnectionValueInput,
986): readonly NormalizedConnectionInput[] => {
987 if ("inputs" in input) {
988 return Object.entries(input.inputs).map(([variable, origin]) => ({ variable, origin }));
989 }
990 if ("values" in input) {
991 return Object.entries(input.values).map(([variable, value]) => ({
992 variable,
993 origin: { value },
994 }));
995 }
996 if ("from" in input) {
997 return [{ variable: PRIMARY_INPUT_VARIABLE, origin: { from: input.from } }];
998 }
999 return [{ variable: PRIMARY_INPUT_VARIABLE, origin: { value: input.value } }];
1000};
1001
1002/** Decode a connection row's `item_ids` JSON map (`variable → provider item id`).
1003 * Tolerates the historically-single shape by returning `{}` for anything that

Callers 2

connectionsCreateFunction · 0.85
resolveInFlightValuesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected