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 Add encode, decode and uuid helpers #791

Merged
merged 8 commits into from
Oct 18, 2024
Merged

common Add encode, decode and uuid helpers #791

merged 8 commits into from
Oct 18, 2024

Conversation

mtuchi
Copy link
Collaborator

@mtuchi mtuchi commented Oct 18, 2024

Summary

Add encode, decode and uuid helper function and wrote unit test for each function. For now these functions are exported in http adaptor only as util functions. [util.encode, util.decode, util.uuid]

Fixes
This will make it easy creating a base64 encoded payload that is needed when working with GitHub Rest API

Details

  • I have used Buffer for base64 encoding and decoding mainly because from a quick online read Buffer is more performant especially when it comes to huge data volume. Also Buffer supports string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object
  • For uuid i am using randomUUID from node:crypto without modifying the default option disableEntropyCache which caches enough random data to generate up to 128 random UUIDS

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?

@mtuchi mtuchi changed the title D encode common Add encode, decode and uuid helpers Oct 18, 2024
@mtuchi mtuchi marked this pull request as ready for review October 18, 2024 10:17
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.

Lovely!

Please bump versions and expose the functions in whichever adaptor you need this for

@josephjclark josephjclark merged commit 0282e8c into main Oct 18, 2024
2 checks passed
@josephjclark josephjclark deleted the d-encode branch October 18, 2024 14:26
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.

2 participants