Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracted model event interceptor to separate package #17151

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

naz
Copy link
Contributor

@naz naz commented Jun 28, 2023

refs #17065

  • This is a follow up cleanup work after introducing even mapper when working on collections refresh mechanism.
  • This module manages interception of the Model events and maps/dispatches Domain events that could later be used in different libraries.

🤖 Generated by Copilot at 1d0a031

This pull request introduces a new package @tryghost/model-to-domain-event-interceptor that provides a class ModelToDomainEventInterceptor for translating model events to domain events. It also refactors the CollectionsServiceWrapper class to use this new package, improving the performance and scalability of the collections queries. Additionally, it adds the necessary files and configuration for the new package, such as package.json, .eslintrc.js, tsconfig.json, README.md, and unit tests.

@naz naz requested a review from allouis June 28, 2023 10:23
@naz naz self-assigned this Jun 28, 2023
@codecov
Copy link

codecov bot commented Jun 28, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.10 🎉

Comparison is base (4a6a61b) 71.64% compared to head (52a70b2) 71.75%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17151      +/-   ##
==========================================
+ Coverage   71.64%   71.75%   +0.10%     
==========================================
  Files        1833     1836       +3     
  Lines      116270   116456     +186     
  Branches    17259    17289      +30     
==========================================
+ Hits        83307    83568     +261     
+ Misses      31845    31765      -80     
- Partials     1118     1123       +5     
Flag Coverage Δ
e2e-tests 66.45% <100.00%> (-0.04%) ⬇️
unit-tests 63.71% <96.16%> (+0.26%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...re/server/services/collections/intercept-events.js 100.00% <100.00%> (ø)
...t/core/core/server/services/collections/service.js 100.00% <100.00%> (ø)
...t-interceptor/src/ModelToDomainEventInterceptor.ts 100.00% <100.00%> (ø)
...ost/model-to-domain-event-interceptor/src/index.ts 100.00% <100.00%> (ø)
...tor/test/model-to-domain-event-interceptor.test.ts 100.00% <100.00%> (ø)

... and 19 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

naz added 2 commits July 3, 2023 17:19
refs TryGhost#17065

- This is a follow up cleanup work after introducing even mapper when working on collections refresh mechanism.
- This module manages interception of the Model events and maps/dispatches Domain events that could later be used in different libraries.
no issue

- Function types in TypeScript can have what looks like an unused variable for the eslint. It's part of the TypeScript language and should be fully supported out of the box.
@naz naz force-pushed the model-domain-event-interceptor branch from 3392801 to 52a70b2 Compare July 3, 2023 09:19
@naz naz merged commit a547ae4 into TryGhost:main Jul 3, 2023
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant