UNPKG

@oobleck/fluid-backend

Version:

Fluid Framework backend for nteract RTC

137 lines (112 loc) 2.52 kB
import { NotebookDef, OutputStreamType } from "./types" export interface UpsertNotebookInput { id: string content: NotebookContentInput createNew: boolean } export interface UpsertNotebookPayload { notebook: NotebookDef } export interface NotebookContentInput { cells: CellInput[] metadata?: MetadataInput[] } export type CellInput = { code: CodeCellInput } | { markdown: TextCellInput } | { raw: TextCellInput } export interface CodeCellInput { source: string metadata?: MetadataInput[] executionCount?: number | null outputs?: OutputInput[] } export interface TextCellInput { source: string metadata?: MetadataInput[] } export interface MetadataInput { key: string value: string } export type OutputInput = | { executeResult: ExecuteResultInput } | { displayData: DisplayDataInput } | { stream: StreamOutputInput } | { error: ErrorOutputInput } export interface ExecuteResultInput { executionCount: number | null data: MediaBundleInput[] metadata?: MetadataInput[] } export interface DisplayDataInput { data: MediaBundleInput[] metadata?: MetadataInput[] } export interface StreamOutputInput { name: OutputStreamType text: String } export interface ErrorOutputInput { ename: string evalue: string traceback: string[] } export interface MediaBundleInput { key: string value: string } export interface InsertCellInput { insertAt: number cell: CellInput } export interface MoveCellInput { id: string insertAt: number } export interface PatchCellSourceInput { id: string type: "insert" | "delete" | "replace" diff?: string start: number len?: number } export interface UpdatePresenceInput { focusedCellId: string cursorPosition?: PositionInput textSelection?: SelectionRangeInput } export interface PositionInput { line: number column: number } export interface SelectionRangeInput { lineStart: number columnStart: number lineEnd: number columnEnd: number } export interface ReplaceCellInput { id: string cell: CellInput } export interface ChangeCellTypeInput { id: string cellType: string } export interface UpdateNotebookMetadataInput { metadata: MetadataInput } export interface UpdateCellMetadataInput { id: string metadata: MetadataInput } export interface AppendCellOutputInput { id: string output: OutputInput }