This repository has been archived by the owner on Dec 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(DataMapper): Cannot resolve metadata once route ID is changed
Fixes: https://github.com/KaotoIO/kaoto-datamapper-integration/issues/234 Just use 32bit pseudo random instead of UUID
- Loading branch information
1 parent
dd9f0da
commit d8e252b
Showing
4 changed files
with
29 additions
and
6 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,6 +1,14 @@ | ||
const getCryptoObj = () => { | ||
return window.crypto || (window as Window & { msCrypto?: Crypto }).msCrypto; | ||
}; | ||
|
||
export const getCamelRandomId = (kind: string, length = 4): string => { | ||
const cryptoObj = window.crypto || (window as Window & { msCrypto?: Crypto }).msCrypto; | ||
const randomNumber = Math.floor(cryptoObj?.getRandomValues(new Uint32Array(1))[0] ?? Date.now()); | ||
const randomNumber = Math.floor(getCryptoObj()?.getRandomValues(new Uint32Array(1))[0] ?? Date.now()); | ||
|
||
return `${kind}-${randomNumber.toString(10).slice(0, length)}`; | ||
}; | ||
|
||
export const getHexaDecimalRandomId = (prefix: string) => { | ||
const randomNumber = getCryptoObj()?.getRandomValues(new Uint32Array(1))[0] ?? Date.now(); | ||
return `${prefix}-${randomNumber.toString(16)}`; | ||
}; |
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