(seed: string)
| 640 | } |
| 641 | |
| 642 | function buildDeterministicJoinCode(seed: string): string { |
| 643 | const alphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; |
| 644 | let hash = 2166136261; |
| 645 | for (const char of seed) { |
| 646 | hash ^= char.charCodeAt(0); |
| 647 | hash = Math.imul(hash, 16777619); |
| 648 | } |
| 649 | let code = ""; |
| 650 | for (let index = 0; index < 8; index += 1) { |
| 651 | hash = Math.imul(hash ^ index, 16777619); |
| 652 | code += alphabet[Math.abs(hash) % alphabet.length]; |
| 653 | } |
| 654 | return code; |
| 655 | } |
| 656 | |
| 657 | function seedDefaultWorkspace(db: PostgresSyncDatabase): void { |
| 658 | const existingWorkspace = db.prepare("SELECT 1 FROM workspace WHERE id = ? LIMIT 1").get(DEFAULT_WORKSPACE_ID); |
no outgoing calls
no test coverage detected