File size: 473 Bytes
89a2873 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | import { Schema } from "effect"
import { descending } from "./identifier"
import { statics } from "./schema"
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
|