OpenFn / docs

The documentation site and knowledge base for OpenFn, the leading DPG for workflow automation.
https://docs.openfn.org
15 stars 13 forks source link

Add documentation for promises #518

Closed josephjclark closed 1 month ago

josephjclark commented 1 month ago

We've just released support in the runtime to treat every operation as a Promise.

See https://github.com/OpenFn/kit/pull/722 for all the gory details.

The tl;dr on this is:

1) You can now do fn().catch() 2) .then() should remove the need for 95% of callbacks in adaptor code 3) You should start doing each($.data, fn().then())

This is a really big deal and needs good documentation.

The tension here is that I want to communicate the change to users who know openfn, but to new users this promises and callbacks thing is an edge case really.

In the future, most of the existing Callbacks section of the docs will be removed, and we'll just have this Promises stuff and maybe a section explaining fn() (because a lot of callbacks in existing job code should now migrate to using an fn block)

aleksa-krolls commented 1 month ago

@ritazagoni @mtuchi can you pls review and provide feedback here?

josephjclark commented 1 month ago

I've just updated the docs to be a bit sharper. I've also moved it all down the page.

The docs should be self explanatory. Eventually this section should replace the Callbacks bit entirely.