session-message-id.ts 398 B

1234567891011
  1. export * as SessionMessageID from "./session-message-id"
  2. import { Schema } from "effect"
  3. import { ascending } from "./identifier"
  4. import { withStatics } from "./schema"
  5. export const ID = Schema.String.check(Schema.isStartsWith("msg_")).pipe(
  6. Schema.brand("Session.Message.ID"),
  7. withStatics((schema) => ({ create: () => schema.make("msg_" + ascending()) })),
  8. )
  9. export type ID = typeof ID.Type