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
#6362: only return unique services from getUnconfiguredComponentIntegrations #6364
Conversation
Codecov Report
@@ Coverage Diff @@
## main #6364 +/- ##
==========================================
+ Coverage 69.94% 69.95% +0.01%
==========================================
Files 1161 1161
Lines 36286 36295 +9
Branches 6826 6828 +2
==========================================
+ Hits 25379 25391 +12
+ Misses 10907 10904 -3
|
} | ||
return uniqBy( | ||
modComponentDefinitions.flatMap(({ services }) => { | ||
if (isEmpty(services)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
optional nit: could we rename services
to integrations
while we're at it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's still referred/saved as services in the schema. That's a larger change than I'm comfortable making now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, you're right. Wasn't thinking about the destructuring there 🤦♀️
src/utils/modDefinitionUtils.ts
Outdated
if (isEmpty(services)) { | ||
return []; | ||
} | ||
return uniqBy( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution won't work as a non-required integration that is earlier in the array will be kept instead of a later required version. Rethinking the implmentation.
@@ -16,7 +16,31 @@ | |||
*/ | |||
|
|||
import { type RegistryId } from "@/types/registryTypes"; | |||
import { getScopeAndId } from "@/utils/registryUtils"; | |||
import { generatePackageId, getScopeAndId } from "@/utils/registryUtils"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relocated test from modDefinitionUtils.test.ts
import { validateOutputKey } from "@/runtime/runtimeTypes"; | ||
import { validateRegistryId } from "@/types/helpers"; | ||
import { SERVICE_BASE_SCHEMA } from "@/services/serviceUtils"; | ||
|
||
extensionPointRegistry.lookup = jest.fn(); | ||
|
||
describe("generateRecipeId", () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
relocated to registryUtils.test.ts
for (const group of Object.values(groupBy(integrationDependencies, "id"))) { | ||
if (group.some(({ isOptional }) => !isOptional)) { | ||
dedupedIntegrationDependencies.push( | ||
group.find(({ isOptional }) => !isOptional) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: any reason why not just assign the result of group.find
to a constant above and use it in the if statement?
When the PR is merged, the first loom link found on this PR will be posted to |
…rations (#6364) * only return unique services from getUnconfiguredComponentIntegrations * updates logic for getUnconfiguredComponentIntegrations; adds tests
What does this PR do?
Demo
https://www.loom.com/share/4dae3396a9f641f3a8b3b9738d9fecbc?sid=878bb96f-fb59-4bdf-9e74-a2730a5d5720
Checklist