OpenFn / kit

The bits & pieces that make OpenFn work. (diagrammer, cli, compiler, runtime, runtime manager, logger, etc.)
8 stars 12 forks source link

Support promises #722

Open josephjclark opened 1 week ago

josephjclark commented 1 week ago

An experimental, early stage branch to explore whether we can do fn().then() and fn().catch() in job code.

I've added a new suite of integration tests specifically for job writing. These just compile and run against an adaptor - no CLI or Worker in the way. So it should be a nice clean environment to write, test, debug and experiment with pure job code.

Anyway so far I've just run a couple of basic tests and learned that this won't work without compiler magic.

See #721

josephjclark commented 5 days ago

Taylor :+1: to .then() and .catch() on everything

Taylor :+1: to fn() being the primary canonical means of doing a "callback", but the promise is an option

josephjclark commented 1 day ago

One blocker on removing callbacks:

each($.data.ids, get('www, (s) => s))

then() will save us on v2, but v1 will not have this support