-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support checkpoint_ns, refactor (#313)
* Refactor checkpoint * Fix lint and format * Fix tests, fix UUIDv5 issue * Fix build
- Loading branch information
1 parent
35669d8
commit a89219c
Showing
13 changed files
with
430 additions
and
131 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,17 @@ | ||
import { v6 } from "uuid"; | ||
import { v5, v6 } from "uuid"; | ||
|
||
export function uuid6(clockseq: number): string { | ||
return v6({ clockseq }); | ||
} | ||
|
||
// Skip UUID validation check, since UUID6s | ||
// generated with negative clockseq are not | ||
// technically compliant, but still work. | ||
// See: https://github.com/uuidjs/uuid/issues/511 | ||
export function uuid5(name: string, namespace: string): string { | ||
const namespaceBytes = namespace | ||
.replace(/-/g, "") | ||
.match(/.{2}/g)! | ||
.map((byte) => parseInt(byte, 16)); | ||
return v5(name, new Uint8Array(namespaceBytes)); | ||
} |
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.