UNPKG

@esri/solution-common

Version:

Provides general helper functions for @esri/solution.js.

69 lines (68 loc) 2.75 kB
/** @license * Copyright 2021 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. */ import { UserSession } from "./arcgisRestJS"; import { IVelocityInfo } from "./interfaces"; export declare const BASE_NAMES: string[]; export declare const PROP_NAMES: string[]; /** * Get the base velocity url from the current orgs subscription info * * This function will update the input templateDictionary arg with the velocity url * so we can reuse it without pinging the org again for subsequent requests to the * velocity api. * * @param authentication Credentials for the requests * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements * * @returns a promise that will resolve with the velocity url or an empty string when the org does not support velocity * */ export declare function getVelocityUrlBase(authentication: UserSession, templateDictionary: any): Promise<string>; /** * Get the baser velocity url from the current ogs subscription info and verify that we have a valid * id for velocity * * @param authentication Credentials for the requests * * @returns a promise that will resolve with a hasVelocity boolean flag and the velocity url or an empty string when the org does not support velocity * */ export declare function getVelocityInfo(authentication: UserSession): Promise<IVelocityInfo>; /** * Update any velocity urls found in the data * * This function can be extended to support any item type specific functions such as * removing the itemId from operational layers in a webmap * * @param data The data object of the item * @param type The item type * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements * * @returns an updated instance of the data object that was supplied. * */ export declare function updateVelocityReferences(data: any, type: string, templateDictionary: any): any; /** * Helper function to update velocity urls found in the data * * * @param data The data object of the item * @param velocityUrl The velocity url from the current organization * * @returns an updated instance of the data object that was supplied. * @private */ export declare function _replaceVelocityUrls(data: any, velocityUrl: string): any;