-
-
Notifications
You must be signed in to change notification settings - Fork 905
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: add parse/stringify/validate/version/NIL APIs #479
Conversation
* test: parsing non RFC uuid values * feat: create validate, version, uuidRegex (and import to public API) * style: always curly braces added comments to numberToBytes func preallocated array in uuidToBytes func * Update src/regex.js Co-authored-by: Robert Kieffer <robert@broofa.com> * Update src/validate.js Co-authored-by: Robert Kieffer <robert@broofa.com> * Update src/version.js Co-authored-by: Robert Kieffer <robert@broofa.com> * Update test/unit/version.test.js Co-authored-by: Robert Kieffer <robert@broofa.com> * feat: throw error when invalid uuid * test: validate function * feat: short version of parsing UUID * fix: remove explicit ie babel target * Revert "feat: short version of parsing UUID" This reverts commit d096cc2. Co-authored-by: Robert Kieffer <robert@broofa.com> Co-authored-by: Christoph Tavan <dev@tavan.de>
* fix: improved uuidToBytes * chore: comment tweak * chore: bump bundlewatch sizes * fix: uuidToBytes test * feat: export uuidToBytes, uuidToBytes benchmark * chore: review comments * feat: export validate, parse, stringify methods * chore: stringify unit test and benchmark * fix: stringify test in browser * feat: add uuidVersion to rollup exports * chore: bump bundlewatch limits * chore: tweak function name * test: enable browserstack.console setting * fix: revert padStart * fix: pr review comments * fix: no Array.from in IE11 * improvement: hardcode namespace length Co-authored-by: Linus Unnebäck <linus@folkdatorn.se> Co-authored-by: Christoph Tavan <dev@tavan.de> Co-authored-by: Linus Unnebäck <linus@folkdatorn.se>
BTW we still need documentation in the README. |
@ctavan Updated the README.
Note: I also made one minor functional change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I'm happy with this, but maybe get a sanity check review from @TrySound?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everything looks great
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@broofa this looks awesome, thanks a lot 👏
I've made some minor consistency adjustments to the README myself.
I still have 3 questions that we should address before merging this. Once merged I'd like to release this as a beta release and ask the people who wanted these features to try them out. Upon positive feedback I'll make the 8.2
release.
} | ||
|
||
testParseAndStringify(); | ||
testGeneration(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will these tests run in parallel? Shouldn't we rather ensure that they are run in series?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will these tests run in parallel? Shouldn't we rather ensure that they are run in series?
I believe Benchmark.js runs synchronously, so these do run in series. (At least, that's what I see when I do cd examples/benchmark; node benchmark.js
.)
Changes look good. What about my comment regarding the benchmark parallelism? |
@broofa @ctavan I upgraded package from
Now after update it throws an error:
|
@zaggino the RFC requires the namespace to be a valid UUID. It's true that up to Can you update your code to pass only valid UUIDs as namespaces? A valid UUID must match this regex: Line 1 in ade3655
I.e. it must either be the NIL UUID or it has the UUID version after the second hyphen (in your example there's a |
I did update the code, but my concern was that a From the RFC perspective, I agree on fixing this, but from a user-developer perspective - I never noticed any buggy behaviour before this, so was there ever an actual bug when a namespace which was not a 100% proper uuid was used? |
I think this can be a serious interoperability issue: if you have other libraries or programming languages that already do the right thing by validating the passed namespace UUIDs then the UUIDs generated from malformed namespaces with old versions of this library won’t be compatible with those other libraries/languages. So as long as everything that ever has to deal with the v5 UUIDs generated off of bad namespace ids will always use the same flawed library there’s probably no problem, but as soon as you need to be interoperable this might cause very subtle and hard-to-find bugs. |
All that said I agree that it is maybe not the best developer experience to introduce such a change in a minor version bump. Unfortunately it’s out now and too late. Our assessment that this should be a non-breaking change for most developers was apparently wrong. We‘ll be more careful in the future. I’m sorry for the inconvenience. |
@broofa should we just merge this into master and release as
8.2.0
? As far as I can tell it only adds new features, no breaking changes. Or do I miss something?Closes #475
Closes #478
Closes #480
Closes #481