mirror of
https://github.com/anomalyco/opencode.git
synced 2026-07-20 23:33:30 +00:00
15 lines
479 B
TypeScript
15 lines
479 B
TypeScript
import { Schema } from "effect"
|
|
import { descending } from "./identifier.js"
|
|
import { statics } from "./schema.js"
|
|
|
|
export const SessionID = Schema.String.check(Schema.isStartsWith("ses")).pipe(
|
|
Schema.brand("SessionID"),
|
|
statics((schema) => {
|
|
const create = () => schema.make("ses_" + descending())
|
|
return {
|
|
create,
|
|
descending: (id?: string) => (id === undefined ? create() : schema.make(id)),
|
|
}
|
|
}),
|
|
)
|
|
export type SessionID = typeof SessionID.Type
|