@sheetwrite/coreinterface
Document, version, durability, and online options for synchronization.
- Package
@sheetwrite/core- Source
packages/core/src/sync.ts#L184
Members 7
documentId
documentId: string;serverVersion
serverVersion: number;createMutationId
createMutationId?: () => string;pendingStorage
pendingStorage?: PendingCommitStorageinterface PendingCommitStorage {
load(
documentId: string,
options: PendingCommitLoadOptions,
): Promise<readonly PendingCommit[]>;
put(commit: PendingCommit, signal?: AbortSignal): Promise<void>;
remove(
documentId: string,
clientMutationId: string,
signal?: AbortSignal,
): Promise<void>;
replace(
documentId: string,
expectedClientMutationIds: readonly string[],
commits: readonly PendingCommit[],
// … 3 more lines — see the API reference
}interface PendingCommitStorage {
load(
documentId: string,
options: PendingCommitLoadOptions,
): Promise<readonly PendingCommit[]>;
put(commit: PendingCommit, signal?: AbortSignal): Promise<void>;
remove(
documentId: string,
clientMutationId: string,
signal?: AbortSignal,
): Promise<void>;
replace(
documentId: string,
expectedClientMutationIds: readonly string[],
commits: readonly PendingCommit[],
// … 3 more lines — see the API reference
}interface PendingCommitStorage {
load(
documentId: string,
options: PendingCommitLoadOptions,
): Promise<
readonly PendingCommit[]
>;
put(
commit: PendingCommit,
signal?: AbortSignal,
): Promise<void>;
remove(
documentId: string,
clientMutationId: string,
signal?: AbortSignal,
): Promise<void>;
replace(
documentId: string,
expectedClientMutationIds: readonly string[],
// … 4 more lines — see the API reference
}Host-owned durable queue. Browser storage lives in the optional ./browser entrypoint.API reference →;initialConnection
initialConnection?: "offline" | "online";recoverVersionGap Optional host recovery hook.
recoverVersionGap?: ( request: SyncVersionGapRequestinterface SyncVersionGapRequest {
documentId: string;
expectedVersion: number;
receivedVersion: number;
signal: AbortSignal;
}interface SyncVersionGapRequest {
documentId: string;
expectedVersion: number;
receivedVersion: number;
signal: AbortSignal;
}interface SyncVersionGapRequest {
documentId: string;
expectedVersion: number;
receivedVersion: number;
signal: AbortSignal;
}Contiguous-version recovery request produced when remote input skips ahead.API reference →, ) => Promise<readonly VersionedOperationinterface VersionedOperation {
version: number;
readonly operations: readonly DocumentOp[];
clientMutationId?: string;
}interface VersionedOperation {
version: number;
readonly operations: readonly DocumentOp[];
clientMutationId?: string;
}interface VersionedOperation {
version: number;
readonly operations: readonly DocumentOp[];
clientMutationId?: string;
}Remote document operations paired with a contiguous server version.API reference →[] | WorkbookSnapshotinterface WorkbookSnapshot {
schemaVersion: 1;
documentId?: string;
version?: number;
workbook: {
activeSheet: SheetId;
namedRanges?: NamedRangeSnapshot[];
};
sheets: SheetSnapshot[];
}interface WorkbookSnapshot {
schemaVersion: 1;
documentId?: string;
version?: number;
workbook: {
activeSheet: SheetId;
namedRanges?: NamedRangeSnapshot[];
};
sheets: SheetSnapshot[];
}interface WorkbookSnapshot {
schemaVersion: 1;
documentId?: string;
version?: number;
workbook: {
activeSheet: SheetId;
namedRanges?: NamedRangeSnapshot[];
};
sheets: SheetSnapshot[];
}Schema-versioned serializable workbook document.API reference →>;Optional host recovery hook. Return the missing ordered operations, or a snapshot for the host to remount before calling `resumeAfterReload`.
limits Overrides remote collaboration and durable local pending-queue ceilings.
limits?: Partial<SyncCoordinatorLimitsinterface SyncCoordinatorLimits {
maxMutationIdBytes: number;
maxOperationsPerVersion: number;
maxVersionPayloadBytes: number;
maxFutureVersionDistance: number;
maxBufferedVersions: number;
maxBufferedOperations: number;
maxBufferedBytes: number;
maxRecentAcknowledgements: number;
maxPendingCommits: number;
maxPendingOperations: number;
maxPendingEncodedBytes: number;
}interface SyncCoordinatorLimits {
maxMutationIdBytes: number;
maxOperationsPerVersion: number;
maxVersionPayloadBytes: number;
maxFutureVersionDistance: number;
maxBufferedVersions: number;
maxBufferedOperations: number;
maxBufferedBytes: number;
maxRecentAcknowledgements: number;
maxPendingCommits: number;
maxPendingOperations: number;
maxPendingEncodedBytes: number;
}interface SyncCoordinatorLimits {
maxMutationIdBytes: number;
maxOperationsPerVersion: number;
maxVersionPayloadBytes: number;
maxFutureVersionDistance: number;
maxBufferedVersions: number;
maxBufferedOperations: number;
maxBufferedBytes: number;
maxRecentAcknowledgements: number;
maxPendingCommits: number;
maxPendingOperations: number;
maxPendingEncodedBytes: number;
}Resource ceilings applied independently to remote collaboration input and local durability.API reference →>;Declaration
View full TypeScript declaration
export interface SyncCoordinatorOptions { documentId: string; serverVersion: number; createMutationId?: () => string; pendingStorage?: PendingCommitStorageinterface PendingCommitStorage {
load(
documentId: string,
options: PendingCommitLoadOptions,
): Promise<readonly PendingCommit[]>;
put(commit: PendingCommit, signal?: AbortSignal): Promise<void>;
remove(
documentId: string,
clientMutationId: string,
signal?: AbortSignal,
): Promise<void>;
replace(
documentId: string,
expectedClientMutationIds: readonly string[],
commits: readonly PendingCommit[],
// … 3 more lines — see the API reference
}interface PendingCommitStorage {
load(
documentId: string,
options: PendingCommitLoadOptions,
): Promise<readonly PendingCommit[]>;
put(commit: PendingCommit, signal?: AbortSignal): Promise<void>;
remove(
documentId: string,
clientMutationId: string,
signal?: AbortSignal,
): Promise<void>;
replace(
documentId: string,
expectedClientMutationIds: readonly string[],
commits: readonly PendingCommit[],
// … 3 more lines — see the API reference
}interface PendingCommitStorage {
load(
documentId: string,
options: PendingCommitLoadOptions,
): Promise<
readonly PendingCommit[]
>;
put(
commit: PendingCommit,
signal?: AbortSignal,
): Promise<void>;
remove(
documentId: string,
clientMutationId: string,
signal?: AbortSignal,
): Promise<void>;
replace(
documentId: string,
expectedClientMutationIds: readonly string[],
// … 4 more lines — see the API reference
}Host-owned durable queue. Browser storage lives in the optional ./browser entrypoint.API reference →; initialConnection?: "offline" | "online"; recoverVersionGap?: ( request: SyncVersionGapRequestinterface SyncVersionGapRequest {
documentId: string;
expectedVersion: number;
receivedVersion: number;
signal: AbortSignal;
}interface SyncVersionGapRequest {
documentId: string;
expectedVersion: number;
receivedVersion: number;
signal: AbortSignal;
}interface SyncVersionGapRequest {
documentId: string;
expectedVersion: number;
receivedVersion: number;
signal: AbortSignal;
}Contiguous-version recovery request produced when remote input skips ahead.API reference →, ) => Promise<readonly VersionedOperationinterface VersionedOperation {
version: number;
readonly operations: readonly DocumentOp[];
clientMutationId?: string;
}interface VersionedOperation {
version: number;
readonly operations: readonly DocumentOp[];
clientMutationId?: string;
}interface VersionedOperation {
version: number;
readonly operations: readonly DocumentOp[];
clientMutationId?: string;
}Remote document operations paired with a contiguous server version.API reference →[] | WorkbookSnapshotinterface WorkbookSnapshot {
schemaVersion: 1;
documentId?: string;
version?: number;
workbook: {
activeSheet: SheetId;
namedRanges?: NamedRangeSnapshot[];
};
sheets: SheetSnapshot[];
}interface WorkbookSnapshot {
schemaVersion: 1;
documentId?: string;
version?: number;
workbook: {
activeSheet: SheetId;
namedRanges?: NamedRangeSnapshot[];
};
sheets: SheetSnapshot[];
}interface WorkbookSnapshot {
schemaVersion: 1;
documentId?: string;
version?: number;
workbook: {
activeSheet: SheetId;
namedRanges?: NamedRangeSnapshot[];
};
sheets: SheetSnapshot[];
}Schema-versioned serializable workbook document.API reference →>; limits?: Partial<SyncCoordinatorLimitsinterface SyncCoordinatorLimits {
maxMutationIdBytes: number;
maxOperationsPerVersion: number;
maxVersionPayloadBytes: number;
maxFutureVersionDistance: number;
maxBufferedVersions: number;
maxBufferedOperations: number;
maxBufferedBytes: number;
maxRecentAcknowledgements: number;
maxPendingCommits: number;
maxPendingOperations: number;
maxPendingEncodedBytes: number;
}interface SyncCoordinatorLimits {
maxMutationIdBytes: number;
maxOperationsPerVersion: number;
maxVersionPayloadBytes: number;
maxFutureVersionDistance: number;
maxBufferedVersions: number;
maxBufferedOperations: number;
maxBufferedBytes: number;
maxRecentAcknowledgements: number;
maxPendingCommits: number;
maxPendingOperations: number;
maxPendingEncodedBytes: number;
}interface SyncCoordinatorLimits {
maxMutationIdBytes: number;
maxOperationsPerVersion: number;
maxVersionPayloadBytes: number;
maxFutureVersionDistance: number;
maxBufferedVersions: number;
maxBufferedOperations: number;
maxBufferedBytes: number;
maxRecentAcknowledgements: number;
maxPendingCommits: number;
maxPendingOperations: number;
maxPendingEncodedBytes: number;
}Resource ceilings applied independently to remote collaboration input and local durability.API reference →>;}