sofie-core
sofie-core copied to clipboard
feat: split collections to have server and client versions
- What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Code quality
- What is the current behavior? (You can also link to an open issue here)
We have all the mongodb collections defined in meteor/lib/collections. These are then used by both the server and the client.
They expose both async and sync methods, even though we only want to use sync methods on the client (for now), and async methods on the server (to prepare for removal of fibers). in shared code, we need to decide on a strategy.
- What is the new behavior (if this is a feature change)?
By splitting the collection object so that each of the server and client have their own versions. This will let us control what methods are available in each place separately, and continue to identify and remove usages of the sync methods on the server collections. (We don't need to rush to do this, but it will be needed for Meteor 2.11)
Some collections are not being published to the client, and this isolation allows us to see that more clearly as we can skip defining those client versions.
For now the client collections reside in meteor/lib, so that the shared code in lib can use them. We will likely want to move them eventually, but that will be a much smaller and easier change.
It currently looks a bit unclear as to whether the sync methods will be usable on the client in later versions of meteor, so in the future these may need to become async too, but this lets us approach that independently to the server side.
Minimongo is fine with these being defined like this, any 'collections' used by custom publications have their definitions scattered somewhere in the ui code for a while.
- Other information:
So far this is prototyped on a couple of collections, to allow for evaluating how it looks and whether to progress on it.
Most of this change is updating imports. The files containing the new definitions are of the most interest:
- https://github.com/nrkno/sofie-core/blob/feat/seperate-server-client-collections/meteor/server/serverCollections.ts
- https://github.com/nrkno/sofie-core/blob/feat/seperate-server-client-collections/meteor/lib/clientCollections.ts These could be broken out to more files if necessary. I am not sure that either will get long enough to justify it.
This allows us to remove a lot of the meteor/lib/collections/* files, as most of them are simply re-exporting types that moved to corelib a while ago as well as defining the collections which are being moved as part of this.
There is an object containing all of the collections currently. I think this will not be necessary in the future, so can be removed, or at least refactored. It is being broken by this change so far
Status
- [ ] Code documentation for the relevant parts in the code have been added/updated by the PR author
- [ ] The functionality has been tested by the PR author
- [ ] The functionality has been tested by NRK
Codecov Report
Base: 58.33% // Head: 58.29% // Decreases project coverage by -0.05% :warning:
Coverage data is based on head (
92b325e) compared to base (757a183). Patch coverage: 76.04% of modified lines in pull request are covered.
:mega: This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more
Additional details and impacted files
@@ Coverage Diff @@
## release49 #768 +/- ##
=============================================
- Coverage 58.33% 58.29% -0.05%
=============================================
Files 461 469 +8
Lines 72187 72449 +262
Branches 3616 3622 +6
=============================================
+ Hits 42111 42232 +121
- Misses 30024 30164 +140
- Partials 52 53 +1
| Impacted Files | Coverage Δ | |
|---|---|---|
| meteor/client/lib/dev.ts | 0.00% <0.00%> (ø) |
|
| meteor/client/lib/reactiveData/reactiveData.ts | 0.00% <0.00%> (ø) |
|
| meteor/client/lib/rundownLayouts.ts | 0.00% <0.00%> (ø) |
|
| meteor/client/lib/shelf.ts | 0.00% <0.00%> (ø) |
|
| meteor/client/lib/ui/clipPreview.ts | 0.00% <0.00%> (ø) |
|
| meteor/client/lib/viewPort.ts | 0.00% <0.00%> (ø) |
|
| meteor/client/ui/PieceIcons/utils.ts | 0.00% <0.00%> (ø) |
|
| meteor/client/ui/Prompter/prompter.ts | 0.00% <0.00%> (ø) |
|
| .../client/ui/SegmentContainer/withResolvedSegment.ts | 0.00% <0.00%> (ø) |
|
| meteor/client/ui/i18n.ts | 0.00% <0.00%> (ø) |
|
| ... and 175 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.