sfdx-plugin-package-xml
Version:
explore metadata in an org and generate a package.xml manifest
66 lines • 2.54 kB
JavaScript
// https://help.salesforce.com/s/articleView?id=sf.packaging_component_attributes.htm&type=5
// Metadata Types which don't have an entry in the "SUBSCRIBER AND DEVELOPER EDITABLE" column
const MANAGED_READONLY_TYPES = [
"ApexClass",
"SharingReason",
"ApexTrigger",
"CustomLabel",
"CustomPermission",
// Custom Setting?
// Email Template (Lightning)? -> EmailTemplate with fullName ending with underscore and a 13 digit number
"HomePageComponent",
"LightningComponentBundle",
"AuraDefinitionBundle",
"FlexiPage",
"PermissionSet",
"StaticResource",
// Translation?
"ApexComponent",
"ApexPage",
];
// parent types which don't have own properties
const PURE_CONTAINER_TYPES = [
"AssignmentRules",
"AutoResponseRules",
"CustomLabels",
"EscalationRules",
"ManagedTopics",
"MatchingRules",
"SharingRules",
"Workflow",
];
const STANDARD_USERNAMES = ["Automated Process", "salesforce.com"];
export function isManaged(fileProperties) {
return fileProperties.manageableState === "installed";
}
export function isManagedReadOnly(fileProperties) {
return MANAGED_READONLY_TYPES.includes(fileProperties.type) && isManaged(fileProperties);
}
export function isManagedWriteable(fileProperties) {
return !MANAGED_READONLY_TYPES.includes(fileProperties.type) && isManaged(fileProperties);
}
export function isUnlocked(fileProperties) {
return fileProperties.manageableState === "installedEditable";
}
export function isUnmanaged(fileProperties) {
return fileProperties.manageableState === "unmanaged" || fileProperties.manageableState === undefined;
}
export function isUnlockedDeprecated(fileProperties) {
return fileProperties.manageableState === "deprecatedEditable";
}
export function isManagedDeprecated(fileProperties) {
return fileProperties.manageableState === "deprecated";
}
export function isDeprecated(fileProperties) {
return isUnlockedDeprecated(fileProperties) || isManagedDeprecated(fileProperties);
}
export function isStandard(fileProperties) {
return ((!fileProperties.namespacePrefix && !fileProperties.manageableState && !fileProperties.id) ||
(STANDARD_USERNAMES.includes(fileProperties.createdByName) &&
STANDARD_USERNAMES.includes(fileProperties.lastModifiedByName)) ||
fileProperties.namespacePrefix === "standard");
}
export function isPureContainerType(fileProperties) {
return PURE_CONTAINER_TYPES.includes(fileProperties.type);
}
//# sourceMappingURL=filters.js.map