From b79801a1d78d1f4503138e8c4bba619e694f8871 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Wed, 22 Mar 2023 22:06:30 -0500 Subject: [PATCH] Add docs --- docs/.gitignore | 1 + docs/book.toml | 6 ++++++ docs/src/SUMMARY.md | 5 +++++ docs/src/app/meta_json.md | 3 +++ flake.nix | 1 + src/core/db.ts | 36 +++++++++++++++++++++++++++++++----- 6 files changed, 47 insertions(+), 5 deletions(-) create mode 100644 docs/.gitignore create mode 100644 docs/book.toml create mode 100644 docs/src/SUMMARY.md create mode 100644 docs/src/app/meta_json.md diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 0000000..7585238 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1 @@ +book diff --git a/docs/book.toml b/docs/book.toml new file mode 100644 index 0000000..4a656b4 --- /dev/null +++ b/docs/book.toml @@ -0,0 +1,6 @@ +[book] +authors = ["Michael Zhang"] +language = "en" +multilingual = false +src = "src" +title = "mznotes documentation" diff --git a/docs/src/SUMMARY.md b/docs/src/SUMMARY.md new file mode 100644 index 0000000..a1e4db4 --- /dev/null +++ b/docs/src/SUMMARY.md @@ -0,0 +1,5 @@ +# Summary + +## App Developers + +- [`meta.json`](./app/meta_json.md) diff --git a/docs/src/app/meta_json.md b/docs/src/app/meta_json.md new file mode 100644 index 0000000..8e80938 --- /dev/null +++ b/docs/src/app/meta_json.md @@ -0,0 +1,3 @@ +# `meta.json` + +`meta.json` is the entrypoint for installing an application. diff --git a/flake.nix b/flake.nix index aa2179a..5aa3d40 100644 --- a/flake.nix +++ b/flake.nix @@ -23,6 +23,7 @@ cargo-watch deno + mdbook (python310.withPackages (p: with p; [ ipython numpy scipy sympy ])) ]) ++ (with toolchain; [ diff --git a/src/core/db.ts b/src/core/db.ts index d7ff2f6..53f9389 100644 --- a/src/core/db.ts +++ b/src/core/db.ts @@ -1,8 +1,29 @@ -type NodeCreationRequest = { -}; +interface ICreateNodeRequest { + /** + * A label for humans. This is not used by the database in any way, it's just + * something to print when debugging. + */ + label: string; + + /** + * A mapping from labels to node creation requests. + */ + auxiliary_nodes: Map; + + /** + * A set of edges, using the IDs in auxiliary_nodes. + */ + edges: Set; +} + +interface ICreateEdgeRequest { + from_node: string; + to_node: string; + metadata: unknown; +} export default class Database { - public createNode(request: NodeCreationRequest): Node { + public createNode(request: ICreateNodeRequest): Node { // TODO: Calculate the interfaces that must be implemented // - Use the interface application rules // - Insert them into the database @@ -13,11 +34,16 @@ export default class Database { // TODO: Run pre-creation hooks + // TODO: Create all the nodes according to their requests + + // TODO: Run all validations on all of the nodes + let node = new Node(); + + return node; } } export class Node { - public delete() { - } + public delete() {} }