Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/perfScaleNut.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: latest
cache: yarn
- run: npm install -g sfdx-cli --omit=dev
- run: yarn install
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/registryCheck.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: latest
- run: yarn install
- run: yarn build
- run: yarn test:registry
2 changes: 0 additions & 2 deletions .github/workflows/registryCheckPreview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: latest
- run: yarn install
- run: yarn build
- run: yarn metadata:preview
Expand Down
11 changes: 10 additions & 1 deletion src/resolve/manifestResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,16 @@ export class ManifestResolver {
const apiVersion = parsedManifest.version;

for (const typeMembers of packageTypeMembers) {
const typeName = typeMembers.name;
let typeName = typeMembers.name;
// protect against empty/invalid typeMember definitions in the manifest
if (typeof typeName !== 'string' || typeName.length === 0) {
if (typeof typeName === 'object') {
typeName = JSON.stringify(typeName);
}
const err = new Error(`Invalid types definition in manifest file: ${manifestPath}\nFound: "${typeName ?? ''}"`);
err.name = 'InvalidManifest';
throw err;
}
const type = this.registry.getTypeByName(typeName);
const parentType = type.folderType ? this.registry.getTypeByName(type.folderType) : undefined;
const members = ensureArray(typeMembers.members);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[
{
"name": "componentSetCreate",
"duration": 214.46215100004338
"duration": 211.98616599995876
},
{
"name": "sourceToMdapi",
"duration": 6232.359846999985
"duration": 5675.445168000006
},
{
"name": "sourceToZip",
"duration": 4866.491668000002
"duration": 4325.303721999982
},
{
"name": "mdapiToSource",
"duration": 4188.821088000026
"duration": 3837.6363589999964
}
]
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[
{
"name": "componentSetCreate",
"duration": 428.76088600000367
"duration": 414.30975700001
},
{
"name": "sourceToMdapi",
"duration": 8602.956126999983
"duration": 8222.016792999988
},
{
"name": "sourceToZip",
"duration": 6805.6596850000205
"duration": 6871.310621000011
},
{
"name": "mdapiToSource",
"duration": 5127.636436000001
"duration": 4824.338472999982
}
]
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[
{
"name": "componentSetCreate",
"duration": 776.4044480000157
"duration": 710.4652360000182
},
{
"name": "sourceToMdapi",
"duration": 12145.154593000014
"duration": 11589.544998999976
},
{
"name": "sourceToZip",
"duration": 11030.154324000003
"duration": 11294.996881
},
{
"name": "mdapiToSource",
"duration": 12548.084606999997
"duration": 13089.373708
}
]
30 changes: 30 additions & 0 deletions test/resolve/manifestResolver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,36 @@ describe('ManifestResolver', () => {
expect(result.components).to.deep.equal(expected);
});

it('should throw when type is empty', async () => {
const badManifest: VirtualFile = {
name: 'bad-package.xml',
data: Buffer.from(`<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
<types>
<members></members>
<name></name>
</types>
<version>52.0</version>
</Package>\n`),
};
const tree = new VirtualTreeContainer([
{
dirPath: '.',
children: [badManifest],
},
]);
const resolver = new ManifestResolver(tree);
try {
await resolver.resolve(badManifest.name);
expect(true, 'expected invalid types definition error').to.be.false;
} catch (error) {
expect(error).to.have.property('name', 'InvalidManifest');
expect(error)
.to.have.property('message')
.and.include(`Invalid types definition in manifest file: ${badManifest.name}`);
}
});

it('should resolve nested InFolder types', async () => {
const registry = new RegistryAccess();
const reportType = registry.getTypeByName('report');
Expand Down