Skip to content

Conversation

@josephjclark
Copy link
Collaborator

@josephjclark josephjclark commented Jul 17, 2024

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

See OpenFn/kit#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)

@josephjclark josephjclark mentioned this pull request Jul 17, 2024
4 tasks
@aleksa-krolls
Copy link
Member

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

@josephjclark
Copy link
Collaborator Author

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.

Copy link
Member

@ritazagoni ritazagoni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left one comment for possible typo, otherwise looks great and very clear!

@josephjclark josephjclark merged commit 0e9d99a into main Jul 29, 2024
@josephjclark josephjclark deleted the promise-docs branch July 29, 2024 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants