mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-29 11:42:17 +00:00
16 lines
530 B
TypeScript
16 lines
530 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) => {
|
|
const create = () => schema.make("ses_" + descending())
|
|
return {
|
|
create,
|
|
descending: (id?: string) => (id === undefined ? create() : schema.make(id)),
|
|
}
|
|
}),
|
|
)
|
|
export type SessionID = typeof SessionID.Type
|