feat(core): add session snapshot and revert system (#33226)
This commit is contained in:
parent
25c6abc31a
commit
9bb5370205
42 changed files with 2311 additions and 365 deletions
23
packages/schema/src/revert.ts
Normal file
23
packages/schema/src/revert.ts
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
export * as Revert from "./revert"
|
||||
|
||||
import { Schema } from "effect"
|
||||
import { NonNegativeInt, RelativePath } from "./schema"
|
||||
import { SessionMessageID } from "./session-message-id"
|
||||
|
||||
export const FileDiff = Schema.Struct({
|
||||
path: RelativePath,
|
||||
status: Schema.Literals(["added", "modified", "deleted"]),
|
||||
additions: NonNegativeInt,
|
||||
deletions: NonNegativeInt,
|
||||
patch: Schema.String,
|
||||
}).annotate({ identifier: "File.Diff" })
|
||||
export type FileDiff = typeof FileDiff.Type
|
||||
|
||||
export const State = Schema.Struct({
|
||||
messageID: SessionMessageID.ID,
|
||||
partID: Schema.String.pipe(Schema.optional),
|
||||
snapshot: Schema.String.pipe(Schema.optional),
|
||||
diff: Schema.String.pipe(Schema.optional),
|
||||
files: Schema.Array(FileDiff).pipe(Schema.optional),
|
||||
})
|
||||
export type State = typeof State.Type
|
||||
Loading…
Add table
Add a link
Reference in a new issue