summaryrefslogtreecommitdiffhomepage
path: root/js/src/id
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-05-18 14:13:04 -0400
committerDax Raad <[email protected]>2025-05-26 12:40:17 -0400
commit0e303e6508edb4374213d1f98ec383b266339774 (patch)
treef7dc146eb58126f55f470ef135b66c678bf16898 /js/src/id
parentbcd2fd68b7fa00af055f558049994c2975d9515d (diff)
downloadopencode-0e303e6508edb4374213d1f98ec383b266339774.tar.gz
opencode-0e303e6508edb4374213d1f98ec383b266339774.zip
sync
Diffstat (limited to 'js/src/id')
-rw-r--r--js/src/id/id.ts11
1 files changed, 8 insertions, 3 deletions
diff --git a/js/src/id/id.ts b/js/src/id/id.ts
index e4744f172..39ee5326f 100644
--- a/js/src/id/id.ts
+++ b/js/src/id/id.ts
@@ -1,4 +1,4 @@
-import { z } from "zod";
+import { z } from "zod/v4";
import { randomBytes } from "crypto";
export namespace Identifier {
@@ -11,7 +11,7 @@ export namespace Identifier {
return z.string().startsWith(prefixes[prefix]);
}
- const LENGTH = 24;
+ const LENGTH = 26;
export function ascending(prefix: keyof typeof prefixes, given?: string) {
return generateID(prefix, false, given);
@@ -45,6 +45,11 @@ export namespace Identifier {
const randLength = (LENGTH - 12) / 2;
const random = randomBytes(randLength);
- return prefix + "_" + timeBytes.toString("hex") + random.toString("hex");
+ return (
+ prefixes[prefix] +
+ "_" +
+ timeBytes.toString("hex") +
+ random.toString("hex")
+ );
}
}