From 59f353d5ef6c2e08fa2e42a202c95ab7f39f60de Mon Sep 17 00:00:00 2001 From: mercillo Date: Wed, 24 Jan 2024 09:18:28 -0800 Subject: [PATCH 1/2] updated documentation with diagrams --- .../data-diagrams-with-binding-parser.md | 56 +++++++++++++++++++ .../guides/data-diagrams-with-middle-ware.md | 37 ++++++++++++ docs/site/pages/guides/data-diagrams.md | 35 ++++++++++++ 3 files changed, 128 insertions(+) create mode 100644 docs/site/pages/guides/data-diagrams-with-binding-parser.md create mode 100644 docs/site/pages/guides/data-diagrams-with-middle-ware.md create mode 100644 docs/site/pages/guides/data-diagrams.md diff --git a/docs/site/pages/guides/data-diagrams-with-binding-parser.md b/docs/site/pages/guides/data-diagrams-with-binding-parser.md new file mode 100644 index 000000000..dabe6eeb8 --- /dev/null +++ b/docs/site/pages/guides/data-diagrams-with-binding-parser.md @@ -0,0 +1,56 @@ + +```mermaid +sequenceDiagram + title Data Controller with Binding Parser + participant P as Player + + %% the controller is responsible for orchestrating the flow of data and handling interactions between the Data model + participant DC as dataController + + + %% the bindingPasrser is responsible for parsing raw binding strings and creating BindingInstance Objects. These represent paths in the datamodel. + participant BP as BindingParser + Note over BP: Binding parser helps get the binding path in the DataModel.
It helps ensure that bindings are correctly parsed and
are represented as BINDINGINSTANCE objects + + %% the model is reponsible for defining the structure of the data, handling the data operations(get,set,delete), and managing middleware for data processing + participant DM as dataModel + + + + + + Note over P: Initial Data : + Note over P: foo: { + Note over P: bar: { baz:"HelloWorld" }, + Note over P: array: [ { property: "another value}] + Note over P: } + + P->>DC: Request to get(foo.bar.baz) + %%DataController handles this request + DC->>BP: get('foo.bar.baz') + + Note right of BP: The DC utilizes the BindingParser to parse the binding string. + Note right of BP: BindingaParser takes the raw binding string and normalizes it. + Note right of BP: ["foo","bar","baz] would be the normalized path + Note right of BP: an AST gets generated with the normalized path using parseBinding + Note right of BP: which the AST then gets resolved to a normalized result, creating a BindingInstance + BP-->>DM: the BindingParser processes the request with the BindingInstance + + Note over BP: A BindingInstance helps with data manipulation within the data model. + DM->>DC: returns "Hello World" + + %%sets a binding of foo.bar to 'Hello World' + + + P->>DC: Request to Set foo.array.0.property to "New Value" + %% Set takes in a (transaction and options?) as its parameters + + DC->>BP: set(transaction, options) + Note right of DC: On a deeper level, we keep track of the transactions and updates
to help with debugging and logging. Once all the update is accounted
for, it then calls set on the dataModel. + BP->>DM: set([[foo.array.0.property, "New Value"]]) + Note right of DM: { foo: bar {...}, { array:[ property: "New Value"} ] } + + + +``` + diff --git a/docs/site/pages/guides/data-diagrams-with-middle-ware.md b/docs/site/pages/guides/data-diagrams-with-middle-ware.md new file mode 100644 index 000000000..109278312 --- /dev/null +++ b/docs/site/pages/guides/data-diagrams-with-middle-ware.md @@ -0,0 +1,37 @@ + +```mermaid +sequenceDiagram + title Data Controller with MiddleWare + participant P as Player + + %% the controller is responsible for orchestrating the flow of data and handling interactions between the Data model + participant DC as dataController + + + participant MW as Validation Middleware + + Note right of MW: Keep in mind the Binding Parser is still being used to help
parse the bindings in the dataModel to the values + + + %% the model is reponsible for defining the structure of the data, handling the data operations(get,set,delete), and managing middleware for data processing + participant DM as dataModel + + + P->>DC: Request to set a value that has validation + + + DC-->>DM: calls set([[binding,value]],options) + Note over MW: The middleware intercepts the set,
calling set(transaction, options, next) + MW-->DM: for each transaction, sets a shadowModelPath for the binding + MW-->DM: checks to see if validations exist using the MiddlewareCheck for current binding + MW-->DM: [does check to see if binding is strong or week] + MW->>DM: by calling next.set(nextTransaction, options), this is calling the datamodels .set call + DM->>DC: this returns all invalid and valid results + + + + + + +``` + diff --git a/docs/site/pages/guides/data-diagrams.md b/docs/site/pages/guides/data-diagrams.md new file mode 100644 index 000000000..37287c108 --- /dev/null +++ b/docs/site/pages/guides/data-diagrams.md @@ -0,0 +1,35 @@ + +```mermaid +sequenceDiagram + title Data Controller/Model High Level + participant P as Player + + %% the controller is responsible for orchestrating the flow of data and handling interactions between the Data model + participant DC as Data Controller + + %% the model is reponsible for defining the structure of the data, handling the data operations(get,set,delete), and managing middleware for data processing + participant DM as Data Model + + + Note over P: Initial Data is seeded + Note over P: foo: { bar: "HelloWorld" } + P->>DC: Request to get the value of foo.bar + DC->>DM: get('foo.bar') + + DM->>DC: returns "Hello World" + %%sets a binding of foo.bar to 'Hello World' + + + P->>DC: request to Set foo.bar to "New Value" + %% Set takes in a (transaction and options?) as its parameters + + + Note right of DC: On a deeper level, we keep track of the transactions and updates
to help with debugging and logging. Once all the update is accounted
for, it then calls set on the dataModel. + DC->>DM: set([[foo.bar, "New Value"]],{options}) + Note right of DM: { foo: { bar: "New Value"} } + Note right of DM: options can also be passed to show things such as
if the value should be formatted ,
include invalid results, etc + + P->>DC: deleting a binding of foo.bar + DC->>DM: delete(foo.bar) + +``` \ No newline at end of file From 66bbc602c64041475f6d7cd0873fcb81f00b801e Mon Sep 17 00:00:00 2001 From: mercillo Date: Mon, 29 Jan 2024 13:38:17 -0800 Subject: [PATCH 2/2] updated so mmd graphs show on github --- ...parser.md => data-diagrams-with-binding-parser.mmd} | 6 ------ ...ddle-ware.md => data-diagrams-with-middle-ware.mmd} | 10 ---------- .../guides/{data-diagrams.md => data-diagrams.mmd} | 3 --- 3 files changed, 19 deletions(-) rename docs/site/pages/guides/{data-diagrams-with-binding-parser.md => data-diagrams-with-binding-parser.mmd} (99%) rename docs/site/pages/guides/{data-diagrams-with-middle-ware.md => data-diagrams-with-middle-ware.mmd} (84%) rename docs/site/pages/guides/{data-diagrams.md => data-diagrams.mmd} (98%) diff --git a/docs/site/pages/guides/data-diagrams-with-binding-parser.md b/docs/site/pages/guides/data-diagrams-with-binding-parser.mmd similarity index 99% rename from docs/site/pages/guides/data-diagrams-with-binding-parser.md rename to docs/site/pages/guides/data-diagrams-with-binding-parser.mmd index dabe6eeb8..7af13f710 100644 --- a/docs/site/pages/guides/data-diagrams-with-binding-parser.md +++ b/docs/site/pages/guides/data-diagrams-with-binding-parser.mmd @@ -1,5 +1,4 @@ -```mermaid sequenceDiagram title Data Controller with Binding Parser participant P as Player @@ -49,8 +48,3 @@ sequenceDiagram Note right of DC: On a deeper level, we keep track of the transactions and updates
to help with debugging and logging. Once all the update is accounted
for, it then calls set on the dataModel. BP->>DM: set([[foo.array.0.property, "New Value"]]) Note right of DM: { foo: bar {...}, { array:[ property: "New Value"} ] } - - - -``` - diff --git a/docs/site/pages/guides/data-diagrams-with-middle-ware.md b/docs/site/pages/guides/data-diagrams-with-middle-ware.mmd similarity index 84% rename from docs/site/pages/guides/data-diagrams-with-middle-ware.md rename to docs/site/pages/guides/data-diagrams-with-middle-ware.mmd index 109278312..7189dab2b 100644 --- a/docs/site/pages/guides/data-diagrams-with-middle-ware.md +++ b/docs/site/pages/guides/data-diagrams-with-middle-ware.mmd @@ -1,5 +1,4 @@ -```mermaid sequenceDiagram title Data Controller with MiddleWare participant P as Player @@ -24,14 +23,5 @@ sequenceDiagram Note over MW: The middleware intercepts the set,
calling set(transaction, options, next) MW-->DM: for each transaction, sets a shadowModelPath for the binding MW-->DM: checks to see if validations exist using the MiddlewareCheck for current binding - MW-->DM: [does check to see if binding is strong or week] - MW->>DM: by calling next.set(nextTransaction, options), this is calling the datamodels .set call DM->>DC: this returns all invalid and valid results - - - - - - -``` diff --git a/docs/site/pages/guides/data-diagrams.md b/docs/site/pages/guides/data-diagrams.mmd similarity index 98% rename from docs/site/pages/guides/data-diagrams.md rename to docs/site/pages/guides/data-diagrams.mmd index 37287c108..3052f8eef 100644 --- a/docs/site/pages/guides/data-diagrams.md +++ b/docs/site/pages/guides/data-diagrams.mmd @@ -1,5 +1,4 @@ -```mermaid sequenceDiagram title Data Controller/Model High Level participant P as Player @@ -31,5 +30,3 @@ sequenceDiagram P->>DC: deleting a binding of foo.bar DC->>DM: delete(foo.bar) - -``` \ No newline at end of file