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

feat: v8 support #759

Merged
merged 30 commits into from
Jun 7, 2024
Merged

feat: v8 support #759

merged 30 commits into from
Jun 7, 2024

Conversation

broofa
Copy link
Member

@broofa broofa commented Jun 5, 2024

[Stacking this on top of #754, which I expect will go in shortly]

We actually snuck in the change to allow version 8 in the validation regex as part of #651, which is really all that's required to support v8 UUIDs. There's no formal algorithm for v8 ("experiment or vendor-specific") ids, so the only impact on this library is that such ids must properly validate() and version().

This PR adds tests for those cases. I've also taken the opportunity to refactor the validate and version tests to be "table-driven" from a common set of test cases, which I've fleshed out to include the original cases we had, plus a few additional ones.

@broofa broofa changed the title chore: v8 support (unit tests) feat: v8 support (unit tests) Jun 5, 2024
@broofa broofa changed the title feat: v8 support (unit tests) feat: v8 support Jun 5, 2024
@broofa broofa mentioned this pull request Jun 5, 2024
@broofa broofa changed the title feat: v8 support feat: v8 support, closes #758 Jun 5, 2024
@pmccarren pmccarren linked an issue Jun 5, 2024 that may be closed by this pull request
@pmccarren
Copy link
Contributor

@broofa I was thinking it might be helpful to provide an API for generating a uuid8, such as v8(buf). The method would manage bit shifting / placement, and return a compliant uuid8 populated with the first 122 bits of the buffer. Thoughts on wether or not this utility belongs?

@pmccarren pmccarren mentioned this pull request Jun 5, 2024
9 tasks
@broofa
Copy link
Member Author

broofa commented Jun 5, 2024

@broofa I was thinking it might be helpful to provide an API for generating a uuid8, such as v8(buf). The method would manage bit shifting / placement, and return a compliant uuid8 populated with the first 122 bits of the buffer. Thoughts on wether or not this utility belongs?

Let's hold off on this until we see demand for it. I suspect v8 UUIDs will generally be a pretty niche use case compared to other versions, and experience has taught me to be cautious about expanding the API surface. It's 10x harder to remove an API than it is to add it.

@broofa broofa mentioned this pull request Jun 7, 2024
Copy link
Member

@ctavan ctavan left a comment

Choose a reason for hiding this comment

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

Great refactor of the tests, thank you!

@broofa broofa changed the title feat: v8 support, closes #758 feat: v8 support Jun 7, 2024
Base automatically changed from v1v6 to main June 7, 2024 20:15
@broofa broofa merged commit 35a5342 into main Jun 7, 2024
12 checks passed
@broofa broofa deleted the v8 branch June 7, 2024 20:25
gisbdzhch pushed a commit to gisktzh/gb3-web_ui that referenced this pull request Jun 19, 2024
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [uuid](https://github.com/uuidjs/uuid) | dependencies | major | [`^9.0.0` -> `^10.0.0`](https://renovatebot.com/diffs/npm/uuid/9.0.1/10.0.0) |

---

### Release Notes

<details>
<summary>uuidjs/uuid (uuid)</summary>

### [`v10.0.0`](https://github.com/uuidjs/uuid/blob/HEAD/CHANGELOG.md#1000-2024-06-07)

[Compare Source](uuidjs/uuid@v9.0.1...v10.0.0)

##### ⚠ BREAKING CHANGES

-   update node support (drop node@12, node@14, add node@20) ([#&#8203;750](uuidjs/uuid#750))

##### Features

-   support support rfc9562 MAX uuid (new in RFC9562) ([#&#8203;714](uuidjs/uuid#714)) ([0385cd3](uuidjs/uuid@0385cd3))
-   support rfc9562 v6 uuids ([#&#8203;754](uuidjs/uuid#754)) ([c4ed13e](uuidjs/uuid@c4ed13e))
-   support rfc9562 v7 uuids ([#&#8203;681](uuidjs/uuid#681)) ([db76a12](uuidjs/uuid@db76a12))
-   update node support matrix (only support node 16-20) ([#&#8203;750](uuidjs/uuid#750)) ([883b163](uuidjs/uuid@883b163))
-   support rfc9562 v8 uuids ([#&#8203;759](uuidjs/uuid#759)) ([35a5342](uuidjs/uuid@35a5342))

##### Bug Fixes

-   revert "perf: remove superfluous call to toLowerCase ([#&#8203;677](uuidjs/uuid#677))" ([#&#8203;738](uuidjs/uuid#738)) ([e267b90](uuidjs/uuid@e267b90))

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or rename PR to start with "rebase!".

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
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.

Add v8 Support
3 participants