salesforce-alm
Version:
This package contains tools, and APIs, for an improved salesforce.com developer experience.
50 lines (49 loc) • 2.23 kB
TypeScript
import * as BBPromise from 'bluebird';
import { MetadataType } from '../metadataType';
/**
* Encapsulates logic for handling of static resources.
*
* Static resources differ in the following ways from default mdapi expectations:
* 1. The file name has a normal extension reflecting the mime type (zip, jar, jpeg) rather than "resource"
* 2. A zip or jar archive can be exploded into a directory, and will be by default on pull. Only if an
* archive file with the resource full name exists in the resources directory will it remain zipped.
*
* Note that when an archive is expanded on pull no attempt is made to avoid redundant updates of unmodified files
* (as would happen in some other metadata decompositions).
*/
export declare class StaticResource {
private metadataPath;
private metadataType;
private usingGAWorkspace;
private resourcesDir;
private fullName;
private mimeType;
private fileExtensions;
private multiVersionHackUntilWorkspaceVersionsAreSupported;
constructor(metadataPath: string, metadataType: MetadataType, workspaceVersion: any, retrievedMetadataFilePath?: string, unsupportedMimeTypes?: string[]);
getResource(): BBPromise<string>;
saveResource(sourcePath: string, createDuplicates?: boolean, forceoverwrite?: boolean): Promise<[string[], string[], string[]]>;
isExplodedArchive(): boolean;
getContentPaths(): string[];
static zipDir(dir: string): BBPromise<string>;
/**
* Get the mime type from the npm mime library file.
* If the mime type is not supported there, use our backup manually added mime types file
* If the mime type is not supported there, throw an error
*
* @param unsupportedMimeTypes - an array of unsupported mime types for the purpose of logging
* @returns {string[]} the mime type extension(s)
*/
private getMimeTypeExtension;
private getFiles;
private static getMimeType;
private getLegacyFilePath;
private getSingleFilePath;
private getSingleFilePathPreferExisting;
private getExplodedFolderPath;
private isArchiveMimeType;
private expandArchive;
private compareExplodedDirs;
private handleResource;
private handleLegacyPath;
}