UNPKG

@esri/solution-common

Version:

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

80 lines (79 loc) 4.85 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. */ /** * Provides functions for sending resources to AGO. */ import { UserSession } from "../arcgisRestJS"; import { IAssociatedFileCopyResults, IAssociatedFileInfo, IItemTemplate, ISourceFile, IZipInfo } from "../interfaces"; /** * Copies the files for storing the resources, metadata, and thumbnail of an item or group to a storage item * with a specified path by collecting files into zip files. * * @param files List of item files' URLs and folder/filenames for storing the files * @param destinationItemId Id of item to receive copy of resource/metadata/thumbnail * @param destinationAuthentication Credentials for the request to the storage * @param maxFilesPerZip Number of files to include per zip file; AGO limits zips to 50 files * @returns A promise which resolves to a list of the result of the copies */ export declare function copyFilesAsResources(files: ISourceFile[], destinationItemId: string, destinationAuthentication: UserSession, maxFilesPerZip?: number): Promise<IAssociatedFileCopyResults[]>; /** * Copies the files described by a list of full URLs and storage folder/filename combinations for storing * the resources, metadata, and thumbnail of an item or group to a storage item with different * handling based on the type of file. * * @param fileInfos List of item files' URLs and folder/filenames for storing the files * @param sourceAuthentication Credentials for the request to the source * @param sourceItemId Id of item supplying resource/metadata * @param destinationItemId Id of item to receive copy of resource/metadata/thumbnail * @param destinationAuthentication Credentials for the request to the storage * @param template Description of item that will receive files * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies * @returns A promise which resolves to a list of the result of the copies */ export declare function copyAssociatedFilesByType(fileInfos: IAssociatedFileInfo[], sourceAuthentication: UserSession, sourceItemId: string, destinationItemId: string, destinationAuthentication: UserSession, template?: any, templateDictionary?: any): Promise<IAssociatedFileCopyResults[]>; /** * Copies one or more zipfiles to a storage item. * * @param zipInfos List of zip files containing files to store * @param destinationItemId Id of item to receive copy of resource/metadata/thumbnail * @param destinationAuthentication Credentials for the request to the storage * @returns A promise which resolves to a list of the result of the copies * @private */ export declare function _copyAssociatedFileZips(zipInfos: IZipInfo[], destinationItemId: string, destinationAuthentication: UserSession): Promise<IAssociatedFileCopyResults[]>; /** * Replace templatizations in an item's resources * * @param sourceAuthentication Credentials for the request to the source * @param sourceItemId Id of item supplying resource/metadata * @param itemTemplate Item being created * @param fileInfos Resources for the item; these resources are modified as needed * by removing the templatization: the `url` property is replaced by the `file` property * @param destinationAuthentication Credentials for the request to the storage * @param templateDictionary Hash of facts: org URL, adlib replacements, deferreds for dependencies * * @returns A promise that resolves when all de-templatization has completed */ export declare function _detemplatizeResources(sourceAuthentication: UserSession, sourceItemId: string, itemTemplate: IItemTemplate, fileInfos: IAssociatedFileInfo[], destinationAuthentication: UserSession, templateDictionary?: any): Promise<void[]>; /** * Copies one or more zipfiles to a storage item in a serial fashion, waiting a bit between sends. * * @param zipInfos List of zip files containing files to store * @param destinationItemId Id of item to receive copy of resource/metadata/thumbnail * @param destinationAuthentication Credentials for the request to the storage * @returns A promise which resolves to a list of the result of the copies */ export declare function _sendZipsSeriallyToItem(zipInfos: IZipInfo[], destinationItemId: string, destinationAuthentication: UserSession): Promise<IAssociatedFileCopyResults[]>;