The best way to control Claude Code, Codex and more from any computer or phone

main
ts 28 lines 701 Bytes
Raw
1 import * as Schema from "effect/Schema";
2
3 // #region show
4 export const Link = Schema.Struct({
5 code: Schema.String,
6 url: Schema.String,
7 // #region createdAt
8 createdAt: Schema.String,
9 // #endregion createdAt
10 });
11 export type Link = typeof Link.Type;
12 // #region notFound
13
14 export class LinkNotFound extends Schema.TaggedError<LinkNotFound>()(
15 "LinkNotFound",
16 { code: Schema.String },
17 // #region status
18 { httpApiStatus: 404 },
19 // #endregion status
20 ) {}
21 // #endregion notFound
22 // #endregion show
23
24 /** Short, URL-safe codes. */
25 export const newCode = () =>
26 Array.from(crypto.getRandomValues(new Uint8Array(6)), (b) =>
27 "abcdefghijkmnpqrstuvwxyz23456789".charAt(b % 32),
28 ).join("");