UNPKG

@esri/solution-common

Version:

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

113 lines (112 loc) 5.42 kB
/** @license * Copyright 2024 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 common functions compressing and decompressing workflow configurations. * * @module workflowHelpers */ import { IItemTemplate, IPreProcessWorkflowTemplatesResponse } from "./interfaces"; import { IPortal, UserSession } from "./arcgisRestJS"; /** * Compresses a workflow configuration into a zip file. * * @param workflowConfig Workflow configuration * @returns Promise resolving with a zip file */ export declare function compressWorkflowIntoZipFile(workflowConfig: any): Promise<File>; /** * Deletes a workflow. * * @param itemId Id of the workflow item * @param workflowBaseUrl URL of the workflow manager, e.g., "https://workflow.arcgis.com/orgId" * @param authentication Credentials for the request to AGOL * @returns Promise resolving with success or faliure of the request */ export declare function deleteWorkflowItem(itemId: string, workflowBaseUrl: string, authentication: UserSession): Promise<boolean>; /** * Extracts a workflow configuration from a zip file into a JSON object. * * @param zipFile Zip file containing a workflow configuration * @returns Promise resolving with a workflow configuration as JSON object, with each file being a key */ export declare function extractWorkflowFromZipFile(zipFile: File): Promise<any>; /** * Check the license capability of Workflow Manager Server. * * @param workflowBaseUrl URL of the workflow manager, e.g., "https://workflow.arcgis.com/orgId" * @param authentication Credentials for the request to AGO * @returns Promise resolving with a boolean indicating whether the organization has the license * @throws {WorkflowJsonExceptionDTO} if request to workflow manager fails */ export declare function getWorkflowManagerAuthorized(workflowBaseUrl: string, authentication: UserSession): Promise<boolean>; /** * Determines the URL to the Workflow Manager. * * @param authentication Authenticated user session * @param portalResponse Response from portal "self" call; will be fetched if not supplied * @param orgId Id of organization whose license is to be checked; if truthy, the URL will be for AGO; * if falsy, the URL will be for Workflow Manager Enterprise * @returns A URL based on ArcGIS Online or Enterprise, e.g., "https://abc123.esri.com:6443/arcgis" */ export declare function getWorkflowBaseURL(authentication: UserSession, portalResponse?: IPortal, orgId?: string): Promise<string>; /** * Get the URL for the Workflow Manager Enterprise application. * * @param portalRestUrl URL of the portal REST endpoint, e.g., "https://gisserver.domain.com/server/rest/services" * @param authentication Credentials for the request to AGO * @returns URL for the Workflow Manager Enterprise application (e.g., "https://abc123.esri.com:6443/arcgis"), * or an empty string if Workflow Manager is not enabled */ export declare function getWorkflowEnterpriseServerRootURL(portalRestUrl: string, authentication: UserSession): Promise<string>; /** * Remove feature service templates that will be auto-generated by Workflow when * creating the Workflow item. * * Also store key values from any Workflow items so we can update variables in other items. * * @param templates The list of all templates from the Solutions * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements * * @returns An object that contains the items that should use standard deployment and * templates that will be deployed by Wokflow deployment. */ export declare function preprocessWorkflowTemplates(templates: IItemTemplate[], templateDictionary: any): IPreProcessWorkflowTemplatesResponse; /** * Store key values from any Workflow items so we can update variables in other items. * * @param key property from a workflow item that will contain an item id that we will need for variable replacement * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements * @param template Workflow template * @param ids list of ids that will be auto generated by Workflow * */ export declare function storeKeyWorkflowServiceId(key: string, templateDictionary: any, template: IItemTemplate, ids: string[]): void; /** * Replace various IDs in the templates based on items that were created by Workflow * * @param templates The list of all templates from the Solutions * @param templateDictionary Hash of facts: folder id, org URL, adlib replacements * * @returns The updated collection of templates */ export declare function updateWorkflowTemplateIds(templates: IItemTemplate[], templateDictionary: any): IItemTemplate[]; /** * Get the various dependencies from the workflow item and add them to the current templates dependency list * * @param template The IItemTemplate of the workflow item * */ export declare function getWorkflowDependencies(template: IItemTemplate): void;