MCPcopy Create free account
hub / github.com/TabularisDB/tabularis / validateNotebookFile

Function validateNotebookFile

src/utils/notebookFile.ts:37–52  ·  view source on GitHub ↗
(data: unknown)

Source from the content-addressed store, hash-verified

35}
36
37export function validateNotebookFile(data: unknown): data is NotebookFile {
38 if (typeof data !== "object" || data === null) return false;
39 const obj = data as Record<string, unknown>;
40 if (typeof obj.version !== "number") return false;
41 if (typeof obj.title !== "string") return false;
42 if (!Array.isArray(obj.cells)) return false;
43 return obj.cells.every(
44 (cell: unknown) =>
45 typeof cell === "object" &&
46 cell !== null &&
47 typeof (cell as Record<string, unknown>).type === "string" &&
48 ((cell as Record<string, unknown>).type === "sql" ||
49 (cell as Record<string, unknown>).type === "markdown") &&
50 typeof (cell as Record<string, unknown>).content === "string",
51 );
52}
53
54export function deserializeNotebook(json: string): {
55 title: string;

Callers 2

deserializeNotebookFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected