-
Notifications
You must be signed in to change notification settings - Fork 0
Fix ecosystem cache invalidation #95
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
d24dac4
First pass ensure that both main account and sub account are queried …
e389d30
Query split support for both the main account and sub-account
6c91e07
Fix build issue with npm ci for docker hub
ac0f503
Ensure that ecoystem split receivers that are repo sub account ids ar…
945e9ce
projectById can also find by repo sub account id
e57fcbe
DRY up code
118e60f
If an account id is a repo sub account id we don't need to assert tha…
82edda6
Fix copilot function return type feedback
3a90606
Correct return type of calcSubRepoDriverId a la Copilot
33d7ed2
Import calcParentRepoDriverId statically a la Copilot
ae6af07
Reuse sub-account IDs to parent IDs for project receivers a la Copilo…
7f376d0
Restore package-lock.json from main
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import type { AccountId, DbSchema } from '../common/types'; | ||
| import { isRepoDriverId } from '../utils/assert'; | ||
| import { calcSubRepoDriverId } from '../utils/repoSubAccountIdUtils'; | ||
| import type SupportDataSource from '../dataLoaders/SupportDataSource'; | ||
| import type { SplitsReceiverModelDataValues } from '../models/SplitsReceiverModel'; | ||
| import type { GivenEventModelDataValues } from '../given-event/GivenEventModel'; | ||
|
|
||
| /** | ||
| * Gets account IDs to query for project support (main account + sub-account if applicable) | ||
| */ | ||
| export async function getProjectAccountIdsToQuery( | ||
| projectId: AccountId, | ||
| projectChain: DbSchema, | ||
| ): Promise<AccountId[]> { | ||
| const accountIds = [projectId]; | ||
|
|
||
| if (isRepoDriverId(projectId)) { | ||
| const subAccountId = await calcSubRepoDriverId(projectId, projectChain); | ||
| accountIds.push(subAccountId); | ||
| } | ||
|
|
||
| return accountIds; | ||
| } | ||
|
|
||
| /** | ||
| * Queries split support for a project (including both main and sub-account) | ||
| */ | ||
| export async function getProjectSplitSupport( | ||
| projectId: AccountId, | ||
| projectChain: DbSchema, | ||
| supportDataSource: SupportDataSource, | ||
| ): Promise<SplitsReceiverModelDataValues[]> { | ||
| const accountIdsForSplitSupport = await getProjectAccountIdsToQuery( | ||
| projectId, | ||
| projectChain, | ||
| ); | ||
|
|
||
| const splitReceiversResults = await Promise.all( | ||
| accountIdsForSplitSupport.map((accountId) => | ||
| supportDataSource.getSplitSupportByReceiverIdOnChain( | ||
| accountId, | ||
| projectChain, | ||
| ), | ||
| ), | ||
| ); | ||
|
|
||
| return splitReceiversResults.flat(); | ||
| } | ||
|
|
||
| /** | ||
| * Queries one-time donation support for a project (including both main and sub-account) | ||
| */ | ||
| export async function getProjectOneTimeDonationSupport( | ||
| projectId: AccountId, | ||
| projectChain: DbSchema, | ||
| supportDataSource: SupportDataSource, | ||
| ): Promise<GivenEventModelDataValues[]> { | ||
| const accountIdsToQuery = await getProjectAccountIdsToQuery( | ||
| projectId, | ||
| projectChain, | ||
| ); | ||
|
|
||
| return supportDataSource.getOneTimeDonationSupportByAccountIdsOnChain( | ||
| accountIdsToQuery, | ||
| projectChain, | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.