revert.ts 880 B

123456789101112131415161718192021222324
  1. export * as Revert from "./revert"
  2. import { Schema } from "effect"
  3. import { optional } from "./schema"
  4. import { NonNegativeInt, RelativePath } from "./schema"
  5. import { SessionMessage } from "./session-message"
  6. export const FileDiff = Schema.Struct({
  7. path: RelativePath,
  8. status: Schema.Literals(["added", "modified", "deleted"]),
  9. additions: NonNegativeInt,
  10. deletions: NonNegativeInt,
  11. patch: Schema.String,
  12. }).annotate({ identifier: "File.Diff" })
  13. export interface FileDiff extends Schema.Schema.Type<typeof FileDiff> {}
  14. export const State = Schema.Struct({
  15. messageID: SessionMessage.ID,
  16. partID: Schema.String.pipe(optional),
  17. snapshot: Schema.String.pipe(optional),
  18. diff: Schema.String.pipe(optional),
  19. files: Schema.Array(FileDiff).pipe(optional),
  20. }).annotate({ identifier: "Revert.State" })
  21. export interface State extends Schema.Schema.Type<typeof State> {}