Skip to content

kratoon/salesforce-metadata

Repository files navigation

salesforce-metadata

npm version

Read and write Salesforce Metadata files in TypeScript.

WARNING: this project is not stable yet and any API can change.

Types

All the metadata types were generated from salesforce-wsdl-consumer.

Every property is optional and explicitArray for reading an XML file is set to true (always put child nodes in an array).

Usage

Currently, this version can only read and write XML Metadata files, i.e. even though the Profile type extends Metadata type, the "fullName" property from Metadata type won't be processed while reading and writing a file.

Exported functions:

  • readMetadataXML(file: string): Promise<MetadataFile>
  • writeMetadataXML(file: string, metadata: MetadataFile, options?: OptionsV2): Promise<void>
readMetadataXML(profilePath)
    .then((profile: {Profile: Profile}) => {
        profile.Profile.userPermissions?.forEach((perm: ProfileUserPermission) => {
            // ...
        });
        return writeMetadataXML(profilePath, profile);
    });