@oobleck/fluid-backend
Version:
Fluid Framework backend for nteract RTC
99 lines (80 loc) • 2.22 kB
text/typescript
import { CellOutputDef, MetadataEntryDef, PeerLocationDef } from "./types";
export type CellSourceEdit = {
__typename: "TextInserted"
id: string
diff: string
start: number
} | {
__typename: "TextReplaced"
id: string
diff: string
start: number
len: number
} | {
__typename: "TextDeleted"
id: string
start: number
len: number
}
interface ICellOrderEvent {
id: string
sequenceNumber: number
}
export interface ICellInsertedEvent extends ICellOrderEvent {
__typename: "CellInsertedEvent"
pos: number
after?: string
before?: string
}
export interface ICellRemovedEvent extends ICellOrderEvent {
__typename: "CellRemovedEvent"
pos: number
}
export interface ICellMovedEvent extends ICellOrderEvent {
__typename: "CellMovedEvent"
from: number
to: number
}
export interface ICellReplacedEvent extends ICellOrderEvent {
__typename: "CellReplacedEvent"
replacedBy: string
pos: number
}
type CellOrderEvent = ICellInsertedEvent | ICellRemovedEvent | ICellMovedEvent | ICellReplacedEvent
export interface INotebookMetadataEvent {
__typename: "NotebookMetadataEvent"
entry: MetadataEntryDef
}
export type NotebookEvent = INotebookMetadataEvent | CellOrderEvent
export interface ICellMetadataEvent {
__typename: "CellMetadataEvent"
id: string
entry: MetadataEntryDef
}
export interface IOutputAppendedEvent {
__typename: "OutputAppendedEvent"
id: string
output: CellOutputDef
}
export interface IOutputsClearedEvent {
__typename: "OutputsClearedEvent"
id: string
}
type CellOutputEvent = IOutputAppendedEvent | IOutputsClearedEvent;
export type CellEvent = ICellMetadataEvent | CellOutputEvent;
export interface IPeerConnectedEvent {
__typename: "PeerConnectedEvent"
id: string
userId: string
userName: string
}
export interface IPeerDisconnectedEvent {
__typename: "PeerDisconnectedEvent"
id: string
}
export interface IPeerLocationUpdatedEvent {
__typename: "PeerLocationUpdatedEvent"
id: string
location?: PeerLocationDef
}
export type PresenceEvent = IPeerConnectedEvent | IPeerDisconnectedEvent | IPeerLocationUpdatedEvent