![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/connector
Advanced tools
Powerfull Libraries to connect with Salesforce to list, describe, deploy or retrieve metadata types. Also can describe SObjects, Create Projects, Authorize Orgs, Execute Queries, Export or Import Data... To the correct work of this library, you need to ha
Module to connect with Salesforce to list or describe metadata types, list or describe all SObjects, make queries, create SFDX Project, validate, deploy or retrieve in SFDX and Metadata API Formats, export and import data and much more. Is used to Aura Helper and Aura Helper CLI to support salesfore conections.
Class to connect with Salesforce to list or describe metadata types, list or describe all SObjects, make queries, create SFDX Project, validate, deploy or retrieve in SFDX and Metadata API Formats, export and import data and much more. Is used to Aura Helper and Aura Helper CLI to support salesfore conections.
The setters methods are defined like a builder pattern to make it more usefull
All connection methods return a Promise with the associated data to the processes.
The fields that start with _ are for internal use only (Does not modify this fields to a correct connection work). To the rest of fields, setter methods are recommended instead modify fields.
Username or Alias to connect with the org. The org bust be authorized in the system.
Number API Version to connect with the org.
Path to the local project folder
Namespace prefix from the Org to connect
True to able to the connection object to use several threads and processor cores to run some processes and run faster, false to use only one thread and core.
Project package folder path (manifest folder). Must be a child of Project folder
Project package file path (package.xml file). Must be a child of Package folder
The Connection class has only one constructor to create a connection
Constructor to create a new connection object. All parameters are optional and you can use the setters methods to set the values when you want.
setUsernameOrAlias(usernameOrAlias)
Method to set the Username or Alias to connect with org
Method to set the API Version to connect
setProjectFolder(projectFolder)
Method to set the project root folder path. When set the project root, automatically set the packageFolder and packageFile to their respective paths
setPackageFolder(packageFolder)
Method to set the package folder path. When set the package folder, automatically set packageFile to the respective path
Method to set the package xml file path
setNamespacePrefix(namespacePrefix)
Method to set the Org namespace prefix
Method to able to the connection object to use several threads and processor cores to run some processes and run faster
Method to set the connection object to use only one thread and processo core to all processes
Method to handle the event when preparing execution of some processes
Method to handle the event before the create a project on some processes
Method to handle the event before start retrieve data on some processes
Method to handle the event before start processing results on some processes
Method to handle the event before start loading local metadata types on some processes
Method to handle the event before start loading metadata types from org on some processes
Method to handle the event before start copying files on some processes
Method to handle the event before start copying file content on some processes
Method to handle the event before start compress XML File on some processes
onBeforeDownloadType(callback)
Method to handle the event before download a Metadata Type from Org on some processes
Method to handle the event after download a Metadata Type from Org on some processes
onBeforeDownloadSObject(callback)
Method to handle the event before download a SObject when describe SObejcts
onAfterDownloadSObject(callback)
Method to handle the event after download a SObject when describe SObejcts
onAfterDownloadSObject(callback)
Method to handle the event after download a SObject when describe SObejcts
Method to handle the event when connection is aborted
Method to abort all connection running processes. When finishes call onAbort() callback
Method to get the Auth Username from the org (If not found username, return the Alias)
getServerInstance(usernameOrAlias)
Method to get the server instance for an username or alias (or the connection username or alias)
Method to list all auth org on the system
Method to execute a query to the connected org
Method to list all Metadata Types available in the connected org (according selected API Version)
describeMetadataTypes(typesOrDetails, downloadAll)
Method to describe all or selected Metadata Types from the connected org
Method to list all SObjects API Name by category
Method to describe SObject data to the specified objects
retrieve(useMetadataAPI, waitMinutes, targetDir)
Method to retrieve data using the connection package file. You can choose to retrieve as Metadata API format or Source Format
retrieveReport(retrieveId, targetDir)
Retrieve report when use Metadata API to retrieve data
validateDeploy(testLevel, runTests, useMetadataAPI, waitMinutes)
Method to validate a deploy against the org using the connection package file
deployPackage(testLevel, runTests, useMetadataAPI, waitMinutes)
Method to deploy data to the org using the connection package file
deploy(types, testLevel, runTests, waitMinutes)
Method to deploy the selected Metadata Types to the org using Source API
quickDeploy(deployId, useMetadataAPI)
Method to execute a quick deploy when validation result is success
deployReport(deployId, useMetadataAPI, waitMinutes)
Method to get the report of a running deployment
cancelDeploy(deployId, useMetadataAPI, waitMinutes)
Method to get the cancel a running deployment
convertProjectToSFDX(targetDir)
Method to convert a Metadata API format Project to a Source format
convertProjectToMetadataAPI(targetDir)
Method to convert a Source format Project to a Metadata API format
createSFDXProject(projectName, projectFolder, template, withManifest)
Method to create a SFDX Project. This method change the connection object project folder, package folder and package file values when project is created
Method to set an auth org in a Salesforce local project. This command set the selected username or Alias to the connection object when authorize an org.
exportTreeData(query, outputPath, prefix)
Method to export data in a tree format from the connected org
Method to import data in a tree format into the connected org
Method to delete data on bulk mode
executeApexAnonymous(scriptfile)
Method to execute an Apex script file on Anonymous context
loadUserPermissions(tmpFolder)
Method to get all available user permissions from the connected org
retrieveLocalSpecialTypes(tmpFolder, types, compress, sortOrder)
Method to Retrieve local special types from the connected org
retrieveMixedSpecialTypes(tmpFolder, types, downloadAll, compress, sortOrder)
Method to Retrieve mixed special types from the connected org. Mixed means that only affect the Metadata Types on your project folder, but download all related data from this types from your org (and not only the local data)
retrieveOrgSpecialTypes(tmpFolder, types, downloadAll, compress, sortOrder)
Method to Retrieve org special types from the connected org. Org means that affect all Metadata types stored in your org not on your local project.
Method to set the Username or Alias to connect with org
Returns the connection object
Set Connection username or alias
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.setUsernameOrAlias('MyOrg');
Method to set the API Version to connect
Returns the connection object
Set Connection api version
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.setApiVersion(50);
// Or can concatenate method calls because setters return a connection object
connection.setUsernameOrAlias('MyOrg').setApiVersion(50);
Method to set the project root folder path. When set the project root, automatically set the packageFolder and packageFile to their respective paths
Returns the connection object
Set Connection project folder
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.setProjectFolder('project/root/path');
// Or can concatenate method calls because setters return a connection object
connection.setUsernameOrAlias('MyOrg').setProjectFolder('project/root/path');
Method to set the package folder path. When set the package folder, automatically set packageFile to the respective path
Returns the connection object
Set Connection package folder (manifest folder)
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.setPackageFolder('project/root/path/manifest');
// Or can concatenate method calls because setters return a connection object
connection.setUsernameOrAlias('MyOrg').setPackageFolder('project/root/path/manifest');
Method to set the package xml file path
Returns the connection object
Set Connection package file (package.xml)
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.setPackageFile('project/root/path/manifest/package.xml');
// Or can concatenate method calls because setters return a connection object
connection.setUsernameOrAlias('MyOrg').setPackageFile('project/root/path/manifest/package.xml');
Method to set the package xml file path
Returns the connection object
Set Connection namespace prefix const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.setNamespacePrefix('orgPrefix');
// Or can concatenate method calls because setters return a connection object
connection.setUsernameOrAlias('MyOrg').setNamespacePrefix('orgPrefix');
Method to able to the connection object to use several threads and processor cores to run some processes and run faster
Returns the connection object
Set Connection to user multiple threads and cores
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.setMultiThread();
// Or can concatenate method calls because setters return a connection object
connection.setUsernameOrAlias('MyOrg').setMultiThread();
Method to set the connection object to use only one thread and processo core to all processes
Returns the connection object
Set Connection to user single thread and core
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.setSingleThread();
// Or can concatenate method calls because setters return a connection object
connection.setUsernameOrAlias('MyOrg').setSingleThread();
Method to handle the event when preparing execution of some processes
Returns the connection object
Handling progress on prepare stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onPrepare(() => {
console.log('Handling progress on prepare');
}));
Method to handle the event before the create a project on some processes
Returns the connection object
Handling progress on create project stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onCreateProject(() => {
console.log('Handling progress on create project');
}));
Method to handle the event before start retrieve data on some processes
Returns the connection object
Handling progress on retrieve stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onRetrieve(() => {
console.log('Handling progress on create project');
}));
Method to handle the event before start processing results on some processes
Returns the connection object
Handling progress on process stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onProcess(() => {
console.log('Handling progress when process');
}));
Method to handle the event before start loading local metadata types on some processes
Returns the connection object
Handling progress on loading local stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onLoadingLocal(() => {
console.log('Handling progress on loading local data');
}));
Method to handle the event before start loading metadata types from org on some processes
Returns the connection object
Handling progress on loading org stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onLoadingOrg(() => {
console.log('Handling progress on create project');
}));
Method to handle the event before start copying files on some processes
Returns the connection object
Handling progress on copy data stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onCopyData(() => {
console.log('Handling progress when copy data');
}));
Method to handle the event before start copying file content on some processes
Returns the connection object
Handling progress on copy file stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onCopyFile((status) => {
console.log('Handling progress when copy file');
console.log('MetadataType => ' + status.entityType);
console.log('MetadataObject => ' + status.entityObject);
console.log('MetadataItem => ' + status.entityItem);
console.log('file => ' + status.data);
}));
Method to handle the event before start compress XML File on some processes
Returns the connection object
Handling progress on compress file stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onCompressFile((status) => {
console.log('Handling progress when compress file');
console.log('MetadataType => ' + status.entityType);
console.log('MetadataObject => ' + status.entityObject);
console.log('MetadataItem => ' + status.entityItem);
console.log('file => ' + status.data);
}));
Method to handle the event before download a Metadata Type from Org on some processes
Returns the connection object
Handling progress on before download type stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onBeforeDownloadType((status) => {
console.log('Handling progress when describe metadata types');
console.log('MetadataType => ' + status.entityType);
}));
Method to handle the event after download a Metadata Type from Org on some processes
Returns the connection object
Handling progress on after download type stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onAfterDownloadType((status) => {
console.log('Handling progress when describe metadata types');
console.log('MetadataType => ' + status.entityType);
console.log('Downloaded Data => ' + status.data);
}));
Method to handle the event before download a SObject when describe SObejcts
Returns the connection object
Handling progress on before download sobject stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onBeforeDownloadSObject((status) => {
console.log('Handling progress describe sobjects');
console.log('SObject => ' + status.entityObject);
}));
Method to handle the event after download a SObject when describe SObejcts
Returns the connection object
Handling progress on after download sobject stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onAfterDownloadSObject((status) => {
console.log('Handling progress describe sobjects');
console.log('SObject => ' + status.entityObject);
console.log('Downloaded Data => ' + status.data);
}));
Method to handle the event when error ocurred when download metadata
Returns the connection object
Handling progress on error download stage
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onErrorDownload((status) => {
console.log('Handling progress describe sobjects');
console.log('Metadata or SObject => ' + status.entityObject);
console.log('message' + status.data);
}));
Method to handle the event when connection is aborted
Returns the connection object
Set connection abort callback
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onAbort(() => {
}));
// Or can concatenate method calls because setters return a connection object
connection.setUsernameOrAlias('MyOrg').onAbort(() => {
}));
Method to abort all connection running processes. When finishes call onAbort() callback
Abort connection and handle on abort callback
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.onAbort(() => {
// Execute when abortConnection() finish and kill all running processes
}));
connection.abortConnection();
Method to get the Auth Username from the org (If not found username, return the Alias)
Return a String promise with the Username or Alias data
This method can throw the next exceptions:
Get auth username to the connection
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.getAuthUsername().then((username) => {
console.log(username);
}).catch((error) => {
// Handle errors
});
Method to get the server instance for an username or alias (or the connection username or alias)
Return a String promise with the instance URL
This method can throw the next exceptions:
Get server instance to the connected org
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.setUsernameOrAlias('MyOrg');
connection.getServerInstance().then((inbstanceUrl) => {
console.log(inbstanceUrl);
}).catch((error) => {
// Handle errors
});
Get server instance to another
const Connection = require('@aurahelper/connector');
const connection = new Connection();
connection.getServerInstance('MyOrg2').then((inbstanceUrl) => {
console.log(inbstanceUrl);
}).catch((error) => {
// Handle errors
});
Method to list all auth org on the system
Return a promise with all authorized org in the system
This method can throw the next exceptions:
Get all auth org on the system
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 50);
connection.listAuthOrgs().then((authOrgs) => {
for(const org of authOrgs){
console.log('Alias: ' + org.alias);
console.log('Username: ' + org.username);
console.log('ORG Id: ' + org.orgId);
console.log('Instance URL: ' + org.instanceUrl);
console.log('Access Token: ' + org.accessToken);
console.log('OAuth Method: ' + org.oauthMethod);
}
}).catch((error) => {
// Handle errors
});
Method to execute a query to the connected org
Return a promise with the record list
This method can throw the next exceptions:
Query data and handle results
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 50);
const query = 'Select Id, Name, Phone, CustomField__c from Account where Name != null';
connection.query(query).then((records) => {
for(const record of records){
console.log('Account Id: ' + record.Id);
console.log('Account Name: ' + record.Name);
console.log('Account Phone: ' + record.Phone);
console.log('Account Custom Field: ' + record.CustomField__c);
}
}).catch((error) => {
// Handle errors
});
Method to list all Metadata Types available in the connected org (according selected API Version)
Return a promise with the MetadataDetail objects from all available Metadata Types
This method can throw the next exceptions:
Get all available Metadata types to API 45
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 45);
connection.listMetadataTypes().then((metadataDetails) => {
for(const detail of metadataDetails){
console.log('Directory Name: ' + detail.directoryName);
console.log('In folder: ' + detail.inFolder);
console.log('Has Meta file: ' + detail.metaFile);
console.log('Files suffix: ' + detail.suffix);
console.log('API Name: ' + detail.xmlName);
}
}).catch((error) => {
// Handle errors
});
Get all available Metadata types to API 51
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg');
connection.setApiVersion(51);
connection.listMetadataTypes().then((metadataDetails) => {
for(const detail of metadataDetails){
console.log('Directory Name: ' + detail.directoryName);
console.log('In folder: ' + detail.inFolder);
console.log('Has Meta file: ' + detail.metaFile);
console.log('Files suffix: ' + detail.suffix);
console.log('API Name: ' + detail.xmlName);
}
}).catch((error) => {
// Handle errors
});
Method to describe all or selected Metadata Types from the connected org. See Metadata JSON Format section to understand the JSON Metadata Format
Return a promise with Metadata JSON Object with the selected Metadata Types to describe
This method can throw the next exceptions:
Describe all Metadata types from the connected org and org namespace
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg');
connection.setApiVersion(51);
connection.describeMetadataTypes().then((metadataTypes) => {
for(const metadataTypeName of Object.keys(metadataTypes)){
const metadataType = metadataTypes[metadataTypeName];
console.log('metadataType: ' + metadataType);
}
}).catch((error) => {
// Handle errors
});
Describe all Metadata types from the connected org and all namespaces
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg');
connection.setApiVersion(51);
connection.describeMetadataTypes(undefined, true).then((metadataTypes) => {
for(const metadataTypeName of Object.keys(metadataTypes)){
const metadataType = metadataTypes[metadataTypeName];
console.log('metadataType: ' + metadataType);
}
}).catch((error) => {
// Handle errors
});
Describe some Metadata types from the connected
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg');
connection.setApiVersion(51);
const types = [
'CustomObject',
'CustomField',
'ApexClass'
];
connection.describeMetadataTypes(types).then((metadataTypes) => {
for(const metadataTypeName of Object.keys(metadataTypes)){
const metadataType = metadataTypes[metadataTypeName];
console.log('metadataType: ' + metadataType);
}
}).catch((error) => {
// Handle errors
});
Method to list all SObjects API Name by category
Return a promise with a list with the sObject names
This method can throw the next exceptions:
List all SObjects
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg');
connection.setApiVersion(51);
connection.listSObjects().then((objectNames) => {
for(const objName of objectNames){
console.log('Name: ' + objName);
}
}).catch((error) => {
// Handle errors
});
List custom SObjects
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg');
connection.setApiVersion(51);
connection.listSObjects('custom').then((objectNames) => {
for(const objName of objectNames){
console.log('Name: ' + objName);
}
}).catch((error) => {
// Handle errors
});
List standard SObjects
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg');
connection.setApiVersion(51);
connection.listSObjects('standard').then((objectNames) => {
for(const objName of objectNames){
console.log('Name: ' + objName);
}
}).catch((error) => {
// Handle errors
});
Method to describe SObject data to the specified objects
Return a promise with a SObjects data
This method can throw the next exceptions:
Describe some SObjects
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg');
connection.setApiVersion(51);
const objects = [
'Account',
'Case',
'Opportunity',
'Task'
];
connection.describeSObjects(objects).then((objectNames) => {
for(const objName of objectNames){
console.log('Name: ' + objName);
}
}).catch((error) => {
// Handle errors
});
Describe all SObjects
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg');
connection.setApiVersion(51);
const allSObjects = await connection.listSObjects();
connection.describeSObjects(allSObjects).then((objectNames) => {
for(const objName of objectNames){
console.log('Name: ' + objName);
}
}).catch((error) => {
// Handle errors
});
Method to retrieve data using the connection package file. You can choose to retrieve as Metadata API format or Source Format
Return a promise with the RetrieveResult object with the retrieve result
This method can throw the next exceptions:
Retrieve data using Metadata API Format (With package.xml file on project)
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
connection.retrieve(true, 'path/to/target/dir').then((retrieveResult) => {
console.log(retrieveResult);
}).catch((error) => {
// Handle errors
});
Retrieve data using Source Format (With package.xml file on project)
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
connection.retrieve().then((retrieveResult) => {
console.log(retrieveResult);
}).catch((error) => {
// Handle errors
});
Retrieve report when use Metadata API to retrieve data
Return a promise with the RetrieveStatus object with the retrieve status result
This method can throw the next exceptions:
Get a retrieve report status
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const retrieveId = '';
const targetDir = 'path/to/target/retrieve/dir';
connection.retrieveReport(retrieveId, targetDir).then((retrieveStatus) => {
console.log(retrieveStatus);
}).catch((error) => {
// Handle errors
});
Method to validate a deploy against the org using the connection package file
Return a promise with the DeployStatus object with the deploy status result
This method can throw the next exceptions:
Validate deployment with Metadata API format (With package.xml file on project)
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const testLevel = 'RunSpecifiedTests';
const runTest = [
'ApexTest1',
'ApexTest2',
'ApexText3',
...,
...,
'ApexTextN',
];
connection.validateDeploy(testLevel, runTest, true).then((deployStatus) => {
console.log(deployStatus);
}).catch((error) => {
// Handle errors
});
Validate deployment with Source format (With package.xml file on project)
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const testLevel = 'RunSpecifiedTests';
const runTest = [
'ApexTest1',
'ApexTest2',
'ApexText3',
...,
...,
'ApexTextN',
];
connection.validateDeploy(testLevel, runTest).then((deployStatus) => {
console.log(deployStatus);
}).catch((error) => {
// Handle errors
});
Method to deploy data to the org using the connection package file
Return a promise with the DeployStatus object with the deploy status result
This method can throw the next exceptions:
Deploy data with Metadata API format (With package.xml file on project)
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const testLevel = 'RunSpecifiedTests';
const runTest = [
'ApexTest1',
'ApexTest2',
'ApexText3',
...,
...,
'ApexTextN',
];
connection.deployPackage(testLevel, runTest, true).then((deployStatus) => {
console.log(deployStatus);
}).catch((error) => {
// Handle errors
});
Deploy data with Source format (With package.xml file on project)
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const testLevel = 'RunSpecifiedTests';
const runTest = [
'ApexTest1',
'ApexTest2',
'ApexText3',
...,
...,
'ApexTextN',
];
connection.deployPackage(testLevel, runTest).then((deployStatus) => {
console.log(deployStatus);
}).catch((error) => {
// Handle errors
});
Method to deploy data to the org using the connection package file
Return a promise with the DeployStatus object with the deploy status result
This method can throw the next exceptions:
Deploy data with Source format
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const types = 'CustomLabel:LabelName1, Profile:ProfileName1';
const testLevel = 'RunSpecifiedTests';
const runTest = [
'ApexTest1',
'ApexTest2',
'ApexText3',
...,
...,
'ApexTextN',
];
connection.deploy(types, testLevel, runTest).then((deployStatus) => {
console.log(deployStatus);
}).catch((error) => {
// Handle errors
});
Method to execute a quick deploy when validation result is success
Return a promise with the DeployStatus object with the deploy status result
This method can throw the next exceptions:
Execute quick deploy to Validated deploy with Metadata API format
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const deployId = '00X213as2984';
connection.quickDeploy(deployId, true).then((deployStatus) => {
console.log(deployStatus);
}).catch((error) => {
// Handle errors
});
Execute quick deploy to Validated deploy with Source format
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const deployId = '00X213as2984';
connection.quickDeploy(deployId).then((deployStatus) => {
console.log(deployStatus);
}).catch((error) => {
// Handle errors
});
Method to get the report of a running deployment
Return a promise with the DeployStatus object with the deploy status result
This method can throw the next exceptions:
Execute deploy report to active deploy with Metadata API format
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const deployId = '00X213as2984';
connection.deployReport(deployId, true).then((deployStatus) => {
console.log(deployStatus);
}).catch((error) => {
// Handle errors
});
Execute deploy report to active deploy with Source format
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const deployId = '00X213as2984';
connection.deployReport(deployId).then((deployStatus) => {
console.log(deployStatus);
}).catch((error) => {
// Handle errors
});
Method to get the cancel a running deployment
Return a promise with the DeployStatus object with the deploy status result
This method can throw the next exceptions:
Cancel deploy to active deploy with Metadata API format
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const deployId = '00X213as2984';
connection.cancelDeploy(deployId, true).then((deployStatus) => {
console.log(deployStatus);
}).catch((error) => {
// Handle errors
});
Cancel deploy to active deploy with Source format
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const deployId = '00X213as2984';
connection.cancelDeploy(deployId).then((deployStatus) => {
console.log(deployStatus);
}).catch((error) => {
// Handle errors
});
Method to convert a Metadata API format Project to a Source format
Return an empty promise when conversion finish
This method can throw the next exceptions:
Convert Metadata API Format project to Source Format
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
connection.convertProjectToSFDX('path/to/folder/to/save/project').then(() => {
// Conversion finished
}).catch((error) => {
// Handle errors
});
Method to convert a Metadata API format Project to a Source format
Return an empty promise when conversion finish
This method can throw the next exceptions:
Convert Source Format project to Metadata API Format
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
connection.convertProjectToMetadataAPI('path/to/folder/to/save/project').then(() => {
// Conversion finished
}).catch((error) => {
// Handle errors
});
Method to create a SFDX Project. This method change the connection object project folder, package folder and package file values when project is created
Return a promise with SFDXProjectResult Object with the creation result
This method can throw the next exceptions:
Create new SFDX Project with connection project folder
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const projectName = 'NEW SFDX Project';
connection.createSFDXProject(projectName).then((createResult) => {
console.log(createResult);
}).catch((error) => {
// Handle errors
});
Create new SFDX Project on a different connection project folder
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const projectName = 'NEW SFDX Project';
const projectFolder = 'path/to/project/folder';
connection.createSFDXProject(projectName, projectFolder).then((createResult) => {
console.log(createResult);
}).catch((error) => {
// Handle errors
});
Method to set an auth org in a Salesforce local project. This command set the selected username or Alias to the connection object when authorize an org.
Return an empty promise when operation finish
This method can throw the next exceptions:
Auth new org with connection username or alias
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
connection.setAuthOrg().then(() => {
// Org set
}).catch((error) => {
// Handle errors
});
Auth new org with different connection username or alias
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const usernameOrAlias = 'MyOrg2';
connection.setAuthOrg(usernameOrAlias).then(() => {
// Org set
}).catch((error) => {
// Handle errors
});
Method to export data in a tree format from the connected org
Return an array with the extrated data information
This method can throw the next exceptions:
Export Accounts data with related contacts
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const query = 'Select Id, Name, Phone, (Select Id, Name, Phone from Contacts) from Account where Name != null';
const outputPath = 'path/to/save/the/result';
connection.exportTreeData(query, outputPath).then((results) => {
for(const result of results){
console.log(result.file);
console.log(result.nRecords);
console.log(result.isPlanFile);
}
}).catch((error) => {
// Handle errors
});
Method to import data in a tree format into the connected org
Return a promise with an object with the ok result and errors on insert
This method can throw the next exceptions:
Import file with exported records
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const fileToImport = 'path/to/file/to/import.json';
connection.importTreeData(fileToImport).then((result) => {
if(result.results){
for(const result of result.results){
console.log(result.refId);
console.log(result.id);
console.log(result.sobject);
}
} else {
for(const error of result.errors){
console.log(error);
}
}
}).catch((error) => {
// Handle errors
});
Method to delete data on bulk mode
Return a promise with an array with BulkStatus objects with the delete result
This method can throw the next exceptions:
Delete data at bulk mode
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const csvFile = 'path/to/csv/file/to/delete.csv';
connection.bulkDelete(csvFile, 'Account').then((deleteResults) => {
for(const result of deleteResults){
console.log(result);
}
}).catch((error) => {
// Handle errors
});
Method to execute an Apex script file on Anonymous context
Return a promise with the execution log as String
This method can throw the next exceptions:
Execute an Apex Anonymous script
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const scriptFile = 'path/to/csv/file/to/delete.csv';
connection.executeApexAnonymous(scriptFile).then((executionLog) => {
console.log(executionLog);
}).catch((error) => {
// Handle errors
});
Method to get all available user permissions from the connected org
Return a promise with the list of user permissions
This method can throw the next exceptions:
Load User permissions from connected org
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
connection.loadUserPermissions('path/to/temporal/folder').then((permissions) => {
console.log(permissions);
}).catch((error) => {
// Handle errors
});
Method to get all available user permissions from the connected org
Return a promise with a RetrieveResult with the retrieve result
This method can throw the next exceptions:
Retrieve all local special Metadata Types from Org
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
connection.retrieveLocalSpecialTypes('path/to/temporal/folder').then((result) => {
console.log(result);
}).catch((error) => {
// Handle errors
});
Retrieve some local special Metadata Types from Org
const Connection = require('@aurahelper/connector');
const { Types, Values } = require('@aurahelper/core');
const MetadataTypes = Values.MetadataTypes;
const MetadataType = Types.MetadataType;
const MetadataObject = Types.MetadataObject;
const MetadataItem = Types.MetadataItem;
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const types: {};
types[MetadataTypes.CUSTOM_APPLICATION] = new MetadataType(MetadataTypes.CUSTOM_APPLICATION, true); // set to true Metadata Type to ignore all custom application
types[MetadataTypes.PERMISSION_SET] = new MetadataType(MetadataTypes.PERMISSION_SET, false); // set to false Metadata Type to ignore some permission sets
types[MetadataTypes.PERMISSION_SET].addChild(new MetadataObject('PermissionSet1', true)); // Set to true to repair PermissionSet1
types[MetadataTypes.PERMISSION_SET].addChild(new MetadataObject('PermissionSet2', true)); // Set to true to repair PermissionSet2
types[MetadataTypes.PERMISSION_SET].addChild(new MetadataObject('PermissionSet3', false)); // Set to false to not repair PermissionSet3
connection.retrieveLocalSpecialTypes('path/to/temporal/folder', types).then((result) => {
console.log(result);
}).catch((error) => {
// Handle errors
});
Method to Retrieve mixed special types from the connected org. Mixed means that only affect the Metadata Types on your project folder, but download all related data from this types from your org (and not only the local data)
Return a promise with a RetrieveResult with the retrieve result
This method can throw the next exceptions:
Retrieve all mixed special Metadata Types from Org
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
connection.retrieveMixedSpecialTypes('path/to/temporal/folder').then((result) => {
console.log(result);
}).catch((error) => {
// Handle errors
});
Retrieve some mixed special Metadata Types from Org
const Connection = require('@aurahelper/connector');
const { Types, Values } = require('@aurahelper/core');
const MetadataTypes = Values.MetadataTypes;
const MetadataType = Types.MetadataType;
const MetadataObject = Types.MetadataObject;
const MetadataItem = Types.MetadataItem;
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const types: {};
types[MetadataTypes.CUSTOM_APPLICATION] = new MetadataType(MetadataTypes.CUSTOM_APPLICATION, true); // set to true Metadata Type to ignore all custom application
types[MetadataTypes.PERMISSION_SET] = new MetadataType(MetadataTypes.PERMISSION_SET, false); // set to false Metadata Type to ignore some permission sets
types[MetadataTypes.PERMISSION_SET].addChild(new MetadataObject('PermissionSet1', true)); // Set to true to repair PermissionSet1
types[MetadataTypes.PERMISSION_SET].addChild(new MetadataObject('PermissionSet2', true)); // Set to true to repair PermissionSet2
types[MetadataTypes.PERMISSION_SET].addChild(new MetadataObject('PermissionSet3', false)); // Set to false to not repair PermissionSet3
connection.retrieveMixedSpecialTypes('path/to/temporal/folder', types).then((result) => {
console.log(result);
}).catch((error) => {
// Handle errors
});
Method to Retrieve org special types from the connected org. Org means that affect all Metadata types stored in your org not on your local project.
Return a promise with a RetrieveResult with the retrieve result
This method can throw the next exceptions:
Retrieve all org special Metadata Types from Org
const Connection = require('@aurahelper/connector');
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
connection.retrieveOrgSpecialTypes('path/to/temporal/folder').then((result) => {
console.log(result);
}).catch((error) => {
// Handle errors
});
Retrieve some org special Metadata Types from Org
const Connection = require('@aurahelper/connector');
const { Types, Values } = require('@aurahelper/core');
const MetadataTypes = Values.MetadataTypes;
const MetadataType = Types.MetadataType;
const MetadataObject = Types.MetadataObject;
const MetadataItem = Types.MetadataItem;
const connection = new Connection('MyOrg', 51, 'path/to/project/folder');
const types: {};
types[MetadataTypes.CUSTOM_APPLICATION] = new MetadataType(MetadataTypes.CUSTOM_APPLICATION, true); // set to true Metadata Type to ignore all custom application
types[MetadataTypes.PERMISSION_SET] = new MetadataType(MetadataTypes.PERMISSION_SET, false); // set to false Metadata Type to ignore some permission sets
types[MetadataTypes.PERMISSION_SET].addChild(new MetadataObject('PermissionSet1', true)); // Set to true to repair PermissionSet1
types[MetadataTypes.PERMISSION_SET].addChild(new MetadataObject('PermissionSet2', true)); // Set to true to repair PermissionSet2
types[MetadataTypes.PERMISSION_SET].addChild(new MetadataObject('PermissionSet3', false)); // Set to false to not repair PermissionSet3
connection.retrieveOrgSpecialTypes('path/to/temporal/folder', types).then((result) => {
console.log(result);
}).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",
},
...,
...,
...
}
},
...,
...,
...
}
}
}
FAQs
Powerfull Libraries to connect with Salesforce to list, describe, deploy or retrieve metadata types. Also can describe SObjects, Create Projects, Authorize Orgs, Execute Queries, Export or Import Data... To the correct work of this library, you need to ha
The npm package @aurahelper/connector receives a total of 42 weekly downloads. As such, @aurahelper/connector popularity was classified as not popular.
We found that @aurahelper/connector 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.