@esri/solution-creator 1.3.14 → 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/umd/creator.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-creator - v1.
|
|
2
|
+
* @esri/solution-creator - v1.4.1 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
-
*
|
|
4
|
+
* Mon Aug 01 2022 14:09:34 GMT-0700 (Pacific Daylight Time)
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creator.umd.js","sources":["../../src/module-map.ts","../../src/createItemTemplate.ts","../../src/helpers/add-content-to-solution.ts","../../src/creator.ts"],"sourcesContent":["/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { moduleHandler, IItemTypeModuleMap } from \"@esri/solution-common\";\r\nimport * as featureLayer from \"@esri/solution-feature-layer\";\r\nimport * as fileProcessor from \"@esri/solution-file\";\r\nimport * as formProcessor from \"@esri/solution-form\";\r\nimport * as group from \"@esri/solution-group\";\r\nimport {\r\n simpleTypes,\r\n notebookProcessor,\r\n quickcaptureProcessor\r\n} from \"@esri/solution-simple-types\";\r\nimport { StoryMapProcessor } from \"@esri/solution-storymap\";\r\nimport { VelocityProcessor } from \"@esri/solution-velocity\";\r\nimport { WebExperienceProcessor } from \"@esri/solution-web-experience\";\r\nimport { HubPageProcessor, HubSiteProcessor } from \"@esri/solution-hub-types\";\r\n\r\nexport const UNSUPPORTED: moduleHandler = null;\r\n\r\n/**\r\n * Mapping from item type to module with type-specific template-handling code.\r\n * AGO types come from a blend of arcgis-portal-app\\src\\js\\arcgisonline\\pages\\item\\_Info.js and\r\n * arcgis-portal-app\\src\\js\\arcgis-components\\src\\_utils\\metadata\\item\\displayName.ts\r\n */\r\nexport const moduleMap: IItemTypeModuleMap = {\r\n ////////////////////////////////////////////////////////\r\n // Group type\r\n Group: group,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Layer types\r\n \"Big Data Analytic\": VelocityProcessor,\r\n \"Feature Collection\": simpleTypes,\r\n \"Feature Service\": featureLayer,\r\n Feed: VelocityProcessor,\r\n \"Geocoding Service\": undefined,\r\n \"Geodata Service\": undefined,\r\n \"Geometry Service\": undefined,\r\n \"Geoprocessing Service\": undefined,\r\n \"Globe Service\": undefined,\r\n \"Image Service\": undefined,\r\n KML: undefined,\r\n \"Map Service\": featureLayer,\r\n \"Network Analysis Service\": undefined,\r\n \"Real Time Analytic\": VelocityProcessor,\r\n \"Relational Database Connection\": undefined,\r\n \"Scene Service\": undefined,\r\n \"Stream Service\": undefined,\r\n Tool: undefined,\r\n \"Vector Tile Service\": undefined,\r\n WFS: undefined,\r\n WMS: undefined,\r\n WMTS: undefined,\r\n \"Workflow Manager Service\": undefined,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Map types\r\n \"3D Web Scene\": undefined,\r\n \"Web Map\": simpleTypes,\r\n \"Web Scene\": simpleTypes,\r\n\r\n ////////////////////////////////////////////////////////\r\n // App types\r\n Application: undefined,\r\n Dashboard: simpleTypes,\r\n \"Data Store\": undefined,\r\n \"Desktop Application\": undefined,\r\n \"Excalibur Imagery Project\": undefined,\r\n Form: formProcessor,\r\n \"Hub Initiative\": UNSUPPORTED,\r\n \"Hub Page\": HubPageProcessor,\r\n \"Hub Site Application\": HubSiteProcessor,\r\n \"Insights Model\": simpleTypes,\r\n \"Insights Page\": undefined,\r\n \"Insights Theme\": undefined,\r\n \"Insights Workbook\": undefined,\r\n Mission: undefined,\r\n \"Mobile Application\": undefined,\r\n Notebook: notebookProcessor,\r\n \"Oriented Imagery Catalog\": simpleTypes,\r\n \"Ortho Mapping Project\": undefined,\r\n \"QuickCapture Project\": quickcaptureProcessor,\r\n \"Site Application\": HubSiteProcessor,\r\n \"Site Page\": HubPageProcessor,\r\n Solution: UNSUPPORTED,\r\n StoryMap: StoryMapProcessor,\r\n \"Urban Model\": undefined,\r\n \"Web Experience Template\": undefined,\r\n \"Web Experience\": WebExperienceProcessor,\r\n \"Web Mapping Application\": simpleTypes,\r\n \"Workforce Project\": simpleTypes,\r\n\r\n ////////////////////////////////////////////////////////\r\n // File types\r\n \"360 VR Experience\": fileProcessor,\r\n \"AppBuilder Extension\": fileProcessor,\r\n \"AppBuilder Widget Package\": fileProcessor,\r\n \"Application Configuration\": fileProcessor,\r\n \"ArcGIS Pro Add In\": fileProcessor,\r\n \"ArcGIS Pro Configuration\": fileProcessor,\r\n \"ArcPad Package\": fileProcessor,\r\n \"Basemap Package\": fileProcessor,\r\n \"CAD Drawing\": fileProcessor,\r\n \"CityEngine Web Scene\": fileProcessor,\r\n \"Code Attachment\": UNSUPPORTED,\r\n \"Code Sample\": fileProcessor,\r\n \"Color Set\": fileProcessor,\r\n \"Compact Tile Package\": fileProcessor,\r\n \"CSV Collection\": fileProcessor,\r\n CSV: fileProcessor,\r\n \"Deep Learning Package\": fileProcessor,\r\n \"Desktop Add In\": fileProcessor,\r\n \"Desktop Application Template\": fileProcessor,\r\n \"Desktop Style\": fileProcessor,\r\n \"Document Link\": fileProcessor,\r\n \"Explorer Add In\": fileProcessor,\r\n \"Explorer Layer\": fileProcessor,\r\n \"Explorer Map\": fileProcessor,\r\n \"Feature Collection Template\": fileProcessor,\r\n \"File Geodatabase\": fileProcessor,\r\n GeoJson: fileProcessor,\r\n GeoPackage: fileProcessor,\r\n \"Geoprocessing Package\": fileProcessor,\r\n \"Geoprocessing Sample\": fileProcessor,\r\n \"Globe Document\": fileProcessor,\r\n \"Image Collection\": fileProcessor,\r\n Image: fileProcessor,\r\n \"iWork Keynote\": fileProcessor,\r\n \"iWork Numbers\": fileProcessor,\r\n \"iWork Pages\": fileProcessor,\r\n \"KML Collection\": fileProcessor,\r\n \"Layer Package\": fileProcessor,\r\n \"Layer Template\": fileProcessor,\r\n Layer: fileProcessor,\r\n Layout: fileProcessor,\r\n \"Locator Package\": fileProcessor,\r\n \"Map Document\": fileProcessor,\r\n \"Map Package\": fileProcessor,\r\n \"Map Template\": fileProcessor,\r\n \"Microsoft Excel\": fileProcessor,\r\n \"Microsoft Powerpoint\": fileProcessor,\r\n \"Microsoft Word\": fileProcessor,\r\n \"Mobile Basemap Package\": fileProcessor,\r\n \"Mobile Map Package\": fileProcessor,\r\n \"Mobile Scene Package\": fileProcessor,\r\n \"Native Application\": fileProcessor,\r\n \"Native Application Installer\": fileProcessor,\r\n \"Native Application Template\": fileProcessor,\r\n netCDF: fileProcessor,\r\n \"Operation View\": fileProcessor,\r\n \"Operations Dashboard Add In\": fileProcessor,\r\n \"Operations Dashboard Extension\": fileProcessor,\r\n PDF: fileProcessor,\r\n \"Pro Layer Package\": fileProcessor,\r\n \"Pro Layer\": fileProcessor,\r\n \"Pro Map Package\": fileProcessor,\r\n \"Pro Map\": fileProcessor,\r\n \"Pro Report\": fileProcessor,\r\n \"Project Package\": fileProcessor,\r\n \"Project Template\": fileProcessor,\r\n \"Published Map\": fileProcessor,\r\n \"Raster function template\": fileProcessor,\r\n \"Report Template\": fileProcessor,\r\n \"Rule Package\": fileProcessor,\r\n \"Scene Document\": fileProcessor,\r\n \"Scene Package\": fileProcessor,\r\n \"Service Definition\": fileProcessor,\r\n Shapefile: fileProcessor,\r\n \"Statistical Data Collection\": fileProcessor,\r\n Style: fileProcessor,\r\n \"Survey123 Add In\": fileProcessor,\r\n \"Symbol Set\": fileProcessor,\r\n \"Task File\": fileProcessor,\r\n \"Tile Package\": fileProcessor,\r\n \"Toolbox Package\": fileProcessor,\r\n \"Vector Tile Package\": fileProcessor,\r\n \"Viewer Configuration\": fileProcessor,\r\n \"Visio Document\": fileProcessor,\r\n \"Window Mobile Package\": fileProcessor,\r\n \"Windows Mobile Package\": fileProcessor,\r\n \"Windows Viewer Add In\": fileProcessor,\r\n \"Windows Viewer Configuration\": fileProcessor,\r\n \"Workflow Manager Package\": fileProcessor,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Testing \"types\"\r\n Undefined: undefined,\r\n Unsupported: UNSUPPORTED\r\n};\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages creation of the template of a Solution item via the REST API.\r\n *\r\n * @module createItemTemplate\r\n */\r\n\r\nimport {\r\n cleanLayerBasedItemId,\r\n createPlaceholderTemplate,\r\n EItemProgressStatus,\r\n SolutionTemplateFormatVersion,\r\n findTemplateInList,\r\n getGroupBase,\r\n getItemBase,\r\n hasDatasource,\r\n IDatasourceInfo,\r\n IItemGeneralized,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n ISourceFile,\r\n ISourceFileCopyPath,\r\n getItemResourcesFilesFromPaths,\r\n getItemResourcesPaths,\r\n replaceTemplate,\r\n sanitizeJSONAndReportChanges,\r\n fail,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { getProp } from \"@esri/hub-common\";\r\nimport { moduleMap, UNSUPPORTED } from \"./module-map\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Creates template for an AGO item and its dependencies\r\n *\r\n * @param solutionItemId The solution to contain the item\r\n * @param itemId AGO id string\r\n * @param templateDictionary Hash of facts\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Authentication for requesting information from AGO about items to be included in solution item\r\n * @param existingTemplates A collection of AGO item templates that can be referenced by newly-created templates\r\n * @returns A promise which resolves with an array of resources for the item and its dependencies\r\n * @private\r\n */\r\nexport function createItemTemplate(\r\n solutionItemId: string,\r\n itemId: string,\r\n templateDictionary: any,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession,\r\n existingTemplates: IItemTemplate[],\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ISourceFile[]> {\r\n return new Promise(resolve => {\r\n // Check if item and its dependents are already in list or are queued\r\n if (findTemplateInList(existingTemplates, itemId)) {\r\n resolve([]);\r\n } else {\r\n // Add the id as a placeholder to show that it is being fetched\r\n existingTemplates.push(createPlaceholderTemplate(itemId));\r\n\r\n itemProgressCallback(itemId, EItemProgressStatus.Started, 0);\r\n\r\n // Fetch the item\r\n getItemBase(itemId, srcAuthentication)\r\n .catch(() => {\r\n // If item query fails, try fetching item as a group\r\n // Change its placeholder from an empty type to the Group type so that we can later distinguish\r\n // between items and groups (the base info for a group doesn't include a type property)\r\n replaceTemplate(\r\n existingTemplates,\r\n itemId,\r\n createPlaceholderTemplate(itemId, \"Group\")\r\n );\r\n return getGroupBase(itemId, srcAuthentication);\r\n })\r\n .then(\r\n itemInfo => {\r\n itemInfo = sanitizeJSONAndReportChanges(itemInfo);\r\n\r\n // Save the URL as a symbol\r\n if (itemInfo.url) {\r\n templateDictionary[itemInfo.url] = \"{{\" + itemInfo.id + \".url}}\";\r\n itemInfo.origUrl = itemInfo.url;\r\n }\r\n\r\n const idTest: RegExp = /^source-[0-9A-F]{32}/i;\r\n // Remove any source-itemId type keywords\r\n /* istanbul ignore else */\r\n if (Array.isArray(itemInfo.typeKeywords)) {\r\n itemInfo.typeKeywords = itemInfo.typeKeywords.filter(v =>\r\n idTest.test(v) ? false : true\r\n );\r\n }\r\n // Remove any source-itemId tags\r\n /* istanbul ignore else */\r\n if (Array.isArray(itemInfo.tags)) {\r\n itemInfo.tags = itemInfo.tags.filter(v =>\r\n idTest.test(v) ? false : true\r\n );\r\n }\r\n\r\n const placeholder = findTemplateInList(existingTemplates, itemId);\r\n let itemType = placeholder.type;\r\n if (!itemType) {\r\n // Groups have this defined when their placeholder is created\r\n itemType = itemInfo.type;\r\n placeholder.type = itemType;\r\n }\r\n if (!itemInfo.type) {\r\n itemInfo.type = itemType; // Groups don't have this property, so we'll patch it in\r\n }\r\n placeholder.item = {\r\n ...itemInfo\r\n } as IItemGeneralized;\r\n\r\n // Interrupt process if progress callback returns `false`\r\n if (!itemProgressCallback(itemId, EItemProgressStatus.Created, 1)) {\r\n itemProgressCallback(itemId, EItemProgressStatus.Cancelled, 1);\r\n resolve(fail(\"Cancelled\"));\r\n return;\r\n }\r\n\r\n const itemHandler = moduleMap[itemType];\r\n if (!itemHandler || itemHandler === UNSUPPORTED) {\r\n if (itemHandler === UNSUPPORTED) {\r\n itemProgressCallback(itemId, EItemProgressStatus.Ignored, 1);\r\n resolve([]);\r\n } else {\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n placeholder.properties[\"failed\"] = true;\r\n replaceTemplate(existingTemplates, itemId, placeholder);\r\n resolve(\r\n fail(\r\n \"The type of AGO item \" +\r\n itemId +\r\n \" ('\" +\r\n itemType +\r\n \"') is not supported at this time\"\r\n )\r\n );\r\n }\r\n } else {\r\n // Handle original Story Maps with next-gen Story Maps\r\n /* istanbul ignore else */\r\n /* Not yet supported\r\n if (storyMap.isAStoryMap(itemType, itemInfo.url)) {\r\n itemHandler = storyMap;\r\n } */\r\n\r\n // Delegate the creation of the item to the handler\r\n itemHandler\r\n .convertItemToTemplate(\r\n solutionItemId,\r\n itemInfo,\r\n destAuthentication,\r\n srcAuthentication,\r\n templateDictionary\r\n )\r\n .then(\r\n itemTemplate => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n getItemResourcesPaths(\r\n itemTemplate,\r\n solutionItemId,\r\n srcAuthentication,\r\n SolutionTemplateFormatVersion\r\n ).then((resourceItemFilePaths: ISourceFileCopyPath[]) => {\r\n itemTemplate.item.thumbnail = null; // not needed in this property; handled as a resource\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n getItemResourcesFilesFromPaths(\r\n resourceItemFilePaths,\r\n srcAuthentication\r\n ).then((resourceItemFiles: ISourceFile[]) => {\r\n // update the template's resources\r\n itemTemplate.resources = itemTemplate.resources.concat(\r\n resourceItemFiles.map(\r\n (file: ISourceFile) =>\r\n file.folder + \"/\" + file.filename\r\n )\r\n );\r\n\r\n // Set the value keyed by the id to the created template, replacing the placeholder template\r\n replaceTemplate(\r\n existingTemplates,\r\n itemTemplate.itemId,\r\n itemTemplate\r\n );\r\n\r\n // Trace item dependencies\r\n if (itemTemplate.dependencies.length === 0) {\r\n itemProgressCallback(\r\n itemId,\r\n EItemProgressStatus.Finished,\r\n 1\r\n );\r\n resolve(resourceItemFiles);\r\n } else {\r\n // Get its dependencies, asking each to get its dependents via\r\n // recursive calls to this function\r\n const dependentDfds: Array<Promise<\r\n ISourceFile[]\r\n >> = [];\r\n itemTemplate.dependencies.forEach(dependentId => {\r\n if (\r\n !findTemplateInList(\r\n existingTemplates,\r\n dependentId\r\n )\r\n ) {\r\n dependentDfds.push(\r\n createItemTemplate(\r\n solutionItemId,\r\n dependentId,\r\n templateDictionary,\r\n srcAuthentication,\r\n destAuthentication,\r\n existingTemplates,\r\n itemProgressCallback\r\n )\r\n );\r\n }\r\n });\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all(dependentDfds).then(\r\n (dependentResourceItemFiles: ISourceFile[][]) => {\r\n // Templatization of item and its dependencies done\r\n itemProgressCallback(\r\n itemId,\r\n EItemProgressStatus.Finished,\r\n 1\r\n );\r\n resourceItemFiles = dependentResourceItemFiles.reduce(\r\n (accumulator, currentValue) =>\r\n accumulator.concat(currentValue),\r\n resourceItemFiles\r\n );\r\n resolve(resourceItemFiles);\r\n }\r\n );\r\n }\r\n });\r\n });\r\n },\r\n error => {\r\n placeholder.properties[\"error\"] = JSON.stringify(error);\r\n replaceTemplate(existingTemplates, itemId, placeholder);\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n resolve([]);\r\n }\r\n );\r\n }\r\n },\r\n // Id not found or item is not accessible\r\n () => {\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n resolve([]);\r\n }\r\n );\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Templatizes field references within specific template types.\r\n * Currently only handles web applications\r\n *\r\n * @param templates List of solution templates\r\n * @returns A list of templates that have templatized field references\r\n */\r\nexport function postProcessFieldReferences(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n const datasourceInfos: IDatasourceInfo[] = _getDatasourceInfos(templates);\r\n const templateTypeHash: any = _getTemplateTypeHash(templates);\r\n\r\n return templates.map(template => {\r\n /* istanbul ignore else */\r\n if (\r\n template.type === \"Web Mapping Application\" ||\r\n template.type === \"Dashboard\" ||\r\n template.type === \"Web Map\"\r\n ) {\r\n const webMapFSDependencies: string[] = _getWebMapFSDependencies(\r\n template,\r\n templateTypeHash\r\n );\r\n const itemHandler: any = moduleMap[template.item.type];\r\n /* istanbul ignore else */\r\n if (itemHandler) {\r\n const dependencies: string[] = webMapFSDependencies.concat(\r\n template.dependencies\r\n );\r\n let dependantDatasources: IDatasourceInfo[] = datasourceInfos.filter(\r\n ds => {\r\n if (dependencies.indexOf(ds.itemId) > -1) {\r\n return ds;\r\n }\r\n }\r\n );\r\n dependantDatasources = _addMapLayerIds(\r\n dependantDatasources,\r\n templateTypeHash\r\n );\r\n if (dependantDatasources.length > 0) {\r\n template = itemHandler.postProcessFieldReferences(\r\n template,\r\n dependantDatasources,\r\n template.item.type\r\n );\r\n }\r\n }\r\n }\r\n return template;\r\n });\r\n}\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Get common properties that will support the templatization of field references\r\n *\r\n * @param templates List of solution templates\r\n * @returns A list of IDataSourceInfo objects with key properties\r\n * @private\r\n */\r\nexport function _getDatasourceInfos(\r\n templates: IItemTemplate[]\r\n): IDatasourceInfo[] {\r\n const datasourceInfos: IDatasourceInfo[] = [];\r\n templates.forEach(t => {\r\n if (t.type === \"Feature Service\") {\r\n const layers: any[] = getProp(t, \"properties.layers\") || [];\r\n const tables: any[] = getProp(t, \"properties.tables\") || [];\r\n const layersAndTables: any[] = layers.concat(tables);\r\n layersAndTables.forEach(obj => {\r\n /* istanbul ignore else */\r\n if (!hasDatasource(datasourceInfos, t.itemId, obj.id)) {\r\n datasourceInfos.push({\r\n itemId: t.itemId,\r\n layerId: obj.id,\r\n fields: obj.fields,\r\n basePath: t.itemId + \".layer\" + obj.id + \".fields\",\r\n url: getProp(t, \"item.url\"),\r\n ids: [],\r\n relationships: obj.relationships || [],\r\n adminLayerInfo: obj.adminLayerInfo || {}\r\n });\r\n }\r\n });\r\n }\r\n });\r\n return datasourceInfos;\r\n}\r\n\r\n/**\r\n * Creates a simple lookup object to quickly understand an items type and dependencies\r\n * and associated web map layer ids based on itemId\r\n *\r\n * @param templates List of solution templates\r\n * @returns The lookup object with type, dependencies, and webmap layer info\r\n * @private\r\n */\r\nexport function _getTemplateTypeHash(templates: IItemTemplate[]): any {\r\n const templateTypeHash: any = {};\r\n templates.forEach(template => {\r\n templateTypeHash[template.itemId] = {\r\n type: template.type,\r\n dependencies: template.dependencies\r\n };\r\n if (template.type === \"Web Map\") {\r\n _updateWebMapHashInfo(template, templateTypeHash[template.itemId]);\r\n }\r\n });\r\n return templateTypeHash;\r\n}\r\n\r\n/**\r\n * Updates the lookup object with webmap layer info\r\n * so we can know the id used within a map for a given feature service\r\n *\r\n * @param template A webmap solution template\r\n * @returns The lookup object with webmap layer info added\r\n * @private\r\n */\r\nexport function _updateWebMapHashInfo(template: IItemTemplate, hashItem: any) {\r\n const operationalLayers: any[] =\r\n getProp(template, \"data.operationalLayers\") || [];\r\n\r\n const tables: any[] = getProp(template, \"data.tables\") || [];\r\n const layersAndTables: any[] = operationalLayers.concat(tables);\r\n if (layersAndTables && layersAndTables.length > 0) {\r\n hashItem.layersAndTables = [];\r\n layersAndTables.forEach(layer => {\r\n const obj: any = {};\r\n let itemId: any;\r\n /* istanbul ignore else */\r\n if (layer.itemId) {\r\n itemId = layer.itemId;\r\n }\r\n /* istanbul ignore else */\r\n if (itemId) {\r\n obj[cleanLayerBasedItemId(itemId)] = {\r\n id: layer.id,\r\n url: layer.url\r\n };\r\n hashItem.layersAndTables.push(obj);\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Updates a templatized datasource URL with a layer id.\r\n *\r\n * @param dataSourceUrl Templatized datasource URL\r\n * @param layerId Layer id\r\n * @returns string Amended datasource URL\r\n * @private\r\n */\r\nexport function _addLayerIdToDatasourceUrl(\r\n datasourceUrl?: string,\r\n layerId?: any\r\n): string {\r\n return datasourceUrl && !isNaN(layerId)\r\n ? datasourceUrl.replace(/[.]/, \".layer\" + layerId + \".\")\r\n : \"\";\r\n}\r\n\r\n/**\r\n * Updates the datasource info objects by passing the webmap layer IDs from the lookup hash\r\n * to the underlying feature service datasource infos\r\n *\r\n * @param datasourceInfos A webmap solution template\r\n * @param templateTypeHash A simple lookup object populated with key item info\r\n * @returns The updated datasource infos\r\n * @private\r\n */\r\nexport function _addMapLayerIds(\r\n datasourceInfos: IDatasourceInfo[],\r\n templateTypeHash: any\r\n): IDatasourceInfo[] {\r\n const webMapIds: any[] = Object.keys(templateTypeHash).filter(k => {\r\n if (templateTypeHash[k].type === \"Web Map\") {\r\n return templateTypeHash[k];\r\n }\r\n });\r\n\r\n return datasourceInfos.map(ds => {\r\n webMapIds.forEach(webMapId => {\r\n templateTypeHash[webMapId].layersAndTables.forEach((opLayer: any) => {\r\n const opLayerInfo: any = opLayer[ds.itemId];\r\n const url: string = _addLayerIdToDatasourceUrl(ds.url, ds.layerId);\r\n if (\r\n opLayerInfo &&\r\n url === opLayerInfo.url &&\r\n ds.ids.indexOf(opLayerInfo.id) < 0\r\n ) {\r\n ds.ids.push(opLayerInfo.id);\r\n }\r\n });\r\n });\r\n return ds;\r\n });\r\n}\r\n\r\n/**\r\n * Get feature service item IDs from applications webmaps\r\n * As they are not explict dependencies of the application but are needed for field references\r\n *\r\n * @param template A webmap solution template\r\n * @param templateTypeHash A simple lookup object populated with key item info\r\n * @returns A lsit of feature service item IDs\r\n * @private\r\n */\r\nexport function _getWebMapFSDependencies(\r\n template: IItemTemplate,\r\n templateTypeHash: any\r\n): string[] {\r\n const webMapFSDependencies: string[] = [];\r\n template.dependencies.forEach(dep => {\r\n const depObj: any = templateTypeHash[dep];\r\n if (depObj.type === \"Web Map\") {\r\n depObj.dependencies.forEach((depObjDependency: string) => {\r\n /* istanbul ignore else */\r\n if (templateTypeHash[depObjDependency].type === \"Feature Service\") {\r\n webMapFSDependencies.push(depObjDependency);\r\n }\r\n });\r\n }\r\n });\r\n return webMapFSDependencies;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n SolutionTemplateFormatVersion,\r\n EItemProgressStatus,\r\n failWithIds,\r\n getIDs,\r\n getPortal,\r\n getTemplateById,\r\n globalStringReplace,\r\n ICreateSolutionOptions,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n IItemUpdate,\r\n ISolutionItemData,\r\n ISourceFile,\r\n isWorkforceProject,\r\n removeTemplate,\r\n replaceInTemplate,\r\n SItemProgressStatus,\r\n copyFilesToStorageItem,\r\n postProcessWorkforceTemplates,\r\n updateItem,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { getProp, getWithDefault } from \"@esri/hub-common\";\r\nimport {\r\n createItemTemplate,\r\n postProcessFieldReferences\r\n} from \"../createItemTemplate\";\r\n\r\n/**\r\n * Adds a list of AGO item ids to a solution item.\r\n *\r\n * @param solutionItemId AGO id of solution to receive items\r\n * @param options Customizations for creating the solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @returns A promise that resolves with the AGO id of the updated solution\r\n * @internal\r\n */\r\nexport function addContentToSolution(\r\n solutionItemId: string,\r\n options: ICreateSolutionOptions,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession\r\n): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n if (!options.itemIds || options.itemIds.length === 0) {\r\n resolve(solutionItemId);\r\n return;\r\n }\r\n\r\n // Prepare feedback mechanism\r\n let totalEstimatedCost = 2 * options.itemIds.length + 1; // solution items, plus avoid divide by 0\r\n let percentDone: number = 16; // allow for previous creation work\r\n let progressPercentStep = (95 - percentDone) / totalEstimatedCost; // leave some % for caller for wrapup\r\n\r\n const failedItemIds: string[] = [];\r\n let totalExpended = 0;\r\n let statusOK = true;\r\n const itemProgressCallback: IItemProgressCallback = (\r\n itemId: string,\r\n status: EItemProgressStatus,\r\n costUsed: number\r\n ) => {\r\n // ---------------------------------------------------------------------------------------------------------------\r\n if (options.itemIds.indexOf(itemId) < 0) {\r\n // New item--a dependency that wasn't in the supplied list of itemIds; add it to the list\r\n // and recalculate the progress percent step based on how much progress remains to be done\r\n options.itemIds.push(itemId);\r\n\r\n totalEstimatedCost += 2;\r\n progressPercentStep =\r\n (95 - percentDone) / (totalEstimatedCost - totalExpended);\r\n }\r\n\r\n totalExpended += costUsed;\r\n percentDone += progressPercentStep * costUsed;\r\n if (options.progressCallback) {\r\n options.progressCallback(Math.round(percentDone), options.jobId);\r\n }\r\n\r\n /* istanbul ignore if */\r\n if (options.consoleProgress) {\r\n console.log(\r\n Date.now(),\r\n itemId,\r\n options.jobId ?? \"\",\r\n SItemProgressStatus[status],\r\n percentDone.toFixed(0) + \"%\",\r\n costUsed\r\n );\r\n }\r\n\r\n if (status === EItemProgressStatus.Failed) {\r\n let error = \"\";\r\n solutionTemplates.some(t => {\r\n /* istanbul ignore else */\r\n if (t.itemId === itemId) {\r\n /* istanbul ignore else */\r\n if (getProp(t, \"properties.error\")) {\r\n error = t.properties.error;\r\n try {\r\n // parse for better console logging if we can\r\n error = JSON.parse(error);\r\n } catch (e) {\r\n /* istanbul ignore next */\r\n // do nothing and show the error as is\r\n }\r\n }\r\n return true;\r\n }\r\n });\r\n removeTemplate(solutionTemplates, itemId);\r\n if (failedItemIds.indexOf(itemId) < 0) {\r\n failedItemIds.push(itemId);\r\n }\r\n statusOK = false;\r\n } else if (status === EItemProgressStatus.Ignored) {\r\n removeTemplate(solutionTemplates, itemId);\r\n }\r\n\r\n return statusOK;\r\n // ---------------------------------------------------------------------------------------------------------------\r\n };\r\n\r\n // Replacement dictionary and created templates\r\n const templateDictionary = options.templateDictionary ?? {};\r\n let solutionTemplates: IItemTemplate[] = [];\r\n\r\n // Handle a list of one or more AGO ids by stepping through the list\r\n // and calling this function recursively\r\n const getItemsPromise: Array<Promise<ISourceFile[]>> = [];\r\n options.itemIds.forEach(itemId => {\r\n const createDef = createItemTemplate(\r\n solutionItemId,\r\n itemId,\r\n templateDictionary,\r\n srcAuthentication,\r\n destAuthentication,\r\n solutionTemplates,\r\n itemProgressCallback\r\n );\r\n getItemsPromise.push(createDef);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all(getItemsPromise).then(\r\n (multipleResourceItemFiles: ISourceFile[][]) => {\r\n if (failedItemIds.length > 0) {\r\n reject(\r\n failWithIds(\r\n failedItemIds,\r\n \"One or more items cannot be converted into templates\"\r\n )\r\n );\r\n } else {\r\n if (solutionTemplates.length > 0) {\r\n // Coalesce the resource file paths from the created templates\r\n let resourceItemFiles: ISourceFile[] = multipleResourceItemFiles.reduce(\r\n (accumulator, currentValue) => accumulator.concat(currentValue),\r\n [] as ISourceFile[]\r\n );\r\n\r\n // test for and update group dependencies and other post-processing\r\n solutionTemplates = _postProcessGroupDependencies(\r\n solutionTemplates\r\n );\r\n solutionTemplates = postProcessWorkforceTemplates(\r\n solutionTemplates\r\n );\r\n\r\n // Filter out any resources from items that have been removed from the templates, such as\r\n // Living Atlas layers\r\n solutionTemplates = _postProcessIgnoredItems(solutionTemplates);\r\n const templateIds = solutionTemplates.map(\r\n template => template.itemId\r\n );\r\n\r\n // Coalesce the resource file paths from the created templates\r\n resourceItemFiles = resourceItemFiles.filter(file =>\r\n templateIds.includes(file.itemId)\r\n );\r\n\r\n // Send the accumulated resources to the solution item\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n copyFilesToStorageItem(\r\n resourceItemFiles,\r\n solutionItemId,\r\n destAuthentication\r\n ).then(() => {\r\n _templatizeSolutionIds(solutionTemplates);\r\n _simplifyUrlsInItemDescriptions(solutionTemplates);\r\n _replaceDictionaryItemsInObject(\r\n templateDictionary,\r\n solutionTemplates\r\n );\r\n _templatizeOrgUrl(solutionTemplates, destAuthentication).then(\r\n solutionTemplates2 => {\r\n // Update solution item with its data JSON\r\n const solutionData: ISolutionItemData = {\r\n metadata: { version: SolutionTemplateFormatVersion },\r\n templates: options.templatizeFields\r\n ? postProcessFieldReferences(solutionTemplates2)\r\n : solutionTemplates2\r\n };\r\n const itemInfo: IItemUpdate = {\r\n id: solutionItemId,\r\n text: solutionData\r\n };\r\n updateItem(itemInfo, destAuthentication).then(() => {\r\n resolve(solutionItemId);\r\n }, reject);\r\n },\r\n reject\r\n );\r\n });\r\n } else {\r\n resolve(solutionItemId);\r\n }\r\n }\r\n }\r\n );\r\n });\r\n}\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Gets the dependencies of an item by merging its dependencies list with item references in template variables.\r\n *\r\n * @param template Template to examine\r\n * @returns List of dependency ids\r\n * @private\r\n */\r\nexport function _getDependencies(template: IItemTemplate): string[] {\r\n // Get all dependencies\r\n let deps = template.dependencies.concat(\r\n _getIdsOutOfTemplateVariables(\r\n _getTemplateVariables(JSON.stringify(template.data))\r\n )\r\n );\r\n\r\n // Remove duplicates and self-references\r\n deps.sort();\r\n deps = deps.filter((elem, index, array) => {\r\n if (elem === template.itemId) {\r\n return false;\r\n } else if (index > 0) {\r\n return elem !== array[index - 1];\r\n } else {\r\n return true;\r\n }\r\n });\r\n\r\n return deps;\r\n}\r\n\r\n/**\r\n * Extracts AGO ids out of template variables.\r\n *\r\n * @param variables List of template variables to examine\r\n * @returns List of AGO ids referenced in `variables`\r\n * @private\r\n */\r\nexport function _getIdsOutOfTemplateVariables(variables: string[]): string[] {\r\n return variables\r\n .map(variable => {\r\n const idList = variable.match(/[0-9A-F]{32}/i); // is it a guid?\r\n if (idList) {\r\n return idList[0];\r\n } else {\r\n return null;\r\n }\r\n })\r\n .filter(variable => !!variable);\r\n}\r\n\r\n/**\r\n * Creates a list of item URLs.\r\n *\r\n * @param templates Templates to check for URLs\r\n * @returns List of URLs\r\n * @private\r\n */\r\nexport function _getSolutionItemUrls(templates: IItemTemplate[]): string[][] {\r\n const solutionUrls: string[][] = [];\r\n templates.forEach(template => {\r\n /* istanbul ignore else */\r\n if (template.item.origUrl) {\r\n solutionUrls.push([template.itemId, template.item.origUrl]);\r\n }\r\n });\r\n return solutionUrls;\r\n}\r\n\r\n/**\r\n * Extracts template variables out of a string.\r\n *\r\n * @param text String to examine\r\n * @returns List of template variables found in string\r\n * @private\r\n */\r\nexport function _getTemplateVariables(text: string): string[] {\r\n return (text.match(/{{[a-z0-9.]*}}/gi) || []) // find variable\r\n .map(variable => variable.substring(2, variable.length - 2)); // remove \"{{\" & \"}}\"\r\n}\r\n\r\n/**\r\n * Update the items dependencies and groups arrays\r\n *\r\n * @param templates The array of templates to evaluate\r\n * @returns Updated version of the templates\r\n * @private\r\n */\r\nexport function _postProcessGroupDependencies(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n return templates.map((template: IItemTemplate) => {\r\n if (template.type === \"Group\") {\r\n const id: string = template.itemId;\r\n // remove group dependencies if we find a circular dependency with one of its items\r\n let removeDependencies: boolean = false;\r\n // before we remove update each dependants groups array\r\n template.dependencies.forEach(dependencyId => {\r\n const dependantTemplate: IItemTemplate = getTemplateById(\r\n templates,\r\n dependencyId\r\n );\r\n // Not all items shared to the group will exist in the templates array\r\n // i.e. Hub Initiative items or any other unsupported types\r\n if (dependantTemplate) {\r\n // check if the group is in the dependantTemplate's list of dependencies\r\n const gIndex = getWithDefault(\r\n dependantTemplate,\r\n \"dependencies\",\r\n []\r\n ).indexOf(id);\r\n\r\n /* istanbul ignore else */\r\n if (gIndex > -1) {\r\n removeDependencies = true;\r\n }\r\n // if the dependant template does not have the group id\r\n // in it's groups array, add it\r\n const groups = getWithDefault(dependantTemplate, \"groups\", []);\r\n if (groups.indexOf(id) === -1) {\r\n groups.push(id);\r\n dependantTemplate.groups = groups;\r\n }\r\n }\r\n });\r\n if (removeDependencies) {\r\n template.dependencies = [];\r\n }\r\n }\r\n return template;\r\n });\r\n}\r\n\r\n/**\r\n * Check for feature service items that have been flagged for invalid designations.\r\n * Remove templates that have invalid designations from the solution item and other item dependencies.\r\n * Clean up any references to items with invalid designations in the other templates.\r\n *\r\n * @param templates The array of templates to evaluate\r\n * @returns Updated version of the templates\r\n * @private\r\n */\r\nexport function _postProcessIgnoredItems(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n // replace in template\r\n const updateDictionary: any = templates.reduce((result, template) => {\r\n return template.properties.hasInvalidDesignations\r\n ? Object.assign(result, template.data)\r\n : result;\r\n }, {});\r\n Object.keys(updateDictionary).forEach(k => {\r\n removeTemplate(templates, k);\r\n templates = templates.map(t => {\r\n t.dependencies = t.dependencies.filter(id => id !== k);\r\n return replaceInTemplate(t, updateDictionary);\r\n });\r\n });\r\n\r\n return templates;\r\n}\r\n\r\n/**\r\n * Recursively runs through an object to find and replace any strings found in a dictionary.\r\n *\r\n * @param templateDictionary Hash of things to be replaced\r\n * @param obj Object to be examined\r\n * @private\r\n */\r\nexport function _replaceDictionaryItemsInObject(hash: any, obj: any): any {\r\n /* istanbul ignore else */\r\n if (obj) {\r\n Object.keys(obj).forEach(prop => {\r\n const propObj = obj[prop];\r\n if (propObj) {\r\n if (typeof propObj === \"object\") {\r\n _replaceDictionaryItemsInObject(hash, propObj);\r\n } else if (typeof propObj === \"string\") {\r\n obj[prop] = hash[propObj] || propObj;\r\n }\r\n }\r\n });\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Recursively runs through an object to find and templatize any remaining references to solution's items.\r\n *\r\n * @param ids Ids to be replaced in strings found in object\r\n * @param obj Object to be examined\r\n * @private\r\n */\r\nexport function _replaceRemainingIdsInObject(ids: string[], obj: any): any {\r\n /* istanbul ignore else */\r\n if (obj) {\r\n Object.keys(obj).forEach(prop => {\r\n const propObj = obj[prop];\r\n if (propObj) {\r\n if (typeof propObj === \"object\") {\r\n _replaceRemainingIdsInObject(ids, propObj);\r\n } else if (typeof propObj === \"string\") {\r\n obj[prop] = _replaceRemainingIdsInString(ids, propObj);\r\n }\r\n }\r\n });\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Templatizes ids from a list in a string if they're not already templatized.\r\n *\r\n * @param ids Ids to be replaced in source string\r\n * @param str Source string to be examined\r\n * @returns A copy of the source string with any templatization changes\r\n * @private\r\n */\r\nexport function _replaceRemainingIdsInString(\r\n ids: string[],\r\n str: string\r\n): string {\r\n let updatedStr = str;\r\n const untemplatizedIds = getIDs(str);\r\n if (untemplatizedIds.length > 0) {\r\n untemplatizedIds.forEach(id => {\r\n if (ids.includes(id)) {\r\n const re = new RegExp(\"({*)\" + id, \"gi\");\r\n updatedStr = updatedStr.replace(re, match =>\r\n match.indexOf(\"{{\") < 0\r\n ? \"{{\" + id.replace(\"{\", \"\") + \".itemId}}\"\r\n : match\r\n );\r\n }\r\n });\r\n }\r\n return updatedStr;\r\n}\r\n\r\n/**\r\n * Finds and templatizes any URLs in solution items' descriptions.\r\n *\r\n * @param templates The array of templates to evaluate, modified in place\r\n * @private\r\n */\r\nexport function _simplifyUrlsInItemDescriptions(\r\n templates: IItemTemplate[]\r\n): void {\r\n // Get the urls in the solution along with their item ids & convert the id into the form\r\n // \"{{fcb2bf2837a6404ebb418a1f805f976a.url}}\"\r\n const solutionUrls = _getSolutionItemUrls(templates).map(idUrl => [\r\n \"{{\" + idUrl[0] + \".url}}\",\r\n idUrl[1]\r\n ]);\r\n\r\n /* istanbul ignore else */\r\n if (solutionUrls.length > 0) {\r\n // Make the replacements\r\n templates.forEach(template => {\r\n solutionUrls.forEach(\r\n // TypeScript for es2015 doesn't have a definition for `replaceAll`\r\n idUrl => {\r\n /* istanbul ignore else */\r\n if (template.item.description) {\r\n template.item.description = (template.item\r\n .description as any).replaceAll(idUrl[1], idUrl[0]);\r\n }\r\n }\r\n );\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Templatizes occurrences of the URL to the user's organization in the `item` and `data` template sections.\r\n *\r\n * @param templates The array of templates to evaluate; templates is modified in place\r\n * @param destAuthentication Credentials for request organization info\r\n * @returns Promise resolving with `templates`\r\n * @private\r\n */\r\nexport function _templatizeOrgUrl(\r\n templates: IItemTemplate[],\r\n destAuthentication: UserSession\r\n): Promise<IItemTemplate[]> {\r\n return new Promise((resolve, reject) => {\r\n // Get the org's URL\r\n getPortal(null, destAuthentication).then(org => {\r\n const orgUrl = \"https://\" + org.urlKey + \".\" + org.customBaseUrl;\r\n const templatizedOrgUrl = \"{{portalBaseUrl}}\";\r\n\r\n // Cycle through each of the items in the template and scan the `item` and `data` sections of each for replacements\r\n templates.forEach((template: IItemTemplate) => {\r\n globalStringReplace(\r\n template.item,\r\n new RegExp(orgUrl, \"gi\"),\r\n templatizedOrgUrl\r\n );\r\n globalStringReplace(\r\n template.data,\r\n new RegExp(orgUrl, \"gi\"),\r\n templatizedOrgUrl\r\n );\r\n });\r\n resolve(templates);\r\n }, reject);\r\n });\r\n}\r\n\r\n/**\r\n * Finds and templatizes any references to solution's items.\r\n *\r\n * @param templates The array of templates to evaluate, modified in place\r\n * @private\r\n */\r\nexport function _templatizeSolutionIds(templates: IItemTemplate[]): void {\r\n // Get the ids in the solution\r\n const solutionIds: string[] = templates.map(\r\n (template: IItemTemplate) => template.itemId\r\n );\r\n\r\n // Cycle through each of the items in the template and\r\n // 1. templatize untemplatized ids in our solution in the `item` and `data` sections;\r\n // 2. update the `dependencies` section\r\n templates.forEach((template: IItemTemplate) => {\r\n _replaceRemainingIdsInObject(solutionIds, template.item);\r\n _replaceRemainingIdsInObject(solutionIds, template.data);\r\n /* istanbul ignore else */\r\n if (template.type !== \"Group\" && !isWorkforceProject(template)) {\r\n template.dependencies = _getDependencies(template);\r\n }\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation of a Solution item.\r\n *\r\n * @module creator\r\n */\r\n\r\nimport {\r\n appendQueryParam,\r\n createItemWithData,\r\n createLongId,\r\n createShortId,\r\n CURRENT_SCHEMA_VERSION,\r\n generateSourceThumbnailUrl,\r\n getBlobAsFile,\r\n getFilenameFromUrl,\r\n getGroupBase,\r\n getGroupContents,\r\n getItemBase,\r\n getPortal,\r\n getUser,\r\n getVelocityUrlBase,\r\n ICreateSolutionOptions,\r\n ISolutionItemData,\r\n IGroup,\r\n IItem,\r\n removeItem,\r\n sanitizeJSONAndReportChanges,\r\n setLocationTrackingEnabled,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { failSafe, IModel } from \"@esri/hub-common\";\r\nimport { addContentToSolution } from \"./helpers/add-content-to-solution\";\r\n\r\n// Simple no-op to clean up progressCallback management\r\nconst noOp = () => {};\r\n\r\n/**\r\n * Creates a solution item.\r\n *\r\n * @param sourceId AGO id of group whose contents are to be added to solution or of an item to convert into a solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @param options Customizations for creating the solution\r\n * @returns A promise that resolves with the AGO id of the new solution\r\n */\r\nexport function createSolution(\r\n sourceId: string,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession,\r\n options?: ICreateSolutionOptions\r\n): Promise<string> {\r\n const createOptions: ICreateSolutionOptions = options || {};\r\n const progressCb = createOptions.progressCallback || noOp;\r\n createOptions.templateDictionary = Object.assign(\r\n {},\r\n createOptions.templateDictionary\r\n );\r\n\r\n progressCb(1); // let the caller know that we've started\r\n\r\n // Assume that source is a group and try to get group's information\r\n return Promise.all([\r\n getGroupBase(sourceId, srcAuthentication),\r\n getGroupContents(sourceId, srcAuthentication),\r\n getVelocityUrlBase(srcAuthentication, createOptions.templateDictionary)\r\n ])\r\n .then(\r\n // Group fetches worked; assumption was correct\r\n responses => {\r\n createOptions.itemIds = responses[1];\r\n progressCb(15);\r\n\r\n return new Promise<ICreateSolutionOptions>(resolve => {\r\n // Update the createOptions with values from the group\r\n resolve(\r\n _applySourceToCreateOptions(\r\n createOptions,\r\n responses[0],\r\n srcAuthentication,\r\n true\r\n )\r\n );\r\n });\r\n },\r\n\r\n // Assumption incorrect; try source as an item\r\n () => {\r\n return new Promise<ICreateSolutionOptions>((resolve, reject) => {\r\n createOptions.itemIds = [sourceId];\r\n getItemBase(sourceId, srcAuthentication).then(\r\n // Update the createOptions with values from the item\r\n itemBase =>\r\n resolve(\r\n _applySourceToCreateOptions(\r\n createOptions,\r\n itemBase,\r\n srcAuthentication,\r\n false\r\n )\r\n ),\r\n reject\r\n );\r\n });\r\n }\r\n )\r\n\r\n .then(createOptions => {\r\n return new Promise<ICreateSolutionOptions>((resolve, reject) => {\r\n Promise.all([\r\n getPortal(\"\", srcAuthentication),\r\n getUser(srcAuthentication)\r\n ]).then(responses => {\r\n // check tracking\r\n const [portalResponse, userResponse] = responses;\r\n setLocationTrackingEnabled(\r\n portalResponse,\r\n userResponse,\r\n createOptions.templateDictionary\r\n );\r\n resolve(createOptions);\r\n }, reject);\r\n });\r\n })\r\n\r\n .then(\r\n // Use a copy of the thumbnail rather than a URL to it\r\n createOptions => {\r\n return _addThumbnailFileToCreateOptions(\r\n createOptions,\r\n srcAuthentication\r\n );\r\n }\r\n )\r\n\r\n .then(\r\n // Create a solution\r\n createOptions => {\r\n return _createSolutionFromItemIds(\r\n createOptions,\r\n srcAuthentication,\r\n destAuthentication\r\n );\r\n }\r\n )\r\n\r\n .then(\r\n // Successfully created solution\r\n createdSolutionId => {\r\n progressCb(100); // finished\r\n return createdSolutionId;\r\n },\r\n\r\n // Error fetching group, group contents, or item, or error creating solution from ids\r\n error => {\r\n progressCb(1);\r\n console.error(error);\r\n throw error;\r\n }\r\n );\r\n}\r\n\r\n/**\r\n * Update the createOptions with the group properties\r\n *\r\n * @param createOptions\r\n * @param sourceInfo\r\n * @param authentication\r\n * @param isGroup Boolean to indicate if the files are associated with a group or item\r\n * @private\r\n */\r\nexport function _applySourceToCreateOptions(\r\n createOptions: ICreateSolutionOptions,\r\n sourceInfo: IGroup | IItem,\r\n srcAuthentication: UserSession,\r\n isGroup = false\r\n): ICreateSolutionOptions {\r\n // Create a solution from the group's or item's contents,\r\n // using the group's or item's information as defaults for the solution item\r\n [\"title\", \"snippet\", \"description\", \"tags\"].forEach(prop => {\r\n createOptions[prop] = createOptions[prop] ?? sourceInfo[prop];\r\n });\r\n\r\n if (!createOptions.thumbnailurl && sourceInfo.thumbnail) {\r\n // Get the full path to the thumbnail\r\n createOptions.thumbnailurl = generateSourceThumbnailUrl(\r\n srcAuthentication.portal,\r\n sourceInfo.id,\r\n sourceInfo.thumbnail,\r\n isGroup\r\n );\r\n delete sourceInfo.thumbnail;\r\n }\r\n\r\n return createOptions;\r\n}\r\n\r\n/**\r\n * Update the createOptions with the thumbnail file\r\n *\r\n * @param createOptions\r\n * @param srcAuthentication\r\n * @private\r\n */\r\nexport function _addThumbnailFileToCreateOptions(\r\n createOptions: ICreateSolutionOptions,\r\n srcAuthentication: UserSession\r\n): Promise<ICreateSolutionOptions> {\r\n return new Promise<ICreateSolutionOptions>(resolve => {\r\n if (!createOptions.thumbnail && createOptions.thumbnailurl) {\r\n // Figure out the thumbnail's filename\r\n const filename =\r\n getFilenameFromUrl(createOptions.thumbnailurl) || \"thumbnail\";\r\n const thumbnailurl = appendQueryParam(\r\n createOptions.thumbnailurl,\r\n \"w=400\"\r\n );\r\n delete createOptions.thumbnailurl;\r\n\r\n // Fetch the thumbnail\r\n getBlobAsFile(thumbnailurl, filename, srcAuthentication).then(\r\n thumbnail => {\r\n createOptions.thumbnail = thumbnail;\r\n resolve(createOptions);\r\n },\r\n () => {\r\n resolve(createOptions);\r\n }\r\n );\r\n } else {\r\n resolve(createOptions);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Creates a solution item using a list of AGO item ids.\r\n *\r\n * @param options Customizations for creating the solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its\r\n * there is a problem updating it\r\n * @private\r\n */\r\nexport function _createSolutionFromItemIds(\r\n options: ICreateSolutionOptions,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession\r\n): Promise<string> {\r\n let solutionId = \"\";\r\n // Create a solution from the list of items\r\n return _createSolutionItem(destAuthentication, options)\r\n .then(id => {\r\n solutionId = id;\r\n // Add list of items to the new solution\r\n return addContentToSolution(\r\n solutionId,\r\n options,\r\n srcAuthentication,\r\n destAuthentication\r\n );\r\n })\r\n .catch(addError => {\r\n // If the solution item got created, delete it\r\n if (solutionId) {\r\n const failSafeRemove = failSafe(removeItem, { success: true });\r\n return failSafeRemove(solutionId, destAuthentication).then(() => {\r\n throw addError;\r\n });\r\n } else {\r\n throw addError;\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Creates an empty solution item.\r\n *\r\n * @param authentication Credentials for the request\r\n * @param options Customizations for creating the solution\r\n * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its\r\n * there is a problem updating its thumbnail\r\n * @private\r\n */\r\nexport function _createSolutionItem(\r\n authentication: UserSession,\r\n options?: ICreateSolutionOptions\r\n): Promise<string> {\r\n const model = _createSolutionItemModel(options);\r\n\r\n // Create new solution item\r\n delete model.item.thumbnailurl;\r\n model.item.thumbnail = options?.thumbnail;\r\n return createItemWithData(\r\n model.item,\r\n model.data,\r\n authentication,\r\n options?.folderId\r\n ).then(createResponse => {\r\n return Promise.resolve(createResponse.id);\r\n });\r\n}\r\n\r\n/**\r\n * Create the Solution Item model to be used to create\r\n * the Solution Item itself\r\n *\r\n * @param options\r\n * @private\r\n */\r\nexport function _createSolutionItemModel(options: any): IModel {\r\n // Solution uses all supplied tags but for deploy.* tags; that information goes into properties\r\n const creationTags = options?.tags ?? [];\r\n\r\n const solutionItem: any = {\r\n type: \"Solution\",\r\n title: options?.title ?? createShortId(),\r\n snippet: options?.snippet ?? \"\",\r\n description: options?.description ?? \"\",\r\n properties: {\r\n schemaVersion: CURRENT_SCHEMA_VERSION\r\n },\r\n thumbnailurl: options?.thumbnailurl ?? \"\",\r\n tags: creationTags.filter((tag: any) => !tag.startsWith(\"deploy.\")),\r\n typeKeywords: [\"Solution\", \"Template\"].concat(\r\n _getDeploymentProperties(creationTags)\r\n )\r\n };\r\n\r\n // ensure that snippet and description are not nefarious\r\n const sanitizedItem = sanitizeJSONAndReportChanges(solutionItem);\r\n\r\n const addlKeywords = options?.additionalTypeKeywords || [];\r\n sanitizedItem.typeKeywords = [].concat(\r\n solutionItem.typeKeywords,\r\n addlKeywords\r\n );\r\n\r\n const solutionData: ISolutionItemData = {\r\n metadata: {},\r\n templates: []\r\n };\r\n return {\r\n item: sanitizedItem,\r\n data: solutionData\r\n };\r\n}\r\n\r\n/**\r\n * Gets the deploy.id and deploy.version tag values.\r\n *\r\n * @param tags A list of item tags\r\n * @returns A list containing the two values found in the tags, or defaulting to a new GUID and \"1.0\", respectively,\r\n * as needed\r\n * @private\r\n */\r\nexport function _getDeploymentProperties(tags: string[]): string[] {\r\n return [\r\n \"solutionid-\" +\r\n (_getDeploymentProperty(\"deploy.id.\", tags) ?? createLongId()),\r\n \"solutionversion-\" +\r\n (_getDeploymentProperty(\"deploy.version.\", tags) ?? \"1.0\")\r\n ];\r\n}\r\n\r\n/**\r\n * Searches for a tag that has the specified prefix and returns the rest of the tag following that prefix.\r\n *\r\n * @param desiredTagPrefix Tag prefix to look for\r\n * @param tags A list of item tags\r\n * @returns The extracted value of the first matching tag or null if a tag with the specified prefix is not found\r\n * @private\r\n */\r\nexport function _getDeploymentProperty(\r\n desiredTagPrefix: string,\r\n tags: string[]\r\n): string | null {\r\n const foundTagAsList = tags.filter(tag => tag.startsWith(desiredTagPrefix));\r\n if (foundTagAsList.length > 0) {\r\n return foundTagAsList[0].substr(desiredTagPrefix.length);\r\n } else {\r\n return null;\r\n }\r\n}\r\n"],"names":["group","VelocityProcessor","simpleTypes","featureLayer","formProcessor","HubPageProcessor","HubSiteProcessor","notebookProcessor","quickcaptureProcessor","StoryMapProcessor","WebExperienceProcessor","fileProcessor","findTemplateInList","createPlaceholderTemplate","EItemProgressStatus","getItemBase","replaceTemplate","getGroupBase","sanitizeJSONAndReportChanges","fail","getItemResourcesPaths","SolutionTemplateFormatVersion","getItemResourcesFilesFromPaths","getProp","hasDatasource","cleanLayerBasedItemId","SItemProgressStatus","removeTemplate","failWithIds","postProcessWorkforceTemplates","copyFilesToStorageItem","updateItem","getTemplateById","getWithDefault","replaceInTemplate","getIDs","getPortal","globalStringReplace","isWorkforceProject","getGroupContents","getVelocityUrlBase","getUser","setLocationTrackingEnabled","generateSourceThumbnailUrl","getFilenameFromUrl","appendQueryParam","getBlobAsFile","failSafe","removeItem","createItemWithData","createShortId","CURRENT_SCHEMA_VERSION","createLongId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;EAcG;AAiBI,QAAM,WAAW,GAAkB,KAAK;EAE/C;;;;EAIG;AACU,QAAA,SAAS,GAAuB;;;EAG3C,IAAA,KAAK,EAAEA,gBAAK;;;EAIZ,IAAA,mBAAmB,EAAEC,kCAAiB;EACtC,IAAA,oBAAoB,EAAEC,+BAAW;EACjC,IAAA,iBAAiB,EAAEC,uBAAY;EAC/B,IAAA,IAAI,EAAEF,kCAAiB;EACvB,IAAA,mBAAmB,EAAE,SAAS;EAC9B,IAAA,iBAAiB,EAAE,SAAS;EAC5B,IAAA,kBAAkB,EAAE,SAAS;EAC7B,IAAA,uBAAuB,EAAE,SAAS;EAClC,IAAA,eAAe,EAAE,SAAS;EAC1B,IAAA,eAAe,EAAE,SAAS;EAC1B,IAAA,GAAG,EAAE,SAAS;EACd,IAAA,aAAa,EAAEE,uBAAY;EAC3B,IAAA,0BAA0B,EAAE,SAAS;EACrC,IAAA,oBAAoB,EAAEF,kCAAiB;EACvC,IAAA,gCAAgC,EAAE,SAAS;EAC3C,IAAA,eAAe,EAAE,SAAS;EAC1B,IAAA,gBAAgB,EAAE,SAAS;EAC3B,IAAA,IAAI,EAAE,SAAS;EACf,IAAA,qBAAqB,EAAE,SAAS;EAChC,IAAA,GAAG,EA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G,IAAI,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;EAC5E,IAAA,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;UAC7B,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;EAC1D,KAAA;EAAM,SAAA;EACL,QAAA,OAAO,IAAI,CAAC;EACb,KAAA;EACH;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"creator.umd.js","sources":["../../src/module-map.ts","../../src/createItemTemplate.ts","../../src/helpers/add-content-to-solution.ts","../../src/creator.ts"],"sourcesContent":["/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { moduleHandler, IItemTypeModuleMap } from \"@esri/solution-common\";\r\nimport * as featureLayer from \"@esri/solution-feature-layer\";\r\nimport * as fileProcessor from \"@esri/solution-file\";\r\nimport * as formProcessor from \"@esri/solution-form\";\r\nimport * as group from \"@esri/solution-group\";\r\nimport {\r\n simpleTypes,\r\n notebookProcessor,\r\n quickcaptureProcessor\r\n} from \"@esri/solution-simple-types\";\r\nimport { StoryMapProcessor } from \"@esri/solution-storymap\";\r\nimport { VelocityProcessor } from \"@esri/solution-velocity\";\r\nimport { WebExperienceProcessor } from \"@esri/solution-web-experience\";\r\nimport { HubPageProcessor, HubSiteProcessor } from \"@esri/solution-hub-types\";\r\n\r\nexport const UNSUPPORTED: moduleHandler = null;\r\n\r\n/**\r\n * Mapping from item type to module with type-specific template-handling code.\r\n * AGO types come from a blend of arcgis-portal-app\\src\\js\\arcgisonline\\pages\\item\\_Info.js and\r\n * arcgis-portal-app\\src\\js\\arcgis-components\\src\\_utils\\metadata\\item\\displayName.ts\r\n */\r\nexport const moduleMap: IItemTypeModuleMap = {\r\n ////////////////////////////////////////////////////////\r\n // Group type\r\n Group: group,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Layer types\r\n \"Big Data Analytic\": VelocityProcessor,\r\n \"Feature Collection\": simpleTypes,\r\n \"Feature Service\": featureLayer,\r\n Feed: VelocityProcessor,\r\n \"Geocoding Service\": undefined,\r\n \"Geodata Service\": undefined,\r\n \"Geometry Service\": undefined,\r\n \"Geoprocessing Service\": undefined,\r\n \"Globe Service\": undefined,\r\n \"Image Service\": undefined,\r\n KML: undefined,\r\n \"Map Service\": featureLayer,\r\n \"Network Analysis Service\": undefined,\r\n \"Real Time Analytic\": VelocityProcessor,\r\n \"Relational Database Connection\": undefined,\r\n \"Scene Service\": undefined,\r\n \"Stream Service\": undefined,\r\n Tool: undefined,\r\n \"Vector Tile Service\": undefined,\r\n WFS: undefined,\r\n WMS: undefined,\r\n WMTS: undefined,\r\n \"Workflow Manager Service\": undefined,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Map types\r\n \"3D Web Scene\": undefined,\r\n \"Web Map\": simpleTypes,\r\n \"Web Scene\": simpleTypes,\r\n\r\n ////////////////////////////////////////////////////////\r\n // App types\r\n Application: undefined,\r\n Dashboard: simpleTypes,\r\n \"Data Store\": undefined,\r\n \"Desktop Application\": undefined,\r\n \"Excalibur Imagery Project\": undefined,\r\n Form: formProcessor,\r\n \"Hub Initiative\": UNSUPPORTED,\r\n \"Hub Page\": HubPageProcessor,\r\n \"Hub Site Application\": HubSiteProcessor,\r\n \"Insights Model\": simpleTypes,\r\n \"Insights Page\": undefined,\r\n \"Insights Theme\": undefined,\r\n \"Insights Workbook\": undefined,\r\n Mission: undefined,\r\n \"Mobile Application\": undefined,\r\n Notebook: notebookProcessor,\r\n \"Oriented Imagery Catalog\": simpleTypes,\r\n \"Ortho Mapping Project\": undefined,\r\n \"QuickCapture Project\": quickcaptureProcessor,\r\n \"Site Application\": HubSiteProcessor,\r\n \"Site Page\": HubPageProcessor,\r\n Solution: UNSUPPORTED,\r\n StoryMap: StoryMapProcessor,\r\n \"Urban Model\": undefined,\r\n \"Web Experience Template\": undefined,\r\n \"Web Experience\": WebExperienceProcessor,\r\n \"Web Mapping Application\": simpleTypes,\r\n \"Workforce Project\": simpleTypes,\r\n\r\n ////////////////////////////////////////////////////////\r\n // File types\r\n \"360 VR Experience\": fileProcessor,\r\n \"AppBuilder Extension\": fileProcessor,\r\n \"AppBuilder Widget Package\": fileProcessor,\r\n \"Application Configuration\": fileProcessor,\r\n \"ArcGIS Pro Add In\": fileProcessor,\r\n \"ArcGIS Pro Configuration\": fileProcessor,\r\n \"ArcPad Package\": fileProcessor,\r\n \"Basemap Package\": fileProcessor,\r\n \"CAD Drawing\": fileProcessor,\r\n \"CityEngine Web Scene\": fileProcessor,\r\n \"Code Attachment\": UNSUPPORTED,\r\n \"Code Sample\": fileProcessor,\r\n \"Color Set\": fileProcessor,\r\n \"Compact Tile Package\": fileProcessor,\r\n \"CSV Collection\": fileProcessor,\r\n CSV: fileProcessor,\r\n \"Deep Learning Package\": fileProcessor,\r\n \"Desktop Add In\": fileProcessor,\r\n \"Desktop Application Template\": fileProcessor,\r\n \"Desktop Style\": fileProcessor,\r\n \"Document Link\": fileProcessor,\r\n \"Explorer Add In\": fileProcessor,\r\n \"Explorer Layer\": fileProcessor,\r\n \"Explorer Map\": fileProcessor,\r\n \"Feature Collection Template\": fileProcessor,\r\n \"File Geodatabase\": fileProcessor,\r\n GeoJson: fileProcessor,\r\n GeoPackage: fileProcessor,\r\n \"Geoprocessing Package\": fileProcessor,\r\n \"Geoprocessing Sample\": fileProcessor,\r\n \"Globe Document\": fileProcessor,\r\n \"Image Collection\": fileProcessor,\r\n Image: fileProcessor,\r\n \"iWork Keynote\": fileProcessor,\r\n \"iWork Numbers\": fileProcessor,\r\n \"iWork Pages\": fileProcessor,\r\n \"KML Collection\": fileProcessor,\r\n \"Layer Package\": fileProcessor,\r\n \"Layer Template\": fileProcessor,\r\n Layer: fileProcessor,\r\n Layout: fileProcessor,\r\n \"Locator Package\": fileProcessor,\r\n \"Map Document\": fileProcessor,\r\n \"Map Package\": fileProcessor,\r\n \"Map Template\": fileProcessor,\r\n \"Microsoft Excel\": fileProcessor,\r\n \"Microsoft Powerpoint\": fileProcessor,\r\n \"Microsoft Word\": fileProcessor,\r\n \"Mobile Basemap Package\": fileProcessor,\r\n \"Mobile Map Package\": fileProcessor,\r\n \"Mobile Scene Package\": fileProcessor,\r\n \"Native Application\": fileProcessor,\r\n \"Native Application Installer\": fileProcessor,\r\n \"Native Application Template\": fileProcessor,\r\n netCDF: fileProcessor,\r\n \"Operation View\": fileProcessor,\r\n \"Operations Dashboard Add In\": fileProcessor,\r\n \"Operations Dashboard Extension\": fileProcessor,\r\n PDF: fileProcessor,\r\n \"Pro Layer Package\": fileProcessor,\r\n \"Pro Layer\": fileProcessor,\r\n \"Pro Map Package\": fileProcessor,\r\n \"Pro Map\": fileProcessor,\r\n \"Pro Report\": fileProcessor,\r\n \"Project Package\": fileProcessor,\r\n \"Project Template\": fileProcessor,\r\n \"Published Map\": fileProcessor,\r\n \"Raster function template\": fileProcessor,\r\n \"Report Template\": fileProcessor,\r\n \"Rule Package\": fileProcessor,\r\n \"Scene Document\": fileProcessor,\r\n \"Scene Package\": fileProcessor,\r\n \"Service Definition\": fileProcessor,\r\n Shapefile: fileProcessor,\r\n \"Statistical Data Collection\": fileProcessor,\r\n Style: fileProcessor,\r\n \"Survey123 Add In\": fileProcessor,\r\n \"Symbol Set\": fileProcessor,\r\n \"Task File\": fileProcessor,\r\n \"Tile Package\": fileProcessor,\r\n \"Toolbox Package\": fileProcessor,\r\n \"Vector Tile Package\": fileProcessor,\r\n \"Viewer Configuration\": fileProcessor,\r\n \"Visio Document\": fileProcessor,\r\n \"Window Mobile Package\": fileProcessor,\r\n \"Windows Mobile Package\": fileProcessor,\r\n \"Windows Viewer Add In\": fileProcessor,\r\n \"Windows Viewer Configuration\": fileProcessor,\r\n \"Workflow Manager Package\": fileProcessor,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Testing \"types\"\r\n Undefined: undefined,\r\n Unsupported: UNSUPPORTED\r\n};\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages creation of the template of a Solution item via the REST API.\r\n *\r\n * @module createItemTemplate\r\n */\r\n\r\nimport {\r\n cleanLayerBasedItemId,\r\n createPlaceholderTemplate,\r\n EItemProgressStatus,\r\n SolutionTemplateFormatVersion,\r\n findTemplateInList,\r\n getGroupBase,\r\n getItemBase,\r\n hasDatasource,\r\n IDatasourceInfo,\r\n IItemGeneralized,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n ISourceFile,\r\n ISourceFileCopyPath,\r\n getItemResourcesFilesFromPaths,\r\n getItemResourcesPaths,\r\n replaceTemplate,\r\n sanitizeJSONAndReportChanges,\r\n fail,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { getProp } from \"@esri/hub-common\";\r\nimport { moduleMap, UNSUPPORTED } from \"./module-map\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Creates template for an AGO item and its dependencies\r\n *\r\n * @param solutionItemId The solution to contain the item\r\n * @param itemId AGO id string\r\n * @param templateDictionary Hash of facts\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Authentication for requesting information from AGO about items to be included in solution item\r\n * @param existingTemplates A collection of AGO item templates that can be referenced by newly-created templates\r\n * @returns A promise which resolves with an array of resources for the item and its dependencies\r\n * @private\r\n */\r\nexport function createItemTemplate(\r\n solutionItemId: string,\r\n itemId: string,\r\n templateDictionary: any,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession,\r\n existingTemplates: IItemTemplate[],\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ISourceFile[]> {\r\n return new Promise(resolve => {\r\n // Check if item and its dependents are already in list or are queued\r\n if (findTemplateInList(existingTemplates, itemId)) {\r\n resolve([]);\r\n } else {\r\n // Add the id as a placeholder to show that it is being fetched\r\n existingTemplates.push(createPlaceholderTemplate(itemId));\r\n\r\n itemProgressCallback(itemId, EItemProgressStatus.Started, 0);\r\n\r\n // Fetch the item\r\n getItemBase(itemId, srcAuthentication)\r\n .catch(() => {\r\n // If item query fails, try fetching item as a group\r\n // Change its placeholder from an empty type to the Group type so that we can later distinguish\r\n // between items and groups (the base info for a group doesn't include a type property)\r\n replaceTemplate(\r\n existingTemplates,\r\n itemId,\r\n createPlaceholderTemplate(itemId, \"Group\")\r\n );\r\n return getGroupBase(itemId, srcAuthentication);\r\n })\r\n .then(\r\n itemInfo => {\r\n itemInfo = sanitizeJSONAndReportChanges(itemInfo);\r\n\r\n // Save the URL as a symbol\r\n if (itemInfo.url) {\r\n templateDictionary[itemInfo.url] = \"{{\" + itemInfo.id + \".url}}\";\r\n itemInfo.origUrl = itemInfo.url;\r\n }\r\n\r\n const idTest: RegExp = /^source-[0-9A-F]{32}/i;\r\n // Remove any source-itemId type keywords\r\n /* istanbul ignore else */\r\n if (Array.isArray(itemInfo.typeKeywords)) {\r\n itemInfo.typeKeywords = itemInfo.typeKeywords.filter(v =>\r\n idTest.test(v) ? false : true\r\n );\r\n }\r\n // Remove any source-itemId tags\r\n /* istanbul ignore else */\r\n if (Array.isArray(itemInfo.tags)) {\r\n itemInfo.tags = itemInfo.tags.filter(v =>\r\n idTest.test(v) ? false : true\r\n );\r\n }\r\n\r\n const placeholder = findTemplateInList(existingTemplates, itemId);\r\n let itemType = placeholder.type;\r\n if (!itemType) {\r\n // Groups have this defined when their placeholder is created\r\n itemType = itemInfo.type;\r\n placeholder.type = itemType;\r\n }\r\n if (!itemInfo.type) {\r\n itemInfo.type = itemType; // Groups don't have this property, so we'll patch it in\r\n }\r\n placeholder.item = {\r\n ...itemInfo\r\n } as IItemGeneralized;\r\n\r\n // Interrupt process if progress callback returns `false`\r\n if (!itemProgressCallback(itemId, EItemProgressStatus.Created, 1)) {\r\n itemProgressCallback(itemId, EItemProgressStatus.Cancelled, 1);\r\n resolve(fail(\"Cancelled\"));\r\n return;\r\n }\r\n\r\n const itemHandler = moduleMap[itemType];\r\n if (!itemHandler || itemHandler === UNSUPPORTED) {\r\n if (itemHandler === UNSUPPORTED) {\r\n itemProgressCallback(itemId, EItemProgressStatus.Ignored, 1);\r\n resolve([]);\r\n } else {\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n placeholder.properties[\"failed\"] = true;\r\n replaceTemplate(existingTemplates, itemId, placeholder);\r\n resolve(\r\n fail(\r\n \"The type of AGO item \" +\r\n itemId +\r\n \" ('\" +\r\n itemType +\r\n \"') is not supported at this time\"\r\n )\r\n );\r\n }\r\n } else {\r\n // Handle original Story Maps with next-gen Story Maps\r\n /* istanbul ignore else */\r\n /* Not yet supported\r\n if (storyMap.isAStoryMap(itemType, itemInfo.url)) {\r\n itemHandler = storyMap;\r\n } */\r\n\r\n // Delegate the creation of the item to the handler\r\n itemHandler\r\n .convertItemToTemplate(\r\n solutionItemId,\r\n itemInfo,\r\n destAuthentication,\r\n srcAuthentication,\r\n templateDictionary\r\n )\r\n .then(\r\n itemTemplate => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n getItemResourcesPaths(\r\n itemTemplate,\r\n solutionItemId,\r\n srcAuthentication,\r\n SolutionTemplateFormatVersion\r\n ).then((resourceItemFilePaths: ISourceFileCopyPath[]) => {\r\n itemTemplate.item.thumbnail = null; // not needed in this property; handled as a resource\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n getItemResourcesFilesFromPaths(\r\n resourceItemFilePaths,\r\n srcAuthentication\r\n ).then((resourceItemFiles: ISourceFile[]) => {\r\n // update the template's resources\r\n itemTemplate.resources = itemTemplate.resources.concat(\r\n resourceItemFiles.map(\r\n (file: ISourceFile) =>\r\n file.folder + \"/\" + file.filename\r\n )\r\n );\r\n\r\n // Set the value keyed by the id to the created template, replacing the placeholder template\r\n replaceTemplate(\r\n existingTemplates,\r\n itemTemplate.itemId,\r\n itemTemplate\r\n );\r\n\r\n // Trace item dependencies\r\n if (itemTemplate.dependencies.length === 0) {\r\n itemProgressCallback(\r\n itemId,\r\n EItemProgressStatus.Finished,\r\n 1\r\n );\r\n resolve(resourceItemFiles);\r\n } else {\r\n // Get its dependencies, asking each to get its dependents via\r\n // recursive calls to this function\r\n const dependentDfds: Array<Promise<\r\n ISourceFile[]\r\n >> = [];\r\n itemTemplate.dependencies.forEach(dependentId => {\r\n if (\r\n !findTemplateInList(\r\n existingTemplates,\r\n dependentId\r\n )\r\n ) {\r\n dependentDfds.push(\r\n createItemTemplate(\r\n solutionItemId,\r\n dependentId,\r\n templateDictionary,\r\n srcAuthentication,\r\n destAuthentication,\r\n existingTemplates,\r\n itemProgressCallback\r\n )\r\n );\r\n }\r\n });\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all(dependentDfds).then(\r\n (dependentResourceItemFiles: ISourceFile[][]) => {\r\n // Templatization of item and its dependencies done\r\n itemProgressCallback(\r\n itemId,\r\n EItemProgressStatus.Finished,\r\n 1\r\n );\r\n resourceItemFiles = dependentResourceItemFiles.reduce(\r\n (accumulator, currentValue) =>\r\n accumulator.concat(currentValue),\r\n resourceItemFiles\r\n );\r\n resolve(resourceItemFiles);\r\n }\r\n );\r\n }\r\n });\r\n });\r\n },\r\n error => {\r\n placeholder.properties[\"error\"] = JSON.stringify(error);\r\n replaceTemplate(existingTemplates, itemId, placeholder);\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n resolve([]);\r\n }\r\n );\r\n }\r\n },\r\n // Id not found or item is not accessible\r\n () => {\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n resolve([]);\r\n }\r\n );\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Templatizes field references within specific template types.\r\n * Currently only handles web applications\r\n *\r\n * @param templates List of solution templates\r\n * @returns A list of templates that have templatized field references\r\n */\r\nexport function postProcessFieldReferences(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n const datasourceInfos: IDatasourceInfo[] = _getDatasourceInfos(templates);\r\n const templateTypeHash: any = _getTemplateTypeHash(templates);\r\n\r\n return templates.map(template => {\r\n /* istanbul ignore else */\r\n if (\r\n template.type === \"Web Mapping Application\" ||\r\n template.type === \"Dashboard\" ||\r\n template.type === \"Web Map\"\r\n ) {\r\n const webMapFSDependencies: string[] = _getWebMapFSDependencies(\r\n template,\r\n templateTypeHash\r\n );\r\n const itemHandler: any = moduleMap[template.item.type];\r\n /* istanbul ignore else */\r\n if (itemHandler) {\r\n const dependencies: string[] = webMapFSDependencies.concat(\r\n template.dependencies\r\n );\r\n let dependantDatasources: IDatasourceInfo[] = datasourceInfos.filter(\r\n ds => {\r\n if (dependencies.indexOf(ds.itemId) > -1) {\r\n return ds;\r\n }\r\n }\r\n );\r\n dependantDatasources = _addMapLayerIds(\r\n dependantDatasources,\r\n templateTypeHash\r\n );\r\n if (dependantDatasources.length > 0) {\r\n template = itemHandler.postProcessFieldReferences(\r\n template,\r\n dependantDatasources,\r\n template.item.type\r\n );\r\n }\r\n }\r\n }\r\n return template;\r\n });\r\n}\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Get common properties that will support the templatization of field references\r\n *\r\n * @param templates List of solution templates\r\n * @returns A list of IDataSourceInfo objects with key properties\r\n * @private\r\n */\r\nexport function _getDatasourceInfos(\r\n templates: IItemTemplate[]\r\n): IDatasourceInfo[] {\r\n const datasourceInfos: IDatasourceInfo[] = [];\r\n templates.forEach(t => {\r\n if (t.type === \"Feature Service\") {\r\n const layers: any[] = getProp(t, \"properties.layers\") || [];\r\n const tables: any[] = getProp(t, \"properties.tables\") || [];\r\n const layersAndTables: any[] = layers.concat(tables);\r\n layersAndTables.forEach(obj => {\r\n /* istanbul ignore else */\r\n if (!hasDatasource(datasourceInfos, t.itemId, obj.id)) {\r\n datasourceInfos.push({\r\n itemId: t.itemId,\r\n layerId: obj.id,\r\n fields: obj.fields,\r\n basePath: t.itemId + \".layer\" + obj.id + \".fields\",\r\n url: getProp(t, \"item.url\"),\r\n ids: [],\r\n relationships: obj.relationships || [],\r\n adminLayerInfo: obj.adminLayerInfo || {}\r\n });\r\n }\r\n });\r\n }\r\n });\r\n return datasourceInfos;\r\n}\r\n\r\n/**\r\n * Creates a simple lookup object to quickly understand an items type and dependencies\r\n * and associated web map layer ids based on itemId\r\n *\r\n * @param templates List of solution templates\r\n * @returns The lookup object with type, dependencies, and webmap layer info\r\n * @private\r\n */\r\nexport function _getTemplateTypeHash(templates: IItemTemplate[]): any {\r\n const templateTypeHash: any = {};\r\n templates.forEach(template => {\r\n templateTypeHash[template.itemId] = {\r\n type: template.type,\r\n dependencies: template.dependencies\r\n };\r\n if (template.type === \"Web Map\") {\r\n _updateWebMapHashInfo(template, templateTypeHash[template.itemId]);\r\n }\r\n });\r\n return templateTypeHash;\r\n}\r\n\r\n/**\r\n * Updates the lookup object with webmap layer info\r\n * so we can know the id used within a map for a given feature service\r\n *\r\n * @param template A webmap solution template\r\n * @returns The lookup object with webmap layer info added\r\n * @private\r\n */\r\nexport function _updateWebMapHashInfo(template: IItemTemplate, hashItem: any) {\r\n const operationalLayers: any[] =\r\n getProp(template, \"data.operationalLayers\") || [];\r\n\r\n const tables: any[] = getProp(template, \"data.tables\") || [];\r\n const layersAndTables: any[] = operationalLayers.concat(tables);\r\n if (layersAndTables && layersAndTables.length > 0) {\r\n hashItem.layersAndTables = [];\r\n layersAndTables.forEach(layer => {\r\n const obj: any = {};\r\n let itemId: any;\r\n /* istanbul ignore else */\r\n if (layer.itemId) {\r\n itemId = layer.itemId;\r\n }\r\n /* istanbul ignore else */\r\n if (itemId) {\r\n obj[cleanLayerBasedItemId(itemId)] = {\r\n id: layer.id,\r\n url: layer.url\r\n };\r\n hashItem.layersAndTables.push(obj);\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Updates a templatized datasource URL with a layer id.\r\n *\r\n * @param dataSourceUrl Templatized datasource URL\r\n * @param layerId Layer id\r\n * @returns string Amended datasource URL\r\n * @private\r\n */\r\nexport function _addLayerIdToDatasourceUrl(\r\n datasourceUrl?: string,\r\n layerId?: any\r\n): string {\r\n return datasourceUrl && !isNaN(layerId)\r\n ? datasourceUrl.replace(/[.]/, \".layer\" + layerId + \".\")\r\n : \"\";\r\n}\r\n\r\n/**\r\n * Updates the datasource info objects by passing the webmap layer IDs from the lookup hash\r\n * to the underlying feature service datasource infos\r\n *\r\n * @param datasourceInfos A webmap solution template\r\n * @param templateTypeHash A simple lookup object populated with key item info\r\n * @returns The updated datasource infos\r\n * @private\r\n */\r\nexport function _addMapLayerIds(\r\n datasourceInfos: IDatasourceInfo[],\r\n templateTypeHash: any\r\n): IDatasourceInfo[] {\r\n const webMapIds: any[] = Object.keys(templateTypeHash).filter(k => {\r\n if (templateTypeHash[k].type === \"Web Map\") {\r\n return templateTypeHash[k];\r\n }\r\n });\r\n\r\n return datasourceInfos.map(ds => {\r\n webMapIds.forEach(webMapId => {\r\n templateTypeHash[webMapId].layersAndTables.forEach((opLayer: any) => {\r\n const opLayerInfo: any = opLayer[ds.itemId];\r\n const url: string = _addLayerIdToDatasourceUrl(ds.url, ds.layerId);\r\n if (\r\n opLayerInfo &&\r\n url === opLayerInfo.url &&\r\n ds.ids.indexOf(opLayerInfo.id) < 0\r\n ) {\r\n ds.ids.push(opLayerInfo.id);\r\n }\r\n });\r\n });\r\n return ds;\r\n });\r\n}\r\n\r\n/**\r\n * Get feature service item IDs from applications webmaps\r\n * As they are not explict dependencies of the application but are needed for field references\r\n *\r\n * @param template A webmap solution template\r\n * @param templateTypeHash A simple lookup object populated with key item info\r\n * @returns A lsit of feature service item IDs\r\n * @private\r\n */\r\nexport function _getWebMapFSDependencies(\r\n template: IItemTemplate,\r\n templateTypeHash: any\r\n): string[] {\r\n const webMapFSDependencies: string[] = [];\r\n template.dependencies.forEach(dep => {\r\n const depObj: any = templateTypeHash[dep];\r\n if (depObj.type === \"Web Map\") {\r\n depObj.dependencies.forEach((depObjDependency: string) => {\r\n /* istanbul ignore else */\r\n if (templateTypeHash[depObjDependency].type === \"Feature Service\") {\r\n webMapFSDependencies.push(depObjDependency);\r\n }\r\n });\r\n }\r\n });\r\n return webMapFSDependencies;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n SolutionTemplateFormatVersion,\r\n EItemProgressStatus,\r\n failWithIds,\r\n getIDs,\r\n getPortal,\r\n getTemplateById,\r\n globalStringReplace,\r\n ICreateSolutionOptions,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n IItemUpdate,\r\n ISolutionItemData,\r\n ISourceFile,\r\n isWorkforceProject,\r\n removeTemplate,\r\n replaceInTemplate,\r\n SItemProgressStatus,\r\n copyFilesToStorageItem,\r\n postProcessWorkforceTemplates,\r\n updateItem,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { getProp, getWithDefault } from \"@esri/hub-common\";\r\nimport {\r\n createItemTemplate,\r\n postProcessFieldReferences\r\n} from \"../createItemTemplate\";\r\n\r\n/**\r\n * Adds a list of AGO item ids to a solution item.\r\n *\r\n * @param solutionItemId AGO id of solution to receive items\r\n * @param options Customizations for creating the solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @returns A promise that resolves with the AGO id of the updated solution\r\n * @internal\r\n */\r\nexport function addContentToSolution(\r\n solutionItemId: string,\r\n options: ICreateSolutionOptions,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession\r\n): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n if (!options.itemIds || options.itemIds.length === 0) {\r\n resolve(solutionItemId);\r\n return;\r\n }\r\n\r\n // Prepare feedback mechanism\r\n let totalEstimatedCost = 2 * options.itemIds.length + 1; // solution items, plus avoid divide by 0\r\n let percentDone: number = 16; // allow for previous creation work\r\n let progressPercentStep = (95 - percentDone) / totalEstimatedCost; // leave some % for caller for wrapup\r\n\r\n const failedItemIds: string[] = [];\r\n let totalExpended = 0;\r\n let statusOK = true;\r\n const itemProgressCallback: IItemProgressCallback = (\r\n itemId: string,\r\n status: EItemProgressStatus,\r\n costUsed: number\r\n ) => {\r\n // ---------------------------------------------------------------------------------------------------------------\r\n if (options.itemIds.indexOf(itemId) < 0) {\r\n // New item--a dependency that wasn't in the supplied list of itemIds; add it to the list\r\n // and recalculate the progress percent step based on how much progress remains to be done\r\n options.itemIds.push(itemId);\r\n\r\n totalEstimatedCost += 2;\r\n progressPercentStep =\r\n (95 - percentDone) / (totalEstimatedCost - totalExpended);\r\n }\r\n\r\n totalExpended += costUsed;\r\n percentDone += progressPercentStep * costUsed;\r\n if (options.progressCallback) {\r\n options.progressCallback(Math.round(percentDone), options.jobId);\r\n }\r\n\r\n /* istanbul ignore if */\r\n if (options.consoleProgress) {\r\n console.log(\r\n Date.now(),\r\n itemId,\r\n options.jobId ?? \"\",\r\n SItemProgressStatus[status],\r\n percentDone.toFixed(0) + \"%\",\r\n costUsed\r\n );\r\n }\r\n\r\n if (status === EItemProgressStatus.Failed) {\r\n let error = \"\";\r\n solutionTemplates.some(t => {\r\n /* istanbul ignore else */\r\n if (t.itemId === itemId) {\r\n /* istanbul ignore else */\r\n if (getProp(t, \"properties.error\")) {\r\n error = t.properties.error;\r\n try {\r\n // parse for better console logging if we can\r\n error = JSON.parse(error);\r\n } catch (e) {\r\n /* istanbul ignore next */\r\n // do nothing and show the error as is\r\n }\r\n }\r\n return true;\r\n }\r\n });\r\n removeTemplate(solutionTemplates, itemId);\r\n if (failedItemIds.indexOf(itemId) < 0) {\r\n failedItemIds.push(itemId);\r\n }\r\n statusOK = false;\r\n } else if (status === EItemProgressStatus.Ignored) {\r\n removeTemplate(solutionTemplates, itemId);\r\n }\r\n\r\n return statusOK;\r\n // ---------------------------------------------------------------------------------------------------------------\r\n };\r\n\r\n // Replacement dictionary and created templates\r\n const templateDictionary = options.templateDictionary ?? {};\r\n let solutionTemplates: IItemTemplate[] = [];\r\n\r\n // Handle a list of one or more AGO ids by stepping through the list\r\n // and calling this function recursively\r\n const getItemsPromise: Array<Promise<ISourceFile[]>> = [];\r\n options.itemIds.forEach(itemId => {\r\n const createDef = createItemTemplate(\r\n solutionItemId,\r\n itemId,\r\n templateDictionary,\r\n srcAuthentication,\r\n destAuthentication,\r\n solutionTemplates,\r\n itemProgressCallback\r\n );\r\n getItemsPromise.push(createDef);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all(getItemsPromise).then(\r\n (multipleResourceItemFiles: ISourceFile[][]) => {\r\n if (failedItemIds.length > 0) {\r\n reject(\r\n failWithIds(\r\n failedItemIds,\r\n \"One or more items cannot be converted into templates\"\r\n )\r\n );\r\n } else {\r\n if (solutionTemplates.length > 0) {\r\n // Coalesce the resource file paths from the created templates\r\n let resourceItemFiles: ISourceFile[] = multipleResourceItemFiles.reduce(\r\n (accumulator, currentValue) => accumulator.concat(currentValue),\r\n [] as ISourceFile[]\r\n );\r\n\r\n // test for and update group dependencies and other post-processing\r\n solutionTemplates = _postProcessGroupDependencies(\r\n solutionTemplates\r\n );\r\n solutionTemplates = postProcessWorkforceTemplates(\r\n solutionTemplates\r\n );\r\n\r\n // Filter out any resources from items that have been removed from the templates, such as\r\n // Living Atlas layers\r\n solutionTemplates = _postProcessIgnoredItems(solutionTemplates);\r\n const templateIds = solutionTemplates.map(\r\n template => template.itemId\r\n );\r\n\r\n // Coalesce the resource file paths from the created templates\r\n resourceItemFiles = resourceItemFiles.filter(file =>\r\n templateIds.includes(file.itemId)\r\n );\r\n\r\n // Send the accumulated resources to the solution item\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n copyFilesToStorageItem(\r\n resourceItemFiles,\r\n solutionItemId,\r\n destAuthentication\r\n ).then(() => {\r\n _templatizeSolutionIds(solutionTemplates);\r\n _simplifyUrlsInItemDescriptions(solutionTemplates);\r\n _replaceDictionaryItemsInObject(\r\n templateDictionary,\r\n solutionTemplates\r\n );\r\n _templatizeOrgUrl(solutionTemplates, destAuthentication).then(\r\n solutionTemplates2 => {\r\n // Update solution item with its data JSON\r\n const solutionData: ISolutionItemData = {\r\n metadata: { version: SolutionTemplateFormatVersion },\r\n templates: options.templatizeFields\r\n ? postProcessFieldReferences(solutionTemplates2)\r\n : solutionTemplates2\r\n };\r\n const itemInfo: IItemUpdate = {\r\n id: solutionItemId,\r\n text: solutionData\r\n };\r\n updateItem(itemInfo, destAuthentication).then(() => {\r\n resolve(solutionItemId);\r\n }, reject);\r\n },\r\n reject\r\n );\r\n });\r\n } else {\r\n resolve(solutionItemId);\r\n }\r\n }\r\n }\r\n );\r\n });\r\n}\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Gets the dependencies of an item by merging its dependencies list with item references in template variables.\r\n *\r\n * @param template Template to examine\r\n * @returns List of dependency ids\r\n * @private\r\n */\r\nexport function _getDependencies(template: IItemTemplate): string[] {\r\n // Get all dependencies\r\n let deps = template.dependencies.concat(\r\n _getIdsOutOfTemplateVariables(\r\n _getTemplateVariables(JSON.stringify(template.data))\r\n )\r\n );\r\n\r\n // Remove duplicates and self-references\r\n deps.sort();\r\n deps = deps.filter((elem, index, array) => {\r\n if (elem === template.itemId) {\r\n return false;\r\n } else if (index > 0) {\r\n return elem !== array[index - 1];\r\n } else {\r\n return true;\r\n }\r\n });\r\n\r\n return deps;\r\n}\r\n\r\n/**\r\n * Extracts AGO ids out of template variables.\r\n *\r\n * @param variables List of template variables to examine\r\n * @returns List of AGO ids referenced in `variables`\r\n * @private\r\n */\r\nexport function _getIdsOutOfTemplateVariables(variables: string[]): string[] {\r\n return variables\r\n .map(variable => {\r\n const idList = variable.match(/[0-9A-F]{32}/i); // is it a guid?\r\n if (idList) {\r\n return idList[0];\r\n } else {\r\n return null;\r\n }\r\n })\r\n .filter(variable => !!variable);\r\n}\r\n\r\n/**\r\n * Creates a list of item URLs.\r\n *\r\n * @param templates Templates to check for URLs\r\n * @returns List of URLs\r\n * @private\r\n */\r\nexport function _getSolutionItemUrls(templates: IItemTemplate[]): string[][] {\r\n const solutionUrls: string[][] = [];\r\n templates.forEach(template => {\r\n /* istanbul ignore else */\r\n if (template.item.origUrl) {\r\n solutionUrls.push([template.itemId, template.item.origUrl]);\r\n }\r\n });\r\n return solutionUrls;\r\n}\r\n\r\n/**\r\n * Extracts template variables out of a string.\r\n *\r\n * @param text String to examine\r\n * @returns List of template variables found in string\r\n * @private\r\n */\r\nexport function _getTemplateVariables(text: string): string[] {\r\n return (text.match(/{{[a-z0-9.]*}}/gi) || []) // find variable\r\n .map(variable => variable.substring(2, variable.length - 2)); // remove \"{{\" & \"}}\"\r\n}\r\n\r\n/**\r\n * Update the items dependencies and groups arrays\r\n *\r\n * @param templates The array of templates to evaluate\r\n * @returns Updated version of the templates\r\n * @private\r\n */\r\nexport function _postProcessGroupDependencies(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n return templates.map((template: IItemTemplate) => {\r\n if (template.type === \"Group\") {\r\n const id: string = template.itemId;\r\n // remove group dependencies if we find a circular dependency with one of its items\r\n let removeDependencies: boolean = false;\r\n // before we remove update each dependants groups array\r\n template.dependencies.forEach(dependencyId => {\r\n const dependantTemplate: IItemTemplate = getTemplateById(\r\n templates,\r\n dependencyId\r\n );\r\n // Not all items shared to the group will exist in the templates array\r\n // i.e. Hub Initiative items or any other unsupported types\r\n if (dependantTemplate) {\r\n // check if the group is in the dependantTemplate's list of dependencies\r\n const gIndex = getWithDefault(\r\n dependantTemplate,\r\n \"dependencies\",\r\n []\r\n ).indexOf(id);\r\n\r\n /* istanbul ignore else */\r\n if (gIndex > -1) {\r\n removeDependencies = true;\r\n }\r\n // if the dependant template does not have the group id\r\n // in it's groups array, add it\r\n const groups = getWithDefault(dependantTemplate, \"groups\", []);\r\n if (groups.indexOf(id) === -1) {\r\n groups.push(id);\r\n dependantTemplate.groups = groups;\r\n }\r\n }\r\n });\r\n if (removeDependencies) {\r\n template.dependencies = [];\r\n }\r\n }\r\n return template;\r\n });\r\n}\r\n\r\n/**\r\n * Check for feature service items that have been flagged for invalid designations.\r\n * Remove templates that have invalid designations from the solution item and other item dependencies.\r\n * Clean up any references to items with invalid designations in the other templates.\r\n *\r\n * @param templates The array of templates to evaluate\r\n * @returns Updated version of the templates\r\n * @private\r\n */\r\nexport function _postProcessIgnoredItems(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n // replace in template\r\n const updateDictionary: any = templates.reduce((result, template) => {\r\n return template.properties.hasInvalidDesignations\r\n ? Object.assign(result, template.data)\r\n : result;\r\n }, {});\r\n Object.keys(updateDictionary).forEach(k => {\r\n removeTemplate(templates, k);\r\n templates = templates.map(t => {\r\n t.dependencies = t.dependencies.filter(id => id !== k);\r\n return replaceInTemplate(t, updateDictionary);\r\n });\r\n });\r\n\r\n return templates;\r\n}\r\n\r\n/**\r\n * Recursively runs through an object to find and replace any strings found in a dictionary.\r\n *\r\n * @param templateDictionary Hash of things to be replaced\r\n * @param obj Object to be examined\r\n * @private\r\n */\r\nexport function _replaceDictionaryItemsInObject(hash: any, obj: any): any {\r\n /* istanbul ignore else */\r\n if (obj) {\r\n Object.keys(obj).forEach(prop => {\r\n const propObj = obj[prop];\r\n if (propObj) {\r\n if (typeof propObj === \"object\") {\r\n _replaceDictionaryItemsInObject(hash, propObj);\r\n } else if (typeof propObj === \"string\") {\r\n obj[prop] = hash[propObj] || propObj;\r\n }\r\n }\r\n });\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Recursively runs through an object to find and templatize any remaining references to solution's items.\r\n *\r\n * @param ids Ids to be replaced in strings found in object\r\n * @param obj Object to be examined\r\n * @private\r\n */\r\nexport function _replaceRemainingIdsInObject(ids: string[], obj: any): any {\r\n /* istanbul ignore else */\r\n if (obj) {\r\n Object.keys(obj).forEach(prop => {\r\n const propObj = obj[prop];\r\n if (propObj) {\r\n if (typeof propObj === \"object\") {\r\n _replaceRemainingIdsInObject(ids, propObj);\r\n } else if (typeof propObj === \"string\") {\r\n obj[prop] = _replaceRemainingIdsInString(ids, propObj);\r\n }\r\n }\r\n });\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Templatizes ids from a list in a string if they're not already templatized.\r\n *\r\n * @param ids Ids to be replaced in source string\r\n * @param str Source string to be examined\r\n * @returns A copy of the source string with any templatization changes\r\n * @private\r\n */\r\nexport function _replaceRemainingIdsInString(\r\n ids: string[],\r\n str: string\r\n): string {\r\n let updatedStr = str;\r\n const untemplatizedIds = getIDs(str);\r\n if (untemplatizedIds.length > 0) {\r\n untemplatizedIds.forEach(id => {\r\n if (ids.includes(id)) {\r\n const re = new RegExp(\"({*)\" + id, \"gi\");\r\n updatedStr = updatedStr.replace(re, match =>\r\n match.indexOf(\"{{\") < 0\r\n ? \"{{\" + id.replace(\"{\", \"\") + \".itemId}}\"\r\n : match\r\n );\r\n }\r\n });\r\n }\r\n return updatedStr;\r\n}\r\n\r\n/**\r\n * Finds and templatizes any URLs in solution items' descriptions.\r\n *\r\n * @param templates The array of templates to evaluate, modified in place\r\n * @private\r\n */\r\nexport function _simplifyUrlsInItemDescriptions(\r\n templates: IItemTemplate[]\r\n): void {\r\n // Get the urls in the solution along with their item ids & convert the id into the form\r\n // \"{{fcb2bf2837a6404ebb418a1f805f976a.url}}\"\r\n const solutionUrls = _getSolutionItemUrls(templates).map(idUrl => [\r\n \"{{\" + idUrl[0] + \".url}}\",\r\n idUrl[1]\r\n ]);\r\n\r\n /* istanbul ignore else */\r\n if (solutionUrls.length > 0) {\r\n // Make the replacements\r\n templates.forEach(template => {\r\n solutionUrls.forEach(\r\n // TypeScript for es2015 doesn't have a definition for `replaceAll`\r\n idUrl => {\r\n /* istanbul ignore else */\r\n if (template.item.description) {\r\n template.item.description = (template.item\r\n .description as any).replaceAll(idUrl[1], idUrl[0]);\r\n }\r\n }\r\n );\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Templatizes occurrences of the URL to the user's organization in the `item` and `data` template sections.\r\n *\r\n * @param templates The array of templates to evaluate; templates is modified in place\r\n * @param destAuthentication Credentials for request organization info\r\n * @returns Promise resolving with `templates`\r\n * @private\r\n */\r\nexport function _templatizeOrgUrl(\r\n templates: IItemTemplate[],\r\n destAuthentication: UserSession\r\n): Promise<IItemTemplate[]> {\r\n return new Promise((resolve, reject) => {\r\n // Get the org's URL\r\n getPortal(null, destAuthentication).then(org => {\r\n const orgUrl = \"https://\" + org.urlKey + \".\" + org.customBaseUrl;\r\n const templatizedOrgUrl = \"{{portalBaseUrl}}\";\r\n\r\n // Cycle through each of the items in the template and scan the `item` and `data` sections of each for replacements\r\n templates.forEach((template: IItemTemplate) => {\r\n globalStringReplace(\r\n template.item,\r\n new RegExp(orgUrl, \"gi\"),\r\n templatizedOrgUrl\r\n );\r\n globalStringReplace(\r\n template.data,\r\n new RegExp(orgUrl, \"gi\"),\r\n templatizedOrgUrl\r\n );\r\n });\r\n resolve(templates);\r\n }, reject);\r\n });\r\n}\r\n\r\n/**\r\n * Finds and templatizes any references to solution's items.\r\n *\r\n * @param templates The array of templates to evaluate, modified in place\r\n * @private\r\n */\r\nexport function _templatizeSolutionIds(templates: IItemTemplate[]): void {\r\n // Get the ids in the solution\r\n const solutionIds: string[] = templates.map(\r\n (template: IItemTemplate) => template.itemId\r\n );\r\n\r\n // Cycle through each of the items in the template and\r\n // 1. templatize untemplatized ids in our solution in the `item` and `data` sections;\r\n // 2. update the `dependencies` section\r\n templates.forEach((template: IItemTemplate) => {\r\n _replaceRemainingIdsInObject(solutionIds, template.item);\r\n _replaceRemainingIdsInObject(solutionIds, template.data);\r\n /* istanbul ignore else */\r\n if (template.type !== \"Group\" && !isWorkforceProject(template)) {\r\n template.dependencies = _getDependencies(template);\r\n }\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation of a Solution item.\r\n *\r\n * @module creator\r\n */\r\n\r\nimport {\r\n appendQueryParam,\r\n createItemWithData,\r\n createLongId,\r\n createShortId,\r\n CURRENT_SCHEMA_VERSION,\r\n generateSourceThumbnailUrl,\r\n getBlobAsFile,\r\n getFilenameFromUrl,\r\n getGroupBase,\r\n getGroupContents,\r\n getItemBase,\r\n getPortal,\r\n getUser,\r\n getVelocityUrlBase,\r\n ICreateSolutionOptions,\r\n ISolutionItemData,\r\n IGroup,\r\n IItem,\r\n removeItem,\r\n sanitizeJSONAndReportChanges,\r\n setLocationTrackingEnabled,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { failSafe, IModel } from \"@esri/hub-common\";\r\nimport { addContentToSolution } from \"./helpers/add-content-to-solution\";\r\n\r\n// Simple no-op to clean up progressCallback management\r\nconst noOp = () => {};\r\n\r\n/**\r\n * Creates a solution item.\r\n *\r\n * @param sourceId AGO id of group whose contents are to be added to solution or of an item to convert into a solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @param options Customizations for creating the solution\r\n * @returns A promise that resolves with the AGO id of the new solution\r\n */\r\nexport function createSolution(\r\n sourceId: string,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession,\r\n options?: ICreateSolutionOptions\r\n): Promise<string> {\r\n const createOptions: ICreateSolutionOptions = options || {};\r\n const progressCb = createOptions.progressCallback || noOp;\r\n createOptions.templateDictionary = Object.assign(\r\n {},\r\n createOptions.templateDictionary\r\n );\r\n\r\n progressCb(1); // let the caller know that we've started\r\n\r\n // Assume that source is a group and try to get group's information\r\n return Promise.all([\r\n getGroupBase(sourceId, srcAuthentication),\r\n getGroupContents(sourceId, srcAuthentication),\r\n getVelocityUrlBase(srcAuthentication, createOptions.templateDictionary)\r\n ])\r\n .then(\r\n // Group fetches worked; assumption was correct\r\n responses => {\r\n createOptions.itemIds = responses[1];\r\n progressCb(15);\r\n\r\n return new Promise<ICreateSolutionOptions>(resolve => {\r\n // Update the createOptions with values from the group\r\n resolve(\r\n _applySourceToCreateOptions(\r\n createOptions,\r\n responses[0],\r\n srcAuthentication,\r\n true\r\n )\r\n );\r\n });\r\n },\r\n\r\n // Assumption incorrect; try source as an item\r\n () => {\r\n return new Promise<ICreateSolutionOptions>((resolve, reject) => {\r\n createOptions.itemIds = [sourceId];\r\n getItemBase(sourceId, srcAuthentication).then(\r\n // Update the createOptions with values from the item\r\n itemBase =>\r\n resolve(\r\n _applySourceToCreateOptions(\r\n createOptions,\r\n itemBase,\r\n srcAuthentication,\r\n false\r\n )\r\n ),\r\n reject\r\n );\r\n });\r\n }\r\n )\r\n\r\n .then(createOptions => {\r\n return new Promise<ICreateSolutionOptions>((resolve, reject) => {\r\n Promise.all([\r\n getPortal(\"\", srcAuthentication),\r\n getUser(srcAuthentication)\r\n ]).then(responses => {\r\n // check tracking\r\n const [portalResponse, userResponse] = responses;\r\n setLocationTrackingEnabled(\r\n portalResponse,\r\n userResponse,\r\n createOptions.templateDictionary\r\n );\r\n resolve(createOptions);\r\n }, reject);\r\n });\r\n })\r\n\r\n .then(\r\n // Use a copy of the thumbnail rather than a URL to it\r\n createOptions => {\r\n return _addThumbnailFileToCreateOptions(\r\n createOptions,\r\n srcAuthentication\r\n );\r\n }\r\n )\r\n\r\n .then(\r\n // Create a solution\r\n createOptions => {\r\n return _createSolutionFromItemIds(\r\n createOptions,\r\n srcAuthentication,\r\n destAuthentication\r\n );\r\n }\r\n )\r\n\r\n .then(\r\n // Successfully created solution\r\n createdSolutionId => {\r\n progressCb(100); // finished\r\n return createdSolutionId;\r\n },\r\n\r\n // Error fetching group, group contents, or item, or error creating solution from ids\r\n error => {\r\n progressCb(1);\r\n console.error(error);\r\n throw error;\r\n }\r\n );\r\n}\r\n\r\n/**\r\n * Update the createOptions with the group properties\r\n *\r\n * @param createOptions\r\n * @param sourceInfo\r\n * @param authentication\r\n * @param isGroup Boolean to indicate if the files are associated with a group or item\r\n * @private\r\n */\r\nexport function _applySourceToCreateOptions(\r\n createOptions: ICreateSolutionOptions,\r\n sourceInfo: IGroup | IItem,\r\n srcAuthentication: UserSession,\r\n isGroup = false\r\n): ICreateSolutionOptions {\r\n // Create a solution from the group's or item's contents,\r\n // using the group's or item's information as defaults for the solution item\r\n [\"title\", \"snippet\", \"description\", \"tags\"].forEach(prop => {\r\n createOptions[prop] = createOptions[prop] ?? sourceInfo[prop];\r\n });\r\n\r\n if (!createOptions.thumbnailurl && sourceInfo.thumbnail) {\r\n // Get the full path to the thumbnail\r\n createOptions.thumbnailurl = generateSourceThumbnailUrl(\r\n srcAuthentication.portal,\r\n sourceInfo.id,\r\n sourceInfo.thumbnail,\r\n isGroup\r\n );\r\n delete sourceInfo.thumbnail;\r\n }\r\n\r\n return createOptions;\r\n}\r\n\r\n/**\r\n * Update the createOptions with the thumbnail file\r\n *\r\n * @param createOptions\r\n * @param srcAuthentication\r\n * @private\r\n */\r\nexport function _addThumbnailFileToCreateOptions(\r\n createOptions: ICreateSolutionOptions,\r\n srcAuthentication: UserSession\r\n): Promise<ICreateSolutionOptions> {\r\n return new Promise<ICreateSolutionOptions>(resolve => {\r\n if (!createOptions.thumbnail && createOptions.thumbnailurl) {\r\n // Figure out the thumbnail's filename\r\n const filename =\r\n getFilenameFromUrl(createOptions.thumbnailurl) || \"thumbnail\";\r\n const thumbnailurl = appendQueryParam(\r\n createOptions.thumbnailurl,\r\n \"w=400\"\r\n );\r\n delete createOptions.thumbnailurl;\r\n\r\n // Fetch the thumbnail\r\n getBlobAsFile(thumbnailurl, filename, srcAuthentication).then(\r\n thumbnail => {\r\n createOptions.thumbnail = thumbnail;\r\n resolve(createOptions);\r\n },\r\n () => {\r\n resolve(createOptions);\r\n }\r\n );\r\n } else {\r\n resolve(createOptions);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Creates a solution item using a list of AGO item ids.\r\n *\r\n * @param options Customizations for creating the solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its\r\n * there is a problem updating it\r\n * @private\r\n */\r\nexport function _createSolutionFromItemIds(\r\n options: ICreateSolutionOptions,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession\r\n): Promise<string> {\r\n let solutionId = \"\";\r\n // Create a solution from the list of items\r\n return _createSolutionItem(destAuthentication, options)\r\n .then(id => {\r\n solutionId = id;\r\n // Add list of items to the new solution\r\n return addContentToSolution(\r\n solutionId,\r\n options,\r\n srcAuthentication,\r\n destAuthentication\r\n );\r\n })\r\n .catch(addError => {\r\n // If the solution item got created, delete it\r\n if (solutionId) {\r\n const failSafeRemove = failSafe(removeItem, { success: true });\r\n return failSafeRemove(solutionId, destAuthentication).then(() => {\r\n throw addError;\r\n });\r\n } else {\r\n throw addError;\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Creates an empty solution item.\r\n *\r\n * @param authentication Credentials for the request\r\n * @param options Customizations for creating the solution\r\n * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its\r\n * there is a problem updating its thumbnail\r\n * @private\r\n */\r\nexport function _createSolutionItem(\r\n authentication: UserSession,\r\n options?: ICreateSolutionOptions\r\n): Promise<string> {\r\n const model = _createSolutionItemModel(options);\r\n\r\n // Create new solution item\r\n delete model.item.thumbnailurl;\r\n model.item.thumbnail = options?.thumbnail;\r\n return createItemWithData(\r\n model.item,\r\n model.data,\r\n authentication,\r\n options?.folderId\r\n ).then(createResponse => {\r\n return Promise.resolve(createResponse.id);\r\n });\r\n}\r\n\r\n/**\r\n * Create the Solution Item model to be used to create\r\n * the Solution Item itself\r\n *\r\n * @param options\r\n * @private\r\n */\r\nexport function _createSolutionItemModel(options: any): IModel {\r\n // Solution uses all supplied tags but for deploy.* tags; that information goes into properties\r\n const creationTags = options?.tags ?? [];\r\n\r\n const solutionItem: any = {\r\n type: \"Solution\",\r\n title: options?.title ?? createShortId(),\r\n snippet: options?.snippet ?? \"\",\r\n description: options?.description ?? \"\",\r\n properties: {\r\n schemaVersion: CURRENT_SCHEMA_VERSION\r\n },\r\n thumbnailurl: options?.thumbnailurl ?? \"\",\r\n tags: creationTags.filter((tag: any) => !tag.startsWith(\"deploy.\")),\r\n typeKeywords: [\"Solution\", \"Template\"].concat(\r\n _getDeploymentProperties(creationTags)\r\n )\r\n };\r\n\r\n // ensure that snippet and description are not nefarious\r\n const sanitizedItem = sanitizeJSONAndReportChanges(solutionItem);\r\n\r\n const addlKeywords = options?.additionalTypeKeywords || [];\r\n sanitizedItem.typeKeywords = [].concat(\r\n solutionItem.typeKeywords,\r\n addlKeywords\r\n );\r\n\r\n const solutionData: ISolutionItemData = {\r\n metadata: {},\r\n templates: []\r\n };\r\n return {\r\n item: sanitizedItem,\r\n data: solutionData\r\n };\r\n}\r\n\r\n/**\r\n * Gets the deploy.id and deploy.version tag values.\r\n *\r\n * @param tags A list of item tags\r\n * @returns A list containing the two values found in the tags, or defaulting to a new GUID and \"1.0\", respectively,\r\n * as needed\r\n * @private\r\n */\r\nexport function _getDeploymentProperties(tags: string[]): string[] {\r\n return [\r\n \"solutionid-\" +\r\n (_getDeploymentProperty(\"deploy.id.\", tags) ?? createLongId()),\r\n \"solutionversion-\" +\r\n (_getDeploymentProperty(\"deploy.version.\", tags) ?? \"1.0\")\r\n ];\r\n}\r\n\r\n/**\r\n * Searches for a tag that has the specified prefix and returns the rest of the tag following that prefix.\r\n *\r\n * @param desiredTagPrefix Tag prefix to look for\r\n * @param tags A list of item tags\r\n * @returns The extracted value of the first matching tag or null if a tag with the specified prefix is not found\r\n * @private\r\n */\r\nexport function _getDeploymentProperty(\r\n desiredTagPrefix: string,\r\n tags: string[]\r\n): string | null {\r\n const foundTagAsList = tags.filter(tag => tag.startsWith(desiredTagPrefix));\r\n if (foundTagAsList.length > 0) {\r\n return foundTagAsList[0].substr(desiredTagPrefix.length);\r\n } else {\r\n return null;\r\n }\r\n}\r\n"],"names":["group","VelocityProcessor","simpleTypes","featureLayer","formProcessor","HubPageProcessor","HubSiteProcessor","notebookProcessor","quickcaptureProcessor","StoryMapProcessor","WebExperienceProcessor","fileProcessor","findTemplateInList","createPlaceholderTemplate","EItemProgressStatus","getItemBase","replaceTemplate","getGroupBase","sanitizeJSONAndReportChanges","fail","getItemResourcesPaths","SolutionTemplateFormatVersion","getItemResourcesFilesFromPaths","getProp","hasDatasource","cleanLayerBasedItemId","SItemProgressStatus","removeTemplate","failWithIds","postProcessWorkforceTemplates","copyFilesToStorageItem","updateItem","getTemplateById","getWithDefault","replaceInTemplate","getIDs","getPortal","globalStringReplace","isWorkforceProject","getGroupContents","getVelocityUrlBase","getUser","setLocationTrackingEnabled","generateSourceThumbnailUrl","getFilenameFromUrl","appendQueryParam","getBlobAsFile","failSafe","removeItem","createItemWithData","createShortId","CURRENT_SCHEMA_VERSION","createLongId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;;;;;;;;;;;;;;;QA+Ba,WAAW,GAAkB,KAAK;EAE/C;;;;;QAKa,SAAS,GAAuB;;;MAG3C,KAAK,EAAEA,gBAAK;;;MAIZ,mBAAmB,EAAEC,kCAAiB;MACtC,oBAAoB,EAAEC,+BAAW;MACjC,iBAAiB,EAAEC,uBAAY;MAC/B,IAAI,EAAEF,kCAAiB;MACvB,mBAAmB,EAAE,SAAS;MAC9B,iBAAiB,EAAE,SAAS;MAC5B,kBAAkB,EAAE,SAAS;MAC7B,uBAAuB,EAAE,SAAS;MAClC,eAAe,EAAE,SAAS;MAC1B,eAAe,EAAE,SAAS;MAC1B,GAAG,EAAE,SAAS;MACd,aAAa,EAAEE,uBAAY;MAC3B,0BAA0B,EAAE,SAAS;MACrC,oBAAoB,EAAEF,kCAAiB;MACvC,gCAAgC,EAAE,SAAS;MAC3C,eAAe,EAAE,SAAS;MAC1B,gBAAgB,EAAE,SAAS;MAC3B,IAAI,EAAE,SAAS;MACf,qBAAqB,EAAE,SAAS;MAChC,GAAG,EAAE,SAAS;MACd,GAAG,EAAE,SAAS;MACd,IAAI,EAAE,SAAS;MACf,0BAA0B,EAAE,SAAS;;;MAIrC,cAAc,EAAE,SAAS;MACzB,SAAS,EAAEC,+BAAW;MACtB,WAAW,EAAEA,+BAAW;;;MAIxB,WAAW,EAAE,SAAS;MACtB,SAAS,EAAEA,+BAAW;MACtB,YAAY,EAAE,SAAS;MACvB,qBAAqB,EAAE,SAAS;MAChC,2BAA2B,EAAE,SAAS;MACtC,IAAI,EAAEE,wBAAa;MAC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;MAEjE,MAAM,YAAY,GAAG,OAAO,EAAE,sBAAsB,IAAI,EAAE,CAAC;MAC3D,aAAa,CAAC,YAAY,GAAG,EAAE,CAAC,MAAM,CACpC,YAAY,CAAC,YAAY,EACzB,YAAY,CACb,CAAC;MAEF,MAAM,YAAY,GAAsB;UACtC,QAAQ,EAAE,EAAE;UACZ,SAAS,EAAE,EAAE;OACd,CAAC;MACF,OAAO;UACL,IAAI,EAAE,aAAa;UACnB,IAAI,EAAE,YAAY;OACnB,CAAC;EACJ,CAAC;EAED;;;;;;;;WAQgB,wBAAwB,CAAC,IAAc;MACrD,OAAO;UACL,aAAa;eACV,sBAAsB,CAAC,YAAY,EAAE,IAAI,CAAC,IAAIkC,2BAAY,EAAE,CAAC;UAChE,kBAAkB;eACf,sBAAsB,CAAC,iBAAiB,EAAE,IAAI,CAAC,IAAI,KAAK,CAAC;OAC7D,CAAC;EACJ,CAAC;EAED;;;;;;;;WAQgB,sBAAsB,CACpC,gBAAwB,EACxB,IAAc;MAEd,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,gBAAgB,CAAC,CAAC,CAAC;MAC5E,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE;UAC7B,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC;OAC1D;WAAM;UACL,OAAO,IAAI,CAAC;OACb;EACH;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* @preserve
|
|
2
|
-
* @esri/solution-creator - v1.
|
|
2
|
+
* @esri/solution-creator - v1.4.1 - Apache-2.0
|
|
3
3
|
* Copyright (c) 2018-2022 Esri, Inc.
|
|
4
|
-
*
|
|
4
|
+
* Mon Aug 01 2022 14:09:47 GMT-0700 (Pacific Daylight Time)
|
|
5
5
|
*
|
|
6
6
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
7
7
|
* you may not use this file except in compliance with the License.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"creator.umd.min.js","sources":["../../src/module-map.ts","../../src/createItemTemplate.ts","../../src/helpers/add-content-to-solution.ts","../../src/creator.ts"],"sourcesContent":["/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { moduleHandler, IItemTypeModuleMap } from \"@esri/solution-common\";\r\nimport * as featureLayer from \"@esri/solution-feature-layer\";\r\nimport * as fileProcessor from \"@esri/solution-file\";\r\nimport * as formProcessor from \"@esri/solution-form\";\r\nimport * as group from \"@esri/solution-group\";\r\nimport {\r\n simpleTypes,\r\n notebookProcessor,\r\n quickcaptureProcessor\r\n} from \"@esri/solution-simple-types\";\r\nimport { StoryMapProcessor } from \"@esri/solution-storymap\";\r\nimport { VelocityProcessor } from \"@esri/solution-velocity\";\r\nimport { WebExperienceProcessor } from \"@esri/solution-web-experience\";\r\nimport { HubPageProcessor, HubSiteProcessor } from \"@esri/solution-hub-types\";\r\n\r\nexport const UNSUPPORTED: moduleHandler = null;\r\n\r\n/**\r\n * Mapping from item type to module with type-specific template-handling code.\r\n * AGO types come from a blend of arcgis-portal-app\\src\\js\\arcgisonline\\pages\\item\\_Info.js and\r\n * arcgis-portal-app\\src\\js\\arcgis-components\\src\\_utils\\metadata\\item\\displayName.ts\r\n */\r\nexport const moduleMap: IItemTypeModuleMap = {\r\n ////////////////////////////////////////////////////////\r\n // Group type\r\n Group: group,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Layer types\r\n \"Big Data Analytic\": VelocityProcessor,\r\n \"Feature Collection\": simpleTypes,\r\n \"Feature Service\": featureLayer,\r\n Feed: VelocityProcessor,\r\n \"Geocoding Service\": undefined,\r\n \"Geodata Service\": undefined,\r\n \"Geometry Service\": undefined,\r\n \"Geoprocessing Service\": undefined,\r\n \"Globe Service\": undefined,\r\n \"Image Service\": undefined,\r\n KML: undefined,\r\n \"Map Service\": featureLayer,\r\n \"Network Analysis Service\": undefined,\r\n \"Real Time Analytic\": VelocityProcessor,\r\n \"Relational Database Connection\": undefined,\r\n \"Scene Service\": undefined,\r\n \"Stream Service\": undefined,\r\n Tool: undefined,\r\n \"Vector Tile Service\": undefined,\r\n WFS: undefined,\r\n WMS: undefined,\r\n WMTS: undefined,\r\n \"Workflow Manager Service\": undefined,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Map types\r\n \"3D Web Scene\": undefined,\r\n \"Web Map\": simpleTypes,\r\n \"Web Scene\": simpleTypes,\r\n\r\n ////////////////////////////////////////////////////////\r\n // App types\r\n Application: undefined,\r\n Dashboard: simpleTypes,\r\n \"Data Store\": undefined,\r\n \"Desktop Application\": undefined,\r\n \"Excalibur Imagery Project\": undefined,\r\n Form: formProcessor,\r\n \"Hub Initiative\": UNSUPPORTED,\r\n \"Hub Page\": HubPageProcessor,\r\n \"Hub Site Application\": HubSiteProcessor,\r\n \"Insights Model\": simpleTypes,\r\n \"Insights Page\": undefined,\r\n \"Insights Theme\": undefined,\r\n \"Insights Workbook\": undefined,\r\n Mission: undefined,\r\n \"Mobile Application\": undefined,\r\n Notebook: notebookProcessor,\r\n \"Oriented Imagery Catalog\": simpleTypes,\r\n \"Ortho Mapping Project\": undefined,\r\n \"QuickCapture Project\": quickcaptureProcessor,\r\n \"Site Application\": HubSiteProcessor,\r\n \"Site Page\": HubPageProcessor,\r\n Solution: UNSUPPORTED,\r\n StoryMap: StoryMapProcessor,\r\n \"Urban Model\": undefined,\r\n \"Web Experience Template\": undefined,\r\n \"Web Experience\": WebExperienceProcessor,\r\n \"Web Mapping Application\": simpleTypes,\r\n \"Workforce Project\": simpleTypes,\r\n\r\n ////////////////////////////////////////////////////////\r\n // File types\r\n \"360 VR Experience\": fileProcessor,\r\n \"AppBuilder Extension\": fileProcessor,\r\n \"AppBuilder Widget Package\": fileProcessor,\r\n \"Application Configuration\": fileProcessor,\r\n \"ArcGIS Pro Add In\": fileProcessor,\r\n \"ArcGIS Pro Configuration\": fileProcessor,\r\n \"ArcPad Package\": fileProcessor,\r\n \"Basemap Package\": fileProcessor,\r\n \"CAD Drawing\": fileProcessor,\r\n \"CityEngine Web Scene\": fileProcessor,\r\n \"Code Attachment\": UNSUPPORTED,\r\n \"Code Sample\": fileProcessor,\r\n \"Color Set\": fileProcessor,\r\n \"Compact Tile Package\": fileProcessor,\r\n \"CSV Collection\": fileProcessor,\r\n CSV: fileProcessor,\r\n \"Deep Learning Package\": fileProcessor,\r\n \"Desktop Add In\": fileProcessor,\r\n \"Desktop Application Template\": fileProcessor,\r\n \"Desktop Style\": fileProcessor,\r\n \"Document Link\": fileProcessor,\r\n \"Explorer Add In\": fileProcessor,\r\n \"Explorer Layer\": fileProcessor,\r\n \"Explorer Map\": fileProcessor,\r\n \"Feature Collection Template\": fileProcessor,\r\n \"File Geodatabase\": fileProcessor,\r\n GeoJson: fileProcessor,\r\n GeoPackage: fileProcessor,\r\n \"Geoprocessing Package\": fileProcessor,\r\n \"Geoprocessing Sample\": fileProcessor,\r\n \"Globe Document\": fileProcessor,\r\n \"Image Collection\": fileProcessor,\r\n Image: fileProcessor,\r\n \"iWork Keynote\": fileProcessor,\r\n \"iWork Numbers\": fileProcessor,\r\n \"iWork Pages\": fileProcessor,\r\n \"KML Collection\": fileProcessor,\r\n \"Layer Package\": fileProcessor,\r\n \"Layer Template\": fileProcessor,\r\n Layer: fileProcessor,\r\n Layout: fileProcessor,\r\n \"Locator Package\": fileProcessor,\r\n \"Map Document\": fileProcessor,\r\n \"Map Package\": fileProcessor,\r\n \"Map Template\": fileProcessor,\r\n \"Microsoft Excel\": fileProcessor,\r\n \"Microsoft Powerpoint\": fileProcessor,\r\n \"Microsoft Word\": fileProcessor,\r\n \"Mobile Basemap Package\": fileProcessor,\r\n \"Mobile Map Package\": fileProcessor,\r\n \"Mobile Scene Package\": fileProcessor,\r\n \"Native Application\": fileProcessor,\r\n \"Native Application Installer\": fileProcessor,\r\n \"Native Application Template\": fileProcessor,\r\n netCDF: fileProcessor,\r\n \"Operation View\": fileProcessor,\r\n \"Operations Dashboard Add In\": fileProcessor,\r\n \"Operations Dashboard Extension\": fileProcessor,\r\n PDF: fileProcessor,\r\n \"Pro Layer Package\": fileProcessor,\r\n \"Pro Layer\": fileProcessor,\r\n \"Pro Map Package\": fileProcessor,\r\n \"Pro Map\": fileProcessor,\r\n \"Pro Report\": fileProcessor,\r\n \"Project Package\": fileProcessor,\r\n \"Project Template\": fileProcessor,\r\n \"Published Map\": fileProcessor,\r\n \"Raster function template\": fileProcessor,\r\n \"Report Template\": fileProcessor,\r\n \"Rule Package\": fileProcessor,\r\n \"Scene Document\": fileProcessor,\r\n \"Scene Package\": fileProcessor,\r\n \"Service Definition\": fileProcessor,\r\n Shapefile: fileProcessor,\r\n \"Statistical Data Collection\": fileProcessor,\r\n Style: fileProcessor,\r\n \"Survey123 Add In\": fileProcessor,\r\n \"Symbol Set\": fileProcessor,\r\n \"Task File\": fileProcessor,\r\n \"Tile Package\": fileProcessor,\r\n \"Toolbox Package\": fileProcessor,\r\n \"Vector Tile Package\": fileProcessor,\r\n \"Viewer Configuration\": fileProcessor,\r\n \"Visio Document\": fileProcessor,\r\n \"Window Mobile Package\": fileProcessor,\r\n \"Windows Mobile Package\": fileProcessor,\r\n \"Windows Viewer Add In\": fileProcessor,\r\n \"Windows Viewer Configuration\": fileProcessor,\r\n \"Workflow Manager Package\": fileProcessor,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Testing \"types\"\r\n Undefined: undefined,\r\n Unsupported: UNSUPPORTED\r\n};\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages creation of the template of a Solution item via the REST API.\r\n *\r\n * @module createItemTemplate\r\n */\r\n\r\nimport {\r\n cleanLayerBasedItemId,\r\n createPlaceholderTemplate,\r\n EItemProgressStatus,\r\n SolutionTemplateFormatVersion,\r\n findTemplateInList,\r\n getGroupBase,\r\n getItemBase,\r\n hasDatasource,\r\n IDatasourceInfo,\r\n IItemGeneralized,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n ISourceFile,\r\n ISourceFileCopyPath,\r\n getItemResourcesFilesFromPaths,\r\n getItemResourcesPaths,\r\n replaceTemplate,\r\n sanitizeJSONAndReportChanges,\r\n fail,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { getProp } from \"@esri/hub-common\";\r\nimport { moduleMap, UNSUPPORTED } from \"./module-map\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Creates template for an AGO item and its dependencies\r\n *\r\n * @param solutionItemId The solution to contain the item\r\n * @param itemId AGO id string\r\n * @param templateDictionary Hash of facts\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Authentication for requesting information from AGO about items to be included in solution item\r\n * @param existingTemplates A collection of AGO item templates that can be referenced by newly-created templates\r\n * @returns A promise which resolves with an array of resources for the item and its dependencies\r\n * @private\r\n */\r\nexport function createItemTemplate(\r\n solutionItemId: string,\r\n itemId: string,\r\n templateDictionary: any,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession,\r\n existingTemplates: IItemTemplate[],\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ISourceFile[]> {\r\n return new Promise(resolve => {\r\n // Check if item and its dependents are already in list or are queued\r\n if (findTemplateInList(existingTemplates, itemId)) {\r\n resolve([]);\r\n } else {\r\n // Add the id as a placeholder to show that it is being fetched\r\n existingTemplates.push(createPlaceholderTemplate(itemId));\r\n\r\n itemProgressCallback(itemId, EItemProgressStatus.Started, 0);\r\n\r\n // Fetch the item\r\n getItemBase(itemId, srcAuthentication)\r\n .catch(() => {\r\n // If item query fails, try fetching item as a group\r\n // Change its placeholder from an empty type to the Group type so that we can later distinguish\r\n // between items and groups (the base info for a group doesn't include a type property)\r\n replaceTemplate(\r\n existingTemplates,\r\n itemId,\r\n createPlaceholderTemplate(itemId, \"Group\")\r\n );\r\n return getGroupBase(itemId, srcAuthentication);\r\n })\r\n .then(\r\n itemInfo => {\r\n itemInfo = sanitizeJSONAndReportChanges(itemInfo);\r\n\r\n // Save the URL as a symbol\r\n if (itemInfo.url) {\r\n templateDictionary[itemInfo.url] = \"{{\" + itemInfo.id + \".url}}\";\r\n itemInfo.origUrl = itemInfo.url;\r\n }\r\n\r\n const idTest: RegExp = /^source-[0-9A-F]{32}/i;\r\n // Remove any source-itemId type keywords\r\n /* istanbul ignore else */\r\n if (Array.isArray(itemInfo.typeKeywords)) {\r\n itemInfo.typeKeywords = itemInfo.typeKeywords.filter(v =>\r\n idTest.test(v) ? false : true\r\n );\r\n }\r\n // Remove any source-itemId tags\r\n /* istanbul ignore else */\r\n if (Array.isArray(itemInfo.tags)) {\r\n itemInfo.tags = itemInfo.tags.filter(v =>\r\n idTest.test(v) ? false : true\r\n );\r\n }\r\n\r\n const placeholder = findTemplateInList(existingTemplates, itemId);\r\n let itemType = placeholder.type;\r\n if (!itemType) {\r\n // Groups have this defined when their placeholder is created\r\n itemType = itemInfo.type;\r\n placeholder.type = itemType;\r\n }\r\n if (!itemInfo.type) {\r\n itemInfo.type = itemType; // Groups don't have this property, so we'll patch it in\r\n }\r\n placeholder.item = {\r\n ...itemInfo\r\n } as IItemGeneralized;\r\n\r\n // Interrupt process if progress callback returns `false`\r\n if (!itemProgressCallback(itemId, EItemProgressStatus.Created, 1)) {\r\n itemProgressCallback(itemId, EItemProgressStatus.Cancelled, 1);\r\n resolve(fail(\"Cancelled\"));\r\n return;\r\n }\r\n\r\n const itemHandler = moduleMap[itemType];\r\n if (!itemHandler || itemHandler === UNSUPPORTED) {\r\n if (itemHandler === UNSUPPORTED) {\r\n itemProgressCallback(itemId, EItemProgressStatus.Ignored, 1);\r\n resolve([]);\r\n } else {\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n placeholder.properties[\"failed\"] = true;\r\n replaceTemplate(existingTemplates, itemId, placeholder);\r\n resolve(\r\n fail(\r\n \"The type of AGO item \" +\r\n itemId +\r\n \" ('\" +\r\n itemType +\r\n \"') is not supported at this time\"\r\n )\r\n );\r\n }\r\n } else {\r\n // Handle original Story Maps with next-gen Story Maps\r\n /* istanbul ignore else */\r\n /* Not yet supported\r\n if (storyMap.isAStoryMap(itemType, itemInfo.url)) {\r\n itemHandler = storyMap;\r\n } */\r\n\r\n // Delegate the creation of the item to the handler\r\n itemHandler\r\n .convertItemToTemplate(\r\n solutionItemId,\r\n itemInfo,\r\n destAuthentication,\r\n srcAuthentication,\r\n templateDictionary\r\n )\r\n .then(\r\n itemTemplate => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n getItemResourcesPaths(\r\n itemTemplate,\r\n solutionItemId,\r\n srcAuthentication,\r\n SolutionTemplateFormatVersion\r\n ).then((resourceItemFilePaths: ISourceFileCopyPath[]) => {\r\n itemTemplate.item.thumbnail = null; // not needed in this property; handled as a resource\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n getItemResourcesFilesFromPaths(\r\n resourceItemFilePaths,\r\n srcAuthentication\r\n ).then((resourceItemFiles: ISourceFile[]) => {\r\n // update the template's resources\r\n itemTemplate.resources = itemTemplate.resources.concat(\r\n resourceItemFiles.map(\r\n (file: ISourceFile) =>\r\n file.folder + \"/\" + file.filename\r\n )\r\n );\r\n\r\n // Set the value keyed by the id to the created template, replacing the placeholder template\r\n replaceTemplate(\r\n existingTemplates,\r\n itemTemplate.itemId,\r\n itemTemplate\r\n );\r\n\r\n // Trace item dependencies\r\n if (itemTemplate.dependencies.length === 0) {\r\n itemProgressCallback(\r\n itemId,\r\n EItemProgressStatus.Finished,\r\n 1\r\n );\r\n resolve(resourceItemFiles);\r\n } else {\r\n // Get its dependencies, asking each to get its dependents via\r\n // recursive calls to this function\r\n const dependentDfds: Array<Promise<\r\n ISourceFile[]\r\n >> = [];\r\n itemTemplate.dependencies.forEach(dependentId => {\r\n if (\r\n !findTemplateInList(\r\n existingTemplates,\r\n dependentId\r\n )\r\n ) {\r\n dependentDfds.push(\r\n createItemTemplate(\r\n solutionItemId,\r\n dependentId,\r\n templateDictionary,\r\n srcAuthentication,\r\n destAuthentication,\r\n existingTemplates,\r\n itemProgressCallback\r\n )\r\n );\r\n }\r\n });\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all(dependentDfds).then(\r\n (dependentResourceItemFiles: ISourceFile[][]) => {\r\n // Templatization of item and its dependencies done\r\n itemProgressCallback(\r\n itemId,\r\n EItemProgressStatus.Finished,\r\n 1\r\n );\r\n resourceItemFiles = dependentResourceItemFiles.reduce(\r\n (accumulator, currentValue) =>\r\n accumulator.concat(currentValue),\r\n resourceItemFiles\r\n );\r\n resolve(resourceItemFiles);\r\n }\r\n );\r\n }\r\n });\r\n });\r\n },\r\n error => {\r\n placeholder.properties[\"error\"] = JSON.stringify(error);\r\n replaceTemplate(existingTemplates, itemId, placeholder);\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n resolve([]);\r\n }\r\n );\r\n }\r\n },\r\n // Id not found or item is not accessible\r\n () => {\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n resolve([]);\r\n }\r\n );\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Templatizes field references within specific template types.\r\n * Currently only handles web applications\r\n *\r\n * @param templates List of solution templates\r\n * @returns A list of templates that have templatized field references\r\n */\r\nexport function postProcessFieldReferences(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n const datasourceInfos: IDatasourceInfo[] = _getDatasourceInfos(templates);\r\n const templateTypeHash: any = _getTemplateTypeHash(templates);\r\n\r\n return templates.map(template => {\r\n /* istanbul ignore else */\r\n if (\r\n template.type === \"Web Mapping Application\" ||\r\n template.type === \"Dashboard\" ||\r\n template.type === \"Web Map\"\r\n ) {\r\n const webMapFSDependencies: string[] = _getWebMapFSDependencies(\r\n template,\r\n templateTypeHash\r\n );\r\n const itemHandler: any = moduleMap[template.item.type];\r\n /* istanbul ignore else */\r\n if (itemHandler) {\r\n const dependencies: string[] = webMapFSDependencies.concat(\r\n template.dependencies\r\n );\r\n let dependantDatasources: IDatasourceInfo[] = datasourceInfos.filter(\r\n ds => {\r\n if (dependencies.indexOf(ds.itemId) > -1) {\r\n return ds;\r\n }\r\n }\r\n );\r\n dependantDatasources = _addMapLayerIds(\r\n dependantDatasources,\r\n templateTypeHash\r\n );\r\n if (dependantDatasources.length > 0) {\r\n template = itemHandler.postProcessFieldReferences(\r\n template,\r\n dependantDatasources,\r\n template.item.type\r\n );\r\n }\r\n }\r\n }\r\n return template;\r\n });\r\n}\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Get common properties that will support the templatization of field references\r\n *\r\n * @param templates List of solution templates\r\n * @returns A list of IDataSourceInfo objects with key properties\r\n * @private\r\n */\r\nexport function _getDatasourceInfos(\r\n templates: IItemTemplate[]\r\n): IDatasourceInfo[] {\r\n const datasourceInfos: IDatasourceInfo[] = [];\r\n templates.forEach(t => {\r\n if (t.type === \"Feature Service\") {\r\n const layers: any[] = getProp(t, \"properties.layers\") || [];\r\n const tables: any[] = getProp(t, \"properties.tables\") || [];\r\n const layersAndTables: any[] = layers.concat(tables);\r\n layersAndTables.forEach(obj => {\r\n /* istanbul ignore else */\r\n if (!hasDatasource(datasourceInfos, t.itemId, obj.id)) {\r\n datasourceInfos.push({\r\n itemId: t.itemId,\r\n layerId: obj.id,\r\n fields: obj.fields,\r\n basePath: t.itemId + \".layer\" + obj.id + \".fields\",\r\n url: getProp(t, \"item.url\"),\r\n ids: [],\r\n relationships: obj.relationships || [],\r\n adminLayerInfo: obj.adminLayerInfo || {}\r\n });\r\n }\r\n });\r\n }\r\n });\r\n return datasourceInfos;\r\n}\r\n\r\n/**\r\n * Creates a simple lookup object to quickly understand an items type and dependencies\r\n * and associated web map layer ids based on itemId\r\n *\r\n * @param templates List of solution templates\r\n * @returns The lookup object with type, dependencies, and webmap layer info\r\n * @private\r\n */\r\nexport function _getTemplateTypeHash(templates: IItemTemplate[]): any {\r\n const templateTypeHash: any = {};\r\n templates.forEach(template => {\r\n templateTypeHash[template.itemId] = {\r\n type: template.type,\r\n dependencies: template.dependencies\r\n };\r\n if (template.type === \"Web Map\") {\r\n _updateWebMapHashInfo(template, templateTypeHash[template.itemId]);\r\n }\r\n });\r\n return templateTypeHash;\r\n}\r\n\r\n/**\r\n * Updates the lookup object with webmap layer info\r\n * so we can know the id used within a map for a given feature service\r\n *\r\n * @param template A webmap solution template\r\n * @returns The lookup object with webmap layer info added\r\n * @private\r\n */\r\nexport function _updateWebMapHashInfo(template: IItemTemplate, hashItem: any) {\r\n const operationalLayers: any[] =\r\n getProp(template, \"data.operationalLayers\") || [];\r\n\r\n const tables: any[] = getProp(template, \"data.tables\") || [];\r\n const layersAndTables: any[] = operationalLayers.concat(tables);\r\n if (layersAndTables && layersAndTables.length > 0) {\r\n hashItem.layersAndTables = [];\r\n layersAndTables.forEach(layer => {\r\n const obj: any = {};\r\n let itemId: any;\r\n /* istanbul ignore else */\r\n if (layer.itemId) {\r\n itemId = layer.itemId;\r\n }\r\n /* istanbul ignore else */\r\n if (itemId) {\r\n obj[cleanLayerBasedItemId(itemId)] = {\r\n id: layer.id,\r\n url: layer.url\r\n };\r\n hashItem.layersAndTables.push(obj);\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Updates a templatized datasource URL with a layer id.\r\n *\r\n * @param dataSourceUrl Templatized datasource URL\r\n * @param layerId Layer id\r\n * @returns string Amended datasource URL\r\n * @private\r\n */\r\nexport function _addLayerIdToDatasourceUrl(\r\n datasourceUrl?: string,\r\n layerId?: any\r\n): string {\r\n return datasourceUrl && !isNaN(layerId)\r\n ? datasourceUrl.replace(/[.]/, \".layer\" + layerId + \".\")\r\n : \"\";\r\n}\r\n\r\n/**\r\n * Updates the datasource info objects by passing the webmap layer IDs from the lookup hash\r\n * to the underlying feature service datasource infos\r\n *\r\n * @param datasourceInfos A webmap solution template\r\n * @param templateTypeHash A simple lookup object populated with key item info\r\n * @returns The updated datasource infos\r\n * @private\r\n */\r\nexport function _addMapLayerIds(\r\n datasourceInfos: IDatasourceInfo[],\r\n templateTypeHash: any\r\n): IDatasourceInfo[] {\r\n const webMapIds: any[] = Object.keys(templateTypeHash).filter(k => {\r\n if (templateTypeHash[k].type === \"Web Map\") {\r\n return templateTypeHash[k];\r\n }\r\n });\r\n\r\n return datasourceInfos.map(ds => {\r\n webMapIds.forEach(webMapId => {\r\n templateTypeHash[webMapId].layersAndTables.forEach((opLayer: any) => {\r\n const opLayerInfo: any = opLayer[ds.itemId];\r\n const url: string = _addLayerIdToDatasourceUrl(ds.url, ds.layerId);\r\n if (\r\n opLayerInfo &&\r\n url === opLayerInfo.url &&\r\n ds.ids.indexOf(opLayerInfo.id) < 0\r\n ) {\r\n ds.ids.push(opLayerInfo.id);\r\n }\r\n });\r\n });\r\n return ds;\r\n });\r\n}\r\n\r\n/**\r\n * Get feature service item IDs from applications webmaps\r\n * As they are not explict dependencies of the application but are needed for field references\r\n *\r\n * @param template A webmap solution template\r\n * @param templateTypeHash A simple lookup object populated with key item info\r\n * @returns A lsit of feature service item IDs\r\n * @private\r\n */\r\nexport function _getWebMapFSDependencies(\r\n template: IItemTemplate,\r\n templateTypeHash: any\r\n): string[] {\r\n const webMapFSDependencies: string[] = [];\r\n template.dependencies.forEach(dep => {\r\n const depObj: any = templateTypeHash[dep];\r\n if (depObj.type === \"Web Map\") {\r\n depObj.dependencies.forEach((depObjDependency: string) => {\r\n /* istanbul ignore else */\r\n if (templateTypeHash[depObjDependency].type === \"Feature Service\") {\r\n webMapFSDependencies.push(depObjDependency);\r\n }\r\n });\r\n }\r\n });\r\n return webMapFSDependencies;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n SolutionTemplateFormatVersion,\r\n EItemProgressStatus,\r\n failWithIds,\r\n getIDs,\r\n getPortal,\r\n getTemplateById,\r\n globalStringReplace,\r\n ICreateSolutionOptions,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n IItemUpdate,\r\n ISolutionItemData,\r\n ISourceFile,\r\n isWorkforceProject,\r\n removeTemplate,\r\n replaceInTemplate,\r\n SItemProgressStatus,\r\n copyFilesToStorageItem,\r\n postProcessWorkforceTemplates,\r\n updateItem,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { getProp, getWithDefault } from \"@esri/hub-common\";\r\nimport {\r\n createItemTemplate,\r\n postProcessFieldReferences\r\n} from \"../createItemTemplate\";\r\n\r\n/**\r\n * Adds a list of AGO item ids to a solution item.\r\n *\r\n * @param solutionItemId AGO id of solution to receive items\r\n * @param options Customizations for creating the solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @returns A promise that resolves with the AGO id of the updated solution\r\n * @internal\r\n */\r\nexport function addContentToSolution(\r\n solutionItemId: string,\r\n options: ICreateSolutionOptions,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession\r\n): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n if (!options.itemIds || options.itemIds.length === 0) {\r\n resolve(solutionItemId);\r\n return;\r\n }\r\n\r\n // Prepare feedback mechanism\r\n let totalEstimatedCost = 2 * options.itemIds.length + 1; // solution items, plus avoid divide by 0\r\n let percentDone: number = 16; // allow for previous creation work\r\n let progressPercentStep = (95 - percentDone) / totalEstimatedCost; // leave some % for caller for wrapup\r\n\r\n const failedItemIds: string[] = [];\r\n let totalExpended = 0;\r\n let statusOK = true;\r\n const itemProgressCallback: IItemProgressCallback = (\r\n itemId: string,\r\n status: EItemProgressStatus,\r\n costUsed: number\r\n ) => {\r\n // ---------------------------------------------------------------------------------------------------------------\r\n if (options.itemIds.indexOf(itemId) < 0) {\r\n // New item--a dependency that wasn't in the supplied list of itemIds; add it to the list\r\n // and recalculate the progress percent step based on how much progress remains to be done\r\n options.itemIds.push(itemId);\r\n\r\n totalEstimatedCost += 2;\r\n progressPercentStep =\r\n (95 - percentDone) / (totalEstimatedCost - totalExpended);\r\n }\r\n\r\n totalExpended += costUsed;\r\n percentDone += progressPercentStep * costUsed;\r\n if (options.progressCallback) {\r\n options.progressCallback(Math.round(percentDone), options.jobId);\r\n }\r\n\r\n /* istanbul ignore if */\r\n if (options.consoleProgress) {\r\n console.log(\r\n Date.now(),\r\n itemId,\r\n options.jobId ?? \"\",\r\n SItemProgressStatus[status],\r\n percentDone.toFixed(0) + \"%\",\r\n costUsed\r\n );\r\n }\r\n\r\n if (status === EItemProgressStatus.Failed) {\r\n let error = \"\";\r\n solutionTemplates.some(t => {\r\n /* istanbul ignore else */\r\n if (t.itemId === itemId) {\r\n /* istanbul ignore else */\r\n if (getProp(t, \"properties.error\")) {\r\n error = t.properties.error;\r\n try {\r\n // parse for better console logging if we can\r\n error = JSON.parse(error);\r\n } catch (e) {\r\n /* istanbul ignore next */\r\n // do nothing and show the error as is\r\n }\r\n }\r\n return true;\r\n }\r\n });\r\n removeTemplate(solutionTemplates, itemId);\r\n if (failedItemIds.indexOf(itemId) < 0) {\r\n failedItemIds.push(itemId);\r\n }\r\n statusOK = false;\r\n } else if (status === EItemProgressStatus.Ignored) {\r\n removeTemplate(solutionTemplates, itemId);\r\n }\r\n\r\n return statusOK;\r\n // ---------------------------------------------------------------------------------------------------------------\r\n };\r\n\r\n // Replacement dictionary and created templates\r\n const templateDictionary = options.templateDictionary ?? {};\r\n let solutionTemplates: IItemTemplate[] = [];\r\n\r\n // Handle a list of one or more AGO ids by stepping through the list\r\n // and calling this function recursively\r\n const getItemsPromise: Array<Promise<ISourceFile[]>> = [];\r\n options.itemIds.forEach(itemId => {\r\n const createDef = createItemTemplate(\r\n solutionItemId,\r\n itemId,\r\n templateDictionary,\r\n srcAuthentication,\r\n destAuthentication,\r\n solutionTemplates,\r\n itemProgressCallback\r\n );\r\n getItemsPromise.push(createDef);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all(getItemsPromise).then(\r\n (multipleResourceItemFiles: ISourceFile[][]) => {\r\n if (failedItemIds.length > 0) {\r\n reject(\r\n failWithIds(\r\n failedItemIds,\r\n \"One or more items cannot be converted into templates\"\r\n )\r\n );\r\n } else {\r\n if (solutionTemplates.length > 0) {\r\n // Coalesce the resource file paths from the created templates\r\n let resourceItemFiles: ISourceFile[] = multipleResourceItemFiles.reduce(\r\n (accumulator, currentValue) => accumulator.concat(currentValue),\r\n [] as ISourceFile[]\r\n );\r\n\r\n // test for and update group dependencies and other post-processing\r\n solutionTemplates = _postProcessGroupDependencies(\r\n solutionTemplates\r\n );\r\n solutionTemplates = postProcessWorkforceTemplates(\r\n solutionTemplates\r\n );\r\n\r\n // Filter out any resources from items that have been removed from the templates, such as\r\n // Living Atlas layers\r\n solutionTemplates = _postProcessIgnoredItems(solutionTemplates);\r\n const templateIds = solutionTemplates.map(\r\n template => template.itemId\r\n );\r\n\r\n // Coalesce the resource file paths from the created templates\r\n resourceItemFiles = resourceItemFiles.filter(file =>\r\n templateIds.includes(file.itemId)\r\n );\r\n\r\n // Send the accumulated resources to the solution item\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n copyFilesToStorageItem(\r\n resourceItemFiles,\r\n solutionItemId,\r\n destAuthentication\r\n ).then(() => {\r\n _templatizeSolutionIds(solutionTemplates);\r\n _simplifyUrlsInItemDescriptions(solutionTemplates);\r\n _replaceDictionaryItemsInObject(\r\n templateDictionary,\r\n solutionTemplates\r\n );\r\n _templatizeOrgUrl(solutionTemplates, destAuthentication).then(\r\n solutionTemplates2 => {\r\n // Update solution item with its data JSON\r\n const solutionData: ISolutionItemData = {\r\n metadata: { version: SolutionTemplateFormatVersion },\r\n templates: options.templatizeFields\r\n ? postProcessFieldReferences(solutionTemplates2)\r\n : solutionTemplates2\r\n };\r\n const itemInfo: IItemUpdate = {\r\n id: solutionItemId,\r\n text: solutionData\r\n };\r\n updateItem(itemInfo, destAuthentication).then(() => {\r\n resolve(solutionItemId);\r\n }, reject);\r\n },\r\n reject\r\n );\r\n });\r\n } else {\r\n resolve(solutionItemId);\r\n }\r\n }\r\n }\r\n );\r\n });\r\n}\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Gets the dependencies of an item by merging its dependencies list with item references in template variables.\r\n *\r\n * @param template Template to examine\r\n * @returns List of dependency ids\r\n * @private\r\n */\r\nexport function _getDependencies(template: IItemTemplate): string[] {\r\n // Get all dependencies\r\n let deps = template.dependencies.concat(\r\n _getIdsOutOfTemplateVariables(\r\n _getTemplateVariables(JSON.stringify(template.data))\r\n )\r\n );\r\n\r\n // Remove duplicates and self-references\r\n deps.sort();\r\n deps = deps.filter((elem, index, array) => {\r\n if (elem === template.itemId) {\r\n return false;\r\n } else if (index > 0) {\r\n return elem !== array[index - 1];\r\n } else {\r\n return true;\r\n }\r\n });\r\n\r\n return deps;\r\n}\r\n\r\n/**\r\n * Extracts AGO ids out of template variables.\r\n *\r\n * @param variables List of template variables to examine\r\n * @returns List of AGO ids referenced in `variables`\r\n * @private\r\n */\r\nexport function _getIdsOutOfTemplateVariables(variables: string[]): string[] {\r\n return variables\r\n .map(variable => {\r\n const idList = variable.match(/[0-9A-F]{32}/i); // is it a guid?\r\n if (idList) {\r\n return idList[0];\r\n } else {\r\n return null;\r\n }\r\n })\r\n .filter(variable => !!variable);\r\n}\r\n\r\n/**\r\n * Creates a list of item URLs.\r\n *\r\n * @param templates Templates to check for URLs\r\n * @returns List of URLs\r\n * @private\r\n */\r\nexport function _getSolutionItemUrls(templates: IItemTemplate[]): string[][] {\r\n const solutionUrls: string[][] = [];\r\n templates.forEach(template => {\r\n /* istanbul ignore else */\r\n if (template.item.origUrl) {\r\n solutionUrls.push([template.itemId, template.item.origUrl]);\r\n }\r\n });\r\n return solutionUrls;\r\n}\r\n\r\n/**\r\n * Extracts template variables out of a string.\r\n *\r\n * @param text String to examine\r\n * @returns List of template variables found in string\r\n * @private\r\n */\r\nexport function _getTemplateVariables(text: string): string[] {\r\n return (text.match(/{{[a-z0-9.]*}}/gi) || []) // find variable\r\n .map(variable => variable.substring(2, variable.length - 2)); // remove \"{{\" & \"}}\"\r\n}\r\n\r\n/**\r\n * Update the items dependencies and groups arrays\r\n *\r\n * @param templates The array of templates to evaluate\r\n * @returns Updated version of the templates\r\n * @private\r\n */\r\nexport function _postProcessGroupDependencies(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n return templates.map((template: IItemTemplate) => {\r\n if (template.type === \"Group\") {\r\n const id: string = template.itemId;\r\n // remove group dependencies if we find a circular dependency with one of its items\r\n let removeDependencies: boolean = false;\r\n // before we remove update each dependants groups array\r\n template.dependencies.forEach(dependencyId => {\r\n const dependantTemplate: IItemTemplate = getTemplateById(\r\n templates,\r\n dependencyId\r\n );\r\n // Not all items shared to the group will exist in the templates array\r\n // i.e. Hub Initiative items or any other unsupported types\r\n if (dependantTemplate) {\r\n // check if the group is in the dependantTemplate's list of dependencies\r\n const gIndex = getWithDefault(\r\n dependantTemplate,\r\n \"dependencies\",\r\n []\r\n ).indexOf(id);\r\n\r\n /* istanbul ignore else */\r\n if (gIndex > -1) {\r\n removeDependencies = true;\r\n }\r\n // if the dependant template does not have the group id\r\n // in it's groups array, add it\r\n const groups = getWithDefault(dependantTemplate, \"groups\", []);\r\n if (groups.indexOf(id) === -1) {\r\n groups.push(id);\r\n dependantTemplate.groups = groups;\r\n }\r\n }\r\n });\r\n if (removeDependencies) {\r\n template.dependencies = [];\r\n }\r\n }\r\n return template;\r\n });\r\n}\r\n\r\n/**\r\n * Check for feature service items that have been flagged for invalid designations.\r\n * Remove templates that have invalid designations from the solution item and other item dependencies.\r\n * Clean up any references to items with invalid designations in the other templates.\r\n *\r\n * @param templates The array of templates to evaluate\r\n * @returns Updated version of the templates\r\n * @private\r\n */\r\nexport function _postProcessIgnoredItems(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n // replace in template\r\n const updateDictionary: any = templates.reduce((result, template) => {\r\n return template.properties.hasInvalidDesignations\r\n ? Object.assign(result, template.data)\r\n : result;\r\n }, {});\r\n Object.keys(updateDictionary).forEach(k => {\r\n removeTemplate(templates, k);\r\n templates = templates.map(t => {\r\n t.dependencies = t.dependencies.filter(id => id !== k);\r\n return replaceInTemplate(t, updateDictionary);\r\n });\r\n });\r\n\r\n return templates;\r\n}\r\n\r\n/**\r\n * Recursively runs through an object to find and replace any strings found in a dictionary.\r\n *\r\n * @param templateDictionary Hash of things to be replaced\r\n * @param obj Object to be examined\r\n * @private\r\n */\r\nexport function _replaceDictionaryItemsInObject(hash: any, obj: any): any {\r\n /* istanbul ignore else */\r\n if (obj) {\r\n Object.keys(obj).forEach(prop => {\r\n const propObj = obj[prop];\r\n if (propObj) {\r\n if (typeof propObj === \"object\") {\r\n _replaceDictionaryItemsInObject(hash, propObj);\r\n } else if (typeof propObj === \"string\") {\r\n obj[prop] = hash[propObj] || propObj;\r\n }\r\n }\r\n });\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Recursively runs through an object to find and templatize any remaining references to solution's items.\r\n *\r\n * @param ids Ids to be replaced in strings found in object\r\n * @param obj Object to be examined\r\n * @private\r\n */\r\nexport function _replaceRemainingIdsInObject(ids: string[], obj: any): any {\r\n /* istanbul ignore else */\r\n if (obj) {\r\n Object.keys(obj).forEach(prop => {\r\n const propObj = obj[prop];\r\n if (propObj) {\r\n if (typeof propObj === \"object\") {\r\n _replaceRemainingIdsInObject(ids, propObj);\r\n } else if (typeof propObj === \"string\") {\r\n obj[prop] = _replaceRemainingIdsInString(ids, propObj);\r\n }\r\n }\r\n });\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Templatizes ids from a list in a string if they're not already templatized.\r\n *\r\n * @param ids Ids to be replaced in source string\r\n * @param str Source string to be examined\r\n * @returns A copy of the source string with any templatization changes\r\n * @private\r\n */\r\nexport function _replaceRemainingIdsInString(\r\n ids: string[],\r\n str: string\r\n): string {\r\n let updatedStr = str;\r\n const untemplatizedIds = getIDs(str);\r\n if (untemplatizedIds.length > 0) {\r\n untemplatizedIds.forEach(id => {\r\n if (ids.includes(id)) {\r\n const re = new RegExp(\"({*)\" + id, \"gi\");\r\n updatedStr = updatedStr.replace(re, match =>\r\n match.indexOf(\"{{\") < 0\r\n ? \"{{\" + id.replace(\"{\", \"\") + \".itemId}}\"\r\n : match\r\n );\r\n }\r\n });\r\n }\r\n return updatedStr;\r\n}\r\n\r\n/**\r\n * Finds and templatizes any URLs in solution items' descriptions.\r\n *\r\n * @param templates The array of templates to evaluate, modified in place\r\n * @private\r\n */\r\nexport function _simplifyUrlsInItemDescriptions(\r\n templates: IItemTemplate[]\r\n): void {\r\n // Get the urls in the solution along with their item ids & convert the id into the form\r\n // \"{{fcb2bf2837a6404ebb418a1f805f976a.url}}\"\r\n const solutionUrls = _getSolutionItemUrls(templates).map(idUrl => [\r\n \"{{\" + idUrl[0] + \".url}}\",\r\n idUrl[1]\r\n ]);\r\n\r\n /* istanbul ignore else */\r\n if (solutionUrls.length > 0) {\r\n // Make the replacements\r\n templates.forEach(template => {\r\n solutionUrls.forEach(\r\n // TypeScript for es2015 doesn't have a definition for `replaceAll`\r\n idUrl => {\r\n /* istanbul ignore else */\r\n if (template.item.description) {\r\n template.item.description = (template.item\r\n .description as any).replaceAll(idUrl[1], idUrl[0]);\r\n }\r\n }\r\n );\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Templatizes occurrences of the URL to the user's organization in the `item` and `data` template sections.\r\n *\r\n * @param templates The array of templates to evaluate; templates is modified in place\r\n * @param destAuthentication Credentials for request organization info\r\n * @returns Promise resolving with `templates`\r\n * @private\r\n */\r\nexport function _templatizeOrgUrl(\r\n templates: IItemTemplate[],\r\n destAuthentication: UserSession\r\n): Promise<IItemTemplate[]> {\r\n return new Promise((resolve, reject) => {\r\n // Get the org's URL\r\n getPortal(null, destAuthentication).then(org => {\r\n const orgUrl = \"https://\" + org.urlKey + \".\" + org.customBaseUrl;\r\n const templatizedOrgUrl = \"{{portalBaseUrl}}\";\r\n\r\n // Cycle through each of the items in the template and scan the `item` and `data` sections of each for replacements\r\n templates.forEach((template: IItemTemplate) => {\r\n globalStringReplace(\r\n template.item,\r\n new RegExp(orgUrl, \"gi\"),\r\n templatizedOrgUrl\r\n );\r\n globalStringReplace(\r\n template.data,\r\n new RegExp(orgUrl, \"gi\"),\r\n templatizedOrgUrl\r\n );\r\n });\r\n resolve(templates);\r\n }, reject);\r\n });\r\n}\r\n\r\n/**\r\n * Finds and templatizes any references to solution's items.\r\n *\r\n * @param templates The array of templates to evaluate, modified in place\r\n * @private\r\n */\r\nexport function _templatizeSolutionIds(templates: IItemTemplate[]): void {\r\n // Get the ids in the solution\r\n const solutionIds: string[] = templates.map(\r\n (template: IItemTemplate) => template.itemId\r\n );\r\n\r\n // Cycle through each of the items in the template and\r\n // 1. templatize untemplatized ids in our solution in the `item` and `data` sections;\r\n // 2. update the `dependencies` section\r\n templates.forEach((template: IItemTemplate) => {\r\n _replaceRemainingIdsInObject(solutionIds, template.item);\r\n _replaceRemainingIdsInObject(solutionIds, template.data);\r\n /* istanbul ignore else */\r\n if (template.type !== \"Group\" && !isWorkforceProject(template)) {\r\n template.dependencies = _getDependencies(template);\r\n }\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation of a Solution item.\r\n *\r\n * @module creator\r\n */\r\n\r\nimport {\r\n appendQueryParam,\r\n createItemWithData,\r\n createLongId,\r\n createShortId,\r\n CURRENT_SCHEMA_VERSION,\r\n generateSourceThumbnailUrl,\r\n getBlobAsFile,\r\n getFilenameFromUrl,\r\n getGroupBase,\r\n getGroupContents,\r\n getItemBase,\r\n getPortal,\r\n getUser,\r\n getVelocityUrlBase,\r\n ICreateSolutionOptions,\r\n ISolutionItemData,\r\n IGroup,\r\n IItem,\r\n removeItem,\r\n sanitizeJSONAndReportChanges,\r\n setLocationTrackingEnabled,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { failSafe, IModel } from \"@esri/hub-common\";\r\nimport { addContentToSolution } from \"./helpers/add-content-to-solution\";\r\n\r\n// Simple no-op to clean up progressCallback management\r\nconst noOp = () => {};\r\n\r\n/**\r\n * Creates a solution item.\r\n *\r\n * @param sourceId AGO id of group whose contents are to be added to solution or of an item to convert into a solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @param options Customizations for creating the solution\r\n * @returns A promise that resolves with the AGO id of the new solution\r\n */\r\nexport function createSolution(\r\n sourceId: string,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession,\r\n options?: ICreateSolutionOptions\r\n): Promise<string> {\r\n const createOptions: ICreateSolutionOptions = options || {};\r\n const progressCb = createOptions.progressCallback || noOp;\r\n createOptions.templateDictionary = Object.assign(\r\n {},\r\n createOptions.templateDictionary\r\n );\r\n\r\n progressCb(1); // let the caller know that we've started\r\n\r\n // Assume that source is a group and try to get group's information\r\n return Promise.all([\r\n getGroupBase(sourceId, srcAuthentication),\r\n getGroupContents(sourceId, srcAuthentication),\r\n getVelocityUrlBase(srcAuthentication, createOptions.templateDictionary)\r\n ])\r\n .then(\r\n // Group fetches worked; assumption was correct\r\n responses => {\r\n createOptions.itemIds = responses[1];\r\n progressCb(15);\r\n\r\n return new Promise<ICreateSolutionOptions>(resolve => {\r\n // Update the createOptions with values from the group\r\n resolve(\r\n _applySourceToCreateOptions(\r\n createOptions,\r\n responses[0],\r\n srcAuthentication,\r\n true\r\n )\r\n );\r\n });\r\n },\r\n\r\n // Assumption incorrect; try source as an item\r\n () => {\r\n return new Promise<ICreateSolutionOptions>((resolve, reject) => {\r\n createOptions.itemIds = [sourceId];\r\n getItemBase(sourceId, srcAuthentication).then(\r\n // Update the createOptions with values from the item\r\n itemBase =>\r\n resolve(\r\n _applySourceToCreateOptions(\r\n createOptions,\r\n itemBase,\r\n srcAuthentication,\r\n false\r\n )\r\n ),\r\n reject\r\n );\r\n });\r\n }\r\n )\r\n\r\n .then(createOptions => {\r\n return new Promise<ICreateSolutionOptions>((resolve, reject) => {\r\n Promise.all([\r\n getPortal(\"\", srcAuthentication),\r\n getUser(srcAuthentication)\r\n ]).then(responses => {\r\n // check tracking\r\n const [portalResponse, userResponse] = responses;\r\n setLocationTrackingEnabled(\r\n portalResponse,\r\n userResponse,\r\n createOptions.templateDictionary\r\n );\r\n resolve(createOptions);\r\n }, reject);\r\n });\r\n })\r\n\r\n .then(\r\n // Use a copy of the thumbnail rather than a URL to it\r\n createOptions => {\r\n return _addThumbnailFileToCreateOptions(\r\n createOptions,\r\n srcAuthentication\r\n );\r\n }\r\n )\r\n\r\n .then(\r\n // Create a solution\r\n createOptions => {\r\n return _createSolutionFromItemIds(\r\n createOptions,\r\n srcAuthentication,\r\n destAuthentication\r\n );\r\n }\r\n )\r\n\r\n .then(\r\n // Successfully created solution\r\n createdSolutionId => {\r\n progressCb(100); // finished\r\n return createdSolutionId;\r\n },\r\n\r\n // Error fetching group, group contents, or item, or error creating solution from ids\r\n error => {\r\n progressCb(1);\r\n console.error(error);\r\n throw error;\r\n }\r\n );\r\n}\r\n\r\n/**\r\n * Update the createOptions with the group properties\r\n *\r\n * @param createOptions\r\n * @param sourceInfo\r\n * @param authentication\r\n * @param isGroup Boolean to indicate if the files are associated with a group or item\r\n * @private\r\n */\r\nexport function _applySourceToCreateOptions(\r\n createOptions: ICreateSolutionOptions,\r\n sourceInfo: IGroup | IItem,\r\n srcAuthentication: UserSession,\r\n isGroup = false\r\n): ICreateSolutionOptions {\r\n // Create a solution from the group's or item's contents,\r\n // using the group's or item's information as defaults for the solution item\r\n [\"title\", \"snippet\", \"description\", \"tags\"].forEach(prop => {\r\n createOptions[prop] = createOptions[prop] ?? sourceInfo[prop];\r\n });\r\n\r\n if (!createOptions.thumbnailurl && sourceInfo.thumbnail) {\r\n // Get the full path to the thumbnail\r\n createOptions.thumbnailurl = generateSourceThumbnailUrl(\r\n srcAuthentication.portal,\r\n sourceInfo.id,\r\n sourceInfo.thumbnail,\r\n isGroup\r\n );\r\n delete sourceInfo.thumbnail;\r\n }\r\n\r\n return createOptions;\r\n}\r\n\r\n/**\r\n * Update the createOptions with the thumbnail file\r\n *\r\n * @param createOptions\r\n * @param srcAuthentication\r\n * @private\r\n */\r\nexport function _addThumbnailFileToCreateOptions(\r\n createOptions: ICreateSolutionOptions,\r\n srcAuthentication: UserSession\r\n): Promise<ICreateSolutionOptions> {\r\n return new Promise<ICreateSolutionOptions>(resolve => {\r\n if (!createOptions.thumbnail && createOptions.thumbnailurl) {\r\n // Figure out the thumbnail's filename\r\n const filename =\r\n getFilenameFromUrl(createOptions.thumbnailurl) || \"thumbnail\";\r\n const thumbnailurl = appendQueryParam(\r\n createOptions.thumbnailurl,\r\n \"w=400\"\r\n );\r\n delete createOptions.thumbnailurl;\r\n\r\n // Fetch the thumbnail\r\n getBlobAsFile(thumbnailurl, filename, srcAuthentication).then(\r\n thumbnail => {\r\n createOptions.thumbnail = thumbnail;\r\n resolve(createOptions);\r\n },\r\n () => {\r\n resolve(createOptions);\r\n }\r\n );\r\n } else {\r\n resolve(createOptions);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Creates a solution item using a list of AGO item ids.\r\n *\r\n * @param options Customizations for creating the solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its\r\n * there is a problem updating it\r\n * @private\r\n */\r\nexport function _createSolutionFromItemIds(\r\n options: ICreateSolutionOptions,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession\r\n): Promise<string> {\r\n let solutionId = \"\";\r\n // Create a solution from the list of items\r\n return _createSolutionItem(destAuthentication, options)\r\n .then(id => {\r\n solutionId = id;\r\n // Add list of items to the new solution\r\n return addContentToSolution(\r\n solutionId,\r\n options,\r\n srcAuthentication,\r\n destAuthentication\r\n );\r\n })\r\n .catch(addError => {\r\n // If the solution item got created, delete it\r\n if (solutionId) {\r\n const failSafeRemove = failSafe(removeItem, { success: true });\r\n return failSafeRemove(solutionId, destAuthentication).then(() => {\r\n throw addError;\r\n });\r\n } else {\r\n throw addError;\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Creates an empty solution item.\r\n *\r\n * @param authentication Credentials for the request\r\n * @param options Customizations for creating the solution\r\n * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its\r\n * there is a problem updating its thumbnail\r\n * @private\r\n */\r\nexport function _createSolutionItem(\r\n authentication: UserSession,\r\n options?: ICreateSolutionOptions\r\n): Promise<string> {\r\n const model = _createSolutionItemModel(options);\r\n\r\n // Create new solution item\r\n delete model.item.thumbnailurl;\r\n model.item.thumbnail = options?.thumbnail;\r\n return createItemWithData(\r\n model.item,\r\n model.data,\r\n authentication,\r\n options?.folderId\r\n ).then(createResponse => {\r\n return Promise.resolve(createResponse.id);\r\n });\r\n}\r\n\r\n/**\r\n * Create the Solution Item model to be used to create\r\n * the Solution Item itself\r\n *\r\n * @param options\r\n * @private\r\n */\r\nexport function _createSolutionItemModel(options: any): IModel {\r\n // Solution uses all supplied tags but for deploy.* tags; that information goes into properties\r\n const creationTags = options?.tags ?? [];\r\n\r\n const solutionItem: any = {\r\n type: \"Solution\",\r\n title: options?.title ?? createShortId(),\r\n snippet: options?.snippet ?? \"\",\r\n description: options?.description ?? \"\",\r\n properties: {\r\n schemaVersion: CURRENT_SCHEMA_VERSION\r\n },\r\n thumbnailurl: options?.thumbnailurl ?? \"\",\r\n tags: creationTags.filter((tag: any) => !tag.startsWith(\"deploy.\")),\r\n typeKeywords: [\"Solution\", \"Template\"].concat(\r\n _getDeploymentProperties(creationTags)\r\n )\r\n };\r\n\r\n // ensure that snippet and description are not nefarious\r\n const sanitizedItem = sanitizeJSONAndReportChanges(solutionItem);\r\n\r\n const addlKeywords = options?.additionalTypeKeywords || [];\r\n sanitizedItem.typeKeywords = [].concat(\r\n solutionItem.typeKeywords,\r\n addlKeywords\r\n );\r\n\r\n const solutionData: ISolutionItemData = {\r\n metadata: {},\r\n templates: []\r\n };\r\n return {\r\n item: sanitizedItem,\r\n data: solutionData\r\n };\r\n}\r\n\r\n/**\r\n * Gets the deploy.id and deploy.version tag values.\r\n *\r\n * @param tags A list of item tags\r\n * @returns A list containing the two values found in the tags, or defaulting to a new GUID and \"1.0\", respectively,\r\n * as needed\r\n * @private\r\n */\r\nexport function _getDeploymentProperties(tags: string[]): string[] {\r\n return [\r\n \"solutionid-\" +\r\n (_getDeploymentProperty(\"deploy.id.\", tags) ?? createLongId()),\r\n \"solutionversion-\" +\r\n (_getDeploymentProperty(\"deploy.version.\", tags) ?? \"1.0\")\r\n ];\r\n}\r\n\r\n/**\r\n * Searches for a tag that has the specified prefix and returns the rest of the tag following that prefix.\r\n *\r\n * @param desiredTagPrefix Tag prefix to look for\r\n * @param tags A list of item tags\r\n * @returns The extracted value of the first matching tag or null if a tag with the specified prefix is not found\r\n * @private\r\n */\r\nexport function _getDeploymentProperty(\r\n desiredTagPrefix: string,\r\n tags: string[]\r\n): string | null {\r\n const foundTagAsList = tags.filter(tag => tag.startsWith(desiredTagPrefix));\r\n if (foundTagAsList.length > 0) {\r\n return foundTagAsList[0].substr(desiredTagPrefix.length);\r\n } else {\r\n return null;\r\n }\r\n}\r\n"],"names":["UNSUPPORTED","moduleMap","Group","VelocityProcessor","simpleTypes","featureLayer","Feed","undefined","KML","Tool","WFS","WMS","WMTS","Application","Dashboard","Form","formProcessor","HubPageProcessor","HubSiteProcessor","Mission","Notebook","notebookProcessor","quickcaptureProcessor","Solution","StoryMap","StoryMapProcessor","WebExperienceProcessor","fileProcessor","CSV","GeoJson","GeoPackage","Image","Layer","Layout","netCDF","PDF","Shapefile","Style","Undefined","Unsupported","createItemTemplate","solutionItemId","itemId","templateDictionary","srcAuthentication","destAuthentication","existingTemplates","itemProgressCallback","Promise","resolve","findTemplateInList","push","createPlaceholderTemplate","EItemProgressStatus","Started","getItemBase","catch","replaceTemplate","getGroupBase","then","itemInfo","sanitizeJSONAndReportChanges","url","id","origUrl","idTest","Array","isArray","typeKeywords","filter","v","test","tags","placeholder","itemType","type","item","Created","Cancelled","fail","itemHandler","convertItemToTemplate","itemTemplate","getItemResourcesPaths","SolutionTemplateFormatVersion","resourceItemFilePaths","thumbnail","getItemResourcesFilesFromPaths","resourceItemFiles","resources","concat","map","file","folder","filename","dependencies","length","Finished","dependentDfds","forEach","dependentId","all","dependentResourceItemFiles","reduce","accumulator","currentValue","error","properties","JSON","stringify","Failed","Ignored","postProcessFieldReferences","templates","datasourceInfos","_getDatasourceInfos","templateTypeHash","_getTemplateTypeHash","template","webMapFSDependencies","_getWebMapFSDependencies","dependantDatasources","ds","indexOf","_addMapLayerIds","t","layers","getProp","tables","obj","hasDatasource","layerId","fields","basePath","ids","relationships","adminLayerInfo","_updateWebMapHashInfo","hashItem","operationalLayers","layersAndTables","layer","cleanLayerBasedItemId","_addLayerIdToDatasourceUrl","datasourceUrl","isNaN","replace","webMapIds","Object","keys","k","webMapId","opLayer","opLayerInfo","dep","depObj","depObjDependency","addContentToSolution","options","reject","itemIds","totalEstimatedCost","percentDone","progressPercentStep","failedItemIds","totalExpended","statusOK","status","costUsed","progressCallback","Math","round","jobId","consoleProgress","console","log","Date","now","SItemProgressStatus","toFixed","solutionTemplates","some","parse","e","removeTemplate","getItemsPromise","createDef","multipleResourceItemFiles","failWithIds","removeDependencies","dependencyId","dependantTemplate","getTemplateById","getWithDefault","groups","postProcessWorkforceTemplates","updateDictionary","result","hasInvalidDesignations","assign","data","replaceInTemplate","_postProcessIgnoredItems","templateIds","includes","copyFilesToStorageItem","solutionIds","_replaceRemainingIdsInObject","isWorkforceProject","deps","text","variables","match","variable","substring","idList","sort","elem","index","array","_getDependencies","_templatizeSolutionIds","solutionUrls","_getSolutionItemUrls","idUrl","description","replaceAll","_simplifyUrlsInItemDescriptions","_replaceDictionaryItemsInObject","getPortal","org","orgUrl","urlKey","customBaseUrl","templatizedOrgUrl","globalStringReplace","RegExp","_templatizeOrgUrl","solutionTemplates2","solutionData","metadata","version","templatizeFields","updateItem","hash","prop","propObj","str","updatedStr","untemplatizedIds","getIDs","re","_replaceRemainingIdsInString","noOp","_applySourceToCreateOptions","createOptions","sourceInfo","isGroup","thumbnailurl","generateSourceThumbnailUrl","portal","_addThumbnailFileToCreateOptions","getFilenameFromUrl","appendQueryParam","getBlobAsFile","_createSolutionFromItemIds","solutionId","_createSolutionItem","addError","failSafe","removeItem","success","failSafeRemove","authentication","model","_createSolutionItemModel","createItemWithData","folderId","createResponse","creationTags","solutionItem","title","createShortId","snippet","schemaVersion","CURRENT_SCHEMA_VERSION","tag","startsWith","_getDeploymentProperties","sanitizedItem","addlKeywords","additionalTypeKeywords","_getDeploymentProperty","createLongId","desiredTagPrefix","foundTagAsList","substr","sourceId","progressCb","getGroupContents","getVelocityUrlBase","responses","itemBase","getUser","portalResponse","userResponse","setLocationTrackingEnabled","createdSolutionId"],"mappings":";;;;;;;;;;;;;;;;;m6CA+Ba,MAAAA,EAA6B,KAO7BC,EAAgC,CAG3CC,WAIA,oBAAqBC,EAAiBA,kBACtC,qBAAsBC,EAAWA,YACjC,kBAAmBC,EACnBC,KAAMH,EAAiBA,kBACvB,yBAAqBI,EACrB,uBAAmBA,EACnB,wBAAoBA,EACpB,6BAAyBA,EACzB,qBAAiBA,EACjB,qBAAiBA,EACjBC,SAAKD,EACL,cAAeF,EACf,gCAA4BE,EAC5B,qBAAsBJ,EAAiBA,kBACvC,sCAAkCI,EAClC,qBAAiBA,EACjB,sBAAkBA,EAClBE,UAAMF,EACN,2BAAuBA,EACvBG,SAAKH,EACLI,SAAKJ,EACLK,UAAML,EACN,gCAA4BA,EAI5B,oBAAgBA,EAChB,UAAWH,EAAWA,YACtB,YAAaA,EAAWA,YAIxBS,iBAAaN,EACbO,UAAWV,EAAWA,YACtB,kBAAcG,EACd,2BAAuBA,EACvB,iCAA6BA,EAC7BQ,KAAMC,EACN,iBAAkBhB,EAClB,WAAYiB,EAAgBA,iBAC5B,uBAAwBC,EAAgBA,iBACxC,iBAAkBd,EAAWA,YAC7B,qBAAiBG,EACjB,sBAAkBA,EAClB,yBAAqBA,EACrBY,aAASZ,EACT,0BAAsBA,EACtBa,SAAUC,EAAiBA,kBAC3B,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,EACvCK,EAAAA,2BACEF,EACAC,EACAlD,EAAcpN,oBAEhBM,EAAQ8M,KACPhG,QAINpG,MAECoM,GACSM,EACLN,EACAnN,KAKLe,MAECoM,GACSU,EACLV,EACAnN,EACAC,KAKLc,MAECwP,IACET,EAAW,KACJS,KAITzM,IAGE,MAFAgM,EAAW,GACX5H,QAAQpE,MAAMA,GACRA"}
|
|
1
|
+
{"version":3,"file":"creator.umd.min.js","sources":["../../src/module-map.ts","../../src/createItemTemplate.ts","../../src/helpers/add-content-to-solution.ts","../../src/creator.ts"],"sourcesContent":["/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport { moduleHandler, IItemTypeModuleMap } from \"@esri/solution-common\";\r\nimport * as featureLayer from \"@esri/solution-feature-layer\";\r\nimport * as fileProcessor from \"@esri/solution-file\";\r\nimport * as formProcessor from \"@esri/solution-form\";\r\nimport * as group from \"@esri/solution-group\";\r\nimport {\r\n simpleTypes,\r\n notebookProcessor,\r\n quickcaptureProcessor\r\n} from \"@esri/solution-simple-types\";\r\nimport { StoryMapProcessor } from \"@esri/solution-storymap\";\r\nimport { VelocityProcessor } from \"@esri/solution-velocity\";\r\nimport { WebExperienceProcessor } from \"@esri/solution-web-experience\";\r\nimport { HubPageProcessor, HubSiteProcessor } from \"@esri/solution-hub-types\";\r\n\r\nexport const UNSUPPORTED: moduleHandler = null;\r\n\r\n/**\r\n * Mapping from item type to module with type-specific template-handling code.\r\n * AGO types come from a blend of arcgis-portal-app\\src\\js\\arcgisonline\\pages\\item\\_Info.js and\r\n * arcgis-portal-app\\src\\js\\arcgis-components\\src\\_utils\\metadata\\item\\displayName.ts\r\n */\r\nexport const moduleMap: IItemTypeModuleMap = {\r\n ////////////////////////////////////////////////////////\r\n // Group type\r\n Group: group,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Layer types\r\n \"Big Data Analytic\": VelocityProcessor,\r\n \"Feature Collection\": simpleTypes,\r\n \"Feature Service\": featureLayer,\r\n Feed: VelocityProcessor,\r\n \"Geocoding Service\": undefined,\r\n \"Geodata Service\": undefined,\r\n \"Geometry Service\": undefined,\r\n \"Geoprocessing Service\": undefined,\r\n \"Globe Service\": undefined,\r\n \"Image Service\": undefined,\r\n KML: undefined,\r\n \"Map Service\": featureLayer,\r\n \"Network Analysis Service\": undefined,\r\n \"Real Time Analytic\": VelocityProcessor,\r\n \"Relational Database Connection\": undefined,\r\n \"Scene Service\": undefined,\r\n \"Stream Service\": undefined,\r\n Tool: undefined,\r\n \"Vector Tile Service\": undefined,\r\n WFS: undefined,\r\n WMS: undefined,\r\n WMTS: undefined,\r\n \"Workflow Manager Service\": undefined,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Map types\r\n \"3D Web Scene\": undefined,\r\n \"Web Map\": simpleTypes,\r\n \"Web Scene\": simpleTypes,\r\n\r\n ////////////////////////////////////////////////////////\r\n // App types\r\n Application: undefined,\r\n Dashboard: simpleTypes,\r\n \"Data Store\": undefined,\r\n \"Desktop Application\": undefined,\r\n \"Excalibur Imagery Project\": undefined,\r\n Form: formProcessor,\r\n \"Hub Initiative\": UNSUPPORTED,\r\n \"Hub Page\": HubPageProcessor,\r\n \"Hub Site Application\": HubSiteProcessor,\r\n \"Insights Model\": simpleTypes,\r\n \"Insights Page\": undefined,\r\n \"Insights Theme\": undefined,\r\n \"Insights Workbook\": undefined,\r\n Mission: undefined,\r\n \"Mobile Application\": undefined,\r\n Notebook: notebookProcessor,\r\n \"Oriented Imagery Catalog\": simpleTypes,\r\n \"Ortho Mapping Project\": undefined,\r\n \"QuickCapture Project\": quickcaptureProcessor,\r\n \"Site Application\": HubSiteProcessor,\r\n \"Site Page\": HubPageProcessor,\r\n Solution: UNSUPPORTED,\r\n StoryMap: StoryMapProcessor,\r\n \"Urban Model\": undefined,\r\n \"Web Experience Template\": undefined,\r\n \"Web Experience\": WebExperienceProcessor,\r\n \"Web Mapping Application\": simpleTypes,\r\n \"Workforce Project\": simpleTypes,\r\n\r\n ////////////////////////////////////////////////////////\r\n // File types\r\n \"360 VR Experience\": fileProcessor,\r\n \"AppBuilder Extension\": fileProcessor,\r\n \"AppBuilder Widget Package\": fileProcessor,\r\n \"Application Configuration\": fileProcessor,\r\n \"ArcGIS Pro Add In\": fileProcessor,\r\n \"ArcGIS Pro Configuration\": fileProcessor,\r\n \"ArcPad Package\": fileProcessor,\r\n \"Basemap Package\": fileProcessor,\r\n \"CAD Drawing\": fileProcessor,\r\n \"CityEngine Web Scene\": fileProcessor,\r\n \"Code Attachment\": UNSUPPORTED,\r\n \"Code Sample\": fileProcessor,\r\n \"Color Set\": fileProcessor,\r\n \"Compact Tile Package\": fileProcessor,\r\n \"CSV Collection\": fileProcessor,\r\n CSV: fileProcessor,\r\n \"Deep Learning Package\": fileProcessor,\r\n \"Desktop Add In\": fileProcessor,\r\n \"Desktop Application Template\": fileProcessor,\r\n \"Desktop Style\": fileProcessor,\r\n \"Document Link\": fileProcessor,\r\n \"Explorer Add In\": fileProcessor,\r\n \"Explorer Layer\": fileProcessor,\r\n \"Explorer Map\": fileProcessor,\r\n \"Feature Collection Template\": fileProcessor,\r\n \"File Geodatabase\": fileProcessor,\r\n GeoJson: fileProcessor,\r\n GeoPackage: fileProcessor,\r\n \"Geoprocessing Package\": fileProcessor,\r\n \"Geoprocessing Sample\": fileProcessor,\r\n \"Globe Document\": fileProcessor,\r\n \"Image Collection\": fileProcessor,\r\n Image: fileProcessor,\r\n \"iWork Keynote\": fileProcessor,\r\n \"iWork Numbers\": fileProcessor,\r\n \"iWork Pages\": fileProcessor,\r\n \"KML Collection\": fileProcessor,\r\n \"Layer Package\": fileProcessor,\r\n \"Layer Template\": fileProcessor,\r\n Layer: fileProcessor,\r\n Layout: fileProcessor,\r\n \"Locator Package\": fileProcessor,\r\n \"Map Document\": fileProcessor,\r\n \"Map Package\": fileProcessor,\r\n \"Map Template\": fileProcessor,\r\n \"Microsoft Excel\": fileProcessor,\r\n \"Microsoft Powerpoint\": fileProcessor,\r\n \"Microsoft Word\": fileProcessor,\r\n \"Mobile Basemap Package\": fileProcessor,\r\n \"Mobile Map Package\": fileProcessor,\r\n \"Mobile Scene Package\": fileProcessor,\r\n \"Native Application\": fileProcessor,\r\n \"Native Application Installer\": fileProcessor,\r\n \"Native Application Template\": fileProcessor,\r\n netCDF: fileProcessor,\r\n \"Operation View\": fileProcessor,\r\n \"Operations Dashboard Add In\": fileProcessor,\r\n \"Operations Dashboard Extension\": fileProcessor,\r\n PDF: fileProcessor,\r\n \"Pro Layer Package\": fileProcessor,\r\n \"Pro Layer\": fileProcessor,\r\n \"Pro Map Package\": fileProcessor,\r\n \"Pro Map\": fileProcessor,\r\n \"Pro Report\": fileProcessor,\r\n \"Project Package\": fileProcessor,\r\n \"Project Template\": fileProcessor,\r\n \"Published Map\": fileProcessor,\r\n \"Raster function template\": fileProcessor,\r\n \"Report Template\": fileProcessor,\r\n \"Rule Package\": fileProcessor,\r\n \"Scene Document\": fileProcessor,\r\n \"Scene Package\": fileProcessor,\r\n \"Service Definition\": fileProcessor,\r\n Shapefile: fileProcessor,\r\n \"Statistical Data Collection\": fileProcessor,\r\n Style: fileProcessor,\r\n \"Survey123 Add In\": fileProcessor,\r\n \"Symbol Set\": fileProcessor,\r\n \"Task File\": fileProcessor,\r\n \"Tile Package\": fileProcessor,\r\n \"Toolbox Package\": fileProcessor,\r\n \"Vector Tile Package\": fileProcessor,\r\n \"Viewer Configuration\": fileProcessor,\r\n \"Visio Document\": fileProcessor,\r\n \"Window Mobile Package\": fileProcessor,\r\n \"Windows Mobile Package\": fileProcessor,\r\n \"Windows Viewer Add In\": fileProcessor,\r\n \"Windows Viewer Configuration\": fileProcessor,\r\n \"Workflow Manager Package\": fileProcessor,\r\n\r\n ////////////////////////////////////////////////////////\r\n // Testing \"types\"\r\n Undefined: undefined,\r\n Unsupported: UNSUPPORTED\r\n};\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages creation of the template of a Solution item via the REST API.\r\n *\r\n * @module createItemTemplate\r\n */\r\n\r\nimport {\r\n cleanLayerBasedItemId,\r\n createPlaceholderTemplate,\r\n EItemProgressStatus,\r\n SolutionTemplateFormatVersion,\r\n findTemplateInList,\r\n getGroupBase,\r\n getItemBase,\r\n hasDatasource,\r\n IDatasourceInfo,\r\n IItemGeneralized,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n ISourceFile,\r\n ISourceFileCopyPath,\r\n getItemResourcesFilesFromPaths,\r\n getItemResourcesPaths,\r\n replaceTemplate,\r\n sanitizeJSONAndReportChanges,\r\n fail,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { getProp } from \"@esri/hub-common\";\r\nimport { moduleMap, UNSUPPORTED } from \"./module-map\";\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Creates template for an AGO item and its dependencies\r\n *\r\n * @param solutionItemId The solution to contain the item\r\n * @param itemId AGO id string\r\n * @param templateDictionary Hash of facts\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Authentication for requesting information from AGO about items to be included in solution item\r\n * @param existingTemplates A collection of AGO item templates that can be referenced by newly-created templates\r\n * @returns A promise which resolves with an array of resources for the item and its dependencies\r\n * @private\r\n */\r\nexport function createItemTemplate(\r\n solutionItemId: string,\r\n itemId: string,\r\n templateDictionary: any,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession,\r\n existingTemplates: IItemTemplate[],\r\n itemProgressCallback: IItemProgressCallback\r\n): Promise<ISourceFile[]> {\r\n return new Promise(resolve => {\r\n // Check if item and its dependents are already in list or are queued\r\n if (findTemplateInList(existingTemplates, itemId)) {\r\n resolve([]);\r\n } else {\r\n // Add the id as a placeholder to show that it is being fetched\r\n existingTemplates.push(createPlaceholderTemplate(itemId));\r\n\r\n itemProgressCallback(itemId, EItemProgressStatus.Started, 0);\r\n\r\n // Fetch the item\r\n getItemBase(itemId, srcAuthentication)\r\n .catch(() => {\r\n // If item query fails, try fetching item as a group\r\n // Change its placeholder from an empty type to the Group type so that we can later distinguish\r\n // between items and groups (the base info for a group doesn't include a type property)\r\n replaceTemplate(\r\n existingTemplates,\r\n itemId,\r\n createPlaceholderTemplate(itemId, \"Group\")\r\n );\r\n return getGroupBase(itemId, srcAuthentication);\r\n })\r\n .then(\r\n itemInfo => {\r\n itemInfo = sanitizeJSONAndReportChanges(itemInfo);\r\n\r\n // Save the URL as a symbol\r\n if (itemInfo.url) {\r\n templateDictionary[itemInfo.url] = \"{{\" + itemInfo.id + \".url}}\";\r\n itemInfo.origUrl = itemInfo.url;\r\n }\r\n\r\n const idTest: RegExp = /^source-[0-9A-F]{32}/i;\r\n // Remove any source-itemId type keywords\r\n /* istanbul ignore else */\r\n if (Array.isArray(itemInfo.typeKeywords)) {\r\n itemInfo.typeKeywords = itemInfo.typeKeywords.filter(v =>\r\n idTest.test(v) ? false : true\r\n );\r\n }\r\n // Remove any source-itemId tags\r\n /* istanbul ignore else */\r\n if (Array.isArray(itemInfo.tags)) {\r\n itemInfo.tags = itemInfo.tags.filter(v =>\r\n idTest.test(v) ? false : true\r\n );\r\n }\r\n\r\n const placeholder = findTemplateInList(existingTemplates, itemId);\r\n let itemType = placeholder.type;\r\n if (!itemType) {\r\n // Groups have this defined when their placeholder is created\r\n itemType = itemInfo.type;\r\n placeholder.type = itemType;\r\n }\r\n if (!itemInfo.type) {\r\n itemInfo.type = itemType; // Groups don't have this property, so we'll patch it in\r\n }\r\n placeholder.item = {\r\n ...itemInfo\r\n } as IItemGeneralized;\r\n\r\n // Interrupt process if progress callback returns `false`\r\n if (!itemProgressCallback(itemId, EItemProgressStatus.Created, 1)) {\r\n itemProgressCallback(itemId, EItemProgressStatus.Cancelled, 1);\r\n resolve(fail(\"Cancelled\"));\r\n return;\r\n }\r\n\r\n const itemHandler = moduleMap[itemType];\r\n if (!itemHandler || itemHandler === UNSUPPORTED) {\r\n if (itemHandler === UNSUPPORTED) {\r\n itemProgressCallback(itemId, EItemProgressStatus.Ignored, 1);\r\n resolve([]);\r\n } else {\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n placeholder.properties[\"failed\"] = true;\r\n replaceTemplate(existingTemplates, itemId, placeholder);\r\n resolve(\r\n fail(\r\n \"The type of AGO item \" +\r\n itemId +\r\n \" ('\" +\r\n itemType +\r\n \"') is not supported at this time\"\r\n )\r\n );\r\n }\r\n } else {\r\n // Handle original Story Maps with next-gen Story Maps\r\n /* istanbul ignore else */\r\n /* Not yet supported\r\n if (storyMap.isAStoryMap(itemType, itemInfo.url)) {\r\n itemHandler = storyMap;\r\n } */\r\n\r\n // Delegate the creation of the item to the handler\r\n itemHandler\r\n .convertItemToTemplate(\r\n solutionItemId,\r\n itemInfo,\r\n destAuthentication,\r\n srcAuthentication,\r\n templateDictionary\r\n )\r\n .then(\r\n itemTemplate => {\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n getItemResourcesPaths(\r\n itemTemplate,\r\n solutionItemId,\r\n srcAuthentication,\r\n SolutionTemplateFormatVersion\r\n ).then((resourceItemFilePaths: ISourceFileCopyPath[]) => {\r\n itemTemplate.item.thumbnail = null; // not needed in this property; handled as a resource\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n getItemResourcesFilesFromPaths(\r\n resourceItemFilePaths,\r\n srcAuthentication\r\n ).then((resourceItemFiles: ISourceFile[]) => {\r\n // update the template's resources\r\n itemTemplate.resources = itemTemplate.resources.concat(\r\n resourceItemFiles.map(\r\n (file: ISourceFile) =>\r\n file.folder + \"/\" + file.filename\r\n )\r\n );\r\n\r\n // Set the value keyed by the id to the created template, replacing the placeholder template\r\n replaceTemplate(\r\n existingTemplates,\r\n itemTemplate.itemId,\r\n itemTemplate\r\n );\r\n\r\n // Trace item dependencies\r\n if (itemTemplate.dependencies.length === 0) {\r\n itemProgressCallback(\r\n itemId,\r\n EItemProgressStatus.Finished,\r\n 1\r\n );\r\n resolve(resourceItemFiles);\r\n } else {\r\n // Get its dependencies, asking each to get its dependents via\r\n // recursive calls to this function\r\n const dependentDfds: Array<Promise<\r\n ISourceFile[]\r\n >> = [];\r\n itemTemplate.dependencies.forEach(dependentId => {\r\n if (\r\n !findTemplateInList(\r\n existingTemplates,\r\n dependentId\r\n )\r\n ) {\r\n dependentDfds.push(\r\n createItemTemplate(\r\n solutionItemId,\r\n dependentId,\r\n templateDictionary,\r\n srcAuthentication,\r\n destAuthentication,\r\n existingTemplates,\r\n itemProgressCallback\r\n )\r\n );\r\n }\r\n });\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all(dependentDfds).then(\r\n (dependentResourceItemFiles: ISourceFile[][]) => {\r\n // Templatization of item and its dependencies done\r\n itemProgressCallback(\r\n itemId,\r\n EItemProgressStatus.Finished,\r\n 1\r\n );\r\n resourceItemFiles = dependentResourceItemFiles.reduce(\r\n (accumulator, currentValue) =>\r\n accumulator.concat(currentValue),\r\n resourceItemFiles\r\n );\r\n resolve(resourceItemFiles);\r\n }\r\n );\r\n }\r\n });\r\n });\r\n },\r\n error => {\r\n placeholder.properties[\"error\"] = JSON.stringify(error);\r\n replaceTemplate(existingTemplates, itemId, placeholder);\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n resolve([]);\r\n }\r\n );\r\n }\r\n },\r\n // Id not found or item is not accessible\r\n () => {\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n itemProgressCallback(itemId, EItemProgressStatus.Failed, 1);\r\n resolve([]);\r\n }\r\n );\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Templatizes field references within specific template types.\r\n * Currently only handles web applications\r\n *\r\n * @param templates List of solution templates\r\n * @returns A list of templates that have templatized field references\r\n */\r\nexport function postProcessFieldReferences(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n const datasourceInfos: IDatasourceInfo[] = _getDatasourceInfos(templates);\r\n const templateTypeHash: any = _getTemplateTypeHash(templates);\r\n\r\n return templates.map(template => {\r\n /* istanbul ignore else */\r\n if (\r\n template.type === \"Web Mapping Application\" ||\r\n template.type === \"Dashboard\" ||\r\n template.type === \"Web Map\"\r\n ) {\r\n const webMapFSDependencies: string[] = _getWebMapFSDependencies(\r\n template,\r\n templateTypeHash\r\n );\r\n const itemHandler: any = moduleMap[template.item.type];\r\n /* istanbul ignore else */\r\n if (itemHandler) {\r\n const dependencies: string[] = webMapFSDependencies.concat(\r\n template.dependencies\r\n );\r\n let dependantDatasources: IDatasourceInfo[] = datasourceInfos.filter(\r\n ds => {\r\n if (dependencies.indexOf(ds.itemId) > -1) {\r\n return ds;\r\n }\r\n }\r\n );\r\n dependantDatasources = _addMapLayerIds(\r\n dependantDatasources,\r\n templateTypeHash\r\n );\r\n if (dependantDatasources.length > 0) {\r\n template = itemHandler.postProcessFieldReferences(\r\n template,\r\n dependantDatasources,\r\n template.item.type\r\n );\r\n }\r\n }\r\n }\r\n return template;\r\n });\r\n}\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Get common properties that will support the templatization of field references\r\n *\r\n * @param templates List of solution templates\r\n * @returns A list of IDataSourceInfo objects with key properties\r\n * @private\r\n */\r\nexport function _getDatasourceInfos(\r\n templates: IItemTemplate[]\r\n): IDatasourceInfo[] {\r\n const datasourceInfos: IDatasourceInfo[] = [];\r\n templates.forEach(t => {\r\n if (t.type === \"Feature Service\") {\r\n const layers: any[] = getProp(t, \"properties.layers\") || [];\r\n const tables: any[] = getProp(t, \"properties.tables\") || [];\r\n const layersAndTables: any[] = layers.concat(tables);\r\n layersAndTables.forEach(obj => {\r\n /* istanbul ignore else */\r\n if (!hasDatasource(datasourceInfos, t.itemId, obj.id)) {\r\n datasourceInfos.push({\r\n itemId: t.itemId,\r\n layerId: obj.id,\r\n fields: obj.fields,\r\n basePath: t.itemId + \".layer\" + obj.id + \".fields\",\r\n url: getProp(t, \"item.url\"),\r\n ids: [],\r\n relationships: obj.relationships || [],\r\n adminLayerInfo: obj.adminLayerInfo || {}\r\n });\r\n }\r\n });\r\n }\r\n });\r\n return datasourceInfos;\r\n}\r\n\r\n/**\r\n * Creates a simple lookup object to quickly understand an items type and dependencies\r\n * and associated web map layer ids based on itemId\r\n *\r\n * @param templates List of solution templates\r\n * @returns The lookup object with type, dependencies, and webmap layer info\r\n * @private\r\n */\r\nexport function _getTemplateTypeHash(templates: IItemTemplate[]): any {\r\n const templateTypeHash: any = {};\r\n templates.forEach(template => {\r\n templateTypeHash[template.itemId] = {\r\n type: template.type,\r\n dependencies: template.dependencies\r\n };\r\n if (template.type === \"Web Map\") {\r\n _updateWebMapHashInfo(template, templateTypeHash[template.itemId]);\r\n }\r\n });\r\n return templateTypeHash;\r\n}\r\n\r\n/**\r\n * Updates the lookup object with webmap layer info\r\n * so we can know the id used within a map for a given feature service\r\n *\r\n * @param template A webmap solution template\r\n * @returns The lookup object with webmap layer info added\r\n * @private\r\n */\r\nexport function _updateWebMapHashInfo(template: IItemTemplate, hashItem: any) {\r\n const operationalLayers: any[] =\r\n getProp(template, \"data.operationalLayers\") || [];\r\n\r\n const tables: any[] = getProp(template, \"data.tables\") || [];\r\n const layersAndTables: any[] = operationalLayers.concat(tables);\r\n if (layersAndTables && layersAndTables.length > 0) {\r\n hashItem.layersAndTables = [];\r\n layersAndTables.forEach(layer => {\r\n const obj: any = {};\r\n let itemId: any;\r\n /* istanbul ignore else */\r\n if (layer.itemId) {\r\n itemId = layer.itemId;\r\n }\r\n /* istanbul ignore else */\r\n if (itemId) {\r\n obj[cleanLayerBasedItemId(itemId)] = {\r\n id: layer.id,\r\n url: layer.url\r\n };\r\n hashItem.layersAndTables.push(obj);\r\n }\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Updates a templatized datasource URL with a layer id.\r\n *\r\n * @param dataSourceUrl Templatized datasource URL\r\n * @param layerId Layer id\r\n * @returns string Amended datasource URL\r\n * @private\r\n */\r\nexport function _addLayerIdToDatasourceUrl(\r\n datasourceUrl?: string,\r\n layerId?: any\r\n): string {\r\n return datasourceUrl && !isNaN(layerId)\r\n ? datasourceUrl.replace(/[.]/, \".layer\" + layerId + \".\")\r\n : \"\";\r\n}\r\n\r\n/**\r\n * Updates the datasource info objects by passing the webmap layer IDs from the lookup hash\r\n * to the underlying feature service datasource infos\r\n *\r\n * @param datasourceInfos A webmap solution template\r\n * @param templateTypeHash A simple lookup object populated with key item info\r\n * @returns The updated datasource infos\r\n * @private\r\n */\r\nexport function _addMapLayerIds(\r\n datasourceInfos: IDatasourceInfo[],\r\n templateTypeHash: any\r\n): IDatasourceInfo[] {\r\n const webMapIds: any[] = Object.keys(templateTypeHash).filter(k => {\r\n if (templateTypeHash[k].type === \"Web Map\") {\r\n return templateTypeHash[k];\r\n }\r\n });\r\n\r\n return datasourceInfos.map(ds => {\r\n webMapIds.forEach(webMapId => {\r\n templateTypeHash[webMapId].layersAndTables.forEach((opLayer: any) => {\r\n const opLayerInfo: any = opLayer[ds.itemId];\r\n const url: string = _addLayerIdToDatasourceUrl(ds.url, ds.layerId);\r\n if (\r\n opLayerInfo &&\r\n url === opLayerInfo.url &&\r\n ds.ids.indexOf(opLayerInfo.id) < 0\r\n ) {\r\n ds.ids.push(opLayerInfo.id);\r\n }\r\n });\r\n });\r\n return ds;\r\n });\r\n}\r\n\r\n/**\r\n * Get feature service item IDs from applications webmaps\r\n * As they are not explict dependencies of the application but are needed for field references\r\n *\r\n * @param template A webmap solution template\r\n * @param templateTypeHash A simple lookup object populated with key item info\r\n * @returns A lsit of feature service item IDs\r\n * @private\r\n */\r\nexport function _getWebMapFSDependencies(\r\n template: IItemTemplate,\r\n templateTypeHash: any\r\n): string[] {\r\n const webMapFSDependencies: string[] = [];\r\n template.dependencies.forEach(dep => {\r\n const depObj: any = templateTypeHash[dep];\r\n if (depObj.type === \"Web Map\") {\r\n depObj.dependencies.forEach((depObjDependency: string) => {\r\n /* istanbul ignore else */\r\n if (templateTypeHash[depObjDependency].type === \"Feature Service\") {\r\n webMapFSDependencies.push(depObjDependency);\r\n }\r\n });\r\n }\r\n });\r\n return webMapFSDependencies;\r\n}\r\n","/** @license\r\n * Copyright 2020 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\nimport {\r\n SolutionTemplateFormatVersion,\r\n EItemProgressStatus,\r\n failWithIds,\r\n getIDs,\r\n getPortal,\r\n getTemplateById,\r\n globalStringReplace,\r\n ICreateSolutionOptions,\r\n IItemProgressCallback,\r\n IItemTemplate,\r\n IItemUpdate,\r\n ISolutionItemData,\r\n ISourceFile,\r\n isWorkforceProject,\r\n removeTemplate,\r\n replaceInTemplate,\r\n SItemProgressStatus,\r\n copyFilesToStorageItem,\r\n postProcessWorkforceTemplates,\r\n updateItem,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { getProp, getWithDefault } from \"@esri/hub-common\";\r\nimport {\r\n createItemTemplate,\r\n postProcessFieldReferences\r\n} from \"../createItemTemplate\";\r\n\r\n/**\r\n * Adds a list of AGO item ids to a solution item.\r\n *\r\n * @param solutionItemId AGO id of solution to receive items\r\n * @param options Customizations for creating the solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @returns A promise that resolves with the AGO id of the updated solution\r\n * @internal\r\n */\r\nexport function addContentToSolution(\r\n solutionItemId: string,\r\n options: ICreateSolutionOptions,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession\r\n): Promise<string> {\r\n return new Promise((resolve, reject) => {\r\n if (!options.itemIds || options.itemIds.length === 0) {\r\n resolve(solutionItemId);\r\n return;\r\n }\r\n\r\n // Prepare feedback mechanism\r\n let totalEstimatedCost = 2 * options.itemIds.length + 1; // solution items, plus avoid divide by 0\r\n let percentDone: number = 16; // allow for previous creation work\r\n let progressPercentStep = (95 - percentDone) / totalEstimatedCost; // leave some % for caller for wrapup\r\n\r\n const failedItemIds: string[] = [];\r\n let totalExpended = 0;\r\n let statusOK = true;\r\n const itemProgressCallback: IItemProgressCallback = (\r\n itemId: string,\r\n status: EItemProgressStatus,\r\n costUsed: number\r\n ) => {\r\n // ---------------------------------------------------------------------------------------------------------------\r\n if (options.itemIds.indexOf(itemId) < 0) {\r\n // New item--a dependency that wasn't in the supplied list of itemIds; add it to the list\r\n // and recalculate the progress percent step based on how much progress remains to be done\r\n options.itemIds.push(itemId);\r\n\r\n totalEstimatedCost += 2;\r\n progressPercentStep =\r\n (95 - percentDone) / (totalEstimatedCost - totalExpended);\r\n }\r\n\r\n totalExpended += costUsed;\r\n percentDone += progressPercentStep * costUsed;\r\n if (options.progressCallback) {\r\n options.progressCallback(Math.round(percentDone), options.jobId);\r\n }\r\n\r\n /* istanbul ignore if */\r\n if (options.consoleProgress) {\r\n console.log(\r\n Date.now(),\r\n itemId,\r\n options.jobId ?? \"\",\r\n SItemProgressStatus[status],\r\n percentDone.toFixed(0) + \"%\",\r\n costUsed\r\n );\r\n }\r\n\r\n if (status === EItemProgressStatus.Failed) {\r\n let error = \"\";\r\n solutionTemplates.some(t => {\r\n /* istanbul ignore else */\r\n if (t.itemId === itemId) {\r\n /* istanbul ignore else */\r\n if (getProp(t, \"properties.error\")) {\r\n error = t.properties.error;\r\n try {\r\n // parse for better console logging if we can\r\n error = JSON.parse(error);\r\n } catch (e) {\r\n /* istanbul ignore next */\r\n // do nothing and show the error as is\r\n }\r\n }\r\n return true;\r\n }\r\n });\r\n removeTemplate(solutionTemplates, itemId);\r\n if (failedItemIds.indexOf(itemId) < 0) {\r\n failedItemIds.push(itemId);\r\n }\r\n statusOK = false;\r\n } else if (status === EItemProgressStatus.Ignored) {\r\n removeTemplate(solutionTemplates, itemId);\r\n }\r\n\r\n return statusOK;\r\n // ---------------------------------------------------------------------------------------------------------------\r\n };\r\n\r\n // Replacement dictionary and created templates\r\n const templateDictionary = options.templateDictionary ?? {};\r\n let solutionTemplates: IItemTemplate[] = [];\r\n\r\n // Handle a list of one or more AGO ids by stepping through the list\r\n // and calling this function recursively\r\n const getItemsPromise: Array<Promise<ISourceFile[]>> = [];\r\n options.itemIds.forEach(itemId => {\r\n const createDef = createItemTemplate(\r\n solutionItemId,\r\n itemId,\r\n templateDictionary,\r\n srcAuthentication,\r\n destAuthentication,\r\n solutionTemplates,\r\n itemProgressCallback\r\n );\r\n getItemsPromise.push(createDef);\r\n });\r\n\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n Promise.all(getItemsPromise).then(\r\n (multipleResourceItemFiles: ISourceFile[][]) => {\r\n if (failedItemIds.length > 0) {\r\n reject(\r\n failWithIds(\r\n failedItemIds,\r\n \"One or more items cannot be converted into templates\"\r\n )\r\n );\r\n } else {\r\n if (solutionTemplates.length > 0) {\r\n // Coalesce the resource file paths from the created templates\r\n let resourceItemFiles: ISourceFile[] = multipleResourceItemFiles.reduce(\r\n (accumulator, currentValue) => accumulator.concat(currentValue),\r\n [] as ISourceFile[]\r\n );\r\n\r\n // test for and update group dependencies and other post-processing\r\n solutionTemplates = _postProcessGroupDependencies(\r\n solutionTemplates\r\n );\r\n solutionTemplates = postProcessWorkforceTemplates(\r\n solutionTemplates\r\n );\r\n\r\n // Filter out any resources from items that have been removed from the templates, such as\r\n // Living Atlas layers\r\n solutionTemplates = _postProcessIgnoredItems(solutionTemplates);\r\n const templateIds = solutionTemplates.map(\r\n template => template.itemId\r\n );\r\n\r\n // Coalesce the resource file paths from the created templates\r\n resourceItemFiles = resourceItemFiles.filter(file =>\r\n templateIds.includes(file.itemId)\r\n );\r\n\r\n // Send the accumulated resources to the solution item\r\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\r\n copyFilesToStorageItem(\r\n resourceItemFiles,\r\n solutionItemId,\r\n destAuthentication\r\n ).then(() => {\r\n _templatizeSolutionIds(solutionTemplates);\r\n _simplifyUrlsInItemDescriptions(solutionTemplates);\r\n _replaceDictionaryItemsInObject(\r\n templateDictionary,\r\n solutionTemplates\r\n );\r\n _templatizeOrgUrl(solutionTemplates, destAuthentication).then(\r\n solutionTemplates2 => {\r\n // Update solution item with its data JSON\r\n const solutionData: ISolutionItemData = {\r\n metadata: { version: SolutionTemplateFormatVersion },\r\n templates: options.templatizeFields\r\n ? postProcessFieldReferences(solutionTemplates2)\r\n : solutionTemplates2\r\n };\r\n const itemInfo: IItemUpdate = {\r\n id: solutionItemId,\r\n text: solutionData\r\n };\r\n updateItem(itemInfo, destAuthentication).then(() => {\r\n resolve(solutionItemId);\r\n }, reject);\r\n },\r\n reject\r\n );\r\n });\r\n } else {\r\n resolve(solutionItemId);\r\n }\r\n }\r\n }\r\n );\r\n });\r\n}\r\n\r\n// ------------------------------------------------------------------------------------------------------------------ //\r\n\r\n/**\r\n * Gets the dependencies of an item by merging its dependencies list with item references in template variables.\r\n *\r\n * @param template Template to examine\r\n * @returns List of dependency ids\r\n * @private\r\n */\r\nexport function _getDependencies(template: IItemTemplate): string[] {\r\n // Get all dependencies\r\n let deps = template.dependencies.concat(\r\n _getIdsOutOfTemplateVariables(\r\n _getTemplateVariables(JSON.stringify(template.data))\r\n )\r\n );\r\n\r\n // Remove duplicates and self-references\r\n deps.sort();\r\n deps = deps.filter((elem, index, array) => {\r\n if (elem === template.itemId) {\r\n return false;\r\n } else if (index > 0) {\r\n return elem !== array[index - 1];\r\n } else {\r\n return true;\r\n }\r\n });\r\n\r\n return deps;\r\n}\r\n\r\n/**\r\n * Extracts AGO ids out of template variables.\r\n *\r\n * @param variables List of template variables to examine\r\n * @returns List of AGO ids referenced in `variables`\r\n * @private\r\n */\r\nexport function _getIdsOutOfTemplateVariables(variables: string[]): string[] {\r\n return variables\r\n .map(variable => {\r\n const idList = variable.match(/[0-9A-F]{32}/i); // is it a guid?\r\n if (idList) {\r\n return idList[0];\r\n } else {\r\n return null;\r\n }\r\n })\r\n .filter(variable => !!variable);\r\n}\r\n\r\n/**\r\n * Creates a list of item URLs.\r\n *\r\n * @param templates Templates to check for URLs\r\n * @returns List of URLs\r\n * @private\r\n */\r\nexport function _getSolutionItemUrls(templates: IItemTemplate[]): string[][] {\r\n const solutionUrls: string[][] = [];\r\n templates.forEach(template => {\r\n /* istanbul ignore else */\r\n if (template.item.origUrl) {\r\n solutionUrls.push([template.itemId, template.item.origUrl]);\r\n }\r\n });\r\n return solutionUrls;\r\n}\r\n\r\n/**\r\n * Extracts template variables out of a string.\r\n *\r\n * @param text String to examine\r\n * @returns List of template variables found in string\r\n * @private\r\n */\r\nexport function _getTemplateVariables(text: string): string[] {\r\n return (text.match(/{{[a-z0-9.]*}}/gi) || []) // find variable\r\n .map(variable => variable.substring(2, variable.length - 2)); // remove \"{{\" & \"}}\"\r\n}\r\n\r\n/**\r\n * Update the items dependencies and groups arrays\r\n *\r\n * @param templates The array of templates to evaluate\r\n * @returns Updated version of the templates\r\n * @private\r\n */\r\nexport function _postProcessGroupDependencies(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n return templates.map((template: IItemTemplate) => {\r\n if (template.type === \"Group\") {\r\n const id: string = template.itemId;\r\n // remove group dependencies if we find a circular dependency with one of its items\r\n let removeDependencies: boolean = false;\r\n // before we remove update each dependants groups array\r\n template.dependencies.forEach(dependencyId => {\r\n const dependantTemplate: IItemTemplate = getTemplateById(\r\n templates,\r\n dependencyId\r\n );\r\n // Not all items shared to the group will exist in the templates array\r\n // i.e. Hub Initiative items or any other unsupported types\r\n if (dependantTemplate) {\r\n // check if the group is in the dependantTemplate's list of dependencies\r\n const gIndex = getWithDefault(\r\n dependantTemplate,\r\n \"dependencies\",\r\n []\r\n ).indexOf(id);\r\n\r\n /* istanbul ignore else */\r\n if (gIndex > -1) {\r\n removeDependencies = true;\r\n }\r\n // if the dependant template does not have the group id\r\n // in it's groups array, add it\r\n const groups = getWithDefault(dependantTemplate, \"groups\", []);\r\n if (groups.indexOf(id) === -1) {\r\n groups.push(id);\r\n dependantTemplate.groups = groups;\r\n }\r\n }\r\n });\r\n if (removeDependencies) {\r\n template.dependencies = [];\r\n }\r\n }\r\n return template;\r\n });\r\n}\r\n\r\n/**\r\n * Check for feature service items that have been flagged for invalid designations.\r\n * Remove templates that have invalid designations from the solution item and other item dependencies.\r\n * Clean up any references to items with invalid designations in the other templates.\r\n *\r\n * @param templates The array of templates to evaluate\r\n * @returns Updated version of the templates\r\n * @private\r\n */\r\nexport function _postProcessIgnoredItems(\r\n templates: IItemTemplate[]\r\n): IItemTemplate[] {\r\n // replace in template\r\n const updateDictionary: any = templates.reduce((result, template) => {\r\n return template.properties.hasInvalidDesignations\r\n ? Object.assign(result, template.data)\r\n : result;\r\n }, {});\r\n Object.keys(updateDictionary).forEach(k => {\r\n removeTemplate(templates, k);\r\n templates = templates.map(t => {\r\n t.dependencies = t.dependencies.filter(id => id !== k);\r\n return replaceInTemplate(t, updateDictionary);\r\n });\r\n });\r\n\r\n return templates;\r\n}\r\n\r\n/**\r\n * Recursively runs through an object to find and replace any strings found in a dictionary.\r\n *\r\n * @param templateDictionary Hash of things to be replaced\r\n * @param obj Object to be examined\r\n * @private\r\n */\r\nexport function _replaceDictionaryItemsInObject(hash: any, obj: any): any {\r\n /* istanbul ignore else */\r\n if (obj) {\r\n Object.keys(obj).forEach(prop => {\r\n const propObj = obj[prop];\r\n if (propObj) {\r\n if (typeof propObj === \"object\") {\r\n _replaceDictionaryItemsInObject(hash, propObj);\r\n } else if (typeof propObj === \"string\") {\r\n obj[prop] = hash[propObj] || propObj;\r\n }\r\n }\r\n });\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Recursively runs through an object to find and templatize any remaining references to solution's items.\r\n *\r\n * @param ids Ids to be replaced in strings found in object\r\n * @param obj Object to be examined\r\n * @private\r\n */\r\nexport function _replaceRemainingIdsInObject(ids: string[], obj: any): any {\r\n /* istanbul ignore else */\r\n if (obj) {\r\n Object.keys(obj).forEach(prop => {\r\n const propObj = obj[prop];\r\n if (propObj) {\r\n if (typeof propObj === \"object\") {\r\n _replaceRemainingIdsInObject(ids, propObj);\r\n } else if (typeof propObj === \"string\") {\r\n obj[prop] = _replaceRemainingIdsInString(ids, propObj);\r\n }\r\n }\r\n });\r\n }\r\n return obj;\r\n}\r\n\r\n/**\r\n * Templatizes ids from a list in a string if they're not already templatized.\r\n *\r\n * @param ids Ids to be replaced in source string\r\n * @param str Source string to be examined\r\n * @returns A copy of the source string with any templatization changes\r\n * @private\r\n */\r\nexport function _replaceRemainingIdsInString(\r\n ids: string[],\r\n str: string\r\n): string {\r\n let updatedStr = str;\r\n const untemplatizedIds = getIDs(str);\r\n if (untemplatizedIds.length > 0) {\r\n untemplatizedIds.forEach(id => {\r\n if (ids.includes(id)) {\r\n const re = new RegExp(\"({*)\" + id, \"gi\");\r\n updatedStr = updatedStr.replace(re, match =>\r\n match.indexOf(\"{{\") < 0\r\n ? \"{{\" + id.replace(\"{\", \"\") + \".itemId}}\"\r\n : match\r\n );\r\n }\r\n });\r\n }\r\n return updatedStr;\r\n}\r\n\r\n/**\r\n * Finds and templatizes any URLs in solution items' descriptions.\r\n *\r\n * @param templates The array of templates to evaluate, modified in place\r\n * @private\r\n */\r\nexport function _simplifyUrlsInItemDescriptions(\r\n templates: IItemTemplate[]\r\n): void {\r\n // Get the urls in the solution along with their item ids & convert the id into the form\r\n // \"{{fcb2bf2837a6404ebb418a1f805f976a.url}}\"\r\n const solutionUrls = _getSolutionItemUrls(templates).map(idUrl => [\r\n \"{{\" + idUrl[0] + \".url}}\",\r\n idUrl[1]\r\n ]);\r\n\r\n /* istanbul ignore else */\r\n if (solutionUrls.length > 0) {\r\n // Make the replacements\r\n templates.forEach(template => {\r\n solutionUrls.forEach(\r\n // TypeScript for es2015 doesn't have a definition for `replaceAll`\r\n idUrl => {\r\n /* istanbul ignore else */\r\n if (template.item.description) {\r\n template.item.description = (template.item\r\n .description as any).replaceAll(idUrl[1], idUrl[0]);\r\n }\r\n }\r\n );\r\n });\r\n }\r\n}\r\n\r\n/**\r\n * Templatizes occurrences of the URL to the user's organization in the `item` and `data` template sections.\r\n *\r\n * @param templates The array of templates to evaluate; templates is modified in place\r\n * @param destAuthentication Credentials for request organization info\r\n * @returns Promise resolving with `templates`\r\n * @private\r\n */\r\nexport function _templatizeOrgUrl(\r\n templates: IItemTemplate[],\r\n destAuthentication: UserSession\r\n): Promise<IItemTemplate[]> {\r\n return new Promise((resolve, reject) => {\r\n // Get the org's URL\r\n getPortal(null, destAuthentication).then(org => {\r\n const orgUrl = \"https://\" + org.urlKey + \".\" + org.customBaseUrl;\r\n const templatizedOrgUrl = \"{{portalBaseUrl}}\";\r\n\r\n // Cycle through each of the items in the template and scan the `item` and `data` sections of each for replacements\r\n templates.forEach((template: IItemTemplate) => {\r\n globalStringReplace(\r\n template.item,\r\n new RegExp(orgUrl, \"gi\"),\r\n templatizedOrgUrl\r\n );\r\n globalStringReplace(\r\n template.data,\r\n new RegExp(orgUrl, \"gi\"),\r\n templatizedOrgUrl\r\n );\r\n });\r\n resolve(templates);\r\n }, reject);\r\n });\r\n}\r\n\r\n/**\r\n * Finds and templatizes any references to solution's items.\r\n *\r\n * @param templates The array of templates to evaluate, modified in place\r\n * @private\r\n */\r\nexport function _templatizeSolutionIds(templates: IItemTemplate[]): void {\r\n // Get the ids in the solution\r\n const solutionIds: string[] = templates.map(\r\n (template: IItemTemplate) => template.itemId\r\n );\r\n\r\n // Cycle through each of the items in the template and\r\n // 1. templatize untemplatized ids in our solution in the `item` and `data` sections;\r\n // 2. update the `dependencies` section\r\n templates.forEach((template: IItemTemplate) => {\r\n _replaceRemainingIdsInObject(solutionIds, template.item);\r\n _replaceRemainingIdsInObject(solutionIds, template.data);\r\n /* istanbul ignore else */\r\n if (template.type !== \"Group\" && !isWorkforceProject(template)) {\r\n template.dependencies = _getDependencies(template);\r\n }\r\n });\r\n}\r\n","/** @license\r\n * Copyright 2018 Esri\r\n *\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n *\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n *\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\n\r\n/**\r\n * Manages the creation of a Solution item.\r\n *\r\n * @module creator\r\n */\r\n\r\nimport {\r\n appendQueryParam,\r\n createItemWithData,\r\n createLongId,\r\n createShortId,\r\n CURRENT_SCHEMA_VERSION,\r\n generateSourceThumbnailUrl,\r\n getBlobAsFile,\r\n getFilenameFromUrl,\r\n getGroupBase,\r\n getGroupContents,\r\n getItemBase,\r\n getPortal,\r\n getUser,\r\n getVelocityUrlBase,\r\n ICreateSolutionOptions,\r\n ISolutionItemData,\r\n IGroup,\r\n IItem,\r\n removeItem,\r\n sanitizeJSONAndReportChanges,\r\n setLocationTrackingEnabled,\r\n UserSession\r\n} from \"@esri/solution-common\";\r\nimport { failSafe, IModel } from \"@esri/hub-common\";\r\nimport { addContentToSolution } from \"./helpers/add-content-to-solution\";\r\n\r\n// Simple no-op to clean up progressCallback management\r\nconst noOp = () => {};\r\n\r\n/**\r\n * Creates a solution item.\r\n *\r\n * @param sourceId AGO id of group whose contents are to be added to solution or of an item to convert into a solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @param options Customizations for creating the solution\r\n * @returns A promise that resolves with the AGO id of the new solution\r\n */\r\nexport function createSolution(\r\n sourceId: string,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession,\r\n options?: ICreateSolutionOptions\r\n): Promise<string> {\r\n const createOptions: ICreateSolutionOptions = options || {};\r\n const progressCb = createOptions.progressCallback || noOp;\r\n createOptions.templateDictionary = Object.assign(\r\n {},\r\n createOptions.templateDictionary\r\n );\r\n\r\n progressCb(1); // let the caller know that we've started\r\n\r\n // Assume that source is a group and try to get group's information\r\n return Promise.all([\r\n getGroupBase(sourceId, srcAuthentication),\r\n getGroupContents(sourceId, srcAuthentication),\r\n getVelocityUrlBase(srcAuthentication, createOptions.templateDictionary)\r\n ])\r\n .then(\r\n // Group fetches worked; assumption was correct\r\n responses => {\r\n createOptions.itemIds = responses[1];\r\n progressCb(15);\r\n\r\n return new Promise<ICreateSolutionOptions>(resolve => {\r\n // Update the createOptions with values from the group\r\n resolve(\r\n _applySourceToCreateOptions(\r\n createOptions,\r\n responses[0],\r\n srcAuthentication,\r\n true\r\n )\r\n );\r\n });\r\n },\r\n\r\n // Assumption incorrect; try source as an item\r\n () => {\r\n return new Promise<ICreateSolutionOptions>((resolve, reject) => {\r\n createOptions.itemIds = [sourceId];\r\n getItemBase(sourceId, srcAuthentication).then(\r\n // Update the createOptions with values from the item\r\n itemBase =>\r\n resolve(\r\n _applySourceToCreateOptions(\r\n createOptions,\r\n itemBase,\r\n srcAuthentication,\r\n false\r\n )\r\n ),\r\n reject\r\n );\r\n });\r\n }\r\n )\r\n\r\n .then(createOptions => {\r\n return new Promise<ICreateSolutionOptions>((resolve, reject) => {\r\n Promise.all([\r\n getPortal(\"\", srcAuthentication),\r\n getUser(srcAuthentication)\r\n ]).then(responses => {\r\n // check tracking\r\n const [portalResponse, userResponse] = responses;\r\n setLocationTrackingEnabled(\r\n portalResponse,\r\n userResponse,\r\n createOptions.templateDictionary\r\n );\r\n resolve(createOptions);\r\n }, reject);\r\n });\r\n })\r\n\r\n .then(\r\n // Use a copy of the thumbnail rather than a URL to it\r\n createOptions => {\r\n return _addThumbnailFileToCreateOptions(\r\n createOptions,\r\n srcAuthentication\r\n );\r\n }\r\n )\r\n\r\n .then(\r\n // Create a solution\r\n createOptions => {\r\n return _createSolutionFromItemIds(\r\n createOptions,\r\n srcAuthentication,\r\n destAuthentication\r\n );\r\n }\r\n )\r\n\r\n .then(\r\n // Successfully created solution\r\n createdSolutionId => {\r\n progressCb(100); // finished\r\n return createdSolutionId;\r\n },\r\n\r\n // Error fetching group, group contents, or item, or error creating solution from ids\r\n error => {\r\n progressCb(1);\r\n console.error(error);\r\n throw error;\r\n }\r\n );\r\n}\r\n\r\n/**\r\n * Update the createOptions with the group properties\r\n *\r\n * @param createOptions\r\n * @param sourceInfo\r\n * @param authentication\r\n * @param isGroup Boolean to indicate if the files are associated with a group or item\r\n * @private\r\n */\r\nexport function _applySourceToCreateOptions(\r\n createOptions: ICreateSolutionOptions,\r\n sourceInfo: IGroup | IItem,\r\n srcAuthentication: UserSession,\r\n isGroup = false\r\n): ICreateSolutionOptions {\r\n // Create a solution from the group's or item's contents,\r\n // using the group's or item's information as defaults for the solution item\r\n [\"title\", \"snippet\", \"description\", \"tags\"].forEach(prop => {\r\n createOptions[prop] = createOptions[prop] ?? sourceInfo[prop];\r\n });\r\n\r\n if (!createOptions.thumbnailurl && sourceInfo.thumbnail) {\r\n // Get the full path to the thumbnail\r\n createOptions.thumbnailurl = generateSourceThumbnailUrl(\r\n srcAuthentication.portal,\r\n sourceInfo.id,\r\n sourceInfo.thumbnail,\r\n isGroup\r\n );\r\n delete sourceInfo.thumbnail;\r\n }\r\n\r\n return createOptions;\r\n}\r\n\r\n/**\r\n * Update the createOptions with the thumbnail file\r\n *\r\n * @param createOptions\r\n * @param srcAuthentication\r\n * @private\r\n */\r\nexport function _addThumbnailFileToCreateOptions(\r\n createOptions: ICreateSolutionOptions,\r\n srcAuthentication: UserSession\r\n): Promise<ICreateSolutionOptions> {\r\n return new Promise<ICreateSolutionOptions>(resolve => {\r\n if (!createOptions.thumbnail && createOptions.thumbnailurl) {\r\n // Figure out the thumbnail's filename\r\n const filename =\r\n getFilenameFromUrl(createOptions.thumbnailurl) || \"thumbnail\";\r\n const thumbnailurl = appendQueryParam(\r\n createOptions.thumbnailurl,\r\n \"w=400\"\r\n );\r\n delete createOptions.thumbnailurl;\r\n\r\n // Fetch the thumbnail\r\n getBlobAsFile(thumbnailurl, filename, srcAuthentication).then(\r\n thumbnail => {\r\n createOptions.thumbnail = thumbnail;\r\n resolve(createOptions);\r\n },\r\n () => {\r\n resolve(createOptions);\r\n }\r\n );\r\n } else {\r\n resolve(createOptions);\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Creates a solution item using a list of AGO item ids.\r\n *\r\n * @param options Customizations for creating the solution\r\n * @param srcAuthentication Credentials for requests to source items\r\n * @param destAuthentication Credentials for the requests to destination solution\r\n * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its\r\n * there is a problem updating it\r\n * @private\r\n */\r\nexport function _createSolutionFromItemIds(\r\n options: ICreateSolutionOptions,\r\n srcAuthentication: UserSession,\r\n destAuthentication: UserSession\r\n): Promise<string> {\r\n let solutionId = \"\";\r\n // Create a solution from the list of items\r\n return _createSolutionItem(destAuthentication, options)\r\n .then(id => {\r\n solutionId = id;\r\n // Add list of items to the new solution\r\n return addContentToSolution(\r\n solutionId,\r\n options,\r\n srcAuthentication,\r\n destAuthentication\r\n );\r\n })\r\n .catch(addError => {\r\n // If the solution item got created, delete it\r\n if (solutionId) {\r\n const failSafeRemove = failSafe(removeItem, { success: true });\r\n return failSafeRemove(solutionId, destAuthentication).then(() => {\r\n throw addError;\r\n });\r\n } else {\r\n throw addError;\r\n }\r\n });\r\n}\r\n\r\n/**\r\n * Creates an empty solution item.\r\n *\r\n * @param authentication Credentials for the request\r\n * @param options Customizations for creating the solution\r\n * @returns A promise that resolves with the AGO id of the new solution; solution item is deleted if its\r\n * there is a problem updating its thumbnail\r\n * @private\r\n */\r\nexport function _createSolutionItem(\r\n authentication: UserSession,\r\n options?: ICreateSolutionOptions\r\n): Promise<string> {\r\n const model = _createSolutionItemModel(options);\r\n\r\n // Create new solution item\r\n delete model.item.thumbnailurl;\r\n model.item.thumbnail = options?.thumbnail;\r\n return createItemWithData(\r\n model.item,\r\n model.data,\r\n authentication,\r\n options?.folderId\r\n ).then(createResponse => {\r\n return Promise.resolve(createResponse.id);\r\n });\r\n}\r\n\r\n/**\r\n * Create the Solution Item model to be used to create\r\n * the Solution Item itself\r\n *\r\n * @param options\r\n * @private\r\n */\r\nexport function _createSolutionItemModel(options: any): IModel {\r\n // Solution uses all supplied tags but for deploy.* tags; that information goes into properties\r\n const creationTags = options?.tags ?? [];\r\n\r\n const solutionItem: any = {\r\n type: \"Solution\",\r\n title: options?.title ?? createShortId(),\r\n snippet: options?.snippet ?? \"\",\r\n description: options?.description ?? \"\",\r\n properties: {\r\n schemaVersion: CURRENT_SCHEMA_VERSION\r\n },\r\n thumbnailurl: options?.thumbnailurl ?? \"\",\r\n tags: creationTags.filter((tag: any) => !tag.startsWith(\"deploy.\")),\r\n typeKeywords: [\"Solution\", \"Template\"].concat(\r\n _getDeploymentProperties(creationTags)\r\n )\r\n };\r\n\r\n // ensure that snippet and description are not nefarious\r\n const sanitizedItem = sanitizeJSONAndReportChanges(solutionItem);\r\n\r\n const addlKeywords = options?.additionalTypeKeywords || [];\r\n sanitizedItem.typeKeywords = [].concat(\r\n solutionItem.typeKeywords,\r\n addlKeywords\r\n );\r\n\r\n const solutionData: ISolutionItemData = {\r\n metadata: {},\r\n templates: []\r\n };\r\n return {\r\n item: sanitizedItem,\r\n data: solutionData\r\n };\r\n}\r\n\r\n/**\r\n * Gets the deploy.id and deploy.version tag values.\r\n *\r\n * @param tags A list of item tags\r\n * @returns A list containing the two values found in the tags, or defaulting to a new GUID and \"1.0\", respectively,\r\n * as needed\r\n * @private\r\n */\r\nexport function _getDeploymentProperties(tags: string[]): string[] {\r\n return [\r\n \"solutionid-\" +\r\n (_getDeploymentProperty(\"deploy.id.\", tags) ?? createLongId()),\r\n \"solutionversion-\" +\r\n (_getDeploymentProperty(\"deploy.version.\", tags) ?? \"1.0\")\r\n ];\r\n}\r\n\r\n/**\r\n * Searches for a tag that has the specified prefix and returns the rest of the tag following that prefix.\r\n *\r\n * @param desiredTagPrefix Tag prefix to look for\r\n * @param tags A list of item tags\r\n * @returns The extracted value of the first matching tag or null if a tag with the specified prefix is not found\r\n * @private\r\n */\r\nexport function _getDeploymentProperty(\r\n desiredTagPrefix: string,\r\n tags: string[]\r\n): string | null {\r\n const foundTagAsList = tags.filter(tag => tag.startsWith(desiredTagPrefix));\r\n if (foundTagAsList.length > 0) {\r\n return foundTagAsList[0].substr(desiredTagPrefix.length);\r\n } else {\r\n return null;\r\n }\r\n}\r\n"],"names":["UNSUPPORTED","moduleMap","Group","VelocityProcessor","simpleTypes","featureLayer","Feed","undefined","KML","Tool","WFS","WMS","WMTS","Application","Dashboard","Form","formProcessor","HubPageProcessor","HubSiteProcessor","Mission","Notebook","notebookProcessor","quickcaptureProcessor","Solution","StoryMap","StoryMapProcessor","WebExperienceProcessor","fileProcessor","CSV","GeoJson","GeoPackage","Image","Layer","Layout","netCDF","PDF","Shapefile","Style","Undefined","Unsupported","createItemTemplate","solutionItemId","itemId","templateDictionary","srcAuthentication","destAuthentication","existingTemplates","itemProgressCallback","Promise","resolve","findTemplateInList","push","createPlaceholderTemplate","EItemProgressStatus","Started","getItemBase","catch","replaceTemplate","getGroupBase","then","itemInfo","sanitizeJSONAndReportChanges","url","id","origUrl","idTest","Array","isArray","typeKeywords","filter","v","test","tags","placeholder","itemType","type","item","Created","Cancelled","fail","itemHandler","convertItemToTemplate","itemTemplate","getItemResourcesPaths","SolutionTemplateFormatVersion","resourceItemFilePaths","thumbnail","getItemResourcesFilesFromPaths","resourceItemFiles","resources","concat","map","file","folder","filename","dependencies","length","Finished","dependentDfds","forEach","dependentId","all","dependentResourceItemFiles","reduce","accumulator","currentValue","error","properties","JSON","stringify","Failed","Ignored","postProcessFieldReferences","templates","datasourceInfos","_getDatasourceInfos","templateTypeHash","_getTemplateTypeHash","template","webMapFSDependencies","_getWebMapFSDependencies","dependantDatasources","ds","indexOf","_addMapLayerIds","t","layers","getProp","tables","obj","hasDatasource","layerId","fields","basePath","ids","relationships","adminLayerInfo","_updateWebMapHashInfo","hashItem","operationalLayers","layersAndTables","layer","cleanLayerBasedItemId","_addLayerIdToDatasourceUrl","datasourceUrl","isNaN","replace","webMapIds","Object","keys","k","webMapId","opLayer","opLayerInfo","dep","depObj","depObjDependency","addContentToSolution","options","reject","itemIds","totalEstimatedCost","percentDone","progressPercentStep","failedItemIds","totalExpended","statusOK","status","costUsed","progressCallback","Math","round","jobId","consoleProgress","console","log","Date","now","SItemProgressStatus","toFixed","solutionTemplates","some","parse","e","removeTemplate","getItemsPromise","createDef","multipleResourceItemFiles","failWithIds","removeDependencies","dependencyId","dependantTemplate","getTemplateById","getWithDefault","groups","postProcessWorkforceTemplates","updateDictionary","result","hasInvalidDesignations","assign","data","replaceInTemplate","_postProcessIgnoredItems","templateIds","includes","copyFilesToStorageItem","solutionIds","_replaceRemainingIdsInObject","isWorkforceProject","deps","text","variables","match","variable","substring","idList","sort","elem","index","array","_getDependencies","_templatizeSolutionIds","solutionUrls","_getSolutionItemUrls","idUrl","description","replaceAll","_simplifyUrlsInItemDescriptions","_replaceDictionaryItemsInObject","getPortal","org","orgUrl","urlKey","customBaseUrl","templatizedOrgUrl","globalStringReplace","RegExp","_templatizeOrgUrl","solutionTemplates2","solutionData","metadata","version","templatizeFields","updateItem","hash","prop","propObj","str","updatedStr","untemplatizedIds","getIDs","re","_replaceRemainingIdsInString","noOp","_applySourceToCreateOptions","createOptions","sourceInfo","isGroup","thumbnailurl","generateSourceThumbnailUrl","portal","_addThumbnailFileToCreateOptions","getFilenameFromUrl","appendQueryParam","getBlobAsFile","_createSolutionFromItemIds","solutionId","_createSolutionItem","addError","failSafe","removeItem","success","failSafeRemove","authentication","model","_createSolutionItemModel","createItemWithData","folderId","createResponse","creationTags","solutionItem","title","createShortId","snippet","schemaVersion","CURRENT_SCHEMA_VERSION","tag","startsWith","_getDeploymentProperties","sanitizedItem","addlKeywords","additionalTypeKeywords","_getDeploymentProperty","createLongId","desiredTagPrefix","foundTagAsList","substr","sourceId","progressCb","getGroupContents","getVelocityUrlBase","responses","itemBase","getUser","portalResponse","userResponse","setLocationTrackingEnabled","createdSolutionId"],"mappings":";;;;;;;;;;;;;;;;;y6CA+BaA,EAA6B,KAO7BC,EAAgC,CAG3CC,WAIA,oBAAqBC,oBACrB,qBAAsBC,cACtB,kBAAmBC,EACnBC,KAAMH,oBACN,yBAAqBI,EACrB,uBAAmBA,EACnB,wBAAoBA,EACpB,6BAAyBA,EACzB,qBAAiBA,EACjB,qBAAiBA,EACjBC,SAAKD,EACL,cAAeF,EACf,gCAA4BE,EAC5B,qBAAsBJ,oBACtB,sCAAkCI,EAClC,qBAAiBA,EACjB,sBAAkBA,EAClBE,UAAMF,EACN,2BAAuBA,EACvBG,SAAKH,EACLI,SAAKJ,EACLK,UAAML,EACN,gCAA4BA,EAI5B,oBAAgBA,EAChB,UAAWH,cACX,YAAaA,cAIbS,iBAAaN,EACbO,UAAWV,cACX,kBAAcG,EACd,2BAAuBA,EACvB,iCAA6BA,EAC7BQ,KAAMC,EACN,iBAAkBhB,EAClB,WAAYiB,mBACZ,uBAAwBC,mBACxB,iBAAkBd,cAClB,qBAAiBG,EACjB,sBAAkB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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@esri/solution-creator",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "Manages the creation of a Solution item for @esri/solution.js.",
|
|
5
5
|
"main": "dist/node/index.js",
|
|
6
6
|
"unpkg": "dist/umd/creator.umd.min.js",
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
"@esri/arcgis-rest-portal": "3.4.3",
|
|
19
19
|
"@esri/arcgis-rest-request": "3.4.3",
|
|
20
20
|
"@esri/arcgis-rest-service-admin": "3.4.3",
|
|
21
|
-
"@esri/hub-common": "
|
|
22
|
-
"@esri/hub-initiatives": "
|
|
23
|
-
"@esri/hub-sites": "
|
|
24
|
-
"@esri/hub-teams": "
|
|
25
|
-
"rollup": "2.
|
|
21
|
+
"@esri/hub-common": "^10.0.0-next.3",
|
|
22
|
+
"@esri/hub-initiatives": "^10.0.0-next.3",
|
|
23
|
+
"@esri/hub-sites": "^10.0.0-next.3",
|
|
24
|
+
"@esri/hub-teams": "^10.0.0-next.3",
|
|
25
|
+
"rollup": "2.66.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"@esri/arcgis-rest-auth": "3.4.3",
|
|
@@ -30,22 +30,22 @@
|
|
|
30
30
|
"@esri/arcgis-rest-portal": "3.4.3",
|
|
31
31
|
"@esri/arcgis-rest-request": "3.4.3",
|
|
32
32
|
"@esri/arcgis-rest-service-admin": "3.4.3",
|
|
33
|
-
"@esri/hub-common": "
|
|
34
|
-
"@esri/hub-initiatives": "
|
|
35
|
-
"@esri/hub-sites": "
|
|
36
|
-
"@esri/hub-teams": "
|
|
33
|
+
"@esri/hub-common": "^10.0.0-next.3",
|
|
34
|
+
"@esri/hub-initiatives": "^10.0.0-next.3",
|
|
35
|
+
"@esri/hub-sites": "^10.0.0-next.3",
|
|
36
|
+
"@esri/hub-teams": "^10.0.0-next.3"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@esri/solution-common": "^1.
|
|
40
|
-
"@esri/solution-feature-layer": "^1.
|
|
41
|
-
"@esri/solution-file": "^1.
|
|
42
|
-
"@esri/solution-form": "^1.
|
|
43
|
-
"@esri/solution-group": "^1.
|
|
44
|
-
"@esri/solution-hub-types": "^1.
|
|
45
|
-
"@esri/solution-simple-types": "^1.
|
|
46
|
-
"@esri/solution-storymap": "^1.
|
|
47
|
-
"@esri/solution-velocity": "^1.
|
|
48
|
-
"@esri/solution-web-experience": "^1.
|
|
39
|
+
"@esri/solution-common": "^1.4.1",
|
|
40
|
+
"@esri/solution-feature-layer": "^1.4.1",
|
|
41
|
+
"@esri/solution-file": "^1.4.1",
|
|
42
|
+
"@esri/solution-form": "^1.4.1",
|
|
43
|
+
"@esri/solution-group": "^1.4.1",
|
|
44
|
+
"@esri/solution-hub-types": "^1.4.1",
|
|
45
|
+
"@esri/solution-simple-types": "^1.4.1",
|
|
46
|
+
"@esri/solution-storymap": "^1.4.1",
|
|
47
|
+
"@esri/solution-velocity": "^1.4.1",
|
|
48
|
+
"@esri/solution-web-experience": "^1.4.1",
|
|
49
49
|
"tslib": "1.14.1"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"esri",
|
|
100
100
|
"ES6"
|
|
101
101
|
],
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "71006b142f9473cdd1b4a8b9fad0d6bfe50e12bd"
|
|
103
103
|
}
|