UNPKG

@esri/solution-common

Version:

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

116 lines (115 loc) 4.87 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 { ICreateServiceParams, UserSession } from "./arcgisRestJS"; import { IItemTemplate, IItemUpdate } from "./interfaces"; /** * Used by deploy to evaluate if we have everything we need to deploy tracking views. * * This function will update the input templateDictionary with a boolean * indicating if tracking is enabled on the org and the user is an admin. * * @param portalResponse portal self response * @param userResponse portal user response * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies * @param templates the list of IItemTemplates from the solution * * @private */ export declare function setLocationTrackingEnabled(portalResponse: any, userResponse: any, templateDictionary: any, templates?: IItemTemplate[]): void; /** * Used by deploy to evaluate if we have everything we need to deploy tracking views. * * An error is thrown to prevent additional deployment work if we have Tracking items and tracking is * not enabled or the deployment user is not an admin in the organization. * * @param templates the list of IItemTemplates from the solution * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies * * @private */ export declare function _validateTrackingTemplates(templates: IItemTemplate[], templateDictionary: any): void; /** * Used by deploy to determine the owner of the tracking service. * Only one tracking service per org and all tracking views and tracking groups must be owned by the tracking service owner. * * This function will update the input templateDictionary with the owner as well as * the item id for the source tracking service. * * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies * @param authentication Credentials for the requests * * @private */ export declare function getTackingServiceOwner(templateDictionary: any, authentication: UserSession): Promise<boolean>; /** * Check key properties to understand if we are dealing with a tracking template * * @param itemTemplate the template to evaluate * @param itemUpdate the item update to evaluate * * @private */ export declare function isTrackingViewTemplate(itemTemplate?: IItemTemplate, itemUpdate?: IItemUpdate): boolean; /** * Check key properties to understand if we are dealing with a tracking group template * * @param itemTemplate the template to evaluate * * @private */ export declare function isTrackingViewGroup(itemTemplate: IItemTemplate): boolean; /** * Templatize the tracker view group id and view name for location tracking views. * This function will update the itemTemplate that is passed in when it's a tracking view. * * @param itemTemplate Template for feature service item * * @private */ export declare function templatizeTracker(itemTemplate: IItemTemplate): void; /** * Templatize the tracker view group id and view name for location tracking views. * This function will update the itemTemplate that is passed in when it's a tracking view. * * @param itemTemplate Template for the tracker view * @param path the path to the property that stores the current name * @param groupId the id of the associated tracker group * @param groupIdVar the variable to replace the existing name with * * @private */ export declare function _setName(itemTemplate: IItemTemplate, path: string, groupId: string, groupIdVar: string): void; /** * Templatize the tracker view serviceItemId * * This function will update the input obj with the templatized variable * * @param obj the object that stores the serviceItemId * @param path the path to the property that stores the serviceItemId * * @private */ export declare function templatizeServiceItemId(obj: any, path: string): void; /** * Used by deploy to update the request options with key details for deploying tracker views * * @param itemTemplate Template for feature service item * @param options the current request options to update * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies * * @private */ export declare function setTrackingOptions(itemTemplate: IItemTemplate, options: any, templateDictionary: any): ICreateServiceParams;