fix(sessions): allow optional patch field in diff for migrated sessions (#26574)
This commit is contained in:
@@ -23,11 +23,12 @@ function span(id: string, value: { value: string; start: number; end: number })
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function diff(kind: string, diffs: { file: string; patch: string }[] | undefined) {
|
function diff(kind: string, diffs: { file: string; patch?: string }[] | undefined) {
|
||||||
return diffs?.map((item, i) => ({
|
return diffs?.map((item, i) => ({
|
||||||
...item,
|
...item,
|
||||||
file: redact(`${kind}-file`, String(i), item.file),
|
file: redact(`${kind}-file`, String(i), item.file),
|
||||||
patch: redact(`${kind}-patch`, String(i), item.patch),
|
patch:
|
||||||
|
item.patch === undefined ? undefined : redact(`${kind}-patch`, String(i), item.patch),
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export type Patch = typeof Patch.Type
|
|||||||
|
|
||||||
export const FileDiff = Schema.Struct({
|
export const FileDiff = Schema.Struct({
|
||||||
file: Schema.String,
|
file: Schema.String,
|
||||||
patch: Schema.String,
|
patch: Schema.optional(Schema.String),
|
||||||
additions: NonNegativeInt,
|
additions: NonNegativeInt,
|
||||||
deletions: NonNegativeInt,
|
deletions: NonNegativeInt,
|
||||||
status: Schema.optional(Schema.Literals(["added", "deleted", "modified"])),
|
status: Schema.optional(Schema.Literals(["added", "deleted", "modified"])),
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ export type PermissionRequest = {
|
|||||||
|
|
||||||
export type SnapshotFileDiff = {
|
export type SnapshotFileDiff = {
|
||||||
file: string
|
file: string
|
||||||
patch: string
|
patch?: string
|
||||||
additions: number
|
additions: number
|
||||||
deletions: number
|
deletions: number
|
||||||
status?: "added" | "deleted" | "modified"
|
status?: "added" | "deleted" | "modified"
|
||||||
|
|||||||
Reference in New Issue
Block a user