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

feat: Add global mutation trigger field to EntityCompanionProvider #215

Merged
merged 10 commits into from
Jun 11, 2024

Conversation

Josh-McFarlin
Copy link
Contributor

Why

Adding global mutation triggers to EntityCompanionProvider allows the creation of mutation triggers that run for every entity.

How

I added the property globalMutationTriggers to EntityCompanionProvider. In the EntityMutator constructor, the mutationTriggers property is set to the combination of companionProvider.globalMutationTriggers and any mutation triggers included in the constructor's parameter. Global mutation triggers will always run before any mutation triggers defined for the individual entity.

Test Plan

I modified EntityMutator-test.ts to include the globalMutationTriggers during createEntityMutatorFactory, and these global triggers have their trigger count verified later.

Copy link

codecov bot commented Nov 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (778d9e3) to head (c483e0b).

Current head c483e0b differs from pull request most recent head 97ef6f1

Please upload reports for the commit 97ef6f1 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #215   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           69        70    +1     
  Lines         1899      1921   +22     
  Branches       262       267    +5     
=========================================
+ Hits          1899      1921   +22     
Flag Coverage Δ
integration 100.00% <100.00%> (ø)
unittest 100.00% <100.00%> (ø)

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

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Josh-McFarlin Josh-McFarlin marked this pull request as ready for review June 4, 2024 19:03
packages/entity/src/EntityMutator.ts Outdated Show resolved Hide resolved
packages/entity/src/__tests__/EntityMutator-test.ts Outdated Show resolved Hide resolved
tsconfig.json Outdated Show resolved Hide resolved
yarn.lock Outdated Show resolved Hide resolved
@wschurman wschurman changed the title Add global mutation trigger field to EntityCompanionProvider feat: Add global mutation trigger field to EntityCompanionProvider Jun 11, 2024
Copy link
Member

@wschurman wschurman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few changes before commit, otherwise looks good.

One other thing is I renamed the PR to use conventional commits style, so when you merge it ensure it keeps the new style in the final commit title. This just makes it so that the changelog is auto-generated.

packages/entity/src/EntityCompanionProvider.ts Outdated Show resolved Hide resolved
packages/entity/src/__tests__/EntityCompanion-test.ts Outdated Show resolved Hide resolved
packages/entity/src/utils/mergeMutationTriggers.ts Outdated Show resolved Hide resolved
packages/entity/src/utils/mergeMutationTriggers.ts Outdated Show resolved Hide resolved
@Josh-McFarlin Josh-McFarlin merged commit 6569486 into main Jun 11, 2024
1 check passed
@Josh-McFarlin Josh-McFarlin deleted the global-mutation-triggers branch June 11, 2024 19:24
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.

2 participants