Skip to content

Commit

Permalink
fix: decomposing, recomposing
Browse files Browse the repository at this point in the history
  • Loading branch information
WillieRuemmele committed Sep 4, 2024
1 parent 6cc84d4 commit 37874cd
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/convert/transformers/decomposedPermissionSetTransformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,14 @@ const getChildWriteInfos =
(stateSetter: StateSetter) =>
(childrenOfMergeComponent: ComponentSet) =>
({ mergeWith, childComponent, value, entryName }: InfoContainer): WriteInfo[] => {
const source = objectToSource(childComponent.parent!.type.name)(childComponent.type.name)(
value as unknown as JsonMap[]
);
const childDirectories = childComponent.parent?.type.children?.directories as Record<string, string>;

// convert to the correct child's xml tag with capitalization
const source = objectToSource(childComponent.parent!.type.name)(
Object.entries(childDirectories)
.find((e) => e[1] === childComponent.type.name.toLowerCase())
?.at(0) ?? ''
)(value as unknown as JsonMap[]);
// if there's nothing to merge with, push write operation now to default location
if (!mergeWith) {
return [{ source, output: getDefaultOutput(childComponent) }];
Expand Down Expand Up @@ -320,7 +325,11 @@ const getAndCombineChildWriteInfos = (
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
[info[0].parentComponent.type.name]: Object.assign(
{},
...info.map((i) => ({ [i.childComponent.type.name]: i.value }))
...info.map((i) => ({
[Object.entries(i.childComponent.parent?.type.children?.directories as Record<string, string>)
.find((e) => e[1] === i.childComponent.type.name.toLowerCase())
?.at(0) ?? '']: i.value,
}))
),
});
// if there's nothing to merge with, push write operation now to default location
Expand Down

2 comments on commit 37874cd

@svc-cli-bot
Copy link
Collaborator

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: 37874cd Previous: 44b539e Ratio
eda-componentSetCreate-linux 234 ms 241 ms 0.97
eda-sourceToMdapi-linux 2336 ms 2298 ms 1.02
eda-sourceToZip-linux 1914 ms 1860 ms 1.03
eda-mdapiToSource-linux 2921 ms 2924 ms 1.00
lotsOfClasses-componentSetCreate-linux 441 ms 435 ms 1.01
lotsOfClasses-sourceToMdapi-linux 3766 ms 3743 ms 1.01
lotsOfClasses-sourceToZip-linux 3143 ms 3260 ms 0.96
lotsOfClasses-mdapiToSource-linux 3741 ms 3658 ms 1.02
lotsOfClassesOneDir-componentSetCreate-linux 771 ms 759 ms 1.02
lotsOfClassesOneDir-sourceToMdapi-linux 6576 ms 6608 ms 1.00
lotsOfClassesOneDir-sourceToZip-linux 5897 ms 5907 ms 1.00
lotsOfClassesOneDir-mdapiToSource-linux 6635 ms 6627 ms 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@svc-cli-bot
Copy link
Collaborator

Choose a reason for hiding this comment

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

Benchmark

Benchmark suite Current: 37874cd Previous: 44b539e Ratio
eda-componentSetCreate-win32 762 ms 702 ms 1.09
eda-sourceToMdapi-win32 4573 ms 4541 ms 1.01
eda-sourceToZip-win32 3270 ms 3207 ms 1.02
eda-mdapiToSource-win32 6070 ms 6210 ms 0.98
lotsOfClasses-componentSetCreate-win32 1338 ms 1337 ms 1.00
lotsOfClasses-sourceToMdapi-win32 8349 ms 8383 ms 1.00
lotsOfClasses-sourceToZip-win32 5426 ms 5450 ms 1.00
lotsOfClasses-mdapiToSource-win32 8477 ms 8702 ms 0.97
lotsOfClassesOneDir-componentSetCreate-win32 2281 ms 2147 ms 1.06
lotsOfClassesOneDir-sourceToMdapi-win32 14576 ms 13993 ms 1.04
lotsOfClassesOneDir-sourceToZip-win32 9146 ms 9307 ms 0.98
lotsOfClassesOneDir-mdapiToSource-win32 14182 ms 14439 ms 0.98

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.