Skip to content

Commit 1727cd3

Browse files
committed
Merge remote-tracking branch 'origin/main' into sm/no-adapter-classes
2 parents 5a0ff3c + 8e14cd8 commit 1727cd3

File tree

29 files changed

+810
-553
lines changed

29 files changed

+810
-553
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
## [12.1.10](https://github.com/forcedotcom/source-deploy-retrieve/compare/12.1.9...12.1.10) (2024-08-01)
2+
3+
### Bug Fixes
4+
5+
- manifests for custom object can omit parent ([#1375](https://github.com/forcedotcom/source-deploy-retrieve/issues/1375)) ([8fd9c9e](https://github.com/forcedotcom/source-deploy-retrieve/commit/8fd9c9ec57a8502234c9c2abe0cd528e5107844b))
6+
7+
## [12.1.9](https://github.com/forcedotcom/source-deploy-retrieve/compare/12.1.8...12.1.9) (2024-07-31)
8+
9+
### Bug Fixes
10+
11+
- use jsforce's `cancelDeploy` method ([#1380](https://github.com/forcedotcom/source-deploy-retrieve/issues/1380)) ([7d644f2](https://github.com/forcedotcom/source-deploy-retrieve/commit/7d644f215d7c0bcfe413d1fcfafc10122b17a412))
12+
113
## [12.1.8](https://github.com/forcedotcom/source-deploy-retrieve/compare/12.1.7...12.1.8) (2024-07-19)
214

315
### Bug Fixes

METADATA_SUPPORT.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This list compares metadata types found in Salesforce v61 with the [metadata reg
44

55
This repository is used by both the Salesforce CLIs and Salesforce's VSCode Extensions.
66

7-
Currently, there are 576/610 supported metadata types.
7+
Currently, there are 577/608 supported metadata types.
88
For status on any existing gaps, please search or file an issue in the [Salesforce CLI issues only repo](https://github.com/forcedotcom/cli/issues).
99
To contribute a new metadata type, please see the [Contributing Metadata Types to the Registry](./contributing/metadata.md)
1010

@@ -167,11 +167,11 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
167167
| DashboardFolder || |
168168
| DataCalcInsightTemplate || |
169169
| DataCategoryGroup || |
170-
| DataConnectionParamTmpl || Not supported, but support could be added |
171170
| DataConnectorIngestApi || |
172171
| DataConnectorS3 || |
173172
| DataDotComSettings || |
174173
| DataImportManagementSettings || |
174+
| DataKitObjectDependency || |
175175
| DataKitObjectTemplate || |
176176
| DataPackageKitDefinition || |
177177
| DataPackageKitObject || |
@@ -393,8 +393,6 @@ To contribute a new metadata type, please see the [Contributing Metadata Types t
393393
| MilestoneType || |
394394
| MktCalcInsightObjectDef || |
395395
| MktDataConnection || Not supported, but support could be added |
396-
| MktDataConnectionCred || Not supported, but support could be added |
397-
| MktDataConnectionParam || Not supported, but support could be added |
398396
| MktDataConnectionSrcParam || Not supported, but support could be added |
399397
| MktDataTranObject || |
400398
| MlDomain || |
@@ -632,7 +630,6 @@ v62 introduces the following new types. Here's their current level of support
632630
| ChannelRevMgmtSettings || |
633631
| ChoiceList || Not supported, but support could be added (but not for tracking) |
634632
| ConversationMessageDefinition || |
635-
| DataKitObjectDependency || |
636633
| EnblProgramTaskSubCategory || |
637634
| ExtlClntAppPushConfigurablePolicies || Not supported, but support could be added (but not for tracking) |
638635
| ExtlClntAppPushSettings || |

messages/sdr.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,3 +190,16 @@ If the type is available via Metadata API but not in the registry
190190

191191
- Open an issue <https://github.com/forcedotcom/cli/issues>
192192
- Add the type via PR. Instructions: <https://github.com/forcedotcom/source-deploy-retrieve/blob/main/contributing/metadata.md>
193+
194+
# type_name_suggestions
195+
196+
Confirm the metadata type name is correct. Validate against the registry at:
197+
<https://github.com/forcedotcom/source-deploy-retrieve/blob/main/src/registry/metadataRegistry.json>
198+
199+
If the type is not listed in the registry, check that it has Metadata API support via the Metadata Coverage Report:
200+
<https://developer.salesforce.com/docs/metadata-coverage>
201+
202+
If the type is available via Metadata API but not in the registry
203+
204+
- Open an issue <https://github.com/forcedotcom/cli/issues>
205+
- Add the type via PR. Instructions: <https://github.com/forcedotcom/source-deploy-retrieve/blob/main/contributing/metadata.md>

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@salesforce/source-deploy-retrieve",
3-
"version": "12.1.8",
3+
"version": "12.1.10",
44
"description": "JavaScript library to run Salesforce metadata deploys and retrieves",
55
"main": "lib/src/index.js",
66
"author": "Salesforce",
@@ -25,9 +25,9 @@
2525
"node": ">=18.0.0"
2626
},
2727
"dependencies": {
28-
"@salesforce/core": "^8.2.1",
28+
"@salesforce/core": "^8.2.8",
2929
"@salesforce/kit": "^3.1.6",
30-
"@salesforce/ts-types": "^2.0.10",
30+
"@salesforce/ts-types": "^2.0.12",
3131
"fast-levenshtein": "^3.0.0",
3232
"fast-xml-parser": "^4.3.6",
3333
"got": "^11.8.6",
@@ -39,22 +39,22 @@
3939
"proxy-agent": "^6.4.0"
4040
},
4141
"devDependencies": {
42-
"@jsforce/jsforce-node": "^3.2.4",
43-
"@salesforce/cli-plugins-testkit": "^5.3.18",
44-
"@salesforce/dev-scripts": "^10.2.2",
42+
"@jsforce/jsforce-node": "^3.4.0",
43+
"@salesforce/cli-plugins-testkit": "^5.3.20",
44+
"@salesforce/dev-scripts": "^10.2.8",
4545
"@types/deep-equal-in-any-order": "^1.0.1",
4646
"@types/fast-levenshtein": "^0.0.4",
4747
"@types/graceful-fs": "^4.1.9",
4848
"@types/mime": "2.0.3",
4949
"@types/minimatch": "^5.1.2",
5050
"deep-equal-in-any-order": "^1.1.19",
5151
"deepmerge": "^4.3.1",
52-
"eslint-plugin-sf-plugin": "^1.18.12",
52+
"eslint-plugin-sf-plugin": "^1.20.1",
5353
"mocha-junit-reporter": "^1.23.3",
5454
"mocha-snap": "^5.0.0",
5555
"ts-node": "^10.9.2",
5656
"ts-patch": "^3.2.1",
57-
"typescript": "^5.5.3"
57+
"typescript": "^5.5.4"
5858
},
5959
"scripts": {
6060
"build": "wireit",

src/client/metadataApiDeploy.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -165,9 +165,7 @@ export class MetadataApiDeploy extends MetadataTransfer<
165165

166166
const connection = await this.getConnection();
167167

168-
// jsforce has an <any> on this
169-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call,@typescript-eslint/no-unsafe-member-access,no-underscore-dangle
170-
await connection.metadata._invoke('cancelDeploy', { id: this.id });
168+
await connection.metadata.cancelDeploy(this.id);
171169
}
172170

173171
protected async pre(): Promise<AsyncResult> {

src/collections/componentSet.ts

Lines changed: 62 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
SfProject,
1818
} from '@salesforce/core';
1919
import { isString } from '@salesforce/ts-types';
20+
import { objectHasSomeRealValues } from '../utils/decomposed';
2021
import { MetadataApiDeploy, MetadataApiDeployOptions } from '../client/metadataApiDeploy';
2122
import { MetadataApiRetrieve } from '../client/metadataApiRetrieve';
2223
import type { MetadataApiRetrieveOptions } from '../client/types';
@@ -406,74 +407,60 @@ export class ComponentSet extends LazyCollection<MetadataComponent> {
406407
* @returns Object representation of a package manifest
407408
*/
408409
public async getObject(destructiveType?: DestructiveChangesType): Promise<PackageManifestObject> {
409-
const version = await this.getApiVersion();
410-
411410
// If this ComponentSet has components marked for delete, we need to
412411
// only include those components in a destructiveChanges.xml and
413412
// all other components in the regular manifest.
414-
let components = this.components;
415-
if (this.getTypesOfDestructiveChanges().length) {
416-
components = destructiveType ? this.destructiveComponents[destructiveType] : this.manifestComponents;
417-
}
413+
const components = this.getTypesOfDestructiveChanges().length
414+
? destructiveType
415+
? this.destructiveComponents[destructiveType]
416+
: this.manifestComponents
417+
: this.components;
418418

419-
const typeMap = new Map<string, string[]>();
419+
const typeMap = new Map<string, Set<string>>();
420420

421-
const addToTypeMap = (type: MetadataType, fullName: string): void => {
422-
if (type.isAddressable !== false) {
423-
const typeName = type.name;
424-
if (!typeMap.has(typeName)) {
425-
typeMap.set(typeName, []);
426-
}
427-
const typeEntry = typeMap.get(typeName);
428-
if (fullName === ComponentSet.WILDCARD && !type.supportsWildcardAndName && !destructiveType) {
429-
// if the type doesn't support mixed wildcards and specific names, overwrite the names to be a wildcard
430-
typeMap.set(typeName, [fullName]);
431-
} else if (
432-
typeEntry &&
433-
!typeEntry.includes(fullName) &&
434-
(!typeEntry.includes(ComponentSet.WILDCARD) || type.supportsWildcardAndName)
435-
) {
436-
// if the type supports both wildcards and names, add them regardless
437-
typeMap.get(typeName)?.push(fullName);
438-
}
439-
}
440-
};
441-
442-
for (const key of components.keys()) {
421+
[...components.entries()].map(([key, cmpMap]) => {
443422
const [typeId, fullName] = splitOnFirstDelimiter(key);
444-
let type = this.registry.getTypeByName(typeId);
445-
446-
if (type.folderContentType) {
447-
type = this.registry.getTypeByName(type.folderContentType);
448-
}
449-
addToTypeMap(
450-
type,
451-
// they're reassembled like CustomLabels.MyLabel
452-
this.registry.getParentType(type.name)?.strategies?.recomposition === 'startEmpty' && fullName.includes('.')
453-
? fullName.split('.')[1]
454-
: fullName
455-
);
423+
const type = this.registry.getTypeByName(typeId);
456424

457425
// Add children
458-
const componentMap = components.get(key);
459-
if (componentMap) {
460-
for (const comp of componentMap.values()) {
461-
for (const child of comp.getChildren()) {
462-
addToTypeMap(child.type, child.fullName);
463-
}
426+
[...(cmpMap?.values() ?? [])]
427+
.flatMap((c) => c.getChildren())
428+
.map((child) => addToTypeMap({ typeMap, type: child.type, fullName: child.fullName, destructiveType }));
429+
430+
// logic: if this is a decomposed type, skip its inclusion in the manifest if the parent is "empty"
431+
if (
432+
type.strategies?.transformer === 'decomposed' &&
433+
// exclude (ex: CustomObjectTranslation) where there are no addressable children
434+
Object.values(type.children?.types ?? {}).some((t) => t.unaddressableWithoutParent !== true) &&
435+
Object.values(type.children?.types ?? {}).some((t) => t.isAddressable !== false)
436+
) {
437+
const parentComp = [...(cmpMap?.values() ?? [])].find((c) => c.fullName === fullName);
438+
if (parentComp?.xml && !objectHasSomeRealValues(type)(parentComp.parseXmlSync())) {
439+
return;
464440
}
465441
}
466-
}
442+
443+
addToTypeMap({
444+
typeMap,
445+
type: type.folderContentType ? this.registry.getTypeByName(type.folderContentType) : type,
446+
fullName:
447+
this.registry.getParentType(type.name)?.strategies?.recomposition === 'startEmpty' && fullName.includes('.')
448+
? // they're reassembled like CustomLabels.MyLabel
449+
fullName.split('.')[1]
450+
: fullName,
451+
destructiveType,
452+
});
453+
});
467454

468455
const typeMembers = Array.from(typeMap.entries())
469-
.map(([typeName, members]) => ({ members: members.sort(), name: typeName }))
456+
.map(([typeName, members]) => ({ members: [...members].sort(), name: typeName }))
470457
.sort((a, b) => (a.name > b.name ? 1 : -1));
471458

472459
return {
473460
Package: {
474461
...{
475462
types: typeMembers,
476-
version,
463+
version: await this.getApiVersion(),
477464
},
478465
...(this.fullName ? { fullName: this.fullName } : {}),
479466
},
@@ -750,3 +737,28 @@ const splitOnFirstDelimiter = (input: string): [string, string] => {
750737
const indexOfSplitChar = input.indexOf(KEY_DELIMITER);
751738
return [input.substring(0, indexOfSplitChar), input.substring(indexOfSplitChar + 1)];
752739
};
740+
741+
/** side effect: mutates the typeMap property */
742+
const addToTypeMap = ({
743+
typeMap,
744+
type,
745+
fullName,
746+
destructiveType,
747+
}: {
748+
typeMap: Map<string, Set<string>>;
749+
type: MetadataType;
750+
fullName: string;
751+
destructiveType?: DestructiveChangesType;
752+
}): void => {
753+
if (type.isAddressable === false) return;
754+
if (fullName === ComponentSet.WILDCARD && !type.supportsWildcardAndName && !destructiveType) {
755+
// if the type doesn't support mixed wildcards and specific names, overwrite the names to be a wildcard
756+
typeMap.set(type.name, new Set([fullName]));
757+
return;
758+
}
759+
const existing = typeMap.get(type.name) ?? new Set<string>();
760+
if (!existing.has(ComponentSet.WILDCARD) || type.supportsWildcardAndName) {
761+
// if the type supports both wildcards and names, add them regardless
762+
typeMap.set(type.name, existing.add(fullName));
763+
}
764+
};

0 commit comments

Comments
 (0)