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

Openmrs http helpers #936

Merged
merged 26 commits into from
Jan 28, 2025
Merged

Openmrs http helpers #936

merged 26 commits into from
Jan 28, 2025

Conversation

josephjclark
Copy link
Collaborator

@josephjclark josephjclark commented Jan 24, 2025

Summary

post remove and get helpers for HTTP

Fixes #890

Details

Added wrappers, with tests and documentation, for http.get(), http.post() and http.remove.

AI Usage

Please disclose how you've used AI in this work (it's cool, we just want to
know!):

  • Code generation (copilot but not intellisense)
  • Learning or fact checking
  • Strategy / design
  • Optimisation / refactoring
  • Translation / spellchecking / doc gen
  • Other
  • I have not used AI

You can read more details in our
Responsible AI Policy

Review Checklist

Before merging, the reviewer should check the following items:

  • Does the PR do what it claims to do?
  • If this is a new adaptor, added the adaptor on marketing website ?
  • If this PR includes breaking changes, do we need to update any jobs in
    production? Is it safe to release?
  • Are there any unit tests?
  • Is there a changeset associated with this PR? Should there be? Note that
    dev only changes don't need a changeset.
  • Have you ticked a box under AI Usage?

@josephjclark
Copy link
Collaborator Author

Hi @PiusKariuki - can you continue development on this branch please?

I've got a few calls this morning but I'll get this reviewed for you today

@PiusKariuki
Copy link
Collaborator

Sure thing Joe. This is much easier than working from a fork. I'll be working from this repo on all subsequent contributions

Copy link
Collaborator Author

@josephjclark josephjclark left a comment

Choose a reason for hiding this comment

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

Fantastic work @PiusKariuki , nice and clean and simple.

I've left some comments which are mostly the result of me not specifying the requirements of the work properly for you :)

packages/openmrs/src/http.js Outdated Show resolved Hide resolved
packages/openmrs/src/http.js Outdated Show resolved Hide resolved
packages/openmrs/src/http.js Outdated Show resolved Hide resolved
packages/openmrs/src/http.js Outdated Show resolved Hide resolved
packages/openmrs/src/http.js Outdated Show resolved Hide resolved
@PiusKariuki
Copy link
Collaborator

Hi @josephjclark ,
Do you have any idea what causes this error when I run pnpm build ?

Building docs
rendering jsdocs...
/home/pius/Development/OpenFN/adaptors/tools/build/src/util/hbs-helpers.js:32
handlebars.helpers._identifiers(options).forEach(o => {
^
TypeError: handlebars.helpers._identifiers is not a function

@josephjclark
Copy link
Collaborator Author

Hi @PiusKariuki - off the top of my head I don't. I see lots of commits, have you resolved it?

Is it related to this PR or the docs stuff? The docs fix should ideally be in a different PR by the way. It's probably OK to branch off this but ideally we'd fix it on main and merge these two together.

@PiusKariuki
Copy link
Collaborator

Hi @josephjclark I just figured it out a minute ago. Sometimes the handlebars package fails to install therefore the handlebars-helper function fail during generation. Should I declare it as a dev-dependency in the package.json that in the build folder ?

@PiusKariuki
Copy link
Collaborator

@josephjclark No worries I will be fixing it in a different PR. The commits here are purely for the http wrapper functions.

@josephjclark
Copy link
Collaborator Author

@PiusKariuki that's pretty strange. Thanks for flagging, I'll take a look at it. I haven't heard this before. Dependencies are totally deterministic and shouldn't fail to install 🤔 I'll run some tests on Monday

@josephjclark
Copy link
Collaborator Author

josephjclark commented Jan 27, 2025

Thanks @PiusKariuki - I am approving this PR and releasing soon

EDIT: Actually I'll wait a minute for the unit test stuff and this possible docs fix 🤞

@josephjclark
Copy link
Collaborator Author

Good catch on the typedef @PiusKariuki, thanks!

@PiusKariuki
Copy link
Collaborator

PiusKariuki commented Jan 27, 2025

@josephjclark Are you free to hop on a call. I think I might have found something on the docs.ts

Edit: Actually there's no need I figured it out. The problem was a filter in the docs-template.hbs that required typedefs to be public. The commit below fixes it

@PiusKariuki
Copy link
Collaborator

@josephjclark you can go ahead and merge this now. I had paused any refactors in the test suite to prioritize the documentation bug. I will do the refactors in a separate PR. They actually don't look that bad.

@josephjclark
Copy link
Collaborator Author

That's a really great catch @PiusKariuki, thank you!

@josephjclark josephjclark merged commit 8ae3205 into main Jan 28, 2025
2 checks passed
@josephjclark josephjclark deleted the openmrs-http-helpers branch January 28, 2025 11:25
@PiusKariuki
Copy link
Collaborator

Thanks you @josephjclark 🙏

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.

Phase 2: Add other HTTP helpers
2 participants