How is Promise.all
used in a ramda pipe? I think I'm missing something silly here.
const pipeline: Function = R.pipe(
R.map((record) => record.body),
R.map(JSON.parse),
R.map(asyncFunction),
console.log
);
Returns an array of promises (the input to Promise.all
)
[ Promise { <pending> },
Promise { <pending> },
Promise { <pending> },
Promise { <pending> },
Promise { <pending> },
Promise { <pending> },
Promise { <pending> },
Promise { <pending> },
Promise { <pending> },
Promise { <pending> } ]
However if I try to wait for those promises to resolve with Promise.all
, like so:
const pipeline: Function = R.pipe(
R.map((record) => record.body),
R.map(JSON.parse),
R.map(asyncFunction),
Promise.all,
R.andThen(useTheReturn)
);
I end up with a type error stating that i'm trying to use Promise.all
as a constructor type.
{
"errorType": "TypeError",
"errorMessage": "#<Object> is not a constructor",
"stack": [
"TypeError: #<Object> is not a constructor",
" at all (<anonymous>)",
" at /var/task/node_modules/ramda/src/internal/_pipe.js:3:14",
" at /var/task/node_modules/ramda/src/internal/_arity.js:11:19",
" at Runtime.exports.handler (/var/task/lambda/data-pipeline/1-call-summary-ingestion/index.js:14:19)",
" at Runtime.handleOnce (/var/runtime/Runtime.js:66:25)"
]
}