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

Function normalizeConnectionInputs

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

Source from the content-addressed store, hash-verified

1168 * `values` map, or the canonical per-variable `inputs` map) into a uniform list
1169 * of named origins. */
1170const normalizeConnectionInputs = (
1171 input: ConnectionValueInput,
1172): readonly NormalizedConnectionInput[] => {
1173 if ("inputs" in input) {
1174 return Object.entries(input.inputs).map(([variable, origin]) => ({
1175 variable,
1176 origin,
1177 }));
1178 }
1179 if ("values" in input) {
1180 return Object.entries(input.values).map(([variable, value]) => ({
1181 variable,
1182 origin: { value },
1183 }));
1184 }
1185 if ("from" in input) {
1186 return [{ variable: PRIMARY_INPUT_VARIABLE, origin: { from: input.from } }];
1187 }
1188 return [{ variable: PRIMARY_INPUT_VARIABLE, origin: { value: input.value } }];
1189};
1190
1191/** Decode a connection row's `item_ids` JSON map (`variable → provider item id`).
1192 * 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