@esri/solution-common
Version:
Provides general helper functions for @esri/solution.js.
74 lines (73 loc) • 2.63 kB
TypeScript
/** @license
* Copyright 2020 Esri
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* Provides connectors to third-party helper functions.
*/
import { Sanitizer } from "@esri/arcgis-html-sanitizer";
export { Sanitizer } from "@esri/arcgis-html-sanitizer";
/**
* Creates a zip File from a collection of Files.
*
* @param zipFilename Name to use for zip File
* @param files List of files to add to zip File
* @param folder Folder to contain the files
* @returns Promise resolving to a zip File
*/
export declare function createZip(zipFilename: string, files: File[], folder?: string): Promise<File>;
/**
* Result of checking if a string contains invalid HTML.
*/
export interface IValidationResult {
isValid: boolean;
sanitized: string;
}
/**
* Sanitizes html.
*
* @param HTML Text to sanitize
* @param sanitizer Instance of Sanitizer class
* @returns Sanitized version of `html`
* @see https://github.com/esri/arcgis-html-sanitizer#basic-usage
*/
export declare function sanitizeHTML(html: string, sanitizer?: Sanitizer): string;
/**
* Sanitizes JSON.
*
* @param json JSON to sanitize
* @param sanitizer Instance of Sanitizer class
* @returns Sanitized version of `json`
* @see https://github.com/esri/arcgis-html-sanitizer#sanitize-json
*/
export declare function sanitizeJSON(json: any, sanitizer?: Sanitizer): any;
/**
* Sanitizes the protocol in a URL.
*
* @param url URL to sanitize
* @param sanitizer Instance of Sanitizer class
* @returns Sanitized version of `url`
* @see https://github.com/esri/arcgis-html-sanitizer#sanitize-urls
*/
export declare function sanitizeURLProtocol(url: string, sanitizer?: Sanitizer): string;
/**
* Checks if a string contains invalid HTML.
*
* @param html HTML to check
* @param sanitizer Instance of Sanitizer class
* @returns An object containing a flag indicating if `html` is valid (i.e., contains no invalid HTML)
* as well as the sanitized version of `html`
* @see https://github.com/esri/arcgis-html-sanitizer#basic-usage
*/
export declare function validateHTML(html: string, sanitizer?: Sanitizer): IValidationResult;