Jungle Code Walkthrough
A mutable store of data, categorised under domains that reflect our applications.
Send actions - All changes are triggered using rxJS actions. which are added to a queue to be handled.
Reduce the queue - The queue, runs reduce and all reducers we declare check for a matching name to determine if they are the intended recipient.
Store updates - subscribers trigger - All subscribers to that state pick up the changes because they're subscribed to them.
Inspired by - http://blog.brecht.io/A-scalable-angular-architecture-part2/
It’s the only interface for our smart components (containers) to communicate with the rest of the application (i.e. the store and services).
It’s a facade that abstracts away specific business logic from our components.
App-shell is your root component... header, content, footer basics..
Common module is common to nearly all.... shared code stuff.
Articles, Authentication, Contact-us, Dashboard are all domains that reflect structure of the app..
Its just semantics
Containers are smart components, typically a page loaded by a router and always has access to at least one sandbox.
Components are stupid, they only know how to take data @inputs, and delegate user inputs via @Outputs back out
Most of the time - containers encapsulate containers... exception to that rule is when a nested component gets a sandbox because it is less noise to do so... (tradeoff)
A very recent SLACK chat with CF guys
(I say #1 for now)
1. Leave it as is for now, but try to secure it by creating a proxy on the middleware tier to hide the CMA key at least
2. Build micro-services in house for 'likes', 'collections' and 'comments' and send the data there for speed instead. Integration fun.
3. Rip out contentful altogether... likely the route the .NET guys will opt for.
cma-service - The write service CRUD functionality for generic CF stuff. We made cf-write-query-helper.service.ts to help with queries.
graphql-service - The readonly service uses graphql schema queries. Uses cf-read-query-helper.service.ts to help with query building
* Some remain encapsulated in their respective modules e.g. authentication
For when something had both read and write requirements, a facade was made to encompass the common functionality and complexity.
Exception to the rule as always is when the process of writing was simple enough to use cma service directly...
e.g. 'User profile' and 'User preferences'.. but see profileprefs-sandbox.ts for where we just use the cma-service directly for simplicity... inconsistent.. i know...
This service is implemented by the graphql-service and cma-service and is just there to help with making it clear when the app is 'processing' something async.. we use this to reflect loading spinners on the UI etc...
When we realised that cf-graphQL didn't send me 'total' for a collection e.g. here is 50 of 1020 possible results... i had to write a query to pull totals for :
This might be deprecated after Emily updates cf-graphql to latest (this will take some reworking though)