This repository has been archived by the owner on May 28, 2023. It is now read-only.
Replies: 1 comment 1 reply
-
There're more to add, but the general idea is described, comments and thoughts are highly appreciated! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This discussion is created to discuss my new proposal for
ntast
to make it easier to work with Notion content at application layer while maintaining efficient communication with Notion API.Why?
While Notion API block structure is brilliant to make partial query and transaction effective, it's too low-level from application-level constraints, which makes it hard and error-prone to work with at application layer.
Notion API block structure is already presented very well in notion-types, big shoutout to @transitive-bullshit 🙌🏻.
Glossary
Application layer
: where a Notion-based end-user application is implemented, e.g. 3rd apps, Notion web/desktop app. At this layer, an app should work on only data structures that directly describe Notion-application features, e.g. a heading 1 block, a text block can be bold, italic, etc.Persistence layer
: where changes on application layer are persisted. This is done by communicating with Notion API.Notion API is unaware of
Application layer
and has its own protocol forPersistence layer
.Goals
Notion API query objects↔️ ntast
This can be done easily as
ntast
is a high-level representation of Notion query objects. However, this needs to be done in a way that changes can be detected.In Notion, there're 3 types of changes:
Changes should be detected as simple as:
Block creation and deletion
This can be done by maintaining an id of a block.
Block property change
This can be done by checking deep equality between 2 instances of the same block id (using deep-equal library).
Children's order change
[WIP]
ntast↔️ Notion API transaction
Thanks to the ability to compare and detect changes from 2 instances of the same tree, transactions can be created:
Syntax trees
List of syntax trees implementing above assumptions.
[WIP]
Beta Was this translation helpful? Give feedback.
All reactions