UNPKG

@esri/solution-common

Version:

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

141 lines (140 loc) 4.56 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. * * @module item-reuse */ import { IItem, ISearchResult, UserSession } from "./arcgisRestJS"; export interface ISourceItem { /** * The key is the id of the item as it is within the solution template that will be deployed */ [key: string]: IReuseItem; } /** * Object that contains key details for items that could be leveraged for reuse */ export interface IReuseItem { /** * The key is the id of the item as it is within the solution template that will be deployed */ [key: string]: IReuseItemInfo; } /** * Object that contains key details for an item that could be leveraged for reuse */ export interface IReuseItemInfo { /** * The date/time the item was created */ created: number; /** * A collection of key details from solutions that leverage this item */ solutions: IReuseSolutions; /** * The title of the item that is already deployed */ title: string; /** * The type of item that is already deployed */ type: string; } /** * A collection of key details from a solutions that leverage one or more reuse items */ export interface IReuseSolutions { /** * A collection of key details from a solution that leverages one or more reuse items * The key is the id of the deployed solution. */ [key: string]: IReuseSolution; } /** * A collection of key details from a solution that leverages one or more reuse items */ export interface IReuseSolution { /** * The date/time the solution was created */ created: number; /** * The title of the solution is already deployed */ title: string; } /** * Collection of key details about one or more solutions */ export interface ISolutionInfos { /** * Key details about a solution * The key value is the solutions item id */ [key: string]: ISolutionInfo; } /** * Key details about a solution */ export interface ISolutionInfo { /** * Array of template ids from the solution */ templates: string[]; /** * A collection of key details from a solution that leverages one or more reuse items */ solutionInfo: IReuseSolution; } /** * Find all deployed solutions and their items from the current org for the current user * * @param authentication Credentials for the request */ export declare function getDeployedSolutionsAndItems(authentication: UserSession): Promise<ISolutionInfos>; /** * Find all deployed solutions from the current org for the current user * * @param authentication Credentials for the request */ export declare function getDeployedSolutions(authentication: UserSession): Promise<ISearchResult<IItem>>; /** * Find key details for the items from each of the deployed solutions * * @param authentication Credentials for the request * @param searchResults key details of the deployed solutions */ export declare function getSolutionItemsFromDeployedSolutions(authentication: UserSession, searchResults: ISearchResult<IItem>): Promise<ISolutionInfos>; /** * Get the ids for each template in a solution * * @param authentication Credentials for the request */ export declare function getIdsFromSolutionTemplates(id: string, authentication: UserSession): Promise<string[]>; /** * Fetch key details for the solution that will be deployed and find any solutions * that leverage any of the source items that exist in the solution to be deployed. * * @param id The id of the solution that will be deployed * @param authentication Credentials for the request */ export declare function findReusableSolutionsAndItems(id: string, authentication: UserSession): Promise<ISourceItem>; /** * Fetch key details for the solution that will be deployed * * @param id The id of the solution that will be deployed * @param authentication Credentials for the request */ export declare function getItemHash(id: string, authentication: UserSession): Promise<ISourceItem>;