opencode/packages/schema/src/session-id.ts

12 lines
409 B
TypeScript

import { Schema } from "effect"
import { descending } from "./identifier.js"
import { statics } from "./schema.js"
export const SessionID = Schema.String.check(Schema.isStartingWith("ses")).pipe(
Schema.brand("SessionID"),
Schema.annotate({ identifier: "Session.ID" }),
statics((schema) => ({
create: () => schema.make("ses_" + descending()),
})),
)
export type SessionID = typeof SessionID.Type