Closed
Conversation
Member
Author
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has required the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
0268d8a to
c3e77ca
Compare
c3e77ca to
4696c41
Compare
Merge activity
|
graphite-app bot
pushed a commit
that referenced
this pull request
Jan 29, 2026
### TL;DR Added support for base62 encoding in message ID generation to provide alphanumeric-only IDs. ### What changed? - Implemented a new `encode_base62` function to encode hash digests using only alphanumeric characters (0-9, A-Z, a-z) - Updated the `generate_id` function to support three distinct encoding options: - `base64`: Standard base64 encoding (may contain +/) - `base64url`: URL-safe base64 encoding (uses -_ instead of +/) - `base62`: Alphanumeric-only encoding (0-9, A-Z, a-z) - Added comprehensive tests for the new base62 encoding and clarified differences between encoding types - Fixed documentation to reflect the new encoding options ### How to test? Run the new tests that verify: - Base62 encoding produces alphanumeric-only IDs - Base62 IDs are deterministic (same input produces same ID) - Base62 encoding produces different output than base64 and hex - Base62 encoding works with various ID lengths You can also manually test by running the CLI with a pattern like: ``` formatjs extract --id-interpolation-pattern "[sha512:contenthash:base62:10]" --out-file messages.json source.js ``` ### Why make this change? Base62 encoding provides several advantages: - Creates IDs that are alphanumeric-only, making them safer to use in various contexts - Avoids special characters (+/=) from base64 and base64url that might require escaping in some environments - Provides a more compact representation than hex encoding while maintaining compatibility with systems that only support alphanumeric characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

TL;DR
Added support for base62 encoding in message ID generation to provide alphanumeric-only IDs.
What changed?
encode_base62function to encode hash digests using only alphanumeric characters (0-9, A-Z, a-z)generate_idfunction to support three distinct encoding options:base64: Standard base64 encoding (may contain +/)base64url: URL-safe base64 encoding (uses -_ instead of +/)base62: Alphanumeric-only encoding (0-9, A-Z, a-z)How to test?
Run the new tests that verify:
You can also manually test by running the CLI with a pattern like:
Why make this change?
Base62 encoding provides several advantages: