Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation for promises #518

Merged
merged 3 commits into from
Jul 29, 2024
Merged

Add documentation for promises #518

merged 3 commits into from
Jul 29, 2024

Conversation

josephjclark
Copy link
Contributor

@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
Contributor 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!

docs/jobs/job-writing-guide.md Outdated Show resolved Hide resolved
@josephjclark josephjclark merged commit 0e9d99a into main Jul 29, 2024
1 check passed
@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.

3 participants