import { IUser, UserSession } from '@esri/arcgis-rest-auth'; import { IGroup, IItem, IPortal } from '@esri/arcgis-rest-portal'; import { IDeployable, IDeployedTemplateResponse, IGroupProcessor, IGroupTemplate, IPostProcessResult, IProcessorConversionOutput, IRemovedGroup, ISolutionVariables } from '@esri/templates-common'; /** * Handle Processing of Groups that will be included in the Template/Deployment */ export default class GroupProcessor implements IGroupProcessor { constructor(); name: string; /** * Can this processor convert a specific group to a template * * @param {IGroup} group * @return {*} {boolean} */ canConvert(): boolean; /** * Convert an IGroup into an IGroupTemplate * * @param {IGroup} group * @param {UserSession} srcSession Credentials for fetching information * @param {UserSession} destSession Credentials for writing information * @param {Record} [params] * @return {*} {Promise} */ convertToTemplate(group: IGroup, srcSession: UserSession, destSession: UserSession, _params?: Record): Promise; /** * Can this processor deploy a specific template? * * @param {IGroupTemplate} group * @return {*} {boolean} */ canDeploy(group: IGroupTemplate): boolean; /** * Check if a specific user can deploy a specific group template. * * Returns an IDeployable * * @param {IGroupTemplate} groupTemplate * @param {IUser} user * @param {IPortal} portal * @return {*} {IDeployable} */ canUserDeploy(groupTemplate: IGroupTemplate, user: IUser, portal: IPortal): IDeployable; /** * Create the group from the template. * * Calling code should already have called `canUserDeploy` so we * should not need to do any pre-flight checks. Any exceptions from * this code will be actual exceptional conditions * * @param {IGroupTemplate} template * @param {ISolutionVariables} variables * @param {UserSession} srcSession Credentials for fetching information * @param {UserSession} destSession Credentials for writing information * @return {*} {Promise} */ deployFromTemplate(template: IGroupTemplate, variables: ISolutionVariables, srcSession: UserSession, destSession: UserSession): Promise; /** * Share all dependencies into the group * * Once all the deployment tasks are complete, `postProcess` is called * for each item/group that was created. For Groups the system passes in * all the items that were created. * * This code will locate any item dependencies of the group * and share those items to the group * * Details: * During the Group deployment we take the group's dependencies (items * which need to be shared into the group once they are deployed) and * attach that into the `solutionVariables` hash as * * ```js * solutionVariables[newGroupId].itemsToShare = [sourceId, sourceId]; * ``` * * Since this function gets the deployed group (IGroup) we have the id * and can get the list. From there we use that list of sourceIds to * grab the deployed item entries that are attached into solutionVariables * as `solutionVariables[sourceId] = newItem` * * @param {IGroup} group * @param {IItem[]} allItems * @param {UserSession} destSession Credentials for writing information * @return {*} {Promise} */ postProcess(group: IGroup, allItems: IItem[], solutionVariables: ISolutionVariables, destSession: UserSession): Promise; /** * Remove a Group * Simply removes a group. Does nothing with items shared to the group * * @param {IGroup} group * @param {UserSession} session * @return {*} {Promise} */ removeGroup(group: IGroup, session: UserSession): Promise; }