@lifi/composer-sdk
Version:
Public Composer SDK for building and submitting flows
17 lines • 565 B
JavaScript
const isInputHandle = (h) => h._tag === "input";
const isOutputHandle = (h) => h._tag === "output";
const handleToRef = (h) => {
if (h._tag === "input") {
if (!h.inputName) throw new Error("InputHandle has empty inputName");
return { $ref: `input.${h.inputName}` };
}
if (!h.nodeId) throw new Error("OutputHandle has empty nodeId");
if (!h.portName) throw new Error("OutputHandle has empty portName");
return { $ref: `${h.nodeId}.${h.portName}` };
};
export {
handleToRef,
isInputHandle,
isOutputHandle
};
//# sourceMappingURL=handles.js.map