From 7ba7d7334e0cba80dd7c77ebea4b2574857454b6 Mon Sep 17 00:00:00 2001 From: Michael Zhang Date: Tue, 18 Apr 2023 23:26:51 -0500 Subject: [PATCH] add some more docs --- docs/src/index.md | 41 +++++++++++++++++++++++++++++++++++ src/core/db.ts | 4 ++++ src/routes/calendar/index.tsx | 3 +++ 3 files changed, 48 insertions(+) create mode 100644 src/routes/calendar/index.tsx diff --git a/docs/src/index.md b/docs/src/index.md index 695ac1e..d9a9d16 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -139,3 +139,44 @@ - Subset of React components to typecheck against - Aggregated queries and group by? Joins? + + - Middleware interface / higher-order nodes + + - the idea would be it would be solely dependent on / modify another + - i think this would also want to pair with some notion of app-private nodes + + - for example, use cases would be: + + - version control? + + - update "hook" for this would create a third node and append it + + ``` + const newPrev = new Node() + newPrev.prev = curr.prev + curr.prev = newPrev + ``` + + creates like a linked list of version updates + + - Pub/Sub? + + - i think this could use the same interface as the query interface, so you + would just "listen" to updates there, rather than just getting a single + snapshot of it + + - findNodes interface: + - Params + - mode, one of "single", "many", "stream" + - single: return a single document + - many: return many documents (may limit with take) + - TODO: what does a cursor look like? + - stream: open a socket and keep listening for + - streamType, one of "inserts" or "updates" + - metadata: object + - `{ [keyName] : { has?: boolean, value?: [value], select: boolean } }` + - has means if it's not in there, then filter it out + - value means that if the value's not exactly a match, then filter + it out + - could this include valueMatches, which runs a custom predicate? + - select means should this be included in the result diff --git a/src/core/db.ts b/src/core/db.ts index 9755e8e..be0c116 100644 --- a/src/core/db.ts +++ b/src/core/db.ts @@ -97,6 +97,8 @@ export class Database { } } + // TODO: Notify pubsub streams that this has been created? + return createdNode; }); } @@ -125,6 +127,8 @@ export class Database { } }); + // TODO: Notify pubsub streams that this has updated? + return await this.prisma.node.findFirst({ where: { id: request.id }, select: { id: true, label: true, metadata: true }, diff --git a/src/routes/calendar/index.tsx b/src/routes/calendar/index.tsx new file mode 100644 index 0000000..3443961 --- /dev/null +++ b/src/routes/calendar/index.tsx @@ -0,0 +1,3 @@ +export default function Calendar() { + return <>Calendar; +}