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

Common util encode should take an object and stringify #904

Conversation

PiusKariuki
Copy link
Collaborator

Summary

Adds functionality to encode and decode JSON objects in the encode and decode util functions

Fixes #794

Details

Added a conditional in the encode util to check for objects and stringify them first before encoding them.
Added functionality to decode that handles JSON objects and parses them to standard JavaScript objects.

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 ?
  • 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?

@PiusKariuki
Copy link
Collaborator Author

@josephjclark please review this for me.

@josephjclark
Copy link
Collaborator

Thank you @PiusKariuki !

I'll look at this tomorrow and hopefully roll it into the same releases as your other fixes (we had a problem with released today which blocked me from getting to release your stuff - should be all OK tomorrow!)

Copy link
Collaborator

@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.

Thanks @PiusKariuki! I've got a few suggestions here - please take a look.

When you're done, can you run pnpm changeset and generate a patch change note? Thanks!

packages/common/src/util/base64.js Outdated Show resolved Hide resolved
packages/common/src/util/base64.js Outdated Show resolved Hide resolved
packages/common/src/util/base64.js Outdated Show resolved Hide resolved
packages/common/src/util/base64.js Outdated Show resolved Hide resolved
packages/common/src/util/base64.js Outdated Show resolved Hide resolved
packages/common/src/util/base64.js Outdated Show resolved Hide resolved
packages/common/test/util/index.test.js Show resolved Hide resolved
packages/common/src/util/base64.js Outdated Show resolved Hide resolved
packages/common/src/util/base64.js Outdated Show resolved Hide resolved
@PiusKariuki
Copy link
Collaborator Author

@josephjclark does this look okay now?

@josephjclark josephjclark changed the base branch from main to release/next January 16, 2025 09:25
Copy link
Collaborator

@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.

Thanks @PiusKariuki !

@josephjclark josephjclark merged commit 18b6aaa into OpenFn:release/next Jan 16, 2025
@josephjclark josephjclark mentioned this pull request Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

common util.encode should take an object and stringify
2 participants