instruction.ts 776 B

123456789101112131415161718192021
  1. export * as Instruction from "./instruction.js"
  2. import { Schema } from "effect"
  3. export const Key = Schema.String.check(Schema.isPattern(/^[a-z0-9][a-z0-9._-]*\/[a-z0-9][a-z0-9._/-]*$/)).pipe(
  4. Schema.brand("Instruction.Key"),
  5. )
  6. export type Key = typeof Key.Type
  7. export const Hash = Schema.String.check(Schema.isPattern(/^[a-f0-9]{64}$/)).pipe(Schema.brand("Instruction.Hash"))
  8. export type Hash = typeof Hash.Type
  9. export const Values = Schema.Record(Key, Hash)
  10. export type Values = Readonly<Record<string, Hash>>
  11. export const Removed = Schema.Literal("removed")
  12. export type Removed = typeof Removed.Type
  13. export const removed = Removed.make("removed")
  14. export const Delta = Schema.Record(Schema.String, Schema.Union([Hash, Removed]))
  15. export type Delta = typeof Delta.Type