import { Reader } from 'properties-reader'; import { ExportMetaData } from '../ops/OpsTypes'; import { State } from '../shared/State'; export type ExportImport = { getMetadata(): ExportMetaData; titleCase(input: string): string; getRealmString(): string; convertBase64TextToArray(b64text: string): any[]; convertBase64UrlTextToArray(b64UTF8Text: string): any[]; convertTextArrayToBase64(textArray: string[]): string; convertTextArrayToBase64Url(textArray: string[]): any; validateImport(metadata: any): boolean; getTypedFilename(name: string, type: string, suffix?: string): string; getWorkingDirectory(mkdirs?: boolean): string; getFilePath(fileName: string, mkdirs?: boolean): string; saveToFile(type: string, data: object, identifier: string, filename: string, includeMeta?: boolean): void; /** * Save JSON object to file * @param {Object} data data object * @param {String} filename file name * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true * @return {boolean} true if successful, false otherwise */ saveJsonToFile(data: object, filename: string, includeMeta?: boolean): boolean; /** * Save text data to file * @param data text data * @param filename file name * @return true if successful, false otherwise */ saveTextToFile(data: string, filename: string): boolean; /** * Append text data to file * @param {String} data text data * @param {String} filename file name */ appendTextToFile(data: string, filename: string): void; /** * Find files by name * @param {string} fileName file name to search for * @param {boolean} fast return first result and stop search * @param {string} path path to directory where to start the search * @returns {string[]} array of found file paths relative to starting directory */ findFilesByName(fileName: string, fast?: boolean, path?: string): string[]; /** * find all (nested) files in a directory * * @param directory directory to search * @returns list of files */ readFiles(directory: string): Promise<{ path: string; content: string; }[]>; substituteEnvParams(input: string, reader: Reader): string; unSubstituteEnvParams(input: string, reader: Reader): string; parseUrl(href: string): any; /** * Check if a string is a valid URL * @param {string} urlString input string to be evaluated * @returns {boolean} true if a valid URL, false otherwise */ isValidUrl(urlString: string): boolean; }; declare const _default: (state: State) => ExportImport; export default _default; export declare function getMetadata({ state }: { state: State; }): ExportMetaData; export declare function titleCase(input: string): string; export declare function getRealmString({ state }: { state: State; }): string; export declare function convertBase64TextToArray(b64text: string): any[]; export declare function convertBase64UrlTextToArray(b64UTF8Text: string): any[]; export declare function convertTextArrayToBase64(textArray: string[]): string; export declare function convertTextArrayToBase64Url(textArray: string[]): any; export declare function validateImport(metadata: any): boolean; export declare function getTypedFilename(name: string, type: string, suffix?: string): string; export declare function getWorkingDirectory({ mkdirs, state, }: { mkdirs: boolean; state: State; }): string; /** * Get the file path to a file in the working directory. If working directory does not exist, it will return the fileName as the file path. * @param fileName The file name * @param mkdirs If directories to working directory don't exist, makes the directories if true, and if false does not make the directories. Default: false * @return The file path to the file in the working directory */ export declare function getFilePath({ fileName, mkdirs, state, }: { fileName: string; mkdirs: boolean; state: State; }): string; /** * Save to file * @param {any} data data object * @param {string} filename file name */ export declare function saveToFile({ type, data, identifier, filename, includeMeta, state, }: { type: string; data: object; identifier: string; filename: string; includeMeta: boolean; state: State; }): void; /** * Save JSON object to file * @param {object} data data object * @param {string} filename file name * @param {boolean} includeMeta true to include metadata, false otherwise. Default: true * @return {boolean} true if successful, false otherwise */ export declare function saveJsonToFile({ data, filename, includeMeta, state, }: { data: object; filename: string; includeMeta?: boolean; state: State; }): boolean; /** * Save text data to file * @param data text data * @param filename file name * @return true if successful, false otherwise */ export declare function saveTextToFile({ data, filename, state, }: { data: string; filename: string; state: State; }): boolean; /** * Append text data to file * @param {string} data text data * @param {string} filename file name */ export declare function appendTextToFile(data: string, filename: string): void; /** * Find files by name * @param {string} fileName file name to search for * @param {boolean} fast return first result and stop search * @param {string} path path to directory where to start the search * @returns {string[]} array of found file paths relative to starting directory */ export declare function findFilesByName(fileName: string, fast?: boolean, path?: string): string[]; /** * find all (nested) files in a directory * * @param directory directory to search * @returns list of files */ export declare function readFiles(directory: string): Promise<{ path: string; content: string; }[]>; export declare function substituteEnvParams(input: string, reader: Reader): string; export declare function unSubstituteEnvParams(input: string, reader: Reader): string; export declare function parseUrl(href: string): any; /** * Check if a string is a valid URL * @param {string} urlString input string to be evaluated * @returns {boolean} true if a valid URL, false otherwise */ export declare function isValidUrl(urlString: string): boolean; /** * Performs an export given a function with its parameters with custom error handling that will just print the error if one is thrown and return null. * @param func The export function. * @param parameters The parameters to call the export function with. By default, it is { state }. * @param errors Parameter to collect errors that occur. * @param perform Performs and returns the export if true, otherwise returns null. Default: true * @returns {Promise} Returns the result of the export function, or null if an error is thrown or perform is false */ export declare function exportWithErrorHandling

(func: (params: P) => Promise, parameters: P, errors: Error[], perform?: boolean): Promise; /** * Performs an import given a function with its parameters with custom error handling that will just print the error if one is thrown and return null. * @param func The import function. * @param parameters The parameters to call the import function with. By default, it is { state }. * @param errors Parameter to collect errors that occur. * @param id Indicator id for the progress indicator * @param type The type (plural) of the entities being imported * @param perform Performs and returns the export if true, otherwise returns null. Default: true * @returns {Promise} Returns the result of the import function, or null if an error is thrown */ export declare function importWithErrorHandling

(func: (params: P) => Promise, parameters: P, errors: Error[], id: string, type: string, perform?: boolean): Promise; //# sourceMappingURL=ExportImportUtils.d.ts.map