![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@aurahelper/ignore
Advanced tools
Aura Helper Ignore Metadata Module is a powerfull module to exclude a specified metadata from your Salesforce Project or Package XML Files. This module will be util in some use cases, like Custom Label values unique for every environment (like ids...), or
Module to ignore metadata from your salesforce projects or from a JSON metadata object. This module will be specially util in some use cases, like Custom Label values unique for every environment (like ids...), or to avoid deploy some user permissions, or when you creating autogenerated package (from git for example) and like to excludo some metadata automatically. To understund the .ahignore.json file, see Ignore File section.
This module is used to @ah/package-generator for ignore metadata types when created the package or detructive XML files. Also use @aurahelper/xml-compressor to compress the XML Files.
Class to ignore metadata from your salesforce projects or from a JSON metadata object. This class will be specially util in some use cases, like Custom Label values unique for every environment (like ids...), or to avoid deploy some user permissions, or when you creating autogenerated package (from git for example) and like to excludo some metadata automatically
The setters methods are defined like a builder pattern to make it more usefull
The fields that start with _ are for internal use only (Does not modify this fields to a correct Ignore work). To the rest of fields, setter methods are recommended instead modify fields.
Path to the ignore file
string
List with the Metadata Type API Names to ignore. This parameter is used to ignore only the specified metadata (also must be in ignore file) and avoid ignore all metadata types specified on the file.
string
| { [key:string]: MetadataType }
True to remove ignored elements from the result object, false only for unselect elements
boolean
True to compress the XML Files, false in otherwise
boolean
Sort order to order the XML elements. Values: simpleFirst, complexFirst, alphabetAsc or alphabetDesc. (alphabetDesc by default)
boolean
Constructor to instance a new Ignore object. All parameters are optional and you can use the setters methods to set the values when you want.
string
Method to set the callback function to handle the event Start Process Metadata Type to handle the ignore progress
Method to set the callback function to handle the event End Process Metadata Type to handle the ignore progress
Method to set the ignore file to ignore the metadata types
setTypesToIgnore(typesToIgnore)
Method to set the Metadata Name or Names to ignore
Method to set if remove metadata from Metadata Object or only unselect it
Method to set if compress the affected XML Files when the ignore project metadata
Method to set the sort order for the XML Elements when compress the files
Method to set Simple XML Elements first as sort order (simpleFirst)
Method to set Complex XML Elements first as sort order (complexFirst)
Method to set Alphabet Asc as sort order (alphabetAsc)
Method to set Alphabet Desc as sort order (alphabetDesc)
ignoreMetadata(metadataOrPath)
Method to ignore Metadata types from a Metadata JSON Object or Metadata JSON file. You can choose to uncheck elements or remove it from Metadata JSON.
ignoreProjectMetadata(projectPath, metadataDetails)
Method to ignore Metadata types from your local project. This method can delete some data from XML Files or entire XML files or folders according the ignore file data
Method to set the callback function to handle the event Start Process Metadata Type to handle the ignore progress
Function
Return the ignore object instance
Ignore
Handle progress with on Start Process Type Event
import { Ignore } from '@aurahelper/ignore';
const ignore = new Ignore();
ignore.onStartProcessType((metadataTypeAPIName) => {
console.log(metadataTypeAPIName);
});
Method to set the callback function to handle the event End Process Metadata Type to handle the ignore progress
Function
Return the ignore object instance
Ignore
Handle progress with on End Process Type Event
import { Ignore } from '@aurahelper/ignore';
const ignore = new Ignore();
ignore.onEndProcessType((metadataTypeAPIName) => {
console.log(metadataTypeAPIName);
});
Method to set the ignore file to ignore the metadata types
string
Return the ignore object instance
Ignore
Set the ignore file
import { Ignore } from '@aurahelper/ignore';
const ignore = new Ignore();
ignore.setIgnoreFile('path/to/the/ignore/file.json');
Method to set the Metadata Name or Names to ignore
string[]
Return the ignore object instance
Ignore
Set the types to ignore
import { Ignore } from '@aurahelper/ignore';
const ignore = new Ignore();
ignore.setTypesToIgnore(['CustomObject', 'CustomField', 'CustomTab']);
Method to set if remove metadata from Metadata Object or only unselect it
boolean
Return the ignore object instance
Ignore
Set remove data from Metadata Object result
import { Ignore } from '@aurahelper/ignore';
const ignore = new Ignore();
ignore.removeData(true);
True to compress the XML Files, false in otherwise. If undefined or not pass parameter, also set to true.
boolean
Return the ignore object instance
Ignore
Set compress affected XML Files
import { Ignore } from '@aurahelper/ignore';
const ignore = new Ignore();
ignore.setCompress(true);
Method to set the sort order value to sort the XML Elements when compress
string
Return the ignore object instance
Ignore
Set Sort order to order XML Elements
import { XMLCompressor } from '@aurahelper/xml-compressor';
import { Ignore } from '@aurahelper/ignore';
const sortOrder = XMLCompressor.getSortOrderValues();
const ignore = new Ignore();
ignore.setSortOrder(sortOrder.SIMPLE_FIRST);
Method to set Simple XML Elements first as sort order (simpleFirst)
Return the ignore object instance
Ignore
Set Simple first sort order to order XML Elements
import { Ignore } from '@aurahelper/ignore';
const ignore = new Ignore();
ignore.setIgnoreFile('path/to/the/ignore/file.json').sortSimpleFirst();
Method to set Complex XML Elements first as sort order (complexFirst)
Return the ignore object instance
Ignore
Set Complex first sort order to order XML Elements
import { Ignore } from '@aurahelper/ignore';
const ignore = new Ignore();
ignore.setIgnoreFile('path/to/the/ignore/file.json').sortComplexFirst();
Method to set Alphabet Asc as sort order (alphabetAsc)
Return the ignore object instance
Ignore
Set Alphabet asc sort order to order XML Elements
import { Ignore } from '@aurahelper/ignore';
const ignore = new Ignore();
ignore.setIgnoreFile('path/to/the/ignore/file.json').sortAlphabetAsc();
Method to set Alphabet Desc as sort order (alphabetDesc)
Return the ignore object instance
Ignore
Set Alphabet desc sort order to order XML Elements
import { Ignore } from '@aurahelper/ignore';
const ignore = new Ignore();
ignore.setIgnoreFile('path/to/the/ignore/file.json').sortAlphabetDesc();
Method to ignore Metadata types from a Metadata JSON Object or Metadata JSON file. You can choose to uncheck elements or remove it from Metadata JSON. See Metadata JSON Format section to understand the JSON Metadata Format
string
| { [key: string]: MetadataType }
Return a Metadata JSON Object with the ignored metadata unselected or removed
{ [key: string]: MetadataType }
This method can throw the next exceptions:
WrongFilePathException
: If the metadata file path or ignore file path is not a String or can't convert to absolute pathFileNotFoundException
: If the metadata file path or ignore file not exists or not have access to itInvalidFilePathException
: If the metadata file path or ignore file is not a fileWrongFormatException
: If metadata file path or ignore file is not a JSON file or Metadata Object are wrongIgnore Metadata from Metadata JSON Object
import { Ignore } from '@aurahelper/ignore';
const metadataObjects = {
CustomObject: {
name: 'CustomObject',
childs: {
Account: {
name: 'Account',
checked: true,
childs: {}
}
},
checked: true,
},
CustomField: {
name: 'CustomField',
childs: {
Account: {
name: 'Account',
checked: true,
childs: {
Name: {
name: 'Name',
checked: true
}
}
}
},
checked: true,
},
{
...
}
}
const ignoreFile = './path/to/ignore/file';
const ignore = new Ignore(ignoreFile);
const metadataTypes = ignore.ignoreMetadata(metadataObjects);
console.log(metadataTypes);
Ignore Specified Metadata from Metadata JSON File
import { Ignore } from '@aurahelper/ignore';
const typesForIgnore = ['CustomObject'];
const metadataPath = 'path/to/json/file';
const ignoreFile = './path/to/ignore/file';
const ignore = new Ignore(ignoreFile).setTypesToIgnore(typesForIgnore);
const metadataTypes = Ignore.ignoreMetadata(metadataPath);
console.log(metadataTypes);
Ignore Metadata and Remove from Metadata JSON File
import { Ignore } from '@aurahelper/ignore';
const remove = true;
const metadataPath = 'path/to/json/file';
const ignoreFile = './path/to/ignore/file';
const ignore = new Ignore(ignoreFile);
ignore.removeData(remove);
const metadataTypes = Ignore.ignoreMetadata(metadataPath);
console.log(metadataTypes);
Method to ignore Metadata types from your local project. This method can delete some data from XML Files or entire XML files or folders according the ignore file data
string
MetadataDetail[]
This method can throw the next exceptions:
WrongFilePathException
: If the ignore file path is not a String or can't convert to absolute pathFileNotFoundException
: If the ignore file not exists or not have access to itInvalidFilePathException
: If the ignore file is not a fileWrongFormatException
: If ignore file is not a JSON fileWrongDirectoryPathException
: If the project path is not a String or can't convert to absolute pathDirectoryNotFoundException
: If the project path directory not exists or not have access to itInvalidDirectoryPathException
: If the project path is not a directoryIgnore Metadata from Project
This option can remove entire file or folders from your project, or remove some metadata into your files like some custom labels from the custom labels file, or workflow alerts from your Account workflow file for example. For this operation, also need a Metadata Details from your salesforce project. You can get it with @ah/connector from your org using the listMetadataTypes() method. Also allow to you to compress files with the @aurahelper/xml-compressor
import { Ignore } from '@aurahelper/ignore';
import { XMLCompressor, SORT_ORDER } from '@aurahelper/xml-compressor';
import { Connection } from '@aurahelper/connector';
// Get Metadata Details from your org using @ah/connector
const connection = new Connection('MyOrg', '50');
connection.setUsernameOrAlias('MyOrg');
connection.setSingleThread();
connection.listMetadataTypes().then((metadataDetails) => {
const ignore = new Ignore('./path/to/ignore/file');
ignore.ignoreProjectMetadata('path/to/your/project', metadataDetails);
// Like on Ignore Metadata method, you can choose an optional metadata types for ignore
ignore.setTypesToIgnore(['CustomObject', 'CustomField', 'ApexClass']);
Ignore.ignoreProjectMetadata('path/to/your/project', metadataDetails);
// Also you can choose to compress the modified files with @aurahelper/xml-compressor
ignore.setCompress().sortSimpleFirst().setTypesToIgnore(['CustomObject', 'CustomField', 'ApexClass']);
ignore.ignoreProjectMetadata('path/to/your/project', metadataDetails);
}).catch((error) => {
// Handle errors
});
The Metadata JSON Format used by Aura Helper Framework and modules have the next structure. Some fields are required and the datatypes checked to ensure the correct file structure.
{
"MetadataAPIName": {
"name": "MetadataAPIName", // Required (String). Contains the Metadata Type API Name (like object Key)
"checked": false, // Required (Boolean). Field for include this type on package or not
"path": "path/to/the/metadata/folder", // Optional (String). Path to the Metadata Type folder in local project
"suffix": "fileSuffix", // Optional (String). Metadata File suffix
"childs": { // Object with a collection of childs (Field required (JSON Object) but can be an empty object)
"MetadataObjectName":{
"name": "MetadataObjectName", // Required (String). Contains the Metadata Object API Name (like object Key)
"checked": false, // Required (Boolean). Field for include this object on package or not
"path": "path/to/the/metadata/file/or/folder", // Optional (String). Path to the object file or folder path
"childs": { // Object with a collection of childs (Field required (JSON Object) but can be an empty object)
"MetadataItemName": {
"name": "MetadataItemName", // Required (String). Contains the Metadata Item API Name (like object Key)
"checked": false, // Required (Boolean). Field for include this object on package or not
"path": "path/to/the/metadata/file"
},
"MetadataItemName2": {
...
},
...,
...,
...
}
}
"MetadataObjectName2":{
...
},
...,
...,
...
}
}
}
{
"CustomObject": {
"name": "CustomObject",
"checked": false,
"path": "path/to/root/project/force-app/main/default/objects",
"suffix": "object",
"childs": {
"Account": {
"name": "Account",
"checked": true, // Add Account Object to the package
"path": "path/to/root/project/force-app/main/default/objects/Account/Account.object-meta.xml",
"childs": {}
},
"Case": {
"name": "Case",
"checked": true, // Add Case Object to the package
"path": "path/to/root/project/force-app/main/default/objects/Case/Case.object-meta.xml",
"childs": {}
},
...,
...,
...
}
},
"CustomField": {
"name": "CustomField",
"checked": false,
"path": "path/to/root/project/force-app/main/default/objects",
"suffix": "field",
"childs": {
"Account": {
"name": "Account",
"checked": false,
"path": "path/to/root/project/force-app/main/default/objects/Account/fields",
"childs": {
"customField__c": {
"name": "customField__c",
"checked": true, // Add customField__c to the package
"path": "path/to/root/project/force-app/main/default/objects/Account/fields/customField__c.field-meta.xml",
},
...,
...,
...
}
},
"Case": {
"name": "Case",
"checked": false,
"path": "path/to/root/project/force-app/main/default/objects/Case/fields",
"childs": {
"CaseNumber": {
"name": "CaseNumber",
"checked": true, // Add CaseNumber to the package
"path": "path/to/root/project/force-app/main/default/objects/Account/fields/CaseNumber.field-meta.xml",
},
...,
...,
...
}
},
...,
...,
...
}
}
}
The ignore file is a JSON file used on ignore, create package or repair dependencies modules. On this file you can specify metadata types, objects and elements for ignore or delete from your local project or package files. You can have a main ignore file on your root project (like gitignore) named .ahignore.json for use automatically, or have different ignore files and specify it on the commands when you need tou use.
The ignore file have the next structure
{
// Basic structure
"MetadataTypeAPIName": {
"MetadataObject1",
"MetadataObject2"
}
// Advance Structure
"MetadataTypeAPIName": {
"MetadataObject1:MetadataItem1",
"MetadataObject1:MetadataItem2",
"MetadataObject2:*",
"*",
"*:*" // Only valid on Custom Objects
}
// Special for Permissions
"MetadataTypeAPIName": {
"UserPermission:MetadataObject1:PermissionName",
"UserPermission:MetadataObject2:*",
"UserPermission:*:PermissionName"
}
}
{
"CustomLabels": {
"labelName1", // Ignore or remove the custom label "labelName1"
"labelName2", // Ignore or remove the custom label "labelName2",
"*" // Ignore or remove all Custom Labels
},
"AssignmentRules":{
"Case:Assign1", // Ignore or remove the Assignent Rule "Assign1" from the object Case
"Lead:*", // Ignore or remove all Assignment Rules from Lead
"*" // Ignore or remove all Assignment Rules
},
"CustomObject": {
"Account", // Ignore or remove the Account Object
"Case:*", // Ignore or remove all related objects from case, including the object (Bussines Process, Fields, Validation Rules...),
"*", // Ignore or remove all custom objects (only the object not the related metadata)
"*:*", // Ignore or remove all custom objects and the related metadata (Bussines Process, Fields, Validation Rules...)
},
"Report": {
"ReportFolder", // Ignore or remove the entire folder
"ReportFolder1:ReportName2", // Ignore or remove the report "ReportName2" from "ReportFolder1" folder.
"*", // Ignore or remove all reports.
},
"Workflow": {
"Account", // Ignore or remove the Account worflows (Rules, Task, Alerts...)
"*" // Ignore or remove all workflows (Rules, Task, Alerts...) from all objects
},
"WorkflowRule": {
"Case:*", // Ignore or remove all Workflow rules from case object
"Account:Rule1", // Ignore or remove "Rule1" from Account workflows,
"*" // Ignore or remove all Worflow rules from all objects
},
"Profile": {
"UserPermission:*:Permission1", // Remove the "Permission1" User Permission from all profiles
"UserPermission:TestProfile:*", // Remove all User permissions from TestProfile file
"UserPermission:Admin:Perm1", // Remove the Perm1 User Permission from Admin profile
"TestProfile2", // Ignore or remove the "TestProfile" profile
"*" // Ignore or remove all profiles
}
}
Some Metadata Types have singular and plural name like CustomLabels, MatchingRules, EscalationRules... For ignore or remove this types you must use the plural name, if use the singular name the ignore process not take effect with this types.
[2.0.0 - 2021-12-13]
FAQs
Aura Helper Ignore Metadata Module is a powerfull module to exclude a specified metadata from your Salesforce Project or Package XML Files. This module will be util in some use cases, like Custom Label values unique for every environment (like ids...), or
The npm package @aurahelper/ignore receives a total of 40 weekly downloads. As such, @aurahelper/ignore popularity was classified as not popular.
We found that @aurahelper/ignore demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.