mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 02:14:01 +00:00
fix: allocate share-link layer tokens without collisions
This commit is contained in:
1 parent
ce671ce500
commit
54735a9e6f
15 files changed
+1295
-20
No files matched your search
@@ -0,0 +1,22 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import {
|
||||
LAYER_STATE_TOKEN_RESERVATIONS,
|
||||
nextLayerStateToken,
|
||||
} from '../src/data/layerState.js';
|
||||
|
||||
const layerId = String(process.argv[2] || '').trim();
|
||||
|
||||
if (!/^[a-z0-9-]+$/.test(layerId)) {
|
||||
console.error('Usage: npm run layer-token:next -- <layer-id>');
|
||||
process.exitCode = 1;
|
||||
} else if (Object.hasOwn(LAYER_STATE_TOKEN_RESERVATIONS, layerId)) {
|
||||
console.error(
|
||||
`${layerId} already owns token ${LAYER_STATE_TOKEN_RESERVATIONS[layerId]}`,
|
||||
);
|
||||
process.exitCode = 1;
|
||||
} else {
|
||||
console.log(`${layerId}: ${nextLayerStateToken()}`);
|
||||
console.log('Order: free digits 0-9, then two-character base-36 00-zz.');
|
||||
console.log('Re-run after rebasing onto the latest main before merge.');
|
||||
}
|
||||
Reference in new issue
Block a user