pipeline.js 611 B

1234567891011121314151617181920
  1. import { parseDef } from "../parseDef.js";
  2. export const parsePipelineDef = (def, refs) => {
  3. if (refs.pipeStrategy === "input") {
  4. return parseDef(def.in._def, refs);
  5. }
  6. else if (refs.pipeStrategy === "output") {
  7. return parseDef(def.out._def, refs);
  8. }
  9. const a = parseDef(def.in._def, {
  10. ...refs,
  11. currentPath: [...refs.currentPath, "allOf", "0"],
  12. });
  13. const b = parseDef(def.out._def, {
  14. ...refs,
  15. currentPath: [...refs.currentPath, "allOf", a ? "1" : "0"],
  16. });
  17. return {
  18. allOf: [a, b].filter((x) => x !== undefined),
  19. };
  20. };