mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02:00
Merge pull request #20277 from overleaf/jpa-ro-mirror-chunk
[misc] use Chunk for read-only mirror in frontend GitOrigin-RevId: b97e520c7a63015179792542310d18f346752e92
This commit is contained in:
@@ -6,10 +6,11 @@ const OError = require('@overleaf/o-error')
|
||||
const History = require('./history')
|
||||
|
||||
/**
|
||||
* @import { BlobStore } from "./types"
|
||||
* @import { BlobStore, RawChunk } from "./types"
|
||||
* @import Change from "./change"
|
||||
* @import Snapshot from "./snapshot"
|
||||
*/
|
||||
|
||||
class ConflictingEndVersion extends OError {
|
||||
constructor(clientEndVersion, latestEndVersion) {
|
||||
const message =
|
||||
@@ -84,6 +85,10 @@ class Chunk {
|
||||
this.startVersion = startVersion
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {RawChunk} raw
|
||||
* @return {Chunk}
|
||||
*/
|
||||
static fromRaw(raw) {
|
||||
return new Chunk(History.fromRaw(raw.history), raw.startVersion)
|
||||
}
|
||||
|
||||
@@ -76,6 +76,16 @@ export type RawSnapshot = {
|
||||
v2DocVersions?: RawV2DocVersions | null
|
||||
}
|
||||
|
||||
export type RawHistory = {
|
||||
snapshot: RawSnapshot
|
||||
changes: RawChange[]
|
||||
}
|
||||
|
||||
export type RawChunk = {
|
||||
history: RawHistory
|
||||
startVersion: number
|
||||
}
|
||||
|
||||
export type RawFileMap = Record<string, RawFile>
|
||||
|
||||
export type RawFile = { metadata?: Object } & RawFileData
|
||||
|
||||
Reference in New Issue
Block a user